From owner-svn-src-stable-8@FreeBSD.ORG Sun Dec 6 01:45:55 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A633106566C; Sun, 6 Dec 2009 01:45:55 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 866DE8FC0A; Sun, 6 Dec 2009 01:45:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB61jtkU006472; Sun, 6 Dec 2009 01:45:55 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB61jtQV006465; Sun, 6 Dec 2009 01:45:55 GMT (envelope-from np@svn.freebsd.org) Message-Id: <200912060145.nB61jtQV006465@svn.freebsd.org> From: Navdeep Parhar Date: Sun, 6 Dec 2009 01:45:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200175 - in stable/8/sys/dev/cxgb: . common X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Dec 2009 01:45:55 -0000 Author: np Date: Sun Dec 6 01:45:55 2009 New Revision: 200175 URL: http://svn.freebsd.org/changeset/base/200175 Log: MFC r199237, r199238, r199239, r199240, r200003 r199237: sc->rev and is_offload(sc) will always be 0 during probe. Wait till attach to get correct values. r199238: Make sure *some* edc is setup even for an unknown transceiver (assume it is optical). r199239: The 10GBASE-T card should use an IPG of 1. Also enable the check for low power startup on this card. r199240: Don't disable the XGMAC's tx on ifconfig down. It is unnecessary and can cause false backpressure in the chip. Fix a us/ms mixup while here. r200003: T3 firmware 7.8.0 for cxgb(4) Modified: stable/8/sys/dev/cxgb/common/cxgb_ael1002.c stable/8/sys/dev/cxgb/common/cxgb_aq100x.c stable/8/sys/dev/cxgb/common/cxgb_common.h stable/8/sys/dev/cxgb/common/cxgb_xgmac.c stable/8/sys/dev/cxgb/cxgb_main.c stable/8/sys/dev/cxgb/cxgb_t3fw.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/cxgb/common/cxgb_ael1002.c ============================================================================== --- stable/8/sys/dev/cxgb/common/cxgb_ael1002.c Sun Dec 6 01:29:49 2009 (r200174) +++ stable/8/sys/dev/cxgb/common/cxgb_ael1002.c Sun Dec 6 01:45:55 2009 (r200175) @@ -1270,7 +1270,7 @@ static int ael2005_reset(struct cphy *ph return err; phy->modtype = (u8)err; - if (err == phy_modtype_none || err == phy_modtype_unknown) + if (err == phy_modtype_none) err = 0; else if (err == phy_modtype_twinax || err == phy_modtype_twinax_long) err = ael2005_setup_twinax_edc(phy, err); @@ -1981,7 +1981,7 @@ static int ael2020_reset(struct cphy *ph if (err < 0) return err; phy->modtype = (u8)err; - if (err == phy_modtype_none || err == phy_modtype_unknown) + if (err == phy_modtype_none) err = 0; else if (err == phy_modtype_twinax || err == phy_modtype_twinax_long) err = ael2020_setup_twinax_edc(phy, err); Modified: stable/8/sys/dev/cxgb/common/cxgb_aq100x.c ============================================================================== --- stable/8/sys/dev/cxgb/common/cxgb_aq100x.c Sun Dec 6 01:29:49 2009 (r200174) +++ stable/8/sys/dev/cxgb/common/cxgb_aq100x.c Sun Dec 6 01:45:55 2009 (r200175) @@ -515,13 +515,11 @@ t3_aq100x_phy_prep(pinfo_t *pinfo, int p CH_WARN(adapter, "PHY%d: unknown firmware %d.%d\n", phy_addr, v >> 8, v & 0xff); -#if 0 /* The PHY should start in really-low-power mode. */ (void) mdio_read(phy, MDIO_DEV_PMA_PMD, MII_BMCR, &v); if ((v & BMCR_PDOWN) == 0) CH_WARN(adapter, "PHY%d does not start in low power mode.\n", phy_addr); -#endif /* * Verify XAUI and 1000-X settings, but let prep succeed no matter what. Modified: stable/8/sys/dev/cxgb/common/cxgb_common.h ============================================================================== --- stable/8/sys/dev/cxgb/common/cxgb_common.h Sun Dec 6 01:29:49 2009 (r200174) +++ stable/8/sys/dev/cxgb/common/cxgb_common.h Sun Dec 6 01:45:55 2009 (r200175) @@ -97,7 +97,7 @@ enum { enum { FW_VERSION_MAJOR = 7, - FW_VERSION_MINOR = 7, + FW_VERSION_MINOR = 8, FW_VERSION_MICRO = 0 }; Modified: stable/8/sys/dev/cxgb/common/cxgb_xgmac.c ============================================================================== --- stable/8/sys/dev/cxgb/common/cxgb_xgmac.c Sun Dec 6 01:29:49 2009 (r200174) +++ stable/8/sys/dev/cxgb/common/cxgb_xgmac.c Sun Dec 6 01:45:55 2009 (r200175) @@ -508,7 +508,7 @@ int t3_mac_set_mtu(struct cmac *mac, uns thres /= 10; thres = mtu > thres ? (mtu - thres + 7) / 8 : 0; thres = max(thres, 8U); /* need at least 8 */ - ipg = (adap->params.rev == T3_REV_C) ? 0 : 1; + ipg = (port_type == 9 || adap->params.rev != T3_REV_C) ? 1 : 0; t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset, V_TXFIFOTHRESH(M_TXFIFOTHRESH) | V_TXIPG(M_TXIPG), V_TXFIFOTHRESH(thres) | V_TXIPG(ipg)); Modified: stable/8/sys/dev/cxgb/cxgb_main.c ============================================================================== --- stable/8/sys/dev/cxgb/cxgb_main.c Sun Dec 6 01:29:49 2009 (r200174) +++ stable/8/sys/dev/cxgb/cxgb_main.c Sun Dec 6 01:45:55 2009 (r200175) @@ -1989,14 +1989,14 @@ cxgb_uninit_synchronized(struct port_inf t3_set_reg_field(sc, A_XGM_RXFIFO_CFG + pi->mac.offset, V_RXFIFOPAUSEHWM(M_RXFIFOPAUSEHWM), 0); - DELAY(100); + DELAY(100 * 1000); /* Wait for TXFIFO empty */ t3_wait_op_done(sc, A_XGM_TXFIFO_CFG + pi->mac.offset, F_TXFIFO_EMPTY, 1, 20, 5); - DELAY(100); - t3_mac_disable(&pi->mac, MAC_DIRECTION_TX | MAC_DIRECTION_RX); + DELAY(100 * 1000); + t3_mac_disable(&pi->mac, MAC_DIRECTION_RX); pi->phy.ops->power_down(&pi->phy, 1); Modified: stable/8/sys/dev/cxgb/cxgb_t3fw.h ============================================================================== --- stable/8/sys/dev/cxgb/cxgb_t3fw.h Sun Dec 6 01:29:49 2009 (r200174) +++ stable/8/sys/dev/cxgb/cxgb_t3fw.h Sun Dec 6 01:45:55 2009 (r200175) @@ -32,8 +32,8 @@ $FreeBSD$ #define U (unsigned char) -static unsigned int t3fw_length = 30772; -static unsigned char t3fw[30772] = { +static unsigned int t3fw_length = 30840; +static unsigned char t3fw[30840] = { U 0x60, U 0x00, U 0x74, U 0x00, U 0x20, U 0x03, U 0x80, U 0x00, U 0x20, U 0x03, U 0x70, U 0x00, @@ -55,13 +55,13 @@ static unsigned char t3fw[30772] = { U 0x1F, U 0xFF, U 0xC0, U 0x00, U 0xE3, U 0x00, U 0x04, U 0x3C, U 0x02, U 0x00, U 0x00, U 0x00, - U 0x20, U 0x00, U 0x6B, U 0xE8, + U 0x20, U 0x00, U 0x6C, U 0x34, U 0x1F, U 0xFF, U 0xC2, U 0x90, - U 0x20, U 0x00, U 0x6C, U 0x30, + U 0x20, U 0x00, U 0x6C, U 0x7C, U 0x1F, U 0xFF, U 0xC2, U 0x94, - U 0x20, U 0x00, U 0x6C, U 0x70, + U 0x20, U 0x00, U 0x6C, U 0xBC, U 0x1F, U 0xFF, U 0xC2, U 0x98, - U 0x20, U 0x00, U 0x6C, U 0xE4, + U 0x20, U 0x00, U 0x6D, U 0x30, U 0x1F, U 0xFF, U 0xC2, U 0x9C, U 0x20, U 0x00, U 0x03, U 0xC0, U 0xC0, U 0x00, U 0x00, U 0xE4, @@ -396,11 +396,11 @@ static unsigned char t3fw[30772] = { U 0x20, U 0x00, U 0x03, U 0xB0, U 0xE3, U 0x00, U 0x0D, U 0x3C, U 0x20, U 0x00, U 0x03, U 0xB0, - U 0x20, U 0x00, U 0x6E, U 0x08, + U 0x20, U 0x00, U 0x6E, U 0x54, U 0xE3, U 0x00, U 0x0D, U 0x3C, - U 0x20, U 0x00, U 0x6E, U 0x08, - U 0x20, U 0x00, U 0x6E, U 0x08, - U 0xE3, U 0x00, U 0x77, U 0x94, + U 0x20, U 0x00, U 0x6E, U 0x54, + U 0x20, U 0x00, U 0x6E, U 0x54, + U 0xE3, U 0x00, U 0x77, U 0xE0, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, @@ -408,8 +408,8 @@ static unsigned char t3fw[30772] = { U 0x1F, U 0xFC, U 0x00, U 0x00, U 0x1F, U 0xFF, U 0xC5, U 0x90, U 0x1F, U 0xFF, U 0xC6, U 0x70, - U 0x20, U 0x00, U 0x6E, U 0x08, - U 0x20, U 0x00, U 0x6E, U 0x08, + U 0x20, U 0x00, U 0x6E, U 0x58, + U 0x20, U 0x00, U 0x6E, U 0x58, U 0xDE, U 0xFF, U 0xFE, U 0x00, U 0x00, U 0x00, U 0x08, U 0x0C, U 0xDE, U 0xAD, U 0xBE, U 0xEF, @@ -616,47 +616,47 @@ static unsigned char t3fw[30772] = { U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, - U 0x20, U 0x00, U 0x55, U 0x08, - U 0x20, U 0x00, U 0x53, U 0xD8, - U 0x20, U 0x00, U 0x55, U 0x08, - U 0x20, U 0x00, U 0x55, U 0x08, - U 0x20, U 0x00, U 0x53, U 0x14, - U 0x20, U 0x00, U 0x53, U 0x14, - U 0x20, U 0x00, U 0x53, U 0x14, - U 0x20, U 0x00, U 0x51, U 0x54, - U 0x20, U 0x00, U 0x51, U 0x54, - U 0x20, U 0x00, U 0x51, U 0x4C, - U 0x20, U 0x00, U 0x50, U 0xB8, - U 0x20, U 0x00, U 0x4F, U 0x60, - U 0x20, U 0x00, U 0x4D, U 0x40, - U 0x20, U 0x00, U 0x4B, U 0x14, - U 0x00, U 0x00, U 0x00, U 0x00, - U 0x00, U 0x00, U 0x00, U 0x00, - U 0x20, U 0x00, U 0x54, U 0xD8, - U 0x20, U 0x00, U 0x53, U 0xA4, - U 0x20, U 0x00, U 0x54, U 0x48, - U 0x20, U 0x00, U 0x54, U 0x48, - U 0x20, U 0x00, U 0x51, U 0xFC, - U 0x20, U 0x00, U 0x51, U 0xFC, - U 0x20, U 0x00, U 0x51, U 0xFC, - U 0x20, U 0x00, U 0x51, U 0xFC, - U 0x20, U 0x00, U 0x51, U 0xFC, - U 0x20, U 0x00, U 0x51, U 0x44, - U 0x20, U 0x00, U 0x51, U 0xFC, - U 0x20, U 0x00, U 0x4E, U 0x80, - U 0x20, U 0x00, U 0x4C, U 0xF0, - U 0x20, U 0x00, U 0x4A, U 0xC0, + U 0x20, U 0x00, U 0x55, U 0x54, + U 0x20, U 0x00, U 0x54, U 0x24, + U 0x20, U 0x00, U 0x55, U 0x54, + U 0x20, U 0x00, U 0x55, U 0x54, + U 0x20, U 0x00, U 0x53, U 0x60, + U 0x20, U 0x00, U 0x53, U 0x60, + U 0x20, U 0x00, U 0x53, U 0x60, + U 0x20, U 0x00, U 0x51, U 0xA0, + U 0x20, U 0x00, U 0x51, U 0xA0, + U 0x20, U 0x00, U 0x51, U 0x98, + U 0x20, U 0x00, U 0x51, U 0x04, + U 0x20, U 0x00, U 0x4F, U 0xAC, + U 0x20, U 0x00, U 0x4D, U 0x8C, + U 0x20, U 0x00, U 0x4B, U 0x60, + U 0x00, U 0x00, U 0x00, U 0x00, + U 0x00, U 0x00, U 0x00, U 0x00, + U 0x20, U 0x00, U 0x55, U 0x24, + U 0x20, U 0x00, U 0x53, U 0xF0, + U 0x20, U 0x00, U 0x54, U 0x94, + U 0x20, U 0x00, U 0x54, U 0x94, + U 0x20, U 0x00, U 0x52, U 0x48, + U 0x20, U 0x00, U 0x52, U 0x48, + U 0x20, U 0x00, U 0x52, U 0x48, + U 0x20, U 0x00, U 0x52, U 0x48, + U 0x20, U 0x00, U 0x52, U 0x48, + U 0x20, U 0x00, U 0x51, U 0x90, + U 0x20, U 0x00, U 0x52, U 0x48, + U 0x20, U 0x00, U 0x4E, U 0xCC, + U 0x20, U 0x00, U 0x4D, U 0x3C, + U 0x20, U 0x00, U 0x4B, U 0x0C, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, U 0x20, U 0x00, U 0x0B, U 0xE8, U 0x20, U 0x00, U 0x3A, U 0xA8, U 0x20, U 0x00, U 0x04, U 0xC0, - U 0x20, U 0x00, U 0x46, U 0xB4, + U 0x20, U 0x00, U 0x46, U 0xFC, U 0x20, U 0x00, U 0x0B, U 0xE0, U 0x20, U 0x00, U 0x41, U 0xC0, U 0x20, U 0x00, U 0x03, U 0xF0, - U 0x20, U 0x00, U 0x46, U 0x74, - U 0x20, U 0x00, U 0x4A, U 0x9C, + U 0x20, U 0x00, U 0x46, U 0xBC, + U 0x20, U 0x00, U 0x4A, U 0xE8, U 0x20, U 0x00, U 0x3E, U 0xCC, U 0x20, U 0x00, U 0x3D, U 0xE8, U 0x20, U 0x00, U 0x3A, U 0x24, @@ -666,7 +666,7 @@ static unsigned char t3fw[30772] = { U 0x20, U 0x00, U 0x3C, U 0x44, U 0x20, U 0x00, U 0x2D, U 0xB0, U 0x20, U 0x00, U 0x28, U 0x44, - U 0x20, U 0x00, U 0x67, U 0x8C, + U 0x20, U 0x00, U 0x67, U 0xD8, U 0x20, U 0x00, U 0x23, U 0xD0, U 0x20, U 0x00, U 0x20, U 0xB0, U 0x20, U 0x00, U 0x20, U 0x5C, @@ -851,22 +851,22 @@ static unsigned char t3fw[30772] = { U 0x0B, U 0xBB, U 0x90, U 0x00, U 0x53, U 0x00, U 0x00, U 0x00, U 0x63, U 0xFF, U 0xFC, U 0x00, - U 0x20, U 0x00, U 0x6B, U 0xC4, + U 0x20, U 0x00, U 0x6C, U 0x10, U 0x10, U 0xFF, U 0xFF, U 0x0A, U 0x00, U 0x00, U 0x00, U 0x00, - U 0x20, U 0x00, U 0x6B, U 0xE8, + U 0x20, U 0x00, U 0x6C, U 0x34, U 0x00, U 0xD2, U 0x31, U 0x10, U 0xFF, U 0xFE, U 0x0A, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, - U 0x20, U 0x00, U 0x6C, U 0x30, + U 0x20, U 0x00, U 0x6C, U 0x7C, U 0x00, U 0xD3, U 0x31, U 0x10, U 0xFF, U 0xFE, U 0x0A, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, - U 0x20, U 0x00, U 0x6C, U 0x70, + U 0x20, U 0x00, U 0x6C, U 0xBC, U 0x00, U 0xD4, U 0x31, U 0x10, U 0xFF, U 0xFE, U 0x0A, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, - U 0x20, U 0x00, U 0x6C, U 0xE4, + U 0x20, U 0x00, U 0x6D, U 0x30, U 0x00, U 0xD5, U 0x31, U 0x10, U 0xFF, U 0xFE, U 0x0A, U 0x00, U 0x00, U 0x00, U 0x00, U 0x00, @@ -893,8 +893,8 @@ static unsigned char t3fw[30772] = { U 0xFA, U 0xD3, U 0x0F, U 0x77, U 0x6B, U 0x06, U 0x90, U 0x60, U 0xB4, U 0x66, U 0x77, U 0x63, - U 0xF8, U 0x54, U 0x15, U 0xD3, - U 0x54, U 0x1A, U 0x7E, U 0x0F, + U 0xF8, U 0x54, U 0x15, U 0xE6, + U 0x54, U 0x1A, U 0x91, U 0x0F, U 0x14, U 0x00, U 0x63, U 0xFF, U 0xF9, U 0x00, U 0x00, U 0x00, U 0x6C, U 0x10, U 0x04, U 0xC0, @@ -1107,7 +1107,7 @@ static unsigned char t3fw[30772] = { U 0xFC, U 0x13, U 0x2C, U 0x16, U 0x18, U 0x2B, U 0x12, U 0x1A, U 0x2A, U 0x12, U 0x1B, U 0xDC, - U 0x50, U 0x58, U 0x19, U 0x91, + U 0x50, U 0x58, U 0x19, U 0xA4, U 0xC0, U 0xD0, U 0xC0, U 0x90, U 0x2E, U 0x5C, U 0xF4, U 0x2C, U 0x12, U 0x17, U 0x28, U 0x12, @@ -1345,7 +1345,7 @@ static unsigned char t3fw[30772] = { U 0xFC, U 0x2A, U 0x00, U 0x00, U 0x64, U 0x50, U 0xC0, U 0xDA, U 0x20, U 0xDB, U 0xC0, U 0x58, - U 0x16, U 0x65, U 0xC0, U 0x20, + U 0x16, U 0x78, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xC0, U 0x91, U 0x63, U 0xFD, U 0x7A, U 0x00, U 0xC0, U 0x91, U 0x63, U 0xFA, @@ -1354,7 +1354,7 @@ static unsigned char t3fw[30772] = { U 0x0A, U 0x80, U 0xC0, U 0x9A, U 0x29, U 0x24, U 0x68, U 0x2C, U 0x70, U 0x07, U 0x58, U 0x15, - U 0x55, U 0xD2, U 0xA0, U 0xD1, + U 0x68, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x03, U 0x47, U 0x0B, U 0x18, U 0xED, U 0x4F, U 0xDB, U 0x70, U 0xA8, U 0x28, U 0x78, @@ -1362,7 +1362,7 @@ static unsigned char t3fw[30772] = { U 0xF8, U 0xD9, U 0xB0, U 0x63, U 0xFA, U 0x61, U 0x00, U 0x00, U 0x2A, U 0x2C, U 0x74, U 0xDB, - U 0x40, U 0x58, U 0x0E, U 0xD1, + U 0x40, U 0x58, U 0x0E, U 0xE3, U 0x63, U 0xFA, U 0xE4, U 0x00, U 0x00, U 0x29, U 0x22, U 0x1D, U 0x2D, U 0x25, U 0x02, U 0x7B, @@ -1386,7 +1386,7 @@ static unsigned char t3fw[30772] = { U 0xC0, U 0xD1, U 0x2E, U 0x0A, U 0x80, U 0xC0, U 0x9E, U 0x29, U 0x24, U 0x68, U 0x2C, U 0x70, - U 0x07, U 0x58, U 0x15, U 0x34, + U 0x07, U 0x58, U 0x15, U 0x47, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xC0, U 0x94, U 0x63, U 0xFB, U 0xC9, U 0xC0, U 0x96, U 0x63, @@ -1472,7 +1472,7 @@ static unsigned char t3fw[30772] = { U 0x28, U 0x2D, U 0xF6, U 0x85, U 0xC8, U 0x5A, U 0x2A, U 0x2C, U 0x74, U 0xDB, U 0x40, U 0x58, - U 0x0E, U 0x64, U 0xD2, U 0xA0, + U 0x0E, U 0x76, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x00, U 0x00, U 0x00, U 0x29, U 0xCC, U 0xF9, @@ -1497,26 +1497,26 @@ static unsigned char t3fw[30772] = { U 0x75, U 0x63, U 0xFF, U 0x7D, U 0x00, U 0xCC, U 0x57, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0xDC, - U 0x40, U 0x58, U 0x15, U 0x3A, + U 0x40, U 0x58, U 0x15, U 0x4D, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x00, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x15, U 0xC9, + U 0xB6, U 0x58, U 0x15, U 0xDC, U 0x63, U 0xFF, U 0xE5, U 0x00, U 0xDA, U 0x20, U 0x58, U 0x15, - U 0xC7, U 0x63, U 0xFF, U 0xDC, + U 0xDA, U 0x63, U 0xFF, U 0xDC, U 0x00, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0xDC, U 0x40, U 0xDD, - U 0x50, U 0x58, U 0x16, U 0x55, + U 0x50, U 0x58, U 0x16, U 0x68, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xC8, U 0x58, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x58, U 0x14, - U 0xA7, U 0x2A, U 0x21, U 0x02, + U 0xBA, U 0x2A, U 0x21, U 0x02, U 0x65, U 0xAF, U 0xBD, U 0xC0, U 0x94, U 0x09, U 0xA9, U 0x02, U 0x29, U 0x25, U 0x02, U 0x63, U 0xFF, U 0xB2, U 0x00, U 0x00, U 0x2B, U 0x21, U 0x04, U 0x58, - U 0x14, U 0x53, U 0x1D, U 0xEC, + U 0x14, U 0x66, U 0x1D, U 0xEC, U 0xAF, U 0xC0, U 0xE0, U 0x2E, U 0x24, U 0x66, U 0x8F, U 0x30, U 0x2B, U 0x20, U 0x0C, U 0x0F, @@ -1527,7 +1527,7 @@ static unsigned char t3fw[30772] = { U 0xFC, U 0x50, U 0x64, U 0xCF, U 0x56, U 0x2B, U 0x21, U 0x04, U 0xC0, U 0xC0, U 0x58, U 0x14, - U 0x48, U 0x1D, U 0xEC, U 0xA4, + U 0x5B, U 0x1D, U 0xEC, U 0xA4, U 0xC0, U 0xE0, U 0x8F, U 0x30, U 0x2B, U 0x20, U 0x0C, U 0x0F, U 0x8F, U 0x14, U 0x63, U 0xFF, @@ -1535,7 +1535,7 @@ static unsigned char t3fw[30772] = { U 0x2B, U 0x21, U 0x04, U 0xB1, U 0xCC, U 0x0C, U 0x0C, U 0x47, U 0x2C, U 0x24, U 0x66, U 0x58, - U 0x14, U 0x40, U 0x1D, U 0xEC, + U 0x14, U 0x53, U 0x1D, U 0xEC, U 0x9C, U 0xC0, U 0xE0, U 0x2E, U 0x24, U 0x66, U 0x8F, U 0x30, U 0x2B, U 0x20, U 0x0C, U 0x0F, @@ -1574,7 +1574,7 @@ static unsigned char t3fw[30772] = { U 0xAC, U 0xFD, U 0x65, U 0xA0, U 0xC2, U 0xCC, U 0x5F, U 0xDB, U 0x30, U 0xDA, U 0x20, U 0x8C, - U 0x11, U 0x58, U 0x14, U 0xED, + U 0x11, U 0x58, U 0x15, U 0x00, U 0xC0, U 0x51, U 0x9A, U 0x13, U 0xC7, U 0xBF, U 0x9B, U 0xA9, U 0x8E, U 0x13, U 0x2E, U 0xE2, @@ -1613,19 +1613,19 @@ static unsigned char t3fw[30772] = { U 0x20, U 0x7F, U 0x89, U 0x05, U 0x29, U 0xD2, U 0x85, U 0x65, U 0x91, U 0x65, U 0xDA, U 0x20, - U 0x58, U 0x15, U 0x58, U 0xC9, + U 0x58, U 0x15, U 0x6B, U 0xC9, U 0x5C, U 0x60, U 0x01, U 0xFF, U 0x00, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x15, U 0x55, + U 0xB6, U 0x58, U 0x15, U 0x68, U 0x60, U 0x00, U 0x0C, U 0x00, U 0xC0, U 0x90, U 0x63, U 0xFF, U 0xB5, U 0x00, U 0x00, U 0xDA, - U 0x20, U 0x58, U 0x15, U 0x51, + U 0x20, U 0x58, U 0x15, U 0x64, U 0x65, U 0x51, U 0xE4, U 0x8D, U 0x13, U 0x8C, U 0x11, U 0xDB, U 0xD0, U 0x8D, U 0xD0, U 0x02, U 0x2A, U 0x02, U 0x0D, U 0x6D, - U 0x51, U 0x58, U 0x13, U 0xC3, + U 0x51, U 0x58, U 0x13, U 0xD6, U 0x9A, U 0x13, U 0x64, U 0xA1, U 0xCE, U 0xC7, U 0x5F, U 0x8F, U 0xA1, U 0x95, U 0xA9, U 0xC0, @@ -1643,7 +1643,7 @@ static unsigned char t3fw[30772] = { U 0x09, U 0x9D, U 0x02, U 0x64, U 0x81, U 0x59, U 0xC9, U 0xD3, U 0x8A, U 0x10, U 0x2B, U 0x21, - U 0x04, U 0x58, U 0x13, U 0xD3, + U 0x04, U 0x58, U 0x13, U 0xE6, U 0x8A, U 0x13, U 0xC0, U 0xB0, U 0x2B, U 0x24, U 0x66, U 0x2E, U 0xA2, U 0x09, U 0x2A, U 0xA0, @@ -1700,7 +1700,7 @@ static unsigned char t3fw[30772] = { U 0xE4, U 0xCF, U 0x2B, U 0xBC, U 0x20, U 0x2B, U 0xC6, U 0x85, U 0x2A, U 0x2C, U 0x74, U 0x8B, - U 0x11, U 0x58, U 0x0D, U 0x7F, + U 0x11, U 0x58, U 0x0D, U 0x91, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x28, U 0x20, U 0x3D, U 0xC0, U 0xE0, U 0x7C, U 0x87, U 0x7F, @@ -1734,14 +1734,14 @@ static unsigned char t3fw[30772] = { U 0xF0, U 0x63, U 0xFE, U 0x95, U 0x00, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, U 0x11, U 0xDD, - U 0x50, U 0x58, U 0x15, U 0x71, + U 0x50, U 0x58, U 0x15, U 0x84, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xC0, U 0xE1, U 0x63, U 0xFF, U 0x7A, U 0x8B, U 0x13, U 0x8C, U 0x11, U 0xDD, U 0x50, U 0xC0, U 0xAA, U 0x2E, U 0x0A, U 0x80, U 0x2A, U 0x24, U 0x68, U 0xDA, - U 0x20, U 0x58, U 0x13, U 0xD1, + U 0x20, U 0x58, U 0x13, U 0xE4, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x6C, U 0x10, U 0x06, U 0x29, @@ -1851,19 +1851,19 @@ static unsigned char t3fw[30772] = { U 0x72, U 0x63, U 0xFF, U 0x66, U 0x00, U 0xCC, U 0x57, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0xDC, - U 0x40, U 0x58, U 0x13, U 0xD8, + U 0x40, U 0x58, U 0x13, U 0xEB, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0x58, U 0x14, - U 0x68, U 0x63, U 0xFF, U 0xE8, + U 0x7B, U 0x63, U 0xFF, U 0xE8, U 0xC0, U 0xA0, U 0x63, U 0xFE, U 0x82, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x14, U 0x64, + U 0xB6, U 0x58, U 0x14, U 0x77, U 0x63, U 0xFF, U 0xD9, U 0x00, U 0xDB, U 0x40, U 0x2A, U 0x2C, - U 0x74, U 0x58, U 0x0C, U 0xDF, + U 0x74, U 0x58, U 0x0C, U 0xF1, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x8A, U 0x10, U 0x2B, U 0x21, - U 0x04, U 0x58, U 0x12, U 0xF7, + U 0x04, U 0x58, U 0x13, U 0x0A, U 0x1E, U 0xEB, U 0x46, U 0xC0, U 0xD0, U 0x2D, U 0x24, U 0x66, U 0x63, U 0xFE, U 0xB1, U 0x00, @@ -1893,14 +1893,14 @@ static unsigned char t3fw[30772] = { U 0x22, U 0xD2, U 0x85, U 0xCF, U 0x25, U 0x60, U 0x00, U 0x0D, U 0x00, U 0xDA, U 0x60, U 0xC0, - U 0xB6, U 0x58, U 0x14, U 0x40, + U 0xB6, U 0x58, U 0x14, U 0x53, U 0xC8, U 0x5A, U 0x60, U 0x01, U 0x0F, U 0x00, U 0xDA, U 0x60, - U 0x58, U 0x14, U 0x3D, U 0x65, + U 0x58, U 0x14, U 0x50, U 0x65, U 0x51, U 0x06, U 0xDC, U 0x40, U 0xDB, U 0x30, U 0x8D, U 0x30, U 0xDA, U 0x60, U 0x0D, U 0x6D, - U 0x51, U 0x58, U 0x12, U 0xB0, + U 0x51, U 0x58, U 0x12, U 0xC3, U 0xD3, U 0xA0, U 0x64, U 0xA0, U 0xF3, U 0x84, U 0xA1, U 0xC0, U 0x51, U 0x04, U 0x04, U 0x47, @@ -1911,7 +1911,7 @@ static unsigned char t3fw[30772] = { U 0x2C, U 0x64, U 0x66, U 0x6F, U 0xC6, U 0x02, U 0x70, U 0x96, U 0x0A, U 0x2B, U 0x61, U 0x04, - U 0x58, U 0x12, U 0xC7, U 0xC0, + U 0x58, U 0x12, U 0xDA, U 0xC0, U 0xB0, U 0x2B, U 0x64, U 0x66, U 0x65, U 0x50, U 0xB4, U 0x2A, U 0x3C, U 0x10, U 0xC0, U 0xE7, @@ -1961,7 +1961,7 @@ static unsigned char t3fw[30772] = { U 0xFF, U 0x60, U 0x00, U 0x00, U 0x2A, U 0x6C, U 0x74, U 0xC0, U 0xB2, U 0xDC, U 0x20, U 0xDD, - U 0x40, U 0x58, U 0x12, U 0xA5, + U 0x40, U 0x58, U 0x12, U 0xB8, U 0xC0, U 0xB0, U 0x63, U 0xFF, U 0x63, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x00, U 0x00, U 0x00, @@ -2013,7 +2013,7 @@ static unsigned char t3fw[30772] = { U 0xA6, U 0x9D, U 0x2F, U 0x35, U 0x02, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xDA, U 0x30, U 0xC0, - U 0xB6, U 0x58, U 0x13, U 0xC8, + U 0xB6, U 0x58, U 0x13, U 0xDB, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x6C, U 0x10, U 0x06, U 0x2A, U 0x20, U 0x06, U 0x94, U 0x10, @@ -2024,7 +2024,7 @@ static unsigned char t3fw[30772] = { U 0x92, U 0x0A, U 0xCC, U 0x5F, U 0xDB, U 0x30, U 0xDA, U 0x20, U 0x8C, U 0x10, U 0x58, U 0x13, - U 0x2C, U 0xC0, U 0x51, U 0xD3, + U 0x3F, U 0xC0, U 0x51, U 0xD3, U 0xA0, U 0xC7, U 0xAF, U 0x9A, U 0x3A, U 0xC0, U 0xD0, U 0x1C, U 0xEA, U 0xA5, U 0x14, U 0xEA, @@ -2154,37 +2154,37 @@ static unsigned char t3fw[30772] = { U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x00, U 0xCC, U 0x57, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, - U 0x10, U 0x58, U 0x12, U 0xA9, + U 0x10, U 0x58, U 0x12, U 0xBC, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xC0, U 0x91, U 0x63, U 0xFF, U 0x8F, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x13, U 0x37, + U 0xB6, U 0x58, U 0x13, U 0x4A, U 0x63, U 0xFF, U 0xE1, U 0x00, U 0xDA, U 0x20, U 0x58, U 0x13, - U 0x35, U 0x63, U 0xFF, U 0xD8, + U 0x48, U 0x63, U 0xFF, U 0xD8, U 0x2B, U 0x21, U 0x04, U 0x58, - U 0x11, U 0xCC, U 0x1E, U 0xEA, + U 0x11, U 0xDF, U 0x1E, U 0xEA, U 0x1D, U 0x2B, U 0x20, U 0x0C, U 0xC0, U 0xD0, U 0x2D, U 0x24, U 0x66, U 0x8F, U 0x3A, U 0x63, U 0xFE, U 0x4D, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0xDC, U 0x40, U 0xDD, U 0x50, U 0x58, U 0x13, - U 0xBE, U 0xD2, U 0xA0, U 0xD1, + U 0xD1, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x2A, U 0x2C, U 0x74, U 0x8B, U 0x10, U 0x58, U 0x0B, - U 0xA7, U 0xD2, U 0xA0, U 0xD1, + U 0xB9, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x29, U 0x21, U 0x38, U 0xC0, U 0x88, U 0x79, U 0x83, U 0x2E, U 0x8C, U 0x31, U 0x0C, U 0xFC, U 0x50, U 0x64, U 0xCE, U 0x22, U 0x2B, U 0x21, U 0x04, U 0xC0, U 0xC0, U 0x58, U 0x11, - U 0xBB, U 0xC0, U 0xD0, U 0x1E, + U 0xCE, U 0xC0, U 0xD0, U 0x1E, U 0xEA, U 0x0C, U 0x8F, U 0x3A, U 0x2B, U 0x20, U 0x0C, U 0x63, U 0xFE, U 0x0D, U 0xDA, U 0x20, - U 0x58, U 0x13, U 0x1D, U 0x63, + U 0x58, U 0x13, U 0x30, U 0x63, U 0xFF, U 0x7A, U 0xDA, U 0x20, U 0x5B, U 0xFF, U 0x22, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x00, @@ -2192,7 +2192,7 @@ static unsigned char t3fw[30772] = { U 0x21, U 0x04, U 0xB1, U 0xCC, U 0x0C, U 0x0C, U 0x47, U 0x2C, U 0x24, U 0x66, U 0x58, U 0x11, - U 0xAF, U 0x1E, U 0xEA, U 0x00, + U 0xC2, U 0x1E, U 0xEA, U 0x00, U 0x2B, U 0x20, U 0x0C, U 0xC0, U 0xD0, U 0x2D, U 0x24, U 0x66, U 0x8F, U 0x3A, U 0x63, U 0xFD, @@ -2376,7 +2376,7 @@ static unsigned char t3fw[30772] = { U 0xCF, U 0x0B, U 0x4B, U 0x0B, U 0x2B, U 0xC6, U 0x85, U 0xC0, U 0xB0, U 0x8C, U 0x15, U 0x58, - U 0x11, U 0x9C, U 0xD2, U 0xA0, + U 0x11, U 0xAF, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x8A, U 0x35, U 0x6F, U 0xA5, U 0x46, U 0xD8, U 0x30, U 0x8B, U 0xD5, U 0x6D, @@ -2388,7 +2388,7 @@ static unsigned char t3fw[30772] = { U 0x08, U 0x0B, U 0x47, U 0x65, U 0xB1, U 0x0B, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x2C, U 0x12, - U 0x05, U 0x58, U 0x11, U 0xBF, + U 0x05, U 0x58, U 0x11, U 0xD2, U 0xD3, U 0xA0, U 0xC0, U 0xC1, U 0xC0, U 0xD0, U 0x2D, U 0xA4, U 0x03, U 0x9C, U 0x14, U 0x63, @@ -2401,25 +2401,25 @@ static unsigned char t3fw[30772] = { U 0x88, U 0x14, U 0xCC, U 0x87, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, U 0x15, U 0x58, U 0x11, - U 0xB3, U 0xC0, U 0x20, U 0xD1, + U 0xC6, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x12, U 0x42, + U 0xB6, U 0x58, U 0x12, U 0x55, U 0x63, U 0xFF, U 0xE4, U 0x00, U 0x00, U 0xDA, U 0x20, U 0x8B, - U 0x10, U 0x58, U 0x12, U 0x3F, + U 0x10, U 0x58, U 0x12, U 0x52, U 0x63, U 0xFF, U 0xD8, U 0x00, U 0x9E, U 0x17, U 0x8A, U 0x12, U 0x2B, U 0x21, U 0x04, U 0x58, - U 0x10, U 0xD5, U 0x8E, U 0x17, + U 0x10, U 0xE8, U 0x8E, U 0x17, U 0xC0, U 0x90, U 0x29, U 0x24, U 0x66, U 0x63, U 0xFE, U 0x34, U 0xC0, U 0x80, U 0x63, U 0xFE, U 0x06, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, U 0x15, U 0xDD, - U 0x50, U 0x58, U 0x12, U 0xC7, + U 0x50, U 0x58, U 0x12, U 0xDA, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0x58, U 0x12, - U 0x33, U 0x63, U 0xFF, U 0xA7, + U 0x46, U 0x63, U 0xFF, U 0xA7, U 0x00, U 0x2B, U 0x21, U 0x38, U 0xC0, U 0xA8, U 0x7B, U 0xAB, U 0x02, U 0x60, U 0x01, U 0x04, @@ -2427,7 +2427,7 @@ static unsigned char t3fw[30772] = { U 0x50, U 0x64, U 0xCE, U 0x04, U 0x8A, U 0x12, U 0x2B, U 0x21, U 0x04, U 0xC0, U 0xC0, U 0x98, - U 0x17, U 0x58, U 0x10, U 0xC3, + U 0x17, U 0x58, U 0x10, U 0xD6, U 0x8E, U 0x17, U 0x63, U 0xFD, U 0xF3, U 0x2D, U 0x21, U 0x38, U 0x2D, U 0xDC, U 0xFF, U 0x0D, @@ -2458,7 +2458,7 @@ static unsigned char t3fw[30772] = { U 0x8D, U 0x14, U 0x2E, U 0x0A, U 0x80, U 0xC0, U 0x8E, U 0x28, U 0x24, U 0x68, U 0x58, U 0x11, - U 0x05, U 0xD2, U 0xA0, U 0xD1, + U 0x18, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x2E, U 0x7C, U 0x48, U 0x19, U 0xE8, U 0xF5, U 0x2A, U 0x32, U 0x16, U 0x2B, U 0x76, @@ -2483,7 +2483,7 @@ static unsigned char t3fw[30772] = { U 0x0C, U 0x47, U 0x2C, U 0x24, U 0x66, U 0xC9, U 0xC0, U 0x9E, U 0x17, U 0x8A, U 0x12, U 0x58, - U 0x10, U 0x8C, U 0x8E, U 0x17, + U 0x10, U 0x9F, U 0x8E, U 0x17, U 0xC0, U 0x34, U 0x8F, U 0x20, U 0xC0, U 0xD0, U 0x2D, U 0x24, U 0x66, U 0xC0, U 0x68, U 0x26, @@ -2493,7 +2493,7 @@ static unsigned char t3fw[30772] = { U 0x66, U 0x98, U 0x17, U 0xB1, U 0xCC, U 0x0C, U 0x0C, U 0x47, U 0x2C, U 0x24, U 0x66, U 0x58, - U 0x10, U 0x82, U 0x8E, U 0x17, + U 0x10, U 0x95, U 0x8E, U 0x17, U 0x87, U 0x16, U 0xC0, U 0xD0, U 0x2D, U 0x24, U 0x66, U 0x63, U 0xFC, U 0xE6, U 0x8D, U 0x35, @@ -2578,13 +2578,13 @@ static unsigned char t3fw[30772] = { U 0xCD, U 0x2D, U 0x25, U 0x23, U 0xC8, U 0x55, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x58, U 0x10, - U 0x7B, U 0x29, U 0x21, U 0x02, + U 0x8E, U 0x29, U 0x21, U 0x02, U 0xCC, U 0x96, U 0xC0, U 0xE8, U 0x0E, U 0x9E, U 0x02, U 0x2E, U 0x25, U 0x02, U 0xCC, U 0x57, U 0xDA, U 0x20, U 0xDB, U 0x30, - U 0xDC, U 0x40, U 0x58, U 0x10, - U 0xFC, U 0xC0, U 0x20, U 0xD1, + U 0xDC, U 0x40, U 0x58, U 0x11, + U 0x0F, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x2C, U 0x20, U 0x66, U 0x89, U 0x31, U 0xB1, U 0xCC, U 0x0C, U 0x0C, U 0x47, U 0x2C, @@ -2694,28 +2694,28 @@ static unsigned char t3fw[30772] = { U 0x20, U 0xD1, U 0x0F, U 0x00, U 0xC0, U 0x9A, U 0x63, U 0xFF, U 0xC6, U 0xDA, U 0x20, U 0x58, - U 0x11, U 0x20, U 0x63, U 0xFE, + U 0x11, U 0x33, U 0x63, U 0xFE, U 0x38, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x11, U 0x1D, + U 0xB6, U 0x58, U 0x11, U 0x30, U 0x63, U 0xFE, U 0x2E, U 0x00, U 0x68, U 0x97, U 0x3C, U 0x2B, U 0x9C, U 0xFD, U 0x64, U 0xBE, U 0x24, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0xDB, - U 0x70, U 0x58, U 0x10, U 0xD9, + U 0x70, U 0x58, U 0x10, U 0xEC, U 0xC0, U 0xC0, U 0xC0, U 0xD1, U 0x0A, U 0xDA, U 0x39, U 0x0A, U 0xDC, U 0x38, U 0x65, U 0xCD, U 0xE0, U 0x63, U 0xFE, U 0x09, U 0x8A, U 0x10, U 0x2B, U 0x21, - U 0x04, U 0x58, U 0x0F, U 0xAA, + U 0x04, U 0x58, U 0x0F, U 0xBD, U 0xC0, U 0xB0, U 0x2B, U 0x24, U 0x66, U 0x63, U 0xFE, U 0x21, U 0xDB, U 0x40, U 0x2A, U 0x2C, - U 0x74, U 0x58, U 0x09, U 0x8B, + U 0x74, U 0x58, U 0x09, U 0x9D, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0x58, U 0x0F, - U 0xAF, U 0x63, U 0xFC, U 0xF7, + U 0xC2, U 0x63, U 0xFC, U 0xF7, U 0x6C, U 0x10, U 0x04, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x00, U 0x6C, U 0x10, U 0x04, U 0x29, @@ -2744,7 +2744,7 @@ static unsigned char t3fw[30772] = { U 0x9B, U 0x68, U 0x98, U 0x0B, U 0x2A, U 0x9C, U 0xF9, U 0x65, U 0xA1, U 0xB2, U 0x02, U 0x2A, - U 0x02, U 0x58, U 0x0F, U 0x91, + U 0x02, U 0x58, U 0x0F, U 0xA4, U 0x89, U 0x37, U 0x1B, U 0xE7, U 0xD7, U 0xC8, U 0x91, U 0x64, U 0x52, U 0x0E, U 0x2A, U 0x21, @@ -2787,7 +2787,7 @@ static unsigned char t3fw[30772] = { U 0x55, U 0x60, U 0x00, U 0x1E, U 0x2A, U 0x20, U 0x0C, U 0xC1, U 0xB2, U 0x8C, U 0x20, U 0x58, - U 0x11, U 0x03, U 0x9A, U 0x18, + U 0x11, U 0x16, U 0x9A, U 0x18, U 0x64, U 0xA2, U 0x45, U 0x8D, U 0x67, U 0x63, U 0xFF, U 0xCF, U 0xC0, U 0xC0, U 0x63, U 0xFF, @@ -2802,7 +2802,7 @@ static unsigned char t3fw[30772] = { U 0x01, U 0x99, U 0xD7, U 0xA0, U 0xDA, U 0x20, U 0xDB, U 0x70, U 0xC1, U 0xC8, U 0x2D, U 0x21, - U 0x20, U 0x58, U 0x10, U 0x9D, + U 0x20, U 0x58, U 0x10, U 0xB0, U 0x8C, U 0x26, U 0x8B, U 0x27, U 0x9A, U 0x16, U 0x0C, U 0xBB, U 0x0C, U 0x7A, U 0xB3, U 0x34, @@ -2820,7 +2820,7 @@ static unsigned char t3fw[30772] = { U 0x02, U 0x60, U 0x00, U 0x97, U 0xCF, U 0x58, U 0x60, U 0x00, U 0x1F, U 0xDA, U 0x20, U 0x8B, - U 0x16, U 0x58, U 0x10, U 0x63, + U 0x16, U 0x58, U 0x10, U 0x76, U 0x65, U 0xA1, U 0x38, U 0x63, U 0xFF, U 0xBD, U 0xC0, U 0x81, U 0xC0, U 0x90, U 0x8F, U 0x18, @@ -2829,7 +2829,7 @@ static unsigned char t3fw[30772] = { U 0x97, U 0xF5, U 0x63, U 0xFF, U 0xD2, U 0xDB, U 0x30, U 0xDA, U 0x20, U 0xDC, U 0x40, U 0x58, - U 0x10, U 0x07, U 0xC0, U 0x51, + U 0x10, U 0x1A, U 0xC0, U 0x51, U 0xD6, U 0xA0, U 0xC0, U 0xC0, U 0x2B, U 0xA0, U 0x10, U 0x2C, U 0xA4, U 0x03, U 0x9B, U 0x17, @@ -2854,7 +2854,7 @@ static unsigned char t3fw[30772] = { U 0x26, U 0x18, U 0x63, U 0xFE, U 0x96, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0xDC, U 0x40, U 0xDD, - U 0x50, U 0x58, U 0x11, U 0x11, + U 0x50, U 0x58, U 0x11, U 0x24, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xC0, U 0x30, U 0x2C, U 0x20, U 0x66, U 0x89, U 0x61, U 0xB1, @@ -2877,7 +2877,7 @@ static unsigned char t3fw[30772] = { U 0x16, U 0xDC, U 0x40, U 0x2F, U 0x22, U 0x13, U 0xDD, U 0x50, U 0xB1, U 0xFF, U 0x2F, U 0x26, - U 0x13, U 0x58, U 0x0F, U 0xA6, + U 0x13, U 0x58, U 0x0F, U 0xB9, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x00, U 0x28, U 0x20, U 0x3D, U 0x08, U 0x48, U 0x40, U 0x65, @@ -2902,28 +2902,28 @@ static unsigned char t3fw[30772] = { U 0xD1, U 0x00, U 0x00, U 0x00, U 0x65, U 0x50, U 0x81, U 0xDA, U 0x20, U 0xDB, U 0x60, U 0xDC, - U 0x40, U 0x58, U 0x0F, U 0xBD, + U 0x40, U 0x58, U 0x0F, U 0xD0, U 0xC0, U 0x20, U 0xC0, U 0xF0, U 0x2F, U 0xA4, U 0x03, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x10, U 0x4B, + U 0xB6, U 0x58, U 0x10, U 0x5E, U 0x63, U 0xFF, U 0xE0, U 0x00, U 0x00, U 0x6F, U 0x95, U 0x02, U 0x63, U 0xFD, U 0x6C, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0xDC, U 0x40, U 0xDD, U 0x50, U 0xC4, - U 0xE0, U 0x58, U 0x0F, U 0x3E, + U 0xE0, U 0x58, U 0x0F, U 0x51, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0x8A, U 0x15, U 0x2B, U 0x21, - U 0x04, U 0x58, U 0x0E, U 0xDB, + U 0x04, U 0x58, U 0x0E, U 0xEE, U 0x23, U 0x24, U 0x66, U 0x28, U 0x60, U 0x10, U 0x98, U 0x17, U 0x63, U 0xFF, U 0x21, U 0x00, U 0xDA, U 0x20, U 0x58, U 0x10, - U 0x3E, U 0x63, U 0xFF, U 0xAB, + U 0x51, U 0x63, U 0xFF, U 0xAB, U 0xC8, U 0x58, U 0xDB, U 0x30, U 0xDA, U 0x20, U 0x58, U 0x0F, - U 0x22, U 0x2A, U 0x21, U 0x02, + U 0x35, U 0x2A, U 0x21, U 0x02, U 0x65, U 0xAF, U 0x9C, U 0xC0, U 0x94, U 0x09, U 0xA9, U 0x02, U 0x29, U 0x25, U 0x02, U 0x63, @@ -2932,11 +2932,11 @@ static unsigned char t3fw[30772] = { U 0xC0, U 0xA3, U 0x2E, U 0x0A, U 0x80, U 0x2A, U 0x24, U 0x68, U 0xDA, U 0x20, U 0x58, U 0x0F, - U 0x2B, U 0xD2, U 0xA0, U 0xD1, + U 0x3E, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0x2B, U 0x20, U 0x0C, U 0x58, U 0x10, - U 0x53, U 0x63, U 0xFF, U 0x6B, + U 0x66, U 0x63, U 0xFF, U 0x6B, U 0x6C, U 0x10, U 0x04, U 0x28, U 0x20, U 0x06, U 0xC0, U 0x62, U 0x28, U 0x8C, U 0xF8, U 0x65, @@ -3007,7 +3007,7 @@ static unsigned char t3fw[30772] = { U 0xAF, U 0xE7, U 0x63, U 0xFF, U 0xA6, U 0x2A, U 0x2C, U 0x74, U 0xC0, U 0xB0, U 0x2C, U 0x0A, - U 0x02, U 0x58, U 0x0E, U 0x15, + U 0x02, U 0x58, U 0x0E, U 0x28, U 0x1C, U 0xE6, U 0xFB, U 0x9C, U 0xA0, U 0x8B, U 0x20, U 0x08, U 0xBB, U 0x11, U 0x06, U 0xBB, @@ -3017,10 +3017,10 @@ static unsigned char t3fw[30772] = { U 0x26, U 0x24, U 0x68, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0xDC, U 0x40, U 0xDD, U 0x50, U 0x58, - U 0x10, U 0x6F, U 0xD2, U 0xA0, + U 0x10, U 0x82, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0x2B, U 0x20, U 0x0C, U 0x58, - U 0x0F, U 0xDA, U 0xC0, U 0x20, + U 0x0F, U 0xED, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0x00, U 0x00, U 0x6C, U 0x10, U 0x06, U 0x07, U 0x3D, U 0x14, U 0xC0, U 0x80, @@ -3239,7 +3239,7 @@ static unsigned char t3fw[30772] = { U 0x21, U 0x23, U 0x65, U 0xD4, U 0xA0, U 0xC0, U 0xA6, U 0x2B, U 0x0A, U 0x03, U 0x2C, U 0x22, - U 0x00, U 0x58, U 0x0F, U 0x17, + U 0x00, U 0x58, U 0x0F, U 0x2A, U 0x64, U 0xA3, U 0xB9, U 0x17, U 0xE5, U 0xE6, U 0x8E, U 0x38, U 0x9A, U 0x16, U 0x64, U 0xE3, @@ -3248,11 +3248,11 @@ static unsigned char t3fw[30772] = { U 0xF3, U 0x7E, U 0x83, U 0x11, U 0xC2, U 0xB0, U 0x8C, U 0x20, U 0x2A, U 0x20, U 0x0C, U 0x58, - U 0x0F, U 0x36, U 0xD7, U 0xA0, + U 0x0F, U 0x49, U 0xD7, U 0xA0, U 0xCD, U 0xA1, U 0x60, U 0x04, U 0xA2, U 0x00, U 0xC2, U 0xB0, U 0x8C, U 0x20, U 0x2A, U 0x20, - U 0x0C, U 0x58, U 0x0F, U 0x0A, + U 0x0C, U 0x58, U 0x0F, U 0x1D, U 0xD7, U 0xA0, U 0x64, U 0xA4, U 0x86, U 0x2F, U 0x21, U 0x2E, U 0x8B, U 0x68, U 0x0F, U 0xBF, @@ -3264,7 +3264,7 @@ static unsigned char t3fw[30772] = { U 0x4C, U 0xDA, U 0x20, U 0xDB, U 0x50, U 0xC1, U 0xC4, U 0x2D, U 0x21, U 0x1F, U 0x58, U 0x0E, - U 0xD0, U 0x8B, U 0x26, U 0x9A, + U 0xE3, U 0x8B, U 0x26, U 0x9A, U 0x18, U 0x9A, U 0x19, U 0x89, U 0x27, U 0x2A, U 0xAC, U 0x38, U 0x0B, U 0x99, U 0x0C, U 0x7A, @@ -3291,11 +3291,11 @@ static unsigned char t3fw[30772] = { U 0x93, U 0xC0, U 0xE0, U 0x63, U 0xFF, U 0xE2, U 0xDA, U 0x20, U 0x8B, U 0x18, U 0x58, U 0x0E, - U 0x8D, U 0x65, U 0xA2, U 0xB1, + U 0xA0, U 0x65, U 0xA2, U 0xB1, U 0x63, U 0xFF, U 0x9E, U 0x00, U 0x00, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, U 0x15, U 0x58, - U 0x0E, U 0x35, U 0xD6, U 0xA0, + U 0x0E, U 0x48, U 0xD6, U 0xA0, U 0xC0, U 0xC0, U 0xC0, U 0xD1, U 0x2D, U 0x16, U 0x04, U 0x2C, U 0xA4, U 0x03, U 0xDC, U 0x70, @@ -3346,12 +3346,12 @@ static unsigned char t3fw[30772] = { U 0x64, U 0x41, U 0x81, U 0xC0, U 0x44, U 0x2B, U 0x0A, U 0x00, U 0x8C, U 0x20, U 0x2A, U 0x20, - U 0x0C, U 0x58, U 0x0E, U 0xAC, + U 0x0C, U 0x58, U 0x0E, U 0xBF, U 0x0A, U 0xA7, U 0x02, U 0x65, U 0xA0, U 0x0F, U 0xC0, U 0xB0, U 0x2C, U 0x22, U 0x00, U 0x2A, U 0x20, U 0x0C, U 0x58, U 0x0E, - U 0xA8, U 0xD7, U 0xA0, U 0x64, + U 0xBB, U 0xD7, U 0xA0, U 0x64, U 0xAF, U 0xEF, U 0xDA, U 0x20, U 0xC1, U 0xBC, U 0xC1, U 0xC8, U 0x2D, U 0x21, U 0x20, U 0x8F, @@ -3360,7 +3360,7 @@ static unsigned char t3fw[30772] = { U 0x26, U 0x0E, U 0x99, U 0x0C, U 0x09, U 0x09, U 0x48, U 0x29, U 0x25, U 0x25, U 0x58, U 0x0E, - U 0x70, U 0xC0, U 0x90, U 0xC0, + U 0x83, U 0xC0, U 0x90, U 0xC0, U 0x50, U 0xC0, U 0xC2, U 0x88, U 0x60, U 0x9A, U 0x19, U 0x1E, U 0xE5, U 0x6E, U 0xC0, U 0xA1, @@ -3442,7 +3442,7 @@ static unsigned char t3fw[30772] = { U 0xFD, U 0x0B, U 0x2D, U 0xE6, U 0x85, U 0xDA, U 0x20, U 0x8B, U 0x19, U 0x8C, U 0x15, U 0x8D, - U 0x14, U 0x58, U 0x0D, U 0x71, + U 0x14, U 0x58, U 0x0D, U 0x84, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xDC, U 0x70, U 0xDF, U 0x50, U 0xDB, U 0x60, U 0x2D, U 0x6C, @@ -3467,20 +3467,20 @@ static unsigned char t3fw[30772] = { U 0xFF, U 0xE8, U 0x88, U 0x14, U 0x65, U 0x81, U 0x68, U 0xDA, U 0x20, U 0xDB, U 0x60, U 0x8C, - U 0x15, U 0x58, U 0x0D, U 0x88, + U 0x15, U 0x58, U 0x0D, U 0x9B, U 0xC0, U 0x20, U 0xC0, U 0x90, U 0x29, U 0xA4, U 0x03, U 0xD1, U 0x0F, U 0x8A, U 0x16, U 0x2B, U 0x21, U 0x04, U 0x58, U 0x0C, - U 0xAF, U 0xC0, U 0xA0, U 0x2A, + U 0xC2, U 0xC0, U 0xA0, U 0x2A, U 0x24, U 0x66, U 0x8E, U 0x68, U 0x63, U 0xFD, U 0xCA, U 0x00, U 0x00, U 0x2B, U 0x9C, U 0xF9, U 0x65, U 0xB0, U 0xFD, U 0xDA, - U 0x20, U 0x58, U 0x0C, U 0xB4, + U 0x20, U 0x58, U 0x0C, U 0xC7, U 0x63, U 0xFC, U 0x22, U 0x00, U 0x00, U 0xDA, U 0x20, U 0xC0, - U 0xB6, U 0x58, U 0x0E, U 0x0D, + U 0xB6, U 0x58, U 0x0E, U 0x20, U 0x63, U 0xFF, U 0xBA, U 0x00, U 0x2B, U 0x20, U 0x0C, U 0x0C, U 0xBE, U 0x11, U 0xA7, U 0xEE, @@ -3500,7 +3500,7 @@ static unsigned char t3fw[30772] = { U 0xC6, U 0x02, U 0x70, U 0x96, U 0x0C, U 0x8A, U 0x16, U 0x2B, U 0x21, U 0x04, U 0x58, U 0x0C, - U 0x93, U 0xC0, U 0xD0, U 0x2D, + U 0xA6, U 0xC0, U 0xD0, U 0x2D, U 0x24, U 0x66, U 0x8E, U 0x30, U 0x77, U 0xE7, U 0x4D, U 0x1C, U 0xE4, U 0xF1, U 0x1B, U 0xE4, @@ -3528,7 +3528,7 @@ static unsigned char t3fw[30772] = { U 0x8B, U 0x14, U 0x2C, U 0x25, U 0x23, U 0xC8, U 0xB7, U 0x02, U 0x2A, U 0x02, U 0x06, U 0x6B, - U 0x02, U 0x58, U 0x0C, U 0xC4, + U 0x02, U 0x58, U 0x0C, U 0xD7, U 0x2A, U 0x21, U 0x02, U 0x65, U 0xAE, U 0xF7, U 0xC0, U 0xD8, U 0x0D, U 0xAD, U 0x02, U 0x2D, @@ -3536,38 +3536,38 @@ static unsigned char t3fw[30772] = { U 0xEC, U 0x00, U 0x8E, U 0x14, U 0xC8, U 0xE8, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x58, U 0x0C, - U 0xBD, U 0x2A, U 0x21, U 0x02, + U 0xD0, U 0x2A, U 0x21, U 0x02, U 0x65, U 0xAE, U 0xDA, U 0x07, U 0xAF, U 0x02, U 0x2F, U 0x25, U 0x02, U 0x63, U 0xFE, U 0xD1, U 0x00, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, U 0x15, U 0x8D, - U 0x14, U 0x58, U 0x0E, U 0x61, + U 0x14, U 0x58, U 0x0E, U 0x74, U 0xD2, U 0xA0, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0x2B, U 0x20, - U 0x0C, U 0x58, U 0x0D, U 0xCC, + U 0x0C, U 0x58, U 0x0D, U 0xDF, U 0x63, U 0xFE, U 0xB6, U 0x00, U 0xDA, U 0x20, U 0x2B, U 0x20, - U 0x0C, U 0x58, U 0x0D, U 0xEE, + U 0x0C, U 0x58, U 0x0E, U 0x01, U 0x63, U 0xFE, U 0xAA, U 0xDA, U 0x20, U 0xDB, U 0x30, U 0x8C, U 0x15, U 0x2D, U 0x12, U 0x04, U 0x2E, U 0x0A, U 0x80, U 0x28, U 0x0A, U 0x00, U 0x28, U 0x24, - U 0x68, U 0x58, U 0x0C, U 0xBC, + U 0x68, U 0x58, U 0x0C, U 0xCF, U 0x63, U 0xFA, U 0xE5, U 0x00, U 0xC0, U 0x20, U 0xD1, U 0x0F, U 0xDA, U 0x20, U 0x58, U 0x0D, - U 0xC0, U 0x89, U 0x14, U 0xCD, + U 0xD3, U 0x89, U 0x14, U 0xCD, U 0x92, U 0xDA, U 0x20, U 0xDB, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Sun Dec 6 01:59:06 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D1441065672; Sun, 6 Dec 2009 01:59:06 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B4D28FC0A; Sun, 6 Dec 2009 01:59:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB61x6w1006921; Sun, 6 Dec 2009 01:59:06 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB61x65o006919; Sun, 6 Dec 2009 01:59:06 GMT (envelope-from np@svn.freebsd.org) Message-Id: <200912060159.nB61x65o006919@svn.freebsd.org> From: Navdeep Parhar Date: Sun, 6 Dec 2009 01:59:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200176 - stable/8/sys/dev/cxgb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Dec 2009 01:59:06 -0000 Author: np Date: Sun Dec 6 01:59:06 2009 New Revision: 200176 URL: http://svn.freebsd.org/changeset/base/200176 Log: MFC r199237: sc->rev and is_offload(sc) will always be 0 during probe. Wait till attach to get correct values. (missed this one in r200175) Modified: stable/8/sys/dev/cxgb/cxgb_main.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/cxgb/cxgb_main.c ============================================================================== --- stable/8/sys/dev/cxgb/cxgb_main.c Sun Dec 6 01:45:55 2009 (r200175) +++ stable/8/sys/dev/cxgb/cxgb_main.c Sun Dec 6 01:59:06 2009 (r200176) @@ -355,7 +355,6 @@ cxgb_controller_probe(device_t dev) const struct adapter_info *ai; char *ports, buf[80]; int nports; - struct adapter *sc = device_get_softc(dev); ai = cxgb_get_adapter_info(dev); if (ai == NULL) @@ -367,9 +366,7 @@ cxgb_controller_probe(device_t dev) else ports = "ports"; - snprintf(buf, sizeof(buf), "%s %sNIC, rev: %d nports: %d %s", - ai->desc, is_offload(sc) ? "R" : "", - sc->params.rev, nports, ports); + snprintf(buf, sizeof(buf), "%s, %d %s", ai->desc, nports, ports); device_set_desc_copy(dev, buf); return (BUS_PROBE_DEFAULT); } @@ -665,8 +662,8 @@ cxgb_controller_attach(device_t dev) G_FW_VERSION_MAJOR(vers), G_FW_VERSION_MINOR(vers), G_FW_VERSION_MICRO(vers)); - snprintf(buf, sizeof(buf), "%s\t E/C: %s S/N: %s", - ai->desc, + snprintf(buf, sizeof(buf), "%s %sNIC\t E/C: %s S/N: %s", + ai->desc, is_offload(sc) ? "R" : "", sc->params.vpd.ec, sc->params.vpd.sn); device_set_desc_copy(dev, buf); From owner-svn-src-stable-8@FreeBSD.ORG Sun Dec 6 09:36:11 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63EB7106566B; Sun, 6 Dec 2009 09:36:11 +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 4C35A8FC0C; Sun, 6 Dec 2009 09:36:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB69aB54015990; Sun, 6 Dec 2009 09:36:11 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB69aB1Q015988; Sun, 6 Dec 2009 09:36:11 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200912060936.nB69aB1Q015988@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 6 Dec 2009 09:36:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200179 - stable/8/sys/compat/linux X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Dec 2009 09:36:11 -0000 Author: bz Date: Sun Dec 6 09:36:11 2009 New Revision: 200179 URL: http://svn.freebsd.org/changeset/base/200179 Log: MFC r198467: Unconditionally call the setsockopt for IPV6_V6ONLY for v6 linux sockets no matter whether we are compiled as module or if our default of the net.inet6.ip6.v6only sysctl already matches what we would set. This avoids unnecessary complications with modules, VIMAGES, INET6 and the sysctl value, especially considering that most users will use linux compat as a module. Discussed with: kib, rwatson (weeks ago) Reviewed by: rwatson Modified: stable/8/sys/compat/linux/linux_socket.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/compat/linux/linux_socket.c ============================================================================== --- stable/8/sys/compat/linux/linux_socket.c Sun Dec 6 08:59:19 2009 (r200178) +++ stable/8/sys/compat/linux/linux_socket.c Sun Dec 6 09:36:11 2009 (r200179) @@ -639,19 +639,12 @@ linux_socket(struct thread *td, struct l } #ifdef INET6 /* - * Linux AF_INET6 socket has IPV6_V6ONLY setsockopt set to 0 by - * default and some apps depend on this. So, set V6ONLY to 0 - * for Linux apps if the sysctl value is set to 1. + * Linux AF_INET6 socket has IPV6_V6ONLY setsockopt set to 0 by default + * and some apps depend on this. So, set V6ONLY to 0 for Linux apps. + * For simplicity we do this unconditionally of the net.inet6.ip6.v6only + * sysctl value. */ - if (bsd_args.domain == PF_INET6 -#ifndef KLD_MODULE - /* - * XXX: Avoid undefined symbol error with an IPv4 only - * kernel. - */ - && V_ip6_v6only -#endif - ) { + if (bsd_args.domain == PF_INET6) { int v6only; v6only = 0; From owner-svn-src-stable-8@FreeBSD.ORG Sun Dec 6 19:01:33 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E722B106566C; Sun, 6 Dec 2009 19:01:33 +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 D514D8FC1A; Sun, 6 Dec 2009 19:01:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB6J1Xre028818; Sun, 6 Dec 2009 19:01:33 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB6J1X7L028816; Sun, 6 Dec 2009 19:01:33 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912061901.nB6J1X7L028816@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 6 Dec 2009 19:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200184 - stable/8/sbin/ipfw X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Dec 2009 19:01:34 -0000 Author: luigi Date: Sun Dec 6 19:01:33 2009 New Revision: 200184 URL: http://svn.freebsd.org/changeset/base/200184 Log: mfc r200056 use qsort_r instead of heapsort; staticize two functions. Modified: stable/8/sbin/ipfw/dummynet.c Modified: stable/8/sbin/ipfw/dummynet.c ============================================================================== --- stable/8/sbin/ipfw/dummynet.c Sun Dec 6 18:04:26 2009 (r200183) +++ stable/8/sbin/ipfw/dummynet.c Sun Dec 6 19:01:33 2009 (r200184) @@ -78,7 +78,7 @@ static struct _s_x dummynet_params[] = { }; static int -sort_q(const void *pa, const void *pb) +sort_q(void *arg, const void *pa, const void *pb) { int rev = (co.do_sort < 0); int field = rev ? -co.do_sort : co.do_sort; @@ -121,7 +121,7 @@ list_queues(struct dn_flow_set *fs, stru return; if (co.do_sort != 0) - heapsort(q, fs->rq_elements, sizeof *q, sort_q); + qsort_r(q, fs->rq_elements, sizeof *q, NULL, sort_q); /* Print IPv4 flows */ index_printed = 0; @@ -486,7 +486,7 @@ is_valid_number(const char *s) * and return the numeric bandwidth value. * set clocking interface or bandwidth value */ -void +static void read_bandwidth(char *arg, int *bandwidth, char *if_name, int namelen) { if (*bandwidth != -1) @@ -530,7 +530,7 @@ struct point { double delay; }; -int +static int compare_points(const void *vp1, const void *vp2) { const struct point *p1 = vp1; From owner-svn-src-stable-8@FreeBSD.ORG Sun Dec 6 21:07:47 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85F331065676; Sun, 6 Dec 2009 21:07:47 +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 736F98FC0C; Sun, 6 Dec 2009 21:07:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB6L7laT031650; Sun, 6 Dec 2009 21:07:47 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB6L7lFI031648; Sun, 6 Dec 2009 21:07:47 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200912062107.nB6L7lFI031648@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 6 Dec 2009 21:07:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200186 - stable/8/usr.bin/perror X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Dec 2009 21:07:47 -0000 Author: edwin Date: Sun Dec 6 21:07:47 2009 New Revision: 200186 URL: http://svn.freebsd.org/changeset/base/200186 Log: MFC of r199642 The output of perror(1) is now showing local messages for locales supported by libc/nls PR: bin/140499 Approved by: gnn@ Modified: stable/8/usr.bin/perror/perror.c Directory Properties: stable/8/usr.bin/perror/ (props changed) Modified: stable/8/usr.bin/perror/perror.c ============================================================================== --- stable/8/usr.bin/perror/perror.c Sun Dec 6 20:30:21 2009 (r200185) +++ stable/8/usr.bin/perror/perror.c Sun Dec 6 21:07:47 2009 (r200186) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include static void usage(void); @@ -43,6 +44,7 @@ main(int argc, char **argv) char *errstr; long errnum; + (void) setlocale(LC_MESSAGES, ""); if (argc != 2) usage(); From owner-svn-src-stable-8@FreeBSD.ORG Sun Dec 6 22:01:45 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C27C106566B; Sun, 6 Dec 2009 22:01:45 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59ECB8FC0A; Sun, 6 Dec 2009 22:01:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB6M1j3J032885; Sun, 6 Dec 2009 22:01:45 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB6M1jsP032883; Sun, 6 Dec 2009 22:01:45 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200912062201.nB6M1jsP032883@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 6 Dec 2009 22:01:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200188 - stable/8/bin/sh X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Dec 2009 22:01:45 -0000 Author: jilles Date: Sun Dec 6 22:01:45 2009 New Revision: 200188 URL: http://svn.freebsd.org/changeset/base/200188 Log: MFC r198963: sh: Fix memory leak when using a variable in arithmetic like $((x)). Modified: stable/8/bin/sh/arith_lex.l Directory Properties: stable/8/bin/sh/ (props changed) Modified: stable/8/bin/sh/arith_lex.l ============================================================================== --- stable/8/bin/sh/arith_lex.l Sun Dec 6 21:42:25 2009 (r200187) +++ stable/8/bin/sh/arith_lex.l Sun Dec 6 22:01:45 2009 (r200188) @@ -51,6 +51,13 @@ __FBSDID("$FreeBSD$"); int yylex(void); +struct varname +{ + struct varname *next; + char name[1]; +}; +static struct varname *varnames; + #undef YY_INPUT #define YY_INPUT(buf,result,max) \ result = (*buf = *arith_buf++) ? 1 : YY_NULL; @@ -80,11 +87,14 @@ int yylex(void); * If variable doesn't exist, we should initialize * it to zero. */ - char *temp; + struct varname *temp; if (lookupvar(yytext) == NULL) setvarsafe(yytext, "0", 0); - temp = (char *)ckmalloc(strlen(yytext) + 1); - yylval.s_value = strcpy(temp, yytext); + temp = ckmalloc(sizeof(struct varname) + + strlen(yytext)); + temp->next = varnames; + varnames = temp; + yylval.s_value = strcpy(temp->name, yytext); return ARITH_VAR; } @@ -130,5 +140,15 @@ int yylex(void); void arith_lex_reset(void) { + struct varname *name, *next; + YY_NEW_FILE; + + name = varnames; + while (name != NULL) { + next = name->next; + ckfree(name); + name = next; + } + varnames = NULL; } From owner-svn-src-stable-8@FreeBSD.ORG Sun Dec 6 22:14:58 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE68F106566B; Sun, 6 Dec 2009 22:14:58 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9AA858FC19; Sun, 6 Dec 2009 22:14:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB6MEw73033178; Sun, 6 Dec 2009 22:14:58 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB6MEwRg033175; Sun, 6 Dec 2009 22:14:58 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200912062214.nB6MEwRg033175@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 6 Dec 2009 22:14:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200189 - in stable/8: lib/libc/gen tools/regression/lib/libc/gen X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Dec 2009 22:14:58 -0000 Author: jilles Date: Sun Dec 6 22:14:58 2009 New Revision: 200189 URL: http://svn.freebsd.org/changeset/base/200189 Log: MFC r198406: wordexp(3): fix some bugs with signals and long outputs * retry various system calls on EINTR * retry the rest after a short read (common if there is more than about 1K of output) * block SIGCHLD like system(3) does (note that this does not and cannot work fully in threaded programs, they will need to be careful with wait functions) PR: 90580 Modified: stable/8/lib/libc/gen/wordexp.c stable/8/tools/regression/lib/libc/gen/test-wordexp.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/tools/regression/lib/libc/ (props changed) Modified: stable/8/lib/libc/gen/wordexp.c ============================================================================== --- stable/8/lib/libc/gen/wordexp.c Sun Dec 6 22:01:45 2009 (r200188) +++ stable/8/lib/libc/gen/wordexp.c Sun Dec 6 22:14:58 2009 (r200189) @@ -28,8 +28,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -73,6 +75,24 @@ wordexp(const char * __restrict words, w return (0); } +static size_t +we_read_fully(int fd, char *buffer, size_t len) +{ + size_t done; + ssize_t nread; + + done = 0; + do { + nread = _read(fd, buffer + done, len - done); + if (nread == -1 && errno == EINTR) + continue; + if (nread <= 0) + break; + done += nread; + } while (done != len); + return done; +} + /* * we_askshell -- * Use the `wordexp' /bin/sh builtin function to do most of the work @@ -90,20 +110,31 @@ we_askshell(const char *words, wordexp_t size_t sofs; /* Offset into we->we_strings */ size_t vofs; /* Offset into we->we_wordv */ pid_t pid; /* Process ID of child */ + pid_t wpid; /* waitpid return value */ int status; /* Child exit status */ + int error; /* Our return value */ + int serrno; /* errno to return */ char *ifs; /* IFS env. var. */ char *np, *p; /* Handy pointers */ char *nstrings; /* Temporary for realloc() */ char **nwv; /* Temporary for realloc() */ + sigset_t newsigblock, oldsigblock; + serrno = errno; if ((ifs = getenv("IFS")) == NULL) ifs = " \t\n"; if (pipe(pdes) < 0) return (WRDE_NOSPACE); /* XXX */ + (void)sigemptyset(&newsigblock); + (void)sigaddset(&newsigblock, SIGCHLD); + (void)_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock); if ((pid = fork()) < 0) { + serrno = errno; _close(pdes[0]); _close(pdes[1]); + (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); + errno = serrno; return (WRDE_NOSPACE); /* XXX */ } else if (pid == 0) { @@ -114,6 +145,7 @@ we_askshell(const char *words, wordexp_t int devnull; char *cmd; + (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); _close(pdes[0]); if (_dup2(pdes[1], STDOUT_FILENO) < 0) _exit(1); @@ -139,10 +171,11 @@ we_askshell(const char *words, wordexp_t * the expanded words separated by nulls. */ _close(pdes[1]); - if (_read(pdes[0], wbuf, 8) != 8 || _read(pdes[0], bbuf, 8) != 8) { - _close(pdes[0]); - _waitpid(pid, &status, 0); - return (flags & WRDE_UNDEF ? WRDE_BADVAL : WRDE_SYNTAX); + if (we_read_fully(pdes[0], wbuf, 8) != 8 || + we_read_fully(pdes[0], bbuf, 8) != 8) { + error = flags & WRDE_UNDEF ? WRDE_BADVAL : WRDE_SYNTAX; + serrno = errno; + goto cleanup; } wbuf[8] = bbuf[8] = '\0'; nwords = strtol(wbuf, NULL, 16); @@ -162,33 +195,38 @@ we_askshell(const char *words, wordexp_t if ((nwv = realloc(we->we_wordv, (we->we_wordc + 1 + (flags & WRDE_DOOFFS ? we->we_offs : 0)) * sizeof(char *))) == NULL) { - _close(pdes[0]); - _waitpid(pid, &status, 0); - return (WRDE_NOSPACE); + error = WRDE_NOSPACE; + goto cleanup; } we->we_wordv = nwv; if ((nstrings = realloc(we->we_strings, we->we_nbytes)) == NULL) { - _close(pdes[0]); - _waitpid(pid, &status, 0); - return (WRDE_NOSPACE); + error = WRDE_NOSPACE; + goto cleanup; } for (i = 0; i < vofs; i++) if (we->we_wordv[i] != NULL) we->we_wordv[i] += nstrings - we->we_strings; we->we_strings = nstrings; - if (_read(pdes[0], we->we_strings + sofs, nbytes) != nbytes) { - _close(pdes[0]); - _waitpid(pid, &status, 0); - return (flags & WRDE_UNDEF ? WRDE_BADVAL : WRDE_SYNTAX); + if (we_read_fully(pdes[0], we->we_strings + sofs, nbytes) != nbytes) { + error = flags & WRDE_UNDEF ? WRDE_BADVAL : WRDE_SYNTAX; + serrno = errno; + goto cleanup; } - if (_waitpid(pid, &status, 0) < 0 || !WIFEXITED(status) || - WEXITSTATUS(status) != 0) { - _close(pdes[0]); - return (flags & WRDE_UNDEF ? WRDE_BADVAL : WRDE_SYNTAX); - } + error = 0; +cleanup: _close(pdes[0]); + do + wpid = _waitpid(pid, &status, 0); + while (wpid < 0 && errno == EINTR); + (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); + if (error != 0) { + errno = serrno; + return (error); + } + if (wpid < 0 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) + return (flags & WRDE_UNDEF ? WRDE_BADVAL : WRDE_SYNTAX); /* * Break the null-terminated expanded word strings out into Modified: stable/8/tools/regression/lib/libc/gen/test-wordexp.c ============================================================================== --- stable/8/tools/regression/lib/libc/gen/test-wordexp.c Sun Dec 6 22:01:45 2009 (r200188) +++ stable/8/tools/regression/lib/libc/gen/test-wordexp.c Sun Dec 6 22:14:58 2009 (r200189) @@ -32,17 +32,36 @@ #include __FBSDID("$FreeBSD$"); +#include + #include +#include +#include #include #include #include #include +static void +chld_handler(int x) +{ + int status, serrno; + + (void)x; + serrno = errno; + while (waitpid(-1, &status, WNOHANG) > 0) + ; + errno = serrno; +} + int main(int argc, char *argv[]) { + struct sigaction sa; wordexp_t we; int r; + int i; + char longdata[6 * 10000 + 1]; /* Test that the macros are there. */ (void)(WRDE_APPEND + WRDE_DOOFFS + WRDE_NOCMD + WRDE_REUSE + @@ -59,6 +78,15 @@ main(int argc, char *argv[]) assert(we.we_wordv[2] == NULL); wordfree(&we); + /* Long output. */ + for (i = 0; i < 10000; i++) + snprintf(longdata + 6 * i, 7, "%05d ", i); + r = wordexp(longdata, &we, 0); + assert(r == 0); + assert(we.we_wordc == 10000); + assert(we.we_wordv[10000] == NULL); + wordfree(&we); + /* WRDE_DOOFFS */ we.we_offs = 3; r = wordexp("hello world", &we, WRDE_DOOFFS); @@ -167,6 +195,20 @@ main(int argc, char *argv[]) r = wordexp("test } test", &we, 0); assert(r == WRDE_BADCHAR); + /* With a SIGCHLD handler that reaps all zombies. */ + sa.sa_flags = 0; + sigemptyset(&sa.sa_mask); + sa.sa_handler = chld_handler; + r = sigaction(SIGCHLD, &sa, NULL); + assert(r == 0); + r = wordexp("hello world", &we, 0); + assert(r == 0); + assert(we.we_wordc == 2); + assert(strcmp(we.we_wordv[0], "hello") == 0); + assert(strcmp(we.we_wordv[1], "world") == 0); + assert(we.we_wordv[2] == NULL); + wordfree(&we); + printf("PASS wordexp()\n"); printf("PASS wordfree()\n"); From owner-svn-src-stable-8@FreeBSD.ORG Sun Dec 6 22:46:43 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48305106566C; Sun, 6 Dec 2009 22:46:43 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mx1.freebsd.org (Postfix) with ESMTP id 29F988FC16; Sun, 6 Dec 2009 22:46:41 +0000 (UTC) Received: by bwz5 with SMTP id 5so3097806bwz.3 for ; Sun, 06 Dec 2009 14:46:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=UJNXjvEhdPSKMU8ay+iRYH15SuVY97tVTvjSjEVE7jk=; b=wEw5Hgle9Ayg0VnYggVZ9GeV4kQTGtYLu9u8vCtnm/HBpOcmnhhy+jweYa5QANTzV2 /f8fAQ3iCX0DiJeneHyGwJL6hJt38CAXpoNPzrZXIEA1mF0k88vDAmez9dVObmoiVJgn w3l7G1ukL3A3Th9lGBqhCZfaVWmYbUV7eF1/M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=xx2M/IYhsT/1kjqtcgCoss6Ack8OmYXam1jQflunfLmKZaKS2WphVKbi18iu/fYYm9 PyDske0RNCQ+YvW3qOmRu9ec06L+GW8Mh++DsrsQ8QwPeZca/jRjA6BzqH2tyQsK3FaY yhIEQ3cuJf44PpdDYr/CW+nyuNSPz82CaL7Y0= MIME-Version: 1.0 Received: by 10.204.34.10 with SMTP id j10mr3603298bkd.77.1260139601015; Sun, 06 Dec 2009 14:46:41 -0800 (PST) In-Reply-To: <200912062201.nB6M1jsP032883@svn.freebsd.org> References: <200912062201.nB6M1jsP032883@svn.freebsd.org> Date: Sun, 6 Dec 2009 23:46:40 +0100 Message-ID: <6101e8c40912061446s79423b50le51dd7861fdcc333@mail.gmail.com> From: Oliver Pinter To: Jilles Tjoelker Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r200188 - stable/8/bin/sh X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Dec 2009 22:46:43 -0000 this for 7-STABLE? On 12/6/09, Jilles Tjoelker wrote: > Author: jilles > Date: Sun Dec 6 22:01:45 2009 > New Revision: 200188 > URL: http://svn.freebsd.org/changeset/base/200188 > > Log: > MFC r198963: sh: Fix memory leak when using a variable in arithmetic > like $((x)). > > Modified: > stable/8/bin/sh/arith_lex.l > Directory Properties: > stable/8/bin/sh/ (props changed) > > Modified: stable/8/bin/sh/arith_lex.l > ============================================================================== > --- stable/8/bin/sh/arith_lex.l Sun Dec 6 21:42:25 2009 (r200187) > +++ stable/8/bin/sh/arith_lex.l Sun Dec 6 22:01:45 2009 (r200188) > @@ -51,6 +51,13 @@ __FBSDID("$FreeBSD$"); > > int yylex(void); > > +struct varname > +{ > + struct varname *next; > + char name[1]; > +}; > +static struct varname *varnames; > + > #undef YY_INPUT > #define YY_INPUT(buf,result,max) \ > result = (*buf = *arith_buf++) ? 1 : YY_NULL; > @@ -80,11 +87,14 @@ int yylex(void); > * If variable doesn't exist, we should initialize > * it to zero. > */ > - char *temp; > + struct varname *temp; > if (lookupvar(yytext) == NULL) > setvarsafe(yytext, "0", 0); > - temp = (char *)ckmalloc(strlen(yytext) + 1); > - yylval.s_value = strcpy(temp, yytext); > + temp = ckmalloc(sizeof(struct varname) + > + strlen(yytext)); > + temp->next = varnames; > + varnames = temp; > + yylval.s_value = strcpy(temp->name, yytext); > > return ARITH_VAR; > } > @@ -130,5 +140,15 @@ int yylex(void); > void > arith_lex_reset(void) > { > + struct varname *name, *next; > + > YY_NEW_FILE; > + > + name = varnames; > + while (name != NULL) { > + next = name->next; > + ckfree(name); > + name = next; > + } > + varnames = NULL; > } > _______________________________________________ > svn-src-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable > To unsubscribe, send any mail to "svn-src-stable-unsubscribe@freebsd.org" > From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 7 06:05:36 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C94EF106566C; Mon, 7 Dec 2009 06:05:36 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B18A28FC15; Mon, 7 Dec 2009 06:05:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB765aAg043377; Mon, 7 Dec 2009 06:05:36 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB765ahB043372; Mon, 7 Dec 2009 06:05:36 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <200912070605.nB765ahB043372@svn.freebsd.org> From: Hiroki Sato Date: Mon, 7 Dec 2009 06:05:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200204 - stable/8/sbin/ifconfig X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 06:05:36 -0000 Author: hrs Date: Mon Dec 7 06:05:36 2009 New Revision: 200204 URL: http://svn.freebsd.org/changeset/base/200204 Log: MFC: r197138: - The ifconfig(8) command now supports NDP flags which are handled by ndp(8). r198006: - Use printb() to display the "nd6 options=" line. Added: stable/8/sbin/ifconfig/af_nd6.c - copied, changed from r197138, head/sbin/ifconfig/af_nd6.c Modified: stable/8/sbin/ifconfig/Makefile stable/8/sbin/ifconfig/af_inet6.c stable/8/sbin/ifconfig/ifconfig.8 Directory Properties: stable/8/sbin/ifconfig/ (props changed) Modified: stable/8/sbin/ifconfig/Makefile ============================================================================== --- stable/8/sbin/ifconfig/Makefile Mon Dec 7 05:57:28 2009 (r200203) +++ stable/8/sbin/ifconfig/Makefile Mon Dec 7 06:05:36 2009 (r200204) @@ -18,6 +18,7 @@ SRCS+= af_link.c # LLC support SRCS+= af_inet.c # IPv4 support SRCS+= af_inet6.c # IPv6 support SRCS+= af_atalk.c # AppleTalk support +SRCS+= af_nd6.c # ND6 support SRCS+= ifclone.c # clone device support SRCS+= ifmac.c # MAC support Modified: stable/8/sbin/ifconfig/af_inet6.c ============================================================================== --- stable/8/sbin/ifconfig/af_inet6.c Mon Dec 7 05:57:28 2009 (r200203) +++ stable/8/sbin/ifconfig/af_inet6.c Mon Dec 7 06:05:36 2009 (r200204) @@ -67,6 +67,9 @@ static int prefix(void *, int); static char *sec2str(time_t); static int explicit_prefix = 0; +extern void setnd6flags(const char *, int, int, const struct afswtch *); +extern void setnd6defif(const char *, int, int, const struct afswtch *); + static char addr_buf[MAXHOSTNAMELEN *2 + 1]; /*for getnameinfo()*/ static void @@ -493,6 +496,16 @@ static struct cmd inet6_cmds[] = { DEF_CMD("-deprecated", -IN6_IFF_DEPRECATED, setip6flags), DEF_CMD("autoconf", IN6_IFF_AUTOCONF, setip6flags), DEF_CMD("-autoconf", -IN6_IFF_AUTOCONF, setip6flags), + DEF_CMD("accept_rtadv", ND6_IFF_ACCEPT_RTADV, setnd6flags), + DEF_CMD("-accept_rtadv",-ND6_IFF_ACCEPT_RTADV, setnd6flags), + DEF_CMD("defaultif", 1, setnd6defif), + DEF_CMD("-defaultif", -1, setnd6defif), + DEF_CMD("ifdisabled", ND6_IFF_IFDISABLED, setnd6flags), + DEF_CMD("-ifdisabled", -ND6_IFF_IFDISABLED, setnd6flags), + DEF_CMD("nud", ND6_IFF_PERFORMNUD, setnd6flags), + DEF_CMD("-nud", -ND6_IFF_PERFORMNUD, setnd6flags), + DEF_CMD("prefer_source",ND6_IFF_PREFER_SOURCE, setnd6flags), + DEF_CMD("-prefer_source",-ND6_IFF_PREFER_SOURCE,setnd6flags), DEF_CMD_ARG("pltime", setip6pltime), DEF_CMD_ARG("vltime", setip6vltime), DEF_CMD("eui64", 0, setip6eui64), Copied and modified: stable/8/sbin/ifconfig/af_nd6.c (from r197138, head/sbin/ifconfig/af_nd6.c) ============================================================================== --- head/sbin/ifconfig/af_nd6.c Sat Sep 12 22:08:20 2009 (r197138, copy source) +++ stable/8/sbin/ifconfig/af_nd6.c Mon Dec 7 06:05:36 2009 (r200204) @@ -56,17 +56,9 @@ static const char rcsid[] = #include "ifconfig.h" #define MAX_SYSCTL_TRY 5 - -static struct nd6_opt_list { - const char *label; - u_int mask; -} nd6_opts[] = { - { "IFDISABLED", ND6_IFF_IFDISABLED, }, - { "PERFORMNUD", ND6_IFF_PERFORMNUD, }, - { "ACCEPT_RTADV", ND6_IFF_ACCEPT_RTADV, }, - { "PREFER_SOURCE", ND6_IFF_PREFER_SOURCE, }, - { "AUTO_LINKLOCAL", ND6_IFF_AUTO_LINKLOCAL, }, -}; +#define ND6BITS "\020\001PERFORMNUD\002ACCEPT_RTADV\003PREFER_SOURCE" \ + "\004IFDISABLED\005DONT_SET_IFROUTE\006AUTO_LINKLOCAL" \ + "\020DEFAULTIF" static int isnd6defif(int); void setnd6flags(const char *, int, int, const struct afswtch *); @@ -153,9 +145,8 @@ nd6_status(int s) char *buf, *next; int mib[6], ntry; int s6; - int i, error; + int error; int isinet6, isdefif; - int nopts; /* Check if the interface has at least one IPv6 address. */ mib[0] = CTL_NET; @@ -220,22 +211,9 @@ nd6_status(int s) close(s6); if (nd.ndi.flags == 0 && !isdefif) return; - - nopts = 0; - printf("\tnd6 options=%d<", nd.ndi.flags); - for (i=0; i < sizeof(nd6_opts)/sizeof(nd6_opts[0]); i++) { - if (nd.ndi.flags & nd6_opts[i].mask) { - if (nopts++) - printf(","); - printf("%s", nd6_opts[i].label); - } - } - if (isdefif) { - if (nopts) - printf(","); - printf("DEFAULTIF"); - } - printf(">\n"); + printb("\tnd6 options", + (unsigned int)(nd.ndi.flags | (isdefif << 15)), ND6BITS); + putchar('\n'); } static struct afswtch af_nd6 = { Modified: stable/8/sbin/ifconfig/ifconfig.8 ============================================================================== --- stable/8/sbin/ifconfig/ifconfig.8 Mon Dec 7 05:57:28 2009 (r200203) +++ stable/8/sbin/ifconfig/ifconfig.8 Mon Dec 7 06:05:36 2009 (r200204) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd July 8, 2009 +.Dd December 7, 2009 .Dt IFCONFIG 8 .Os .Sh NAME @@ -598,6 +598,38 @@ If the interface was reset when previous the hardware will be re-initialized. .El .Pp +The following parameters are for ICMPv6 Neightbor Discovery Protocol: +.Bl -tag -width indent +.It Cm accept_rtadv +Set a flag to enable accepting ICMPv6 Router Advertisement messages. +.It Cm -accept_rtadv +Clear a flag +.Cm accept_rtadv . +.It Cm defaultif +Set the specified interface as the default route when there is no +default router. +.It Cm -defaultif +Clear a flag +.Cm defaultif . +.It Cm ifdisabled +Set a flag to disable all of IPv6 network communications on the +specified interface. +.It Cm -ifdisabled +Clear a flag +.Cm ifdisabled . +.It Cm nud +Set a flag to enable Neighbor Unreachability Detection. +.It Cm -nud +Clear a flag +.Cm nud . +.It Cm prefer_source +Set a flag to prefer addesses on the interface as candidates of the +source address for outgoing packets. +.It Cm -prefer_source +Clear a flag +.Cm prefer_source . +.El +.Pp The following parameters are specific to cloning IEEE 802.11 wireless interfaces with the .Cm create From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 7 06:25:19 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C57751065670; Mon, 7 Dec 2009 06:25:19 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B32CF8FC08; Mon, 7 Dec 2009 06:25:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB76PJtR043798; Mon, 7 Dec 2009 06:25:19 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB76PJli043796; Mon, 7 Dec 2009 06:25:19 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <200912070625.nB76PJli043796@svn.freebsd.org> From: Hiroki Sato Date: Mon, 7 Dec 2009 06:25:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200205 - stable/8/etc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 06:25:19 -0000 Author: hrs Date: Mon Dec 7 06:25:19 2009 New Revision: 200205 URL: http://svn.freebsd.org/changeset/base/200205 Log: MFC: r197144: - Add an extension of set_rcvar(), a new function set_rcvar_obsolete(), and $desc. The set_rcvar_obsolete() is to mark a variable as obsolete and define the new one. More specifically, a warning is displayed when a variable is removed or changed in the source tree and the user still defines the old one. Modified: stable/8/etc/rc.subr Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/rc.subr ============================================================================== --- stable/8/etc/rc.subr Mon Dec 7 06:05:36 2009 (r200204) +++ stable/8/etc/rc.subr Mon Dec 7 06:25:19 2009 (r200205) @@ -72,37 +72,63 @@ esac # functions # --------- +# set_rcvar [var] [defval] [desc] # -# set_rcvar base_var -# Set the variable name enabling a specific service. -# FreeBSD uses ${service}_enable, while NetBSD uses -# just the name of the service. For example: -# FreeBSD: sendmail_enable="YES" -# NetBSD : sendmail="YES" -# $1 - if $name is not the base to work of off, specify -# a different one +# Echo or define a rc.conf(5) variable name. Global variable +# $rcvars is used. +# +# If no argument is specified, echo "${name}_enable". +# +# If only a var is specified, echo "${var}_enable". +# +# If var and defval are specified, the ${var} is defined as +# rc.conf(5) variable and the default value is ${defvar}. An +# optional argument $desc can also be specified to add a +# description for that. # set_rcvar() { - if [ -z "$1" ]; then - base_var=${name} - else - base_var="$1" - fi - - case ${OSTYPE} in - FreeBSD) - echo ${base_var}_enable + case $# in + 0) + echo ${name}_enable ;; - NetBSD) - echo ${base_var} + 1) + echo ${1}_enable ;; *) - echo 'XXX' + debug "rcvar_define: \$$1=$2 is added" \ + " as a rc.conf(5) variable." + + local _var + _var=$1 + rcvars="${rcvars# } $_var" + eval ${_var}_defval=\"$2\" + shift 2 + # encode multiple lines of _desc + for l in "$@"; do + eval ${_var}_desc=\"\${${_var}_desc#^^}^^$l\" + done + eval ${_var}_desc=\"\${${_var}_desc#^^}\" ;; esac } +# set_rcvar_obsolete oldvar [newvar] [msg] +# Define obsolete variable. +# Global variable $rcvars_obsolete is used. +# +set_rcvar_obsolete() +{ + local _var + _var=$1 + debug "rcvar_obsolete: \$$1(old) -> \$$2(new) is defined" + + rcvars_obsolete="${rcvars_obsolete# } $1" + eval ${1}_newvar=\"$2\" + shift 2 + eval ${_var}_obsolete_msg=\"$*\" +} + # # force_depend script # Force a service to start. Intended for use by services @@ -415,6 +441,8 @@ check_startmsgs() # command_interpreter n If not empty, command is interpreted, so # call check_{pidfile,process}() appropriately. # +# desc n Description of script. +# # extra_commands n List of extra commands supported. # # pidfile n If set, use check_pidfile $pidfile $command, @@ -588,7 +616,7 @@ run_rc_command() esac eval _override_command=\$${name}_program - command=${_override_command:-$command} + command=${command:-${_override_command}} _keywords="start stop restart rcvar $extra_commands" rc_pid= @@ -792,14 +820,49 @@ $command $rc_flags $command_args" ;; rcvar) - echo "# $name" - if [ -n "$rcvar" ]; then - if checkyesno ${rcvar}; then - echo "${rcvar}=YES" - else - echo "${rcvar}=NO" - fi + echo -n "# $name" + if [ -n "$desc" ]; then + echo " : $desc" + else + echo "" fi + echo "#" + # Get unique vars in $rcvar $rcvars + for _v in $rcvar $rcvars; do + case $v in + $_v\ *|\ *$_v|*\ $_v\ *) ;; + *) v="${v# } $_v" ;; + esac + done + + # Display variables. + for _v in $v; do + if [ -z "$_v" ]; then + continue + fi + + eval _desc=\$${_v}_desc + eval _defval=\$${_v}_defval + _h="-" + + eval echo \"$_v=\\\"\$$_v\\\"\" + # decode multiple lines of _desc + while [ -n "$_desc" ]; do + case $_desc in + *^^*) + echo "# $_h ${_desc%%^^*}" + _desc=${_desc#*^^} + _h=" " + ;; + *) + echo "# $_h ${_desc}" + break + ;; + esac + done + echo "# (default: \"$_defval\")" + done + echo "" ;; *) @@ -910,7 +973,8 @@ run_rc_script() unset name command command_args command_interpreter \ extra_commands pidfile procname \ - rcvar required_dirs required_files required_vars + rcvar rcvars rcvars_obsolete required_dirs required_files \ + required_vars eval unset ${_arg}_cmd ${_arg}_precmd ${_arg}_postcmd case "$_file" in @@ -941,6 +1005,7 @@ run_rc_script() # load_rc_config() { + local _name _var _defval _v _msg _new _name=$1 if [ -z "$_name" ]; then err 3 'USAGE: load_rc_config name' @@ -967,6 +1032,36 @@ load_rc_config() # Old variable names support # [ -n "$enable_quotas" ] && quota_enable="$enable_quotas" + + # Set defaults if defined. + for _var in $rcvar $rcvars; do + _defval=`eval echo "\\\$${_var}_defval"` + if [ -n "$_defval" ]; then + eval : \${$_var:=\$${_var}_defval} + fi + done + + # check obsolete rc.conf variables + for _var in $rcvars_obsolete; do + _v=`eval echo \\$$_var` + _msg=`eval echo \\$${_var}_obsolete_msg` + _new=`eval echo \\$${_var}_newvar` + case $_v in + "") + ;; + *) + if [ -z "$_new" ]; then + _msg="Ignored." + else + eval $_new=\"\$$_var\" + if [ -z "$_msg" ]; then + _msg="Use \$$_new instead." + fi + fi + warn "\$$_var is obsolete. $_msg" + ;; + esac + done } # From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 7 07:33:52 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78080106568B; Mon, 7 Dec 2009 07:33:52 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 644288FC12; Mon, 7 Dec 2009 07:33:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB77XqO9045229; Mon, 7 Dec 2009 07:33:52 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB77Xq4u045211; Mon, 7 Dec 2009 07:33:52 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <200912070733.nB77Xq4u045211@svn.freebsd.org> From: Michael Tuexen Date: Mon, 7 Dec 2009 07:33:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200208 - in stable/8/sys: kern net netinet netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 07:33:52 -0000 Author: tuexen Date: Mon Dec 7 07:33:51 2009 New Revision: 200208 URL: http://svn.freebsd.org/changeset/base/200208 Log: MFC 197288,197326,197327,197328,197342,197914,197929, 197955,199365,199370,199371,199373,199866 This MFCs all SCTP/VNET relevant fixes from head. Approved by: rrs (mentor) Modified: stable/8/sys/kern/uipc_syscalls.c stable/8/sys/net/route.c stable/8/sys/netinet/in_proto.c stable/8/sys/netinet/sctp_asconf.c stable/8/sys/netinet/sctp_bsd_addr.c stable/8/sys/netinet/sctp_constants.h stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_os_bsd.h stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_pcb.h stable/8/sys/netinet/sctp_structs.h stable/8/sys/netinet/sctp_sysctl.c stable/8/sys/netinet/sctp_timer.c stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctputil.c stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/uipc_syscalls.c ============================================================================== --- stable/8/sys/kern/uipc_syscalls.c Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/kern/uipc_syscalls.c Mon Dec 7 07:33:51 2009 (r200208) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2311,6 +2312,7 @@ sctp_peeloff(td, uap) goto done; td->td_retval[0] = fd; + CURVNET_SET(head->so_vnet); so = sonewconn(head, SS_ISCONNECTED); if (so == NULL) goto noconnection; @@ -2350,6 +2352,7 @@ noconnection: /* * Release explicitly held references before returning. */ + CURVNET_RESTORE(); done: if (nfp != NULL) fdrop(nfp, td); @@ -2428,9 +2431,11 @@ sctp_generic_sendmsg (td, uap) auio.uio_offset = 0; /* XXX */ auio.uio_resid = 0; len = auio.uio_resid = uap->mlen; + CURVNET_SET(so->so_vnet); error = sctp_lower_sosend(so, to, &auio, (struct mbuf *)NULL, (struct mbuf *)NULL, uap->flags, use_rcvinfo, u_sinfo, td); + CURVNET_RESTORE(); if (error) { if (auio.uio_resid != len && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) @@ -2538,9 +2543,11 @@ sctp_generic_sendmsg_iov(td, uap) } } len = auio.uio_resid; + CURVNET_SET(so->so_vnet); error = sctp_lower_sosend(so, to, &auio, (struct mbuf *)NULL, (struct mbuf *)NULL, uap->flags, use_rcvinfo, u_sinfo, td); + CURVNET_RESTORE(); if (error) { if (auio.uio_resid != len && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) @@ -2660,9 +2667,11 @@ sctp_generic_recvmsg(td, uap) if (KTRPOINT(td, KTR_GENIO)) ktruio = cloneuio(&auio); #endif /* KTRACE */ + CURVNET_SET(so->so_vnet); error = sctp_sorecvmsg(so, &auio, (struct mbuf **)NULL, fromsa, fromlen, &msg_flags, (struct sctp_sndrcvinfo *)&sinfo, 1); + CURVNET_RESTORE(); if (error) { if (auio.uio_resid != (int)len && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) Modified: stable/8/sys/net/route.c ============================================================================== --- stable/8/sys/net/route.c Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/net/route.c Mon Dec 7 07:33:51 2009 (r200208) @@ -1497,7 +1497,11 @@ rtinit1(struct ifaddr *ifa, int cmd, int ((struct sockaddr_dl *)rt->rt_gateway)->sdl_index = rt->rt_ifp->if_index; } + RT_ADDREF(rt); + RT_UNLOCK(rt); rt_newaddrmsg(cmd, ifa, error, rt); + RT_LOCK(rt); + RT_REMREF(rt); if (cmd == RTM_DELETE) { /* * If we are deleting, and we found an entry, Modified: stable/8/sys/netinet/in_proto.c ============================================================================== --- stable/8/sys/netinet/in_proto.c Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/netinet/in_proto.c Mon Dec 7 07:33:51 2009 (r200208) @@ -150,39 +150,42 @@ struct protosw inetsw[] = { }, #ifdef SCTP { - .pr_type = SOCK_DGRAM, - .pr_domain = &inetdomain, - .pr_protocol = IPPROTO_SCTP, - .pr_flags = PR_WANTRCVD, - .pr_input = sctp_input, - .pr_ctlinput = sctp_ctlinput, - .pr_ctloutput = sctp_ctloutput, - .pr_init = sctp_init, - .pr_drain = sctp_drain, - .pr_usrreqs = &sctp_usrreqs -}, -{ - .pr_type = SOCK_SEQPACKET, - .pr_domain = &inetdomain, - .pr_protocol = IPPROTO_SCTP, - .pr_flags = PR_WANTRCVD, - .pr_input = sctp_input, - .pr_ctlinput = sctp_ctlinput, - .pr_ctloutput = sctp_ctloutput, - .pr_drain = sctp_drain, - .pr_usrreqs = &sctp_usrreqs + .pr_type = SOCK_DGRAM, + .pr_domain = &inetdomain, + .pr_protocol = IPPROTO_SCTP, + .pr_flags = PR_WANTRCVD, + .pr_input = sctp_input, + .pr_ctlinput = sctp_ctlinput, + .pr_ctloutput = sctp_ctloutput, + .pr_init = sctp_init, +#ifdef VIMAGE + .pr_destroy = sctp_finish, +#endif + .pr_drain = sctp_drain, + .pr_usrreqs = &sctp_usrreqs +}, +{ + .pr_type = SOCK_SEQPACKET, + .pr_domain = &inetdomain, + .pr_protocol = IPPROTO_SCTP, + .pr_flags = PR_WANTRCVD, + .pr_input = sctp_input, + .pr_ctlinput = sctp_ctlinput, + .pr_ctloutput = sctp_ctloutput, + .pr_drain = sctp_drain, + .pr_usrreqs = &sctp_usrreqs }, { - .pr_type = SOCK_STREAM, - .pr_domain = &inetdomain, - .pr_protocol = IPPROTO_SCTP, - .pr_flags = PR_WANTRCVD, - .pr_input = sctp_input, - .pr_ctlinput = sctp_ctlinput, - .pr_ctloutput = sctp_ctloutput, - .pr_drain = sctp_drain, - .pr_usrreqs = &sctp_usrreqs + .pr_type = SOCK_STREAM, + .pr_domain = &inetdomain, + .pr_protocol = IPPROTO_SCTP, + .pr_flags = PR_WANTRCVD, + .pr_input = sctp_input, + .pr_ctlinput = sctp_ctlinput, + .pr_ctloutput = sctp_ctloutput, + .pr_drain = sctp_drain, + .pr_usrreqs = &sctp_usrreqs }, #endif /* SCTP */ { Modified: stable/8/sys/netinet/sctp_asconf.c ============================================================================== --- stable/8/sys/netinet/sctp_asconf.c Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/netinet/sctp_asconf.c Mon Dec 7 07:33:51 2009 (r200208) @@ -881,7 +881,7 @@ send_reply: /* we probably don't need these operations */ (void)sa6_recoverscope(from6); sa6_embedscope(from6, - MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)); + MODULE_GLOBAL(ip6_use_defzone)); break; } Modified: stable/8/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/8/sys/netinet/sctp_bsd_addr.c Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/netinet/sctp_bsd_addr.c Mon Dec 7 07:33:51 2009 (r200208) @@ -89,6 +89,7 @@ sctp_wakeup_iterator(void) static void sctp_iterator_thread(void *v) { + CURVNET_SET((struct vnet *)v); SCTP_IPI_ITERATOR_WQ_LOCK(); SCTP_BASE_INFO(iterator_running) = 0; while (1) { @@ -96,10 +97,12 @@ sctp_iterator_thread(void *v) &SCTP_BASE_INFO(ipi_iterator_wq_mtx), 0, "waiting_for_work", 0); if (SCTP_BASE_INFO(threads_must_exit)) { + SCTP_IPI_ITERATOR_WQ_DESTROY(); kthread_exit(); } sctp_iterator_worker(); } + CURVNET_RESTORE(); } void @@ -108,7 +111,7 @@ sctp_startup_iterator(void) int ret; ret = kproc_create(sctp_iterator_thread, - (void *)NULL, + (void *)curvnet, &SCTP_BASE_INFO(thread_proc), RFPROC, SCTP_KTHREAD_PAGES, @@ -126,7 +129,7 @@ sctp_gather_internal_ifa_flags(struct sc ifa6 = (struct in6_ifaddr *)ifa->ifa; ifa->flags = ifa6->ia6_flags; - if (!MODULE_GLOBAL(MOD_INET6, ip6_use_deprecated)) { + if (!MODULE_GLOBAL(ip6_use_deprecated)) { if (ifa->flags & IN6_IFF_DEPRECATED) { ifa->localifa_flags |= SCTP_ADDR_IFA_UNUSEABLE; @@ -206,7 +209,8 @@ sctp_init_ifns_for_vrf(int vrfid) struct sctp_ifa *sctp_ifa; uint32_t ifa_flags; - TAILQ_FOREACH(ifn, &MODULE_GLOBAL(MOD_NET, ifnet), if_list) { + IFNET_RLOCK(); + TAILQ_FOREACH(ifn, &MODULE_GLOBAL(ifnet), if_list) { IF_ADDR_LOCK(ifn); TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { if (ifa->ifa_addr == NULL) { @@ -251,6 +255,7 @@ sctp_init_ifns_for_vrf(int vrfid) } IF_ADDR_UNLOCK(ifn); } + IFNET_RUNLOCK(); } void @@ -336,7 +341,8 @@ void struct ifnet *ifn; struct ifaddr *ifa; - TAILQ_FOREACH(ifn, &MODULE_GLOBAL(MOD_NET, ifnet), if_list) { + IFNET_RLOCK(); + TAILQ_FOREACH(ifn, &MODULE_GLOBAL(ifnet), if_list) { if (!(*pred) (ifn)) { continue; } @@ -344,6 +350,7 @@ void sctp_addr_change(ifa, add ? RTM_ADD : RTM_DELETE); } } + IFNET_RUNLOCK(); } struct mbuf * Modified: stable/8/sys/netinet/sctp_constants.h ============================================================================== --- stable/8/sys/netinet/sctp_constants.h Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/netinet/sctp_constants.h Mon Dec 7 07:33:51 2009 (r200208) @@ -87,10 +87,13 @@ __FBSDID("$FreeBSD$"); /* #define SCTP_AUDITING_ENABLED 1 used for debug/auditing */ #define SCTP_AUDIT_SIZE 256 +/* temporary disabled since it does not work with VNET. */ +#if 0 #define SCTP_USE_THREAD_BASED_ITERATOR 1 +#endif #define SCTP_KTRHEAD_NAME "sctp_iterator" -#define SCTP_KTHREAD_PAGES 2 +#define SCTP_KTHREAD_PAGES 0 /* If you support Multi-VRF how big to Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/netinet/sctp_input.c Mon Dec 7 07:33:51 2009 (r200208) @@ -5876,7 +5876,7 @@ sctp_skip_csum_4: * idea, so I will leave it in place. */ if (inp && ipsec4_in_reject(m, &inp->ip_inp.inp)) { - MODULE_GLOBAL(MOD_IPSEC, ipsec4stat).in_polvio++; + MODULE_GLOBAL(ipsec4stat).in_polvio++; SCTP_STAT_INCR(sctps_hdrops); goto bad; } Modified: stable/8/sys/netinet/sctp_os_bsd.h ============================================================================== --- stable/8/sys/netinet/sctp_os_bsd.h Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/netinet/sctp_os_bsd.h Mon Dec 7 07:33:51 2009 (r200208) @@ -78,10 +78,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef VIMAGE -#error "SCTP is not yet compatible with VIMAGE." -#endif - #ifdef IPSEC #include #include @@ -137,25 +133,21 @@ MALLOC_DECLARE(SCTP_M_SOCKOPT); #define SCTP_CTR6 CTR6 #endif -#define SCTP_BASE_INFO(__m) system_base_info.sctppcbinfo.__m -#define SCTP_BASE_STATS system_base_info.sctpstat -#define SCTP_BASE_STAT(__m) system_base_info.sctpstat.__m -#define SCTP_BASE_SYSCTL(__m) system_base_info.sctpsysctl.__m -#define SCTP_BASE_VAR(__m) system_base_info.__m - /* * Macros to expand out globals defined by various modules * to either a real global or a virtualized instance of one, * depending on whether VIMAGE is defined. */ -/* first define modules that supply us information */ -#define MOD_NET net -#define MOD_INET inet -#define MOD_INET6 inet6 -#define MOD_IPSEC ipsec - /* then define the macro(s) that hook into the vimage macros */ -#define MODULE_GLOBAL(__MODULE, __SYMBOL) V_ ## __SYMBOL +#define MODULE_GLOBAL(__SYMBOL) V_##__SYMBOL + +#define V_system_base_info VNET(system_base_info) +#define SCTP_BASE_INFO(__m) V_system_base_info.sctppcbinfo.__m +#define SCTP_BASE_STATS V_system_base_info.sctpstat +#define SCTP_BASE_STATS_SYSCTL VNET_NAME(system_base_info.sctpstat) +#define SCTP_BASE_STAT(__m) V_system_base_info.sctpstat.__m +#define SCTP_BASE_SYSCTL(__m) VNET_NAME(system_base_info.sctpsysctl.__m) +#define SCTP_BASE_VAR(__m) V_system_base_info.__m /* * @@ -263,10 +255,9 @@ MALLOC_DECLARE(SCTP_M_SOCKOPT); /* SCTP_ZONE_INIT: initialize the zone */ typedef struct uma_zone *sctp_zone_t; -#define UMA_ZFLAG_FULL 0x0020 #define SCTP_ZONE_INIT(zone, name, size, number) { \ zone = uma_zcreate(name, size, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,\ - UMA_ZFLAG_FULL); \ + 0); \ uma_zone_set_max(zone, number); \ } Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/netinet/sctp_output.c Mon Dec 7 07:33:51 2009 (r200208) @@ -3829,7 +3829,7 @@ sctp_lowlevel_chunk_output(struct sctp_i sin6 = &tmp; /* KAME hack: embed scopeid */ - if (sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)) != 0) { + if (sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)) != 0) { SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); return (EINVAL); } @@ -3883,7 +3883,7 @@ sctp_lowlevel_chunk_output(struct sctp_i if (net->src_addr_selected == 0) { sin6 = (struct sockaddr_in6 *)&net->ro._l_addr; /* KAME hack: embed scopeid */ - if (sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)) != 0) { + if (sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)) != 0) { SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); return (EINVAL); } @@ -3906,7 +3906,7 @@ sctp_lowlevel_chunk_output(struct sctp_i } else { sin6 = (struct sockaddr_in6 *)&ro->ro_dst; /* KAME hack: embed scopeid */ - if (sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)) != 0) { + if (sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)) != 0) { SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); return (EINVAL); } @@ -5143,7 +5143,7 @@ do_a_abort: */ (void)sa6_recoverscope(sin6); stc.scope_id = sin6->sin6_scope_id; - sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)); + sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)); stc.loopback_scope = 1; stc.local_scope = 0; stc.site_scope = 1; @@ -5179,7 +5179,7 @@ do_a_abort: */ (void)sa6_recoverscope(sin6); stc.scope_id = sin6->sin6_scope_id; - sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)); + sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)); } else if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) { /* * If the new destination is @@ -10768,7 +10768,7 @@ sctp_send_shutdown_complete2(struct mbuf /* Fill in the IPv6 header for the ABORT */ ip6_out->ip6_flow = ip6->ip6_flow; - ip6_out->ip6_hlim = MODULE_GLOBAL(MOD_INET6, ip6_defhlim); + ip6_out->ip6_hlim = MODULE_GLOBAL(ip6_defhlim); if (port) { ip6_out->ip6_nxt = IPPROTO_UDP; } else { @@ -11787,7 +11787,7 @@ sctp_send_abort(struct mbuf *m, int iphl /* Fill in the IP6 header for the ABORT */ ip6_out->ip6_flow = ip6->ip6_flow; - ip6_out->ip6_hlim = MODULE_GLOBAL(MOD_INET6, ip6_defhlim); + ip6_out->ip6_hlim = MODULE_GLOBAL(ip6_defhlim); if (port) { ip6_out->ip6_nxt = IPPROTO_UDP; } else { @@ -12014,7 +12014,7 @@ sctp_send_operr_to(struct mbuf *m, int i /* Fill in the IP6 header for the ABORT */ ip6_out->ip6_flow = ip6->ip6_flow; - ip6_out->ip6_hlim = MODULE_GLOBAL(MOD_INET6, ip6_defhlim); + ip6_out->ip6_hlim = MODULE_GLOBAL(ip6_defhlim); if (port) { ip6_out->ip6_nxt = IPPROTO_UDP; } else { @@ -13765,7 +13765,7 @@ sctp_v6src_match_nexthop(struct sockaddr return (0); /* get prefix entry of address */ - LIST_FOREACH(pfx, &MODULE_GLOBAL(MOD_INET6, nd_prefix), ndpr_entry) { + LIST_FOREACH(pfx, &MODULE_GLOBAL(nd_prefix), ndpr_entry) { if (pfx->ndpr_stateflags & NDPRF_DETACHED) continue; if (IN6_ARE_MASKED_ADDR_EQUAL(&pfx->ndpr_prefix.sin6_addr, Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/netinet/sctp_pcb.c Mon Dec 7 07:33:51 2009 (r200208) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #include -struct sctp_base_info system_base_info; +VNET_DEFINE(struct sctp_base_info, system_base_info); /* FIX: we don't handle multiple link local scopes */ /* "scopeless" replacement IN6_ARE_ADDR_EQUAL */ @@ -59,11 +59,11 @@ SCTP6_ARE_ADDR_EQUAL(struct sockaddr_in6 struct sockaddr_in6 tmp_a, tmp_b; memcpy(&tmp_a, a, sizeof(struct sockaddr_in6)); - if (sa6_embedscope(&tmp_a, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)) != 0) { + if (sa6_embedscope(&tmp_a, MODULE_GLOBAL(ip6_use_defzone)) != 0) { return 0; } memcpy(&tmp_b, b, sizeof(struct sockaddr_in6)); - if (sa6_embedscope(&tmp_b, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)) != 0) { + if (sa6_embedscope(&tmp_b, MODULE_GLOBAL(ip6_use_defzone)) != 0) { return 0; } return (IN6_ARE_ADDR_EQUAL(&tmp_a.sin6_addr, &tmp_b.sin6_addr)); @@ -2008,7 +2008,7 @@ sctp_findassociation_addr(struct mbuf *m /* Get the scopes in properly to the sin6 addr's */ /* we probably don't need these operations */ (void)sa6_recoverscope(from6); - sa6_embedscope(from6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)); + sa6_embedscope(from6, MODULE_GLOBAL(ip6_use_defzone)); break; } #endif @@ -2049,7 +2049,7 @@ sctp_findassociation_addr(struct mbuf *m /* Get the scopes in properly to the sin6 addr's */ /* we probably don't need these operations */ (void)sa6_recoverscope(to6); - sa6_embedscope(to6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)); + sa6_embedscope(to6, MODULE_GLOBAL(ip6_use_defzone)); break; } #endif @@ -2316,7 +2316,7 @@ sctp_inpcb_alloc(struct socket *so, uint } #endif /* IPSEC */ SCTP_INCR_EP_COUNT(); - inp->ip_inp.inp.inp_ip_ttl = MODULE_GLOBAL(MOD_INET, ip_defttl); + inp->ip_inp.inp.inp_ip_ttl = MODULE_GLOBAL(ip_defttl); SCTP_INP_INFO_WUNLOCK(); so->so_pcb = (caddr_t)inp; @@ -2688,7 +2688,7 @@ sctp_inpcb_bind(struct socket *so, struc if (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { bindall = 0; /* KAME hack: embed scopeid */ - if (sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)) != 0) { + if (sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)) != 0) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); return (EINVAL); } @@ -2814,8 +2814,8 @@ continue_anyway: int done; if (ip_inp->inp_flags & INP_HIGHPORT) { - first = MODULE_GLOBAL(MOD_INET, ipport_hifirstauto); - last = MODULE_GLOBAL(MOD_INET, ipport_hilastauto); + first = MODULE_GLOBAL(ipport_hifirstauto); + last = MODULE_GLOBAL(ipport_hilastauto); } else if (ip_inp->inp_flags & INP_LOWPORT) { if (p && (error = priv_check(p, PRIV_NETINET_RESERVEDPORT) @@ -2826,11 +2826,11 @@ continue_anyway: SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); return (error); } - first = MODULE_GLOBAL(MOD_INET, ipport_lowfirstauto); - last = MODULE_GLOBAL(MOD_INET, ipport_lowlastauto); + first = MODULE_GLOBAL(ipport_lowfirstauto); + last = MODULE_GLOBAL(ipport_lowlastauto); } else { - first = MODULE_GLOBAL(MOD_INET, ipport_firstauto); - last = MODULE_GLOBAL(MOD_INET, ipport_lastauto); + first = MODULE_GLOBAL(ipport_firstauto); + last = MODULE_GLOBAL(ipport_lastauto); } if (first > last) { uint16_t temp; @@ -3756,7 +3756,7 @@ sctp_add_remote_addr(struct sctp_tcb *st struct sockaddr_in6 *sin6; sin6 = (struct sockaddr_in6 *)&net->ro._l_addr; - (void)sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)); + (void)sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)); sin6->sin6_scope_id = 0; } #endif @@ -5558,36 +5558,54 @@ sctp_pcb_finish(void) struct sctp_ifa *ifa; struct sctpvtaghead *chain; struct sctp_tagblock *twait_block, *prev_twait_block; + struct sctp_laddr *wi; + struct sctp_iterator *it; int i; +#if defined(SCTP_USE_THREAD_BASED_ITERATOR) + SCTP_BASE_INFO(threads_must_exit) = 1; + /* Wake the thread up so it will exit now */ + sctp_wakeup_iterator(); + +#endif + SCTP_OS_TIMER_STOP(&SCTP_BASE_INFO(addr_wq_timer.timer)); + SCTP_IPI_ITERATOR_WQ_LOCK(); + while ((wi = LIST_FIRST(&SCTP_BASE_INFO(addr_wq))) != NULL) { + LIST_REMOVE(wi, sctp_nxt_addr); + SCTP_DECR_LADDR_COUNT(); + SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_laddr), wi); + } + SCTP_IPI_ITERATOR_WQ_UNLOCK(); + while ((it = TAILQ_FIRST(&SCTP_BASE_INFO(iteratorhead))) != NULL) { + if (it->function_atend != NULL) { + (*it->function_atend) (it->pointer, it->val); + } + TAILQ_REMOVE(&SCTP_BASE_INFO(iteratorhead), it, sctp_nxt_itr); + SCTP_FREE(it, SCTP_M_ITER); + } + /* * free the vrf/ifn/ifa lists and hashes (be sure address monitor is * destroyed first). */ vrf_bucket = &SCTP_BASE_INFO(sctp_vrfhash)[(SCTP_DEFAULT_VRFID & SCTP_BASE_INFO(hashvrfmark))]; - vrf = LIST_FIRST(vrf_bucket); - while (vrf) { - ifn = LIST_FIRST(&vrf->ifnlist); - while (ifn) { - ifa = LIST_FIRST(&ifn->ifalist); - while (ifa) { + while ((vrf = LIST_FIRST(vrf_bucket)) != NULL) { + while ((ifn = LIST_FIRST(&vrf->ifnlist)) != NULL) { + while ((ifa = LIST_FIRST(&ifn->ifalist)) != NULL) { /* free the ifa */ LIST_REMOVE(ifa, next_bucket); LIST_REMOVE(ifa, next_ifa); SCTP_FREE(ifa, SCTP_M_IFA); - ifa = LIST_FIRST(&ifn->ifalist); } /* free the ifn */ LIST_REMOVE(ifn, next_bucket); LIST_REMOVE(ifn, next_ifn); SCTP_FREE(ifn, SCTP_M_IFN); - ifn = LIST_FIRST(&vrf->ifnlist); } SCTP_HASH_FREE(vrf->vrf_addr_hash, vrf->vrf_addr_hashmark); /* free the vrf */ LIST_REMOVE(vrf, next_vrf); SCTP_FREE(vrf, SCTP_M_VRF); - vrf = LIST_FIRST(vrf_bucket); } /* free the vrf hashes */ SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_vrfhash), SCTP_BASE_INFO(hashvrfmark)); @@ -5614,9 +5632,7 @@ sctp_pcb_finish(void) /* free the locks and mutexes */ #ifdef SCTP_PACKET_LOGGING SCTP_IP_PKTLOG_DESTROY(); - #endif - SCTP_IPI_ITERATOR_WQ_DESTROY(); SCTP_IPI_ADDR_DESTROY(); SCTP_ITERATOR_LOCK_DESTROY(); SCTP_STATLOG_DESTROY(); @@ -6422,10 +6438,6 @@ sctp_drain_mbufs(struct sctp_inpcb *inp, /* We look for anything larger than the cum-ack + 1 */ - SCTP_STAT_INCR(sctps_protocol_drain_calls); - if (SCTP_BASE_SYSCTL(sctp_do_drain) == 0) { - return; - } asoc = &stcb->asoc; if (asoc->cumulative_tsn == asoc->highest_tsn_inside_map) { /* none we can reneg on. */ @@ -6588,22 +6600,37 @@ sctp_drain() * is LOW on MBUF's and needs help. This is where reneging will * occur. We really hope this does NOT happen! */ - struct sctp_inpcb *inp; - struct sctp_tcb *stcb; + VNET_ITERATOR_DECL(vnet_iter); + VNET_LIST_RLOCK_NOSLEEP(); + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); + struct sctp_inpcb *inp; + struct sctp_tcb *stcb; - SCTP_INP_INFO_RLOCK(); - LIST_FOREACH(inp, &SCTP_BASE_INFO(listhead), sctp_list) { - /* For each endpoint */ - SCTP_INP_RLOCK(inp); - LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { - /* For each association */ - SCTP_TCB_LOCK(stcb); - sctp_drain_mbufs(inp, stcb); - SCTP_TCB_UNLOCK(stcb); + SCTP_STAT_INCR(sctps_protocol_drain_calls); + if (SCTP_BASE_SYSCTL(sctp_do_drain) == 0) { +#ifdef VIMAGE + continue; +#else + return; +#endif } - SCTP_INP_RUNLOCK(inp); + SCTP_INP_INFO_RLOCK(); + LIST_FOREACH(inp, &SCTP_BASE_INFO(listhead), sctp_list) { + /* For each endpoint */ + SCTP_INP_RLOCK(inp); + LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { + /* For each association */ + SCTP_TCB_LOCK(stcb); + sctp_drain_mbufs(inp, stcb); + SCTP_TCB_UNLOCK(stcb); + } + SCTP_INP_RUNLOCK(inp); + } + SCTP_INP_INFO_RUNLOCK(); + CURVNET_RESTORE(); } - SCTP_INP_INFO_RUNLOCK(); + VNET_LIST_RUNLOCK_NOSLEEP(); } /* Modified: stable/8/sys/netinet/sctp_pcb.h ============================================================================== --- stable/8/sys/netinet/sctp_pcb.h Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/netinet/sctp_pcb.h Mon Dec 7 07:33:51 2009 (r200208) @@ -462,7 +462,7 @@ struct sctp_tcb { * goes with the base info. sctp_pcb.c has * the real definition. */ -extern struct sctp_base_info system_base_info; +VNET_DECLARE(struct sctp_base_info, system_base_info); #ifdef INET6 int SCTP6_ARE_ADDR_EQUAL(struct sockaddr_in6 *a, struct sockaddr_in6 *b); Modified: stable/8/sys/netinet/sctp_structs.h ============================================================================== --- stable/8/sys/netinet/sctp_structs.h Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/netinet/sctp_structs.h Mon Dec 7 07:33:51 2009 (r200208) @@ -51,6 +51,7 @@ struct sctp_timer { void *ep; void *tcb; void *net; + void *vnet; /* for sanity checking */ void *self; Modified: stable/8/sys/netinet/sctp_sysctl.c ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.c Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/netinet/sctp_sysctl.c Mon Dec 7 07:33:51 2009 (r200208) @@ -930,7 +930,7 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ou #endif SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_RW, - &SCTP_BASE_STATS, sctpstat, + &SCTP_BASE_STATS_SYSCTL, sctpstat, "SCTP statistics (struct sctp_stat)"); SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoclist, CTLFLAG_RD, Modified: stable/8/sys/netinet/sctp_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/netinet/sctp_timer.c Mon Dec 7 07:33:51 2009 (r200208) @@ -1773,7 +1773,7 @@ sctp_pathmtu_timer(struct sctp_inpcb *in struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&net->ro._l_addr; /* KAME hack: embed scopeid */ - (void)sa6_embedscope(sin6, MODULE_GLOBAL(MOD_INET6, ip6_use_defzone)); + (void)sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)); } #endif Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/netinet/sctp_usrreq.c Mon Dec 7 07:33:51 2009 (r200208) @@ -544,7 +544,7 @@ sctp_attach(struct socket *so, int proto inp->sctp_flags &= ~SCTP_PCB_FLAGS_BOUND_V6; /* I'm not v6! */ ip_inp = &inp->ip_inp.inp; ip_inp->inp_vflag |= INP_IPV4; - ip_inp->inp_ip_ttl = MODULE_GLOBAL(MOD_INET, ip_defttl); + ip_inp->inp_ip_ttl = MODULE_GLOBAL(ip_defttl); #ifdef IPSEC error = ipsec_init_policy(so, &ip_inp->inp_sp); #ifdef SCTP_LOG_CLOSING Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/netinet/sctputil.c Mon Dec 7 07:33:51 2009 (r200208) @@ -1446,6 +1446,7 @@ sctp_timeout_handler(void *t) inp = (struct sctp_inpcb *)tmr->ep; stcb = (struct sctp_tcb *)tmr->tcb; net = (struct sctp_nets *)tmr->net; + CURVNET_SET((struct vnet *)tmr->vnet); did_output = 1; #ifdef SCTP_AUDITING_ENABLED @@ -1459,6 +1460,7 @@ sctp_timeout_handler(void *t) * SCTP_PRINTF("Stale SCTP timer fired (%p), ignoring...\n", * tmr); */ + CURVNET_RESTORE(); return; } tmr->stopped_from = 0xa001; @@ -1467,10 +1469,12 @@ sctp_timeout_handler(void *t) * SCTP_PRINTF("SCTP timer fired with invalid type: 0x%x\n", * tmr->type); */ + CURVNET_RESTORE(); return; } tmr->stopped_from = 0xa002; if ((tmr->type != SCTP_TIMER_TYPE_ADDR_WQ) && (inp == NULL)) { + CURVNET_RESTORE(); return; } /* if this is an iterator timeout, get the struct and clear inp */ @@ -1494,6 +1498,7 @@ sctp_timeout_handler(void *t) (tmr->type != SCTP_TIMER_TYPE_ASOCKILL)) ) { SCTP_INP_DECR_REF(inp); + CURVNET_RESTORE(); return; } } @@ -1505,6 +1510,7 @@ sctp_timeout_handler(void *t) if (inp) { SCTP_INP_DECR_REF(inp); } + CURVNET_RESTORE(); return; } } @@ -1517,6 +1523,7 @@ sctp_timeout_handler(void *t) if (stcb) { atomic_add_int(&stcb->asoc.refcnt, -1); } + CURVNET_RESTORE(); return; } tmr->stopped_from = 0xa006; @@ -1531,6 +1538,7 @@ sctp_timeout_handler(void *t) if (inp) { SCTP_INP_DECR_REF(inp); } + CURVNET_RESTORE(); return; } } @@ -1903,6 +1911,7 @@ out_decr: out_no_decr: SCTPDBG(SCTP_DEBUG_TIMER1, "Timer now complete (type %d)\n", type); + CURVNET_RESTORE(); } void @@ -2263,6 +2272,7 @@ sctp_timer_start(int t_type, struct sctp tmr->tcb = (void *)stcb; tmr->net = (void *)net; tmr->self = (void *)tmr; + tmr->vnet = (void *)curvnet; tmr->ticks = sctp_get_tick_count(); (void)SCTP_OS_TIMER_START(&tmr->timer, to_ticks, sctp_timeout_handler, tmr); return; Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Mon Dec 7 06:41:27 2009 (r200207) +++ stable/8/sys/netinet6/sctp6_usrreq.c Mon Dec 7 07:33:51 2009 (r200208) @@ -223,7 +223,7 @@ sctp_skip_csum: */ if (in6p_ip && (ipsec6_in_reject(m, in6p_ip))) { /* XXX */ - MODULE_GLOBAL(MOD_IPSEC, ipsec6stat).in_polvio++; + MODULE_GLOBAL(ipsec6stat).in_polvio++; goto bad; } #endif /* IPSEC */ @@ -695,7 +695,7 @@ sctp6_attach(struct socket *so, int prot * socket as well, because the socket may be bound to an IPv6 * wildcard address, which may match an IPv4-mapped IPv6 address. */ - inp6->inp_ip_ttl = MODULE_GLOBAL(MOD_INET, ip_defttl); + inp6->inp_ip_ttl = MODULE_GLOBAL(ip_defttl); #endif /* * Hmm what about the IPSEC stuff that is missing here but in @@ -859,7 +859,7 @@ sctp6_send(struct socket *so, int flags, } } if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { - if (!MODULE_GLOBAL(MOD_INET6, ip6_v6only)) { + if (!MODULE_GLOBAL(ip6_v6only)) { struct sockaddr_in sin; /* convert v4-mapped into v4 addr and send */ @@ -990,7 +990,7 @@ sctp6_connect(struct socket *so, struct } } if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { - if (!MODULE_GLOBAL(MOD_INET6, ip6_v6only)) { + if (!MODULE_GLOBAL(ip6_v6only)) { /* convert v4-mapped into v4 addr */ in6_sin6_2_sin((struct sockaddr_in *)&ss, sin6); addr = (struct sockaddr *)&ss; From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 7 07:41:30 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 364F5106566B; Mon, 7 Dec 2009 07:41:30 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24AF28FC08; Mon, 7 Dec 2009 07:41:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB77fU1S045411; Mon, 7 Dec 2009 07:41:30 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB77fUOh045409; Mon, 7 Dec 2009 07:41:30 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <200912070741.nB77fUOh045409@svn.freebsd.org> From: Hiroki Sato Date: Mon, 7 Dec 2009 07:41:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200209 - stable/8/etc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 07:41:30 -0000 Author: hrs Date: Mon Dec 7 07:41:29 2009 New Revision: 200209 URL: http://svn.freebsd.org/changeset/base/200209 Log: MFC: r197139 - Add afexists() to check if the specified address family exists on the system or not. r197697 - Add AF_IPX and AF_NATM to afexists(). Modified: stable/8/etc/network.subr Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/network.subr ============================================================================== --- stable/8/etc/network.subr Mon Dec 7 07:33:51 2009 (r200208) +++ stable/8/etc/network.subr Mon Dec 7 07:41:29 2009 (r200209) @@ -276,6 +276,37 @@ wpaif() return 1 } +# afexists af +# Returns 0 if the address family is enabled in the kernel +# 1 otherwise. +afexists() +{ + local _af + _af=$1 + + case ${_af} in + inet) + ${SYSCTL_N} net.inet > /dev/null 2>&1 + ;; + inet6) + ${SYSCTL_N} net.inet6 > /dev/null 2>&1 + ;; + ipx) + ${SYSCTL_N} net.ipx > /dev/null 2>&1 + ;; + atm) + if [ -x /sbin/atmconfig ]; then + /sbin/atmconfig diag list > /dev/null 2>&1 + else + return 1 + fi + ;; + *) + err 1 "afexists(): Unsupported address family: $_af" + ;; + esac +} + # ipv6if if # Returns 0 if the interface should be configured for IPv6 and # 1 otherwise. From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 7 08:36:49 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB5D71065670; Mon, 7 Dec 2009 08:36:49 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9B6B8FC22; Mon, 7 Dec 2009 08:36:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB78anX4046622; Mon, 7 Dec 2009 08:36:49 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB78anMY046620; Mon, 7 Dec 2009 08:36:49 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200912070836.nB78anMY046620@svn.freebsd.org> From: Christian Brueffer Date: Mon, 7 Dec 2009 08:36:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200210 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 08:36:49 -0000 Author: brueffer Date: Mon Dec 7 08:36:49 2009 New Revision: 200210 URL: http://svn.freebsd.org/changeset/base/200210 Log: MFC: r197900 Improved one-line description of this module (taken from NOTES). Modified: stable/8/share/man/man4/lindev.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/lindev.4 ============================================================================== --- stable/8/share/man/man4/lindev.4 Mon Dec 7 07:41:29 2009 (r200209) +++ stable/8/share/man/man4/lindev.4 Mon Dec 7 08:36:49 2009 (r200210) @@ -30,7 +30,7 @@ .Os .Sh NAME .Nm lindev -.Nd the lindev module +.Nd Linux-specific pseudo devices support .Sh SYNOPSIS To compile this collection of linux-specific pseudo devices into the kernel, place the following line in your kernel configuration file: From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 7 08:38:44 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8D111065670; Mon, 7 Dec 2009 08:38:44 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C77468FC16; Mon, 7 Dec 2009 08:38:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB78ciUU046700; Mon, 7 Dec 2009 08:38:44 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB78ciPm046698; Mon, 7 Dec 2009 08:38:44 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200912070838.nB78ciPm046698@svn.freebsd.org> From: Christian Brueffer Date: Mon, 7 Dec 2009 08:38:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200211 - stable/8/lib/libc/stdio X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 08:38:45 -0000 Author: brueffer Date: Mon Dec 7 08:38:44 2009 New Revision: 200211 URL: http://svn.freebsd.org/changeset/base/200211 Log: MFC: r200019 Fix the dprintf() prototype. Modified: stable/8/lib/libc/stdio/printf.3 Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/stdio/printf.3 ============================================================================== --- stable/8/lib/libc/stdio/printf.3 Mon Dec 7 08:36:49 2009 (r200210) +++ stable/8/lib/libc/stdio/printf.3 Mon Dec 7 08:38:44 2009 (r200211) @@ -32,7 +32,7 @@ .\" @(#)printf.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd March 3, 2009 +.Dd December 2, 2009 .Dt PRINTF 3 .Os .Sh NAME @@ -55,7 +55,7 @@ .Ft int .Fn asprintf "char **ret" "const char *format" ... .Ft int -.Fn dprintf "int" "const char * restrict format" ... +.Fn dprintf "int fd" "const char * restrict format" ... .In stdarg.h .Ft int .Fn vprintf "const char * restrict format" "va_list ap" From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 7 16:37:02 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFCE8106568B; Mon, 7 Dec 2009 16:37:02 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD5F88FC08; Mon, 7 Dec 2009 16:37:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB7Gb2FE059491; Mon, 7 Dec 2009 16:37:02 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB7Gb2RX059486; Mon, 7 Dec 2009 16:37:02 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200912071637.nB7Gb2RX059486@svn.freebsd.org> From: Robert Noland Date: Mon, 7 Dec 2009 16:37:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200220 - in stable/8/sys/boot: . i386 i386/loader i386/zfsboot i386/zfsloader X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 16:37:03 -0000 Author: rnoland Date: Mon Dec 7 16:37:02 2009 New Revision: 200220 URL: http://svn.freebsd.org/changeset/base/200220 Log: MFC 199714 Create a seperate ZFS enabled loader. This adds zfsloader which will be called by zfsboot/gptzfsboot code rather than the tradional loader. This eliminates the need to set the LOADER_ZFS_SUPPORT variable in order to get a ZFS enabled loader. Note however, that you must reinstall your bootcode (zfsboot/gptzfsboot) in order for the boot process to use the new loader. New installations will no longer be required to build a ZFS enabled loader for a working ZFS boot system. Installing zfsboot/gptzfsboot is sufficient for acknowledging the use of CDDL code and therefore the ZFS enabled loader. Added: stable/8/sys/boot/i386/zfsloader/ - copied from r199714, head/sys/boot/i386/zfsloader/ Modified: stable/8/sys/boot/Makefile stable/8/sys/boot/i386/Makefile stable/8/sys/boot/i386/loader/Makefile stable/8/sys/boot/i386/zfsboot/zfsboot.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/boot/Makefile ============================================================================== --- stable/8/sys/boot/Makefile Mon Dec 7 16:29:43 2009 (r200219) +++ stable/8/sys/boot/Makefile Mon Dec 7 16:37:02 2009 (r200220) @@ -22,7 +22,7 @@ SUBDIR+= ofw SUBDIR+= uboot .endif -.if defined(LOADER_ZFS_SUPPORT) +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE} == "i386" SUBDIR+= zfs .endif Modified: stable/8/sys/boot/i386/Makefile ============================================================================== --- stable/8/sys/boot/i386/Makefile Mon Dec 7 16:29:43 2009 (r200219) +++ stable/8/sys/boot/i386/Makefile Mon Dec 7 16:37:02 2009 (r200220) @@ -1,7 +1,7 @@ # $FreeBSD$ SUBDIR= mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot zfsboot \ - gptzfsboot kgzldr libi386 libfirewire loader + gptzfsboot kgzldr libi386 libfirewire loader zfsloader # special boot programs, 'self-extracting boot2+loader' SUBDIR+= pxeldr Modified: stable/8/sys/boot/i386/loader/Makefile ============================================================================== --- stable/8/sys/boot/i386/loader/Makefile Mon Dec 7 16:29:43 2009 (r200219) +++ stable/8/sys/boot/i386/loader/Makefile Mon Dec 7 16:37:02 2009 (r200220) @@ -3,9 +3,10 @@ .include MK_SSP= no -PROG= loader.sym +LOADER?= loader +PROG= ${LOADER}.sym INTERNALPROG= -NEWVERSWHAT= "bootstrap loader" i386 +NEWVERSWHAT?= "bootstrap loader" i386 # architecture-specific loader code SRCS= main.c conf.c vers.c @@ -16,7 +17,7 @@ CFLAGS+= -DLOADER_FIREWIRE_SUPPORT LIBFIREWIRE= ${.OBJDIR}/../libfirewire/libfirewire.a .endif -# Put LOADER_ZFS_SUPPORT=yes in /etc/make.conf for ZFS support +# Set by zfsloader Makefile .if defined(LOADER_ZFS_SUPPORT) CFLAGS+= -DLOADER_ZFS_SUPPORT LIBZFS= ${.OBJDIR}/../../zfs/libzfsboot.a @@ -61,7 +62,7 @@ CFLAGS+= -DLOADER_GPT_SUPPORT CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I. -CLEANFILES= vers.c loader loader.bin loader.help +CLEANFILES= vers.c ${LOADER} ${LOADER}.bin loader.help CFLAGS+= -Wall LDFLAGS= -static -Ttext 0x0 @@ -80,30 +81,35 @@ CFLAGS+= -I${.CURDIR}/../btx/lib # Pick up ../Makefile.inc early. .include -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} +vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version + sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version \ + ${NEWVERSWHAT} -loader: loader.bin ${BTXLDR} ${BTXKERN} +${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ - -b ${BTXKERN} loader.bin + -b ${BTXKERN} ${LOADER}.bin -loader.bin: loader.sym +${LOADER}.bin: ${LOADER}.sym cp ${.ALLSRC} ${.TARGET} strip -R .comment -R .note ${.TARGET} loader.help: help.common help.i386 cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} +FILES= ${LOADER} +# XXX INSTALLFLAGS_loader= -b +FILESMODE_${LOADER}= ${BINMODE} -b + +.if !defined(LOADER_ONLY) .PATH: ${.CURDIR}/../../forth -FILES= loader loader.help loader.4th support.4th loader.conf +FILES+= loader.help loader.4th support.4th loader.conf FILES+= screen.4th frames.4th beastie.4th -# XXX INSTALLFLAGS_loader= -b -FILESMODE_loader= ${BINMODE} -b FILESDIR_loader.conf= /boot/defaults .if !exists(${DESTDIR}/boot/loader.rc) FILES+= loader.rc .endif +.endif # XXX crt0.o needs to be first for pxeboot(8) to work OBJS= ${BTXCRT} Modified: stable/8/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- stable/8/sys/boot/i386/zfsboot/zfsboot.c Mon Dec 7 16:29:43 2009 (r200219) +++ stable/8/sys/boot/i386/zfsboot/zfsboot.c Mon Dec 7 16:37:02 2009 (r200220) @@ -84,7 +84,7 @@ __FBSDID("$FreeBSD$"); #define KARGS_FLAGS_ZFS 0x4 #define PATH_CONFIG "/boot.config" -#define PATH_BOOT3 "/boot/loader" +#define PATH_BOOT3 "/boot/zfsloader" #define PATH_KERNEL "/boot/kernel/kernel" #define ARGS 0x900 From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 7 17:18:53 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1807C106568B; Mon, 7 Dec 2009 17:18: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 06EFB8FC18; Mon, 7 Dec 2009 17:18:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB7HIq6h060388; Mon, 7 Dec 2009 17:18:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB7HIqf7060386; Mon, 7 Dec 2009 17:18:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200912071718.nB7HIqf7060386@svn.freebsd.org> From: John Baldwin Date: Mon, 7 Dec 2009 17:18:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200222 - stable/8/sys/conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 17:18:53 -0000 Author: jhb Date: Mon Dec 7 17:18:52 2009 New Revision: 200222 URL: http://svn.freebsd.org/changeset/base/200222 Log: MFC 199974: Remove extra parantheses from usb_ethernet.c and usb_serial.c lines. config(8) doesn't parse parantheses and instead treated them as being part of the device driver name (e.g. '(u3g' vs 'u3g'). While here, fix the style of these long lines to match the wrapping used for other long lines in this file. Modified: stable/8/sys/conf/files Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Mon Dec 7 17:15:36 2009 (r200221) +++ stable/8/sys/conf/files Mon Dec 7 17:18:52 2009 (r200222) @@ -1624,8 +1624,8 @@ dev/usb/net/if_cue.c optional cue dev/usb/net/if_kue.c optional kue dev/usb/net/if_rue.c optional rue dev/usb/net/if_udav.c optional udav -dev/usb/net/usb_ethernet.c \ - optional (aue | axe | cdce | cue | kue | rue | udav) +dev/usb/net/usb_ethernet.c optional aue | axe | cdce | cue | kue | rue | \ + udav # # USB WLAN drivers # @@ -1656,8 +1656,11 @@ dev/usb/serial/uplcom.c optional uplcom dev/usb/serial/uslcom.c optional uslcom dev/usb/serial/uvisor.c optional uvisor dev/usb/serial/uvscom.c optional uvscom -dev/usb/serial/usb_serial.c optional ucom | \ - (u3g | uark | ubsa | ubser | uchcom | ucycom | ufoma | uftdi | ugensa | uipaq | ulpt | umct | umodem | umoscom | uplcom | uslcom | uvisor | uvscom) +dev/usb/serial/usb_serial.c optional ucom | u3g | uark | ubsa | ubser | \ + uchcom | ucycom | ufoma | uftdi | \ + ugensa | uipaq | ulpt | umct | \ + umodem | umoscom | uplcom | uslcom | \ + uvisor | uvscom # # USB misc drivers # From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 7 19:07:45 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 817C41065670; Mon, 7 Dec 2009 19:07:45 +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 6F4948FC13; Mon, 7 Dec 2009 19:07:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB7J7jfD062829; Mon, 7 Dec 2009 19:07:45 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB7J7j8W062827; Mon, 7 Dec 2009 19:07:45 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200912071907.nB7J7j8W062827@svn.freebsd.org> From: John Baldwin Date: Mon, 7 Dec 2009 19:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200224 - stable/8/lib/libc/rpc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 19:07:45 -0000 Author: jhb Date: Mon Dec 7 19:07:45 2009 New Revision: 200224 URL: http://svn.freebsd.org/changeset/base/200224 Log: MFC 200061: The fd_mask type is an unsigned long, not an int, so treat the mask as a long instead of an int when examining the results of select() to look for RPC requests. Previously this routine would ignore RPC requests to sockets whose file descriptor mod 64 was greater than 31 on a 64-bit platform. Modified: stable/8/lib/libc/rpc/svc.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/rpc/svc.c ============================================================================== --- stable/8/lib/libc/rpc/svc.c Mon Dec 7 18:37:50 2009 (r200223) +++ stable/8/lib/libc/rpc/svc.c Mon Dec 7 19:07:45 2009 (r200224) @@ -627,8 +627,8 @@ svc_getreqset(readfds) maskp = readfds->fds_bits; for (sock = 0; sock < FD_SETSIZE; sock += NFDBITS) { - for (mask = *maskp++; (bit = ffs(mask)) != 0; - mask ^= (1 << (bit - 1))) { + for (mask = *maskp++; (bit = ffsl(mask)) != 0; + mask ^= (1ul << (bit - 1))) { /* sock has input waiting */ fd = sock + bit - 1; svc_getreq_common(fd); From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 7 19:59:28 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE2F61065672; Mon, 7 Dec 2009 19:59:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DADDD8FC13; Mon, 7 Dec 2009 19:59:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB7JxSBc064205; Mon, 7 Dec 2009 19:59:28 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB7JxS6C064200; Mon, 7 Dec 2009 19:59:28 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200912071959.nB7JxS6C064200@svn.freebsd.org> From: Xin LI Date: Mon, 7 Dec 2009 19:59:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200229 - in stable/8: lib/libc/sys sys/kern sys/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 19:59:29 -0000 Author: delphij Date: Mon Dec 7 19:59:28 2009 New Revision: 200229 URL: http://svn.freebsd.org/changeset/base/200229 Log: MFC revision 197579 and 199617: Add two new fcntls to enable/disable read-ahead: - F_READAHEAD: specify the amount for sequential access. The amount is specified in bytes and is rounded up to nearest block size. - F_RDAHEAD: Darwin compatible version that use 128KB as the sequential access size. A third argument of zero disables the read-ahead behavior. Please note that the read-ahead amount is also constrainted by sysctl variable, vfs.read_max, which may need to be raised in order to better utilize this feature. Thanks Igor Sysoev for proposing the feature and submitting the original version, and kib@ for his valuable comments. Modified: stable/8/lib/libc/sys/fcntl.2 stable/8/sys/kern/kern_descrip.c stable/8/sys/kern/vfs_vnops.c stable/8/sys/sys/fcntl.h Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/lib/libc/sys/fcntl.2 ============================================================================== --- stable/8/lib/libc/sys/fcntl.2 Mon Dec 7 19:26:54 2009 (r200228) +++ stable/8/lib/libc/sys/fcntl.2 Mon Dec 7 19:59:28 2009 (r200229) @@ -28,7 +28,7 @@ .\" @(#)fcntl.2 8.2 (Berkeley) 1/12/94 .\" $FreeBSD$ .\" -.Dd March 8, 2008 +.Dd September 28, 2009 .Dt FCNTL 2 .Os .Sh NAME @@ -241,6 +241,22 @@ will be interrupted if the signal handle .Dv SA_RESTART (see .Xr sigaction 2 ) . +.It Dv F_READAHEAD +Set or clear the read ahead amount for sequential access to the third +argument, +.Fa arg , +which is rounded up to the nearest block size. +A zero value in +.Fa arg +turns off read ahead. +.It Dv F_RDAHEAD +Equivalent to Darwin counterpart which sets read ahead amount of 128KB +when the third argument, +.Fa arg +is non-zero. +A zero value in +.Fa arg +turns off read ahead. .El .Pp When a shared lock has been set on a segment of a file, Modified: stable/8/sys/kern/kern_descrip.c ============================================================================== --- stable/8/sys/kern/kern_descrip.c Mon Dec 7 19:26:54 2009 (r200228) +++ stable/8/sys/kern/kern_descrip.c Mon Dec 7 19:59:28 2009 (r200229) @@ -421,6 +421,8 @@ kern_fcntl(struct thread *td, int fd, in struct vnode *vp; int error, flg, tmp; int vfslocked; + u_int old, new; + uint64_t bsize; vfslocked = 0; error = 0; @@ -686,6 +688,49 @@ kern_fcntl(struct thread *td, int fd, in vfslocked = 0; fdrop(fp, td); break; + + case F_RDAHEAD: + arg = arg ? 128 * 1024: 0; + /* FALLTHROUGH */ + case F_READAHEAD: + FILEDESC_SLOCK(fdp); + if ((fp = fdtofp(fd, fdp)) == NULL) { + FILEDESC_SUNLOCK(fdp); + error = EBADF; + break; + } + if (fp->f_type != DTYPE_VNODE) { + FILEDESC_SUNLOCK(fdp); + error = EBADF; + break; + } + fhold(fp); + FILEDESC_SUNLOCK(fdp); + if (arg != 0) { + vp = fp->f_vnode; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + error = vn_lock(vp, LK_SHARED); + if (error != 0) + goto readahead_vnlock_fail; + bsize = fp->f_vnode->v_mount->mnt_stat.f_iosize; + VOP_UNLOCK(vp, 0); + fp->f_seqcount = (arg + bsize - 1) / bsize; + do { + new = old = fp->f_flag; + new |= FRDAHEAD; + } while (!atomic_cmpset_rel_int(&fp->f_flag, old, new)); +readahead_vnlock_fail: + VFS_UNLOCK_GIANT(vfslocked); + vfslocked = 0; + } else { + do { + new = old = fp->f_flag; + new &= ~FRDAHEAD; + } while (!atomic_cmpset_rel_int(&fp->f_flag, old, new)); + } + fdrop(fp, td); + break; + default: error = EINVAL; break; Modified: stable/8/sys/kern/vfs_vnops.c ============================================================================== --- stable/8/sys/kern/vfs_vnops.c Mon Dec 7 19:26:54 2009 (r200228) +++ stable/8/sys/kern/vfs_vnops.c Mon Dec 7 19:59:28 2009 (r200229) @@ -312,6 +312,9 @@ static int sequential_heuristic(struct uio *uio, struct file *fp) { + if (atomic_load_acq_int(&(fp->f_flag)) & FRDAHEAD) + return (fp->f_seqcount << IO_SEQSHIFT); + /* * Offset 0 is handled specially. open() sets f_seqcount to 1 so * that the first I/O is normally considered to be slightly Modified: stable/8/sys/sys/fcntl.h ============================================================================== --- stable/8/sys/sys/fcntl.h Mon Dec 7 19:26:54 2009 (r200228) +++ stable/8/sys/sys/fcntl.h Mon Dec 7 19:59:28 2009 (r200229) @@ -140,7 +140,7 @@ typedef __pid_t pid_t; /* bits to save after open */ #define FMASK (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT|FEXEC) /* bits settable by fcntl(F_SETFL, ...) */ -#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT) +#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FRDAHEAD|O_DIRECT) #if defined(COMPAT_FREEBSD7) || defined(COMPAT_FREEBSD6) || \ defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) @@ -151,7 +151,8 @@ typedef __pid_t pid_t; */ #define FPOSIXSHM O_NOFOLLOW #undef FCNTLFLAGS -#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|O_DIRECT) +#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|FRDAHEAD| \ + O_DIRECT) #endif #endif @@ -176,6 +177,8 @@ typedef __pid_t pid_t; * different meaning for fcntl(2). */ #if __BSD_VISIBLE +/* Read ahead */ +#define FRDAHEAD O_CREAT #endif /* Defined by POSIX Extended API Set Part 2 */ @@ -218,6 +221,8 @@ typedef __pid_t pid_t; #define F_SETLK 12 /* set record locking information */ #define F_SETLKW 13 /* F_SETLK; wait if blocked */ #define F_SETLK_REMOTE 14 /* debugging support for remote locks */ +#define F_READAHEAD 15 /* read ahead */ +#define F_RDAHEAD 16 /* Darwin compatible read ahead */ /* file descriptor flags (F_GETFD, F_SETFD) */ #define FD_CLOEXEC 1 /* close-on-exec flag */ From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 7 20:40:48 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC00D106566B; Mon, 7 Dec 2009 20:40:48 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D9DAD8FC14; Mon, 7 Dec 2009 20:40:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB7Kem3w065297; Mon, 7 Dec 2009 20:40:48 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB7KemoR065295; Mon, 7 Dec 2009 20:40:48 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <200912072040.nB7KemoR065295@svn.freebsd.org> From: Fabien Thomas Date: Mon, 7 Dec 2009 20:40:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200232 - stable/8/sys/dev/hwpmc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 20:40:49 -0000 Author: fabient Date: Mon Dec 7 20:40:48 2009 New Revision: 200232 URL: http://svn.freebsd.org/changeset/base/200232 Log: MFC 198432: Only claim that the PMC_CLASS_IAF PMCs are supported by a CPU if there are PMCs on the CPU that belong to the class. Modified: stable/8/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- stable/8/sys/dev/hwpmc/hwpmc_core.c Mon Dec 7 20:17:33 2009 (r200231) +++ stable/8/sys/dev/hwpmc/hwpmc_core.c Mon Dec 7 20:40:48 2009 (r200232) @@ -1954,11 +1954,21 @@ pmc_core_initialize(struct pmc_mdep *md, core_iaf_npmc = cpuid[CORE_CPUID_EDX] & 0x1F; core_iaf_width = (cpuid[CORE_CPUID_EDX] >> 5) & 0xFF; - iaf_initialize(md, maxcpu, core_iaf_npmc, core_iaf_width); - - core_pmcmask |= ((1ULL << core_iaf_npmc) - 1) << - IAF_OFFSET; - + if (core_iaf_npmc > 0) { + iaf_initialize(md, maxcpu, core_iaf_npmc, + core_iaf_width); + core_pmcmask |= ((1ULL << core_iaf_npmc) - 1) << + IAF_OFFSET; + } else { + /* + * Adjust the number of classes exported to + * user space. + */ + md->pmd_nclass--; + KASSERT(md->pmd_nclass == 2, + ("[core,%d] unexpected nclass %d", __LINE__, + md->pmd_nclass)); + } } PMCDBG(MDP,INI,1,"core-init pmcmask=0x%jx iafri=%d", core_pmcmask, From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 7 20:44:44 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4954C106566C; Mon, 7 Dec 2009 20:44:44 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3723D8FC14; Mon, 7 Dec 2009 20:44:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB7KiiD2065454; Mon, 7 Dec 2009 20:44:44 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB7KiiS0065452; Mon, 7 Dec 2009 20:44:44 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <200912072044.nB7KiiS0065452@svn.freebsd.org> From: Fabien Thomas Date: Mon, 7 Dec 2009 20:44:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200233 - stable/8/lib/libpmc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 20:44:44 -0000 Author: fabient Date: Mon Dec 7 20:44:43 2009 New Revision: 200233 URL: http://svn.freebsd.org/changeset/base/200233 Log: MFC 198433: Not all Intel Core (TM) CPUs implement PMC_CLASS_IAF fixed-function counters. For such CPUs, use an alternate mapping of convenience names to events supported by PMC_CLASS_IAP programmable counters. Modified: stable/8/lib/libpmc/libpmc.c Directory Properties: stable/8/lib/libpmc/ (props changed) Modified: stable/8/lib/libpmc/libpmc.c ============================================================================== --- stable/8/lib/libpmc/libpmc.c Mon Dec 7 20:40:48 2009 (r200232) +++ stable/8/lib/libpmc/libpmc.c Mon Dec 7 20:44:43 2009 (r200233) @@ -442,6 +442,10 @@ static struct pmc_event_alias core_alias /* * Intel Core2 (Family 6, Model F), Core2Extreme (Family 6, Model 17H) * and Atom (Family 6, model 1CH) PMCs. + * + * We map aliases to events on the fixed-function counters if these + * are present. Note that not all CPUs in this family contain fixed-function + * counters. */ static struct pmc_event_alias core2_aliases[] = { @@ -454,8 +458,22 @@ static struct pmc_event_alias core2_alia EV_ALIAS("unhalted-cycles", "iaf-cpu-clk-unhalted.core"), EV_ALIAS(NULL, NULL) }; -#define atom_aliases core2_aliases -#define corei7_aliases core2_aliases + +static struct pmc_event_alias core2_aliases_without_iaf[] = { + EV_ALIAS("branches", "iap-br-inst-retired.any"), + EV_ALIAS("branch-mispredicts", "iap-br-inst-retired.mispred"), + EV_ALIAS("cycles", "tsc-tsc"), + EV_ALIAS("ic-misses", "iap-l1i-misses"), + EV_ALIAS("instructions", "iap-inst-retired.any_p"), + EV_ALIAS("interrupts", "iap-hw-int-rcv"), + EV_ALIAS("unhalted-cycles", "iap-cpu-clk-unhalted.core_p"), + EV_ALIAS(NULL, NULL) +}; + +#define atom_aliases core2_aliases +#define atom_aliases_without_iaf core2_aliases_without_iaf +#define corei7_aliases core2_aliases +#define corei7_aliases_without_iaf core2_aliases_without_iaf #define IAF_KW_OS "os" #define IAF_KW_USR "usr" @@ -2379,6 +2397,10 @@ pmc_init(void) uint32_t abi_version; struct module_stat pmc_modstat; struct pmc_op_getcpuinfo op_cpu_info; +#if defined(__amd64__) || defined(__i386__) + int cpu_has_iaf_counters; + unsigned int t; +#endif if (pmc_syscall != -1) /* already inited */ return (0); @@ -2420,6 +2442,8 @@ pmc_init(void) if (pmc_class_table == NULL) return (-1); + for (n = 0; n < PMC_CLASS_TABLE_SIZE; n++) + pmc_class_table[n] = NULL; /* * Fill in the class table. @@ -2427,6 +2451,14 @@ pmc_init(void) n = 0; #if defined(__amd64__) || defined(__i386__) pmc_class_table[n++] = &tsc_class_table_descr; + + /* + * Check if this CPU has fixed function counters. + */ + cpu_has_iaf_counters = 0; + for (t = 0; t < cpu_info.pm_nclass; t++) + if (cpu_info.pm_classes[t].pm_class == PMC_CLASS_IAF) + cpu_has_iaf_counters = 1; #endif #define PMC_MDEP_INIT(C) do { \ @@ -2436,6 +2468,16 @@ pmc_init(void) PMC_TABLE_SIZE(C##_pmc_classes); \ } while (0) +#define PMC_MDEP_INIT_INTEL_V2(C) do { \ + PMC_MDEP_INIT(C); \ + if (cpu_has_iaf_counters) \ + pmc_class_table[n++] = &iaf_class_table_descr; \ + else \ + pmc_mdep_event_aliases = \ + C##_aliases_without_iaf; \ + pmc_class_table[n] = &C##_class_table_descr; \ + } while (0) + /* Configure the event name parser. */ switch (cpu_info.pm_cputype) { #if defined(__i386__) @@ -2461,24 +2503,17 @@ pmc_init(void) pmc_class_table[n] = &k8_class_table_descr; break; case PMC_CPU_INTEL_ATOM: - PMC_MDEP_INIT(atom); - pmc_class_table[n++] = &iaf_class_table_descr; - pmc_class_table[n] = &atom_class_table_descr; + PMC_MDEP_INIT_INTEL_V2(atom); break; case PMC_CPU_INTEL_CORE: PMC_MDEP_INIT(core); - pmc_class_table[n] = &core_class_table_descr; break; case PMC_CPU_INTEL_CORE2: case PMC_CPU_INTEL_CORE2EXTREME: - PMC_MDEP_INIT(core2); - pmc_class_table[n++] = &iaf_class_table_descr; - pmc_class_table[n] = &core2_class_table_descr; + PMC_MDEP_INIT_INTEL_V2(core2); break; case PMC_CPU_INTEL_COREI7: - PMC_MDEP_INIT(corei7); - pmc_class_table[n++] = &iaf_class_table_descr; - pmc_class_table[n] = &corei7_class_table_descr; + PMC_MDEP_INIT_INTEL_V2(corei7); break; case PMC_CPU_INTEL_PIV: PMC_MDEP_INIT(p4); From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 7 20:49:49 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F8FE1065697; Mon, 7 Dec 2009 20:49:49 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D6D08FC18; Mon, 7 Dec 2009 20:49:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB7KnnIT065702; Mon, 7 Dec 2009 20:49:49 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB7KnnUY065700; Mon, 7 Dec 2009 20:49:49 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <200912072049.nB7KnnUY065700@svn.freebsd.org> From: Fabien Thomas Date: Mon, 7 Dec 2009 20:49:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200236 - stable/8/sys/dev/hwpmc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 20:49:49 -0000 Author: fabient Date: Mon Dec 7 20:49:49 2009 New Revision: 200236 URL: http://svn.freebsd.org/changeset/base/200236 Log: MFC 200060: Use a better check for a valid kernel stack address when capturing kernel call chains. Modified: stable/8/sys/dev/hwpmc/hwpmc_x86.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/hwpmc/hwpmc_x86.c ============================================================================== --- stable/8/sys/dev/hwpmc/hwpmc_x86.c Mon Dec 7 20:47:33 2009 (r200235) +++ stable/8/sys/dev/hwpmc/hwpmc_x86.c Mon Dec 7 20:49:49 2009 (r200236) @@ -176,7 +176,8 @@ pmc_save_kernel_callchain(uintptr_t *cc, stackend = (uintptr_t) td->td_kstack + td->td_kstack_pages * PAGE_SIZE; if (PMC_IN_TRAP_HANDLER(pc) || - !PMC_IN_KERNEL(pc) || !PMC_IN_KERNEL(r) || + !PMC_IN_KERNEL(pc) || + !PMC_IN_KERNEL_STACK(r, stackstart, stackend) || !PMC_IN_KERNEL_STACK(sp, stackstart, stackend) || !PMC_IN_KERNEL_STACK(fp, stackstart, stackend)) return (1); @@ -221,7 +222,7 @@ pmc_save_kernel_callchain(uintptr_t *cc, r = fp + sizeof(uintptr_t); if (!PMC_IN_KERNEL_STACK(fp, stackstart, stackend) || - !PMC_IN_KERNEL(r)) + !PMC_IN_KERNEL_STACK(r, stackstart, stackend)) break; pc = *(uintptr_t *) r; fp = *(uintptr_t *) fp; From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 7 20:51:34 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0AB99106568F; Mon, 7 Dec 2009 20:51:34 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id B541F8FC19; Mon, 7 Dec 2009 20:51:33 +0000 (UTC) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.3/8.14.3) with ESMTP id nB7KHjE4077310; Mon, 7 Dec 2009 14:17:45 -0600 (CST) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.3/8.14.3/Submit) id nB7KHjH9077309; Mon, 7 Dec 2009 14:17:45 -0600 (CST) (envelope-from brooks) Date: Mon, 7 Dec 2009 14:17:44 -0600 From: Brooks Davis To: Luigi Rizzo Message-ID: <20091207201744.GA77256@lor.one-eyed-alien.net> References: <200912061901.nB6J1X7L028816@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fUYQa+Pmc3FrFX/N" Content-Disposition: inline In-Reply-To: <200912061901.nB6J1X7L028816@svn.freebsd.org> User-Agent: Mutt/1.5.17 (2007-11-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (lor.one-eyed-alien.net [127.0.0.1]); Mon, 07 Dec 2009 14:17:45 -0600 (CST) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r200184 - stable/8/sbin/ipfw X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 20:51:34 -0000 --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Dec 06, 2009 at 07:01:33PM +0000, Luigi Rizzo wrote: > Author: luigi > Date: Sun Dec 6 19:01:33 2009 > New Revision: 200184 > URL: http://svn.freebsd.org/changeset/base/200184 >=20 > Log: > mfc r200056 > use qsort_r instead of heapsort; This seems like a move in the wrong direction. The use of a recursive algorithm in the kernel seems generally ill-advised and I was rather disturbed when I found we had a quick sort implementation in libkern. Unless you know the number of items is small, quick sort isn't safe and if the number is small, heap sort is plenty efficient. -- Brooks --fUYQa+Pmc3FrFX/N Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iD8DBQFLHWLoXY6L6fI4GtQRArluAJ9dOCmyxtl1sioZn6e4akpWFqD1wwCgrnc9 OUdu3HYsdlTRtnocrHF6/y8= =VNea -----END PGP SIGNATURE----- --fUYQa+Pmc3FrFX/N-- From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 7 21:06:42 2009 Return-Path: Delivered-To: svn-src-stable-8@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9636D106568D; Mon, 7 Dec 2009 21:06:42 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id 47C6C8FC15; Mon, 7 Dec 2009 21:06:42 +0000 (UTC) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.3/8.14.3) with ESMTP id nB7L5QHP077790; Mon, 7 Dec 2009 15:05:26 -0600 (CST) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.3/8.14.3/Submit) id nB7L5QI8077789; Mon, 7 Dec 2009 15:05:26 -0600 (CST) (envelope-from brooks) Date: Mon, 7 Dec 2009 15:05:26 -0600 From: Brooks Davis To: Luigi Rizzo Message-ID: <20091207210526.GD77256@lor.one-eyed-alien.net> References: <200912061901.nB6J1X7L028816@svn.freebsd.org> <20091207201744.GA77256@lor.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="sXc4Kmr5FA7axrvy" Content-Disposition: inline In-Reply-To: <20091207201744.GA77256@lor.one-eyed-alien.net> User-Agent: Mutt/1.5.17 (2007-11-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (lor.one-eyed-alien.net [127.0.0.1]); Mon, 07 Dec 2009 15:05:26 -0600 (CST) Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org Subject: Re: svn commit: r200184 - stable/8/sbin/ipfw X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 21:06:42 -0000 --sXc4Kmr5FA7axrvy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 07, 2009 at 02:17:44PM -0600, Brooks Davis wrote: > On Sun, Dec 06, 2009 at 07:01:33PM +0000, Luigi Rizzo wrote: > > Author: luigi > > Date: Sun Dec 6 19:01:33 2009 > > New Revision: 200184 > > URL: http://svn.freebsd.org/changeset/base/200184 > >=20 > > Log: > > mfc r200056 > > use qsort_r instead of heapsort; >=20 > This seems like a move in the wrong direction. The use of a recursive > algorithm in the kernel seems generally ill-advised and I was rather > disturbed when I found we had a quick sort implementation in libkern. >=20 > Unless you know the number of items is small, quick sort isn't safe and > if the number is small, heap sort is plenty efficient. Woops, it was pointed out to me that this was the userspace part where qsort is just fine. :) -- Brooks --sXc4Kmr5FA7axrvy Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iD8DBQFLHW4VXY6L6fI4GtQRAvLYAJ9dLBrE1AdVvoR3duv4DWzwUqfexQCbBtYi fZ9IB0YuH41DdOS1D+24u+Q= =ghbb -----END PGP SIGNATURE----- --sXc4Kmr5FA7axrvy-- From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 8 05:18:59 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 848941065670; Tue, 8 Dec 2009 05:18:59 +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 6F9BB8FC14; Tue, 8 Dec 2009 05:18:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB85IxPj076844; Tue, 8 Dec 2009 05:18:59 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB85IxeJ076837; Tue, 8 Dec 2009 05:18:59 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200912080518.nB85IxeJ076837@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 8 Dec 2009 05:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200247 - stable/8/share/man/man4/man4.powerpc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 05:18:59 -0000 Author: nwhitehorn Date: Tue Dec 8 05:18:59 2009 New Revision: 200247 URL: http://svn.freebsd.org/changeset/base/200247 Log: MFC r200070: Add manpages for ams(4), akbd(4), adb(4), and cuda(4), which describe various drivers for Apple Desktop Bus controllers and peripherals. Added: stable/8/share/man/man4/man4.powerpc/adb.4 - copied unchanged from r200070, head/share/man/man4/man4.powerpc/adb.4 stable/8/share/man/man4/man4.powerpc/akbd.4 - copied unchanged from r200070, head/share/man/man4/man4.powerpc/akbd.4 stable/8/share/man/man4/man4.powerpc/ams.4 - copied unchanged from r200070, head/share/man/man4/man4.powerpc/ams.4 stable/8/share/man/man4/man4.powerpc/cuda.4 - copied unchanged from r200070, head/share/man/man4/man4.powerpc/cuda.4 Modified: stable/8/share/man/man4/man4.powerpc/Makefile stable/8/share/man/man4/man4.powerpc/pmu.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/man4.powerpc/Makefile ============================================================================== --- stable/8/share/man/man4/man4.powerpc/Makefile Tue Dec 8 03:24:29 2009 (r200246) +++ stable/8/share/man/man4/man4.powerpc/Makefile Tue Dec 8 05:18:59 2009 (r200247) @@ -1,6 +1,10 @@ # $FreeBSD$ -MAN= bm.4 \ +MAN= adb.4 \ + akbd.4 \ + ams.4 \ + bm.4 \ + cuda.4 \ pmu.4 \ powermac_nvram.4 \ snd_ai2s.4 \ Copied: stable/8/share/man/man4/man4.powerpc/adb.4 (from r200070, head/share/man/man4/man4.powerpc/adb.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/share/man/man4/man4.powerpc/adb.4 Tue Dec 8 05:18:59 2009 (r200247, copy of r200070, head/share/man/man4/man4.powerpc/adb.4) @@ -0,0 +1,70 @@ +.\"- +.\" Copyright (c) 2009 Nathan Whitehorn +.\" 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 ``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$ +.\" +.Dd December 3, 2009 +.Dt ADB 4 +.Os +.Sh NAME +.Nm adb +.Nd Apple Desktop Bus +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device adb" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the Apple Desktop Bus, which is a simple +multi-drop bus used in general for input peripherals in older Apple +Macintosh hardware. +.Pp +The Apple Desktop Bus provides attachment for up to 16 devices, +including multiple devices of a single type, but not does support +hot-plugging. +.Sh SEE ALSO +Apple Tech Note HW01: ADB - The Untold Story: Space Aliens Ate My Mouse: +.Pa http://developer.apple.com/legacy/mac/library/technotes/hw/hw_01.html +.Pp +.Xr akbd 4 , +.Xr ams 4 , +.Xr cuda 4 , +.Xr pmu 4 +.Sh HISTORY +The +.Nm +device driver appeared in +.Fx 8.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Nathan Whitehorn +.Aq nwhitehorn@FreeBSD.org . Copied: stable/8/share/man/man4/man4.powerpc/akbd.4 (from r200070, head/share/man/man4/man4.powerpc/akbd.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/share/man/man4/man4.powerpc/akbd.4 Tue Dec 8 05:18:59 2009 (r200247, copy of r200070, head/share/man/man4/man4.powerpc/akbd.4) @@ -0,0 +1,76 @@ +.\"- +.\" Copyright (c) 2009 Nathan Whitehorn +.\" 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 ``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$ +.\" +.Dd December 3, 2009 +.Dt AKBD 4 +.Os +.Sh NAME +.Nm akbd +.Nd ADB Keyboard Driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device adb" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for all keyboards attached to the Apple Desktop +Bus (ADB). +.Sh HARDWARE +Devices supported by the +.Nm +driver include: +.Pp +.Bl -bullet -compact +.It +Apple Extended Keyboard +.It +Apple Keyboard II +.It +Apple iBook Keyboard +.It +Apple PowerBook Keyboard +.El +.Sh SEE ALSO +.Xr adb 4 , +.Xr cuda 4 , +.Xr pmu 4 +.Sh HISTORY +The +.Nm +device driver appeared in +.Fx 8.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Nathan Whitehorn +.Aq nwhitehorn@FreeBSD.org . Copied: stable/8/share/man/man4/man4.powerpc/ams.4 (from r200070, head/share/man/man4/man4.powerpc/ams.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/share/man/man4/man4.powerpc/ams.4 Tue Dec 8 05:18:59 2009 (r200247, copy of r200070, head/share/man/man4/man4.powerpc/ams.4) @@ -0,0 +1,87 @@ +.\"- +.\" Copyright (c) 2009 Nathan Whitehorn +.\" 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 ``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$ +.\" +.Dd December 3, 2009 +.Dt AMS 4 +.Os +.Sh NAME +.Nm ams +.Nd ADB Mouse Driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device adb" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for mice and trackpads attached to the Apple Desktop +Bus (ADB) implementing both the base and extended ADB mouse protocols. +.Sh HARDWARE +Devices supported by the +.Nm +driver include: +.Pp +.Bl -bullet -compact +.It +Apple Mouse +.It +ADB Extended Mouse +.It +MacAlly 2-Button Mouse +.It +Apple iBook Trackpad +.It +Apple PowerBook Trackpad +.El +.Sh SYSCTL VARIABLES +.Bl -tag -width indent +.It Va dev.ams.%d.tapping +On ADB trackpads, setting this sysctl to 1 causes taps on the trackpad to +be interpreted as button clicks. +.El +.Sh SEE ALSO +Apple Tech Note HW01: ADB - The Untold Story: Space Aliens Ate My Mouse: +.Pa http://developer.apple.com/legacy/mac/library/technotes/hw/hw_01.html +.Pp +.Xr adb 4 , +.Xr cuda 4 , +.Xr pmu 4 +.Sh HISTORY +The +.Nm +device driver appeared in +.Fx 8.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Nathan Whitehorn +.Aq nwhitehorn@FreeBSD.org . Copied: stable/8/share/man/man4/man4.powerpc/cuda.4 (from r200070, head/share/man/man4/man4.powerpc/cuda.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/share/man/man4/man4.powerpc/cuda.4 Tue Dec 8 05:18:59 2009 (r200247, copy of r200070, head/share/man/man4/man4.powerpc/cuda.4) @@ -0,0 +1,79 @@ +.\"- +.\" Copyright (c) 2009 Nathan Whitehorn +.\" 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 ``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$ +.\" +.Dd December 3, 2009 +.Dt CUDA 4 +.Os +.Sh NAME +.Nm cuda +.Nd Apple CUDA I/O Controller Driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device adb" +.Cd "device cuda" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the CUDA VIA (Versatile Interface Attachment) +chip found in pre-Core99 Apple hardware, such as the Power Macintosh G3. +.Pp +The Apple CUDA controller is a multi-purpose ASIC that provides power +control and an +.Xr adb 4 +interface. +.Sh HARDWARE +Chips supported by the +.Nm +driver include: +.Pp +.Bl -bullet -compact +.It +Apple CUDA I/O Controller +.El +.Sh SEE ALSO +.Xr adb 4 +.Sh HISTORY +The +.Nm +device driver appeared in +.Nx 4.0 , +and then in +.Fx 8.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Michael Lorenz +.Aq macallan@NetBSD.org +and ported to FreeBSD by +.An Nathan Whitehorn +.Aq nwhitehorn@FreeBSD.org . Modified: stable/8/share/man/man4/man4.powerpc/pmu.4 ============================================================================== --- stable/8/share/man/man4/man4.powerpc/pmu.4 Tue Dec 8 03:24:29 2009 (r200246) +++ stable/8/share/man/man4/man4.powerpc/pmu.4 Tue Dec 8 05:18:59 2009 (r200247) @@ -95,7 +95,8 @@ Current fraction of the battery's maximu .El .Sh SEE ALSO .Xr acpi 4 , -.Xr adb 4 +.Xr adb 4 , +.Xr led 4 .Sh HISTORY The .Nm From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 8 05:23:08 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 548F31065672; Tue, 8 Dec 2009 05:23:08 +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 427028FC0C; Tue, 8 Dec 2009 05:23:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB85N8uq077005; Tue, 8 Dec 2009 05:23:08 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB85N8gV077003; Tue, 8 Dec 2009 05:23:08 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200912080523.nB85N8gV077003@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 8 Dec 2009 05:23:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200248 - stable/8/sys/powerpc/powermac X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 05:23:08 -0000 Author: nwhitehorn Date: Tue Dec 8 05:23:07 2009 New Revision: 200248 URL: http://svn.freebsd.org/changeset/base/200248 Log: MFC r198444: Allow Heathrow-based machines to boot a kernel containing option SMP without panicing. Modified: stable/8/sys/powerpc/powermac/hrowpic.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/powerpc/powermac/hrowpic.c ============================================================================== --- stable/8/sys/powerpc/powermac/hrowpic.c Tue Dec 8 05:18:59 2009 (r200247) +++ stable/8/sys/powerpc/powermac/hrowpic.c Tue Dec 8 05:23:07 2009 (r200248) @@ -182,7 +182,13 @@ hrowpic_toggle_irq(struct hrowpic_softc u_int roffset; u_int rbit; - KASSERT((irq > 0) && (irq < HROWPIC_IRQMAX), ("en irq out of range")); + KASSERT((irq > 0) && (irq <= HROWPIC_IRQMAX), ("en irq out of range")); + + /* + * Humor the SMP layer if it wants to set up an IPI handler. + */ + if (irq == HROWPIC_IRQMAX) + return; /* * Calculate prim/sec register bank for the IRQ, update soft copy, From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 8 05:27:07 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20EA8106566B; Tue, 8 Dec 2009 05:27:07 +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 0D9738FC0A; Tue, 8 Dec 2009 05:27:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB85R6TU077180; Tue, 8 Dec 2009 05:27:06 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB85R6Ht077177; Tue, 8 Dec 2009 05:27:06 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200912080527.nB85R6Ht077177@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 8 Dec 2009 05:27:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200249 - in stable/8/sys/powerpc: include powerpc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 05:27:07 -0000 Author: nwhitehorn Date: Tue Dec 8 05:27:06 2009 New Revision: 200249 URL: http://svn.freebsd.org/changeset/base/200249 Log: MFC r198445: Turn on NAP mode on G5 systems, and refactor the HID0 setup code a little. This makes my G5 Xserve sound slightly less like it is filled with howling banshees. MFC r198968: Unbreak E500 builds. The inline assembly for the 970 CPUs is invalid when compiling for BookE. MFC r199533: Fix cpuid output on E500 core. Modified: stable/8/sys/powerpc/include/hid.h stable/8/sys/powerpc/powerpc/cpu.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/powerpc/include/hid.h ============================================================================== --- stable/8/sys/powerpc/include/hid.h Tue Dec 8 05:23:07 2009 (r200248) +++ stable/8/sys/powerpc/include/hid.h Tue Dec 8 05:27:06 2009 (r200249) @@ -41,6 +41,7 @@ #define HID0_ECLK 0x02000000 /* CLK_OUT clock type selection */ #define HID0_PAR 0x01000000 /* Disable precharge of ARTRY */ #define HID0_STEN 0x01000000 /* Software table search enable (7450) */ +#define HID0_DEEPNAP 0x01000000 /* Enable deep nap mode (970) */ #define HID0_HBATEN 0x00800000 /* High BAT enable (74[45][578]) */ #define HID0_DOZE 0x00800000 /* Enable doze mode */ #define HID0_NAP 0x00400000 /* Enable nap mode */ @@ -98,6 +99,12 @@ "\020b16\017TBEN\016SEL_TBCLK\015b19\014b20\013b21\012b22\011b23" \ "\010EN_MAS7_UPDATE\007DCFA\006b26\005b27\004b28\003b29\002b30\001NOPTI" +#define HID0_970_BITMASK \ + "\20" \ + "\040ONEPPC\037SINGLE\036ISYNCSC\035SERGP\031DEEPNAP\030DOZE" \ + "\027NAP\025DPM\023TG\022HANGDETECT\021NHR\020INORDER" \ + "\016TBCTRL\015TBEN\012CIABREN\011HDICEEN\001ENATTN" + /* * HID0 bit definitions per cpu model * Modified: stable/8/sys/powerpc/powerpc/cpu.c ============================================================================== --- stable/8/sys/powerpc/powerpc/cpu.c Tue Dec 8 05:23:07 2009 (r200248) +++ stable/8/sys/powerpc/powerpc/cpu.c Tue Dec 8 05:27:06 2009 (r200249) @@ -114,16 +114,21 @@ static char model[64]; SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, model, 0, ""); static void cpu_print_speed(void); -static void cpu_print_cacheinfo(u_int, uint16_t); + +static void cpu_6xx_setup(int cpuid, uint16_t vers); +static void cpu_6xx_print_cacheinfo(u_int, uint16_t); +static void cpu_e500_setup(int cpuid, uint16_t vers); +#ifndef E500 +static void cpu_970_setup(int cpuid, uint16_t vers); +#endif void cpu_setup(u_int cpuid) { - u_int pvr, maj, min, hid0; + u_int pvr, maj, min; uint16_t vers, rev, revfmt; const struct cputab *cp; const char *name; - char *bitmask; pvr = mfpvr(); vers = pvr >> 16; @@ -170,10 +175,8 @@ cpu_setup(u_int cpuid) break; } - hid0 = mfspr(SPR_HID0); - /* - * Configure power-saving mode. + * Configure CPU */ switch (vers) { case MPC603: @@ -184,102 +187,36 @@ cpu_setup(u_int cpuid) case IBM750FX: case MPC7400: case MPC7410: - case MPC8240: - case MPC8245: - /* Select DOZE mode. */ - hid0 &= ~(HID0_DOZE | HID0_NAP | HID0_SLEEP); - hid0 |= HID0_DOZE | HID0_DPM; - powerpc_pow_enabled = 1; - break; - - case MPC7448: - case MPC7447A: - case MPC7457: - case MPC7455: - case MPC7450: - /* Enable the 7450 branch caches */ - hid0 |= HID0_SGE | HID0_BTIC; - hid0 |= HID0_LRSTK | HID0_FOLD | HID0_BHT; - /* Disable BTIC on 7450 Rev 2.0 or earlier and on 7457 */ - if (((pvr >> 16) == MPC7450 && (pvr & 0xFFFF) <= 0x0200) - || (pvr >> 16) == MPC7457) - hid0 &= ~HID0_BTIC; - /* Select NAP mode. */ - hid0 &= ~(HID0_DOZE | HID0_NAP | HID0_SLEEP); - hid0 |= HID0_NAP | HID0_DPM; - powerpc_pow_enabled = 1; - break; - - default: - /* No power-saving mode is available. */ ; - } - - switch (vers) { - case IBM750FX: - case MPC750: - hid0 &= ~HID0_DBP; /* XXX correct? */ - hid0 |= HID0_EMCP | HID0_BTIC | HID0_SGE | HID0_BHT; - break; - - case MPC7400: - case MPC7410: - hid0 &= ~HID0_SPD; - hid0 |= HID0_EMCP | HID0_BTIC | HID0_SGE | HID0_BHT; - hid0 |= HID0_EIEC; - break; - - case FSL_E500v1: - case FSL_E500v2: - break; - } - - mtspr(SPR_HID0, hid0); - - switch (vers) { case MPC7447A: case MPC7448: case MPC7450: case MPC7455: case MPC7457: - bitmask = HID0_7450_BITMASK; - break; - case FSL_E500v1: - case FSL_E500v2: - bitmask = HID0_E500_BITMASK; - break; - default: - bitmask = HID0_BITMASK; + case MPC8240: + case MPC8245: + cpu_6xx_setup(cpuid, vers); break; - } - switch (vers) { - case MPC7450: - case MPC7455: - case MPC7457: - case MPC750: - case IBM750FX: - case MPC7400: - case MPC7410: - case MPC7447A: - case MPC7448: - cpu_print_speed(); - printf("\n"); - - if (bootverbose) - cpu_print_cacheinfo(cpuid, vers); - break; +#ifndef E500 case IBM970: case IBM970FX: + case IBM970GX: case IBM970MP: - cpu_print_speed(); - printf("\n"); + cpu_970_setup(cpuid, vers); + break; +#endif + + case FSL_E500v1: + case FSL_E500v2: + cpu_e500_setup(cpuid, vers); break; + default: - printf("\n"); + /* HID setup is unknown */ break; } - printf("cpu%d: HID0 %b\n", cpuid, hid0, bitmask); + printf("\n"); } void @@ -346,10 +283,101 @@ cpu_est_clockrate(int cpu_id, uint64_t * } void -cpu_print_cacheinfo(u_int cpuid, uint16_t vers) +cpu_6xx_setup(int cpuid, uint16_t vers) { - uint32_t hid; + register_t hid0, pvr; + const char *bitmask; + hid0 = mfspr(SPR_HID0); + pvr = mfpvr(); + + /* + * Configure power-saving mode. + */ + switch (vers) { + case MPC603: + case MPC603e: + case MPC603ev: + case MPC604ev: + case MPC750: + case IBM750FX: + case MPC7400: + case MPC7410: + case MPC8240: + case MPC8245: + /* Select DOZE mode. */ + hid0 &= ~(HID0_DOZE | HID0_NAP | HID0_SLEEP); + hid0 |= HID0_DOZE | HID0_DPM; + powerpc_pow_enabled = 1; + break; + + case MPC7448: + case MPC7447A: + case MPC7457: + case MPC7455: + case MPC7450: + /* Enable the 7450 branch caches */ + hid0 |= HID0_SGE | HID0_BTIC; + hid0 |= HID0_LRSTK | HID0_FOLD | HID0_BHT; + /* Disable BTIC on 7450 Rev 2.0 or earlier and on 7457 */ + if (((pvr >> 16) == MPC7450 && (pvr & 0xFFFF) <= 0x0200) + || (pvr >> 16) == MPC7457) + hid0 &= ~HID0_BTIC; + /* Select NAP mode. */ + hid0 &= ~(HID0_DOZE | HID0_NAP | HID0_SLEEP); + hid0 |= HID0_NAP | HID0_DPM; + powerpc_pow_enabled = 1; + break; + + default: + /* No power-saving mode is available. */ ; + } + + switch (vers) { + case IBM750FX: + case MPC750: + hid0 &= ~HID0_DBP; /* XXX correct? */ + hid0 |= HID0_EMCP | HID0_BTIC | HID0_SGE | HID0_BHT; + break; + + case MPC7400: + case MPC7410: + hid0 &= ~HID0_SPD; + hid0 |= HID0_EMCP | HID0_BTIC | HID0_SGE | HID0_BHT; + hid0 |= HID0_EIEC; + break; + + } + + mtspr(SPR_HID0, hid0); + + cpu_print_speed(); + printf("\n"); + + if (bootverbose) + cpu_6xx_print_cacheinfo(cpuid, vers); + + switch (vers) { + case MPC7447A: + case MPC7448: + case MPC7450: + case MPC7455: + case MPC7457: + bitmask = HID0_7450_BITMASK; + break; + default: + bitmask = HID0_BITMASK; + break; + } + + printf("cpu%d: HID0 %b", cpuid, (int)hid0, bitmask); +} + + +static void +cpu_6xx_print_cacheinfo(u_int cpuid, uint16_t vers) +{ + register_t hid; hid = mfspr(SPR_HID0); printf("cpu%u: ", cpuid); @@ -395,3 +423,46 @@ cpu_print_cacheinfo(u_int cpuid, uint16_ } else printf("L2 cache disabled\n"); } + +static void +cpu_e500_setup(int cpuid, uint16_t vers) +{ + register_t hid0; + + printf("\n"); + + hid0 = mfspr(SPR_HID0); + printf("cpu%d: HID0 %b", cpuid, (int)hid0, HID0_E500_BITMASK); +} + +#ifndef E500 +static void +cpu_970_setup(int cpuid, uint16_t vers) +{ + uint32_t hid0_hi, hid0_lo; + + __asm __volatile ("mfspr %0,%2; clrldi %1,%0,32; srdi %0,%0,32;" + : "=r" (hid0_hi), "=r" (hid0_lo) : "K" (SPR_HID0)); + + /* Configure power-saving mode */ + hid0_hi |= (HID0_NAP | HID0_DPM); + hid0_hi &= ~(HID0_DOZE | HID0_DEEPNAP); + powerpc_pow_enabled = 1; + + __asm __volatile (" \ + sync; isync; \ + sldi %0,%0,32; or %0,%0,%1; \ + mtspr %2, %0; \ + mfspr %0, %2; mfspr %0, %2; mfspr %0, %2; \ + mfspr %0, %2; mfspr %0, %2; mfspr %0, %2; \ + sync; isync" + :: "r" (hid0_hi), "r"(hid0_lo), "K" (SPR_HID0)); + + cpu_print_speed(); + printf("\n"); + + __asm __volatile ("mfspr %0,%1; srdi %0,%0,32;" + : "=r" (hid0_hi) : "K" (SPR_HID0)); + printf("cpu%d: HID0 %b", cpuid, (int)(hid0_hi), HID0_970_BITMASK); +} +#endif From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 8 05:32:44 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F07BC1065670; Tue, 8 Dec 2009 05:32:44 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE7798FC0A; Tue, 8 Dec 2009 05:32:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB85Wit9077515; Tue, 8 Dec 2009 05:32:44 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB85Wi2p077513; Tue, 8 Dec 2009 05:32:44 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200912080532.nB85Wi2p077513@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 8 Dec 2009 05:32:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200250 - stable/8/sys/powerpc/powerpc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 05:32:45 -0000 Author: nwhitehorn Date: Tue Dec 8 05:32:44 2009 New Revision: 200250 URL: http://svn.freebsd.org/changeset/base/200250 Log: MFC r198678: ake procstat -k work on PowerPC by avoiding mistakenly using signed compares with a low address (0x1000) and a high address (the KVA kernel stack). Modified: stable/8/sys/powerpc/powerpc/stack_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/powerpc/powerpc/stack_machdep.c ============================================================================== --- stable/8/sys/powerpc/powerpc/stack_machdep.c Tue Dec 8 05:27:06 2009 (r200249) +++ stable/8/sys/powerpc/powerpc/stack_machdep.c Tue Dec 8 05:32:44 2009 (r200250) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include static void -stack_capture(struct stack *st, register_t frame) +stack_capture(struct stack *st, vm_offset_t frame) { vm_offset_t callpc; @@ -76,7 +76,7 @@ stack_capture(struct stack *st, register void stack_save_td(struct stack *st, struct thread *td) { - register_t frame; + vm_offset_t frame; if (TD_IS_SWAPPED(td)) panic("stack_save_td: swapped"); From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 8 05:37:09 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0029D1065670; Tue, 8 Dec 2009 05:37:08 +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 E0C1B8FC13; Tue, 8 Dec 2009 05:37:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB85b8eL077710; Tue, 8 Dec 2009 05:37:08 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB85b8B7077703; Tue, 8 Dec 2009 05:37:08 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200912080537.nB85b8B7077703@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 8 Dec 2009 05:37:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200252 - in stable/8/sys/powerpc: aim booke include powerpc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 05:37:09 -0000 Author: nwhitehorn Date: Tue Dec 8 05:37:08 2009 New Revision: 200252 URL: http://svn.freebsd.org/changeset/base/200252 Log: MFC r199886: Add a CPU features framework on PowerPC and simplify CPU setup a little more. This provides three new sysctls to user space: hw.cpu_features - A bitmask of available CPU features hw.floatingpoint - Whether or not there is hardware FP support hw.altivec - Whether or not Altivec is available PR: powerpc/139154 Modified: stable/8/sys/powerpc/aim/machdep.c stable/8/sys/powerpc/aim/ofw_machdep.c stable/8/sys/powerpc/booke/machdep.c stable/8/sys/powerpc/include/cpu.h stable/8/sys/powerpc/include/md_var.h stable/8/sys/powerpc/powerpc/cpu.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/powerpc/aim/machdep.c ============================================================================== --- stable/8/sys/powerpc/aim/machdep.c Tue Dec 8 05:35:51 2009 (r200251) +++ stable/8/sys/powerpc/aim/machdep.c Tue Dec 8 05:37:08 2009 (r200252) @@ -130,7 +130,6 @@ extern vm_offset_t ksym_start, ksym_end; int cold = 1; int cacheline_size = 32; -int ppc64 = 0; int hw_direct_map = 1; struct pcpu __pcpu[MAXCPU]; @@ -256,6 +255,7 @@ powerpc_init(u_int startkernel, u_int en char *env; uint32_t msr, scratch; uint8_t *cache_check; + int ppc64; end = 0; kmdp = NULL; @@ -405,12 +405,15 @@ powerpc_init(u_int startkernel, u_int en mfsprg2 %1;" : "=r"(scratch), "=r"(ppc64)); + if (ppc64) + cpu_features |= PPC_FEATURE_64; + /* * Now copy restorebridge into all the handlers, if necessary, * and set up the trap tables. */ - if (ppc64) { + if (cpu_features & PPC_FEATURE_64) { /* Patch the two instances of rfi -> rfid */ bcopy(&rfid_patch,&rfi_patch1,4); #ifdef KDB @@ -489,7 +492,7 @@ powerpc_init(u_int startkernel, u_int en * in case the platform module had a better idea of what we * should do. */ - if (ppc64) + if (cpu_features & PPC_FEATURE_64) pmap_mmu_install(MMU_TYPE_G5, BUS_PROBE_GENERIC); else pmap_mmu_install(MMU_TYPE_OEA, BUS_PROBE_GENERIC); Modified: stable/8/sys/powerpc/aim/ofw_machdep.c ============================================================================== --- stable/8/sys/powerpc/aim/ofw_machdep.c Tue Dec 8 05:35:51 2009 (r200251) +++ stable/8/sys/powerpc/aim/ofw_machdep.c Tue Dec 8 05:37:08 2009 (r200252) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -336,7 +337,7 @@ openfirmware(void *args) /* * Clear battable[] translations */ - if (!ppc64) { + if (!(cpu_features & PPC_FEATURE_64)) { __asm __volatile("mtdbatu 2, %0\n" "mtdbatu 3, %0" : : "r" (0)); } Modified: stable/8/sys/powerpc/booke/machdep.c ============================================================================== --- stable/8/sys/powerpc/booke/machdep.c Tue Dec 8 05:35:51 2009 (r200251) +++ stable/8/sys/powerpc/booke/machdep.c Tue Dec 8 05:37:08 2009 (r200252) @@ -179,7 +179,6 @@ SYSCTL_INT(_machdep, CPU_CACHELINE, cach CTLFLAG_RD, &cacheline_size, 0, ""); int hw_direct_map = 0; -int ppc64 = 0; static void cpu_e500_startup(void *); SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_e500_startup, NULL); Modified: stable/8/sys/powerpc/include/cpu.h ============================================================================== --- stable/8/sys/powerpc/include/cpu.h Tue Dec 8 05:35:51 2009 (r200251) +++ stable/8/sys/powerpc/include/cpu.h Tue Dec 8 05:37:08 2009 (r200252) @@ -39,6 +39,27 @@ #include #include +/* + * CPU Feature Attributes + * + * These are defined in the PowerPC ELF ABI for the AT_HWCAP vector, + * and are exported to userland via the machdep.cpu_features + * sysctl. + */ + +extern int cpu_features; + +#define PPC_FEATURE_32 0x80000000 /* Always true */ +#define PPC_FEATURE_64 0x40000000 /* Defined on a 64-bit CPU */ +#define PPC_FEATURE_HAS_ALTIVEC 0x10000000 +#define PPC_FEATURE_HAS_FPU 0x08000000 +#define PPC_FEATURE_HAS_MMU 0x04000000 +#define PPC_FEATURE_UNIFIED_CACHE 0x01000000 + +#define PPC_FEATURE_BITMASK \ + "\20" \ + "\040PPC32\037PPC64\035ALTIVEC\034FPU\033MMU\031UNIFIEDCACHE" + #define TRAPF_USERMODE(frame) (((frame)->srr1 & PSL_PR) != 0) #define TRAPF_PC(frame) ((frame)->srr0) Modified: stable/8/sys/powerpc/include/md_var.h ============================================================================== --- stable/8/sys/powerpc/include/md_var.h Tue Dec 8 05:35:51 2009 (r200251) +++ stable/8/sys/powerpc/include/md_var.h Tue Dec 8 05:37:08 2009 (r200252) @@ -46,7 +46,6 @@ extern u_long ns_per_tick; extern int powerpc_pow_enabled; extern int cacheline_size; -extern int ppc64; extern int hw_direct_map; void __syncicache(void *, int); Modified: stable/8/sys/powerpc/powerpc/cpu.c ============================================================================== --- stable/8/sys/powerpc/powerpc/cpu.c Tue Dec 8 05:35:51 2009 (r200251) +++ stable/8/sys/powerpc/powerpc/cpu.c Tue Dec 8 05:37:08 2009 (r200252) @@ -67,6 +67,7 @@ #include #include +#include #include #include #include @@ -74,59 +75,102 @@ int powerpc_pow_enabled; +static void cpu_6xx_setup(int cpuid, uint16_t vers); +static void cpu_e500_setup(int cpuid, uint16_t vers); +static void cpu_970_setup(int cpuid, uint16_t vers); + struct cputab { const char *name; uint16_t version; uint16_t revfmt; + int features; /* Do not include PPC_FEATURE_32 or + * PPC_FEATURE_HAS_MMU */ + void (*cpu_setup)(int cpuid, uint16_t vers); }; #define REVFMT_MAJMIN 1 /* %u.%u */ #define REVFMT_HEX 2 /* 0x%04x */ #define REVFMT_DEC 3 /* %u */ static const struct cputab models[] = { - { "Motorola PowerPC 601", MPC601, REVFMT_DEC }, - { "Motorola PowerPC 602", MPC602, REVFMT_DEC }, - { "Motorola PowerPC 603", MPC603, REVFMT_MAJMIN }, - { "Motorola PowerPC 603e", MPC603e, REVFMT_MAJMIN }, - { "Motorola PowerPC 603ev", MPC603ev, REVFMT_MAJMIN }, - { "Motorola PowerPC 604", MPC604, REVFMT_MAJMIN }, - { "Motorola PowerPC 604ev", MPC604ev, REVFMT_MAJMIN }, - { "Motorola PowerPC 620", MPC620, REVFMT_HEX }, - { "Motorola PowerPC 750", MPC750, REVFMT_MAJMIN }, - { "IBM PowerPC 750FX", IBM750FX, REVFMT_MAJMIN }, - { "IBM PowerPC 970", IBM970, REVFMT_MAJMIN }, - { "IBM PowerPC 970FX", IBM970FX, REVFMT_MAJMIN }, - { "IBM PowerPC 970GX", IBM970GX, REVFMT_MAJMIN }, - { "IBM PowerPC 970MP", IBM970MP, REVFMT_MAJMIN }, - { "Motorola PowerPC 7400", MPC7400, REVFMT_MAJMIN }, - { "Motorola PowerPC 7410", MPC7410, REVFMT_MAJMIN }, - { "Motorola PowerPC 7450", MPC7450, REVFMT_MAJMIN }, - { "Motorola PowerPC 7455", MPC7455, REVFMT_MAJMIN }, - { "Motorola PowerPC 7457", MPC7457, REVFMT_MAJMIN }, - { "Motorola PowerPC 7447A", MPC7447A, REVFMT_MAJMIN }, - { "Motorola PowerPC 7448", MPC7448, REVFMT_MAJMIN }, - { "Motorola PowerPC 8240", MPC8240, REVFMT_MAJMIN }, - { "Freescale e500v1 core", FSL_E500v1, REVFMT_MAJMIN }, - { "Freescale e500v2 core", FSL_E500v2, REVFMT_MAJMIN }, - { "Unknown PowerPC CPU", 0, REVFMT_HEX } + { "Motorola PowerPC 601", MPC601, REVFMT_DEC, + PPC_FEATURE_HAS_FPU | PPC_FEATURE_UNIFIED_CACHE, cpu_6xx_setup }, + { "Motorola PowerPC 602", MPC602, REVFMT_DEC, + PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "Motorola PowerPC 603", MPC603, REVFMT_MAJMIN, + PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "Motorola PowerPC 603e", MPC603e, REVFMT_MAJMIN, + PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "Motorola PowerPC 603ev", MPC603ev, REVFMT_MAJMIN, + PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "Motorola PowerPC 604", MPC604, REVFMT_MAJMIN, + PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "Motorola PowerPC 604ev", MPC604ev, REVFMT_MAJMIN, + PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "Motorola PowerPC 620", MPC620, REVFMT_HEX, + PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, NULL }, + { "Motorola PowerPC 750", MPC750, REVFMT_MAJMIN, + PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "IBM PowerPC 750FX", IBM750FX, REVFMT_MAJMIN, + PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "IBM PowerPC 970", IBM970, REVFMT_MAJMIN, + PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, + cpu_970_setup }, + { "IBM PowerPC 970FX", IBM970FX, REVFMT_MAJMIN, + PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, + cpu_970_setup }, + { "IBM PowerPC 970GX", IBM970GX, REVFMT_MAJMIN, + PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, + cpu_970_setup }, + { "IBM PowerPC 970MP", IBM970MP, REVFMT_MAJMIN, + PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, + cpu_970_setup }, + { "Motorola PowerPC 7400", MPC7400, REVFMT_MAJMIN, + PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "Motorola PowerPC 7410", MPC7410, REVFMT_MAJMIN, + PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "Motorola PowerPC 7450", MPC7450, REVFMT_MAJMIN, + PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "Motorola PowerPC 7455", MPC7455, REVFMT_MAJMIN, + PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "Motorola PowerPC 7457", MPC7457, REVFMT_MAJMIN, + PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "Motorola PowerPC 7447A", MPC7447A, REVFMT_MAJMIN, + PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "Motorola PowerPC 7448", MPC7448, REVFMT_MAJMIN, + PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "Motorola PowerPC 8240", MPC8240, REVFMT_MAJMIN, + PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "Motorola PowerPC 8245", MPC8245, REVFMT_MAJMIN, + PPC_FEATURE_HAS_FPU, cpu_6xx_setup }, + { "Freescale e500v1 core", FSL_E500v1, REVFMT_MAJMIN, + 0, cpu_e500_setup }, + { "Freescale e500v2 core", FSL_E500v2, REVFMT_MAJMIN, + 0, cpu_e500_setup }, + { "Unknown PowerPC CPU", 0, REVFMT_HEX, 0, NULL }, }; +static void cpu_6xx_print_cacheinfo(u_int, uint16_t); +static int cpu_feature_bit(SYSCTL_HANDLER_ARGS); + static char model[64]; SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, model, 0, ""); -static void cpu_print_speed(void); - -static void cpu_6xx_setup(int cpuid, uint16_t vers); -static void cpu_6xx_print_cacheinfo(u_int, uint16_t); -static void cpu_e500_setup(int cpuid, uint16_t vers); -#ifndef E500 -static void cpu_970_setup(int cpuid, uint16_t vers); -#endif +int cpu_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU; +SYSCTL_OPAQUE(_hw, OID_AUTO, cpu_features, CTLTYPE_INT | CTLFLAG_RD, + &cpu_features, sizeof(cpu_features), "IX", "PowerPC CPU features"); + +/* Provide some user-friendly aliases for bits in cpu_features */ +SYSCTL_PROC(_hw, OID_AUTO, floatingpoint, CTLTYPE_INT | CTLFLAG_RD, + 0, PPC_FEATURE_HAS_FPU, cpu_feature_bit, "I", + "Floating point instructions executed in hardware"); +SYSCTL_PROC(_hw, OID_AUTO, altivec, CTLTYPE_INT | CTLFLAG_RD, + 0, PPC_FEATURE_HAS_ALTIVEC, cpu_feature_bit, "I", "CPU supports Altivec"); void cpu_setup(u_int cpuid) { u_int pvr, maj, min; uint16_t vers, rev, revfmt; + uint64_t cps; const struct cputab *cp; const char *name; @@ -175,57 +219,19 @@ cpu_setup(u_int cpuid) break; } + if (cpu_est_clockrate(0, &cps) == 0) + printf(", %lld.%02lld MHz", cps / 1000000, (cps / 10000) % 100); + printf("\n"); + + cpu_features |= cp->features; + printf("cpu%d: Features %b\n", cpuid, cpu_features, + PPC_FEATURE_BITMASK); + /* * Configure CPU */ - switch (vers) { - case MPC603: - case MPC603e: - case MPC603ev: - case MPC604ev: - case MPC750: - case IBM750FX: - case MPC7400: - case MPC7410: - case MPC7447A: - case MPC7448: - case MPC7450: - case MPC7455: - case MPC7457: - case MPC8240: - case MPC8245: - cpu_6xx_setup(cpuid, vers); - break; - -#ifndef E500 - case IBM970: - case IBM970FX: - case IBM970GX: - case IBM970MP: - cpu_970_setup(cpuid, vers); - break; -#endif - - case FSL_E500v1: - case FSL_E500v2: - cpu_e500_setup(cpuid, vers); - break; - - default: - /* HID setup is unknown */ - break; - } - - printf("\n"); -} - -void -cpu_print_speed(void) -{ - uint64_t cps; - - if (cpu_est_clockrate(0, &cps) == 0) - printf(", %lld.%02lld MHz", cps / 1000000, (cps / 10000) % 100); + if (cp->cpu_setup != NULL) + cp->cpu_setup(cpuid, vers); } /* Get current clock frequency for the given cpu id. */ @@ -351,9 +357,6 @@ cpu_6xx_setup(int cpuid, uint16_t vers) mtspr(SPR_HID0, hid0); - cpu_print_speed(); - printf("\n"); - if (bootverbose) cpu_6xx_print_cacheinfo(cpuid, vers); @@ -370,7 +373,7 @@ cpu_6xx_setup(int cpuid, uint16_t vers) break; } - printf("cpu%d: HID0 %b", cpuid, (int)hid0, bitmask); + printf("cpu%d: HID0 %b\n", cpuid, (int)hid0, bitmask); } @@ -429,16 +432,14 @@ cpu_e500_setup(int cpuid, uint16_t vers) { register_t hid0; - printf("\n"); - hid0 = mfspr(SPR_HID0); - printf("cpu%d: HID0 %b", cpuid, (int)hid0, HID0_E500_BITMASK); + printf("cpu%d: HID0 %b\n", cpuid, (int)hid0, HID0_E500_BITMASK); } -#ifndef E500 static void cpu_970_setup(int cpuid, uint16_t vers) { +#ifdef AIM uint32_t hid0_hi, hid0_lo; __asm __volatile ("mfspr %0,%2; clrldi %1,%0,32; srdi %0,%0,32;" @@ -458,11 +459,19 @@ cpu_970_setup(int cpuid, uint16_t vers) sync; isync" :: "r" (hid0_hi), "r"(hid0_lo), "K" (SPR_HID0)); - cpu_print_speed(); - printf("\n"); - __asm __volatile ("mfspr %0,%1; srdi %0,%0,32;" : "=r" (hid0_hi) : "K" (SPR_HID0)); - printf("cpu%d: HID0 %b", cpuid, (int)(hid0_hi), HID0_970_BITMASK); -} + printf("cpu%d: HID0 %b\n", cpuid, (int)(hid0_hi), HID0_970_BITMASK); #endif +} + +static int +cpu_feature_bit(SYSCTL_HANDLER_ARGS) +{ + int result; + + result = (cpu_features & arg2) ? 1 : 0; + + return (sysctl_handle_int(oidp, &result, 0, req)); +} + From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 8 15:14:56 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20A661065670; Tue, 8 Dec 2009 15:14:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F1E78FC22; Tue, 8 Dec 2009 15:14:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB8FEtrh091431; Tue, 8 Dec 2009 15:14:55 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB8FEtGh091429; Tue, 8 Dec 2009 15:14:55 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200912081514.nB8FEtGh091429@svn.freebsd.org> From: Andriy Gapon Date: Tue, 8 Dec 2009 15:14:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200258 - stable/8/sys/dev/ichsmb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 15:14:56 -0000 Author: avg Date: Tue Dec 8 15:14:55 2009 New Revision: 200258 URL: http://svn.freebsd.org/changeset/base/200258 Log: MFC r200052: ichsmb: add pci ids for some newer supported hardware Modified: stable/8/sys/dev/ichsmb/ichsmb_pci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- stable/8/sys/dev/ichsmb/ichsmb_pci.c Tue Dec 8 14:55:07 2009 (r200257) +++ stable/8/sys/dev/ichsmb/ichsmb_pci.c Tue Dec 8 15:14:55 2009 (r200258) @@ -75,6 +75,9 @@ __FBSDID("$FreeBSD$"); #define ID_82801EB 0x24D38086 #define ID_82801FB 0x266A8086 #define ID_82801GB 0x27da8086 +#define ID_82801H 0x283e8086 +#define ID_82801I 0x29308086 +#define ID_82801JI 0x3a308086 #define ID_6300ESB 0x25a48086 #define ID_631xESB 0x269b8086 @@ -152,6 +155,15 @@ ichsmb_pci_probe(device_t dev) case ID_82801GB: device_set_desc(dev, "Intel 82801GB (ICH7) SMBus controller"); break; + case ID_82801H: + device_set_desc(dev, "Intel 82801H (ICH8) SMBus controller"); + break; + case ID_82801I: + device_set_desc(dev, "Intel 82801I (ICH9) SMBus controller"); + break; + case ID_82801JI: + device_set_desc(dev, "Intel 82801JI (ICH10) SMBus controller"); + break; case ID_6300ESB: device_set_desc(dev, "Intel 6300ESB (ICH) SMBus controller"); break; From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 8 15:21:39 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F9AE106566C; Tue, 8 Dec 2009 15:21:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DE7F8FC20; Tue, 8 Dec 2009 15:21:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB8FLdDH091778; Tue, 8 Dec 2009 15:21:39 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB8FLd39091775; Tue, 8 Dec 2009 15:21:39 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200912081521.nB8FLd39091775@svn.freebsd.org> From: Andriy Gapon Date: Tue, 8 Dec 2009 15:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200260 - in stable/8/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 15:21:39 -0000 Author: avg Date: Tue Dec 8 15:21:39 2009 New Revision: 200260 URL: http://svn.freebsd.org/changeset/base/200260 Log: MFC r199184: reflect that pg_ps_enabled is a tunable Modified: stable/8/sys/amd64/amd64/pmap.c stable/8/sys/i386/i386/pmap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/amd64/pmap.c ============================================================================== --- stable/8/sys/amd64/amd64/pmap.c Tue Dec 8 15:16:48 2009 (r200259) +++ stable/8/sys/amd64/amd64/pmap.c Tue Dec 8 15:21:39 2009 (r200260) @@ -181,7 +181,7 @@ pt_entry_t pg_nx; SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); static int pg_ps_enabled = 1; -SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RD, &pg_ps_enabled, 0, +SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN, &pg_ps_enabled, 0, "Are large page mappings enabled?"); static u_int64_t KPTphys; /* phys addr of kernel level 1 */ Modified: stable/8/sys/i386/i386/pmap.c ============================================================================== --- stable/8/sys/i386/i386/pmap.c Tue Dec 8 15:16:48 2009 (r200259) +++ stable/8/sys/i386/i386/pmap.c Tue Dec 8 15:21:39 2009 (r200260) @@ -217,7 +217,7 @@ static int pat_works; /* Is page attri SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); static int pg_ps_enabled; -SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RD, &pg_ps_enabled, 0, +SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN, &pg_ps_enabled, 0, "Are large page mappings enabled?"); /* From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 8 15:27:06 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0CA41065695; Tue, 8 Dec 2009 15:27:06 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8562C8FC12; Tue, 8 Dec 2009 15:27:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB8FR6qd092008; Tue, 8 Dec 2009 15:27:06 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB8FR6Za092003; Tue, 8 Dec 2009 15:27:06 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200912081527.nB8FR6Za092003@svn.freebsd.org> From: Andriy Gapon Date: Tue, 8 Dec 2009 15:27:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200262 - in stable/8/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 15:27:06 -0000 Author: avg Date: Tue Dec 8 15:27:06 2009 New Revision: 200262 URL: http://svn.freebsd.org/changeset/base/200262 Log: MFC r199968: x86 cpu features: add MOVBE reporting and flag Modified: stable/8/sys/amd64/amd64/identcpu.c stable/8/sys/amd64/include/specialreg.h stable/8/sys/i386/i386/identcpu.c stable/8/sys/i386/include/specialreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/amd64/identcpu.c ============================================================================== --- stable/8/sys/amd64/amd64/identcpu.c Tue Dec 8 15:24:37 2009 (r200261) +++ stable/8/sys/amd64/amd64/identcpu.c Tue Dec 8 15:27:06 2009 (r200262) @@ -259,7 +259,7 @@ printcpuinfo(void) "\024SSE4.1" "\025SSE4.2" "\026x2APIC" /* xAPIC Extensions */ - "\027" + "\027MOVBE" "\030POPCNT" "\031" "\032" Modified: stable/8/sys/amd64/include/specialreg.h ============================================================================== --- stable/8/sys/amd64/include/specialreg.h Tue Dec 8 15:24:37 2009 (r200261) +++ stable/8/sys/amd64/include/specialreg.h Tue Dec 8 15:27:06 2009 (r200262) @@ -129,6 +129,7 @@ #define CPUID2_SSE41 0x00080000 #define CPUID2_SSE42 0x00100000 #define CPUID2_X2APIC 0x00200000 +#define CPUID2_MOVBE 0x00400000 #define CPUID2_POPCNT 0x00800000 /* Modified: stable/8/sys/i386/i386/identcpu.c ============================================================================== --- stable/8/sys/i386/i386/identcpu.c Tue Dec 8 15:24:37 2009 (r200261) +++ stable/8/sys/i386/i386/identcpu.c Tue Dec 8 15:27:06 2009 (r200262) @@ -746,7 +746,7 @@ printcpuinfo(void) "\024SSE4.1" "\025SSE4.2" "\026x2APIC" /* xAPIC Extensions */ - "\027" + "\027MOVBE" "\030POPCNT" "\031" "\032" Modified: stable/8/sys/i386/include/specialreg.h ============================================================================== --- stable/8/sys/i386/include/specialreg.h Tue Dec 8 15:24:37 2009 (r200261) +++ stable/8/sys/i386/include/specialreg.h Tue Dec 8 15:27:06 2009 (r200262) @@ -126,6 +126,7 @@ #define CPUID2_SSE41 0x00080000 #define CPUID2_SSE42 0x00100000 #define CPUID2_X2APIC 0x00200000 +#define CPUID2_MOVBE 0x00400000 #define CPUID2_POPCNT 0x00800000 /* From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 8 18:23:51 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79F0F106566B; Tue, 8 Dec 2009 18:23:51 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 67D398FC0A; Tue, 8 Dec 2009 18:23:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB8INpc1095768; Tue, 8 Dec 2009 18:23:51 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB8INppk095763; Tue, 8 Dec 2009 18:23:51 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200912081823.nB8INppk095763@svn.freebsd.org> From: Xin LI Date: Tue, 8 Dec 2009 18:23:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200265 - in stable/8: etc/defaults etc/rc.d share/man/man5 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 18:23:51 -0000 Author: delphij Date: Tue Dec 8 18:23:51 2009 New Revision: 200265 URL: http://svn.freebsd.org/changeset/base/200265 Log: MFC revisions 196550 and 196552: Add a new rc.d script, static_arp, which enables the administrator to statically bind IPv4 <-> MAC address at boot time. In order to use this, the administrator needs to configure the following rc.conf(5) variable: - static_arp_pairs: A list of names for static bind pairs, and, - a series of static_arp_(name): the arguments that is being passed to ``arp -S'' operation. Example: static_arp_pairs="gw" static_arp_gw="192.168.1.1 00:01:02:03:04:05" See the rc.conf(5) manual page for more details. Added: stable/8/etc/rc.d/static_arp - copied, changed from r196550, head/etc/rc.d/static_arp Modified: stable/8/etc/defaults/rc.conf stable/8/etc/rc.d/Makefile stable/8/share/man/man5/rc.conf.5 Directory Properties: stable/8/etc/ (props changed) stable/8/share/man/man5/ (props changed) Modified: stable/8/etc/defaults/rc.conf ============================================================================== --- stable/8/etc/defaults/rc.conf Tue Dec 8 17:54:23 2009 (r200264) +++ stable/8/etc/defaults/rc.conf Tue Dec 8 18:23:51 2009 (r200265) @@ -358,6 +358,7 @@ bsnmpd_flags="" # Flags for bsnmpd. ### Network routing options: ### defaultrouter="NO" # Set to default gateway (or NO). +static_arp_pairs="" # Set to static ARP list (or leave empty). static_routes="" # Set to static route list (or leave empty). natm_static_routes="" # Set to static route list for NATM (or leave empty). gateway_enable="NO" # Set to YES if this host will be a gateway. Modified: stable/8/etc/rc.d/Makefile ============================================================================== --- stable/8/etc/rc.d/Makefile Tue Dec 8 17:54:23 2009 (r200264) +++ stable/8/etc/rc.d/Makefile Tue Dec 8 18:23:51 2009 (r200265) @@ -32,7 +32,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKI random rarpd resolv rfcomm_pppd_server root \ route6d routed routing rpcbind rtadvd rwho \ savecore sdpd securelevel sendmail \ - serial sppp statd swap1 \ + serial sppp statd static_arp swap1 \ syscons sysctl syslogd \ timed tmp \ ugidfw \ Copied and modified: stable/8/etc/rc.d/static_arp (from r196550, head/etc/rc.d/static_arp) ============================================================================== --- head/etc/rc.d/static_arp Tue Aug 25 19:07:26 2009 (r196550, copy source) +++ stable/8/etc/rc.d/static_arp Tue Dec 8 18:23:51 2009 (r200265) @@ -41,10 +41,11 @@ stop_cmd="static_arp_stop" static_arp_start() { + local e arp_args + if [ -n "${static_arp_pairs}" ]; then echo -n 'Binding static ARP pair(s):' for e in ${static_arp_pairs}; do - local arp_args echo -n " ${e}" eval arp_args=\$static_arp_${e} arp -S ${arp_args} >/dev/null 2>&1 @@ -55,10 +56,11 @@ static_arp_start() static_arp_stop() { + local e arp_args + if [ -n "${static_arp_pairs}" ]; then echo -n 'Unbinding static ARP pair(s):' for e in ${static_arp_pairs}; do - local arp_args echo -n " ${e}" eval arp_args=\$static_arp_${e} arp -d ${arp_args%%[ ]*} > /dev/null 2>&1 Modified: stable/8/share/man/man5/rc.conf.5 ============================================================================== --- stable/8/share/man/man5/rc.conf.5 Tue Dec 8 17:54:23 2009 (r200264) +++ stable/8/share/man/man5/rc.conf.5 Tue Dec 8 18:23:51 2009 (r200265) @@ -2237,6 +2237,22 @@ name server!). .Pq Vt str The IPv6 equivalent of .Va defaultrouter . +.It Va static_arp_pairs +.Pq Vt str +Set to the list of static ARP pairs that are to be added at system +boot time. +For each whitespace separated +.Ar element +in the value, a +.Va static_arp_ Ns Aq Ar element +variable is assumed to exist whose contents will later be passed to a +.Dq Nm arp Cm -S +operation. +For example +.Bd -literal +static_arp_pairs="gw" +static_arp_gw="192.168.1.1 00:01:02:03:04:05" +.Ed .It Va static_routes .Pq Vt str Set to the list of static routes that are to be added at system From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 8 18:23:52 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDF9A1065672; Tue, 8 Dec 2009 18:23:52 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD1EA8FC12; Tue, 8 Dec 2009 18:23:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB8INq82095801; Tue, 8 Dec 2009 18:23:52 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB8INqrT095799; Tue, 8 Dec 2009 18:23:52 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <200912081823.nB8INqrT095799@svn.freebsd.org> From: Fabien Thomas Date: Tue, 8 Dec 2009 18:23:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200266 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 18:23:53 -0000 Author: fabient Date: Tue Dec 8 18:23:52 2009 New Revision: 200266 URL: http://svn.freebsd.org/changeset/base/200266 Log: MFC 198464: Inform hwpmc(4) of a thread's impending demise prior to invoking sched_throw(). Modified: stable/8/sys/kern/kern_thread.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/kern_thread.c ============================================================================== --- stable/8/sys/kern/kern_thread.c Tue Dec 8 18:23:51 2009 (r200265) +++ stable/8/sys/kern/kern_thread.c Tue Dec 8 18:23:52 2009 (r200266) @@ -27,6 +27,7 @@ */ #include "opt_witness.h" +#include "opt_hwpmc_hooks.h" #include __FBSDID("$FreeBSD$"); @@ -47,6 +48,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef HWPMC_HOOKS +#include +#endif #include @@ -417,6 +421,14 @@ thread_exit(void) panic ("thread_exit: Last thread exiting on its own"); } } +#ifdef HWPMC_HOOKS + /* + * If this thread is part of a process that is being tracked by hwpmc(4), + * inform the module of the thread's impending exit. + */ + if (PMC_PROC_IS_USING_PMCS(td->td_proc)) + PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT); +#endif PROC_UNLOCK(p); thread_lock(td); /* Save our tick information with both the thread and proc locked */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 8 22:28:56 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 047821065670; Tue, 8 Dec 2009 22:28:56 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A04078FC1A; Tue, 8 Dec 2009 22:28:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB8MStPa003142; Tue, 8 Dec 2009 22:28:55 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB8MSt6Y003138; Tue, 8 Dec 2009 22:28:55 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200912082228.nB8MSt6Y003138@svn.freebsd.org> From: Rick Macklem Date: Tue, 8 Dec 2009 22:28:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200277 - in stable/8/sys/fs: nfs nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 22:28:56 -0000 Author: rmacklem Date: Tue Dec 8 22:28:55 2009 New Revision: 200277 URL: http://svn.freebsd.org/changeset/base/200277 Log: MFC: r199616 Patch the experimental NFS server is a manner analagous to r197525, so that the creation verifier is handled correctly in va_atime for 64bit architectures. There were two problems. One was that the code incorrectly assumed that sizeof (struct timespec) == 8 and the other was that the tv_sec field needs to be assigned from a signed 32bit integer, so that sign extension occurs on 64bit architectures. This is required for correct operation when exporting ZFS volumes. Tested by: gerrit at pmp.uni-hannover.de Reviewed by: pjd Modified: stable/8/sys/fs/nfs/nfs_var.h stable/8/sys/fs/nfsserver/nfs_nfsdport.c stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/8/sys/fs/nfs/nfs_var.h Tue Dec 8 21:46:30 2009 (r200276) +++ stable/8/sys/fs/nfs/nfs_var.h Tue Dec 8 22:28:55 2009 (r200277) @@ -529,7 +529,7 @@ int nfsvno_read(vnode_t, off_t, int, str int nfsvno_write(vnode_t, off_t, int, int, int, mbuf_t, char *, struct ucred *, NFSPROC_T *); int nfsvno_createsub(struct nfsrv_descript *, struct nameidata *, - vnode_t *, struct nfsvattr *, int *, u_char *, NFSDEV_T, NFSPROC_T *, + vnode_t *, struct nfsvattr *, int *, int32_t *, NFSDEV_T, NFSPROC_T *, struct nfsexstuff *); int nfsvno_mknod(struct nameidata *, struct nfsvattr *, struct ucred *, NFSPROC_T *); @@ -552,7 +552,7 @@ int nfsvno_fsync(vnode_t, u_int64_t, int int nfsvno_statfs(vnode_t, struct statfs *); void nfsvno_getfs(struct nfsfsinfo *, int); void nfsvno_open(struct nfsrv_descript *, struct nameidata *, nfsquad_t, - nfsv4stateid_t *, struct nfsstate *, int *, struct nfsvattr *, u_char *, + nfsv4stateid_t *, struct nfsstate *, int *, struct nfsvattr *, int32_t *, int, NFSACL_T *, nfsattrbit_t *, struct ucred *, NFSPROC_T *, struct nfsexstuff *, vnode_t *); void nfsvno_updfilerev(vnode_t, struct nfsvattr *, struct ucred *, Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Tue Dec 8 21:46:30 2009 (r200276) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Tue Dec 8 22:28:55 2009 (r200277) @@ -720,7 +720,7 @@ nfsvno_write(struct vnode *vp, off_t off int nfsvno_createsub(struct nfsrv_descript *nd, struct nameidata *ndp, struct vnode **vpp, struct nfsvattr *nvap, int *exclusive_flagp, - u_char *cverf, NFSDEV_T rdev, struct thread *p, struct nfsexstuff *exp) + int32_t *cverf, NFSDEV_T rdev, struct thread *p, struct nfsexstuff *exp) { u_quad_t tempsize; int error; @@ -737,8 +737,8 @@ nfsvno_createsub(struct nfsrv_descript * if (*exclusive_flagp) { *exclusive_flagp = 0; NFSVNO_ATTRINIT(nvap); - NFSBCOPY(cverf,(caddr_t)&nvap->na_atime, - NFSX_VERF); + nvap->na_atime.tv_sec = cverf[0]; + nvap->na_atime.tv_nsec = cverf[1]; error = VOP_SETATTR(ndp->ni_vp, &nvap->na_vattr, nd->nd_cred); } @@ -1285,7 +1285,7 @@ nfsvno_statfs(struct vnode *vp, struct s void nfsvno_open(struct nfsrv_descript *nd, struct nameidata *ndp, nfsquad_t clientid, nfsv4stateid_t *stateidp, struct nfsstate *stp, - int *exclusive_flagp, struct nfsvattr *nvap, u_char *cverf, int create, + int *exclusive_flagp, struct nfsvattr *nvap, int32_t *cverf, int create, NFSACL_T *aclp, nfsattrbit_t *attrbitp, struct ucred *cred, struct thread *p, struct nfsexstuff *exp, struct vnode **vpp) { @@ -1307,9 +1307,8 @@ nfsvno_open(struct nfsrv_descript *nd, s if (*exclusive_flagp) { *exclusive_flagp = 0; NFSVNO_ATTRINIT(nvap); - NFSBCOPY(cverf, - (caddr_t)&nvap->na_atime, - NFSX_VERF); + nvap->na_atime.tv_sec = cverf[0]; + nvap->na_atime.tv_nsec = cverf[1]; nd->nd_repstat = VOP_SETATTR(ndp->ni_vp, &nvap->na_vattr, cred); } else { Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Tue Dec 8 21:46:30 2009 (r200276) +++ stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Tue Dec 8 22:28:55 2009 (r200277) @@ -865,11 +865,11 @@ nfsrvd_create(struct nfsrv_descript *nd, int how = NFSCREATE_UNCHECKED, exclusive_flag = 0; NFSDEV_T rdev = 0; vnode_t vp = NULL, dirp = NULL; - u_char cverf[NFSX_VERF], *cp; fhandle_t fh; char *bufp; u_long *hashp; enum vtype vtyp; + int32_t cverf[2], tverf[2] = { 0, 0 }; if (nd->nd_repstat) { nfsrv_wcc(nd, dirfor_ret, &dirfor, diraft_ret, &diraft); @@ -920,8 +920,9 @@ nfsrvd_create(struct nfsrv_descript *nd, goto nfsmout; break; case NFSCREATE_EXCLUSIVE: - NFSM_DISSECT(cp, u_char *, NFSX_VERF); - NFSBCOPY(cp, cverf, NFSX_VERF); + NFSM_DISSECT(tl, u_int32_t *, NFSX_VERF); + cverf[0] = *tl++; + cverf[1] = *tl; exclusive_flag = 1; break; }; @@ -988,6 +989,10 @@ nfsrvd_create(struct nfsrv_descript *nd, nd->nd_repstat = nfsvno_getattr(vp, &nva, nd->nd_cred, p); vput(vp); + if (!nd->nd_repstat) { + tverf[0] = nva.na_atime.tv_sec; + tverf[1] = nva.na_atime.tv_nsec; + } } if (nd->nd_flag & ND_NFSV2) { if (!nd->nd_repstat) { @@ -995,8 +1000,8 @@ nfsrvd_create(struct nfsrv_descript *nd, nfsrv_fillattr(nd, &nva); } } else { - if (exclusive_flag && !nd->nd_repstat && - NFSBCMP(cverf, (caddr_t)&nva.na_atime, NFSX_VERF)) + if (exclusive_flag && !nd->nd_repstat && (cverf[0] != tverf[0] + || cverf[1] != tverf[1])) nd->nd_repstat = EEXIST; diraft_ret = nfsvno_getattr(dirp, &diraft, nd->nd_cred, p); vrele(dirp); @@ -2406,7 +2411,7 @@ nfsrvd_open(struct nfsrv_descript *nd, _ int error = 0, create, claim, exclusive_flag = 0; u_int32_t rflags = NFSV4OPEN_LOCKTYPEPOSIX, acemask; int how = NFSCREATE_UNCHECKED; - u_char cverf[NFSX_VERF]; + int32_t cverf[2], tverf[2] = { 0, 0 }; vnode_t vp = NULL, dirp = NULL; struct nfsvattr nva, dirfor, diraft; struct nameidata named; @@ -2517,7 +2522,8 @@ nfsrvd_open(struct nfsrv_descript *nd, _ break; case NFSCREATE_EXCLUSIVE: NFSM_DISSECT(tl, u_int32_t *, NFSX_VERF); - NFSBCOPY((caddr_t)tl, cverf, NFSX_VERF); + cverf[0] = *tl++; + cverf[1] = *tl; break; default: nd->nd_repstat = NFSERR_BADXDR; @@ -2677,10 +2683,15 @@ nfsrvd_open(struct nfsrv_descript *nd, _ NFSACCCHK_VPISLOCKED); } - if (!nd->nd_repstat) + if (!nd->nd_repstat) { nd->nd_repstat = nfsvno_getattr(vp, &nva, nd->nd_cred, p); - if (!nd->nd_repstat && exclusive_flag && - NFSBCMP(cverf, (caddr_t)&nva.na_atime, NFSX_VERF)) + if (!nd->nd_repstat) { + tverf[0] = nva.na_atime.tv_sec; + tverf[1] = nva.na_atime.tv_nsec; + } + } + if (!nd->nd_repstat && exclusive_flag && (cverf[0] != tverf[0] || + cverf[1] != tverf[1])) nd->nd_repstat = EEXIST; /* * Do the open locking/delegation stuff. From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 8 22:41:38 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33EAA1065670; Tue, 8 Dec 2009 22:41:38 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2108E8FC13; Tue, 8 Dec 2009 22:41:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB8Mfc1D003589; Tue, 8 Dec 2009 22:41:38 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB8Mfc9a003587; Tue, 8 Dec 2009 22:41:38 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200912082241.nB8Mfc9a003587@svn.freebsd.org> From: Rick Macklem Date: Tue, 8 Dec 2009 22:41:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200281 - stable/8/sys/fs/nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 22:41:38 -0000 Author: rmacklem Date: Tue Dec 8 22:41:37 2009 New Revision: 200281 URL: http://svn.freebsd.org/changeset/base/200281 Log: MFC: r199715 Modify the experimental nfs server so that it falls back to using VOP_LOOKUP() when VFS_VGET() returns EOPNOTSUPP in the ReaddirPlus RPC. This patch is based upon one by pjd@ for the regular nfs server which has not yet been committed. It is needed when a ZFS volume is exported and ReaddirPlus (which almost always happens for NFSv4) is performed by a client. The patch also simplifies vnode lock handling somewhat. Tested by: gerrit at pmp.uni-hannover.de Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Tue Dec 8 22:38:42 2009 (r200280) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Tue Dec 8 22:41:37 2009 (r200281) @@ -1675,7 +1675,7 @@ nfsrvd_readdirplus(struct nfsrv_descript struct nfsvattr nva, at, *nvap = &nva; struct mbuf *mb0, *mb1; struct nfsreferral *refp; - int nlen, r, error = 0, getret = 1, vgetret; + int nlen, r, error = 0, getret = 1, usevget = 1; int siz, cnt, fullsiz, eofflag, ncookies, entrycnt; caddr_t bpos0, bpos1; u_int64_t off, toff, verf; @@ -1683,6 +1683,7 @@ nfsrvd_readdirplus(struct nfsrv_descript nfsattrbit_t attrbits, rderrbits, savbits; struct uio io; struct iovec iv; + struct componentname cn; if (nd->nd_repstat) { nfsrv_postopattr(nd, getret, &at); @@ -1761,8 +1762,6 @@ nfsrvd_readdirplus(struct nfsrv_descript return (0); } - NFSVOPUNLOCK(vp, 0, p); - MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); again: eofflag = 0; @@ -1780,10 +1779,8 @@ again: io.uio_segflg = UIO_SYSSPACE; io.uio_rw = UIO_READ; io.uio_td = NULL; - NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY, p); nd->nd_repstat = VOP_READDIR(vp, &io, nd->nd_cred, &eofflag, &ncookies, &cookies); - NFSVOPUNLOCK(vp, 0, p); off = (u_int64_t)io.uio_offset; if (io.uio_resid) siz -= io.uio_resid; @@ -1795,7 +1792,7 @@ again: if (!nd->nd_repstat) nd->nd_repstat = getret; if (nd->nd_repstat) { - vrele(vp); + vput(vp); if (cookies) free((caddr_t)cookies, M_TEMP); free((caddr_t)rbuf, M_TEMP); @@ -1808,7 +1805,7 @@ again: * rpc reply */ if (siz == 0) { - vrele(vp); + vput(vp); if (nd->nd_flag & ND_NFSV3) nfsrv_postopattr(nd, getret, &at); NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED); @@ -1853,33 +1850,7 @@ again: toff = off; goto again; } - - /* - * Probe one of the directory entries to see if the filesystem - * supports VGET for NFSv3. For NFSv4, it will return an - * error later, if attributes are required. - * (To be honest, most if not all NFSv4 clients will require - * attributes, but??) - */ - if ((nd->nd_flag & ND_NFSV3)) { - vgetret = VFS_VGET(vp->v_mount, dp->d_fileno, LK_EXCLUSIVE, - &nvp); - if (vgetret != 0) { - if (vgetret == EOPNOTSUPP) - nd->nd_repstat = NFSERR_NOTSUPP; - else - nd->nd_repstat = NFSERR_SERVERFAULT; - vrele(vp); - if (cookies) - free((caddr_t)cookies, M_TEMP); - free((caddr_t)rbuf, M_TEMP); - nfsrv_postopattr(nd, getret, &at); - return (0); - } - if (!vgetret) - vput(nvp); - nvp = NULL; - } + NFSVOPUNLOCK(vp, 0, p); /* * Save this position, in case there is an error before one entry @@ -1937,9 +1908,41 @@ again: if (nd->nd_flag & ND_NFSV4) refp = nfsv4root_getreferral(NULL, vp, dp->d_fileno); - if (refp == NULL) - r = VFS_VGET(vp->v_mount, dp->d_fileno, - LK_EXCLUSIVE, &nvp); + if (refp == NULL) { + if (usevget) + r = VFS_VGET(vp->v_mount, + dp->d_fileno, LK_EXCLUSIVE, + &nvp); + else + r = EOPNOTSUPP; + if (r == EOPNOTSUPP) { + if (usevget) { + usevget = 0; + cn.cn_nameiop = LOOKUP; + cn.cn_lkflags = + LK_EXCLUSIVE | + LK_RETRY; + cn.cn_cred = + nd->nd_cred; + cn.cn_thread = p; + } + cn.cn_nameptr = dp->d_name; + cn.cn_namelen = nlen; + cn.cn_flags = ISLASTCN | + NOFOLLOW | LOCKLEAF | + MPSAFE; + if (nlen == 2 && + dp->d_name[0] == '.' && + dp->d_name[1] == '.') + cn.cn_flags |= + ISDOTDOT; + if (!VOP_ISLOCKED(vp)) + vn_lock(vp, + LK_EXCLUSIVE | + LK_RETRY); + r = VOP_LOOKUP(vp, &nvp, &cn); + } + } if (!r) { if (refp == NULL && ((nd->nd_flag & ND_NFSV3) || @@ -2018,7 +2021,10 @@ again: cookiep++; ncookies--; } - vrele(vp); + if (!usevget && VOP_ISLOCKED(vp)) + vput(vp); + else + vrele(vp); /* * If dirlen > cnt, we must strip off the last entry. If that From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 8 23:15:48 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA71B106566C; Tue, 8 Dec 2009 23:15:48 +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 D31818FC14; Tue, 8 Dec 2009 23:15:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB8NFmrA004526; Tue, 8 Dec 2009 23:15:48 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB8NFmmZ004522; Tue, 8 Dec 2009 23:15:48 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912082315.nB8NFmmZ004522@svn.freebsd.org> From: Alexander Motin Date: Tue, 8 Dec 2009 23:15:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200284 - in stable/8: . contrib/top lib/libusb sbin/geom/class/mirror sys/geom/mirror tools/regression/lib/msun tools/regression/usr.bin/pkill tools/tools/ath/common tools/tools/termca... X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 23:15:49 -0000 Author: mav Date: Tue Dec 8 23:15:48 2009 New Revision: 200284 URL: http://svn.freebsd.org/changeset/base/200284 Log: MFC r196879: Add support for changing providers priority. Modified: stable/8/sbin/geom/class/mirror/geom_mirror.c stable/8/sbin/geom/class/mirror/gmirror.8 stable/8/sys/geom/mirror/g_mirror_ctl.c Directory Properties: stable/8/ (props changed) stable/8/ObsoleteFiles.inc (props changed) stable/8/UPDATING (props changed) stable/8/bin/csh/ (props changed) stable/8/bin/ps/ (props changed) stable/8/bin/sh/ (props changed) stable/8/cddl/compat/opensolaris/ (props changed) stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/lib/libnvpair/ (props changed) stable/8/contrib/bind9/ (props changed) stable/8/contrib/bzip2/ (props changed) stable/8/contrib/cpio/ (props changed) stable/8/contrib/csup/ (props changed) stable/8/contrib/ee/ (props changed) stable/8/contrib/file/ (props changed) stable/8/contrib/gdb/ (props changed) stable/8/contrib/gdtoa/ (props changed) stable/8/contrib/less/ (props changed) stable/8/contrib/libpcap/ (props changed) stable/8/contrib/ncurses/ (props changed) stable/8/contrib/netcat/ (props changed) stable/8/contrib/ntp/ (props changed) stable/8/contrib/openbsm/ (props changed) stable/8/contrib/openpam/ (props changed) stable/8/contrib/pf/ (props changed) stable/8/contrib/sendmail/ (props changed) stable/8/contrib/tcpdump/ (props changed) stable/8/contrib/tcsh/ (props changed) stable/8/contrib/top/ (props changed) stable/8/contrib/top/install-sh (props changed) stable/8/contrib/traceroute/ (props changed) stable/8/contrib/wpa/ (props changed) stable/8/crypto/openssh/ (props changed) stable/8/crypto/openssl/ (props changed) stable/8/etc/ (props changed) stable/8/games/fortune/ (props changed) stable/8/games/fortune/datfiles/ (props changed) stable/8/gnu/usr.bin/groff/ (props changed) stable/8/gnu/usr.bin/patch/ (props changed) stable/8/include/ (props changed) stable/8/kerberos5/lib/libgssapi_krb5/ (props changed) stable/8/kerberos5/lib/libgssapi_spnego/ (props changed) stable/8/lib/libarchive/ (props changed) stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libdevinfo/ (props changed) stable/8/lib/libdisk/ (props changed) stable/8/lib/libfetch/ (props changed) stable/8/lib/libkvm/ (props changed) stable/8/lib/libpmc/ (props changed) stable/8/lib/libradius/ (props changed) stable/8/lib/libstand/ (props changed) stable/8/lib/libthr/ (props changed) stable/8/lib/libusb/ (props changed) stable/8/lib/libusb/usb.h (props changed) stable/8/lib/libutil/ (props changed) stable/8/libexec/rtld-elf/ (props changed) stable/8/release/ (props changed) stable/8/release/doc/ (props changed) stable/8/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/8/sbin/ (props changed) stable/8/sbin/atacontrol/ (props changed) stable/8/sbin/bsdlabel/ (props changed) stable/8/sbin/camcontrol/ (props changed) stable/8/sbin/ddb/ (props changed) stable/8/sbin/dhclient/ (props changed) stable/8/sbin/fsck/ (props changed) stable/8/sbin/geom/ (props changed) stable/8/sbin/ifconfig/ (props changed) stable/8/sbin/ipfw/ (props changed) stable/8/sbin/mksnap_ffs/ (props changed) stable/8/sbin/mount/ (props changed) stable/8/sbin/mount_cd9660/ (props changed) stable/8/sbin/mount_nfs/ (props changed) stable/8/sbin/umount/ (props changed) stable/8/secure/usr.bin/bdes/ (props changed) stable/8/share/man/man3/ (props changed) stable/8/share/man/man4/ (props changed) stable/8/share/man/man5/ (props changed) stable/8/share/man/man7/ (props changed) stable/8/share/man/man9/ (props changed) stable/8/share/misc/ (props changed) stable/8/share/timedef/ (props changed) stable/8/share/zoneinfo/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/tools/kerneldoc/subsys/ (props changed) stable/8/tools/regression/bin/sh/ (props changed) stable/8/tools/regression/lib/libc/ (props changed) stable/8/tools/regression/lib/msun/test-conj.t (props changed) stable/8/tools/regression/poll/ (props changed) stable/8/tools/regression/priv/ (props changed) stable/8/tools/regression/usr.bin/pkill/pgrep-_g.t (props changed) stable/8/tools/regression/usr.bin/pkill/pgrep-_s.t (props changed) stable/8/tools/regression/usr.bin/pkill/pkill-_g.t (props changed) stable/8/tools/tools/ath/common/dumpregs.h (props changed) stable/8/tools/tools/ath/common/dumpregs_5210.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5211.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5212.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5416.c (props changed) stable/8/tools/tools/termcap/termcap.pl (props changed) stable/8/tools/tools/vimage/ (props changed) stable/8/usr.bin/calendar/calendars/calendar.freebsd (props changed) stable/8/usr.bin/csup/ (props changed) stable/8/usr.bin/find/ (props changed) stable/8/usr.bin/fstat/ (props changed) stable/8/usr.bin/gcore/ (props changed) stable/8/usr.bin/gzip/ (props changed) stable/8/usr.bin/kdump/ (props changed) stable/8/usr.bin/locale/ (props changed) stable/8/usr.bin/look/ (props changed) stable/8/usr.bin/netstat/ (props changed) stable/8/usr.bin/perror/ (props changed) stable/8/usr.bin/procstat/ (props changed) stable/8/usr.bin/systat/ (props changed) stable/8/usr.bin/vmstat/ (props changed) stable/8/usr.bin/w/ (props changed) stable/8/usr.bin/whois/ (props changed) stable/8/usr.sbin/ (props changed) stable/8/usr.sbin/acpi/ (props changed) stable/8/usr.sbin/arp/ (props changed) stable/8/usr.sbin/cdcontrol/ (props changed) stable/8/usr.sbin/crashinfo/ (props changed) stable/8/usr.sbin/dumpcis/cardinfo.h (props changed) stable/8/usr.sbin/dumpcis/cis.h (props changed) stable/8/usr.sbin/freebsd-update/ (props changed) stable/8/usr.sbin/iostat/ (props changed) stable/8/usr.sbin/jail/ (props changed) stable/8/usr.sbin/jls/ (props changed) stable/8/usr.sbin/lpr/ (props changed) stable/8/usr.sbin/makefs/ffs/ffs_bswap.c (props changed) stable/8/usr.sbin/makefs/ffs/ffs_subr.c (props changed) stable/8/usr.sbin/makefs/ffs/ufs_bswap.h (props changed) stable/8/usr.sbin/makefs/getid.c (props changed) stable/8/usr.sbin/mfiutil/mfiutil.8 (props changed) stable/8/usr.sbin/ndp/ (props changed) stable/8/usr.sbin/ntp/ (props changed) stable/8/usr.sbin/ppp/ (props changed) stable/8/usr.sbin/pstat/ (props changed) stable/8/usr.sbin/sysinstall/ (props changed) stable/8/usr.sbin/traceroute6/ (props changed) stable/8/usr.sbin/usbconfig/ (props changed) stable/8/usr.sbin/wpa/ (props changed) stable/8/usr.sbin/zic/ (props changed) Modified: stable/8/sbin/geom/class/mirror/geom_mirror.c ============================================================================== --- stable/8/sbin/geom/class/mirror/geom_mirror.c Tue Dec 8 22:49:03 2009 (r200283) +++ stable/8/sbin/geom/class/mirror/geom_mirror.c Tue Dec 8 23:15:48 2009 (r200284) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2005 Pawel Jakub Dawidek + * Copyright (c) 2004-2009 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,13 +41,12 @@ __FBSDID("$FreeBSD$"); #include #include - uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_MIRROR_VERSION; static char label_balance[] = "split", configure_balance[] = "none"; static intmax_t label_slice = 4096, configure_slice = -1; -static intmax_t insert_priority = 0; +static intmax_t insert_priority = 0, configure_priority = -1; static void mirror_main(struct gctl_req *req, unsigned flags); static void mirror_activate(struct gctl_req *req); @@ -71,10 +70,12 @@ struct g_command class_commands[] = { { 'F', "nofailsync", NULL, G_TYPE_BOOL }, { 'h', "hardcode", NULL, G_TYPE_BOOL }, { 'n', "noautosync", NULL, G_TYPE_BOOL }, + { 'p', "priority", &configure_priority, G_TYPE_NUMBER }, { 's', "slice", &configure_slice, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-adfFhnv] [-b balance] [-s slice] name" + NULL, "[-adfFhnv] [-b balance] [-s slice] name\n" + "[-v] -p priority name prov" }, { "deactivate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL, "[-v] name prov ..." Modified: stable/8/sbin/geom/class/mirror/gmirror.8 ============================================================================== --- stable/8/sbin/geom/class/mirror/gmirror.8 Tue Dec 8 22:49:03 2009 (r200283) +++ stable/8/sbin/geom/class/mirror/gmirror.8 Tue Dec 8 23:15:48 2009 (r200284) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2004-2005 Pawel Jakub Dawidek +.\" Copyright (c) 2004-2009 Pawel Jakub Dawidek .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2006 +.Dd August 1, 2009 .Dt GMIRROR 8 .Os .Sh NAME @@ -49,6 +49,12 @@ .Op Fl s Ar slice .Ar name .Nm +.Cm configure +.Op Fl v +.Fl p Ar priority +.Ar name +.Ar prov +.Nm .Cm rebuild .Op Fl v .Ar name @@ -115,8 +121,8 @@ indicates an action to be performed: .It Cm label Create a mirror. The order of components is important, because a component's priority is based on its position -(starting from 0). -The component with the biggest priority is used by the +(starting from 0 to 255). +The component with the biggest priority (the lowest number) is used by the .Cm prefer balance algorithm and is also used as a master component when resynchronization is needed, @@ -159,7 +165,7 @@ Clear metadata on the given providers. Configure the given device. .Pp Additional options include: -.Bl -tag -width ".Fl b Ar balance" +.Bl -tag -width ".Fl p Ar priority" .It Fl a Turn on autosynchronization of stale components. .It Fl b Ar balance @@ -175,6 +181,9 @@ Assumes device is in consistent state. Hardcode providers' names in metadata. .It Fl n Turn off autosynchronization of stale components. +.It Fl p Ar priority +Specifies priority for the given component +.Ar prov . .It Fl s Ar slice Specifies slice size for .Cm split Modified: stable/8/sys/geom/mirror/g_mirror_ctl.c ============================================================================== --- stable/8/sys/geom/mirror/g_mirror_ctl.c Tue Dec 8 22:49:03 2009 (r200283) +++ stable/8/sys/geom/mirror/g_mirror_ctl.c Tue Dec 8 23:15:48 2009 (r200284) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2006 Pawel Jakub Dawidek + * Copyright (c) 2004-2009 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,19 +93,19 @@ g_mirror_ctl_configure(struct gctl_req * { struct g_mirror_softc *sc; struct g_mirror_disk *disk; - const char *name, *balancep; - intmax_t *slicep; + const char *name, *balancep, *prov; + intmax_t *slicep, *priority; uint32_t slice; uint8_t balance; int *autosync, *noautosync, *failsync, *nofailsync, *hardcode, *dynamic; - int *nargs, do_sync = 0, dirty = 1; + int *nargs, do_sync = 0, dirty = 1, do_priority = 0; nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs)); if (nargs == NULL) { gctl_error(req, "No '%s' argument.", "nargs"); return; } - if (*nargs != 1) { + if (*nargs != 1 && *nargs != 2) { gctl_error(req, "Invalid number of arguments."); return; } @@ -149,6 +149,29 @@ g_mirror_ctl_configure(struct gctl_req * gctl_error(req, "No '%s' argument.", "dynamic"); return; } + priority = gctl_get_paraml(req, "priority", sizeof(*priority)); + if (priority == NULL) { + gctl_error(req, "No '%s' argument.", "priority"); + return; + } + if (*priority < -1 || *priority > 255) { + gctl_error(req, "Priority range is 0 to 255, %jd given", + *priority); + return; + } + /* + * Since we have a priority, we also need a provider now. + * Note: be WARNS safe, by always assigning prov and only throw an + * error if *priority != -1. + */ + prov = gctl_get_asciiparam(req, "arg1"); + if (*priority > -1) { + if (prov == NULL) { + gctl_error(req, "Priority needs a disk name"); + return; + } + do_priority = 1; + } if (*autosync && *noautosync) { gctl_error(req, "'%s' and '%s' specified.", "autosync", "noautosync"); @@ -189,19 +212,32 @@ g_mirror_ctl_configure(struct gctl_req * slice = sc->sc_slice; else slice = *slicep; - if (g_mirror_ndisks(sc, -1) < sc->sc_ndisks) { + /* Enforce usage() of -p not allowing any other options. */ + if (do_priority && (*autosync || *noautosync || *failsync || + *nofailsync || *hardcode || *dynamic || *slicep != -1 || + strcmp(balancep, "none") != 0)) { sx_xunlock(&sc->sc_lock); - gctl_error(req, "Not all disks connected. Try 'forget' command " - "first."); + gctl_error(req, "only -p accepted when setting priority"); return; } if (sc->sc_balance == balance && sc->sc_slice == slice && !*autosync && !*noautosync && !*failsync && !*nofailsync && !*hardcode && - !*dynamic) { + !*dynamic && !do_priority) { sx_xunlock(&sc->sc_lock); gctl_error(req, "Nothing has changed."); return; } + if ((!do_priority && *nargs != 1) || (do_priority && *nargs != 2)) { + sx_xunlock(&sc->sc_lock); + gctl_error(req, "Invalid number of arguments."); + return; + } + if (g_mirror_ndisks(sc, -1) < sc->sc_ndisks) { + sx_xunlock(&sc->sc_lock); + gctl_error(req, "Not all disks connected. Try 'forget' command " + "first."); + return; + } sc->sc_balance = balance; sc->sc_slice = slice; if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_NOAUTOSYNC) != 0) { @@ -223,6 +259,23 @@ g_mirror_ctl_configure(struct gctl_req * } } LIST_FOREACH(disk, &sc->sc_disks, d_next) { + /* + * Handle priority first, since we only need one disk, do one + * operation on it and then we're done. No need to check other + * flags, as usage doesn't allow it. + */ + if (do_priority) { + if (strcmp(disk->d_name, prov) == 0) { + if (disk->d_priority == *priority) + gctl_error(req, "Nothing has changed."); + else { + disk->d_priority = *priority; + g_mirror_update_metadata(disk); + } + break; + } + continue; + } if (do_sync) { if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING) disk->d_flags &= ~G_MIRROR_DISK_FLAG_FORCE_SYNC; From owner-svn-src-stable-8@FreeBSD.ORG Tue Dec 8 23:23:46 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35DCC106566B; Tue, 8 Dec 2009 23:23:46 +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 233848FC13; Tue, 8 Dec 2009 23:23:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB8NNk1A004827; Tue, 8 Dec 2009 23:23:46 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB8NNkgn004824; Tue, 8 Dec 2009 23:23:46 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912082323.nB8NNkgn004824@svn.freebsd.org> From: Alexander Motin Date: Tue, 8 Dec 2009 23:23:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200285 - stable/8/sys/geom/mirror X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 23:23:46 -0000 Author: mav Date: Tue Dec 8 23:23:45 2009 New Revision: 200285 URL: http://svn.freebsd.org/changeset/base/200285 Log: MFC r200086: Change 'load' balancing mode algorithm: - Instead of measuring last request execution time for each drive and choosing one with smallest time, use averaged number of requests, running on each drive. This information is more accurate and timely. It allows to distribute load between drives in more even and predictable way. - For each drive track offset of the last submitted request. If new request offset matches previous one or close for some drive, prefer that drive. It allows to significantly speedup simultaneous sequential reads. PR: kern/113885 Modified: stable/8/sys/geom/mirror/g_mirror.c stable/8/sys/geom/mirror/g_mirror.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/8/sys/geom/mirror/g_mirror.c Tue Dec 8 23:15:48 2009 (r200284) +++ stable/8/sys/geom/mirror/g_mirror.c Tue Dec 8 23:23:45 2009 (r200285) @@ -451,9 +451,6 @@ g_mirror_init_disk(struct g_mirror_softc disk->d_id = md->md_did; disk->d_state = G_MIRROR_DISK_STATE_NONE; disk->d_priority = md->md_priority; - disk->d_delay.sec = 0; - disk->d_delay.frac = 0; - binuptime(&disk->d_last_used); disk->d_flags = md->md_dflags; if (md->md_provider[0] != '\0') disk->d_flags |= G_MIRROR_DISK_FLAG_HARDCODED; @@ -863,16 +860,6 @@ bintime_cmp(struct bintime *bt1, struct } static void -g_mirror_update_delay(struct g_mirror_disk *disk, struct bio *bp) -{ - - if (disk->d_softc->sc_balance != G_MIRROR_BALANCE_LOAD) - return; - binuptime(&disk->d_delay); - bintime_sub(&disk->d_delay, &bp->bio_t0); -} - -static void g_mirror_done(struct bio *bp) { struct g_mirror_softc *sc; @@ -904,8 +891,6 @@ g_mirror_regular_request(struct bio *bp) g_topology_lock(); g_mirror_kill_consumer(sc, bp->bio_from); g_topology_unlock(); - } else { - g_mirror_update_delay(disk, bp); } pbp->bio_inbed++; @@ -1465,30 +1450,35 @@ g_mirror_request_round_robin(struct g_mi g_io_request(cbp, cp); } +#define TRACK_SIZE (1 * 1024 * 1024) +#define LOAD_SCALE 256 +#define ABS(x) (((x) >= 0) ? (x) : (-(x))) + static void g_mirror_request_load(struct g_mirror_softc *sc, struct bio *bp) { struct g_mirror_disk *disk, *dp; struct g_consumer *cp; struct bio *cbp; - struct bintime curtime; + int prio, best; - binuptime(&curtime); - /* - * Find a disk which the smallest load. - */ + /* Find a disk with the smallest load. */ disk = NULL; + best = INT_MAX; LIST_FOREACH(dp, &sc->sc_disks, d_next) { if (dp->d_state != G_MIRROR_DISK_STATE_ACTIVE) continue; - /* If disk wasn't used for more than 2 sec, use it. */ - if (curtime.sec - dp->d_last_used.sec >= 2) { - disk = dp; - break; - } - if (disk == NULL || - bintime_cmp(&dp->d_delay, &disk->d_delay) < 0) { + prio = dp->load; + /* If disk head is precisely in position - highly prefer it. */ + if (dp->d_last_offset == bp->bio_offset) + prio -= 2 * LOAD_SCALE; + else + /* If disk head is close to position - prefer it. */ + if (ABS(dp->d_last_offset - bp->bio_offset) < TRACK_SIZE) + prio -= 1 * LOAD_SCALE; + if (prio <= best) { disk = dp; + best = prio; } } KASSERT(disk != NULL, ("NULL disk for %s.", sc->sc_name)); @@ -1505,12 +1495,18 @@ g_mirror_request_load(struct g_mirror_so cp = disk->d_consumer; cbp->bio_done = g_mirror_done; cbp->bio_to = cp->provider; - binuptime(&disk->d_last_used); G_MIRROR_LOGREQ(3, cbp, "Sending request."); KASSERT(cp->acr >= 1 && cp->acw >= 1 && cp->ace >= 1, ("Consumer %s not opened (r%dw%de%d).", cp->provider->name, cp->acr, cp->acw, cp->ace)); cp->index++; + /* Remember last head position */ + disk->d_last_offset = bp->bio_offset + bp->bio_length; + /* Update loads. */ + LIST_FOREACH(dp, &sc->sc_disks, d_next) { + dp->load = (dp->d_consumer->index * LOAD_SCALE + + dp->load * 7) / 8; + } g_io_request(cbp, cp); } Modified: stable/8/sys/geom/mirror/g_mirror.h ============================================================================== --- stable/8/sys/geom/mirror/g_mirror.h Tue Dec 8 23:15:48 2009 (r200284) +++ stable/8/sys/geom/mirror/g_mirror.h Tue Dec 8 23:23:45 2009 (r200285) @@ -133,8 +133,8 @@ struct g_mirror_disk { struct g_mirror_softc *d_softc; /* Back-pointer to softc. */ int d_state; /* Disk state. */ u_int d_priority; /* Disk priority. */ - struct bintime d_delay; /* Disk delay. */ - struct bintime d_last_used; /* When disk was last used. */ + u_int load; /* Averaged queue length */ + off_t d_last_offset; /* Last read offset */ uint64_t d_flags; /* Additional flags. */ u_int d_genid; /* Disk's generation ID. */ struct g_mirror_disk_sync d_sync;/* Sync information. */ From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 13:27:06 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6E431065670; Wed, 9 Dec 2009 13:27:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A55098FC15; Wed, 9 Dec 2009 13:27:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9DR6wr026438; Wed, 9 Dec 2009 13:27:06 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9DR6TF026436; Wed, 9 Dec 2009 13:27:06 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912091327.nB9DR6TF026436@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Dec 2009 13:27:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200292 - stable/8/sys/dev/ahci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 13:27:06 -0000 Author: mav Date: Wed Dec 9 13:27:06 2009 New Revision: 200292 URL: http://svn.freebsd.org/changeset/base/200292 Log: MFC r200196: Add Asynchronous Notification support for controllers without SNTF capability by snooping SDB FIS receive area. It should be even faster then regular way, but less reliable. Modified: stable/8/sys/dev/ahci/ahci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Wed Dec 9 13:10:10 2009 (r200291) +++ stable/8/sys/dev/ahci/ahci.c Wed Dec 9 13:27:06 2009 (r200292) @@ -1129,7 +1129,8 @@ ahci_notify_events(device_t dev, u_int32 struct cam_path *dpath; int i; - ATA_OUTL(ch->r_mem, AHCI_P_SNTF, status); + if (ch->caps & AHCI_CAP_SSNTF) + ATA_OUTL(ch->r_mem, AHCI_P_SNTF, status); if (bootverbose) device_printf(dev, "SNTF 0x%04x\n", status); for (i = 0; i < 16; i++) { @@ -1188,8 +1189,16 @@ ahci_ch_intr(void *data) /* Read command statuses. */ sstatus = ATA_INL(ch->r_mem, AHCI_P_SACT); cstatus = ATA_INL(ch->r_mem, AHCI_P_CI); - if ((istatus & AHCI_P_IX_SDB) && (ch->caps & AHCI_CAP_SSNTF)) - sntf = ATA_INL(ch->r_mem, AHCI_P_SNTF); + if (istatus & AHCI_P_IX_SDB) { + if (ch->caps & AHCI_CAP_SSNTF) + sntf = ATA_INL(ch->r_mem, AHCI_P_SNTF); + else { + u_int8_t *fis = ch->dma.rfis + 0x58; + + if (fis[1] & 0x80) + sntf = (1 << (fis[1] & 0x0f)); + } + } /* Process PHY events */ if (istatus & (AHCI_P_IX_PC | AHCI_P_IX_PRC | AHCI_P_IX_OF | AHCI_P_IX_IF | AHCI_P_IX_HBD | AHCI_P_IX_HBF | AHCI_P_IX_TFE)) { From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 13:30:12 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B509106566C; Wed, 9 Dec 2009 13:30:12 +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 19CED8FC0A; Wed, 9 Dec 2009 13:30:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9DUBw4026559; Wed, 9 Dec 2009 13:30:11 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9DUB6d026556; Wed, 9 Dec 2009 13:30:11 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912091330.nB9DUB6d026556@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Dec 2009 13:30:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200293 - stable/8/sys/dev/siis X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 13:30:12 -0000 Author: mav Date: Wed Dec 9 13:30:11 2009 New Revision: 200293 URL: http://svn.freebsd.org/changeset/base/200293 Log: MFC r200217: SiI3124 has no SNotification register. Handle Asynchronous Notifications there without it as good as possible. Modified: stable/8/sys/dev/siis/siis.c stable/8/sys/dev/siis/siis.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Wed Dec 9 13:27:06 2009 (r200292) +++ stable/8/sys/dev/siis/siis.c Wed Dec 9 13:30:11 2009 (r200293) @@ -93,15 +93,17 @@ static struct { uint32_t id; const char *name; int ports; + int quirks; +#define SIIS_Q_SNTF 1 } siis_ids[] = { - {0x31241095, "SiI3124", 4}, - {0x31248086, "SiI3124", 4}, - {0x31321095, "SiI3132", 2}, - {0x02421095, "SiI3132", 2}, - {0x02441095, "SiI3132", 2}, - {0x31311095, "SiI3131", 1}, - {0x35311095, "SiI3531", 1}, - {0, NULL, 0} + {0x31241095, "SiI3124", 4, 0}, + {0x31248086, "SiI3124", 4, 0}, + {0x31321095, "SiI3132", 2, SIIS_Q_SNTF}, + {0x02421095, "SiI3132", 2, SIIS_Q_SNTF}, + {0x02441095, "SiI3132", 2, SIIS_Q_SNTF}, + {0x31311095, "SiI3131", 1, SIIS_Q_SNTF}, + {0x35311095, "SiI3531", 1, SIIS_Q_SNTF}, + {0, NULL, 0, 0} }; static int @@ -113,7 +115,7 @@ siis_probe(device_t dev) for (i = 0; siis_ids[i].id != 0; i++) { if (siis_ids[i].id == devid) { - snprintf(buf, sizeof(buf), "%s SATA2 controller", + snprintf(buf, sizeof(buf), "%s SATA controller", siis_ids[i].name); device_set_desc_copy(dev, buf); return (BUS_PROBE_VENDOR); @@ -130,11 +132,12 @@ siis_attach(device_t dev) device_t child; int error, i, unit; + ctlr->dev = dev; for (i = 0; siis_ids[i].id != 0; i++) { if (siis_ids[i].id == devid) break; } - ctlr->dev = dev; + ctlr->quirks = siis_ids[i].quirks; /* Global memory */ ctlr->r_grid = PCIR_BAR(0); if (!(ctlr->r_gmem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, @@ -413,12 +416,14 @@ siis_ch_probe(device_t dev) static int siis_ch_attach(device_t dev) { + struct siis_controller *ctlr = device_get_softc(device_get_parent(dev)); struct siis_channel *ch = device_get_softc(dev); struct cam_devq *devq; int rid, error, i, sata_rev = 0; ch->dev = dev; ch->unit = (intptr_t)device_get_ivars(dev); + ch->quirks = ctlr->quirks; resource_int_value(device_get_name(dev), device_get_unit(dev), "pm_level", &ch->pm_level); resource_int_value(device_get_name(dev), @@ -680,8 +685,16 @@ siis_notify_events(device_t dev) u_int32_t status; int i; - status = ATA_INL(ch->r_mem, SIIS_P_SNTF); - ATA_OUTL(ch->r_mem, SIIS_P_SNTF, status); + if (ch->quirks & SIIS_Q_SNTF) { + status = ATA_INL(ch->r_mem, SIIS_P_SNTF); + ATA_OUTL(ch->r_mem, SIIS_P_SNTF, status); + } else { + /* + * Without SNTF we have no idea which device sent notification. + * If PMP is connected, assume it, else - device. + */ + status = (ch->pm_present) ? 0x8000 : 0x0001; + } if (bootverbose) device_printf(dev, "SNTF 0x%04x\n", status); for (i = 0; i < 16; i++) { Modified: stable/8/sys/dev/siis/siis.h ============================================================================== --- stable/8/sys/dev/siis/siis.h Wed Dec 9 13:27:06 2009 (r200292) +++ stable/8/sys/dev/siis/siis.h Wed Dec 9 13:30:11 2009 (r200293) @@ -363,6 +363,7 @@ struct siis_channel { struct ata_dma dma; /* DMA data */ struct cam_sim *sim; struct cam_path *path; + int quirks; int pm_level; /* power management level */ struct siis_slot slot[SIIS_MAX_SLOTS]; @@ -400,6 +401,7 @@ struct siis_controller { void *handle; int r_irq_rid; } irq; + int quirks; int channels; struct { void (*function)(void *); From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 13:32:49 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 977151065670; Wed, 9 Dec 2009 13:32:49 +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 6CADC8FC0A; Wed, 9 Dec 2009 13:32:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9DWnlw026671; Wed, 9 Dec 2009 13:32:49 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9DWnuS026667; Wed, 9 Dec 2009 13:32:49 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912091332.nB9DWnuS026667@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Dec 2009 13:32:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200294 - stable/8/sys/dev/siis X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 13:32:49 -0000 Author: mav Date: Wed Dec 9 13:32:49 2009 New Revision: 200294 URL: http://svn.freebsd.org/changeset/base/200294 Log: MFC r200223: Explicitly acknowledge MSI completion, as required by SiI3124 datasheet. It makes MSI working there. Later (and cheaper) PCIe chips (3132/3531) still randomly crashing system in few seconds of high MSI rates, generating something inaporopriate, like NMI or "Fatal trap 30". Modified: stable/8/sys/dev/siis/siis.c stable/8/sys/dev/siis/siis.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Wed Dec 9 13:30:11 2009 (r200293) +++ stable/8/sys/dev/siis/siis.c Wed Dec 9 13:32:49 2009 (r200294) @@ -143,6 +143,7 @@ siis_attach(device_t dev) if (!(ctlr->r_gmem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &ctlr->r_grid, RF_ACTIVE))) return (ENXIO); + ctlr->gctl = ATA_INL(ctlr->r_gmem, SIIS_GCTL); /* Channels memory */ ctlr->r_rid = PCIR_BAR(2); if (!(ctlr->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, @@ -221,7 +222,8 @@ siis_suspend(device_t dev) bus_generic_suspend(dev); /* Put controller into reset state. */ - ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, SIIS_GCTL_GRESET); + ctlr->gctl |= SIIS_GCTL_GRESET; + ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, ctlr->gctl); return 0; } @@ -231,10 +233,13 @@ siis_resume(device_t dev) struct siis_controller *ctlr = device_get_softc(dev); /* Put controller into reset state. */ - ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, SIIS_GCTL_GRESET); + ctlr->gctl |= SIIS_GCTL_GRESET; + ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, ctlr->gctl); DELAY(10000); /* Get controller out of reset state and enable port interrupts. */ - ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, 0x0000000f); + ctlr->gctl &= ~(SIIS_GCTL_GRESET | SIIS_GCTL_I2C_IE); + ctlr->gctl |= 0x0000000f; + ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, ctlr->gctl); return (bus_generic_resume(dev)); } @@ -288,6 +293,11 @@ siis_intr(void *data) ctlr->interrupt[unit].function(arg); } } + /* Acknowledge interrupt, if MSI enabled. */ + if (ctlr->irq.r_irq_rid) { + ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, + ctlr->gctl | SIIS_GCTL_MSIACK); + } } static struct resource * Modified: stable/8/sys/dev/siis/siis.h ============================================================================== --- stable/8/sys/dev/siis/siis.h Wed Dec 9 13:30:11 2009 (r200293) +++ stable/8/sys/dev/siis/siis.h Wed Dec 9 13:32:49 2009 (r200294) @@ -403,6 +403,7 @@ struct siis_controller { } irq; int quirks; int channels; + uint32_t gctl; struct { void (*function)(void *); void *argument; From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 17:11:10 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00E5E1065672; Wed, 9 Dec 2009 17:11:10 +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 E34C48FC17; Wed, 9 Dec 2009 17:11:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9HB9eN031545; Wed, 9 Dec 2009 17:11:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9HB9Ek031544; Wed, 9 Dec 2009 17:11:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912091711.nB9HB9Ek031544@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Dec 2009 17:11:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200296 - stable/8/sys/dev/ata/chipsets X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 17:11:10 -0000 Author: mav Date: Wed Dec 9 17:11:09 2009 New Revision: 200296 URL: http://svn.freebsd.org/changeset/base/200296 Log: MFC r200117: On Soft Reset, read device signature from FIS receive area, instead of PxSIG register. It works better for NVidia chipsets. ahci(4) does the same. PR: kern/140472, i386/138668 Modified: stable/8/sys/dev/ata/chipsets/ata-ahci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-ahci.c Wed Dec 9 14:21:21 2009 (r200295) +++ stable/8/sys/dev/ata/chipsets/ata-ahci.c Wed Dec 9 17:11:09 2009 (r200296) @@ -824,11 +824,10 @@ ata_ahci_hardreset(device_t dev, int por static u_int32_t ata_ahci_softreset(device_t dev, int port) { - struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); - int offset = ch->unit << 7; struct ata_ahci_cmd_tab *ctp = (struct ata_ahci_cmd_tab *)(ch->dma.work + ATA_AHCI_CT_OFFSET); + u_int8_t *fis = ch->dma.work + ATA_AHCI_FB_OFFSET + 0x40; if (bootverbose) device_printf(dev, "software reset port %d...\n", port); @@ -865,7 +864,10 @@ ata_ahci_softreset(device_t dev, int por return (-1); } - return ATA_INL(ctlr->r_res2, ATA_AHCI_P_SIG + offset); + return (((u_int32_t)fis[6] << 24) | + ((u_int32_t)fis[5] << 16) | + ((u_int32_t)fis[4] << 8) | + (u_int32_t)fis[12]); } static void From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 17:20:10 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FE5610656E8; Wed, 9 Dec 2009 17:20:10 +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 4E5048FC1B; Wed, 9 Dec 2009 17:20:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9HKALn031862; Wed, 9 Dec 2009 17:20:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9HKAsv031860; Wed, 9 Dec 2009 17:20:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912091720.nB9HKAsv031860@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Dec 2009 17:20:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200297 - stable/8/sys/dev/ata X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 17:20:10 -0000 Author: mav Date: Wed Dec 9 17:20:10 2009 New Revision: 200297 URL: http://svn.freebsd.org/changeset/base/200297 Log: MFC r200121: Do not ignore device interrupt if bus mastering is still active. It is normal in case of media read error and some ATAPI cases, when transfer size is unknown beforehand. PCI ATA BM specification tells that in case of such underrun driver should just manually stop DMA engine. DMA engine should same time guarantie that all bus mastering transfers completed at the moment of driver reads interrupt flag asserted. This change fixes interrupt storms and command timeouts in many cases. PR: kern/103602, sparc64/121539, kern/133122, kern/139654 Modified: stable/8/sys/dev/ata/ata-pci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ata/ata-pci.c ============================================================================== --- stable/8/sys/dev/ata/ata-pci.c Wed Dec 9 17:11:09 2009 (r200296) +++ stable/8/sys/dev/ata/ata-pci.c Wed Dec 9 17:20:10 2009 (r200297) @@ -462,8 +462,7 @@ ata_pci_status(device_t dev) (ch->dma.flags & ATA_DMA_ACTIVE))) { int bmstat = ATA_IDX_INB(ch, ATA_BMSTAT_PORT) & ATA_BMSTAT_MASK; - if ((bmstat & (ATA_BMSTAT_ACTIVE | ATA_BMSTAT_INTERRUPT)) != - ATA_BMSTAT_INTERRUPT) + if ((bmstat & ATA_BMSTAT_INTERRUPT) == 0) return 0; ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, bmstat & ~ATA_BMSTAT_ERROR); DELAY(1); From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 21:34:39 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C0221065670; Wed, 9 Dec 2009 21:34:39 +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 389518FC08; Wed, 9 Dec 2009 21:34:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9LYdZV039142; Wed, 9 Dec 2009 21:34:39 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9LYdDe039136; Wed, 9 Dec 2009 21:34:39 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092134.nB9LYdDe039136@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 21:34:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200312 - stable/8/lib/libusb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 21:34:39 -0000 Author: thompsa Date: Wed Dec 9 21:34:38 2009 New Revision: 200312 URL: http://svn.freebsd.org/changeset/base/200312 Log: MFC r199575 - fix a transfer cancelling bug/segfault [1] - correct a return code in the transfer cancel function. - add new API function, libusb20_tr_bulk_intr_sync(). Submitted by: HPS Reported by: Robert Jenssen [1] Modified: stable/8/lib/libusb/libusb10.c stable/8/lib/libusb/libusb10.h stable/8/lib/libusb/libusb20.3 stable/8/lib/libusb/libusb20.c stable/8/lib/libusb/libusb20.h Directory Properties: stable/8/lib/libusb/ (props changed) stable/8/lib/libusb/usb.h (props changed) Modified: stable/8/lib/libusb/libusb10.c ============================================================================== --- stable/8/lib/libusb/libusb10.c Wed Dec 9 21:18:56 2009 (r200311) +++ stable/8/lib/libusb/libusb10.c Wed Dec 9 21:34:38 2009 (r200312) @@ -833,8 +833,12 @@ libusb10_complete_transfer(struct libusb if (pxfer != NULL) libusb20_tr_set_priv_sc1(pxfer, NULL); + /* set transfer status */ uxfer->status = status; + /* update super transfer state */ + sxfer->state = LIBUSB_SUPER_XFER_ST_NONE; + dev = libusb_get_device(uxfer->dev_handle); TAILQ_INSERT_TAIL(&dev->ctx->tr_done, sxfer, entry); @@ -1111,6 +1115,8 @@ libusb10_submit_transfer_sub(struct libu return; case 2: sxfer = libusb20_tr_get_priv_sc1(pxfer1); + if (sxfer == NULL) + return; /* cancelling */ if (sxfer->rem_len) return; /* cannot queue another one */ /* swap transfers */ @@ -1118,6 +1124,8 @@ libusb10_submit_transfer_sub(struct libu break; case 1: sxfer = libusb20_tr_get_priv_sc1(pxfer0); + if (sxfer == NULL) + return; /* cancelling */ if (sxfer->rem_len) return; /* cannot queue another one */ /* swap transfers */ @@ -1229,12 +1237,18 @@ libusb_submit_transfer(struct libusb_tra if (pxfer0 == NULL || pxfer1 == NULL) { err = LIBUSB_ERROR_OTHER; } else if ((sxfer->entry.tqe_prev != NULL) || - (libusb20_tr_get_priv_sc1(pxfer0) == sxfer) || + (libusb20_tr_get_priv_sc1(pxfer0) == sxfer) || (libusb20_tr_get_priv_sc1(pxfer1) == sxfer)) { err = LIBUSB_ERROR_BUSY; } else { + + /* set pending state */ + sxfer->state = LIBUSB_SUPER_XFER_ST_PEND; + + /* insert transfer into transfer head list */ TAILQ_INSERT_TAIL(&dev->tr_head, sxfer, entry); + /* start work transfers */ libusb10_submit_transfer_sub( uxfer->dev_handle, endpoint); @@ -1258,12 +1272,14 @@ libusb_cancel_transfer(struct libusb_tra struct libusb_super_transfer *sxfer; struct libusb_device *dev; uint32_t endpoint; + int retval; if (uxfer == NULL) return (LIBUSB_ERROR_INVALID_PARAM); + /* check if not initialised */ if (uxfer->dev_handle == NULL) - return (LIBUSB_ERROR_INVALID_PARAM); + return (LIBUSB_ERROR_NOT_FOUND); endpoint = uxfer->endpoint; @@ -1277,39 +1293,50 @@ libusb_cancel_transfer(struct libusb_tra sxfer = (struct libusb_super_transfer *)( (uint8_t *)uxfer - sizeof(*sxfer)); + retval = 0; + CTX_LOCK(dev->ctx); pxfer0 = libusb10_get_transfer(uxfer->dev_handle, endpoint, 0); pxfer1 = libusb10_get_transfer(uxfer->dev_handle, endpoint, 1); - if (sxfer->entry.tqe_prev != NULL) { + if (sxfer->state != LIBUSB_SUPER_XFER_ST_PEND) { + /* only update the transfer status */ + uxfer->status = LIBUSB_TRANSFER_CANCELLED; + retval = LIBUSB_ERROR_NOT_FOUND; + } else if (sxfer->entry.tqe_prev != NULL) { /* we are lucky - transfer is on a queue */ TAILQ_REMOVE(&dev->tr_head, sxfer, entry); sxfer->entry.tqe_prev = NULL; - libusb10_complete_transfer(NULL, sxfer, LIBUSB_TRANSFER_CANCELLED); + libusb10_complete_transfer(NULL, + sxfer, LIBUSB_TRANSFER_CANCELLED); } else if (pxfer0 == NULL || pxfer1 == NULL) { /* not started */ + retval = LIBUSB_ERROR_NOT_FOUND; } else if (libusb20_tr_get_priv_sc1(pxfer0) == sxfer) { - libusb10_complete_transfer(pxfer0, sxfer, LIBUSB_TRANSFER_CANCELLED); + libusb10_complete_transfer(pxfer0, + sxfer, LIBUSB_TRANSFER_CANCELLED); libusb20_tr_stop(pxfer0); /* make sure the queue doesn't stall */ libusb10_submit_transfer_sub( uxfer->dev_handle, endpoint); } else if (libusb20_tr_get_priv_sc1(pxfer1) == sxfer) { - libusb10_complete_transfer(pxfer1, sxfer, LIBUSB_TRANSFER_CANCELLED); + libusb10_complete_transfer(pxfer1, + sxfer, LIBUSB_TRANSFER_CANCELLED); libusb20_tr_stop(pxfer1); /* make sure the queue doesn't stall */ libusb10_submit_transfer_sub( uxfer->dev_handle, endpoint); } else { /* not started */ + retval = LIBUSB_ERROR_NOT_FOUND; } CTX_UNLOCK(dev->ctx); DPRINTF(dev->ctx, LIBUSB_DEBUG_FUNCTION, "libusb_cancel_transfer leave"); - return (0); + return (retval); } UNEXPORTED void Modified: stable/8/lib/libusb/libusb10.h ============================================================================== --- stable/8/lib/libusb/libusb10.h Wed Dec 9 21:18:56 2009 (r200311) +++ stable/8/lib/libusb/libusb10.h Wed Dec 9 21:34:38 2009 (r200312) @@ -65,7 +65,9 @@ struct libusb_super_transfer { uint8_t *curr_data; uint32_t rem_len; uint32_t last_len; - uint8_t flags; + uint8_t state; +#define LIBUSB_SUPER_XFER_ST_NONE 0 +#define LIBUSB_SUPER_XFER_ST_PEND 1 }; struct libusb_context { Modified: stable/8/lib/libusb/libusb20.3 ============================================================================== --- stable/8/lib/libusb/libusb20.3 Wed Dec 9 21:18:56 2009 (r200311) +++ stable/8/lib/libusb/libusb20.3 Wed Dec 9 21:34:38 2009 (r200312) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 22, 2009 +.Dd November 18, 2009 .Dt LIBUSB20 3 .Os .Sh NAME @@ -98,6 +98,8 @@ USB access library (libusb -lusb) .Fn libusb20_tr_setup_intr "struct libusb20_transfer *xfer" "void *pbuf" "uint32_t length" "uint32_t timeout" .Ft void .Fn libusb20_tr_setup_isoc "struct libusb20_transfer *xfer" "void *pbuf" "uint32_t length" "uint61_t fr_index" +.Ft uint8_t +.Fn libusb20_tr_bulk_intr_sync "struct libusb20_transfer *xfer" "void *pbuf" "uint32_t length" "uint32_t *pactlen" "uint32_t timeout" .Ft void .Fn libusb20_tr_start "struct libusb20_transfer *xfer" .Ft void @@ -451,6 +453,29 @@ is a helper function for setting up a mu . .Pp . +.Fn libusb20_tr_bulk_intr_sync +will perform a synchronous BULK or INTERRUPT transfer having length given by the +.Fa length +argument and buffer pointer given by the +.Fa pbuf +argument on the USB transfer given by the +.Fa xfer +argument. +. +If the +.Fa pactlen +argument is non-NULL the actual transfer length will be stored at the given pointer destination. +. +If the +.Fa timeout +argument is non-zero the transfer will timeout after the given value in milliseconds. +. +This function does not change the transfer flags, like short packet not ok. +. +This function returns zero on success else a LIBUSB20_TRANSFER_XXX value is returned. +. +.Pp +. .Fn libusb20_tr_start will get the USB transfer started, if not already started. Modified: stable/8/lib/libusb/libusb20.c ============================================================================== --- stable/8/lib/libusb/libusb20.c Wed Dec 9 21:18:56 2009 (r200311) +++ stable/8/lib/libusb/libusb20.c Wed Dec 9 21:34:38 2009 (r200312) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /*- - * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2008-2009 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -263,6 +263,10 @@ libusb20_tr_get_priv_sc1(struct libusb20 void libusb20_tr_stop(struct libusb20_transfer *xfer) { + if (!xfer->is_opened) { + /* transfer is not opened */ + return; + } if (!xfer->is_pending) { /* transfer not pending */ return; @@ -280,6 +284,10 @@ libusb20_tr_stop(struct libusb20_transfe void libusb20_tr_drain(struct libusb20_transfer *xfer) { + if (!xfer->is_opened) { + /* transfer is not opened */ + return; + } /* make sure that we are cancelling */ libusb20_tr_stop(xfer); @@ -415,9 +423,79 @@ libusb20_tr_setup_isoc(struct libusb20_t return; } +uint8_t +libusb20_tr_bulk_intr_sync(struct libusb20_transfer *xfer, + void *pbuf, uint32_t length, uint32_t *pactlen, + uint32_t timeout) +{ + struct libusb20_device *pdev = xfer->pdev; + uint32_t transfer_max; + uint32_t transfer_act; + uint8_t retval; + + /* set some sensible default value */ + if (pactlen != NULL) + *pactlen = 0; + + /* check for error condition */ + if (libusb20_tr_pending(xfer)) + return (LIBUSB20_ERROR_OTHER); + + do { + /* compute maximum transfer length */ + transfer_max = + libusb20_tr_get_max_total_length(xfer); + + if (transfer_max > length) + transfer_max = length; + + /* setup bulk or interrupt transfer */ + libusb20_tr_setup_bulk(xfer, pbuf, + transfer_max, timeout); + + /* start the transfer */ + libusb20_tr_start(xfer); + + /* wait for transfer completion */ + while (libusb20_dev_process(pdev) == 0) { + + if (libusb20_tr_pending(xfer) == 0) + break; + + libusb20_dev_wait_process(pdev, -1); + } + + transfer_act = libusb20_tr_get_actual_length(xfer); + + /* update actual length, if any */ + if (pactlen != NULL) + pactlen[0] += transfer_act; + + /* check transfer status */ + retval = libusb20_tr_get_status(xfer); + if (retval) + break; + + /* check for short transfer */ + if (transfer_act != transfer_max) + break; + + /* update buffer pointer and length */ + pbuf = ((uint8_t *)pbuf) + transfer_max; + length = length - transfer_max; + + } while (length != 0); + + return (retval); +} + void libusb20_tr_submit(struct libusb20_transfer *xfer) { + if (!xfer->is_opened) { + /* transfer is not opened */ + return; + } if (xfer->is_pending) { /* should not happen */ return; @@ -433,6 +511,10 @@ libusb20_tr_submit(struct libusb20_trans void libusb20_tr_start(struct libusb20_transfer *xfer) { + if (!xfer->is_opened) { + /* transfer is not opened */ + return; + } if (xfer->is_pending) { if (xfer->is_cancel) { /* cancelling - restart */ @@ -461,7 +543,14 @@ libusb20_dev_close(struct libusb20_devic for (x = 0; x != pdev->nTransfer; x++) { xfer = pdev->pTransfer + x; + if (!xfer->is_opened) { + /* transfer is not opened */ + continue; + } + libusb20_tr_drain(xfer); + + libusb20_tr_close(xfer); } if (pdev->pTransfer != NULL) { Modified: stable/8/lib/libusb/libusb20.h ============================================================================== --- stable/8/lib/libusb/libusb20.h Wed Dec 9 21:18:56 2009 (r200311) +++ stable/8/lib/libusb/libusb20.h Wed Dec 9 21:34:38 2009 (r200312) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /*- - * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2008-2009 Hans Petter Selasky. All rights reserved. * Copyright (c) 2007-2008 Daniel Drake. All rights reserved. * Copyright (c) 2001 Johannes Erdfelt. All rights reserved. * @@ -226,6 +226,7 @@ void libusb20_tr_setup_bulk(struct libus void libusb20_tr_setup_control(struct libusb20_transfer *xfer, void *psetup, void *pbuf, uint32_t timeout); void libusb20_tr_setup_intr(struct libusb20_transfer *xfer, void *pbuf, uint32_t length, uint32_t timeout); void libusb20_tr_setup_isoc(struct libusb20_transfer *xfer, void *pbuf, uint32_t length, uint16_t fr_index); +uint8_t libusb20_tr_bulk_intr_sync(struct libusb20_transfer *xfer, void *pbuf, uint32_t length, uint32_t *pactlen, uint32_t timeout); void libusb20_tr_start(struct libusb20_transfer *xfer); void libusb20_tr_stop(struct libusb20_transfer *xfer); void libusb20_tr_submit(struct libusb20_transfer *xfer); From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 21:47:43 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00E391065670; Wed, 9 Dec 2009 21:47:43 +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 E09DC8FC17; Wed, 9 Dec 2009 21:47:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9Llgu6039545; Wed, 9 Dec 2009 21:47:42 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9LlgLX039541; Wed, 9 Dec 2009 21:47:42 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092147.nB9LlgLX039541@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 21:47:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200314 - in stable/8/sys: conf dev/usb/input modules/usb modules/usb/atp X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 21:47:43 -0000 Author: thompsa Date: Wed Dec 9 21:47:42 2009 New Revision: 200314 URL: http://svn.freebsd.org/changeset/base/200314 Log: MFC r199086,199151,199680,199948,200241 Driver for the Apple Touchpad present on MacBook (non-Pro & Pro). Submitted by: Rohit Grover Added: stable/8/sys/dev/usb/input/atp.c - copied, changed from r199086, head/sys/dev/usb/input/atp.c stable/8/sys/modules/usb/atp/ - copied from r199086, head/sys/modules/usb/atp/ Modified: stable/8/sys/conf/files stable/8/sys/modules/usb/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Wed Dec 9 21:39:43 2009 (r200313) +++ stable/8/sys/conf/files Wed Dec 9 21:47:42 2009 (r200314) @@ -1669,6 +1669,7 @@ dev/usb/misc/udbp.c optional udbp # # USB input drivers # +dev/usb/input/atp.c optional atp dev/usb/input/uhid.c optional uhid dev/usb/input/ukbd.c optional ukbd dev/usb/input/ums.c optional ums Copied and modified: stable/8/sys/dev/usb/input/atp.c (from r199086, head/sys/dev/usb/input/atp.c) ============================================================================== --- head/sys/dev/usb/input/atp.c Mon Nov 9 15:59:09 2009 (r199086, copy source) +++ stable/8/sys/dev/usb/input/atp.c Wed Dec 9 21:47:42 2009 (r200314) @@ -193,21 +193,50 @@ SYSCTL_UINT(_hw_usb_atp, OID_AUTO, pspan &atp_pspan_max_width, 4, "maximum allowed width (in sensors) for pressure-spans"); +/* We support three payload protocols */ +typedef enum { + ATP_PROT_GEYSER1, + ATP_PROT_GEYSER2, + ATP_PROT_GEYSER3, +} atp_protocol; /* Define the various flavours of devices supported by this driver. */ enum { ATP_DEV_PARAMS_0, + ATP_DEV_PARAMS_PBOOK, + ATP_DEV_PARAMS_PBOOK_15A, + ATP_DEV_PARAMS_PBOOK_17, ATP_N_DEV_PARAMS }; struct atp_dev_params { u_int data_len; /* for sensor data */ u_int n_xsensors; u_int n_ysensors; + atp_protocol prot; } atp_dev_params[ATP_N_DEV_PARAMS] = { [ATP_DEV_PARAMS_0] = { .data_len = 64, .n_xsensors = 20, - .n_ysensors = 10 + .n_ysensors = 10, + .prot = ATP_PROT_GEYSER3 + }, + [ATP_DEV_PARAMS_PBOOK] = { + .data_len = 81, + .n_xsensors = 16, + .n_ysensors = 16, + .prot = ATP_PROT_GEYSER1 + }, + [ATP_DEV_PARAMS_PBOOK_15A] = { + .data_len = 64, + .n_xsensors = 15, + .n_ysensors = 9, + .prot = ATP_PROT_GEYSER2 + }, + [ATP_DEV_PARAMS_PBOOK_17] = { + .data_len = 81, + .n_xsensors = 26, + .n_ysensors = 16, + .prot = ATP_PROT_GEYSER1 }, }; @@ -226,6 +255,19 @@ static const struct usb_device_id atp_de { USB_VPI(USB_VENDOR_APPLE, 0x0229, ATP_DEV_PARAMS_0) }, { USB_VPI(USB_VENDOR_APPLE, 0x022a, ATP_DEV_PARAMS_0) }, { USB_VPI(USB_VENDOR_APPLE, 0x022b, ATP_DEV_PARAMS_0) }, + + /* 12 inch PowerBook and iBook */ + { USB_VPI(USB_VENDOR_APPLE, 0x030a, ATP_DEV_PARAMS_PBOOK) }, + { USB_VPI(USB_VENDOR_APPLE, 0x030b, ATP_DEV_PARAMS_PBOOK) }, + + /* 15 inch PowerBook */ + { USB_VPI(USB_VENDOR_APPLE, 0x020e, ATP_DEV_PARAMS_PBOOK) }, + { USB_VPI(USB_VENDOR_APPLE, 0x020f, ATP_DEV_PARAMS_PBOOK) }, + { USB_VPI(USB_VENDOR_APPLE, 0x0215, ATP_DEV_PARAMS_PBOOK_15A) }, + + /* 17 inch PowerBook */ + { USB_VPI(USB_VENDOR_APPLE, 0x020d, ATP_DEV_PARAMS_PBOOK_17) }, + }; /* @@ -299,6 +341,7 @@ typedef struct atp_stroke { enum { ATP_INTR_DT, + ATP_RESET, ATP_N_TRANSFER, }; @@ -321,6 +364,7 @@ struct atp_softc { #define ATP_ENABLED 0x01 #define ATP_ZOMBIES_EXIST 0x02 #define ATP_DOUBLE_TAP_DRAG 0x04 +#define ATP_VALID 0x08 u_int sc_left_margin; u_int sc_right_margin; @@ -378,21 +422,22 @@ static struct usb_fifo_methods atp_fifo_ /* device initialization and shutdown */ static usb_error_t atp_req_get_report(struct usb_device *udev, void *data); static int atp_set_device_mode(device_t dev, interface_mode mode); +static void atp_reset_callback(struct usb_xfer *, usb_error_t); static int atp_enable(struct atp_softc *sc); static void atp_disable(struct atp_softc *sc); static int atp_softc_populate(struct atp_softc *); static void atp_softc_unpopulate(struct atp_softc *); /* sensor interpretation */ -static __inline void atp_interpret_sensor_data(const int8_t *, u_int, u_int, - int *); +static __inline void atp_interpret_sensor_data(const int8_t *, u_int, atp_axis, + int *, atp_protocol); static __inline void atp_get_pressures(int *, const int *, const int *, int); static void atp_detect_pspans(int *, u_int, u_int, atp_pspan *, u_int *); /* movement detection */ static boolean_t atp_match_stroke_component(atp_stroke_component *, - const atp_pspan *); + const atp_pspan *, atp_stroke_type); static void atp_match_strokes_against_pspans(struct atp_softc *, atp_axis, atp_pspan *, u_int, u_int); static boolean_t atp_update_strokes(struct atp_softc *, @@ -413,6 +458,7 @@ static boolean_t atp_compute_stroke_ /* tap detection */ static __inline void atp_setup_reap_time(struct atp_softc *, struct timeval *); static void atp_reap_zombies(struct atp_softc *, u_int *, u_int *); +static void atp_convert_to_slide(struct atp_softc *, atp_stroke *); /* updating fifo */ static void atp_reset_buf(struct atp_softc *sc); @@ -458,6 +504,40 @@ atp_set_device_mode(device_t dev, interf return (0); } +void +atp_reset_callback(struct usb_xfer *xfer, usb_error_t error) +{ + usb_device_request_t req; + struct usb_page_cache *pc; + struct atp_softc *sc = usbd_xfer_softc(xfer); + + switch (USB_GET_STATE(xfer)) { + case USB_ST_SETUP: + sc->sc_mode_bytes[0] = RAW_SENSOR_MODE; + req.bmRequestType = UT_WRITE_CLASS_INTERFACE; + req.bRequest = UR_SET_REPORT; + USETW2(req.wValue, + (uint8_t)0x03 /* type */, (uint8_t)0x00 /* id */); + USETW(req.wIndex, 0); + USETW(req.wLength, MODE_LENGTH); + + pc = usbd_xfer_get_frame(xfer, 0); + usbd_copy_in(pc, 0, &req, sizeof(req)); + pc = usbd_xfer_get_frame(xfer, 1); + usbd_copy_in(pc, 0, sc->sc_mode_bytes, MODE_LENGTH); + + usbd_xfer_set_frame_len(xfer, 0, sizeof(req)); + usbd_xfer_set_frame_len(xfer, 1, MODE_LENGTH); + usbd_xfer_set_frames(xfer, 2); + usbd_transfer_submit(xfer); + break; + + case USB_ST_TRANSFERRED: + default: + break; + } +} + static int atp_enable(struct atp_softc *sc) { @@ -483,7 +563,7 @@ atp_disable(struct atp_softc *sc) { atp_softc_unpopulate(sc); - sc->sc_state &= ~ATP_ENABLED; + sc->sc_state &= ~(ATP_ENABLED | ATP_VALID); DPRINTFN(ATP_LLEVEL_INFO, "disabled atp\n"); } @@ -623,25 +703,42 @@ atp_softc_unpopulate(struct atp_softc *s * raw sensor data from the USB packet. * num * The number of elements in the array 'arr'. - * di_start - * The index of the first data element to be interpreted for - * this sensor array--i.e. when called to interpret the Y - * sensors, di_start passed in as 2, which is the index of Y1 in - * the raw data. + * axis + * Axis of data to fetch * arr * The array to be initialized with the readings. + * prot + * The protocol to use to interpret the data */ static __inline void -atp_interpret_sensor_data(const int8_t *sensor_data, u_int num, u_int di_start, - int *arr) +atp_interpret_sensor_data(const int8_t *sensor_data, u_int num, atp_axis axis, + int *arr, atp_protocol prot) { u_int i; u_int di; /* index into sensor data */ - for (i = 0, di = di_start; i < num; /* empty */ ) { - arr[i++] = sensor_data[di++]; - arr[i++] = sensor_data[di++]; - di++; + switch (prot) { + case ATP_PROT_GEYSER1: + /* + * For Geyser 1, the sensors are laid out in pairs + * every 5 bytes. + */ + for (i = 0, di = (axis == Y) ? 1 : 2; i < 8; di += 5, i++) { + arr[i] = sensor_data[di]; + arr[i+8] = sensor_data[di+2]; + if (axis == X && num > 16) + arr[i+16] = sensor_data[di+40]; + } + + break; + case ATP_PROT_GEYSER2: + case ATP_PROT_GEYSER3: + for (i = 0, di = (axis == Y) ? 2 : 20; i < num; /* empty */ ) { + arr[i++] = sensor_data[di++]; + arr[i++] = sensor_data[di++]; + di++; + } + break; } } @@ -783,23 +880,43 @@ atp_detect_pspans(int *p, u_int num_sens */ static boolean_t atp_match_stroke_component(atp_stroke_component *component, - const atp_pspan *pspan) + const atp_pspan *pspan, atp_stroke_type stroke_type) { - int delta_mickeys = pspan->loc - component->loc; + int delta_mickeys; + u_int min_pressure; + + delta_mickeys = pspan->loc - component->loc; if (abs(delta_mickeys) > atp_max_delta_mickeys) return (FALSE); /* the finger span is too far out; no match */ component->loc = pspan->loc; + + /* + * A sudden and significant increase in a pspan's cumulative + * pressure indicates the incidence of a new finger + * contact. This usually revises the pspan's + * centre-of-gravity, and hence the location of any/all + * matching stroke component(s). But such a change should + * *not* be interpreted as a movement. + */ + if (pspan->cum > ((3 * component->cum_pressure) >> 1)) + delta_mickeys = 0; + component->cum_pressure = pspan->cum; if (pspan->cum > component->max_cum_pressure) component->max_cum_pressure = pspan->cum; /* - * If the cumulative pressure drops below a quarter of the max, - * then disregard the component's movement. + * Disregard the component's movement if its cumulative + * pressure drops below a fraction of the maximum; this + * fraction is determined based on the stroke's type. */ - if (component->cum_pressure < (component->max_cum_pressure >> 2)) + if (stroke_type == ATP_STROKE_TOUCH) + min_pressure = (3 * component->max_cum_pressure) >> 2; + else + min_pressure = component->max_cum_pressure >> 2; + if (component->cum_pressure < min_pressure) delta_mickeys = 0; component->delta_mickeys = delta_mickeys; @@ -834,7 +951,8 @@ atp_match_strokes_against_pspans(struct continue; /* skip matched pspans */ if (atp_match_stroke_component( - &stroke->components[axis], &pspans[j])) { + &stroke->components[axis], &pspans[j], + stroke->type)) { /* There is a match. */ stroke->components[axis].matched = TRUE; @@ -969,19 +1087,23 @@ atp_update_strokes(struct atp_softc *sc, for (i = 0; i < sc->sc_n_strokes; i++) { atp_stroke *stroke = &sc->sc_strokes[i]; - printf(" %s%clc:%u,dm:%d,pnd:%d,mv:%d%c" - ",%clc:%u,dm:%d,pnd:%d,mv:%d%c", + printf(" %s%clc:%u,dm:%d,pnd:%d,cum:%d,max:%d,mv:%d%c" + ",%clc:%u,dm:%d,pnd:%d,cum:%d,max:%d,mv:%d%c", (stroke->flags & ATSF_ZOMBIE) ? "zomb:" : "", (stroke->type == ATP_STROKE_TOUCH) ? '[' : '<', stroke->components[X].loc, stroke->components[X].delta_mickeys, stroke->components[X].pending, + stroke->components[X].cum_pressure, + stroke->components[X].max_cum_pressure, stroke->components[X].movement, (stroke->type == ATP_STROKE_TOUCH) ? ']' : '>', (stroke->type == ATP_STROKE_TOUCH) ? '[' : '<', stroke->components[Y].loc, stroke->components[Y].delta_mickeys, stroke->components[Y].pending, + stroke->components[Y].cum_pressure, + stroke->components[Y].max_cum_pressure, stroke->components[Y].movement, (stroke->type == ATP_STROKE_TOUCH) ? ']' : '>'); } @@ -1122,51 +1244,94 @@ atp_advance_stroke_state(struct atp_soft if (atp_compute_stroke_movement(stroke)) *movement = TRUE; + if (stroke->type != ATP_STROKE_TOUCH) + return; + /* Convert touch strokes to slides upon detecting movement or age. */ - if (stroke->type == ATP_STROKE_TOUCH) { - struct timeval tdiff; + if (stroke->cum_movement >= atp_slide_min_movement) { + atp_convert_to_slide(sc, stroke); + } else { + /* If a touch stroke is found to be older than the + * touch-timeout threshold, it should be converted to + * a slide; except if there is a co-incident sibling + * with a later creation time. + * + * When multiple fingers make contact with the + * touchpad, they are likely to be separated in their + * times of incidence. During a multi-finger tap, + * therefore, the last finger to make + * contact--i.e. the one with the latest + * 'ctime'--should be used to determine how the + * touch-siblings get treated; otherwise older + * siblings may lapse the touch-timeout and get + * converted into slides prematurely. The following + * loop determines if there exists another touch + * stroke with a larger 'ctime' than the current + * stroke (NOTE: zombies with a larger 'ctime' are + * also considered) . + */ - /* Compute the stroke's age. */ - getmicrotime(&tdiff); - if (timevalcmp(&tdiff, &stroke->ctime, >)) - timevalsub(&tdiff, &stroke->ctime); - else { - /* - * If we are here, it is because getmicrotime - * reported the current time as being behind - * the stroke's start time; getmicrotime can - * be imprecise. - */ - tdiff.tv_sec = 0; - tdiff.tv_usec = 0; - } + u_int i; + for (i = 0; i < sc->sc_n_strokes; i++) { + if ((&sc->sc_strokes[i] == stroke) || + (sc->sc_strokes[i].type != ATP_STROKE_TOUCH)) + continue; - if ((tdiff.tv_sec > (atp_touch_timeout / 1000000)) || - ((tdiff.tv_sec == (atp_touch_timeout / 1000000)) && - (tdiff.tv_usec > atp_touch_timeout)) || - (stroke->cum_movement >= atp_slide_min_movement)) { - /* Switch this stroke to being a slide. */ - stroke->type = ATP_STROKE_SLIDE; - - /* Are we at the beginning of a double-click-n-drag? */ - if ((sc->sc_n_strokes == 1) && - ((sc->sc_state & ATP_ZOMBIES_EXIST) == 0) && - timevalcmp(&stroke->ctime, &sc->sc_reap_time, >)) { - struct timeval delta; - struct timeval window = { - atp_double_tap_threshold / 1000000, - atp_double_tap_threshold % 1000000 - }; - - delta = stroke->ctime; - timevalsub(&delta, &sc->sc_reap_time); - if (timevalcmp(&delta, &window, <=)) - sc->sc_state |= ATP_DOUBLE_TAP_DRAG; + if (timevalcmp(&sc->sc_strokes[i].ctime, + &stroke->ctime, >)) + break; + } + if (i == sc->sc_n_strokes) { + /* Found no other touch stroke with a larger 'ctime'. */ + struct timeval tdiff; + + /* Compute the stroke's age. */ + getmicrotime(&tdiff); + if (timevalcmp(&tdiff, &stroke->ctime, >)) + timevalsub(&tdiff, &stroke->ctime); + else { + /* + * If we are here, it is because getmicrotime + * reported the current time as being behind + * the stroke's start time; getmicrotime can + * be imprecise. + */ + tdiff.tv_sec = 0; + tdiff.tv_usec = 0; } + + if ((tdiff.tv_sec > (atp_touch_timeout / 1000000)) || + ((tdiff.tv_sec == (atp_touch_timeout / 1000000)) && + (tdiff.tv_usec >= + (atp_touch_timeout % 1000000)))) + atp_convert_to_slide(sc, stroke); } } } +/* Switch a given touch stroke to being a slide. */ +void +atp_convert_to_slide(struct atp_softc *sc, atp_stroke *stroke) +{ + stroke->type = ATP_STROKE_SLIDE; + + /* Are we at the beginning of a double-click-n-drag? */ + if ((sc->sc_n_strokes == 1) && + ((sc->sc_state & ATP_ZOMBIES_EXIST) == 0) && + timevalcmp(&stroke->ctime, &sc->sc_reap_time, >)) { + struct timeval delta; + struct timeval window = { + atp_double_tap_threshold / 1000000, + atp_double_tap_threshold % 1000000 + }; + + delta = stroke->ctime; + timevalsub(&delta, &sc->sc_reap_time); + if (timevalcmp(&delta, &window, <=)) + sc->sc_state |= ATP_DOUBLE_TAP_DRAG; + } +} + /* * Terminate a stroke. While SLIDE strokes are dropped, TOUCH strokes * are retained as zombies so as to reap all their siblings together; @@ -1455,6 +1620,14 @@ static const struct usb_config atp_confi .bufsize = 0, /* use wMaxPacketSize */ .callback = &atp_intr, }, + [ATP_RESET] = { + .type = UE_CONTROL, + .endpoint = 0, /* Control pipe */ + .direction = UE_DIR_ANY, + .bufsize = sizeof(struct usb_device_request) + MODE_LENGTH, + .callback = &atp_reset_callback, + .interval = 0, /* no pre-delay */ + }, }; static int @@ -1469,10 +1642,7 @@ atp_probe(device_t self) (uaa->info.bInterfaceProtocol != UIPROTO_MOUSE)) return (ENXIO); - if (usbd_lookup_id_by_uaa(atp_devs, sizeof(atp_devs), uaa) == 0) - return BUS_PROBE_SPECIFIC; - else - return ENXIO; + return (usbd_lookup_id_by_uaa(atp_devs, sizeof(atp_devs), uaa)); } static int @@ -1482,12 +1652,6 @@ atp_attach(device_t dev) struct usb_attach_arg *uaa = device_get_ivars(dev); usb_error_t err; - /* ensure that the probe was successful */ - if (uaa->driver_info >= ATP_N_DEV_PARAMS) { - DPRINTF("device probe returned bad id: %lu\n", - uaa->driver_info); - return (ENXIO); - } DPRINTFN(ATP_LLEVEL_INFO, "sc=%p\n", sc); sc->sc_dev = dev; @@ -1566,7 +1730,6 @@ static int atp_detach(device_t dev) { struct atp_softc *sc; - int err; sc = device_get_softc(dev); if (sc->sc_state & ATP_ENABLED) { @@ -1581,12 +1744,6 @@ atp_detach(device_t dev) mtx_destroy(&sc->sc_mutex); - err = atp_set_device_mode(dev, HID_MODE); - if (err != 0) { - DPRINTF("failed to reset mode to 'HID' (%d)\n", err); - return (err); - } - return (0); } @@ -1613,7 +1770,7 @@ atp_intr(struct usb_xfer *xfer, usb_erro len, sc->sc_params->data_len); len = sc->sc_params->data_len; } - if (len == 0) + if (len < sc->sc_params->data_len) goto tr_setup; pc = usbd_xfer_get_frame(xfer, 0); @@ -1621,9 +1778,11 @@ atp_intr(struct usb_xfer *xfer, usb_erro /* Interpret sensor data */ atp_interpret_sensor_data(sc->sensor_data, - sc->sc_params->n_xsensors, 20, sc->cur_x); + sc->sc_params->n_xsensors, X, sc->cur_x, + sc->sc_params->prot); atp_interpret_sensor_data(sc->sensor_data, - sc->sc_params->n_ysensors, 2, sc->cur_y); + sc->sc_params->n_ysensors, Y, sc->cur_y, + sc->sc_params->prot); /* * If this is the initial update (from an untouched @@ -1632,11 +1791,14 @@ atp_intr(struct usb_xfer *xfer, usb_erro * be used as pressure readings subsequently. */ status_bits = sc->sensor_data[sc->sc_params->data_len - 1]; - if (status_bits & ATP_STATUS_BASE_UPDATE) { + if ((sc->sc_params->prot == ATP_PROT_GEYSER3 && + (status_bits & ATP_STATUS_BASE_UPDATE)) || + !(sc->sc_state & ATP_VALID)) { memcpy(sc->base_x, sc->cur_x, sc->sc_params->n_xsensors * sizeof(*(sc->base_x))); memcpy(sc->base_y, sc->cur_y, sc->sc_params->n_ysensors * sizeof(*(sc->base_y))); + sc->sc_state |= ATP_VALID; goto tr_setup; } @@ -1757,8 +1919,23 @@ atp_intr(struct usb_xfer *xfer, usb_erro sc->sc_idlecount++; if (sc->sc_idlecount >= ATP_IDLENESS_THRESHOLD) { DPRINTFN(ATP_LLEVEL_INFO, "idle\n"); - atp_set_device_mode(sc->sc_dev,RAW_SENSOR_MODE); + + /* + * Use the last frame before we go idle for + * calibration on pads which do not send + * calibration frames. + */ + if (sc->sc_params->prot < ATP_PROT_GEYSER3) { + memcpy(sc->base_x, sc->cur_x, + sc->sc_params->n_xsensors * + sizeof(*(sc->base_x))); + memcpy(sc->base_y, sc->cur_y, + sc->sc_params->n_ysensors * + sizeof(*(sc->base_y))); + } + sc->sc_idlecount = 0; + usbd_transfer_start(sc->sc_xfer[ATP_RESET]); } } else { sc->sc_idlecount = 0; @@ -1770,7 +1947,7 @@ atp_intr(struct usb_xfer *xfer, usb_erro if (usb_fifo_put_bytes_max( sc->sc_fifo.fp[USB_FIFO_RX]) != 0) { usbd_xfer_set_frame_len(xfer, 0, - usbd_xfer_max_len(xfer)); + sc->sc_params->data_len); usbd_transfer_submit(xfer); } break; Modified: stable/8/sys/modules/usb/Makefile ============================================================================== --- stable/8/sys/modules/usb/Makefile Wed Dec 9 21:39:43 2009 (r200313) +++ stable/8/sys/modules/usb/Makefile Wed Dec 9 21:47:42 2009 (r200314) @@ -28,7 +28,7 @@ SUBDIR = usb SUBDIR += ehci musb ohci uhci uss820dci ${_at91dci} ${_atmegadci} SUBDIR += rum uath upgt ural zyd ${_urtw} -SUBDIR += uhid ukbd ums udbp ufm +SUBDIR += atp uhid ukbd ums udbp ufm SUBDIR += ucom u3g uark ubsa ubser uchcom ucycom ufoma uftdi ugensa uipaq ulpt \ umct umodem umoscom uplcom uslcom uvisor uvscom SUBDIR += uether aue axe cdce cue kue rue udav From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 21:56:55 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3F451065676; Wed, 9 Dec 2009 21:56:55 +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 B83208FC08; Wed, 9 Dec 2009 21:56:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9Lut78039971; Wed, 9 Dec 2009 21:56:55 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9Luti6039967; Wed, 9 Dec 2009 21:56:55 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200912092156.nB9Luti6039967@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 9 Dec 2009 21:56:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200316 - stable/8/sys/dev/usb/input X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 21:56:56 -0000 Author: nwhitehorn Date: Wed Dec 9 21:56:55 2009 New Revision: 200316 URL: http://svn.freebsd.org/changeset/base/200316 Log: MFC r199169: Reduce probe priority of USB input devices to BUS_PROBE_GENERIC from BUS_PROBE_SPECIFIC. This allows device-specific drivers like atp to attach reliably. Modified: stable/8/sys/dev/usb/input/uhid.c stable/8/sys/dev/usb/input/ukbd.c stable/8/sys/dev/usb/input/ums.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/input/uhid.c ============================================================================== --- stable/8/sys/dev/usb/input/uhid.c Wed Dec 9 21:52:53 2009 (r200315) +++ stable/8/sys/dev/usb/input/uhid.c Wed Dec 9 21:56:55 2009 (r200316) @@ -633,7 +633,7 @@ uhid_probe(device_t dev) if (usb_test_quirk(uaa, UQ_HID_IGNORE)) { return (ENXIO); } - return (0); + return (BUS_PROBE_GENERIC); } static int Modified: stable/8/sys/dev/usb/input/ukbd.c ============================================================================== --- stable/8/sys/dev/usb/input/ukbd.c Wed Dec 9 21:52:53 2009 (r200315) +++ stable/8/sys/dev/usb/input/ukbd.c Wed Dec 9 21:56:55 2009 (r200316) @@ -749,7 +749,7 @@ ukbd_probe(device_t dev) if (usb_test_quirk(uaa, UQ_KBD_IGNORE)) return (ENXIO); else - return (0); + return (BUS_PROBE_GENERIC); } error = usbd_req_get_hid_desc(uaa->device, NULL, @@ -771,7 +771,7 @@ ukbd_probe(device_t dev) if (usb_test_quirk(uaa, UQ_KBD_IGNORE)) error = ENXIO; else - error = 0; + error = BUS_PROBE_GENERIC; } else error = ENXIO; Modified: stable/8/sys/dev/usb/input/ums.c ============================================================================== --- stable/8/sys/dev/usb/input/ums.c Wed Dec 9 21:52:53 2009 (r200315) +++ stable/8/sys/dev/usb/input/ums.c Wed Dec 9 21:56:55 2009 (r200316) @@ -375,7 +375,7 @@ ums_probe(device_t dev) if ((uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT) && (uaa->info.bInterfaceProtocol == UIPROTO_MOUSE)) - return (0); + return (BUS_PROBE_GENERIC); error = usbd_req_get_hid_desc(uaa->device, NULL, &d_ptr, &d_len, M_TEMP, uaa->info.bIfaceIndex); @@ -385,7 +385,7 @@ ums_probe(device_t dev) if (hid_is_collection(d_ptr, d_len, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE))) - error = 0; + error = BUS_PROBE_GENERIC; else error = ENXIO; From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 21:58:39 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 625081065679; Wed, 9 Dec 2009 21:58:39 +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 500F88FC0C; Wed, 9 Dec 2009 21:58:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9LwdpF040111; Wed, 9 Dec 2009 21:58:39 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9LwdHh040109; Wed, 9 Dec 2009 21:58:39 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200912092158.nB9LwdHh040109@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 9 Dec 2009 21:58:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200317 - stable/8/sys/powerpc/conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 21:58:39 -0000 Author: nwhitehorn Date: Wed Dec 9 21:58:39 2009 New Revision: 200317 URL: http://svn.freebsd.org/changeset/base/200317 Log: MFC r199949: Add atp(4) to powerpc GENERIC. Most late-generation Apple PowerPC laptops have trackpads that do not work at all without this driver. Modified: stable/8/sys/powerpc/conf/GENERIC Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/powerpc/conf/GENERIC ============================================================================== --- stable/8/sys/powerpc/conf/GENERIC Wed Dec 9 21:56:55 2009 (r200316) +++ stable/8/sys/powerpc/conf/GENERIC Wed Dec 9 21:58:39 2009 (r200317) @@ -147,6 +147,7 @@ options KBD_INSTALL_CDEV # install a CD device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da0 device ums # Mouse +device atp # Apple USB touchpad device urio # Diamond Rio 500 MP3 player # USB Ethernet device aue # ADMtek USB Ethernet From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 22:10:45 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B72D106568D; Wed, 9 Dec 2009 22:10:45 +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 576948FC1A; Wed, 9 Dec 2009 22:10:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9MAj2b040674; Wed, 9 Dec 2009 22:10:45 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9MAjx7040670; Wed, 9 Dec 2009 22:10:45 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092210.nB9MAjx7040670@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 22:10:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200319 - in stable/8/sys/dev/usb: . wlan X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 22:10:45 -0000 Author: thompsa Date: Wed Dec 9 22:10:45 2009 New Revision: 200319 URL: http://svn.freebsd.org/changeset/base/200319 Log: MFC r197761,r198194,r198862 updates device entries supported with the product name not magic numbers and sorts entries. WUSB54GCV2 is added. overhauls urtw(4) for supporting RTL8187B devices properly that there was major changes to initialize RF chipset and set H/W registers and removed a lot of magic numbers on code. Modified: stable/8/sys/dev/usb/usbdevs stable/8/sys/dev/usb/wlan/if_urtw.c stable/8/sys/dev/usb/wlan/if_urtwreg.h stable/8/sys/dev/usb/wlan/if_urtwvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/usbdevs ============================================================================== --- stable/8/sys/dev/usb/usbdevs Wed Dec 9 22:03:57 2009 (r200318) +++ stable/8/sys/dev/usb/usbdevs Wed Dec 9 22:10:45 2009 (r200319) @@ -909,6 +909,7 @@ product ASIX AX88772 0x7720 AX88772 product ASUS WL167G 0x1707 WL-167g Wireless Adapter product ASUS WL159G 0x170c WL-159g product ASUS A9T_WIFI 0x171b A9T wireless +product ASUS P5B_WIFI 0x171d P5B wireless product ASUS RT2573_1 0x1723 RT2573 product ASUS RT2573_2 0x1724 RT2573 product ASUS LCM 0x1726 LCM display @@ -976,6 +977,7 @@ product BELKIN F5D7051 0x7051 F5D7051 5 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 F5D7050E 0x705e F5D7050E Wireless Adapter product BELKIN F5D9050V3 0x905b F5D9050 ver 3 Wireless Adapter product BELKIN2 F5U002 0x0002 F5U002 Parallel printer @@ -1657,6 +1659,7 @@ product LINKSYS2 WUSB11 0x2219 WUSB11 W product LINKSYS2 USB200M 0x2226 USB 2.0 10/100 Ethernet product LINKSYS3 WUSB11v28 0x2233 WUSB11 v2.8 Wireless Adapter product LINKSYS4 USB1000 0x0039 USB1000 +product LINKSYS4 WUSB54GCV2 0x0073 WUSB54GC v2 /* Logitech products */ product LOGITECH M2452 0x0203 M2452 keyboard @@ -1877,6 +1880,7 @@ 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 WG111V3 0x4260 WG111v3 product NETGEAR WG111U 0x4300 WG111U product NETGEAR WG111U_NF 0x4301 WG111U (no firmware) product NETGEAR WG111V2 0x6a00 WG111V2 @@ -2102,6 +2106,9 @@ product RALINK RT2573_2 0x9021 RT2501US /* Green House and CompUSA OEM this part */ product REALTEK USBKR100 0x8150 USBKR100 USB Ethernet product REALTEK RTL8187 0x8187 RTL8187 Wireless Adapter +product REALTEK RTL8187B_0 0x8189 RTL8187B Wireless Adapter +product REALTEK RTL8187B_1 0x8197 RTL8187B Wireless Adapter +product REALTEK RTL8187B_2 0x8198 RTL8187B Wireless Adapter /* Ricoh products */ product RICOH VGPVCC2 0x1830 VGP-VCC2 Camera @@ -2271,6 +2278,8 @@ product SITECOM SERIAL 0x2068 USB to se product SITECOM2 WL022 0x182d WL-022 /* Sitecom Europe products */ +product SITECOMEU WL168V1 0x000d WL-168 v1 +product SITECOMEU WL168V4 0x0028 WL-168 v4 product SITECOMEU LN028 0x061c LN-028 product SITECOMEU WL113 0x9071 WL-113 product SITECOMEU ZD1211B 0x9075 ZD1211B @@ -2376,6 +2385,7 @@ product DIAMOND2 RIO600USB 0x5001 Rio 60 product DIAMOND2 RIO800USB 0x5002 Rio 800 USB /* Surecom Technology products */ +product SURECOM EP9001G2A 0x11f2 EP-9001-G rev 2A product SURECOM RT2570 0x11f3 RT2570 product SURECOM RT2573 0x31f3 RT2573 Modified: stable/8/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- stable/8/sys/dev/usb/wlan/if_urtw.c Wed Dec 9 22:03:57 2009 (r200318) +++ stable/8/sys/dev/usb/wlan/if_urtw.c Wed Dec 9 22:10:45 2009 (r200319) @@ -76,6 +76,7 @@ enum { URTW_DEBUG_STATE = 0x00000020, /* 802.11 state transitions */ URTW_DEBUG_STAT = 0x00000040, /* statistic */ URTW_DEBUG_INIT = 0x00000080, /* initialization of dev */ + URTW_DEBUG_TXSTATUS = 0x00000100, /* tx status */ URTW_DEBUG_ANY = 0xffffffff }; #define DPRINTF(sc, m, fmt, ...) do { \ @@ -102,23 +103,24 @@ TUNABLE_INT("hw.usb.urtw.preamble_mode", #define URTW_REV_RTL8187B 0 #define URTW_REV_RTL8187L 1 static const struct usb_device_id urtw_devs[] = { - { USB_VPI(USB_VENDOR_BELKIN, 0x705e, URTW_REV_RTL8187B) }, - { USB_VPI(USB_VENDOR_REALTEK, 0x8189, URTW_REV_RTL8187B) }, - { USB_VPI(USB_VENDOR_REALTEK, 0x8197, URTW_REV_RTL8187B) }, - { USB_VPI(USB_VENDOR_REALTEK, 0x8198, URTW_REV_RTL8187B) }, - { USB_VPI(USB_VENDOR_NETGEAR, 0x4260, URTW_REV_RTL8187B) }, + URTW_DEV_B(NETGEAR, WG111V3), + URTW_DEV_B(REALTEK, RTL8187B_0), + URTW_DEV_B(REALTEK, RTL8187B_1), + URTW_DEV_B(REALTEK, RTL8187B_2), + URTW_DEV_B(SITECOMEU, WL168V4), + URTW_DEV_L(ASUS, P5B_WIFI), + URTW_DEV_L(BELKIN, F5D7050E), + URTW_DEV_L(LINKSYS4, WUSB54GCV2), + URTW_DEV_L(NETGEAR, WG111V2), + URTW_DEV_L(REALTEK, RTL8187), + URTW_DEV_L(SITECOMEU, WL168V1), + URTW_DEV_L(SURECOM, EP9001G2A), { USB_VPI(0x1b75, 0x8187, URTW_REV_RTL8187L) }, - { USB_VPI(USB_VENDOR_ASUS, 0x171d, URTW_REV_RTL8187L) }, { USB_VPI(USB_VENDOR_DICKSMITH, 0x9401, URTW_REV_RTL8187L) }, { USB_VPI(USB_VENDOR_HP, 0xca02, URTW_REV_RTL8187L) }, { USB_VPI(USB_VENDOR_LOGITEC, 0x010c, URTW_REV_RTL8187L) }, { USB_VPI(USB_VENDOR_NETGEAR, 0x6100, URTW_REV_RTL8187L) }, - URTW_DEV_L(NETGEAR, WG111V2), - URTW_DEV_L(REALTEK, RTL8187), - { USB_VPI(USB_VENDOR_SITECOMEU, 0x000d, URTW_REV_RTL8187L) }, - { USB_VPI(USB_VENDOR_SITECOMEU, 0x0028, URTW_REV_RTL8187B) }, { USB_VPI(USB_VENDOR_SPHAIRON, 0x0150, URTW_REV_RTL8187L) }, - { USB_VPI(USB_VENDOR_SURECOM, 0x11f2, URTW_REV_RTL8187L) }, { USB_VPI(USB_VENDOR_QCOM, 0x6232, URTW_REV_RTL8187L) }, #undef URTW_DEV_L #undef URTW_DEV_B @@ -325,13 +327,47 @@ static struct urtw_pair urtw_8225v2_rf_p { 0x0c, 0x0850 }, { 0x0d, 0x0cdf }, { 0x0e, 0x002b }, { 0x0f, 0x0114 } }; -static struct urtw_pair urtw_8225v2b_rf_part1[] = { +static struct urtw_pair urtw_8225v2b_rf_part0[] = { { 0x00, 0x00b7 }, { 0x01, 0x0ee0 }, { 0x02, 0x044d }, { 0x03, 0x0441 }, { 0x04, 0x08c3 }, { 0x05, 0x0c72 }, { 0x06, 0x00e6 }, { 0x07, 0x082a }, { 0x08, 0x003f }, { 0x09, 0x0335 }, { 0x0a, 0x09d4 }, { 0x0b, 0x07bb }, { 0x0c, 0x0850 }, { 0x0d, 0x0cdf }, { 0x0e, 0x002b }, { 0x0f, 0x0114 } }; +static struct urtw_pair urtw_8225v2b_rf_part1[] = { + {0x0f0, 0x32}, {0x0f1, 0x32}, {0x0f2, 0x00}, + {0x0f3, 0x00}, {0x0f4, 0x32}, {0x0f5, 0x43}, + {0x0f6, 0x00}, {0x0f7, 0x00}, {0x0f8, 0x46}, + {0x0f9, 0xa4}, {0x0fa, 0x00}, {0x0fb, 0x00}, + {0x0fc, 0x96}, {0x0fd, 0xa4}, {0x0fe, 0x00}, + {0x0ff, 0x00}, {0x158, 0x4b}, {0x159, 0x00}, + {0x15a, 0x4b}, {0x15b, 0x00}, {0x160, 0x4b}, + {0x161, 0x09}, {0x162, 0x4b}, {0x163, 0x09}, + {0x1ce, 0x0f}, {0x1cf, 0x00}, {0x1e0, 0xff}, + {0x1e1, 0x0f}, {0x1e2, 0x00}, {0x1f0, 0x4e}, + {0x1f1, 0x01}, {0x1f2, 0x02}, {0x1f3, 0x03}, + {0x1f4, 0x04}, {0x1f5, 0x05}, {0x1f6, 0x06}, + {0x1f7, 0x07}, {0x1f8, 0x08}, {0x24e, 0x00}, + {0x20c, 0x04}, {0x221, 0x61}, {0x222, 0x68}, + {0x223, 0x6f}, {0x224, 0x76}, {0x225, 0x7d}, + {0x226, 0x84}, {0x227, 0x8d}, {0x24d, 0x08}, + {0x250, 0x05}, {0x251, 0xf5}, {0x252, 0x04}, + {0x253, 0xa0}, {0x254, 0x1f}, {0x255, 0x23}, + {0x256, 0x45}, {0x257, 0x67}, {0x258, 0x08}, + {0x259, 0x08}, {0x25a, 0x08}, {0x25b, 0x08}, + {0x260, 0x08}, {0x261, 0x08}, {0x262, 0x08}, + {0x263, 0x08}, {0x264, 0xcf}, {0x272, 0x56}, + {0x273, 0x9a}, {0x034, 0xf0}, {0x035, 0x0f}, + {0x05b, 0x40}, {0x084, 0x88}, {0x085, 0x24}, + {0x088, 0x54}, {0x08b, 0xb8}, {0x08c, 0x07}, + {0x08d, 0x00}, {0x094, 0x1b}, {0x095, 0x12}, + {0x096, 0x00}, {0x097, 0x06}, {0x09d, 0x1a}, + {0x09f, 0x10}, {0x0b4, 0x22}, {0x0be, 0x80}, + {0x0db, 0x00}, {0x0ee, 0x00}, {0x091, 0x03}, + {0x24c, 0x00}, {0x39f, 0x00}, {0x08c, 0x01}, + {0x08d, 0x10}, {0x08e, 0x08}, {0x08f, 0x00} +}; + static struct urtw_pair urtw_8225v2_rf_part2[] = { { 0x00, 0x01 }, { 0x01, 0x02 }, { 0x02, 0x42 }, { 0x03, 0x00 }, { 0x04, 0x00 }, { 0x05, 0x00 }, { 0x06, 0x40 }, { 0x07, 0x00 }, @@ -477,6 +513,7 @@ static const uint8_t urtw_8187b_reg_tabl static usb_callback_t urtw_bulk_rx_callback; static usb_callback_t urtw_bulk_tx_callback; +static usb_callback_t urtw_bulk_tx_status_callback; static const struct usb_config urtw_8187b_usbconfig[URTW_8187B_N_XFERS] = { [URTW_8187B_BULK_RX] = { @@ -491,6 +528,18 @@ static const struct usb_config urtw_8187 }, .callback = urtw_bulk_rx_callback }, + [URTW_8187B_BULK_TX_STATUS] = { + .type = UE_BULK, + .endpoint = 0x89, + .direction = UE_DIR_IN, + .bufsize = MCLBYTES, + .flags = { + .ext_buffer = 1, + .pipe_bof = 1, + .short_xfer_ok = 1 + }, + .callback = urtw_bulk_tx_status_callback + }, [URTW_8187B_BULK_TX_BE] = { .type = UE_BULK, .endpoint = URTW_8187B_TXPIPE_BE, @@ -702,9 +751,6 @@ static usb_error_t urtw_adapter_start(st static usb_error_t urtw_adapter_start_b(struct urtw_softc *); static usb_error_t urtw_set_mode(struct urtw_softc *, uint32_t); static usb_error_t urtw_8187b_cmd_reset(struct urtw_softc *); -static usb_error_t urtw_write16_i(struct urtw_softc *, int, uint16_t, int); -static usb_error_t urtw_write8_i(struct urtw_softc *, int, uint8_t, int); -static usb_error_t urtw_write32_i(struct urtw_softc *, int, uint32_t, int); static usb_error_t urtw_do_request(struct urtw_softc *, struct usb_device_request *, void *); static usb_error_t urtw_8225v2b_set_txpwrlvl(struct urtw_softc *, int); @@ -712,6 +758,10 @@ static usb_error_t urtw_led_off(struct u static void urtw_abort_xfers(struct urtw_softc *); static struct urtw_data * urtw_getbuf(struct urtw_softc *sc); +static int urtw_compute_txtime(uint16_t, uint16_t, uint8_t, + uint8_t); +static void urtw_updateslot(struct ifnet *); +static void urtw_updateslottask(void *, int); static int urtw_match(device_t dev) @@ -756,6 +806,7 @@ urtw_attach(device_t dev) MTX_DEF); usb_callout_init_mtx(&sc->sc_led_ch, &sc->sc_mtx, 0); TASK_INIT(&sc->sc_led_task, 0, urtw_ledtask, sc); + TASK_INIT(&sc->sc_updateslot_task, 0, urtw_updateslottask, sc); callout_init(&sc->sc_watchdog_ch, 0); if (sc->sc_flags & URTW_RTL8187B) { @@ -844,7 +895,7 @@ urtw_attach(device_t dev) ic->ic_scan_start = urtw_scan_start; ic->ic_scan_end = urtw_scan_end; ic->ic_set_channel = urtw_set_channel; - + ic->ic_updateslot = urtw_updateslot; ic->ic_vap_create = urtw_vap_create; ic->ic_vap_delete = urtw_vap_delete; ic->ic_update_mcast = urtw_update_mcast; @@ -877,6 +928,7 @@ urtw_detach(device_t dev) return (0); urtw_stop(ifp, 1); + ieee80211_draintask(ic, &sc->sc_updateslot_task); ieee80211_draintask(ic, &sc->sc_led_task); usb_callout_drain(&sc->sc_led_ch); @@ -1013,6 +1065,9 @@ urtw_init_locked(void *arg) if (error != 0) goto fail; + if (sc->sc_flags & URTW_RTL8187B) + usbd_transfer_start(sc->sc_xfer[URTW_8187B_BULK_TX_STATUS]); + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; ifp->if_drv_flags |= IFF_DRV_RUNNING; @@ -1035,7 +1090,6 @@ static usb_error_t urtw_adapter_start_b(struct urtw_softc *sc) { #define N(a) (sizeof(a) / sizeof((a)[0])) - int i; uint8_t data8; usb_error_t error; @@ -1067,81 +1121,12 @@ urtw_adapter_start_b(struct urtw_softc * if (error) goto fail; - urtw_write16_m(sc, 0x2d, 0xfff); - urtw_read8_m(sc, URTW_CW_CONF, &data8); - urtw_write8_m(sc, URTW_CW_CONF, data8 | URTW_CW_CONF_PERPACKET_RETRY); - urtw_read8_m(sc, URTW_TX_AGC_CTL, &data8); - data8 |= URTW_TX_AGC_CTL_PERPACKET_GAIN | - URTW_TX_AGC_CTL_PERPACKET_ANTSEL; - urtw_write8_m(sc, URTW_TX_AGC_CTL, data8); - - error = urtw_write16_i(sc, 0xe0, 0xfff, 1); - if (error) - goto fail; - - urtw_read8_m(sc, URTW_RATE_FALLBACK, &data8); - urtw_write8_m(sc, URTW_RATE_FALLBACK, data8 | URTW_RATE_FALLBACK_ENABLE); - - urtw_write16_m(sc, URTW_ATIM_WND, 2); - urtw_write16_m(sc, URTW_BEACON_INTERVAL, 100); - error = urtw_write16_i(sc, 0xd4, 0xffff, 1); - if (error) - goto fail; - - error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG); - if (error) - goto fail; - urtw_read8_m(sc, URTW_CONFIG1, &data8); - urtw_write8_m(sc, URTW_CONFIG1, (data8 & 0x3f) | 0x80); - error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); - if (error) - goto fail; - - urtw_write8_m(sc, URTW_WPA_CONFIG, 0); - for (i = 0; i < N(urtw_8187b_reg_table); i++) { - error = urtw_write8_i(sc, urtw_8187b_reg_table[i][0], - urtw_8187b_reg_table[i][1], urtw_8187b_reg_table[i][2]); - if (error) - goto fail; - } - - urtw_write16_m(sc, URTW_TID_AC_MAP, 0xfa50); - urtw_write16_m(sc, URTW_INT_MIG, 0); - - error = urtw_write32_i(sc, 0xf0, 0, 1); - if (error) - goto fail; - error = urtw_write32_i(sc, 0xf4, 0, 1); - if (error) - goto fail; - error = urtw_write8_i(sc, 0xf8, 0, 1); - if (error) - goto fail; - - urtw_write32_m(sc, URTW_RF_TIMING, 0x00004001); - - error = urtw_write16_i(sc, 0x72, 0x569a, 2); - if (error) - goto fail; - - error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG); - if (error) - goto fail; - urtw_read8_m(sc, URTW_CONFIG3, &data8); - urtw_write8_m(sc, URTW_CONFIG3, data8 | URTW_CONFIG3_ANAPARAM_WRITE); - error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); - if (error) - goto fail; - - urtw_write16_m(sc, URTW_RF_PINS_OUTPUT, 0x0480); - urtw_write16_m(sc, URTW_RF_PINS_SELECT, 0x2488); - urtw_write16_m(sc, URTW_RF_PINS_ENABLE, 0x1fff); - usb_pause_mtx(&sc->sc_mtx, 100); - error = sc->sc_rf_init(sc); if (error != 0) goto fail; + urtw_write8_m(sc, URTW_CMD, URTW_CMD_RX_ENABLE | URTW_CMD_TX_ENABLE); + /* fix RTL8187B RX stall */ error = urtw_intr_enable(sc); if (error) goto fail; @@ -1170,42 +1155,21 @@ urtw_adapter_start_b(struct urtw_softc * urtw_read8_m(sc, 0xdb, &data8); urtw_write8_m(sc, 0xdb, data8 | (1 << 2)); - error = urtw_write16_i(sc, 0x72, 0x59fa, 3); - if (error) - goto fail; - error = urtw_write16_i(sc, 0x74, 0x59d2, 3); - if (error) - goto fail; - error = urtw_write16_i(sc, 0x76, 0x59d2, 3); - if (error) - goto fail; - error = urtw_write16_i(sc, 0x78, 0x19fa, 3); - if (error) - goto fail; - error = urtw_write16_i(sc, 0x7a, 0x19fa, 3); - if (error) - goto fail; - error = urtw_write16_i(sc, 0x7c, 0x00d0, 3); - if (error) - goto fail; + urtw_write16_m(sc, 0x372, 0x59fa); + urtw_write16_m(sc, 0x374, 0x59d2); + urtw_write16_m(sc, 0x376, 0x59d2); + urtw_write16_m(sc, 0x378, 0x19fa); + urtw_write16_m(sc, 0x37a, 0x19fa); + urtw_write16_m(sc, 0x37c, 0x00d0); urtw_write8_m(sc, 0x61, 0); - error = urtw_write8_i(sc, 0x80, 0x0f, 1); - if (error) - goto fail; - error = urtw_write8_i(sc, 0x83, 0x03, 1); - if (error) - goto fail; - urtw_write8_m(sc, 0xda, 0x10); - error = urtw_write8_i(sc, 0x4d, 0x08, 2); - if (error) - goto fail; - - urtw_write32_m(sc, URTW_HSSI_PARA, 0x0600321B); - error = urtw_write16_i(sc, 0xec, 0x800, 1); - if (error) - goto fail; + urtw_write8_m(sc, 0x180, 0x0f); + urtw_write8_m(sc, 0x183, 0x03); + urtw_write8_m(sc, 0xda, 0x10); + urtw_write8_m(sc, 0x24d, 0x08); + urtw_write32_m(sc, URTW_HSSI_PARA, 0x0600321b); + urtw_write16_m(sc, 0x1ec, 0x800); /* RX MAX SIZE */ fail: return (error); #undef N @@ -1309,41 +1273,11 @@ urtw_8187b_cmd_reset(struct urtw_softc * device_printf(sc->sc_dev, "reset timeout\n"); goto fail; } - - error = urtw_set_mode(sc, URTW_EPROM_CMD_LOAD); - if (error) - goto fail; - - for (i = 0; i < 20; i++) { - usb_pause_mtx(&sc->sc_mtx, 4); - urtw_read8_m(sc, URTW_EPROM_CMD, &data8); - if (!(data8 & URTW_EPROM_CMD_CONFIG)) - break; - } - if (i >= 20) { - device_printf(sc->sc_dev, "eeprom reset timeout\n"); - goto fail; - } - fail: return (error); } static usb_error_t -urtw_write16_i(struct urtw_softc *sc, int val, uint16_t data, int idx) -{ - struct usb_device_request req; - - req.bmRequestType = UT_WRITE_VENDOR_DEVICE; - req.bRequest = URTW_8187_SETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, idx & 0x3); - USETW(req.wLength, sizeof(uint16_t)); - - return (urtw_do_request(sc, &req, &data)); -} - -static usb_error_t urtw_do_request(struct urtw_softc *sc, struct usb_device_request *req, void *data) { @@ -1366,34 +1300,6 @@ urtw_do_request(struct urtw_softc *sc, return (err); } -static usb_error_t -urtw_write8_i(struct urtw_softc *sc, int val, uint8_t data, int idx) -{ - struct usb_device_request req; - - req.bmRequestType = UT_WRITE_VENDOR_DEVICE; - req.bRequest = URTW_8187_SETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, idx & 0x3); - USETW(req.wLength, sizeof(uint8_t)); - - return (urtw_do_request(sc, &req, &data)); -} - -static usb_error_t -urtw_write32_i(struct urtw_softc *sc, int val, uint32_t data, int idx) -{ - struct usb_device_request req; - - req.bmRequestType = UT_WRITE_VENDOR_DEVICE; - req.bRequest = URTW_8187_SETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, idx & 0x3); - USETW(req.wLength, sizeof(uint32_t)); - - return (urtw_do_request(sc, &req, &data)); -} - static void urtw_stop_locked(struct ifnet *ifp, int disable) { @@ -1533,6 +1439,7 @@ urtw_start(struct ifnet *ifp) } sc->sc_txtimer = 5; + callout_reset(&sc->sc_watchdog_ch, hz, urtw_watchdog, sc); } URTW_UNLOCK(sc); } @@ -1732,14 +1639,12 @@ static int urtw_tx_start(struct urtw_softc *sc, struct ieee80211_node *ni, struct mbuf *m0, struct urtw_data *data, int prior) { - int xferlen; struct ifnet *ifp = sc->sc_ifp; struct ieee80211_frame *wh = mtod(m0, struct ieee80211_frame *); struct ieee80211_key *k; const struct ieee80211_txparam *tp; struct ieee80211com *ic = ifp->if_l2com; struct ieee80211vap *vap = ni->ni_vap; - struct urtw_8187b_txhdr *hdr; struct usb_xfer *rtl8187b_pipes[URTW_8187B_TXPIPE_MAX] = { sc->sc_xfer[URTW_8187B_BULK_TX_BE], sc->sc_xfer[URTW_8187B_BULK_TX_BK], @@ -1747,6 +1652,10 @@ urtw_tx_start(struct urtw_softc *sc, str sc->sc_xfer[URTW_8187B_BULK_TX_VO] }; struct usb_xfer *xfer; + int dur = 0, rtsdur = 0, rtsenable = 0, ctsenable = 0, rate, + pkttime = 0, txdur = 0, isshort = 0, xferlen; + uint16_t acktime, rtstime, ctstime; + uint32_t flags; usb_error_t error; URTW_ASSERT_LOCKED(sc); @@ -1779,60 +1688,107 @@ urtw_tx_start(struct urtw_softc *sc, str ieee80211_radiotap_tx(vap, m0); } + if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_MGT || + (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) { + tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)]; + rate = tp->mgmtrate; + } else { + tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; + /* for data frames */ + if (IEEE80211_IS_MULTICAST(wh->i_addr1)) + rate = tp->mcastrate; + else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) + rate = tp->ucastrate; + else + rate = urtw_rtl2rate(sc->sc_currate); + } + + if (IEEE80211_IS_MULTICAST(wh->i_addr1)) + txdur = pkttime = urtw_compute_txtime(m0->m_pkthdr.len + + IEEE80211_CRC_LEN, rate, 0, 0); + else { + acktime = urtw_compute_txtime(14, 2,0, 0); + if ((m0->m_pkthdr.len + 4) > vap->iv_rtsthreshold) { + rtsenable = 1; + ctsenable = 0; + rtstime = urtw_compute_txtime(URTW_ACKCTS_LEN, 2, 0, 0); + ctstime = urtw_compute_txtime(14, 2, 0, 0); + pkttime = urtw_compute_txtime(m0->m_pkthdr.len + + IEEE80211_CRC_LEN, rate, 0, isshort); + rtsdur = ctstime + pkttime + acktime + + 3 * URTW_ASIFS_TIME; + txdur = rtstime + rtsdur; + } else { + rtsenable = ctsenable = rtsdur = 0; + pkttime = urtw_compute_txtime(m0->m_pkthdr.len + + IEEE80211_CRC_LEN, rate, 0, isshort); + txdur = pkttime + URTW_ASIFS_TIME + acktime; + } + + if (wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG) + dur = urtw_compute_txtime(m0->m_pkthdr.len + + IEEE80211_CRC_LEN, rate, 0, isshort) + + 3 * URTW_ASIFS_TIME + + 2 * acktime; + else + dur = URTW_ASIFS_TIME + acktime; + } + *(uint16_t *)wh->i_dur = htole16(dur); + xferlen = m0->m_pkthdr.len; xferlen += (sc->sc_flags & URTW_RTL8187B) ? (4 * 8) : (4 * 3); if ((0 == xferlen % 64) || (0 == xferlen % 512)) xferlen += 1; bzero(data->buf, URTW_TX_MAXSIZE); - data->buf[0] = m0->m_pkthdr.len & 0xff; - data->buf[1] = (m0->m_pkthdr.len & 0x0f00) >> 8; - data->buf[1] |= (1 << 7); - + flags = m0->m_pkthdr.len & 0xfff; + flags |= URTW_TX_FLAG_NO_ENC; if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) && (ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_PREAMBLE) && (sc->sc_preamble_mode == URTW_PREAMBLE_MODE_SHORT) && (sc->sc_currate != 0)) - data->buf[2] |= 1; - if ((m0->m_pkthdr.len > vap->iv_rtsthreshold) && - prior == URTW_PRIORITY_LOW) { - device_printf(sc->sc_dev, "TODO tx.\n"); - return (EIO); - } + flags |= URTW_TX_FLAG_SPLCP; if (wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG) - data->buf[2] |= (1 << 1); - /* RTS rate - 10 means we use a basic rate. */ - data->buf[2] |= (urtw_rate2rtl(2) << 3); - /* - * XXX currently TX rate control depends on the rate value of - * RX descriptor because I don't know how to we can control TX rate - * in more smart way. Please fix me you find a thing. - */ - data->buf[3] = sc->sc_currate; - if (prior == URTW_PRIORITY_NORMAL) { - tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; - if (IEEE80211_IS_MULTICAST(wh->i_addr1)) - data->buf[3] = urtw_rate2rtl(tp->mcastrate); - else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) - data->buf[3] = urtw_rate2rtl(tp->ucastrate); - } + flags |= URTW_TX_FLAG_MOREFRAG; + + flags |= (sc->sc_currate & 0xf) << URTW_TX_FLAG_TXRATE_SHIFT; if (sc->sc_flags & URTW_RTL8187B) { - hdr = (struct urtw_8187b_txhdr *)data->buf; - hdr->rts_duration = 0; - hdr->len = 0; - hdr->retry = 3 | (7 << 4) | 11; - hdr->tx_duration = ieee80211_compute_duration(ic->ic_rt, - m0->m_pkthdr.len + IEEE80211_CRC_LEN, - urtw_rtl2rate(data->buf[3]), - (ic->ic_flags & IEEE80211_F_SHPREAMBLE) != 0); - /* XXX MUST fill another variables like rts_duration, tx_.. */ - m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)&data->buf[32]); + struct urtw_8187b_txhdr *tx; + + tx = (struct urtw_8187b_txhdr *)data->buf; + if (ctsenable) + flags |= URTW_TX_FLAG_CTS; + if (rtsenable) { + flags |= URTW_TX_FLAG_RTS; + flags |= (urtw_rate2rtl(11) & 0xf) << + URTW_TX_FLAG_RTSRATE_SHIFT; + tx->rtsdur = rtsdur; + } + tx->flag = htole32(flags); + tx->txdur = txdur; + if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == + IEEE80211_FC0_TYPE_MGT && + (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == + IEEE80211_FC0_SUBTYPE_PROBE_RESP) + tx->retry = 1; + else + tx->retry = URTW_TX_MAXRETRY; + m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)(tx + 1)); } else { - data->buf[8] = 3; /* CW minimum */ - data->buf[8] |= (7 << 4); /* CW maximum */ - data->buf[9] |= 11; /* retry limitation */ - m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)&data->buf[12]); + struct urtw_8187l_txhdr *tx; + + tx = (struct urtw_8187l_txhdr *)data->buf; + if (rtsenable) { + flags |= URTW_TX_FLAG_RTS; + tx->rtsdur = rtsdur; + } + flags |= (urtw_rate2rtl(11) & 0xf) << URTW_TX_FLAG_RTSRATE_SHIFT; + tx->flag = htole32(flags); + tx->retry = 3; /* CW minimum */ + tx->retry = 7 << 4; /* CW maximum */ + tx->retry = URTW_TX_MAXRETRY << 8; /* retry limitation */ + m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)(tx + 1)); } data->buflen = xferlen; @@ -2053,8 +2009,8 @@ urtw_read8_c(struct urtw_softc *sc, int req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = URTW_8187_GETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, 0); + USETW(req.wValue, (val & 0xff) | 0xff00); + USETW(req.wIndex, (val >> 8) & 0x3); USETW(req.wLength, sizeof(uint8_t)); error = urtw_do_request(sc, &req, data); @@ -2071,8 +2027,8 @@ urtw_read16_c(struct urtw_softc *sc, int req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = URTW_8187_GETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, 0); + USETW(req.wValue, (val & 0xff) | 0xff00); + USETW(req.wIndex, (val >> 8) & 0x3); USETW(req.wLength, sizeof(uint16_t)); error = urtw_do_request(sc, &req, data); @@ -2089,8 +2045,8 @@ urtw_read32_c(struct urtw_softc *sc, int req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = URTW_8187_GETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, 0); + USETW(req.wValue, (val & 0xff) | 0xff00); + USETW(req.wIndex, (val >> 8) & 0x3); USETW(req.wLength, sizeof(uint32_t)); error = urtw_do_request(sc, &req, data); @@ -2106,8 +2062,8 @@ urtw_write8_c(struct urtw_softc *sc, int req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = URTW_8187_SETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, 0); + USETW(req.wValue, (val & 0xff) | 0xff00); + USETW(req.wIndex, (val >> 8) & 0x3); USETW(req.wLength, sizeof(uint8_t)); return (urtw_do_request(sc, &req, &data)); @@ -2122,8 +2078,8 @@ urtw_write16_c(struct urtw_softc *sc, in req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = URTW_8187_SETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, 0); + USETW(req.wValue, (val & 0xff) | 0xff00); + USETW(req.wIndex, (val >> 8) & 0x3); USETW(req.wLength, sizeof(uint16_t)); return (urtw_do_request(sc, &req, &data)); @@ -2138,8 +2094,8 @@ urtw_write32_c(struct urtw_softc *sc, in req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = URTW_8187_SETREGS_REQ; - USETW(req.wValue, val | 0xff00); - USETW(req.wIndex, 0); + USETW(req.wValue, (val & 0xff) | 0xff00); + USETW(req.wIndex, (val >> 8) & 0x3); USETW(req.wLength, sizeof(uint32_t)); return (urtw_do_request(sc, &req, &data)); @@ -2403,6 +2359,38 @@ urtw_get_rfchip(struct urtw_softc *sc) uint32_t data; usb_error_t error; + if (sc->sc_flags & URTW_RTL8187B) { + urtw_read8_m(sc, 0xe1, &data8); + switch (data8) { + case 0: + sc->sc_flags |= URTW_RTL8187B_REV_B; + break; + case 1: + sc->sc_flags |= URTW_RTL8187B_REV_D; + break; + case 2: + sc->sc_flags |= URTW_RTL8187B_REV_E; + break; + default: + device_printf(sc->sc_dev, "unknown type: %#x\n", data8); + sc->sc_flags |= URTW_RTL8187B_REV_B; + break; + } + } else { + urtw_read32_m(sc, URTW_TX_CONF, &data); + switch (data & URTW_TX_HWMASK) { + case URTW_TX_R8187vD_B: + sc->sc_flags |= URTW_RTL8187B; + break; + case URTW_TX_R8187vD: + break; + default: + device_printf(sc->sc_dev, "unknown RTL8187L type: %#x\n", + data & URTW_TX_HWMASK); + break; + } + } + error = urtw_eprom_read32(sc, URTW_EPROM_RFCHIPID, &data); if (error != 0) goto fail; @@ -2436,12 +2424,6 @@ urtw_get_rfchip(struct urtw_softc *sc) /* never reach */ } - if (sc->sc_flags & URTW_RTL8187B) { - urtw_read8_m(sc, 0xe1, &data8); - sc->sc_flags |= (data8 == 0) ? URTW_RTL8187B_REV_B : - (data8 == 1) ? URTW_RTL8187B_REV_D : URTW_RTL8187B_REV_E; - } - device_printf(sc->sc_dev, "%s rf %s hwrev %s\n", (sc->sc_flags & URTW_RTL8187B) ? "rtl8187b" : "rtl8187l", ((data & 0xff) == URTW_EPROM_RFCHIPID_RTL8225U) ? "rtl8225u" : @@ -2761,8 +2743,6 @@ fail0: return (error); static usb_error_t urtw_8225_rf_set_chan(struct urtw_softc *sc, int chan) { - struct ieee80211com *ic = sc->sc_ifp->if_l2com; - struct ieee80211_channel *c = ic->ic_curchan; usb_error_t error; error = urtw_8225_set_txpwrlvl(sc, chan); @@ -2770,27 +2750,6 @@ urtw_8225_rf_set_chan(struct urtw_softc goto fail; urtw_8225_write(sc, URTW_8225_ADDR_7_MAGIC, urtw_8225_channel[chan]); usb_pause_mtx(&sc->sc_mtx, 10); - - urtw_write8_m(sc, URTW_SIFS, 0x22); - - if (sc->sc_state == IEEE80211_S_ASSOC && - ic->ic_flags & IEEE80211_F_SHSLOT) - urtw_write8_m(sc, URTW_SLOT, 0x9); - else - urtw_write8_m(sc, URTW_SLOT, 0x14); - - if (IEEE80211_IS_CHAN_G(c)) { - /* for G */ - urtw_write8_m(sc, URTW_DIFS, 0x14); - urtw_write8_m(sc, URTW_EIFS, 0x5b - 0x14); - urtw_write8_m(sc, URTW_CW_VAL, 0x73); - } else { - /* for B */ - urtw_write8_m(sc, URTW_DIFS, 0x24); - urtw_write8_m(sc, URTW_EIFS, 0x5b - 0x24); - urtw_write8_m(sc, URTW_CW_VAL, 0xa5); - } - fail: return (error); } @@ -3038,8 +2997,6 @@ fail: static usb_error_t urtw_8225v2_rf_set_chan(struct urtw_softc *sc, int chan) { - struct ieee80211com *ic = sc->sc_ifp->if_l2com; - struct ieee80211_channel *c = ic->ic_curchan; usb_error_t error; error = urtw_8225v2_set_txpwrlvl(sc, chan); @@ -3048,27 +3005,6 @@ urtw_8225v2_rf_set_chan(struct urtw_soft urtw_8225_write(sc, URTW_8225_ADDR_7_MAGIC, urtw_8225_channel[chan]); usb_pause_mtx(&sc->sc_mtx, 10); - - urtw_write8_m(sc, URTW_SIFS, 0x22); - - if(sc->sc_state == IEEE80211_S_ASSOC && - ic->ic_flags & IEEE80211_F_SHSLOT) - urtw_write8_m(sc, URTW_SLOT, 0x9); - else - urtw_write8_m(sc, URTW_SLOT, 0x14); - - if (IEEE80211_IS_CHAN_G(c)) { - /* for G */ - urtw_write8_m(sc, URTW_DIFS, 0x14); - urtw_write8_m(sc, URTW_EIFS, 0x5b - 0x14); - urtw_write8_m(sc, URTW_CW_VAL, 0x73); - } else { - /* for B */ - urtw_write8_m(sc, URTW_DIFS, 0x24); - urtw_write8_m(sc, URTW_EIFS, 0x5b - 0x24); - urtw_write8_m(sc, URTW_CW_VAL, 0xa5); - } - fail: return (error); } @@ -3271,53 +3207,156 @@ urtw_8225v2b_rf_init(struct urtw_softc * { #define N(a) (sizeof(a) / sizeof((a)[0])) int i; + uint8_t data8; usb_error_t error; + error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG); + if (error) + goto fail; + + /* + * initialize extra registers on 8187 + */ + urtw_write16_m(sc, URTW_BRSR_8187B, 0xfff); + + /* retry limit */ + urtw_read8_m(sc, URTW_CW_CONF, &data8); + data8 |= URTW_CW_CONF_PERPACKET_RETRY; + urtw_write8_m(sc, URTW_CW_CONF, data8); + + /* TX AGC */ + urtw_read8_m(sc, URTW_TX_AGC_CTL, &data8); + data8 |= URTW_TX_AGC_CTL_PERPACKET_GAIN; + urtw_write8_m(sc, URTW_TX_AGC_CTL, data8); + + /* Auto Rate Fallback Control */ +#define URTW_ARFR 0x1e0 + urtw_write16_m(sc, URTW_ARFR, 0xfff); + urtw_read8_m(sc, URTW_RATE_FALLBACK, &data8); + urtw_write8_m(sc, URTW_RATE_FALLBACK, + data8 | URTW_RATE_FALLBACK_ENABLE); + + urtw_read8_m(sc, URTW_MSR, &data8); + urtw_write8_m(sc, URTW_MSR, data8 & 0xf3); + urtw_read8_m(sc, URTW_MSR, &data8); + urtw_write8_m(sc, URTW_MSR, data8 | URTW_MSR_LINK_ENEDCA); + urtw_write8_m(sc, URTW_ACM_CONTROL, sc->sc_acmctl); + + urtw_write16_m(sc, URTW_ATIM_WND, 2); + urtw_write16_m(sc, URTW_BEACON_INTERVAL, 100); +#define URTW_FEMR_FOR_8187B 0x1d4 + urtw_write16_m(sc, URTW_FEMR_FOR_8187B, 0xffff); + + /* led type */ + urtw_read8_m(sc, URTW_CONFIG1, &data8); + data8 = (data8 & 0x3f) | 0x80; + urtw_write8_m(sc, URTW_CONFIG1, data8); + + /* applying MAC address again. */ + urtw_write32_m(sc, URTW_MAC0, ((uint32_t *)sc->sc_bssid)[0]); + urtw_write16_m(sc, URTW_MAC4, ((uint32_t *)sc->sc_bssid)[1] & 0xffff); + + error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); + if (error) + goto fail; + + urtw_write8_m(sc, URTW_WPA_CONFIG, 0); + + /* + * MAC configuration + */ for (i = 0; i < N(urtw_8225v2b_rf_part1); i++) - urtw_8225_write(sc, urtw_8225v2b_rf_part1[i].reg, + urtw_write8_m(sc, urtw_8225v2b_rf_part1[i].reg, urtw_8225v2b_rf_part1[i].val); + urtw_write16_m(sc, URTW_TID_AC_MAP, 0xfa50); + urtw_write16_m(sc, URTW_INT_MIG, 0x0000); + urtw_write32_m(sc, 0x1f0, 0); + urtw_write32_m(sc, 0x1f4, 0); + urtw_write8_m(sc, 0x1f8, 0); + urtw_write32_m(sc, URTW_RF_TIMING, 0x4001); - urtw_8225_write(sc, - URTW_8225_ADDR_0_MAGIC, URTW_8225_ADDR_0_DATA_MAGIC1); +#define URTW_RFSW_CTRL 0x272 + urtw_write16_m(sc, URTW_RFSW_CTRL, 0x569a); + + /* + * initialize PHY + */ + error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG); + if (error) + goto fail; + urtw_read8_m(sc, URTW_CONFIG3, &data8); + urtw_write8_m(sc, URTW_CONFIG3, + data8 | URTW_CONFIG3_ANAPARAM_WRITE); - for (i = 0; i < N(urtw_8225v2b_rxgain); i++) { + error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); + if (error) + goto fail; + + /* setup RFE initial timing */ + urtw_write16_m(sc, URTW_RF_PINS_OUTPUT, 0x0480); + urtw_write16_m(sc, URTW_RF_PINS_SELECT, 0x2488); + urtw_write16_m(sc, URTW_RF_PINS_ENABLE, 0x1fff); + usb_pause_mtx(&sc->sc_mtx, 1100); + + for (i = 0; i < N(urtw_8225v2b_rf_part0); i++) { + urtw_8225_write(sc, urtw_8225v2b_rf_part0[i].reg, + urtw_8225v2b_rf_part0[i].val); + usb_pause_mtx(&sc->sc_mtx, 1); + } + urtw_8225_write(sc, 0x00, 0x01b7); + + for (i = 0; i < 95; i++) { urtw_8225_write(sc, URTW_8225_ADDR_1_MAGIC, (uint8_t)(i + 1)); + usb_pause_mtx(&sc->sc_mtx, 1); urtw_8225_write(sc, URTW_8225_ADDR_2_MAGIC, urtw_8225v2b_rxgain[i]); + usb_pause_mtx(&sc->sc_mtx, 1); } urtw_8225_write(sc, URTW_8225_ADDR_3_MAGIC, 0x080); + usb_pause_mtx(&sc->sc_mtx, 1); urtw_8225_write(sc, URTW_8225_ADDR_5_MAGIC, 0x004); + usb_pause_mtx(&sc->sc_mtx, 1); urtw_8225_write(sc, URTW_8225_ADDR_0_MAGIC, 0x0b7); + usb_pause_mtx(&sc->sc_mtx, 1); + usb_pause_mtx(&sc->sc_mtx, 3000); urtw_8225_write(sc, URTW_8225_ADDR_2_MAGIC, 0xc4d); + usb_pause_mtx(&sc->sc_mtx, 2000); urtw_8225_write(sc, URTW_8225_ADDR_2_MAGIC, 0x44d); + usb_pause_mtx(&sc->sc_mtx, 1); urtw_8225_write(sc, URTW_8225_ADDR_0_MAGIC, 0x2bf); + usb_pause_mtx(&sc->sc_mtx, 1); urtw_write8_m(sc, URTW_TX_GAIN_CCK, 0x03); urtw_write8_m(sc, URTW_TX_GAIN_OFDM, 0x07); urtw_write8_m(sc, URTW_TX_ANTENNA, 0x03); urtw_8187_write_phy_ofdm(sc, 0x80, 0x12); - for (i = 0; i < N(urtw_8225z2_agc); i++) { - urtw_8187_write_phy_ofdm(sc, 0xf, urtw_8225z2_agc[i]); - urtw_8187_write_phy_ofdm(sc, 0xe, 0x80 + i); - urtw_8187_write_phy_ofdm(sc, 0xe, 0); + for (i = 0; i < 128; i++) { + uint32_t addr, data; + + data = (urtw_8225z2_agc[i] << 8) | 0x0000008f; + addr = ((i + 0x80) << 8) | 0x0000008e; + + urtw_8187_write_phy_ofdm(sc, data & 0x7f, (data >> 8) & 0xff); + urtw_8187_write_phy_ofdm(sc, addr & 0x7f, (addr >> 8) & 0xff); + urtw_8187_write_phy_ofdm(sc, 0x0e, 0x00); } urtw_8187_write_phy_ofdm(sc, 0x80, 0x10); for (i = 0; i < N(urtw_8225v2b_rf_part2); i++) urtw_8187_write_phy_ofdm(sc, i, urtw_8225v2b_rf_part2[i].val); - urtw_write32_m(sc, 0xf0, (7 << 12) | (3 << 8) | 0x1c); - urtw_write32_m(sc, 0xf4, (7 << 12) | (3 << 8) | 0x1c); - urtw_write32_m(sc, 0xf8, (7 << 12) | (3 << 8) | 0x1c); - urtw_write32_m(sc, 0xfc, (7 << 12) | (3 << 8) | 0x1c); - urtw_write8_m(sc, URTW_ACM_CONTROL, 0); + urtw_write32_m(sc, URTW_8187B_AC_VO, (7 << 12) | (3 << 8) | 0x1c); + urtw_write32_m(sc, URTW_8187B_AC_VI, (7 << 12) | (3 << 8) | 0x1c); + urtw_write32_m(sc, URTW_8187B_AC_BE, (7 << 12) | (3 << 8) | 0x1c); + urtw_write32_m(sc, URTW_8187B_AC_BK, (7 << 12) | (3 << 8) | 0x1c); urtw_8187_write_phy_ofdm(sc, 0x97, 0x46); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 22:31:45 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8F8B106566C; Wed, 9 Dec 2009 22:31:45 +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 D6AFC8FC17; Wed, 9 Dec 2009 22:31:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9MVjgY041535; Wed, 9 Dec 2009 22:31:45 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9MVjmJ041533; Wed, 9 Dec 2009 22:31:45 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092231.nB9MVjmJ041533@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 22:31:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200322 - stable/8/sys/dev/usb/serial X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 22:31:46 -0000 Author: thompsa Date: Wed Dec 9 22:31:45 2009 New Revision: 200322 URL: http://svn.freebsd.org/changeset/base/200322 Log: MFC r198774 Check unit number and provide string name for consdev. Submitted by: HPS Modified: stable/8/sys/dev/usb/serial/usb_serial.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/serial/usb_serial.c ============================================================================== --- stable/8/sys/dev/usb/serial/usb_serial.c Wed Dec 9 22:28:08 2009 (r200321) +++ stable/8/sys/dev/usb/serial/usb_serial.c Wed Dec 9 22:31:45 2009 (r200322) @@ -1300,7 +1300,12 @@ CONSOLE_DRIVER(ucom); static void ucom_cnprobe(struct consdev *cp) { - cp->cn_pri = CN_NORMAL; + if (ucom_cons_unit != -1) + cp->cn_pri = CN_NORMAL; + else + cp->cn_pri = CN_DEAD; + + strlcpy(cp->cn_name, "ucom", sizeof(cp->cn_name)); } static void From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 22:32:37 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FB5A1065695; Wed, 9 Dec 2009 22:32:37 +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 1D5298FC16; Wed, 9 Dec 2009 22:32:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9MWbNk041603; Wed, 9 Dec 2009 22:32:37 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9MWaNB041600; Wed, 9 Dec 2009 22:32:36 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092232.nB9MWaNB041600@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 22:32:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200323 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 22:32:37 -0000 Author: thompsa Date: Wed Dec 9 22:32:36 2009 New Revision: 200323 URL: http://svn.freebsd.org/changeset/base/200323 Log: MFC r198776 - Add usb_fill_bulk_urb() and usb_bulk_msg() linux compat functions [1] - Don't write actual length if the actual length pointer is NULL [2] - correct Linux Compatibility error codes for short isochronous IN transfers and make status field signed. Submitted by: Leunam Elebek [1], Manuel Gebele [2] Modified: stable/8/sys/dev/usb/usb_compat_linux.c stable/8/sys/dev/usb/usb_compat_linux.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/usb_compat_linux.c ============================================================================== --- stable/8/sys/dev/usb/usb_compat_linux.c Wed Dec 9 22:31:45 2009 (r200322) +++ stable/8/sys/dev/usb/usb_compat_linux.c Wed Dec 9 22:32:36 2009 (r200323) @@ -624,10 +624,11 @@ usb_start_wait_urb(struct urb *urb, usb_ done: if (do_unlock) mtx_unlock(&Giant); - if (err) { - *p_actlen = 0; - } else { - *p_actlen = urb->actual_length; + if (p_actlen != NULL) { + if (err) + *p_actlen = 0; + else + *p_actlen = urb->actual_length; } return (err); } @@ -1362,8 +1363,17 @@ usb_linux_isoc_callback(struct usb_xfer for (x = 0; x < urb->number_of_packets; x++) { uipd = urb->iso_frame_desc + x; + if (uipd->length > xfer->frlengths[x]) { + if (urb->transfer_flags & URB_SHORT_NOT_OK) { + /* XXX should be EREMOTEIO */ + uipd->status = -EPIPE; + } else { + uipd->status = 0; + } + } else { + uipd->status = 0; + } uipd->actual_length = xfer->frlengths[x]; - uipd->status = 0; if (!xfer->flags.ext_buffer) { usbd_copy_out(xfer->frbuffers, offset, USB_ADD_BYTES(urb->transfer_buffer, @@ -1385,8 +1395,8 @@ usb_linux_isoc_callback(struct usb_xfer if (xfer->actlen < xfer->sumlen) { /* short transfer */ if (urb->transfer_flags & URB_SHORT_NOT_OK) { - urb->status = -EPIPE; /* XXX should be - * EREMOTEIO */ + /* XXX should be EREMOTEIO */ + urb->status = -EPIPE; } else { urb->status = 0; } @@ -1482,6 +1492,7 @@ tr_setup: /* Set zero for "actual_length" */ for (x = 0; x < urb->number_of_packets; x++) { urb->iso_frame_desc[x].actual_length = 0; + urb->iso_frame_desc[x].status = urb->status; } /* call callback */ @@ -1663,3 +1674,58 @@ setup_bulk: goto tr_setup; } } + +/*------------------------------------------------------------------------* + * usb_fill_bulk_urb + *------------------------------------------------------------------------*/ +void +usb_fill_bulk_urb(struct urb *urb, struct usb_device *udev, + struct usb_host_endpoint *uhe, void *buf, + int length, usb_complete_t callback, void *arg) +{ + urb->dev = udev; + urb->endpoint = uhe; + urb->transfer_buffer = buf; + urb->transfer_buffer_length = length; + urb->complete = callback; + urb->context = arg; +} + +/*------------------------------------------------------------------------* + * usb_bulk_msg + * + * NOTE: This function can also be used for interrupt endpoints! + * + * Return values: + * 0: Success + * Else: Failure + *------------------------------------------------------------------------*/ +int +usb_bulk_msg(struct usb_device *udev, struct usb_host_endpoint *uhe, + void *data, int len, uint16_t *pactlen, usb_timeout_t timeout) +{ + struct urb *urb; + int err; + + if (uhe == NULL) + return (-EINVAL); + if (len < 0) + return (-EINVAL); + + err = usb_setup_endpoint(udev, uhe, 4096 /* bytes */); + if (err) + return (err); + + urb = usb_alloc_urb(0, 0); + if (urb == NULL) + return (-ENOMEM); + + usb_fill_bulk_urb(urb, udev, uhe, data, len, + usb_linux_wait_complete, NULL); + + err = usb_start_wait_urb(urb, timeout, pactlen); + + usb_free_urb(urb); + + return (err); +} Modified: stable/8/sys/dev/usb/usb_compat_linux.h ============================================================================== --- stable/8/sys/dev/usb/usb_compat_linux.h Wed Dec 9 22:31:45 2009 (r200322) +++ stable/8/sys/dev/usb/usb_compat_linux.h Wed Dec 9 22:32:36 2009 (r200323) @@ -217,7 +217,7 @@ struct usb_iso_packet_descriptor { * packets are usually back to back) */ uint16_t length; /* expected length */ uint16_t actual_length; - uint16_t status; + int16_t status; /* transfer status */ }; /* @@ -299,6 +299,11 @@ void usb_set_intfdata(struct usb_interfa void usb_linux_register(void *arg); void usb_linux_deregister(void *arg); +void usb_fill_bulk_urb(struct urb *, struct usb_device *, + struct usb_host_endpoint *, void *, int, usb_complete_t, void *); +int usb_bulk_msg(struct usb_device *, struct usb_host_endpoint *, + void *, int, uint16_t *, usb_timeout_t); + #define interface_to_usbdev(intf) (intf)->linux_udev #define interface_to_bsddev(intf) (intf)->linux_udev From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 22:33:22 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C82FF10656C0; Wed, 9 Dec 2009 22:33:22 +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 B5B978FC0A; Wed, 9 Dec 2009 22:33:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9MXMrZ041688; Wed, 9 Dec 2009 22:33:22 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9MXM3l041684; Wed, 9 Dec 2009 22:33:22 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092233.nB9MXM3l041684@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 22:33:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200324 - stable/8/sys/dev/usb/controller X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 22:33:22 -0000 Author: thompsa Date: Wed Dec 9 22:33:22 2009 New Revision: 200324 URL: http://svn.freebsd.org/changeset/base/200324 Log: MFC r199057 ehci_init() will do reset and set the usbrev flag. Fix problem where ehci_reset() was called before ehci_init(). PR: usb/140242 Submitted by: Sebastian Huber Modified: stable/8/sys/dev/usb/controller/ehci_ixp4xx.c stable/8/sys/dev/usb/controller/ehci_mbus.c stable/8/sys/dev/usb/controller/ehci_pci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci_ixp4xx.c Wed Dec 9 22:32:36 2009 (r200323) +++ stable/8/sys/dev/usb/controller/ehci_ixp4xx.c Wed Dec 9 22:33:22 2009 (r200324) @@ -157,8 +157,6 @@ ehci_ixp_attach(device_t self) return (ENOMEM); } - sc->sc_bus.usbrev = USB_REV_2_0; - /* NB: hints fix the memory location and irq */ rid = 0; @@ -230,7 +228,6 @@ ehci_ixp_attach(device_t self) | EHCI_SCFLG_BIGEMMIO | EHCI_SCFLG_NORESTERM ; - (void) ehci_reset(sc); err = ehci_init(sc); if (!err) { Modified: stable/8/sys/dev/usb/controller/ehci_mbus.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci_mbus.c Wed Dec 9 22:32:36 2009 (r200323) +++ stable/8/sys/dev/usb/controller/ehci_mbus.c Wed Dec 9 22:33:22 2009 (r200324) @@ -166,8 +166,6 @@ ehci_mbus_attach(device_t self) return (ENOMEM); } - sc->sc_bus.usbrev = USB_REV_2_0; - rid = 0; sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (!sc->sc_io_res) { Modified: stable/8/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci_pci.c Wed Dec 9 22:32:36 2009 (r200323) +++ stable/8/sys/dev/usb/controller/ehci_pci.c Wed Dec 9 22:33:22 2009 (r200324) @@ -318,13 +318,11 @@ ehci_pci_attach(device_t self) device_printf(self, "pre-2.0 USB revision (ignored)\n"); /* fallthrough */ case PCI_USB_REV_2_0: - sc->sc_bus.usbrev = USB_REV_2_0; break; default: /* Quirk for Parallels Desktop 4.0 */ device_printf(self, "USB revision is unknown. Assuming v2.0.\n"); - sc->sc_bus.usbrev = USB_REV_2_0; - break; + break; } rid = PCI_CBMEM; From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 22:34:12 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BDA7106568B; Wed, 9 Dec 2009 22:34:12 +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 ED4268FC1E; Wed, 9 Dec 2009 22:34:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9MYBUW041757; Wed, 9 Dec 2009 22:34:11 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9MYBqS041752; Wed, 9 Dec 2009 22:34:11 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092234.nB9MYBqS041752@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 22:34:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200325 - in stable/8/sys/dev/usb: . controller X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 22:34:12 -0000 Author: thompsa Date: Wed Dec 9 22:34:11 2009 New Revision: 200325 URL: http://svn.freebsd.org/changeset/base/200325 Log: MFC r199059 improve support for high speed isochronous endpoints which does not run 1:1, but needs intervalling 1:2, 1:4 or 1:8 Submitted by: Hans Petter Selasky Modified: stable/8/sys/dev/usb/controller/ehci.c stable/8/sys/dev/usb/usb_core.h stable/8/sys/dev/usb/usb_transfer.c stable/8/sys/dev/usb/usbdi.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/controller/ehci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci.c Wed Dec 9 22:33:22 2009 (r200324) +++ stable/8/sys/dev/usb/controller/ehci.c Wed Dec 9 22:34:11 2009 (r200325) @@ -2140,7 +2140,7 @@ ehci_isoc_hs_done(ehci_softc_t *sc, stru DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n", xfer, xfer->endpoint); - while (nframes--) { + while (nframes) { if (td == NULL) { panic("%s:%d: out of TD's\n", __FUNCTION__, __LINE__); @@ -2162,21 +2162,26 @@ ehci_isoc_hs_done(ehci_softc_t *sc, stru DPRINTFN(2, "status=0x%08x, len=%u\n", status, len); - if (*plen >= len) { - /* - * The length is valid. NOTE: The complete - * length is written back into the status - * field, and not the remainder like with - * other transfer descriptor types. - */ - } else { - /* Invalid length - truncate */ - len = 0; - } + if (xfer->usb_smask & (1 << td_no)) { - *plen = len; + if (*plen >= len) { + /* + * The length is valid. NOTE: The + * complete length is written back + * into the status field, and not the + * remainder like with other transfer + * descriptor types. + */ + } else { + /* Invalid length - truncate */ + len = 0; + } + + *plen = len; + plen++; + nframes--; + } - plen++; td_no++; if ((td_no == 8) || (nframes == 0)) { @@ -2393,10 +2398,9 @@ static void ehci_device_intr_close(struct usb_xfer *xfer) { ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); - uint8_t slot; - slot = usb_intr_schedule_adjust - (xfer->xroot->udev, -(xfer->max_frame_size), xfer->usb_uframe); + usb_intr_schedule_adjust(xfer->xroot->udev, + -(xfer->max_frame_size), xfer->usb_uframe); sc->sc_intr_stat[xfer->qh_pos]--; @@ -2722,6 +2726,28 @@ ehci_device_isoc_hs_open(struct usb_xfer ehci_itd_t *td; uint32_t temp; uint8_t ds; + uint8_t slot; + + slot = usb_intr_schedule_adjust(xfer->xroot->udev, xfer->max_frame_size, + USB_HS_MICRO_FRAMES_MAX); + + xfer->usb_uframe = slot; + xfer->usb_cmask = 0; + + switch (usbd_xfer_get_fps_shift(xfer)) { + case 0: + xfer->usb_smask = 0xFF; + break; + case 1: + xfer->usb_smask = 0x55 << (slot & 1); + break; + case 2: + xfer->usb_smask = 0x11 << (slot & 3); + break; + default: + xfer->usb_smask = 0x01 << (slot & 7); + break; + } /* initialize all TD's */ @@ -2765,6 +2791,10 @@ ehci_device_isoc_hs_open(struct usb_xfer static void ehci_device_isoc_hs_close(struct usb_xfer *xfer) { + + usb_intr_schedule_adjust(xfer->xroot->udev, + -(xfer->max_frame_size), xfer->usb_uframe); + ehci_device_done(xfer, USB_ERR_CANCELLED); } @@ -2854,7 +2884,7 @@ ehci_device_isoc_hs_enter(struct usb_xfe xfer->qh_pos = xfer->endpoint->isoc_next; - while (nframes--) { + while (nframes) { if (td == NULL) { panic("%s:%d: out of TD's\n", __FUNCTION__, __LINE__); @@ -2874,13 +2904,21 @@ ehci_device_isoc_hs_enter(struct usb_xfe #endif *plen = xfer->max_frame_size; } - status = (EHCI_ITD_SET_LEN(*plen) | - EHCI_ITD_ACTIVE | - EHCI_ITD_SET_PG(0)); - td->itd_status[td_no] = htohc32(sc, status); - itd_offset[td_no] = buf_offset; - buf_offset += *plen; - plen++; + + if (xfer->usb_smask & (1 << td_no)) { + status = (EHCI_ITD_SET_LEN(*plen) | + EHCI_ITD_ACTIVE | + EHCI_ITD_SET_PG(0)); + td->itd_status[td_no] = htohc32(sc, status); + itd_offset[td_no] = buf_offset; + buf_offset += *plen; + plen++; + nframes --; + } else { + td->itd_status[td_no] = 0; /* not active */ + itd_offset[td_no] = buf_offset; + } + td_no++; if ((td_no == 8) || (nframes == 0)) { @@ -2937,7 +2975,7 @@ ehci_device_isoc_hs_enter(struct usb_xfe } /* set IOC bit if we are complete */ if (nframes == 0) { - td->itd_status[7] |= htohc32(sc, EHCI_ITD_IOC); + td->itd_status[td_no - 1] |= htohc32(sc, EHCI_ITD_IOC); } usb_pc_cpu_flush(td->page_cache); #if USB_DEBUG @@ -3583,7 +3621,8 @@ ehci_xfer_setup(struct usb_setup_params usbd_transfer_setup_sub(parm); - nitd = (xfer->nframes + 7) / 8; + nitd = ((xfer->nframes + 7) / 8) << + usbd_xfer_get_fps_shift(xfer); } else { Modified: stable/8/sys/dev/usb/usb_core.h ============================================================================== --- stable/8/sys/dev/usb/usb_core.h Wed Dec 9 22:33:22 2009 (r200324) +++ stable/8/sys/dev/usb/usb_core.h Wed Dec 9 22:34:11 2009 (r200325) @@ -165,6 +165,7 @@ struct usb_xfer { uint8_t usb_cmask; uint8_t usb_uframe; uint8_t usb_state; + uint8_t fps_shift; /* down shift of FPS, 0..3 */ usb_error_t error; Modified: stable/8/sys/dev/usb/usb_transfer.c ============================================================================== --- stable/8/sys/dev/usb/usb_transfer.c Wed Dec 9 22:33:22 2009 (r200324) +++ stable/8/sys/dev/usb/usb_transfer.c Wed Dec 9 22:34:11 2009 (r200325) @@ -416,9 +416,15 @@ usbd_transfer_setup_sub(struct usb_setup case USB_SPEED_LOW: case USB_SPEED_FULL: frame_limit = USB_MAX_FS_ISOC_FRAMES_PER_XFER; + xfer->fps_shift = 0; break; default: frame_limit = USB_MAX_HS_ISOC_FRAMES_PER_XFER; + xfer->fps_shift = edesc->bInterval; + if (xfer->fps_shift > 0) + xfer->fps_shift--; + if (xfer->fps_shift > 3) + xfer->fps_shift = 3; break; } @@ -1826,6 +1832,23 @@ usbd_xfer_get_frame(struct usb_xfer *xfe return (&xfer->frbuffers[frindex]); } +/*------------------------------------------------------------------------* + * usbd_xfer_get_fps_shift + * + * The following function is only useful for isochronous transfers. It + * returns how many times the frame execution rate has been shifted + * down. + * + * Return value: + * Success: 0..3 + * Failure: 0 + *------------------------------------------------------------------------*/ +uint8_t +usbd_xfer_get_fps_shift(struct usb_xfer *xfer) +{ + return (xfer->fps_shift); +} + usb_frlength_t usbd_xfer_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex) { Modified: stable/8/sys/dev/usb/usbdi.h ============================================================================== --- stable/8/sys/dev/usb/usbdi.h Wed Dec 9 22:33:22 2009 (r200324) +++ stable/8/sys/dev/usb/usbdi.h Wed Dec 9 22:34:11 2009 (r200325) @@ -478,6 +478,7 @@ void usbd_xfer_set_frame_offset(struct u usb_frlength_t usbd_xfer_max_len(struct usb_xfer *xfer); usb_frlength_t usbd_xfer_max_framelen(struct usb_xfer *xfer); usb_frcount_t usbd_xfer_max_frames(struct usb_xfer *xfer); +uint8_t usbd_xfer_get_fps_shift(struct usb_xfer *xfer); usb_frlength_t usbd_xfer_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex); void usbd_xfer_set_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex, From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 22:35:08 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 633EB10656A4; Wed, 9 Dec 2009 22:35:08 +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 515D88FC14; Wed, 9 Dec 2009 22:35:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9MZ8PR041830; Wed, 9 Dec 2009 22:35:08 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9MZ84B041828; Wed, 9 Dec 2009 22:35:08 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092235.nB9MZ84B041828@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 22:35:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200326 - stable/8/sys/dev/usb/storage X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 22:35:08 -0000 Author: thompsa Date: Wed Dec 9 22:35:08 2009 New Revision: 200326 URL: http://svn.freebsd.org/changeset/base/200326 Log: MFC r199061 Add missing mtx_destroy(). Submitted by: Sebastian Huber Modified: stable/8/sys/dev/usb/storage/umass.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/storage/umass.c ============================================================================== --- stable/8/sys/dev/usb/storage/umass.c Wed Dec 9 22:34:11 2009 (r200325) +++ stable/8/sys/dev/usb/storage/umass.c Wed Dec 9 22:35:08 2009 (r200326) @@ -1669,6 +1669,7 @@ umass_detach(device_t dev) #if (__FreeBSD_version >= 700037) mtx_unlock(&sc->sc_mtx); #endif + mtx_destroy(&sc->sc_mtx); return (0); /* success */ } From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 22:36:16 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AA2C1065670; Wed, 9 Dec 2009 22:36:16 +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 58B248FC0A; Wed, 9 Dec 2009 22:36:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9MaGJo041898; Wed, 9 Dec 2009 22:36:16 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9MaGCn041896; Wed, 9 Dec 2009 22:36:16 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092236.nB9MaGCn041896@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 22:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200327 - stable/8/sys/dev/usb/storage X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 22:36:16 -0000 Author: thompsa Date: Wed Dec 9 22:36:16 2009 New Revision: 200327 URL: http://svn.freebsd.org/changeset/base/200327 Log: MFC r199062 Correct Olympus quirk. Submitted by: Pavel Gubin Modified: stable/8/sys/dev/usb/storage/umass.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/storage/umass.c ============================================================================== --- stable/8/sys/dev/usb/storage/umass.c Wed Dec 9 22:35:08 2009 (r200326) +++ stable/8/sys/dev/usb/storage/umass.c Wed Dec 9 22:36:16 2009 (r200327) @@ -679,7 +679,7 @@ static const struct umass_devdescr umass WRONG_CSWSIG }, {USB_VENDOR_OLYMPUS, USB_PRODUCT_OLYMPUS_C700, RID_WILDCARD, - UMASS_PROTO_SCSI, + UMASS_PROTO_DEFAULT, NO_GETMAXLUN }, {USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_SDS_HOTFIND_D, RID_WILDCARD, From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 22:37:06 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 655721065692; Wed, 9 Dec 2009 22:37:06 +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 5245A8FC08; Wed, 9 Dec 2009 22:37:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9Mb6qM041976; Wed, 9 Dec 2009 22:37:06 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9Mb61k041968; Wed, 9 Dec 2009 22:37:06 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092237.nB9Mb61k041968@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 22:37:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200328 - in stable/8/sys/dev/usb: . controller X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 22:37:06 -0000 Author: thompsa Date: Wed Dec 9 22:37:06 2009 New Revision: 200328 URL: http://svn.freebsd.org/changeset/base/200328 Log: MFC r199672 Improve High Speed slot allocation mechanism by moving the computation to the endpoint rather than per xfer and provide functions around get/free of resources. Submitted by: Hans Petter Selasky Modified: stable/8/sys/dev/usb/controller/ehci.c stable/8/sys/dev/usb/usb_core.h stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_hub.c stable/8/sys/dev/usb/usb_hub.h stable/8/sys/dev/usb/usb_transfer.c stable/8/sys/dev/usb/usbdi.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/controller/ehci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci.c Wed Dec 9 22:36:16 2009 (r200327) +++ stable/8/sys/dev/usb/controller/ehci.c Wed Dec 9 22:37:06 2009 (r200328) @@ -2016,8 +2016,8 @@ ehci_setup_standard_chain(struct usb_xfe qh_endphub = (EHCI_QH_SET_MULT(xfer->max_packet_count & 3) | - EHCI_QH_SET_CMASK(xfer->usb_cmask) | - EHCI_QH_SET_SMASK(xfer->usb_smask) | + EHCI_QH_SET_CMASK(xfer->endpoint->usb_cmask) | + EHCI_QH_SET_SMASK(xfer->endpoint->usb_smask) | EHCI_QH_SET_HUBA(xfer->xroot->udev->hs_hub_addr) | EHCI_QH_SET_PORT(xfer->xroot->udev->hs_port_no)); @@ -2162,7 +2162,7 @@ ehci_isoc_hs_done(ehci_softc_t *sc, stru DPRINTFN(2, "status=0x%08x, len=%u\n", status, len); - if (xfer->usb_smask & (1 << td_no)) { + if (xfer->endpoint->usb_smask & (1 << td_no)) { if (*plen >= len) { /* @@ -2348,22 +2348,8 @@ ehci_device_intr_open(struct usb_xfer *x uint16_t best; uint16_t bit; uint16_t x; - uint8_t slot; - /* Allocate a microframe slot first: */ - - slot = usb_intr_schedule_adjust - (xfer->xroot->udev, xfer->max_frame_size, USB_HS_MICRO_FRAMES_MAX); - - if (usbd_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) { - xfer->usb_uframe = slot; - xfer->usb_smask = (1 << slot) & 0xFF; - xfer->usb_cmask = 0; - } else { - xfer->usb_uframe = slot; - xfer->usb_smask = (1 << slot) & 0x3F; - xfer->usb_cmask = (-(4 << slot)) & 0xFE; - } + usb_hs_bandwidth_alloc(xfer); /* * Find the best QH position corresponding to the given interval: @@ -2399,12 +2385,12 @@ ehci_device_intr_close(struct usb_xfer * { ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); - usb_intr_schedule_adjust(xfer->xroot->udev, - -(xfer->max_frame_size), xfer->usb_uframe); - sc->sc_intr_stat[xfer->qh_pos]--; ehci_device_done(xfer, USB_ERR_CANCELLED); + + /* bandwidth must be freed after device done */ + usb_hs_bandwidth_free(xfer); } static void @@ -2726,28 +2712,8 @@ ehci_device_isoc_hs_open(struct usb_xfer ehci_itd_t *td; uint32_t temp; uint8_t ds; - uint8_t slot; - - slot = usb_intr_schedule_adjust(xfer->xroot->udev, xfer->max_frame_size, - USB_HS_MICRO_FRAMES_MAX); - xfer->usb_uframe = slot; - xfer->usb_cmask = 0; - - switch (usbd_xfer_get_fps_shift(xfer)) { - case 0: - xfer->usb_smask = 0xFF; - break; - case 1: - xfer->usb_smask = 0x55 << (slot & 1); - break; - case 2: - xfer->usb_smask = 0x11 << (slot & 3); - break; - default: - xfer->usb_smask = 0x01 << (slot & 7); - break; - } + usb_hs_bandwidth_alloc(xfer); /* initialize all TD's */ @@ -2791,11 +2757,10 @@ ehci_device_isoc_hs_open(struct usb_xfer static void ehci_device_isoc_hs_close(struct usb_xfer *xfer) { - - usb_intr_schedule_adjust(xfer->xroot->udev, - -(xfer->max_frame_size), xfer->usb_uframe); - ehci_device_done(xfer, USB_ERR_CANCELLED); + + /* bandwidth must be freed after device done */ + usb_hs_bandwidth_free(xfer); } static void @@ -2905,7 +2870,7 @@ ehci_device_isoc_hs_enter(struct usb_xfe *plen = xfer->max_frame_size; } - if (xfer->usb_smask & (1 << td_no)) { + if (xfer->endpoint->usb_smask & (1 << td_no)) { status = (EHCI_ITD_SET_LEN(*plen) | EHCI_ITD_ACTIVE | EHCI_ITD_SET_PG(0)); Modified: stable/8/sys/dev/usb/usb_core.h ============================================================================== --- stable/8/sys/dev/usb/usb_core.h Wed Dec 9 22:36:16 2009 (r200327) +++ stable/8/sys/dev/usb/usb_core.h Wed Dec 9 22:37:06 2009 (r200328) @@ -161,9 +161,6 @@ struct usb_xfer { uint8_t address; /* physical USB address */ uint8_t endpointno; /* physical USB endpoint */ uint8_t max_packet_count; - uint8_t usb_smask; - uint8_t usb_cmask; - uint8_t usb_uframe; uint8_t usb_state; uint8_t fps_shift; /* down shift of FPS, 0..3 */ Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Wed Dec 9 22:36:16 2009 (r200327) +++ stable/8/sys/dev/usb/usb_device.c Wed Dec 9 22:37:06 2009 (r200328) @@ -665,7 +665,7 @@ usb_config_parse(struct usb_device *udev /* look for matching endpoints */ if ((iface_index == USB_IFACE_INDEX_ANY) || (iface_index == ep->iface_index)) { - if (ep->refcount != 0) { + if (ep->refcount_alloc != 0) { /* * This typically indicates a * more serious error. Modified: stable/8/sys/dev/usb/usb_hub.c ============================================================================== --- stable/8/sys/dev/usb/usb_hub.c Wed Dec 9 22:36:16 2009 (r200327) +++ stable/8/sys/dev/usb/usb_hub.c Wed Dec 9 22:37:06 2009 (r200328) @@ -1106,43 +1106,62 @@ done: * The best Transaction Translation slot for an interrupt endpoint. *------------------------------------------------------------------------*/ static uint8_t -usb_intr_find_best_slot(usb_size_t *ptr, uint8_t start, uint8_t end) +usb_intr_find_best_slot(usb_size_t *ptr, uint8_t start, + uint8_t end, uint8_t mask) { - usb_size_t max = 0 - 1; + usb_size_t min = 0 - 1; + usb_size_t sum; uint8_t x; uint8_t y; + uint8_t z; y = 0; /* find the last slot with lesser used bandwidth */ for (x = start; x < end; x++) { - if (max >= ptr[x]) { - max = ptr[x]; + + sum = 0; + + /* compute sum of bandwidth */ + for (z = x; z < end; z++) { + if (mask & (1U << (z - x))) + sum += ptr[z]; + } + + /* check if the current multi-slot is more optimal */ + if (min >= sum) { + min = sum; y = x; } + + /* check if the mask is about to be shifted out */ + if (mask & (1U << (end - 1 - x))) + break; } return (y); } /*------------------------------------------------------------------------* - * usb_intr_schedule_adjust + * usb_hs_bandwidth_adjust * * This function will update the bandwith usage for the microframe * having index "slot" by "len" bytes. "len" can be negative. If the * "slot" argument is greater or equal to "USB_HS_MICRO_FRAMES_MAX" * the "slot" argument will be replaced by the slot having least used - * bandwidth. + * bandwidth. The "mask" argument is used for multi-slot allocations. * * Returns: - * The slot on which the bandwidth update was done. + * The slot in which the bandwidth update was done: 0..7 *------------------------------------------------------------------------*/ -uint8_t -usb_intr_schedule_adjust(struct usb_device *udev, int16_t len, uint8_t slot) +static uint8_t +usb_hs_bandwidth_adjust(struct usb_device *udev, int16_t len, + uint8_t slot, uint8_t mask) { struct usb_bus *bus = udev->bus; struct usb_hub *hub; enum usb_dev_speed speed; + uint8_t x; USB_BUS_LOCK_ASSERT(bus, MA_OWNED); @@ -1164,23 +1183,157 @@ usb_intr_schedule_adjust(struct usb_devi hub = udev->parent_hs_hub->hub; if (slot >= USB_HS_MICRO_FRAMES_MAX) { slot = usb_intr_find_best_slot(hub->uframe_usage, - USB_FS_ISOC_UFRAME_MAX, 6); + USB_FS_ISOC_UFRAME_MAX, 6, mask); + } + for (x = slot; x < 8; x++) { + if (mask & (1U << (x - slot))) { + hub->uframe_usage[x] += len; + bus->uframe_usage[x] += len; + } } - hub->uframe_usage[slot] += len; - bus->uframe_usage[slot] += len; break; default: if (slot >= USB_HS_MICRO_FRAMES_MAX) { slot = usb_intr_find_best_slot(bus->uframe_usage, 0, - USB_HS_MICRO_FRAMES_MAX); + USB_HS_MICRO_FRAMES_MAX, mask); + } + for (x = slot; x < 8; x++) { + if (mask & (1U << (x - slot))) { + bus->uframe_usage[x] += len; + } } - bus->uframe_usage[slot] += len; break; } return (slot); } /*------------------------------------------------------------------------* + * usb_hs_bandwidth_alloc + * + * This function is a wrapper function for "usb_hs_bandwidth_adjust()". + *------------------------------------------------------------------------*/ +void +usb_hs_bandwidth_alloc(struct usb_xfer *xfer) +{ + struct usb_device *udev; + uint8_t slot; + uint8_t mask; + uint8_t speed; + + udev = xfer->xroot->udev; + + if (udev->flags.usb_mode != USB_MODE_HOST) + return; /* not supported */ + + xfer->endpoint->refcount_bw++; + if (xfer->endpoint->refcount_bw != 1) + return; /* already allocated */ + + speed = usbd_get_speed(udev); + + switch (xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) { + case UE_INTERRUPT: + /* allocate a microframe slot */ + + mask = 0x01; + slot = usb_hs_bandwidth_adjust(udev, + xfer->max_frame_size, USB_HS_MICRO_FRAMES_MAX, mask); + + xfer->endpoint->usb_uframe = slot; + xfer->endpoint->usb_smask = mask << slot; + + if ((speed != USB_SPEED_FULL) && + (speed != USB_SPEED_LOW)) { + xfer->endpoint->usb_cmask = 0x00 ; + } else { + xfer->endpoint->usb_cmask = (-(0x04 << slot)) & 0xFE; + } + break; + + case UE_ISOCHRONOUS: + switch (usbd_xfer_get_fps_shift(xfer)) { + case 0: + mask = 0xFF; + break; + case 1: + mask = 0x55; + break; + case 2: + mask = 0x11; + break; + default: + mask = 0x01; + break; + } + + /* allocate a microframe multi-slot */ + + slot = usb_hs_bandwidth_adjust(udev, + xfer->max_frame_size, USB_HS_MICRO_FRAMES_MAX, mask); + + xfer->endpoint->usb_uframe = slot; + xfer->endpoint->usb_cmask = 0; + xfer->endpoint->usb_smask = mask << slot; + break; + + default: + xfer->endpoint->usb_uframe = 0; + xfer->endpoint->usb_cmask = 0; + xfer->endpoint->usb_smask = 0; + break; + } + + DPRINTFN(11, "slot=%d, mask=0x%02x\n", + xfer->endpoint->usb_uframe, + xfer->endpoint->usb_smask >> xfer->endpoint->usb_uframe); +} + +/*------------------------------------------------------------------------* + * usb_hs_bandwidth_free + * + * This function is a wrapper function for "usb_hs_bandwidth_adjust()". + *------------------------------------------------------------------------*/ +void +usb_hs_bandwidth_free(struct usb_xfer *xfer) +{ + struct usb_device *udev; + uint8_t slot; + uint8_t mask; + + udev = xfer->xroot->udev; + + if (udev->flags.usb_mode != USB_MODE_HOST) + return; /* not supported */ + + xfer->endpoint->refcount_bw--; + if (xfer->endpoint->refcount_bw != 0) + return; /* still allocated */ + + switch (xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) { + case UE_INTERRUPT: + case UE_ISOCHRONOUS: + + slot = xfer->endpoint->usb_uframe; + mask = xfer->endpoint->usb_smask; + + /* free microframe slot(s): */ + usb_hs_bandwidth_adjust(udev, + -xfer->max_frame_size, slot, mask >> slot); + + DPRINTFN(11, "slot=%d, mask=0x%02x\n", + slot, mask >> slot); + + xfer->endpoint->usb_uframe = 0; + xfer->endpoint->usb_cmask = 0; + xfer->endpoint->usb_smask = 0; + break; + + default: + break; + } +} + +/*------------------------------------------------------------------------* * usbd_fs_isoc_schedule_init_sub * * This function initialises an USB FULL speed isochronous schedule Modified: stable/8/sys/dev/usb/usb_hub.h ============================================================================== --- stable/8/sys/dev/usb/usb_hub.h Wed Dec 9 22:36:16 2009 (r200327) +++ stable/8/sys/dev/usb/usb_hub.h Wed Dec 9 22:37:06 2009 (r200328) @@ -66,8 +66,8 @@ struct usb_hub { /* function prototypes */ -uint8_t usb_intr_schedule_adjust(struct usb_device *udev, int16_t len, - uint8_t slot); +void usb_hs_bandwidth_alloc(struct usb_xfer *xfer); +void usb_hs_bandwidth_free(struct usb_xfer *xfer); void usbd_fs_isoc_schedule_init_all(struct usb_fs_isoc_schedule *fss); void usb_bus_port_set_device(struct usb_bus *bus, struct usb_port *up, struct usb_device *udev, uint8_t device_index); Modified: stable/8/sys/dev/usb/usb_transfer.c ============================================================================== --- stable/8/sys/dev/usb/usb_transfer.c Wed Dec 9 22:36:16 2009 (r200327) +++ stable/8/sys/dev/usb/usb_transfer.c Wed Dec 9 22:37:06 2009 (r200328) @@ -942,10 +942,18 @@ usbd_transfer_setup(struct usb_device *u * configuration and alternate setting * when USB transfers are in use on * the given interface. Search the USB - * code for "endpoint->refcount" if you + * code for "endpoint->refcount_alloc" if you * want more information. */ - xfer->endpoint->refcount++; + USB_BUS_LOCK(info->bus); + if (xfer->endpoint->refcount_alloc >= USB_EP_REF_MAX) + parm.err = USB_ERR_INVAL; + + xfer->endpoint->refcount_alloc++; + + if (xfer->endpoint->refcount_alloc == 0) + panic("usbd_transfer_setup(): Refcount wrapped to zero\n"); + USB_BUS_UNLOCK(info->bus); /* * Whenever we set ppxfer[] then we @@ -960,6 +968,10 @@ usbd_transfer_setup(struct usb_device *u */ ppxfer[n] = xfer; } + + /* check for error */ + if (parm.err) + goto done; } if (buf || parm.err) { @@ -1179,7 +1191,9 @@ usbd_transfer_unsetup(struct usb_xfer ** * NOTE: default endpoint does not have an * interface, even if endpoint->iface_index == 0 */ - xfer->endpoint->refcount--; + USB_BUS_LOCK(info->bus); + xfer->endpoint->refcount_alloc--; + USB_BUS_UNLOCK(info->bus); usb_callout_drain(&xfer->timeout_handle); Modified: stable/8/sys/dev/usb/usbdi.h ============================================================================== --- stable/8/sys/dev/usb/usbdi.h Wed Dec 9 22:36:16 2009 (r200327) +++ stable/8/sys/dev/usb/usbdi.h Wed Dec 9 22:37:06 2009 (r200328) @@ -130,13 +130,22 @@ struct usb_endpoint { struct usb_pipe_methods *methods; /* set by HC driver */ uint16_t isoc_next; - uint16_t refcount; uint8_t toggle_next:1; /* next data toggle value */ uint8_t is_stalled:1; /* set if endpoint is stalled */ uint8_t is_synced:1; /* set if we a synchronised */ uint8_t unused:5; uint8_t iface_index; /* not used by "default endpoint" */ + + uint8_t refcount_alloc; /* allocation refcount */ + uint8_t refcount_bw; /* bandwidth refcount */ +#define USB_EP_REF_MAX 0x3f + + /* High-Speed resource allocation (valid if "refcount_bw" > 0) */ + + uint8_t usb_smask; /* USB start mask */ + uint8_t usb_cmask; /* USB complete mask */ + uint8_t usb_uframe; /* USB microframe */ }; /* From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 22:38:03 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58CAA106568F; Wed, 9 Dec 2009 22:38:03 +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 3D5738FC15; Wed, 9 Dec 2009 22:38:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9Mc37C042045; Wed, 9 Dec 2009 22:38:03 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9Mc3vO042039; Wed, 9 Dec 2009 22:38:03 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092238.nB9Mc3vO042039@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 22:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200329 - stable/8/sys/dev/usb/controller X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 22:38:03 -0000 Author: thompsa Date: Wed Dec 9 22:38:02 2009 New Revision: 200329 URL: http://svn.freebsd.org/changeset/base/200329 Log: MFC r199673 Initialise variable before use. Submitted by: Hans Petter Selasky Modified: stable/8/sys/dev/usb/controller/at91dci.c stable/8/sys/dev/usb/controller/atmegadci.c stable/8/sys/dev/usb/controller/avr32dci.c stable/8/sys/dev/usb/controller/musb_otg.c stable/8/sys/dev/usb/controller/uss820dci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/controller/at91dci.c ============================================================================== --- stable/8/sys/dev/usb/controller/at91dci.c Wed Dec 9 22:37:06 2009 (r200328) +++ stable/8/sys/dev/usb/controller/at91dci.c Wed Dec 9 22:38:02 2009 (r200329) @@ -894,6 +894,7 @@ at91dci_setup_standard_chain(struct usb_ /* setup temp */ + temp.pc = NULL; temp.td = NULL; temp.td_next = xfer->td_start[0]; temp.offset = 0; Modified: stable/8/sys/dev/usb/controller/atmegadci.c ============================================================================== --- stable/8/sys/dev/usb/controller/atmegadci.c Wed Dec 9 22:37:06 2009 (r200328) +++ stable/8/sys/dev/usb/controller/atmegadci.c Wed Dec 9 22:38:02 2009 (r200329) @@ -797,6 +797,7 @@ atmegadci_setup_standard_chain(struct us /* setup temp */ + temp.pc = NULL; temp.td = NULL; temp.td_next = xfer->td_start[0]; temp.offset = 0; Modified: stable/8/sys/dev/usb/controller/avr32dci.c ============================================================================== --- stable/8/sys/dev/usb/controller/avr32dci.c Wed Dec 9 22:37:06 2009 (r200328) +++ stable/8/sys/dev/usb/controller/avr32dci.c Wed Dec 9 22:38:02 2009 (r200329) @@ -767,6 +767,7 @@ avr32dci_setup_standard_chain(struct usb /* setup temp */ + temp.pc = NULL; temp.td = NULL; temp.td_next = xfer->td_start[0]; temp.offset = 0; Modified: stable/8/sys/dev/usb/controller/musb_otg.c ============================================================================== --- stable/8/sys/dev/usb/controller/musb_otg.c Wed Dec 9 22:37:06 2009 (r200328) +++ stable/8/sys/dev/usb/controller/musb_otg.c Wed Dec 9 22:38:02 2009 (r200329) @@ -1144,6 +1144,7 @@ musbotg_setup_standard_chain(struct usb_ /* setup temp */ + temp.pc = NULL; temp.td = NULL; temp.td_next = xfer->td_start[0]; temp.offset = 0; Modified: stable/8/sys/dev/usb/controller/uss820dci.c ============================================================================== --- stable/8/sys/dev/usb/controller/uss820dci.c Wed Dec 9 22:37:06 2009 (r200328) +++ stable/8/sys/dev/usb/controller/uss820dci.c Wed Dec 9 22:38:02 2009 (r200329) @@ -858,6 +858,7 @@ uss820dci_setup_standard_chain(struct us /* setup temp */ + temp.pc = NULL; temp.td = NULL; temp.td_next = xfer->td_start[0]; temp.offset = 0; From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 22:39:09 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B97F6106566B; Wed, 9 Dec 2009 22:39:09 +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 A603E8FC15; Wed, 9 Dec 2009 22:39:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9Md9xR042127; Wed, 9 Dec 2009 22:39:09 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9Md9qR042116; Wed, 9 Dec 2009 22:39:09 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092239.nB9Md9qR042116@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 22:39:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200330 - in stable/8/sys/dev/usb: . controller input storage X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 22:39:09 -0000 Author: thompsa Date: Wed Dec 9 22:39:09 2009 New Revision: 200330 URL: http://svn.freebsd.org/changeset/base/200330 Log: MFC r199675 Provide tunables for some of the usb sysctls that affect boot behaviour. Submitted by: Andriy Gapon Modified: stable/8/sys/dev/usb/controller/ehci.c stable/8/sys/dev/usb/controller/ohci.c stable/8/sys/dev/usb/controller/uhci.c stable/8/sys/dev/usb/input/ukbd.c stable/8/sys/dev/usb/storage/umass.c stable/8/sys/dev/usb/usb_debug.c stable/8/sys/dev/usb/usb_dev.c stable/8/sys/dev/usb/usb_generic.c stable/8/sys/dev/usb/usb_hub.c stable/8/sys/dev/usb/usb_process.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/controller/ehci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci.c Wed Dec 9 22:38:02 2009 (r200329) +++ stable/8/sys/dev/usb/controller/ehci.c Wed Dec 9 22:39:09 2009 (r200330) @@ -99,6 +99,9 @@ SYSCTL_INT(_hw_usb_ehci, OID_AUTO, debug SYSCTL_INT(_hw_usb_ehci, OID_AUTO, no_hs, CTLFLAG_RW, &ehcinohighspeed, 0, "Disable High Speed USB"); +TUNABLE_INT("hw.usb.ehci.debug", &ehcidebug); +TUNABLE_INT("hw.usb.ehci.no_hs", &ehcinohighspeed); + static void ehci_dump_regs(ehci_softc_t *sc); static void ehci_dump_sqh(ehci_softc_t *sc, ehci_qh_t *sqh); Modified: stable/8/sys/dev/usb/controller/ohci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ohci.c Wed Dec 9 22:38:02 2009 (r200329) +++ stable/8/sys/dev/usb/controller/ohci.c Wed Dec 9 22:39:09 2009 (r200330) @@ -84,6 +84,9 @@ static int ohcidebug = 0; SYSCTL_NODE(_hw_usb, OID_AUTO, ohci, CTLFLAG_RW, 0, "USB ohci"); SYSCTL_INT(_hw_usb_ohci, OID_AUTO, debug, CTLFLAG_RW, &ohcidebug, 0, "ohci debug level"); + +TUNABLE_INT("hw.usb.ohci.debug", &ohcidebug); + static void ohci_dumpregs(ohci_softc_t *); static void ohci_dump_tds(ohci_td_t *); static uint8_t ohci_dump_td(ohci_td_t *); Modified: stable/8/sys/dev/usb/controller/uhci.c ============================================================================== --- stable/8/sys/dev/usb/controller/uhci.c Wed Dec 9 22:38:02 2009 (r200329) +++ stable/8/sys/dev/usb/controller/uhci.c Wed Dec 9 22:39:09 2009 (r200330) @@ -91,6 +91,10 @@ SYSCTL_INT(_hw_usb_uhci, OID_AUTO, debug &uhcidebug, 0, "uhci debug level"); SYSCTL_INT(_hw_usb_uhci, OID_AUTO, loop, CTLFLAG_RW, &uhcinoloop, 0, "uhci noloop"); + +TUNABLE_INT("hw.usb.uhci.debug", &uhcidebug); +TUNABLE_INT("hw.usb.uhci.loop", &uhcinoloop); + static void uhci_dumpregs(uhci_softc_t *sc); static void uhci_dump_tds(uhci_td_t *td); Modified: stable/8/sys/dev/usb/input/ukbd.c ============================================================================== --- stable/8/sys/dev/usb/input/ukbd.c Wed Dec 9 22:38:02 2009 (r200329) +++ stable/8/sys/dev/usb/input/ukbd.c Wed Dec 9 22:39:09 2009 (r200330) @@ -105,6 +105,8 @@ SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, debug SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, no_leds, CTLFLAG_RW, &ukbd_no_leds, 0, "Disables setting of keyboard leds"); +TUNABLE_INT("hw.usb.ukbd.debug", &ukbd_debug); +TUNABLE_INT("hw.usb.ukbd.no_leds", &ukbd_no_leds); #endif #define UPROTO_BOOT_KEYBOARD 1 Modified: stable/8/sys/dev/usb/storage/umass.c ============================================================================== --- stable/8/sys/dev/usb/storage/umass.c Wed Dec 9 22:38:02 2009 (r200329) +++ stable/8/sys/dev/usb/storage/umass.c Wed Dec 9 22:39:09 2009 (r200330) @@ -175,6 +175,8 @@ static int umass_debug = 0; SYSCTL_NODE(_hw_usb, OID_AUTO, umass, CTLFLAG_RW, 0, "USB umass"); SYSCTL_INT(_hw_usb_umass, OID_AUTO, debug, CTLFLAG_RW, &umass_debug, 0, "umass debug level"); + +TUNABLE_INT("hw.usb.umass.debug", &umass_debug); #else #define DIF(...) do { } while (0) #define DPRINTF(...) do { } while (0) Modified: stable/8/sys/dev/usb/usb_debug.c ============================================================================== --- stable/8/sys/dev/usb/usb_debug.c Wed Dec 9 22:38:02 2009 (r200329) +++ stable/8/sys/dev/usb/usb_debug.c Wed Dec 9 22:39:09 2009 (r200330) @@ -67,6 +67,8 @@ SYSCTL_NODE(_hw, OID_AUTO, usb, CTLFLAG_ SYSCTL_INT(_hw_usb, OID_AUTO, debug, CTLFLAG_RW, &usb_debug, 0, "Debug level"); +TUNABLE_INT("hw.usb.debug", &usb_debug); + /*------------------------------------------------------------------------* * usb_dump_iface * Modified: stable/8/sys/dev/usb/usb_dev.c ============================================================================== --- stable/8/sys/dev/usb/usb_dev.c Wed Dec 9 22:38:02 2009 (r200329) +++ stable/8/sys/dev/usb/usb_dev.c Wed Dec 9 22:39:09 2009 (r200330) @@ -85,6 +85,8 @@ static int usb_fifo_debug = 0; SYSCTL_NODE(_hw_usb, OID_AUTO, dev, CTLFLAG_RW, 0, "USB device"); SYSCTL_INT(_hw_usb_dev, OID_AUTO, debug, CTLFLAG_RW, &usb_fifo_debug, 0, "Debug Level"); + +TUNABLE_INT("hw.usb.dev.debug", &usb_fifo_debug); #endif #if ((__FreeBSD_version >= 700001) || (__FreeBSD_version == 0) || \ Modified: stable/8/sys/dev/usb/usb_generic.c ============================================================================== --- stable/8/sys/dev/usb/usb_generic.c Wed Dec 9 22:38:02 2009 (r200329) +++ stable/8/sys/dev/usb/usb_generic.c Wed Dec 9 22:39:09 2009 (r200330) @@ -130,6 +130,8 @@ static int ugen_debug = 0; SYSCTL_NODE(_hw_usb, OID_AUTO, ugen, CTLFLAG_RW, 0, "USB generic"); SYSCTL_INT(_hw_usb_ugen, OID_AUTO, debug, CTLFLAG_RW, &ugen_debug, 0, "Debug level"); + +TUNABLE_INT("hw.usb.ugen.debug", &ugen_debug); #endif Modified: stable/8/sys/dev/usb/usb_hub.c ============================================================================== --- stable/8/sys/dev/usb/usb_hub.c Wed Dec 9 22:38:02 2009 (r200329) +++ stable/8/sys/dev/usb/usb_hub.c Wed Dec 9 22:39:09 2009 (r200330) @@ -79,6 +79,8 @@ static int uhub_debug = 0; SYSCTL_NODE(_hw_usb, OID_AUTO, uhub, CTLFLAG_RW, 0, "USB HUB"); SYSCTL_INT(_hw_usb_uhub, OID_AUTO, debug, CTLFLAG_RW, &uhub_debug, 0, "Debug level"); + +TUNABLE_INT("hw.usb.uhub.debug", &uhub_debug); #endif #if USB_HAVE_POWERD Modified: stable/8/sys/dev/usb/usb_process.c ============================================================================== --- stable/8/sys/dev/usb/usb_process.c Wed Dec 9 22:38:02 2009 (r200329) +++ stable/8/sys/dev/usb/usb_process.c Wed Dec 9 22:39:09 2009 (r200330) @@ -83,6 +83,8 @@ static int usb_proc_debug; SYSCTL_NODE(_hw_usb, OID_AUTO, proc, CTLFLAG_RW, 0, "USB process"); SYSCTL_INT(_hw_usb_proc, OID_AUTO, debug, CTLFLAG_RW, &usb_proc_debug, 0, "Debug level"); + +TUNABLE_INT("hw.usb.proc.debug", &usb_proc_debug); #endif /*------------------------------------------------------------------------* From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 22:40:27 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F6AC106566B; Wed, 9 Dec 2009 22:40:27 +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 4C9098FC17; Wed, 9 Dec 2009 22:40:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9MeRZ5042227; Wed, 9 Dec 2009 22:40:27 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9MeR3W042224; Wed, 9 Dec 2009 22:40:27 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092240.nB9MeR3W042224@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 22:40:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200331 - stable/8/sys/dev/usb/controller X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 22:40:27 -0000 Author: thompsa Date: Wed Dec 9 22:40:27 2009 New Revision: 200331 URL: http://svn.freebsd.org/changeset/base/200331 Log: MFC r199676 Correct register access for USB device side operation on the musb controller. Submitted by: Hans Petter Selasky Modified: stable/8/sys/dev/usb/controller/musb_otg.c stable/8/sys/dev/usb/controller/musb_otg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/controller/musb_otg.c ============================================================================== --- stable/8/sys/dev/usb/controller/musb_otg.c Wed Dec 9 22:39:09 2009 (r200330) +++ stable/8/sys/dev/usb/controller/musb_otg.c Wed Dec 9 22:40:27 2009 (r200331) @@ -1539,18 +1539,18 @@ musbotg_clear_stall_sub(struct musbotg_s /* Configure endpoint */ switch (ep_type) { case UE_INTERRUPT: - MUSB2_WRITE_1(sc, MUSB2_REG_TXMAXP, wMaxPacket); + MUSB2_WRITE_2(sc, MUSB2_REG_TXMAXP, wMaxPacket); MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRH, MUSB2_MASK_CSRH_TXMODE | temp); break; case UE_ISOCHRONOUS: - MUSB2_WRITE_1(sc, MUSB2_REG_TXMAXP, wMaxPacket); + MUSB2_WRITE_2(sc, MUSB2_REG_TXMAXP, wMaxPacket); MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRH, MUSB2_MASK_CSRH_TXMODE | MUSB2_MASK_CSRH_TXISO | temp); break; case UE_BULK: - MUSB2_WRITE_1(sc, MUSB2_REG_TXMAXP, wMaxPacket); + MUSB2_WRITE_2(sc, MUSB2_REG_TXMAXP, wMaxPacket); MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRH, MUSB2_MASK_CSRH_TXMODE | temp); break; @@ -1600,18 +1600,18 @@ musbotg_clear_stall_sub(struct musbotg_s /* Configure endpoint */ switch (ep_type) { case UE_INTERRUPT: - MUSB2_WRITE_1(sc, MUSB2_REG_RXMAXP, wMaxPacket); + MUSB2_WRITE_2(sc, MUSB2_REG_RXMAXP, wMaxPacket); MUSB2_WRITE_1(sc, MUSB2_REG_RXCSRH, MUSB2_MASK_CSRH_RXNYET | temp); break; case UE_ISOCHRONOUS: - MUSB2_WRITE_1(sc, MUSB2_REG_RXMAXP, wMaxPacket); + MUSB2_WRITE_2(sc, MUSB2_REG_RXMAXP, wMaxPacket); MUSB2_WRITE_1(sc, MUSB2_REG_RXCSRH, MUSB2_MASK_CSRH_RXNYET | MUSB2_MASK_CSRH_RXISO | temp); break; case UE_BULK: - MUSB2_WRITE_1(sc, MUSB2_REG_RXMAXP, wMaxPacket); + MUSB2_WRITE_2(sc, MUSB2_REG_RXMAXP, wMaxPacket); MUSB2_WRITE_1(sc, MUSB2_REG_RXCSRH, temp); break; default: @@ -1688,12 +1688,14 @@ usb_error_t musbotg_init(struct musbotg_softc *sc) { struct usb_hw_ep_profile *pf; + uint16_t offset; uint8_t nrx; uint8_t ntx; uint8_t temp; uint8_t fsize; uint8_t frx; uint8_t ftx; + uint8_t dynfifo; DPRINTFN(1, "start\n"); @@ -1776,11 +1778,20 @@ musbotg_init(struct musbotg_softc *sc) DPRINTFN(2, "Config Data: 0x%02x\n", sc->sc_conf_data); + dynfifo = (sc->sc_conf_data & MUSB2_MASK_CD_DYNFIFOSZ) ? 1 : 0; + + if (dynfifo) { + DPRINTFN(0, "Dynamic FIFO sizing detected! " + "Assuming 16Kbytes of FIFO RAM\n"); + } + DPRINTFN(2, "HW version: 0x%04x\n", MUSB2_READ_1(sc, MUSB2_REG_HWVERS)); /* initialise endpoint profiles */ + offset = 0; + for (temp = 1; temp <= sc->sc_ep_max; temp++) { pf = sc->sc_hw_ep_profile + temp; @@ -1791,9 +1802,45 @@ musbotg_init(struct musbotg_softc *sc) frx = (fsize & MUSB2_MASK_RX_FSIZE) / 16;; ftx = (fsize & MUSB2_MASK_TX_FSIZE); - DPRINTF("Endpoint %u FIFO size: IN=%u, OUT=%u\n", - temp, pf->max_in_frame_size, - pf->max_out_frame_size); + DPRINTF("Endpoint %u FIFO size: IN=%u, OUT=%u, DYN=%d\n", + temp, ftx, frx, dynfifo); + + if (dynfifo) { + if (frx && (temp <= nrx)) { + if (temp < 8) { + frx = 10; /* 1K */ + MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, + MUSB2_VAL_FIFOSZ_512 | + MUSB2_MASK_FIFODB); + } else { + frx = 7; /* 128 bytes */ + MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, + MUSB2_VAL_FIFOSZ_128); + } + + MUSB2_WRITE_2(sc, MUSB2_REG_RXFIFOADD, + offset >> 3); + + offset += (1 << frx); + } + if (ftx && (temp <= ntx)) { + if (temp < 8) { + ftx = 10; /* 1K */ + MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, + MUSB2_VAL_FIFOSZ_512 | + MUSB2_MASK_FIFODB); + } else { + ftx = 7; /* 128 bytes */ + MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, + MUSB2_VAL_FIFOSZ_128); + } + + MUSB2_WRITE_2(sc, MUSB2_REG_TXFIFOADD, + offset >> 3); + + offset += (1 << ftx); + } + } if (frx && ftx && (temp <= nrx) && (temp <= ntx)) { pf->max_in_frame_size = 1 << ftx; @@ -1824,6 +1871,8 @@ musbotg_init(struct musbotg_softc *sc) } } + DPRINTFN(2, "Dynamic FIFO size = %d bytes\n", offset); + /* turn on default interrupts */ MUSB2_WRITE_1(sc, MUSB2_REG_INTUSBE, Modified: stable/8/sys/dev/usb/controller/musb_otg.h ============================================================================== --- stable/8/sys/dev/usb/controller/musb_otg.h Wed Dec 9 22:39:09 2009 (r200330) +++ stable/8/sys/dev/usb/controller/musb_otg.h Wed Dec 9 22:40:27 2009 (r200331) @@ -191,7 +191,7 @@ #define MUSB2_REG_EPFIFO(n) (0x0020 + (4*(n))) -#define MUSB2_REG_CONFDATA 0x000F /* EPN=0 */ +#define MUSB2_REG_CONFDATA (0x000F + MUSB2_REG_INDEXED_CSR) /* EPN=0 */ #define MUSB2_MASK_CD_UTMI_DW 0x01 #define MUSB2_MASK_CD_SOFTCONE 0x02 #define MUSB2_MASK_CD_DYNFIFOSZ 0x04 From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 22:41:11 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A508106566C; Wed, 9 Dec 2009 22:41:11 +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 484318FC0A; Wed, 9 Dec 2009 22:41:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9MfBuZ042294; Wed, 9 Dec 2009 22:41:11 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9MfB6v042292; Wed, 9 Dec 2009 22:41:11 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092241.nB9MfB6v042292@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 22:41:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200332 - stable/8/sys/dev/usb/controller X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 22:41:11 -0000 Author: thompsa Date: Wed Dec 9 22:41:11 2009 New Revision: 200332 URL: http://svn.freebsd.org/changeset/base/200332 Log: MFC r199718 Actually disable interrupts in ehci_detach(). Modified: stable/8/sys/dev/usb/controller/ehci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/controller/ehci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci.c Wed Dec 9 22:40:27 2009 (r200331) +++ stable/8/sys/dev/usb/controller/ehci.c Wed Dec 9 22:41:11 2009 (r200332) @@ -528,7 +528,7 @@ ehci_detach(ehci_softc_t *sc) usb_callout_stop(&sc->sc_tmo_pcd); usb_callout_stop(&sc->sc_tmo_poll); - EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); + EOWRITE4(sc, EHCI_USBINTR, 0); USB_BUS_UNLOCK(&sc->sc_bus); if (ehci_hcreset(sc)) { From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 22:41:51 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E68F71065692; Wed, 9 Dec 2009 22:41:50 +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 D43A28FC23; Wed, 9 Dec 2009 22:41:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9Mfoct042357; Wed, 9 Dec 2009 22:41:50 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9MfoM5042353; Wed, 9 Dec 2009 22:41:50 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092241.nB9MfoM5042353@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 22:41:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200333 - in stable/8/sys/dev: pci usb/controller X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 22:41:51 -0000 Author: thompsa Date: Wed Dec 9 22:41:50 2009 New Revision: 200333 URL: http://svn.freebsd.org/changeset/base/200333 Log: MFC r199814 Disable interrupts after doing early takeover of the usb controller in case usb isnt actually compiled in (or kldloaded) as the controller could cause spurious interrupts. Modified: stable/8/sys/dev/pci/pci.c stable/8/sys/dev/usb/controller/uhci_pci.c stable/8/sys/dev/usb/controller/uhcireg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/pci/pci.c ============================================================================== --- stable/8/sys/dev/pci/pci.c Wed Dec 9 22:41:11 2009 (r200332) +++ stable/8/sys/dev/pci/pci.c Wed Dec 9 22:41:50 2009 (r200333) @@ -2610,6 +2610,8 @@ ohci_early_takeover(device_t self) "SMM does not respond, resetting\n"); bus_write_4(res, OHCI_CONTROL, OHCI_HCFS_RESET); } + /* Disable interrupts */ + bus_write_4(res, OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTRS); } bus_release_resource(self, SYS_RES_MEMORY, rid, res); @@ -2619,6 +2621,9 @@ ohci_early_takeover(device_t self) static void uhci_early_takeover(device_t self) { + struct resource *res; + int rid; + /* * Set the PIRQD enable bit and switch off all the others. We don't * want legacy support to interfere with us XXX Does this also mean @@ -2626,6 +2631,14 @@ uhci_early_takeover(device_t self) * to the ports of the root hub? */ pci_write_config(self, PCI_LEGSUP, PCI_LEGSUP_USBPIRQDEN, 2); + + /* Disable interrupts */ + rid = PCI_UHCI_BASE_REG; + res = bus_alloc_resource_any(self, SYS_RES_IOPORT, &rid, RF_ACTIVE); + if (res != NULL) { + bus_write_2(res, UHCI_INTR, 0); + bus_release_resource(self, SYS_RES_IOPORT, rid, res); + } } /* Perform early EHCI takeover from SMM. */ @@ -2637,6 +2650,7 @@ ehci_early_takeover(device_t self) uint32_t eec; uint8_t eecp; uint8_t bios_sem; + uint8_t offs; int rid; int i; @@ -2676,6 +2690,9 @@ ehci_early_takeover(device_t self) printf("ehci early: " "SMM does not respond\n"); } + /* Disable interrupts */ + offs = bus_read_1(res, EHCI_CAPLENGTH); + bus_write_4(res, offs + EHCI_USBINTR, 0); } bus_release_resource(self, SYS_RES_MEMORY, rid, res); } Modified: stable/8/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- stable/8/sys/dev/usb/controller/uhci_pci.c Wed Dec 9 22:41:11 2009 (r200332) +++ stable/8/sys/dev/usb/controller/uhci_pci.c Wed Dec 9 22:41:50 2009 (r200333) @@ -88,8 +88,6 @@ __FBSDID("$FreeBSD$"); /* PIIX4E has no separate stepping */ -#define PCI_UHCI_BASE_REG 0x20 - static device_probe_t uhci_pci_probe; static device_attach_t uhci_pci_attach; static device_detach_t uhci_pci_detach; Modified: stable/8/sys/dev/usb/controller/uhcireg.h ============================================================================== --- stable/8/sys/dev/usb/controller/uhcireg.h Wed Dec 9 22:41:11 2009 (r200332) +++ stable/8/sys/dev/usb/controller/uhcireg.h Wed Dec 9 22:41:50 2009 (r200333) @@ -39,6 +39,8 @@ #ifndef _UHCIREG_H_ #define _UHCIREG_H_ +#define PCI_UHCI_BASE_REG 0x20 + /* PCI config registers */ #define PCI_USBREV 0x60 /* USB protocol revision */ #define PCI_USB_REV_MASK 0xff From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 22:42:41 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 908DD1065679; Wed, 9 Dec 2009 22:42:41 +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 7C03E8FC20; Wed, 9 Dec 2009 22:42:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9MgfWh042461; Wed, 9 Dec 2009 22:42:41 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9Mgf5h042425; Wed, 9 Dec 2009 22:42:41 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092242.nB9Mgf5h042425@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 22:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200334 - in stable/8/sys/dev/usb: . controller input net serial storage template wlan X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 22:42:41 -0000 Author: thompsa Date: Wed Dec 9 22:42:40 2009 New Revision: 200334 URL: http://svn.freebsd.org/changeset/base/200334 Log: MFC r199816 Remove overuse of exclamation marks in kernel printfs, there mere fact a message has been printed is enough to get someones attention. Also remove the line number for DPRINTF/DPRINTFN, it already prints the funtion name and a unique message. Modified: stable/8/sys/dev/usb/controller/atmegadci.c stable/8/sys/dev/usb/controller/avr32dci.c stable/8/sys/dev/usb/controller/musb_otg.c stable/8/sys/dev/usb/controller/usb_controller.c stable/8/sys/dev/usb/input/ukbd.c stable/8/sys/dev/usb/net/if_aue.c stable/8/sys/dev/usb/net/if_axe.c stable/8/sys/dev/usb/net/if_cdce.c stable/8/sys/dev/usb/net/if_cue.c stable/8/sys/dev/usb/net/if_kue.c stable/8/sys/dev/usb/net/if_rue.c stable/8/sys/dev/usb/net/if_udav.c stable/8/sys/dev/usb/serial/u3g.c stable/8/sys/dev/usb/serial/uark.c stable/8/sys/dev/usb/serial/ubser.c stable/8/sys/dev/usb/serial/ucycom.c stable/8/sys/dev/usb/serial/ufoma.c stable/8/sys/dev/usb/serial/uftdi.c stable/8/sys/dev/usb/serial/ugensa.c stable/8/sys/dev/usb/serial/umct.c stable/8/sys/dev/usb/serial/umodem.c stable/8/sys/dev/usb/serial/uplcom.c stable/8/sys/dev/usb/storage/umass.c stable/8/sys/dev/usb/template/usb_template.c stable/8/sys/dev/usb/usb_busdma.c stable/8/sys/dev/usb/usb_debug.h stable/8/sys/dev/usb/usb_dev.c stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_hid.c stable/8/sys/dev/usb/usb_hub.c stable/8/sys/dev/usb/usb_msctest.c stable/8/sys/dev/usb/usb_process.c stable/8/sys/dev/usb/usb_request.c stable/8/sys/dev/usb/usb_transfer.c stable/8/sys/dev/usb/wlan/if_upgt.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/controller/atmegadci.c ============================================================================== --- stable/8/sys/dev/usb/controller/atmegadci.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/controller/atmegadci.c Wed Dec 9 22:42:40 2009 (r200334) @@ -1192,7 +1192,8 @@ atmegadci_clear_stall_sub(struct atmegad temp = ATMEGA_READ_1(sc, ATMEGA_UESTA0X); if (!(temp & ATMEGA_UESTA0X_CFGOK)) { - DPRINTFN(0, "Chip rejected configuration\n"); + device_printf(sc->sc_bus.bdev, + "Chip rejected configuration\n"); } } while (0); } @@ -1914,7 +1915,8 @@ tr_handle_clear_port_feature: /* check valid config */ temp = ATMEGA_READ_1(sc, ATMEGA_UESTA0X); if (!(temp & ATMEGA_UESTA0X_CFGOK)) { - DPRINTFN(0, "Chip rejected EP0 configuration\n"); + device_printf(sc->sc_bus.bdev, + "Chip rejected EP0 configuration\n"); } break; case UHF_C_PORT_SUSPEND: Modified: stable/8/sys/dev/usb/controller/avr32dci.c ============================================================================== --- stable/8/sys/dev/usb/controller/avr32dci.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/controller/avr32dci.c Wed Dec 9 22:42:40 2009 (r200334) @@ -1160,7 +1160,7 @@ avr32dci_clear_stall_sub(struct avr32dci temp = AVR32_READ_4(sc, AVR32_EPTCFG(ep_no)); if (!(temp & AVR32_EPTCFG_EPT_MAPD)) { - DPRINTFN(0, "Chip rejected configuration\n"); + device_printf(sc->sc_bus.bdev, "Chip rejected configuration\n"); } else { AVR32_WRITE_4(sc, AVR32_EPTCTLENB(ep_no), AVR32_EPTCTL_EPT_ENABL); @@ -1840,7 +1840,8 @@ tr_handle_clear_port_feature: temp = AVR32_READ_4(sc, AVR32_EPTCFG(0)); if (!(temp & AVR32_EPTCFG_EPT_MAPD)) { - DPRINTFN(0, "Chip rejected configuration\n"); + device_printf(sc->sc_bus.bdev, + "Chip rejected configuration\n"); } else { AVR32_WRITE_4(sc, AVR32_EPTCTLENB(0), AVR32_EPTCTL_EPT_ENABL); Modified: stable/8/sys/dev/usb/controller/musb_otg.c ============================================================================== --- stable/8/sys/dev/usb/controller/musb_otg.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/controller/musb_otg.c Wed Dec 9 22:42:40 2009 (r200334) @@ -1781,8 +1781,8 @@ musbotg_init(struct musbotg_softc *sc) dynfifo = (sc->sc_conf_data & MUSB2_MASK_CD_DYNFIFOSZ) ? 1 : 0; if (dynfifo) { - DPRINTFN(0, "Dynamic FIFO sizing detected! " - "Assuming 16Kbytes of FIFO RAM\n"); + device_printf(sc->sc_bus.bdev, "Dynamic FIFO sizing detected, " + "assuming 16Kbytes of FIFO RAM\n"); } DPRINTFN(2, "HW version: 0x%04x\n", Modified: stable/8/sys/dev/usb/controller/usb_controller.c ============================================================================== --- stable/8/sys/dev/usb/controller/usb_controller.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/controller/usb_controller.c Wed Dec 9 22:42:40 2009 (r200334) @@ -130,7 +130,7 @@ usb_attach(device_t dev) DPRINTF("\n"); if (bus == NULL) { - DPRINTFN(0, "USB device has no ivars\n"); + device_printf(dev, "USB device has no ivars\n"); return (ENXIO); } @@ -343,7 +343,7 @@ usb_bus_attach(struct usb_proc_msg *pm) break; default: - device_printf(bus->bdev, "Unsupported USB revision!\n"); + device_printf(bus->bdev, "Unsupported USB revision\n"); return; } @@ -530,7 +530,7 @@ usb_bus_mem_alloc_all(struct usb_bus *bu (bus->devices_max < USB_MIN_DEVICES) || (bus->devices == NULL)) { DPRINTFN(0, "Devices field has not been " - "initialised properly!\n"); + "initialised properly\n"); bus->alloc_failed = 1; /* failure */ } #if USB_HAVE_BUSDMA Modified: stable/8/sys/dev/usb/input/ukbd.c ============================================================================== --- stable/8/sys/dev/usb/input/ukbd.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/input/ukbd.c Wed Dec 9 22:42:40 2009 (r200334) @@ -926,7 +926,7 @@ ukbd_detach(device_t dev) DPRINTF("\n"); if (sc->sc_flags & UKBD_FLAG_POLLING) { - panic("cannot detach polled keyboard!\n"); + panic("cannot detach polled keyboard\n"); } sc->sc_flags |= UKBD_FLAG_GONE; Modified: stable/8/sys/dev/usb/net/if_aue.c ============================================================================== --- stable/8/sys/dev/usb/net/if_aue.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/net/if_aue.c Wed Dec 9 22:42:40 2009 (r200334) @@ -692,7 +692,7 @@ aue_attach(device_t dev) sc->sc_xfer, aue_config, AUE_N_TRANSFER, sc, &sc->sc_mtx); if (error) { - device_printf(dev, "allocating USB transfers failed!\n"); + device_printf(dev, "allocating USB transfers failed\n"); goto detach; } Modified: stable/8/sys/dev/usb/net/if_axe.c ============================================================================== --- stable/8/sys/dev/usb/net/if_axe.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/net/if_axe.c Wed Dec 9 22:42:40 2009 (r200334) @@ -706,7 +706,7 @@ axe_attach(device_t dev) error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, axe_config, AXE_N_TRANSFER, sc, &sc->sc_mtx); if (error) { - device_printf(dev, "allocating USB transfers failed!\n"); + device_printf(dev, "allocating USB transfers failed\n"); goto detach; } Modified: stable/8/sys/dev/usb/net/if_cdce.c ============================================================================== --- stable/8/sys/dev/usb/net/if_cdce.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/net/if_cdce.c Wed Dec 9 22:42:40 2009 (r200334) @@ -489,7 +489,7 @@ cdce_attach(device_t dev) break; } } else { - device_printf(dev, "no data interface found!\n"); + device_printf(dev, "no data interface found\n"); goto detach; } } @@ -541,7 +541,7 @@ alloc_transfers: if (error || (i == 32)) { device_printf(dev, "No valid alternate " - "setting found!\n"); + "setting found\n"); goto detach; } Modified: stable/8/sys/dev/usb/net/if_cue.c ============================================================================== --- stable/8/sys/dev/usb/net/if_cue.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/net/if_cue.c Wed Dec 9 22:42:40 2009 (r200334) @@ -404,7 +404,7 @@ cue_attach(device_t dev) error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, cue_config, CUE_N_TRANSFER, sc, &sc->sc_mtx); if (error) { - device_printf(dev, "allocating USB transfers failed!\n"); + device_printf(dev, "allocating USB transfers failed\n"); goto detach; } Modified: stable/8/sys/dev/usb/net/if_kue.c ============================================================================== --- stable/8/sys/dev/usb/net/if_kue.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/net/if_kue.c Wed Dec 9 22:42:40 2009 (r200334) @@ -480,14 +480,14 @@ kue_attach(device_t dev) error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, kue_config, KUE_N_TRANSFER, sc, &sc->sc_mtx); if (error) { - device_printf(dev, "allocating USB transfers failed!\n"); + device_printf(dev, "allocating USB transfers failed\n"); goto detach; } sc->sc_mcfilters = malloc(KUE_MCFILTCNT(sc) * ETHER_ADDR_LEN, M_USBDEV, M_WAITOK); if (sc->sc_mcfilters == NULL) { - device_printf(dev, "failed allocating USB memory!\n"); + device_printf(dev, "failed allocating USB memory\n"); goto detach; } Modified: stable/8/sys/dev/usb/net/if_rue.c ============================================================================== --- stable/8/sys/dev/usb/net/if_rue.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/net/if_rue.c Wed Dec 9 22:42:40 2009 (r200334) @@ -535,7 +535,7 @@ rue_reset(struct rue_softc *sc) break; } if (i == RUE_TIMEOUT) - device_printf(sc->sc_ue.ue_dev, "reset never completed!\n"); + device_printf(sc->sc_ue.ue_dev, "reset never completed\n"); uether_pause(&sc->sc_ue, hz / 100); } @@ -591,7 +591,7 @@ rue_attach(device_t dev) sc->sc_xfer, rue_config, RUE_N_TRANSFER, sc, &sc->sc_mtx); if (error) { - device_printf(dev, "allocating USB transfers failed!\n"); + device_printf(dev, "allocating USB transfers failed\n"); goto detach; } Modified: stable/8/sys/dev/usb/net/if_udav.c ============================================================================== --- stable/8/sys/dev/usb/net/if_udav.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/net/if_udav.c Wed Dec 9 22:42:40 2009 (r200334) @@ -254,7 +254,7 @@ udav_attach(device_t dev) error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, udav_config, UDAV_N_TRANSFER, sc, &sc->sc_mtx); if (error) { - device_printf(dev, "allocating USB transfers failed!\n"); + device_printf(dev, "allocating USB transfers failed\n"); goto detach; } Modified: stable/8/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/8/sys/dev/usb/serial/u3g.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/serial/u3g.c Wed Dec 9 22:42:40 2009 (r200334) @@ -249,8 +249,6 @@ u3g_sierra_init(struct usb_device *udev) { struct usb_device_request req; - DPRINTFN(0, "\n"); - req.bmRequestType = UT_VENDOR; req.bRequest = UR_SET_INTERFACE; USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP); @@ -269,8 +267,6 @@ u3g_huawei_init(struct usb_device *udev) { struct usb_device_request req; - DPRINTFN(0, "\n"); - req.bmRequestType = UT_WRITE_DEVICE; req.bRequest = UR_SET_FEATURE; USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP); Modified: stable/8/sys/dev/usb/serial/uark.c ============================================================================== --- stable/8/sys/dev/usb/serial/uark.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/serial/uark.c Wed Dec 9 22:42:40 2009 (r200334) @@ -211,7 +211,7 @@ uark_attach(device_t dev) if (error) { device_printf(dev, "allocating control USB " - "transfers failed!\n"); + "transfers failed\n"); goto detach; } /* clear stall at first run */ Modified: stable/8/sys/dev/usb/serial/ubser.c ============================================================================== --- stable/8/sys/dev/usb/serial/ubser.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/serial/ubser.c Wed Dec 9 22:42:40 2009 (r200334) @@ -282,7 +282,7 @@ ubser_attach(device_t dev) sc->sc_tx_size = usbd_xfer_max_len(sc->sc_xfer[UBSER_BULK_DT_WR]); if (sc->sc_tx_size == 0) { - DPRINTFN(0, "invalid tx_size!\n"); + DPRINTFN(0, "invalid tx_size\n"); goto detach; } /* initialize port numbers */ Modified: stable/8/sys/dev/usb/serial/ucycom.c ============================================================================== --- stable/8/sys/dev/usb/serial/ucycom.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/serial/ucycom.c Wed Dec 9 22:42:40 2009 (r200334) @@ -266,7 +266,7 @@ ucycom_attach(device_t dev) sc, &sc->sc_mtx); if (error) { device_printf(dev, "allocating USB " - "transfers failed!\n"); + "transfers failed\n"); goto detach; } error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -555,7 +555,7 @@ ucycom_intr_read_callback(struct usb_xfe break; default: - DPRINTFN(0, "unsupported model number!\n"); + DPRINTFN(0, "unsupported model number\n"); goto tr_setup; } Modified: stable/8/sys/dev/usb/serial/ufoma.c ============================================================================== --- stable/8/sys/dev/usb/serial/ufoma.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/serial/ufoma.c Wed Dec 9 22:42:40 2009 (r200334) @@ -401,7 +401,7 @@ ufoma_attach(device_t dev) if (error) { device_printf(dev, "allocating control USB " - "transfers failed!\n"); + "transfers failed\n"); goto detach; } mad = ufoma_get_intconf(cd, id, UDESC_VS_INTERFACE, UDESCSUB_MCPC_ACM); @@ -1060,7 +1060,7 @@ ufoma_modem_setup(device_t dev, struct u break; } } else { - device_printf(dev, "no data interface!\n"); + device_printf(dev, "no data interface\n"); return (EINVAL); } } @@ -1071,7 +1071,7 @@ ufoma_modem_setup(device_t dev, struct u if (error) { device_printf(dev, "allocating BULK USB " - "transfers failed!\n"); + "transfers failed\n"); return (EINVAL); } return (0); Modified: stable/8/sys/dev/usb/serial/uftdi.c ============================================================================== --- stable/8/sys/dev/usb/serial/uftdi.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/serial/uftdi.c Wed Dec 9 22:42:40 2009 (r200334) @@ -307,7 +307,7 @@ uftdi_attach(device_t dev) if (error) { device_printf(dev, "allocating USB " - "transfers failed!\n"); + "transfers failed\n"); goto detach; } sc->sc_ucom.sc_portno = FTDI_PIT_SIOA + uaa->info.bIfaceNum; Modified: stable/8/sys/dev/usb/serial/ugensa.c ============================================================================== --- stable/8/sys/dev/usb/serial/ugensa.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/serial/ugensa.c Wed Dec 9 22:42:40 2009 (r200334) @@ -210,7 +210,7 @@ ugensa_attach(device_t dev) } if (cnt == 0) { - device_printf(dev, "No interfaces!\n"); + device_printf(dev, "No interfaces\n"); goto detach; } for (x = 0; x < cnt; x++) { @@ -229,7 +229,7 @@ ugensa_attach(device_t dev) if (error) { device_printf(dev, "allocating USB " - "transfers failed!\n"); + "transfers failed\n"); goto detach; } /* clear stall at first run */ Modified: stable/8/sys/dev/usb/serial/umct.c ============================================================================== --- stable/8/sys/dev/usb/serial/umct.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/serial/umct.c Wed Dec 9 22:42:40 2009 (r200334) @@ -263,7 +263,7 @@ umct_attach(device_t dev) if (error) { device_printf(dev, "allocating USB " - "transfers failed!\n"); + "transfers failed\n"); goto detach; } Modified: stable/8/sys/dev/usb/serial/umodem.c ============================================================================== --- stable/8/sys/dev/usb/serial/umodem.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/serial/umodem.c Wed Dec 9 22:42:40 2009 (r200334) @@ -311,7 +311,7 @@ umodem_attach(device_t dev) 0 - 1, UDESCSUB_CDC_UNION, 0 - 1); if ((cud == NULL) || (cud->bLength < sizeof(*cud))) { - device_printf(dev, "no CM or union descriptor!\n"); + device_printf(dev, "no CM or union descriptor\n"); goto detach; } @@ -344,7 +344,7 @@ umodem_attach(device_t dev) break; } } else { - device_printf(dev, "no data interface!\n"); + device_printf(dev, "no data interface\n"); goto detach; } } Modified: stable/8/sys/dev/usb/serial/uplcom.c ============================================================================== --- stable/8/sys/dev/usb/serial/uplcom.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/serial/uplcom.c Wed Dec 9 22:42:40 2009 (r200334) @@ -377,7 +377,7 @@ uplcom_attach(device_t dev) if (iface) { id = usbd_get_interface_descriptor(iface); if (id == NULL) { - device_printf(dev, "no interface descriptor (2)!\n"); + device_printf(dev, "no interface descriptor (2)\n"); goto detach; } sc->sc_data_iface_no = id->bInterfaceNumber; @@ -420,7 +420,7 @@ uplcom_attach(device_t dev) */ if (sc->sc_chiptype == TYPE_PL2303X) { if (uplcom_pl2303x_init(uaa->device)) { - device_printf(dev, "init failed!\n"); + device_printf(dev, "init failed\n"); goto detach; } } Modified: stable/8/sys/dev/usb/storage/umass.c ============================================================================== --- stable/8/sys/dev/usb/storage/umass.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/storage/umass.c Wed Dec 9 22:42:40 2009 (r200334) @@ -2847,7 +2847,7 @@ umass_cam_detach_sim(struct umass_softc sc->sc_sim->softc = UMASS_GONE; cam_sim_free(sc->sc_sim, /* free_devq */ TRUE); } else { - panic("%s: CAM layer is busy!\n", + panic("%s: CAM layer is busy\n", sc->sc_name); } sc->sc_sim = NULL; Modified: stable/8/sys/dev/usb/template/usb_template.c ============================================================================== --- stable/8/sys/dev/usb/template/usb_template.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/template/usb_template.c Wed Dec 9 22:42:40 2009 (r200334) @@ -727,7 +727,7 @@ handle_endpoint_desc: if ((pf->max_in_frame_size < wMaxPacketSize) || (pf->max_out_frame_size < wMaxPacketSize)) { DPRINTFN(0, "Endpoint profile %u " - "has too small buffer!\n", ep_no); + "has too small buffer\n", ep_no); return (1); } } else if (ed->bEndpointAddress & UE_DIR_IN) { @@ -735,7 +735,7 @@ handle_endpoint_desc: (1 << (ep_no % 8)); if (pf->max_in_frame_size < wMaxPacketSize) { DPRINTFN(0, "Endpoint profile %u " - "has too small buffer!\n", ep_no); + "has too small buffer\n", ep_no); return (1); } } else { @@ -743,7 +743,7 @@ handle_endpoint_desc: (1 << (ep_no % 8)); if (pf->max_out_frame_size < wMaxPacketSize) { DPRINTFN(0, "Endpoint profile %u " - "has too small buffer!\n", ep_no); + "has too small buffer\n", ep_no); return (1); } } Modified: stable/8/sys/dev/usb/usb_busdma.c ============================================================================== --- stable/8/sys/dev/usb/usb_busdma.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/usb_busdma.c Wed Dec 9 22:42:40 2009 (r200334) @@ -445,7 +445,7 @@ usb_pc_common_mem_cb(void *arg, bus_dma_ /* * This check verifies that the physical address is correct: */ - DPRINTFN(0, "Page offset was not preserved!\n"); + DPRINTFN(0, "Page offset was not preserved\n"); error = 1; goto done; } @@ -764,8 +764,8 @@ usb_dma_tag_find(struct usb_dma_parent_t struct usb_dma_tag *udt; uint8_t nudt; - USB_ASSERT(align > 0, ("Invalid parameter align = 0!\n")); - USB_ASSERT(size > 0, ("Invalid parameter size = 0!\n")); + USB_ASSERT(align > 0, ("Invalid parameter align = 0\n")); + USB_ASSERT(size > 0, ("Invalid parameter size = 0\n")); udt = udpt->utag_first; nudt = udpt->utag_max; Modified: stable/8/sys/dev/usb/usb_debug.h ============================================================================== --- stable/8/sys/dev/usb/usb_debug.h Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/usb_debug.h Wed Dec 9 22:42:40 2009 (r200334) @@ -35,11 +35,11 @@ extern int usb_debug; /* Check if USB debugging is enabled. */ #ifdef USB_DEBUG_VAR #if (USB_DEBUG != 0) -#define DPRINTFN(n,fmt,...) do { \ - if ((USB_DEBUG_VAR) >= (n)) { \ - printf("%s:%u: " fmt, \ - __FUNCTION__, __LINE__,## __VA_ARGS__); \ - } \ +#define DPRINTFN(n,fmt,...) do { \ + if ((USB_DEBUG_VAR) >= (n)) { \ + printf("%s: " fmt, \ + __FUNCTION__,## __VA_ARGS__); \ + } \ } while (0) #define DPRINTF(...) DPRINTFN(1, __VA_ARGS__) #else Modified: stable/8/sys/dev/usb/usb_dev.c ============================================================================== --- stable/8/sys/dev/usb/usb_dev.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/usb_dev.c Wed Dec 9 22:42:40 2009 (r200334) @@ -575,7 +575,7 @@ usb_fifo_free(struct usb_fifo *f) (f->udev->fifo[f->fifo_index] == f)) { f->udev->fifo[f->fifo_index] = NULL; } else { - DPRINTFN(0, "USB FIFO %p has not been linked!\n", f); + DPRINTFN(0, "USB FIFO %p has not been linked\n", f); } /* decrease refcount */ @@ -952,7 +952,7 @@ usb_dev_init_post(void *arg) usb_dev = make_dev(&usb_static_devsw, 0, UID_ROOT, GID_OPERATOR, 0644, USB_DEVICE_NAME); if (usb_dev == NULL) { - DPRINTFN(0, "Could not create usb bus device!\n"); + DPRINTFN(0, "Could not create usb bus device\n"); } } Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/usb_device.c Wed Dec 9 22:42:40 2009 (r200334) @@ -1023,7 +1023,7 @@ usb_detach_device_sub(struct usb_device if (udev->flags.peer_suspended) { err = DEVICE_RESUME(dev); if (err) { - device_printf(dev, "Resume failed!\n"); + device_printf(dev, "Resume failed\n"); } } if (device_detach(dev)) { @@ -1038,7 +1038,7 @@ usb_detach_device_sub(struct usb_device error: /* Detach is not allowed to fail in the USB world */ - panic("An USB driver would not detach!\n"); + panic("A USB driver would not detach\n"); } /*------------------------------------------------------------------------* @@ -1131,7 +1131,7 @@ usb_probe_and_attach_sub(struct usb_devi * to device_detach(). USB devices should * never fail on detach! */ - panic("device_delete_child() failed!\n"); + panic("device_delete_child() failed\n"); } } if (uaa->temp_dev == NULL) { @@ -1140,7 +1140,7 @@ usb_probe_and_attach_sub(struct usb_devi uaa->temp_dev = device_add_child(udev->parent_dev, NULL, -1); if (uaa->temp_dev == NULL) { device_printf(udev->parent_dev, - "Device creation failed!\n"); + "Device creation failed\n"); return (1); /* failure */ } device_set_ivars(uaa->temp_dev, uaa); @@ -1320,7 +1320,7 @@ usb_probe_and_attach(struct usb_device * /* remove the last created child; it is unused */ if (device_delete_child(udev->parent_dev, uaa.temp_dev)) { - DPRINTFN(0, "device delete child failed!\n"); + DPRINTFN(0, "device delete child failed\n"); } } done: @@ -1353,7 +1353,7 @@ usb_suspend_resume_sub(struct usb_device err = DEVICE_RESUME(dev); } if (err) { - device_printf(dev, "%s failed!\n", + device_printf(dev, "%s failed\n", do_suspend ? "Suspend" : "Resume"); } } @@ -1473,13 +1473,13 @@ usb_alloc_device(device_t parent_dev, st if (device_index == bus->devices_max) { device_printf(bus->bdev, - "No free USB device index for new device!\n"); + "No free USB device index for new device\n"); return (NULL); } if (depth > 0x10) { device_printf(bus->bdev, - "Invalid device depth!\n"); + "Invalid device depth\n"); return (NULL); } udev = malloc(sizeof(*udev), M_USB, M_WAITOK | M_ZERO); @@ -1631,7 +1631,7 @@ usb_alloc_device(device_t parent_dev, st USB_MAX_IPACKET, USB_MAX_IPACKET, 0, UDESC_DEVICE, 0, 0); if (err) { DPRINTFN(0, "getting device descriptor " - "at addr %d failed, %s!\n", udev->address, + "at addr %d failed, %s\n", udev->address, usbd_errstr(err)); /* XXX try to re-enumerate the device */ err = usbd_req_re_enumerate(udev, NULL); @@ -1797,7 +1797,7 @@ repeat_set_config: (usbd_get_no_descriptors(udev->cdesc, UDESC_ENDPOINT) == 0)) { DPRINTFN(0, "Found no endpoints " - "(trying next config)!\n"); + "(trying next config)\n"); config_index++; goto repeat_set_config; } @@ -1814,7 +1814,7 @@ repeat_set_config: } } } else if (usb_test_huawei_autoinst_p(udev, &uaa) == 0) { - DPRINTFN(0, "Found Huawei auto-install disk!\n"); + DPRINTFN(0, "Found Huawei auto-install disk\n"); /* leave device unconfigured */ usb_unconfigure(udev, 0); } Modified: stable/8/sys/dev/usb/usb_hid.c ============================================================================== --- stable/8/sys/dev/usb/usb_hid.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/usb_hid.c Wed Dec 9 22:42:40 2009 (r200334) @@ -450,7 +450,7 @@ hid_get_item(struct hid_data *s, struct c = &s->cur[s->pushlevel]; } else { DPRINTFN(0, "Cannot push " - "item @ %d!\n", s->pushlevel); + "item @ %d\n", s->pushlevel); } break; case 11: /* Pop */ @@ -468,7 +468,7 @@ hid_get_item(struct hid_data *s, struct c->loc.count = 0; } else { DPRINTFN(0, "Cannot pop " - "item @ %d!\n", s->pushlevel); + "item @ %d\n", s->pushlevel); } break; default: @@ -490,7 +490,7 @@ hid_get_item(struct hid_data *s, struct s->usages_max[s->nusage] = dval; s->nusage ++; } else { - DPRINTFN(0, "max usage reached!\n"); + DPRINTFN(0, "max usage reached\n"); } /* clear any pending usage sets */ @@ -525,7 +525,7 @@ hid_get_item(struct hid_data *s, struct c->usage_maximum; s->nusage ++; } else { - DPRINTFN(0, "Usage set dropped!\n"); + DPRINTFN(0, "Usage set dropped\n"); } s->susage = 0; break; Modified: stable/8/sys/dev/usb/usb_hub.c ============================================================================== --- stable/8/sys/dev/usb/usb_hub.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/usb_hub.c Wed Dec 9 22:42:40 2009 (r200334) @@ -385,7 +385,7 @@ repeat: (!(sc->sc_st.port_status & UPS_CURRENT_CONNECT_STATUS))) { if (timeout) { DPRINTFN(0, "giving up port reset " - "- device vanished!\n"); + "- device vanished\n"); goto error; } timeout = 1; @@ -435,7 +435,7 @@ repeat: child = usb_alloc_device(sc->sc_dev, udev->bus, udev, udev->depth + 1, portno - 1, portno, speed, mode); if (child == NULL) { - DPRINTFN(0, "could not allocate new device!\n"); + DPRINTFN(0, "could not allocate new device\n"); goto error; } return (0); /* success */ @@ -711,14 +711,14 @@ uhub_attach(device_t dev) parent_hub->flags.self_powered : 0); if (udev->depth > USB_HUB_MAX_DEPTH) { - DPRINTFN(0, "hub depth, %d, exceeded. HUB ignored!\n", + DPRINTFN(0, "hub depth, %d, exceeded. HUB ignored\n", USB_HUB_MAX_DEPTH); goto error; } if (!udev->flags.self_powered && parent_hub && (!parent_hub->flags.self_powered)) { DPRINTFN(0, "bus powered HUB connected to " - "bus powered HUB. HUB ignored!\n"); + "bus powered HUB. HUB ignored\n"); goto error; } /* get HUB descriptor */ @@ -740,11 +740,11 @@ uhub_attach(device_t dev) goto error; } if (hubdesc.bNbrPorts != nports) { - DPRINTFN(0, "number of ports changed!\n"); + DPRINTFN(0, "number of ports changed\n"); goto error; } if (nports == 0) { - DPRINTFN(0, "portless HUB!\n"); + DPRINTFN(0, "portless HUB\n"); goto error; } hub = malloc(sizeof(hub[0]) + (sizeof(hub->ports[0]) * nports), @@ -784,7 +784,7 @@ uhub_attach(device_t dev) } if (err) { DPRINTFN(0, "cannot setup interrupt transfer, " - "errstr=%s!\n", usbd_errstr(err)); + "errstr=%s\n", usbd_errstr(err)); goto error; } /* wait with power off for a while */ @@ -1924,7 +1924,7 @@ usb_dev_resume_peer(struct usb_device *u err = usbd_req_clear_port_feature(udev->parent_hub, NULL, udev->port_no, UHF_PORT_SUSPEND); if (err) { - DPRINTFN(0, "Resuming port failed!\n"); + DPRINTFN(0, "Resuming port failed\n"); return; } /* resume settle time */ @@ -1972,7 +1972,7 @@ usb_dev_resume_peer(struct usb_device *u NULL, UF_DEVICE_REMOTE_WAKEUP); if (err) { DPRINTFN(0, "Clearing device " - "remote wakeup failed: %s!\n", + "remote wakeup failed: %s\n", usbd_errstr(err)); } } @@ -2042,7 +2042,7 @@ repeat: NULL, UF_DEVICE_REMOTE_WAKEUP); if (err) { DPRINTFN(0, "Setting device " - "remote wakeup failed!\n"); + "remote wakeup failed\n"); } } USB_BUS_LOCK(udev->bus); Modified: stable/8/sys/dev/usb/usb_msctest.c ============================================================================== --- stable/8/sys/dev/usb/usb_msctest.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/usb_msctest.c Wed Dec 9 22:42:40 2009 (r200334) @@ -284,7 +284,7 @@ bbb_command_callback(struct usb_xfer *xf sc->cbw.bCDBLength = sc->cmd_len; if (sc->cbw.bCDBLength > sizeof(sc->cbw.CBWCDB)) { sc->cbw.bCDBLength = sizeof(sc->cbw.CBWCDB); - DPRINTFN(0, "Truncating long command!\n"); + DPRINTFN(0, "Truncating long command\n"); } usbd_xfer_set_frame_data(xfer, 0, &sc->cbw, sizeof(sc->cbw)); usbd_transfer_submit(xfer); Modified: stable/8/sys/dev/usb/usb_process.c ============================================================================== --- stable/8/sys/dev/usb/usb_process.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/usb_process.c Wed Dec 9 22:42:40 2009 (r200334) @@ -444,7 +444,7 @@ usb_proc_drain(struct usb_process *up) if (cold) { USB_THREAD_SUSPEND(up->up_ptr); printf("WARNING: A USB process has " - "been left suspended!\n"); + "been left suspended\n"); break; } cv_wait(&up->up_cv, up->up_mtx); Modified: stable/8/sys/dev/usb/usb_request.c ============================================================================== --- stable/8/sys/dev/usb/usb_request.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/usb_request.c Wed Dec 9 22:42:40 2009 (r200334) @@ -1549,7 +1549,7 @@ retry: USB_MAX_IPACKET, USB_MAX_IPACKET, 0, UDESC_DEVICE, 0, 0); if (err) { DPRINTFN(0, "getting device descriptor " - "at addr %d failed, %s!\n", udev->address, + "at addr %d failed, %s\n", udev->address, usbd_errstr(err)); goto done; } @@ -1557,7 +1557,7 @@ retry: err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); if (err) { DPRINTFN(0, "addr=%d, getting device " - "descriptor failed, %s!\n", old_addr, + "descriptor failed, %s\n", old_addr, usbd_errstr(err)); goto done; } Modified: stable/8/sys/dev/usb/usb_transfer.c ============================================================================== --- stable/8/sys/dev/usb/usb_transfer.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/usb_transfer.c Wed Dec 9 22:42:40 2009 (r200334) @@ -201,9 +201,9 @@ usbd_transfer_setup_sub_malloc(struct us usb_size_t r; usb_size_t z; - USB_ASSERT(align > 1, ("Invalid alignment, 0x%08x!\n", + USB_ASSERT(align > 1, ("Invalid alignment, 0x%08x\n", align)); - USB_ASSERT(size > 0, ("Invalid size = 0!\n")); + USB_ASSERT(size > 0, ("Invalid size = 0\n")); if (count == 0) { return (0); /* nothing to allocate */ @@ -1200,7 +1200,7 @@ usbd_transfer_unsetup(struct usb_xfer ** USB_BUS_LOCK(info->bus); USB_ASSERT(info->setup_refcount != 0, ("Invalid setup " - "reference count!\n")); + "reference count\n")); info->setup_refcount--; @@ -1353,7 +1353,7 @@ usbd_setup_ctrl_transfer(struct usb_xfer if (len > xfer->flags_int.control_rem) { DPRINTFN(0, "Length (%d) greater than " - "remaining length (%d)!\n", len, + "remaining length (%d)\n", len, xfer->flags_int.control_rem); goto error; } @@ -1366,7 +1366,7 @@ usbd_setup_ctrl_transfer(struct usb_xfer (len != xfer->flags_int.control_rem) && (xfer->nframes != 1)) { DPRINTFN(0, "Short control transfer without " - "force_short_xfer set!\n"); + "force_short_xfer set\n"); goto error; } xfer->flags_int.control_rem -= len; @@ -1927,7 +1927,7 @@ usbd_xfer_set_frame_offset(struct usb_xf usb_frcount_t frindex) { KASSERT(!xfer->flags.ext_buffer, ("Cannot offset data frame " - "when the USB buffer is external!\n")); + "when the USB buffer is external\n")); KASSERT(frindex < xfer->max_frame_count, ("frame index overflow")); /* set virtual address to load */ @@ -2437,7 +2437,7 @@ usbd_pipe_start(struct usb_xfer_queue *p &udev->cs_msg[0], &udev->cs_msg[1]); } else { /* should not happen */ - DPRINTFN(0, "No stall handler!\n"); + DPRINTFN(0, "No stall handler\n"); } /* * Check if we should stall. Some USB hardware @@ -2580,7 +2580,7 @@ usbd_callback_wrapper_sub(struct usb_xfe if (xfer->aframes > xfer->nframes) { if (xfer->error == 0) { panic("%s: actual number of frames, %d, is " - "greater than initial number of frames, %d!\n", + "greater than initial number of frames, %d\n", __FUNCTION__, xfer->aframes, xfer->nframes); } else { /* just set some valid value */ @@ -2607,7 +2607,7 @@ usbd_callback_wrapper_sub(struct usb_xfe if (xfer->actlen > xfer->sumlen) { if (xfer->error == 0) { panic("%s: actual length, %d, is greater than " - "initial length, %d!\n", + "initial length, %d\n", __FUNCTION__, xfer->actlen, xfer->sumlen); } else { /* just set some valid value */ @@ -2809,7 +2809,7 @@ repeat: udev->default_xfer, usb_control_ep_cfg, USB_DEFAULT_XFER_MAX, NULL, udev->default_mtx)) { DPRINTFN(0, "could not setup default " - "USB transfer!\n"); + "USB transfer\n"); } else { goto repeat; } Modified: stable/8/sys/dev/usb/wlan/if_upgt.c ============================================================================== --- stable/8/sys/dev/usb/wlan/if_upgt.c Wed Dec 9 22:41:50 2009 (r200333) +++ stable/8/sys/dev/usb/wlan/if_upgt.c Wed Dec 9 22:42:40 2009 (r200334) @@ -292,7 +292,7 @@ upgt_attach(device_t dev) /* Calculate device memory space. */ if (sc->sc_memaddr_frame_start == 0 || sc->sc_memaddr_frame_end == 0) { device_printf(dev, - "could not find memory space addresses on FW!\n"); + "could not find memory space addresses on FW\n"); error = EIO; goto fail5; } @@ -732,7 +732,7 @@ upgt_set_macfilter(struct upgt_softc *sc break; default: device_printf(sc->sc_dev, - "MAC filter does not know that state!\n"); + "MAC filter does not know that state\n"); break; } @@ -1181,7 +1181,7 @@ upgt_eeprom_parse(struct upgt_softc *sc) break; case UPGT_EEPROM_TYPE_OFF: DPRINTF(sc, UPGT_DEBUG_FW, - "%s: EEPROM off without end option!\n", __func__); + "%s: EEPROM off without end option\n", __func__); return (EIO); default: DPRINTF(sc, UPGT_DEBUG_FW, @@ -1356,7 +1356,7 @@ upgt_eeprom_read(struct upgt_softc *sc) error = mtx_sleep(sc, &sc->sc_mtx, 0, "eeprom_request", hz); if (error != 0) { device_printf(sc->sc_dev, - "timeout while waiting for EEPROM data!\n"); + "timeout while waiting for EEPROM data\n"); UPGT_UNLOCK(sc); return (EIO); } @@ -1490,7 +1490,7 @@ upgt_rx(struct upgt_softc *sc, uint8_t * ("A current mbuf storage is small (%d)", pkglen + ETHER_ALIGN)); m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { - device_printf(sc->sc_dev, "could not create RX mbuf!\n"); + device_printf(sc->sc_dev, "could not create RX mbuf\n"); return (NULL); } m_adj(m, ETHER_ALIGN); @@ -1587,7 +1587,7 @@ upgt_mem_free(struct upgt_softc *sc, uin } device_printf(sc->sc_dev, - "could not free memory address 0x%08x!\n", addr); + "could not free memory address 0x%08x\n", addr); } static int @@ -1602,7 +1602,7 @@ upgt_fw_load(struct upgt_softc *sc) fw = firmware_get(upgt_fwname); if (fw == NULL) { - device_printf(sc->sc_dev, "could not read microcode %s!\n", + device_printf(sc->sc_dev, "could not read microcode %s\n", upgt_fwname); return (EIO); } @@ -1676,7 +1676,7 @@ upgt_fw_load(struct upgt_softc *sc) usbd_transfer_start(sc->sc_xfer[UPGT_BULK_RX]); error = mtx_sleep(sc, &sc->sc_mtx, 0, "upgtfw", 2 * hz); if (error != 0) { - device_printf(sc->sc_dev, "firmware load failed!\n"); + device_printf(sc->sc_dev, "firmware load failed\n"); error = EIO; } @@ -1782,7 +1782,7 @@ upgt_fw_verify(struct upgt_softc *sc) fw = firmware_get(upgt_fwname); if (fw == NULL) { - device_printf(sc->sc_dev, "could not read microcode %s!\n", + device_printf(sc->sc_dev, "could not read microcode %s\n", upgt_fwname); return EIO; } @@ -1802,7 +1802,7 @@ upgt_fw_verify(struct upgt_softc *sc) } if (offset == fw->datasize) { device_printf(sc->sc_dev, - "firmware Boot Record Area not found!\n"); + "firmware Boot Record Area not found\n"); error = EIO; goto fail; } @@ -1827,7 +1827,7 @@ upgt_fw_verify(struct upgt_softc *sc) if (bra_option_len != UPGT_BRA_FWTYPE_SIZE) { device_printf(sc->sc_dev, - "wrong UPGT_BRA_TYPE_FW len!\n"); + "wrong UPGT_BRA_TYPE_FW len\n"); error = EIO; goto fail; } @@ -1842,7 +1842,7 @@ upgt_fw_verify(struct upgt_softc *sc) break; } device_printf(sc->sc_dev, - "unsupported firmware type!\n"); + "unsupported firmware type\n"); error = EIO; goto fail; case UPGT_BRA_TYPE_VERSION: @@ -1946,7 +1946,7 @@ upgt_alloc_tx(struct upgt_softc *sc) data->buf = malloc(MCLBYTES, M_USBDEV, M_NOWAIT | M_ZERO); if (data->buf == NULL) { device_printf(sc->sc_dev, - "could not allocate TX buffer!\n"); + "could not allocate TX buffer\n"); return (ENOMEM); } STAILQ_INSERT_TAIL(&sc->sc_tx_inactive, data, next); @@ -1970,7 +1970,7 @@ upgt_alloc_rx(struct upgt_softc *sc) data->buf = malloc(MCLBYTES, M_USBDEV, M_NOWAIT | M_ZERO); if (data->buf == NULL) { device_printf(sc->sc_dev, - "could not allocate RX buffer!\n"); + "could not allocate RX buffer\n"); return (ENOMEM); } STAILQ_INSERT_TAIL(&sc->sc_rx_inactive, data, next); From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 23:10:33 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B565106566B; Wed, 9 Dec 2009 23:10:33 +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 3A48F8FC16; Wed, 9 Dec 2009 23:10:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9NAXdZ043454; Wed, 9 Dec 2009 23:10:33 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9NAWwX043453; Wed, 9 Dec 2009 23:10:32 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092310.nB9NAWwX043453@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 23:10:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200335 - stable/8/sys/dev/sound/usb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 23:10:33 -0000 Author: thompsa Date: Wed Dec 9 23:10:32 2009 New Revision: 200335 URL: http://svn.freebsd.org/changeset/base/200335 Log: MFC r196487 Remove redundant Giant reference. Giant will be dropped automatically when the mutex argument is NULL. Modified: stable/8/sys/dev/sound/usb/uaudio.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/8/sys/dev/sound/usb/uaudio.c Wed Dec 9 22:42:40 2009 (r200334) +++ stable/8/sys/dev/sound/usb/uaudio.c Wed Dec 9 23:10:32 2009 (r200335) @@ -2958,7 +2958,7 @@ uaudio_mixer_get(struct usb_device *udev USETW(req.wIndex, mc->wIndex); USETW(req.wLength, len); - err = usbd_do_request(udev, &Giant, &req, data); + err = usbd_do_request(udev, NULL, &req, data); if (err) { DPRINTF("err=%s\n", usbd_errstr(err)); return (0); @@ -3081,7 +3081,7 @@ uaudio_set_speed(struct usb_device *udev data[1] = speed >> 8; data[2] = speed >> 16; - return (usbd_do_request(udev, &Giant, &req, data)); + return (usbd_do_request(udev, NULL, &req, data)); } static int From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 23:11:27 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4079106566B; Wed, 9 Dec 2009 23:11:27 +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 D173D8FC14; Wed, 9 Dec 2009 23:11:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9NBRi0043531; Wed, 9 Dec 2009 23:11:27 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9NBRWh043529; Wed, 9 Dec 2009 23:11:27 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092311.nB9NBRWh043529@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 23:11:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200336 - stable/8/sys/dev/sound/usb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 23:11:28 -0000 Author: thompsa Date: Wed Dec 9 23:11:27 2009 New Revision: 200336 URL: http://svn.freebsd.org/changeset/base/200336 Log: MFC r199060 Improve support for High-speed USB audio devices. - fix issues regarding the mixer, where the interface number was not set in time. - fix wrong use of resolution parameter. Submitted by: Hans Petter Selasky Modified: stable/8/sys/dev/sound/usb/uaudio.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/8/sys/dev/sound/usb/uaudio.c Wed Dec 9 23:10:32 2009 (r200335) +++ stable/8/sys/dev/sound/usb/uaudio.c Wed Dec 9 23:11:27 2009 (r200336) @@ -105,10 +105,9 @@ SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, def &uaudio_default_channels, 0, "uaudio default sample channels"); #endif -#define UAUDIO_MINFRAMES 16 /* must be factor of 8 due HS-USB */ +#define UAUDIO_NFRAMES 64 /* must be factor of 8 due HS-USB */ #define UAUDIO_NCHANBUFS 2 /* number of outstanding request */ #define UAUDIO_RECURSE_LIMIT 24 /* rounds */ -#define UAUDIO_MINFRAMES_ALIGN(x) ((x) & ~(UAUDIO_MINFRAMES - 1)) #define MAKE_WORD(h,l) (((h) << 8) | (l)) #define BIT_TEST(bm,bno) (((bm)[(bno) / 8] >> (7 - ((bno) % 8))) & 1) @@ -119,7 +118,7 @@ struct uaudio_mixer_node { int32_t maxval; #define MIX_MAX_CHAN 8 int32_t wValue[MIX_MAX_CHAN]; /* using nchan */ - uint32_t delta; + uint32_t mod; /* modulus */ uint32_t mul; uint32_t ctl; @@ -169,7 +168,7 @@ struct uaudio_chan { * buffer */ uint32_t intr_size; /* in bytes */ - uint32_t block_size; + uint32_t intr_frames; /* in units */ uint32_t sample_rate; uint32_t format; uint32_t pcm_format[2]; @@ -410,7 +409,7 @@ static const struct usb_config .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = 0, /* use "wMaxPacketSize * frames" */ - .frames = UAUDIO_MINFRAMES, + .frames = UAUDIO_NFRAMES, .flags = {.short_xfer_ok = 1,}, .callback = &uaudio_chan_record_callback, }, @@ -420,7 +419,7 @@ static const struct usb_config .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = 0, /* use "wMaxPacketSize * frames" */ - .frames = UAUDIO_MINFRAMES, + .frames = UAUDIO_NFRAMES, .flags = {.short_xfer_ok = 1,}, .callback = &uaudio_chan_record_callback, }, @@ -433,7 +432,7 @@ static const struct usb_config .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = 0, /* use "wMaxPacketSize * frames" */ - .frames = UAUDIO_MINFRAMES, + .frames = UAUDIO_NFRAMES, .flags = {.short_xfer_ok = 1,}, .callback = &uaudio_chan_play_callback, }, @@ -443,7 +442,7 @@ static const struct usb_config .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = 0, /* use "wMaxPacketSize * frames" */ - .frames = UAUDIO_MINFRAMES, + .frames = UAUDIO_NFRAMES, .flags = {.short_xfer_ok = 1,}, .callback = &uaudio_chan_play_callback, }, @@ -506,7 +505,6 @@ static const struct usb_config .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, .bufsize = sizeof(struct usb_device_request), - .flags = {}, .callback = &umidi_write_clear_stall_callback, .timeout = 1000, /* 1 second */ .interval = 50, /* 50ms */ @@ -517,7 +515,6 @@ static const struct usb_config .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, .bufsize = sizeof(struct usb_device_request), - .flags = {}, .callback = &umidi_read_clear_stall_callback, .timeout = 1000, /* 1 second */ .interval = 50, /* 50ms */ @@ -577,6 +574,8 @@ uaudio_attach(device_t dev) sc->sc_play_chan.priv_sc = sc; sc->sc_rec_chan.priv_sc = sc; sc->sc_udev = uaa->device; + sc->sc_mixer_iface_index = uaa->info.bIfaceIndex; + sc->sc_mixer_iface_no = uaa->info.bIfaceNum; if (usb_test_quirk(uaa, UQ_AUDIO_SWAP_LR)) sc->sc_uq_audio_swap_lr = 1; @@ -600,9 +599,6 @@ uaudio_attach(device_t dev) uaudio_mixer_fill_info(sc, uaa->device, id); - sc->sc_mixer_iface_index = uaa->info.bIfaceIndex; - sc->sc_mixer_iface_no = uaa->info.bIfaceNum; - DPRINTF("audio rev %d.%02x\n", sc->sc_audio_rev >> 8, sc->sc_audio_rev & 0xff); @@ -1119,34 +1115,11 @@ done: * next audio transfer. */ static void -uaudio_setup_blockcount(struct uaudio_chan *ch, usb_frcount_t max_frames, +uaudio_setup_blockcount(struct uaudio_chan *ch, uint32_t *total, uint32_t *blockcount) { - uint32_t temp; - uint32_t isiz; - - /* allow dynamic sizing of play buffer */ - isiz = ch->intr_size; - - /* allow dynamic sizing of play buffer */ - temp = isiz / ch->bytes_per_frame; - - /* align units */ - temp = UAUDIO_MINFRAMES_ALIGN(temp); - - /* range check - min */ - if (temp == 0) - temp = UAUDIO_MINFRAMES; - - /* range check - max */ - if (temp > max_frames) - temp = max_frames; - - /* store blockcount */ - *blockcount = temp; - - /* compute the total length */ - *total = temp * ch->bytes_per_frame; + *total = ch->intr_size; + *blockcount = ch->intr_frames; } static void @@ -1162,8 +1135,12 @@ uaudio_chan_play_callback(struct usb_xfe usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL); - uaudio_setup_blockcount(ch, usbd_xfer_max_frames(xfer), - &total, &blockcount); + uaudio_setup_blockcount(ch, &total, &blockcount); + + if (ch->end == ch->start) { + DPRINTF("no buffer!\n"); + return; + } switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -1187,10 +1164,6 @@ tr_transferred: for (n = 0; n != blockcount; n++) usbd_xfer_set_frame_len(xfer, n, ch->bytes_per_frame); - if (ch->end == ch->start) { - DPRINTF("no buffer!\n"); - break; - } DPRINTFN(6, "transfer %d bytes\n", total); offset = 0; @@ -1235,17 +1208,23 @@ uaudio_chan_record_callback(struct usb_x uint32_t blockcount; uint32_t offset0; uint32_t offset1; + uint32_t mfl; int len; - int actlen, nframes; + int actlen; + int nframes; usbd_xfer_status(xfer, &actlen, NULL, NULL, &nframes); + mfl = usbd_xfer_max_framelen(xfer); - uaudio_setup_blockcount(ch, usbd_xfer_max_frames(xfer), - &total, &blockcount); + uaudio_setup_blockcount(ch, &total, &blockcount); + + if (ch->end == ch->start) { + DPRINTF("no buffer!\n"); + return; + } switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: -tr_transferred: if (actlen < total) { DPRINTF("short transfer, " "%d of %d bytes\n", actlen, total); @@ -1254,11 +1233,11 @@ tr_transferred: } offset0 = 0; + pc = usbd_xfer_get_frame(xfer, 0); for (n = 0; n != nframes; n++) { offset1 = offset0; - pc = usbd_xfer_get_frame(xfer, 0); len = usbd_xfer_frame_len(xfer, n); while (len > 0) { @@ -1279,36 +1258,26 @@ tr_transferred: } } - offset0 += ch->bytes_per_frame; + offset0 += mfl; } chn_intr(ch->pcm_ch); case USB_ST_SETUP: - if (ch->bytes_per_frame > usbd_xfer_max_framelen(xfer)) { - DPRINTF("bytes per transfer, %d, " - "exceeds maximum, %d!\n", - ch->bytes_per_frame, - usbd_xfer_max_framelen(xfer)); - return; - } +tr_setup: usbd_xfer_set_frames(xfer, blockcount); for (n = 0; n < blockcount; n++) { - usbd_xfer_set_frame_len(xfer, n, ch->bytes_per_frame); + usbd_xfer_set_frame_len(xfer, n, mfl); } - if (ch->end == ch->start) { - DPRINTF("no buffer!\n"); - return; - } usbd_transfer_submit(xfer); - return; + break; default: /* Error */ if (error == USB_ERR_CANCELLED) { - return; + break; } - goto tr_transferred; + goto tr_setup; } } @@ -1319,38 +1288,26 @@ uaudio_chan_init(struct uaudio_softc *sc struct uaudio_chan *ch = ((dir == PCMDIR_PLAY) ? &sc->sc_play_chan : &sc->sc_rec_chan); uint32_t buf_size; + uint32_t frames; uint8_t endpoint; + uint8_t blocks; uint8_t iface_index; uint8_t alt_index; + uint8_t fps_shift; usb_error_t err; - /* compute required buffer size */ - buf_size = (ch->bytes_per_frame * UAUDIO_MINFRAMES); - - /* setup interrupt interval */ - ch->intr_size = buf_size; + if (usbd_get_isoc_fps(sc->sc_udev) < 8000) { + /* FULL speed USB */ + frames = 8; + } else { + /* HIGH speed USB */ + frames = UAUDIO_NFRAMES; + } - /* double buffering */ - buf_size *= 2; + /* compute required buffer size */ - ch->buf = malloc(buf_size, M_DEVBUF, M_WAITOK | M_ZERO); - if (ch->buf == NULL) { - goto error; - } - if (sndbuf_setup(b, ch->buf, buf_size) != 0) { - goto error; - } - ch->start = ch->buf; - ch->end = ch->buf + buf_size; - ch->cur = ch->buf; - ch->pcm_ch = c; - ch->pcm_mtx = c->lock; - ch->pcm_buf = b; + buf_size = (ch->bytes_per_frame * frames); - if (ch->pcm_mtx == NULL) { - DPRINTF("ERROR: PCM channels does not have a mutex!\n"); - goto error; - } /* setup play/record format */ ch->pcm_cap.fmtlist = ch->pcm_format; @@ -1370,7 +1327,6 @@ uaudio_chan_init(struct uaudio_softc *sc ch->pcm_cap.fmtlist[1] = 0; - /* set alternate interface corresponding to the mode */ endpoint = ch->p_ed1->bEndpointAddress; @@ -1407,6 +1363,43 @@ uaudio_chan_init(struct uaudio_softc *sc DPRINTF("could not allocate USB transfers!\n"); goto error; } + + fps_shift = usbd_xfer_get_fps_shift(ch->xfer[0]); + + /* setup frame sizes */ + ch->intr_size = buf_size; + ch->intr_frames = (frames >> fps_shift); + ch->bytes_per_frame <<= fps_shift; + + if (ch->intr_frames == 0) { + DPRINTF("frame shift is too high!\n"); + goto error; + } + + /* setup double buffering */ + buf_size *= 2; + blocks = 2; + + ch->buf = malloc(buf_size, M_DEVBUF, M_WAITOK | M_ZERO); + if (ch->buf == NULL) + goto error; + if (sndbuf_setup(b, ch->buf, buf_size) != 0) + goto error; + if (sndbuf_resize(b, blocks, ch->intr_size)) + goto error; + + ch->start = ch->buf; + ch->end = ch->buf + buf_size; + ch->cur = ch->buf; + ch->pcm_ch = c; + ch->pcm_mtx = c->lock; + ch->pcm_buf = b; + + if (ch->pcm_mtx == NULL) { + DPRINTF("ERROR: PCM channels does not have a mutex!\n"); + goto error; + } + return (ch); error: @@ -1431,30 +1424,13 @@ uaudio_chan_free(struct uaudio_chan *ch) int uaudio_chan_set_param_blocksize(struct uaudio_chan *ch, uint32_t blocksize) { - uaudio_chan_set_param_fragments(ch, blocksize, 0 - 1); - - return (ch->block_size); + return (ch->intr_size); } int uaudio_chan_set_param_fragments(struct uaudio_chan *ch, uint32_t blocksize, uint32_t blockcount) { - /* we only support one size */ - blocksize = ch->intr_size; - blockcount = 2; - - if ((sndbuf_getblksz(ch->pcm_buf) != blocksize) || - (sndbuf_getblkcnt(ch->pcm_buf) != blockcount)) { - DPRINTFN(1, "resizing to %u x " - "%u bytes\n", blockcount, blocksize); - if (sndbuf_resize(ch->pcm_buf, blockcount, blocksize)) { - DPRINTFN(0, "failed to resize sound buffer, count=%u, " - "size=%u\n", blockcount, blocksize); - } - } - ch->block_size = sndbuf_getblksz(ch->pcm_buf); - return (1); } @@ -1591,12 +1567,12 @@ uaudio_mixer_add_ctl(struct uaudio_softc DPRINTF("adding %d\n", mc->ctl); } - mc->delta = 0; if (mc->type == MIX_ON_OFF) { mc->minval = 0; mc->maxval = 1; + mc->mod = 1; } else if (mc->type == MIX_SELECTOR) { - + mc->mod = 1; } else { /* determine min and max values */ @@ -1607,21 +1583,30 @@ uaudio_mixer_add_ctl(struct uaudio_softc mc->maxval = uaudio_mixer_get(sc->sc_udev, GET_MAX, mc); - mc->maxval = 1 + uaudio_mixer_signext(mc->type, mc->maxval); + mc->maxval = uaudio_mixer_signext(mc->type, mc->maxval); + + /* check if max and min was swapped */ + + if (mc->maxval < mc->minval) { + res = mc->maxval; + mc->maxval = mc->minval; + mc->minval = res; + } + /* compute value range */ mc->mul = mc->maxval - mc->minval; - if (mc->mul == 0) { + if (mc->mul == 0) mc->mul = 1; - } + + /* compute value alignment */ res = uaudio_mixer_get(sc->sc_udev, GET_RES, mc); - if (res > 0) { - mc->delta = ((res * 255) + (mc->mul / 2)) / mc->mul; - } + if (res == 0) + res = 1; + mc->mod = mc->mul / res; + if (mc->mod == 0) + mc->mod = 1; } - if (mc->maxval < mc->minval) { - mc->maxval = mc->minval; - } uaudio_mixer_add_ctl_sub(sc, mc); #if USB_DEBUG @@ -3108,7 +3093,21 @@ uaudio_mixer_bsd2value(struct uaudio_mix val = mc->minval; } } else { - val = (((val + (mc->delta / 2)) * mc->mul) / 255) + mc->minval; + + /* compute actual volume */ + val = (val * mc->mul) / 255; + + /* align volume level */ + val = val - (val % mc->mod); + + /* add lower offset */ + val = val + mc->minval; + + /* make sure we don't write a value out of range */ + if (val > mc->maxval) + val = mc->maxval; + else if (val < mc->minval) + val = mc->minval; } DPRINTFN(6, "type=0x%03x val=%d min=%d max=%d val=%d\n", From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 23:12:14 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64BFA106566C; Wed, 9 Dec 2009 23:12:14 +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 52FDF8FC12; Wed, 9 Dec 2009 23:12:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9NCERw043597; Wed, 9 Dec 2009 23:12:14 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9NCEq1043595; Wed, 9 Dec 2009 23:12:14 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092312.nB9NCEq1043595@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 23:12:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200337 - stable/8/sys/dev/sound/usb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 23:12:14 -0000 Author: thompsa Date: Wed Dec 9 23:12:14 2009 New Revision: 200337 URL: http://svn.freebsd.org/changeset/base/200337 Log: MFC r199576 remove volume alignment (was previously not correctly implemented) Modified: stable/8/sys/dev/sound/usb/uaudio.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/8/sys/dev/sound/usb/uaudio.c Wed Dec 9 23:11:27 2009 (r200336) +++ stable/8/sys/dev/sound/usb/uaudio.c Wed Dec 9 23:12:14 2009 (r200337) @@ -118,7 +118,6 @@ struct uaudio_mixer_node { int32_t maxval; #define MIX_MAX_CHAN 8 int32_t wValue[MIX_MAX_CHAN]; /* using nchan */ - uint32_t mod; /* modulus */ uint32_t mul; uint32_t ctl; @@ -1318,6 +1317,11 @@ uaudio_chan_init(struct uaudio_softc *sc ch->pcm_cap.minspeed = ch->sample_rate; ch->pcm_cap.maxspeed = ch->sample_rate; + /* setup mutex and PCM channel */ + + ch->pcm_ch = c; + ch->pcm_mtx = c->lock; + if (ch->p_asf1d->bNrChannels >= 2) ch->pcm_cap.fmtlist[0] = SND_FORMAT(ch->p_fmt->freebsd_fmt, 2, 0); @@ -1391,8 +1395,6 @@ uaudio_chan_init(struct uaudio_softc *sc ch->start = ch->buf; ch->end = ch->buf + buf_size; ch->cur = ch->buf; - ch->pcm_ch = c; - ch->pcm_mtx = c->lock; ch->pcm_buf = b; if (ch->pcm_mtx == NULL) { @@ -1570,9 +1572,7 @@ uaudio_mixer_add_ctl(struct uaudio_softc if (mc->type == MIX_ON_OFF) { mc->minval = 0; mc->maxval = 1; - mc->mod = 1; } else if (mc->type == MIX_SELECTOR) { - mc->mod = 1; } else { /* determine min and max values */ @@ -1600,11 +1600,8 @@ uaudio_mixer_add_ctl(struct uaudio_softc /* compute value alignment */ res = uaudio_mixer_get(sc->sc_udev, GET_RES, mc); - if (res == 0) - res = 1; - mc->mod = mc->mul / res; - if (mc->mod == 0) - mc->mod = 1; + + DPRINTF("Resolution = %d\n", (int)res); } uaudio_mixer_add_ctl_sub(sc, mc); @@ -3097,9 +3094,6 @@ uaudio_mixer_bsd2value(struct uaudio_mix /* compute actual volume */ val = (val * mc->mul) / 255; - /* align volume level */ - val = val - (val % mc->mod); - /* add lower offset */ val = val + mc->minval; From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 23:12:52 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7CB41065670; Wed, 9 Dec 2009 23:12:52 +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 B5E2F8FC24; Wed, 9 Dec 2009 23:12:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9NCqjh043655; Wed, 9 Dec 2009 23:12:52 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9NCqUD043653; Wed, 9 Dec 2009 23:12:52 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092312.nB9NCqUD043653@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 23:12:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200338 - stable/8/sys/dev/sound/usb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 23:12:52 -0000 Author: thompsa Date: Wed Dec 9 23:12:52 2009 New Revision: 200338 URL: http://svn.freebsd.org/changeset/base/200338 Log: MFC r199677 add support for MIDI devices without audio control stream. Submitted by: Hans Petter Selasky Modified: stable/8/sys/dev/sound/usb/uaudio.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/8/sys/dev/sound/usb/uaudio.c Wed Dec 9 23:12:14 2009 (r200337) +++ stable/8/sys/dev/sound/usb/uaudio.c Wed Dec 9 23:12:52 2009 (r200338) @@ -559,6 +559,13 @@ uaudio_probe(device_t dev) else return (0); } + + /* check for MIDI stream */ + + if ((uaa->info.bInterfaceClass == UICLASS_AUDIO) && + (uaa->info.bInterfaceSubClass == UISUBCLASS_MIDISTREAM)) { + return (0); + } return (ENXIO); } From owner-svn-src-stable-8@FreeBSD.ORG Wed Dec 9 23:14:53 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 975E01065679; Wed, 9 Dec 2009 23:14:53 +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 857728FC15; Wed, 9 Dec 2009 23:14:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB9NErtg043759; Wed, 9 Dec 2009 23:14:53 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB9NErno043757; Wed, 9 Dec 2009 23:14:53 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912092314.nB9NErno043757@svn.freebsd.org> From: Andrew Thompson Date: Wed, 9 Dec 2009 23:14:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200339 - stable/8/usr.sbin/usbconfig X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 23:14:53 -0000 Author: thompsa Date: Wed Dec 9 23:14:53 2009 New Revision: 200339 URL: http://svn.freebsd.org/changeset/base/200339 Log: MFC r198833 Add more verbose output when dumping the configuration descriptor. Modified: stable/8/usr.sbin/usbconfig/dump.c Directory Properties: stable/8/usr.sbin/usbconfig/ (props changed) Modified: stable/8/usr.sbin/usbconfig/dump.c ============================================================================== --- stable/8/usr.sbin/usbconfig/dump.c Wed Dec 9 23:12:52 2009 (r200338) +++ stable/8/usr.sbin/usbconfig/dump.c Wed Dec 9 23:14:53 2009 (r200339) @@ -100,21 +100,66 @@ dump_field(struct libusb20_device *pdev, printf("%s%s = 0x%04x ", plevel, field, value); - if ((field[0] != 'i') || (field[1] == 'd')) { - printf("\n"); - return; - } - if (value == 0) { - printf(" \n"); - return; + if (strlen(plevel) == 8) { + /* Endpoint Descriptor */ + + if (strcmp(field, "bEndpointAddress") == 0) { + if (value & 0x80) + printf(" \n"); + else + printf(" \n"); + return; + } + + if (strcmp(field, "bmAttributes") == 0) { + switch (value & 0x03) { + case 0: + printf(" \n"); + break; + case 1: + switch (value & 0x0C) { + case 0x00: + printf(" \n"); + break; + case 0x04: + printf(" \n"); + break; + case 0x08: + printf(" \n"); + break; + default: + printf(" \n"); + break; + } + break; + case 2: + printf(" \n"); + break; + default: + printf(" \n"); + break; + } + return; + } } - if (libusb20_dev_req_string_simple_sync(pdev, value, - temp_string, sizeof(temp_string))) { - printf(" \n"); + + if ((field[0] == 'i') && (field[1] != 'd')) { + /* Indirect String Descriptor */ + if (value == 0) { + printf(" \n"); + return; + } + if (libusb20_dev_req_string_simple_sync(pdev, value, + temp_string, sizeof(temp_string))) { + printf(" \n"); + return; + } + printf(" <%s>\n", temp_string); return; } - printf(" <%s>\n", temp_string); - return; + + /* No additional information */ + printf("\n"); } static void From owner-svn-src-stable-8@FreeBSD.ORG Thu Dec 10 05:45:41 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C86C106566B; Thu, 10 Dec 2009 05:45:41 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D55EF8FC0A; Thu, 10 Dec 2009 05:45:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBA5jeYM052321; Thu, 10 Dec 2009 05:45:40 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBA5je5g052318; Thu, 10 Dec 2009 05:45:40 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200912100545.nBA5je5g052318@svn.freebsd.org> From: Marcel Moolenaar Date: Thu, 10 Dec 2009 05:45:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200349 - in stable/8/sys/dev: puc uart X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Dec 2009 05:45:41 -0000 Author: marcel Date: Thu Dec 10 05:45:40 2009 New Revision: 200349 URL: http://svn.freebsd.org/changeset/base/200349 Log: MFC rev 200230: Add support for the NetMos NM9865 family of Serial/Parallel ports. Modified: stable/8/sys/dev/puc/pucdata.c stable/8/sys/dev/uart/uart_bus_pci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/puc/pucdata.c ============================================================================== --- stable/8/sys/dev/puc/pucdata.c Thu Dec 10 05:08:58 2009 (r200348) +++ stable/8/sys/dev/puc/pucdata.c Thu Dec 10 05:45:40 2009 (r200349) @@ -168,10 +168,10 @@ const struct puc_cfg puc_pci_devices[] = { 0x10e8, 0x818e, 0xffff, 0, "Applied Micro Circuits 8 Port UART", - DEFAULT_RCLK, - PUC_PORT_8S, 0x14, -1, -1, + DEFAULT_RCLK, + PUC_PORT_8S, 0x14, -1, -1, .config_function = puc_config_amc - }, + }, { 0x11fe, 0x8010, 0xffff, 0, "Comtrol RocketPort 550/8 RJ11 part A", @@ -808,6 +808,42 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_4S1P, 0x10, 4, 0, }, + { 0x9710, 0x9865, 0xa000, 0x3002, + "NetMos NM9865 Dual UART", + DEFAULT_RCLK, + PUC_PORT_2S, 0x10, 4, 0, + }, + + { 0x9710, 0x9865, 0xa000, 0x3003, + "NetMos NM9865 Triple UART", + DEFAULT_RCLK, + PUC_PORT_3S, 0x10, 4, 0, + }, + + { 0x9710, 0x9865, 0xa000, 0x3004, + "NetMos NM9865 Quad UART", + DEFAULT_RCLK, + PUC_PORT_4S, 0x10, 4, 0,0 + }, + + { 0x9710, 0x9865, 0xa000, 0x3011, + "NetMos NM9865 Single UART and 1284 Printer port", + DEFAULT_RCLK, + PUC_PORT_1S1P, 0x10, 4, 0, + }, + + { 0x9710, 0x9865, 0xa000, 0x3012, + "NetMos NM9865 Dual UART and 1284 Printer port", + DEFAULT_RCLK, + PUC_PORT_2S1P, 0x10, 4, 0, + }, + + { 0x9710, 0x9865, 0xa000, 0x3020, + "NetMos NM9865 Dual 1284 Printer port", + DEFAULT_RCLK, + PUC_PORT_2P, 0x10, 4, 0, + }, + { 0xb00c, 0x021c, 0xffff, 0, "IC Book Labs Gunboat x4 Lite", DEFAULT_RCLK, Modified: stable/8/sys/dev/uart/uart_bus_pci.c ============================================================================== --- stable/8/sys/dev/uart/uart_bus_pci.c Thu Dec 10 05:08:58 2009 (r200348) +++ stable/8/sys/dev/uart/uart_bus_pci.c Thu Dec 10 05:45:40 2009 (r200349) @@ -111,6 +111,7 @@ static struct pci_id pci_ns8250_ids[] = 0x10, 16384000 }, { 0x151f, 0x0000, 0xffff, 0, "TOPIC Semiconductor TP560 56k modem", 0x10 }, { 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 }, +{ 0x9710, 0x9865, 0xa000, 0x1000, "NetMos NM9865 Serial Port", 0x10 }, { 0xdeaf, 0x9051, 0xffff, 0, "Middle Digital PC Weasel Serial Port", 0x10 }, { 0xffff, 0, 0xffff, 0, NULL, 0, 0} }; From owner-svn-src-stable-8@FreeBSD.ORG Thu Dec 10 11:52:16 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE3931065693; Thu, 10 Dec 2009 11:52:16 +0000 (UTC) (envelope-from syrinx@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CBD1F8FC08; Thu, 10 Dec 2009 11:52:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBABqGOC061521; Thu, 10 Dec 2009 11:52:16 GMT (envelope-from syrinx@svn.freebsd.org) Received: (from syrinx@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBABqGB6061515; Thu, 10 Dec 2009 11:52:16 GMT (envelope-from syrinx@svn.freebsd.org) Message-Id: <200912101152.nBABqGB6061515@svn.freebsd.org> From: Shteryana Shopova Date: Thu, 10 Dec 2009 11:52:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200355 - stable/8/contrib/bsnmp/snmp_mibII X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Dec 2009 11:52:17 -0000 Author: syrinx Date: Thu Dec 10 11:52:16 2009 New Revision: 200355 URL: http://svn.freebsd.org/changeset/base/200355 Log: MFC r200063 Fix a problem with high CPU consumption (up to 30%) by bsnmpd on a loaded system. Instead of constantly calling the mibII_idle function when the server is not busy call the function only once every 10 seconds to avoid bsnmpd constantly doing gettimeofday syscalls. Make the idle polling interval confugurable via begemotIfDataPoll. Modified: stable/8/contrib/bsnmp/snmp_mibII/BEGEMOT-MIB2-MIB.txt stable/8/contrib/bsnmp/snmp_mibII/mibII.c stable/8/contrib/bsnmp/snmp_mibII/mibII.h stable/8/contrib/bsnmp/snmp_mibII/mibII_begemot.c stable/8/contrib/bsnmp/snmp_mibII/mibII_tree.def Directory Properties: stable/8/contrib/bsnmp/ (props changed) Modified: stable/8/contrib/bsnmp/snmp_mibII/BEGEMOT-MIB2-MIB.txt ============================================================================== --- stable/8/contrib/bsnmp/snmp_mibII/BEGEMOT-MIB2-MIB.txt Thu Dec 10 10:34:30 2009 (r200354) +++ stable/8/contrib/bsnmp/snmp_mibII/BEGEMOT-MIB2-MIB.txt Thu Dec 10 11:52:16 2009 (r200355) @@ -39,7 +39,7 @@ IMPORTS FROM BEGEMOT-IP-MIB; begemotMib2 MODULE-IDENTITY - LAST-UPDATED "200602130000Z" + LAST-UPDATED "200908030000Z" ORGANIZATION "German Aerospace Center" CONTACT-INFO " Hartmut Brandt @@ -54,6 +54,12 @@ begemotMib2 MODULE-IDENTITY E-mail: harti@freebsd.org" DESCRIPTION "The MIB for private mib2 stuff." + REVISION "200908030000Z" + DESCRIPTION + "Second edition adds begemotIfDataPoll object." + REVISION "200602130000Z" + DESCRIPTION + "Initial revision." ::= { begemotIp 1 } begemotIfMaxspeed OBJECT-TYPE @@ -87,4 +93,14 @@ begemotIfForcePoll OBJECT-TYPE bit rate in its MIB." ::= { begemotMib2 3 } +begemotIfDataPoll OBJECT-TYPE + SYNTAX TimeTicks + UNITS "deciseconds" + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The rate at which the mib2 module will poll interface data." + DEFVAL { 100 } + ::= { begemotMib2 4 } + END Modified: stable/8/contrib/bsnmp/snmp_mibII/mibII.c ============================================================================== --- stable/8/contrib/bsnmp/snmp_mibII/mibII.c Thu Dec 10 10:34:30 2009 (r200354) +++ stable/8/contrib/bsnmp/snmp_mibII/mibII.c Thu Dec 10 11:52:16 2009 (r200355) @@ -117,6 +117,15 @@ u_int mibif_hc_update_interval; /* HC update timer handle */ static void *hc_update_timer; +/* Idle poll timer */ +static void *mibII_poll_timer; + +/* interfaces' data poll interval */ +u_int mibII_poll_ticks; + +/* Idle poll hook */ +static void mibII_idle(void *arg __unused); + /*****************************/ static const struct asn_oid oid_ifMIB = OIDX_ifMIB; @@ -410,6 +419,20 @@ mibif_reset_hc_timer(void) mibif_hc_update_interval = ticks; } +/** + * Restart the idle poll timer. + */ +void +mibif_restart_mibII_poll_timer(void) +{ + if (mibII_poll_timer != NULL) + timer_stop(mibII_poll_timer); + + if ((mibII_poll_timer = timer_start_repeat(mibII_poll_ticks * 10, + mibII_poll_ticks * 10, mibII_idle, NULL, module)) == NULL) + syslog(LOG_ERR, "timer_start(%u): %m", mibII_poll_ticks); +} + /* * Fetch new MIB data. */ @@ -1553,7 +1576,7 @@ get_cloners(void) * Idle function */ static void -mibII_idle(void) +mibII_idle(void *arg __unused) { struct mibifa *ifa; @@ -1608,6 +1631,10 @@ mibII_start(void) ipForward_reg = or_register(&oid_ipForward, "The MIB module for the display of CIDR multipath IP Routes.", module); + + mibII_poll_timer = NULL; + mibII_poll_ticks = MIBII_POLL_TICKS; + mibif_restart_mibII_poll_timer(); } /* @@ -1651,6 +1678,11 @@ mibII_init(struct lmodule *mod, int argc static int mibII_fini(void) { + if (mibII_poll_timer != NULL ) { + timer_stop(mibII_poll_timer); + mibII_poll_timer = NULL; + } + if (route_fd != NULL) fd_deselect(route_fd); if (route != -1) @@ -1690,7 +1722,7 @@ const struct snmp_module config = { "This module implements the interface and ip groups.", mibII_init, mibII_fini, - mibII_idle, /* idle */ + NULL, /* idle */ NULL, /* dump */ NULL, /* config */ mibII_start, Modified: stable/8/contrib/bsnmp/snmp_mibII/mibII.h ============================================================================== --- stable/8/contrib/bsnmp/snmp_mibII/mibII.h Thu Dec 10 10:34:30 2009 (r200354) +++ stable/8/contrib/bsnmp/snmp_mibII/mibII.h Thu Dec 10 11:52:16 2009 (r200355) @@ -211,6 +211,14 @@ extern u_int mibif_hc_update_interval; /* re-compute update interval */ void mibif_reset_hc_timer(void); +/* interfaces' data poll interval */ +extern u_int mibII_poll_ticks; + +/* restart the data poll timer */ +void mibif_restart_mibII_poll_timer(void); + +#define MIBII_POLL_TICKS 100 + /* get interfaces and interface addresses. */ void mib_fetch_interfaces(void); Modified: stable/8/contrib/bsnmp/snmp_mibII/mibII_begemot.c ============================================================================== --- stable/8/contrib/bsnmp/snmp_mibII/mibII_begemot.c Thu Dec 10 10:34:30 2009 (r200354) +++ stable/8/contrib/bsnmp/snmp_mibII/mibII_begemot.c Thu Dec 10 11:52:16 2009 (r200355) @@ -59,6 +59,11 @@ op_begemot_mibII(struct snmp_context *ct ctx->scratch->int1 = mibif_force_hc_update_interval; mibif_force_hc_update_interval = value->v.uint32; return (SNMP_ERR_NOERROR); + + case LEAF_begemotIfDataPoll: + ctx->scratch->int1 = mibII_poll_ticks; + mibII_poll_ticks = value->v.uint32; + return (SNMP_ERR_NOERROR); } abort(); @@ -68,6 +73,10 @@ op_begemot_mibII(struct snmp_context *ct case LEAF_begemotIfForcePoll: mibif_force_hc_update_interval = ctx->scratch->int1; return (SNMP_ERR_NOERROR); + + case LEAF_begemotIfDataPoll: + mibII_poll_ticks = ctx->scratch->int1; + return (SNMP_ERR_NOERROR); } abort(); @@ -78,6 +87,10 @@ op_begemot_mibII(struct snmp_context *ct mibif_force_hc_update_interval = ctx->scratch->int1; mibif_reset_hc_timer(); return (SNMP_ERR_NOERROR); + + case LEAF_begemotIfDataPoll: + mibif_restart_mibII_poll_timer(); + return (SNMP_ERR_NOERROR); } abort(); } @@ -98,6 +111,10 @@ op_begemot_mibII(struct snmp_context *ct case LEAF_begemotIfForcePoll: value->v.uint32 = mibif_force_hc_update_interval; return (SNMP_ERR_NOERROR); + + case LEAF_begemotIfDataPoll: + value->v.uint32 = mibII_poll_ticks; + return (SNMP_ERR_NOERROR); } abort(); } Modified: stable/8/contrib/bsnmp/snmp_mibII/mibII_tree.def ============================================================================== --- stable/8/contrib/bsnmp/snmp_mibII/mibII_tree.def Thu Dec 10 10:34:30 2009 (r200354) +++ stable/8/contrib/bsnmp/snmp_mibII/mibII_tree.def Thu Dec 10 11:52:16 2009 (r200355) @@ -240,6 +240,7 @@ (1 begemotIfMaxspeed COUNTER64 op_begemot_mibII GET) (2 begemotIfPoll TIMETICKS op_begemot_mibII GET) (3 begemotIfForcePoll TIMETICKS op_begemot_mibII GET SET) + (4 begemotIfDataPoll TIMETICKS op_begemot_mibII GET SET) ) ) ) From owner-svn-src-stable-8@FreeBSD.ORG Thu Dec 10 18:38:40 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0DCC1065695; Thu, 10 Dec 2009 18:38:40 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE71A8FC28; Thu, 10 Dec 2009 18:38:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBAIcekk071767; Thu, 10 Dec 2009 18:38:40 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBAIceex071764; Thu, 10 Dec 2009 18:38:40 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200912101838.nBAIceex071764@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 10 Dec 2009 18:38:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200362 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Dec 2009 18:38:41 -0000 Author: pjd Date: Thu Dec 10 18:38:40 2009 New Revision: 200362 URL: http://svn.freebsd.org/changeset/base/200362 Log: MFC r200124,r200126, r200124: Avoid using additional variable for storing an error if we are not going to do anything with it. r200126: Fix deadlock when ZVOLs are present and we are replacing dead component or calling scrub when pool is in a degraded state. It will try to taste ZVOLs, which will lead to deadlock, as ZVOL will try to acquire the same locks as replace/scrub is holding already. We can't simply skip provider based on their GEOM class, because ZVOL can have providers build on top of it and we need to skip those as well. We do it by asking for ZFS::iszvol attribute. Any ZVOL-based provider will give us positive answer and we have to skip those providers. This way we remove possibility to create ZFS pools on top of ZVOLs, but it is not very useful anyway. I believe deadlock is still possible in some very complex situations like when we have MD provider on top of UFS file on top of ZVOL. When we try to replace dead component in the pool mentioned ZVOL is based on, there might be a deadlock when ZFS will try to taste MD provider. There is no easy way to detect that, but it isn't very common. r200125,r200158: Fix order of looking for providers. Before r200125 the order of looking for providers was wrong. It was: 1. Find provider by name. 2. Find provider by guid. 3. Find provider by name and guid. Where it should have been: 1. Find provider by name and guid. 2. Find provider by guid. 3. Find provider by name. Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Dec 10 18:37:14 2009 (r200361) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Dec 10 18:38:40 2009 (r200362) @@ -293,11 +293,16 @@ vdev_geom_read_guid(struct g_consumer *c uint64_t psize; off_t offset, size; uint64_t guid; - int error, l, len; + int error, l, len, iszvol; g_topology_assert_not(); pp = cp->provider; + ZFS_LOG(1, "Reading guid from %s...", pp->name); + if (g_getattr("ZFS::iszvol", cp, &iszvol) == 0 && iszvol) { + ZFS_LOG(1, "Skipping ZVOL-based provider %s.", pp->name); + return (0); + } psize = pp->mediasize; psize = P2ALIGN(psize, (uint64_t)sizeof(vdev_label_t)); @@ -316,8 +321,7 @@ vdev_geom_read_guid(struct g_consumer *c if ((offset % pp->sectorsize) != 0) continue; - error = vdev_geom_io(cp, BIO_READ, label, offset, size); - if (error != 0) + if (vdev_geom_io(cp, BIO_READ, label, offset, size) != 0) continue; buf = label->vl_vdev_phys.vp_nvlist; @@ -502,7 +506,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi if ((owned = mtx_owned(&Giant))) mtx_unlock(&Giant); - cp = vdev_geom_open_by_path(vd, 0); + cp = vdev_geom_open_by_path(vd, 1); if (cp == NULL) { /* * The device at vd->vdev_path doesn't have the expected guid. @@ -512,7 +516,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi cp = vdev_geom_open_by_guid(vd); } if (cp == NULL) - cp = vdev_geom_open_by_path(vd, 1); + cp = vdev_geom_open_by_path(vd, 0); if (cp == NULL) { ZFS_LOG(1, "Provider %s not found.", vd->vdev_path); vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Dec 10 18:37:14 2009 (r200361) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Dec 10 18:38:40 2009 (r200362) @@ -335,8 +335,11 @@ zvol_start(struct bio *bp) wakeup_one(&zv->zv_queue); mtx_unlock(&zv->zv_queue_mtx); break; - case BIO_DELETE: case BIO_GETATTR: + if (g_handleattr_int(bp, "ZFS::iszvol", 1)) + break; + /* FALLTHROUGH */ + case BIO_DELETE: default: g_io_deliver(bp, EOPNOTSUPP); break; From owner-svn-src-stable-8@FreeBSD.ORG Thu Dec 10 23:46:37 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE2E710656A4; Thu, 10 Dec 2009 23:46:37 +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 CC8F48FC19; Thu, 10 Dec 2009 23:46:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBANkbBj078444; Thu, 10 Dec 2009 23:46:37 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBANkbr2078442; Thu, 10 Dec 2009 23:46:37 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912102346.nBANkbr2078442@svn.freebsd.org> From: Alexander Motin Date: Thu, 10 Dec 2009 23:46:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200372 - stable/8/sbin/geom/class/mirror X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Dec 2009 23:46:38 -0000 Author: mav Date: Thu Dec 10 23:46:37 2009 New Revision: 200372 URL: http://svn.freebsd.org/changeset/base/200372 Log: MFC r197044: Actually component with the greatest priority is used by the prefer balance algorithm. Modified: stable/8/sbin/geom/class/mirror/gmirror.8 Directory Properties: stable/8/sbin/geom/ (props changed) Modified: stable/8/sbin/geom/class/mirror/gmirror.8 ============================================================================== --- stable/8/sbin/geom/class/mirror/gmirror.8 Thu Dec 10 23:28:54 2009 (r200371) +++ stable/8/sbin/geom/class/mirror/gmirror.8 Thu Dec 10 23:46:37 2009 (r200372) @@ -122,7 +122,7 @@ indicates an action to be performed: Create a mirror. The order of components is important, because a component's priority is based on its position (starting from 0 to 255). -The component with the biggest priority (the lowest number) is used by the +The component with the biggest priority is used by the .Cm prefer balance algorithm and is also used as a master component when resynchronization is needed, From owner-svn-src-stable-8@FreeBSD.ORG Thu Dec 10 23:51:24 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76BBC1065670; Thu, 10 Dec 2009 23:51:24 +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 4B69F8FC08; Thu, 10 Dec 2009 23:51:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBANpO8V078610; Thu, 10 Dec 2009 23:51:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBANpOKc078607; Thu, 10 Dec 2009 23:51:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912102351.nBANpOKc078607@svn.freebsd.org> From: Alexander Motin Date: Thu, 10 Dec 2009 23:51:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200373 - stable/8/sbin/geom/class/mirror X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Dec 2009 23:51:24 -0000 Author: mav Date: Thu Dec 10 23:51:24 2009 New Revision: 200373 URL: http://svn.freebsd.org/changeset/base/200373 Log: MFC r200282, r200290: Change gmirror default balance algorithm from "split" to improved "load". "split" is very ineffective for devices with rotating media as HDDs. To be effective, it needs that transfer time reduction due to block splitting was bigger then access time increase due to non-sequential access. For modern HDDs I was able to reproduce it only with read sizes of 2MB and above, which is almost not applicable in real life. "load" algorithm same time is more universal and effective now. Modified: stable/8/sbin/geom/class/mirror/geom_mirror.c stable/8/sbin/geom/class/mirror/gmirror.8 Directory Properties: stable/8/sbin/geom/ (props changed) Modified: stable/8/sbin/geom/class/mirror/geom_mirror.c ============================================================================== --- stable/8/sbin/geom/class/mirror/geom_mirror.c Thu Dec 10 23:46:37 2009 (r200372) +++ stable/8/sbin/geom/class/mirror/geom_mirror.c Thu Dec 10 23:51:24 2009 (r200373) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_MIRROR_VERSION; -static char label_balance[] = "split", configure_balance[] = "none"; +static char label_balance[] = "load", configure_balance[] = "none"; static intmax_t label_slice = 4096, configure_slice = -1; static intmax_t insert_priority = 0, configure_priority = -1; Modified: stable/8/sbin/geom/class/mirror/gmirror.8 ============================================================================== --- stable/8/sbin/geom/class/mirror/gmirror.8 Thu Dec 10 23:46:37 2009 (r200372) +++ stable/8/sbin/geom/class/mirror/gmirror.8 Thu Dec 10 23:51:24 2009 (r200373) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 1, 2009 +.Dd December 8, 2009 .Dt GMIRROR 8 .Os .Sh NAME @@ -135,6 +135,7 @@ Specifies balance algorithm to use, one .Bl -tag -width ".Cm round-robin" .It Cm load Read from the component with the lowest load. +This is the default balance algorithm. .It Cm prefer Read from the component with the biggest priority. .It Cm round-robin @@ -142,7 +143,6 @@ Use round-robin algorithm when choosing .It Cm split Split read requests, which are bigger than or equal to slice size on N pieces, where N is the number of active components. -This is the default balance algorithm. .El .It Fl F Do not synchronize after a power failure or system crash. From owner-svn-src-stable-8@FreeBSD.ORG Fri Dec 11 01:06:31 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29BD81065741; Fri, 11 Dec 2009 01:06:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2B928FC14; Fri, 11 Dec 2009 01:06:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBB16UwV080630; Fri, 11 Dec 2009 01:06:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBB16UJK080628; Fri, 11 Dec 2009 01:06:30 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912110106.nBB16UJK080628@svn.freebsd.org> From: Alexander Motin Date: Fri, 11 Dec 2009 01:06:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200378 - stable/8/sys/dev/sound/pci/hda X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2009 01:06:31 -0000 Author: mav Date: Fri Dec 11 01:06:30 2009 New Revision: 200378 URL: http://svn.freebsd.org/changeset/base/200378 Log: MFC r199846: Add two Cirrus Logic codec IDs. Add GPIO setting quirk for Apple MacBookPro5,5. Submitted by: ed Modified: stable/8/sys/dev/sound/pci/hda/hdac.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdac.c Fri Dec 11 01:06:04 2009 (r200377) +++ stable/8/sys/dev/sound/pci/hda/hdac.c Fri Dec 11 01:06:30 2009 (r200378) @@ -315,6 +315,7 @@ SND_DECLARE_FILE("$FreeBSD$"); * (see HDA_CODEC_STAC9221 below). */ #define APPLE_INTEL_MAC 0x76808384 +#define APPLE_MACBOOKPRO55 0xcb7910de /* LG Electronics */ #define LG_VENDORID 0x1854 @@ -605,6 +606,11 @@ static const struct { #define HDA_CODEC_CONSTRUCT(vendor, id) \ (((uint32_t)(vendor##_VENDORID) << 16) | ((id) & 0xffff)) +/* Cirrus Logic */ +#define CIRRUSLOGIC_VENDORID 0x1013 +#define HDA_CODEC_CS4206 HDA_CODEC_CONSTRUCT(CIRRUSLOGIC, 0x4206) +#define HDA_CODEC_CS4207 HDA_CODEC_CONSTRUCT(CIRRUSLOGIC, 0x4207) + /* Realtek */ #define REALTEK_VENDORID 0x10ec #define HDA_CODEC_ALC260 HDA_CODEC_CONSTRUCT(REALTEK, 0x0260) @@ -804,6 +810,8 @@ static const struct { uint32_t id; char *name; } hdac_codecs[] = { + { HDA_CODEC_CS4206, "Cirrus Logic CS4206" }, + { HDA_CODEC_CS4207, "Cirrus Logic CS4207" }, { HDA_CODEC_ALC260, "Realtek ALC260" }, { HDA_CODEC_ALC262, "Realtek ALC262" }, { HDA_CODEC_ALC267, "Realtek ALC267" }, @@ -4667,6 +4675,8 @@ static const struct { HDA_QUIRK_GPIO0 | HDA_QUIRK_OVREF50, 0}, { APPLE_INTEL_MAC, HDA_CODEC_STAC9221, HDA_QUIRK_GPIO0 | HDA_QUIRK_GPIO1, 0 }, + { APPLE_MACBOOKPRO55, HDA_CODEC_CS4206, + HDA_QUIRK_GPIO1 | HDA_QUIRK_GPIO3, 0 }, { DELL_D630_SUBVENDOR, HDA_CODEC_STAC9205X, HDA_QUIRK_GPIO0, 0 }, { DELL_V1400_SUBVENDOR, HDA_CODEC_STAC9228X, From owner-svn-src-stable-8@FreeBSD.ORG Fri Dec 11 01:23:58 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86D4E106566C; Fri, 11 Dec 2009 01:23:58 +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 728758FC1A; Fri, 11 Dec 2009 01:23:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBB1Nwcg081510; Fri, 11 Dec 2009 01:23:58 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBB1Nw5O081498; Fri, 11 Dec 2009 01:23:58 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200912110123.nBB1Nw5O081498@svn.freebsd.org> From: Doug Barton Date: Fri, 11 Dec 2009 01:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200383 - in stable/8: contrib/bind9 contrib/bind9/bin/named contrib/bind9/lib/dns contrib/bind9/lib/dns/include/dns lib/bind X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2009 01:23:58 -0000 Author: dougb Date: Fri Dec 11 01:23:58 2009 New Revision: 200383 URL: http://svn.freebsd.org/changeset/base/200383 Log: MFC r199958: Update to BIND 9.6.1-P2. The vulnerability this is designed to fix is related to DNSSEC validation on a resolving name server that allows access to untrusted users. If your system does not fall into all 3 of these categories you do not need to update immediately. Modified: stable/8/contrib/bind9/CHANGES stable/8/contrib/bind9/bin/named/query.c stable/8/contrib/bind9/lib/dns/api stable/8/contrib/bind9/lib/dns/include/dns/types.h stable/8/contrib/bind9/lib/dns/masterdump.c stable/8/contrib/bind9/lib/dns/rbtdb.c stable/8/contrib/bind9/lib/dns/resolver.c stable/8/contrib/bind9/lib/dns/validator.c stable/8/contrib/bind9/version stable/8/lib/bind/config.h Directory Properties: stable/8/contrib/bind9/ (props changed) stable/8/lib/bind/ (props changed) Modified: stable/8/contrib/bind9/CHANGES ============================================================================== --- stable/8/contrib/bind9/CHANGES Fri Dec 11 01:17:49 2009 (r200382) +++ stable/8/contrib/bind9/CHANGES Fri Dec 11 01:23:58 2009 (r200383) @@ -1,3 +1,9 @@ + --- 9.6.1-P2 released --- + +2772. [security] When validating, track whether pending data was from + the additional section or not and only return it if + validates as secure. [RT #20438] + --- 9.6.1-P1 released --- 2640. [security] A specially crafted update packet will cause named Modified: stable/8/contrib/bind9/bin/named/query.c ============================================================================== --- stable/8/contrib/bind9/bin/named/query.c Fri Dec 11 01:17:49 2009 (r200382) +++ stable/8/contrib/bind9/bin/named/query.c Fri Dec 11 01:23:58 2009 (r200383) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: query.c,v 1.313.20.7 2009/03/13 01:38:51 marka Exp $ */ +/* $Id: query.c,v 1.313.20.7.12.1 2009/11/18 23:58:04 marka Exp $ */ /*! \file */ @@ -116,6 +116,8 @@ #define DNS_GETDB_NOLOG 0x02U #define DNS_GETDB_PARTIAL 0x04U +#define PENDINGOK(x) (((x) & DNS_DBFIND_PENDINGOK) != 0) + typedef struct client_additionalctx { ns_client_t *client; dns_rdataset_t *rdataset; @@ -1761,8 +1763,8 @@ query_addadditional2(void *arg, dns_name */ if (result == ISC_R_SUCCESS && additionaltype == dns_rdatasetadditional_fromcache && - (rdataset->trust == dns_trust_pending || - rdataset->trust == dns_trust_glue) && + (DNS_TRUST_PENDING(rdataset->trust) || + DNS_TRUST_GLUE(rdataset->trust)) && !validate(client, db, fname, rdataset, sigrdataset)) { dns_rdataset_disassociate(rdataset); if (dns_rdataset_isassociated(sigrdataset)) @@ -1801,8 +1803,8 @@ query_addadditional2(void *arg, dns_name */ if (result == ISC_R_SUCCESS && additionaltype == dns_rdatasetadditional_fromcache && - (rdataset->trust == dns_trust_pending || - rdataset->trust == dns_trust_glue) && + (DNS_TRUST_PENDING(rdataset->trust) || + DNS_TRUST_GLUE(rdataset->trust)) && !validate(client, db, fname, rdataset, sigrdataset)) { dns_rdataset_disassociate(rdataset); if (dns_rdataset_isassociated(sigrdataset)) @@ -2601,14 +2603,14 @@ query_addbestns(ns_client_t *client) { /* * Attempt to validate RRsets that are pending or that are glue. */ - if ((rdataset->trust == dns_trust_pending || - (sigrdataset != NULL && sigrdataset->trust == dns_trust_pending)) + if ((DNS_TRUST_PENDING(rdataset->trust) || + (sigrdataset != NULL && DNS_TRUST_PENDING(sigrdataset->trust))) && !validate(client, db, fname, rdataset, sigrdataset) && - (client->query.dboptions & DNS_DBFIND_PENDINGOK) == 0) + !PENDINGOK(client->query.dboptions)) goto cleanup; - if ((rdataset->trust == dns_trust_glue || - (sigrdataset != NULL && sigrdataset->trust == dns_trust_glue)) && + if ((DNS_TRUST_GLUE(rdataset->trust) || + (sigrdataset != NULL && DNS_TRUST_GLUE(sigrdataset->trust))) && !validate(client, db, fname, rdataset, sigrdataset) && SECURE(client) && WANTDNSSEC(client)) goto cleanup; @@ -3716,6 +3718,8 @@ query_find(ns_client_t *client, dns_fetc dns_rdataset_t *noqname; isc_boolean_t resuming; int line = -1; + dns_rdataset_t tmprdataset; + unsigned int dboptions; CTRACE("query_find"); @@ -3933,9 +3937,49 @@ query_find(ns_client_t *client, dns_fetc /* * Now look for an answer in the database. */ + dboptions = client->query.dboptions; + if (sigrdataset == NULL && client->view->enablednssec) { + /* + * If the client doesn't want DNSSEC we still want to + * look for any data pending validation to save a remote + * lookup if possible. + */ + dns_rdataset_init(&tmprdataset); + sigrdataset = &tmprdataset; + dboptions |= DNS_DBFIND_PENDINGOK; + } + refind: result = dns_db_find(db, client->query.qname, version, type, - client->query.dboptions, client->now, - &node, fname, rdataset, sigrdataset); + dboptions, client->now, &node, fname, + rdataset, sigrdataset); + /* + * If we have found pending data try to validate it. + * If the data does not validate as secure and we can't + * use the unvalidated data requery the database with + * pending disabled to prevent infinite looping. + */ + if (result != ISC_R_SUCCESS || !DNS_TRUST_PENDING(rdataset->trust)) + goto validation_done; + if (validate(client, db, fname, rdataset, sigrdataset)) + goto validation_done; + if (rdataset->trust != dns_trust_pending_answer || + !PENDINGOK(client->query.dboptions)) { + dns_rdataset_disassociate(rdataset); + if (sigrdataset != NULL && + dns_rdataset_isassociated(sigrdataset)) + dns_rdataset_disassociate(sigrdataset); + if (sigrdataset == &tmprdataset) + sigrdataset = NULL; + dns_db_detachnode(db, &node); + dboptions &= ~DNS_DBFIND_PENDINGOK; + goto refind; + } + validation_done: + if (sigrdataset == &tmprdataset) { + if (dns_rdataset_isassociated(sigrdataset)) + dns_rdataset_disassociate(sigrdataset); + sigrdataset = NULL; + } resume: CTRACE("query_find: resume"); Modified: stable/8/contrib/bind9/lib/dns/api ============================================================================== --- stable/8/contrib/bind9/lib/dns/api Fri Dec 11 01:17:49 2009 (r200382) +++ stable/8/contrib/bind9/lib/dns/api Fri Dec 11 01:23:58 2009 (r200383) @@ -1,3 +1,3 @@ -LIBINTERFACE = 52 +LIBINTERFACE = 53 LIBREVISION = 0 -LIBAGE = 2 +LIBAGE = 0 Modified: stable/8/contrib/bind9/lib/dns/include/dns/types.h ============================================================================== --- stable/8/contrib/bind9/lib/dns/include/dns/types.h Fri Dec 11 01:17:49 2009 (r200382) +++ stable/8/contrib/bind9/lib/dns/include/dns/types.h Fri Dec 11 01:23:58 2009 (r200383) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: types.h,v 1.130.50.3 2009/01/29 22:40:35 jinmei Exp $ */ +/* $Id: types.h,v 1.130.50.3.12.1 2009/11/18 23:58:04 marka Exp $ */ #ifndef DNS_TYPES_H #define DNS_TYPES_H 1 @@ -258,40 +258,52 @@ enum { dns_trust_none = 0, #define dns_trust_none ((dns_trust_t)dns_trust_none) - /*% Subject to DNSSEC validation but has not yet been validated */ - dns_trust_pending = 1, -#define dns_trust_pending ((dns_trust_t)dns_trust_pending) + /*% + * Subject to DNSSEC validation but has not yet been validated + * dns_trust_pending_additional (from the additional section). + */ + dns_trust_pending_additional = 1, +#define dns_trust_pending_additional \ + ((dns_trust_t)dns_trust_pending_additional) + + dns_trust_pending_answer = 2, +#define dns_trust_pending_answer ((dns_trust_t)dns_trust_pending_answer) /*% Received in the additional section of a response. */ - dns_trust_additional = 2, + dns_trust_additional = 3, #define dns_trust_additional ((dns_trust_t)dns_trust_additional) /* Received in a referral response. */ - dns_trust_glue = 3, + dns_trust_glue = 4, #define dns_trust_glue ((dns_trust_t)dns_trust_glue) /* Answer from a non-authoritative server */ - dns_trust_answer = 4, + dns_trust_answer = 5, #define dns_trust_answer ((dns_trust_t)dns_trust_answer) /* Received in the authority section as part of an authoritative response */ - dns_trust_authauthority = 5, + dns_trust_authauthority = 6, #define dns_trust_authauthority ((dns_trust_t)dns_trust_authauthority) /* Answer from an authoritative server */ - dns_trust_authanswer = 6, + dns_trust_authanswer = 7, #define dns_trust_authanswer ((dns_trust_t)dns_trust_authanswer) /* Successfully DNSSEC validated */ - dns_trust_secure = 7, + dns_trust_secure = 8, #define dns_trust_secure ((dns_trust_t)dns_trust_secure) /* This server is authoritative */ - dns_trust_ultimate = 8 + dns_trust_ultimate = 9 #define dns_trust_ultimate ((dns_trust_t)dns_trust_ultimate) }; +#define DNS_TRUST_PENDING(x) ((x) == dns_trust_pending_answer || \ + (x) == dns_trust_pending_additional) +#define DNS_TRUST_GLUE(x) ((x) == dns_trust_glue) + + /*% * Name checking severities. */ Modified: stable/8/contrib/bind9/lib/dns/masterdump.c ============================================================================== --- stable/8/contrib/bind9/lib/dns/masterdump.c Fri Dec 11 01:17:49 2009 (r200382) +++ stable/8/contrib/bind9/lib/dns/masterdump.c Fri Dec 11 01:23:58 2009 (r200383) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: masterdump.c,v 1.94.50.2 2009/01/18 23:47:40 tbox Exp $ */ +/* $Id: masterdump.c,v 1.94.50.2.12.1 2009/11/18 23:58:04 marka Exp $ */ /*! \file */ @@ -775,7 +775,8 @@ dump_order_compare(const void *a, const static const char *trustnames[] = { "none", - "pending", + "pending-additional", + "pending-answer", "additional", "glue", "answer", Modified: stable/8/contrib/bind9/lib/dns/rbtdb.c ============================================================================== --- stable/8/contrib/bind9/lib/dns/rbtdb.c Fri Dec 11 01:17:49 2009 (r200382) +++ stable/8/contrib/bind9/lib/dns/rbtdb.c Fri Dec 11 01:23:58 2009 (r200383) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rbtdb.c,v 1.270.12.6 2009/05/06 23:34:30 jinmei Exp $ */ +/* $Id: rbtdb.c,v 1.270.12.6.10.1 2009/11/18 23:58:04 marka Exp $ */ /*! \file */ @@ -4005,7 +4005,7 @@ cache_zonecut_callback(dns_rbtnode_t *no } if (dname_header != NULL && - (dname_header->trust != dns_trust_pending || + (!DNS_TRUST_PENDING(dname_header->trust) || (search->options & DNS_DBFIND_PENDINGOK) != 0)) { /* * We increment the reference count on node to ensure that @@ -4548,7 +4548,7 @@ cache_find(dns_db_t *db, dns_name_t *nam if (found == NULL || (found->trust == dns_trust_glue && ((options & DNS_DBFIND_GLUEOK) == 0)) || - (found->trust == dns_trust_pending && + (DNS_TRUST_PENDING(found->trust) && ((options & DNS_DBFIND_PENDINGOK) == 0))) { /* * If there is an NS rdataset at this node, then this is the Modified: stable/8/contrib/bind9/lib/dns/resolver.c ============================================================================== --- stable/8/contrib/bind9/lib/dns/resolver.c Fri Dec 11 01:17:49 2009 (r200382) +++ stable/8/contrib/bind9/lib/dns/resolver.c Fri Dec 11 01:23:58 2009 (r200383) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: resolver.c,v 1.384.14.14 2009/06/02 23:47:13 tbox Exp $ */ +/* $Id: resolver.c,v 1.384.14.14.8.1 2009/11/18 23:58:04 marka Exp $ */ /*! \file */ @@ -4293,6 +4293,7 @@ cache_name(fetchctx_t *fctx, dns_name_t * for it, unless it is glue. */ if (secure_domain && rdataset->trust != dns_trust_glue) { + dns_trust_t trust; /* * RRSIGs are validated as part of validating the * type they cover. @@ -4329,12 +4330,34 @@ cache_name(fetchctx_t *fctx, dns_name_t } /* + * Reject out of bailiwick additional records + * without RRSIGs as they can't possibly validate + * as "secure" and as we will never never want to + * store these as "answers" after validation. + */ + if (rdataset->trust == dns_trust_additional && + sigrdataset == NULL && EXTERNAL(rdataset)) + continue; + + /* + * XXXMPA: If we store as "answer" after validating + * then we need to do bailiwick processing and + * also need to track whether RRsets are in or + * out of bailiwick. This will require a another + * pending trust level. + * * Cache this rdataset/sigrdataset pair as - * pending data. + * pending data. Track whether it was additional + * or not. */ - rdataset->trust = dns_trust_pending; + if (rdataset->trust == dns_trust_additional) + trust = dns_trust_pending_additional; + else + trust = dns_trust_pending_answer; + + rdataset->trust = trust; if (sigrdataset != NULL) - sigrdataset->trust = dns_trust_pending; + sigrdataset->trust = trust; if (!need_validation || !ANSWER(rdataset)) { addedrdataset = ardataset; result = dns_db_addrdataset(fctx->cache, node, @@ -4682,7 +4705,7 @@ ncache_message(fetchctx_t *fctx, dns_adb for (trdataset = ISC_LIST_HEAD(tname->list); trdataset != NULL; trdataset = ISC_LIST_NEXT(trdataset, link)) - trdataset->trust = dns_trust_pending; + trdataset->trust = dns_trust_pending_answer; result = dns_message_nextname(fctx->rmessage, DNS_SECTION_AUTHORITY); } Modified: stable/8/contrib/bind9/lib/dns/validator.c ============================================================================== --- stable/8/contrib/bind9/lib/dns/validator.c Fri Dec 11 01:17:49 2009 (r200382) +++ stable/8/contrib/bind9/lib/dns/validator.c Fri Dec 11 01:23:58 2009 (r200383) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: validator.c,v 1.164.12.9 2009/05/07 23:47:12 tbox Exp $ */ +/* $Id: validator.c,v 1.164.12.9.8.1 2009/11/18 23:58:04 marka Exp $ */ #include @@ -1607,7 +1607,7 @@ get_key(dns_validator_t *val, dns_rdata_ * We have an rrset for the given keyname. */ val->keyset = &val->frdataset; - if (val->frdataset.trust == dns_trust_pending && + if (DNS_TRUST_PENDING(val->frdataset.trust) && dns_rdataset_isassociated(&val->fsigrdataset)) { /* @@ -1622,7 +1622,7 @@ get_key(dns_validator_t *val, dns_rdata_ if (result != ISC_R_SUCCESS) return (result); return (DNS_R_WAIT); - } else if (val->frdataset.trust == dns_trust_pending) { + } else if (DNS_TRUST_PENDING(val->frdataset.trust)) { /* * Having a pending key with no signature means that * something is broken. @@ -2243,7 +2243,7 @@ validatezonekey(dns_validator_t *val) { * We have DS records. */ val->dsset = &val->frdataset; - if (val->frdataset.trust == dns_trust_pending && + if (DNS_TRUST_PENDING(val->frdataset.trust) && dns_rdataset_isassociated(&val->fsigrdataset)) { result = create_validator(val, @@ -2256,7 +2256,7 @@ validatezonekey(dns_validator_t *val) { if (result != ISC_R_SUCCESS) return (result); return (DNS_R_WAIT); - } else if (val->frdataset.trust == dns_trust_pending) { + } else if (DNS_TRUST_PENDING(val->frdataset.trust)) { /* * There should never be an unsigned DS. */ @@ -3337,7 +3337,7 @@ proveunsecure(dns_validator_t *val, isc_ * There is no DS. If this is a delegation, * we maybe done. */ - if (val->frdataset.trust == dns_trust_pending) { + if (DNS_TRUST_PENDING(val->frdataset.trust)) { result = create_fetch(val, tname, dns_rdatatype_ds, dsfetched2, Modified: stable/8/contrib/bind9/version ============================================================================== --- stable/8/contrib/bind9/version Fri Dec 11 01:17:49 2009 (r200382) +++ stable/8/contrib/bind9/version Fri Dec 11 01:23:58 2009 (r200383) @@ -1,4 +1,4 @@ -# $Id: version,v 1.43.12.5.8.1 2009/07/28 14:18:08 marka Exp $ +# $Id: version,v 1.43.12.5.8.2 2009/11/18 23:58:04 marka Exp $ # # This file must follow /bin/sh rules. It is imported directly via # configure. @@ -7,4 +7,4 @@ MAJORVER=9 MINORVER=6 PATCHVER=1 RELEASETYPE=-P -RELEASEVER=1 +RELEASEVER=2 Modified: stable/8/lib/bind/config.h ============================================================================== --- stable/8/lib/bind/config.h Fri Dec 11 01:17:49 2009 (r200382) +++ stable/8/lib/bind/config.h Fri Dec 11 01:23:58 2009 (r200383) @@ -277,6 +277,10 @@ int sigwait(const unsigned int *set, int /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + /* Defined if extern char *optarg is not declared. */ /* #undef NEED_OPTARG */ From owner-svn-src-stable-8@FreeBSD.ORG Fri Dec 11 01:26:26 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D130710656A3; Fri, 11 Dec 2009 01:26:26 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFB318FC25; Fri, 11 Dec 2009 01:26:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBB1QQml081708; Fri, 11 Dec 2009 01:26:26 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBB1QQpm081706; Fri, 11 Dec 2009 01:26:26 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200912110126.nBB1QQpm081706@svn.freebsd.org> From: Marcel Moolenaar Date: Fri, 11 Dec 2009 01:26:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200386 - stable/8/sys/ia64/ia64 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2009 01:26:26 -0000 Author: marcel Date: Fri Dec 11 01:26:26 2009 New Revision: 200386 URL: http://svn.freebsd.org/changeset/base/200386 Log: MFC rev 200240: In exception_save, write-back ar.rnat after switching the backing-store. PR: ia64/120315 Modified: stable/8/sys/ia64/ia64/exception.S Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/ia64/ia64/exception.S ============================================================================== --- stable/8/sys/ia64/ia64/exception.S Fri Dec 11 01:26:09 2009 (r200385) +++ stable/8/sys/ia64/ia64/exception.S Fri Dec 11 01:26:26 2009 (r200386) @@ -219,43 +219,42 @@ exception_save_restart: (p13) dep r20=r20,r21,0,9 // align dirty registers ;; } - // r20=bspstore, r22=iip, r23=ipsr + // r19=rnat, r20=bspstore, r22=iip, r23=ipsr { .mmi st8 [r31]=r23,16 // psr (p13) mov ar.bspstore=r20 nop 0 ;; } -{ .mmi +{ .mmb +(p13) mov ar.rnat=r19 mov r18=ar.bsp - ;; - mov r19=cr.ifs - sub r18=r18,r20 + nop 0 ;; } { .mmi + mov r19=cr.ifs st8.spill [r30]=gp,16 // gp - st8 [r31]=r18,16 // ndirty - nop 0 + sub r18=r18,r20 ;; } // r19=ifs, r22=iip -{ .mmi +{ .mmb + st8 [r31]=r18,16 // ndirty st8 [r30]=r19,16 // cfm - st8 [r31]=r22,16 // iip nop 0 ;; } { .mmi - st8 [r30]=r17 // ifa mov r18=cr.isr + st8 [r31]=r22,16 // iip add r29=16,r30 ;; } -{ .mmi - st8 [r31]=r18 // isr - add r30=8,r29 - add r31=16,r29 +{ .mmb + st8 [r30]=r17,24 // ifa + st8 [r31]=r18,24 // isr + nop 0 ;; } { .mmi From owner-svn-src-stable-8@FreeBSD.ORG Fri Dec 11 02:23:35 2009 Return-Path: Delivered-To: svn-src-stable-8@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5340106568F for ; Fri, 11 Dec 2009 02:23:35 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from sippysoft.com (gk1.360sip.com [72.236.70.240]) by mx1.freebsd.org (Postfix) with ESMTP id 88DE28FC1B for ; Fri, 11 Dec 2009 02:23:35 +0000 (UTC) Received: from [192.168.1.38] (S0106005004e13421.vs.shawcable.net [70.71.167.197]) (authenticated bits=0) by sippysoft.com (8.14.3/8.14.3) with ESMTP id nBB1lYYd018094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 10 Dec 2009 17:47:35 -0800 (PST) (envelope-from sobomax@FreeBSD.org) Message-ID: <4B21A4B9.3070005@FreeBSD.org> Date: Thu, 10 Dec 2009 17:47:37 -0800 From: Maxim Sobolev Organization: Sippy Software, Inc. User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Alexander Motin References: <200912102351.nBANpOKc078607@svn.freebsd.org> In-Reply-To: <200912102351.nBANpOKc078607@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org Subject: Re: svn: stable/8/sbin/geom/class/mirror X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2009 02:23:35 -0000 Alexander Motin wrote: > Author: mav > Date: Thu Dec 10 23:51:24 2009 > New Revision: 200373 > URL: http://svn.freebsd.org/changeset/base/200373 > > Log: > MFC r200282, r200290: > Change gmirror default balance algorithm from "split" to improved "load". > "split" is very ineffective for devices with rotating media as HDDs. > To be effective, it needs that transfer time reduction due to block > splitting was bigger then access time increase due to non-sequential > access. For modern HDDs I was able to reproduce it only with read sizes > of 2MB and above, which is almost not applicable in real life. > "load" algorithm same time is more universal and effective now. The other problem with real hard drives is that they usually read much more data than requested. Some suggest that they read as much as one track each time the data is not in cache even if one sector has been requested, therefore splitting request of any reasonable size is meaningless, as it would simply cause both drives to load essentially the same data, wasting half of available I/O bandwidth and in addition you cause both heads to do seek, which makes it even worse. -Maxim From owner-svn-src-stable-8@FreeBSD.ORG Fri Dec 11 11:07:06 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 030321065672; Fri, 11 Dec 2009 11:07:06 +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 E53C58FC0C; Fri, 11 Dec 2009 11:07:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBBB75rV006493; Fri, 11 Dec 2009 11:07:05 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBBB75gE006491; Fri, 11 Dec 2009 11:07:05 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912111107.nBBB75gE006491@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 11 Dec 2009 11:07:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200404 - stable/8/sys/compat/freebsd32 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2009 11:07:06 -0000 Author: kib Date: Fri Dec 11 11:07:05 2009 New Revision: 200404 URL: http://svn.freebsd.org/changeset/base/200404 Log: MFC r200111: Add several syscall compat32 entries for acl manipulation. Modified: stable/8/sys/compat/freebsd32/syscalls.master Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/compat/freebsd32/syscalls.master ============================================================================== --- stable/8/sys/compat/freebsd32/syscalls.master Fri Dec 11 10:35:58 2009 (r200403) +++ stable/8/sys/compat/freebsd32/syscalls.master Fri Dec 11 11:07:05 2009 (r200404) @@ -740,10 +740,14 @@ struct freebsd32_ucontext *oucp, \ const struct freebsd32_ucontext *ucp); } 424 AUE_SWAPOFF UNIMPL swapoff -425 AUE_NULL UNIMPL __acl_get_link -426 AUE_NULL UNIMPL __acl_set_link -427 AUE_NULL UNIMPL __acl_delete_link -428 AUE_NULL UNIMPL __acl_aclcheck_link +425 AUE_NULL NOPROTO { int __acl_get_link(const char *path, \ + acl_type_t type, struct acl *aclp); } +426 AUE_NULL NOPROTO { int __acl_set_link(const char *path, \ + acl_type_t type, struct acl *aclp); } +427 AUE_NULL NOPROTO { int __acl_delete_link(const char *path, \ + acl_type_t type); } +428 AUE_NULL NOPROTO { int __acl_aclcheck_link(const char *path, \ + acl_type_t type, struct acl *aclp); } 429 AUE_SIGWAIT NOPROTO { int sigwait(const sigset_t *set, \ int *sig); } 430 AUE_NULL UNIMPL thr_create; From owner-svn-src-stable-8@FreeBSD.ORG Fri Dec 11 11:07:49 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4268E106568D; Fri, 11 Dec 2009 11:07:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FF918FC13; Fri, 11 Dec 2009 11:07:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBBB7ngC006540; Fri, 11 Dec 2009 11:07:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBBB7n5Q006535; Fri, 11 Dec 2009 11:07:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912111107.nBBB7n5Q006535@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 11 Dec 2009 11:07:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200405 - stable/8/sys/compat/freebsd32 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2009 11:07:49 -0000 Author: kib Date: Fri Dec 11 11:07:48 2009 New Revision: 200405 URL: http://svn.freebsd.org/changeset/base/200405 Log: Regen Modified: stable/8/sys/compat/freebsd32/freebsd32_proto.h stable/8/sys/compat/freebsd32/freebsd32_syscall.h stable/8/sys/compat/freebsd32/freebsd32_syscalls.c stable/8/sys/compat/freebsd32/freebsd32_sysent.c Modified: stable/8/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_proto.h Fri Dec 11 11:07:05 2009 (r200404) +++ stable/8/sys/compat/freebsd32/freebsd32_proto.h Fri Dec 11 11:07:48 2009 (r200405) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 195468 2009-07-08 16:26:43Z trasz + * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 200404 2009-12-11 11:07:05Z kib */ #ifndef _FREEBSD32_SYSPROTO_H_ Modified: stable/8/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_syscall.h Fri Dec 11 11:07:05 2009 (r200404) +++ stable/8/sys/compat/freebsd32/freebsd32_syscall.h Fri Dec 11 11:07:48 2009 (r200405) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 195468 2009-07-08 16:26:43Z trasz + * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 200404 2009-12-11 11:07:05Z kib */ #define FREEBSD32_SYS_syscall 0 @@ -311,6 +311,10 @@ #define FREEBSD32_SYS_freebsd32_getcontext 421 #define FREEBSD32_SYS_freebsd32_setcontext 422 #define FREEBSD32_SYS_freebsd32_swapcontext 423 +#define FREEBSD32_SYS___acl_get_link 425 +#define FREEBSD32_SYS___acl_set_link 426 +#define FREEBSD32_SYS___acl_delete_link 427 +#define FREEBSD32_SYS___acl_aclcheck_link 428 #define FREEBSD32_SYS_sigwait 429 #define FREEBSD32_SYS_thr_exit 431 #define FREEBSD32_SYS_thr_self 432 Modified: stable/8/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_syscalls.c Fri Dec 11 11:07:05 2009 (r200404) +++ stable/8/sys/compat/freebsd32/freebsd32_syscalls.c Fri Dec 11 11:07:48 2009 (r200405) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 195468 2009-07-08 16:26:43Z trasz + * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 200404 2009-12-11 11:07:05Z kib */ const char *freebsd32_syscallnames[] = { @@ -432,10 +432,10 @@ const char *freebsd32_syscallnames[] = { "freebsd32_setcontext", /* 422 = freebsd32_setcontext */ "freebsd32_swapcontext", /* 423 = freebsd32_swapcontext */ "#424", /* 424 = swapoff */ - "#425", /* 425 = __acl_get_link */ - "#426", /* 426 = __acl_set_link */ - "#427", /* 427 = __acl_delete_link */ - "#428", /* 428 = __acl_aclcheck_link */ + "__acl_get_link", /* 425 = __acl_get_link */ + "__acl_set_link", /* 426 = __acl_set_link */ + "__acl_delete_link", /* 427 = __acl_delete_link */ + "__acl_aclcheck_link", /* 428 = __acl_aclcheck_link */ "sigwait", /* 429 = sigwait */ "#430", /* 430 = thr_create; */ "thr_exit", /* 431 = thr_exit */ Modified: stable/8/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_sysent.c Fri Dec 11 11:07:05 2009 (r200404) +++ stable/8/sys/compat/freebsd32/freebsd32_sysent.c Fri Dec 11 11:07:48 2009 (r200405) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 195468 2009-07-08 16:26:43Z trasz + * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 200404 2009-12-11 11:07:05Z kib */ #include "opt_compat.h" @@ -469,10 +469,10 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_setcontext_args), (sy_call_t *)freebsd32_setcontext, AUE_NULL, NULL, 0, 0, 0 }, /* 422 = freebsd32_setcontext */ { AS(freebsd32_swapcontext_args), (sy_call_t *)freebsd32_swapcontext, AUE_NULL, NULL, 0, 0, 0 }, /* 423 = freebsd32_swapcontext */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 424 = swapoff */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 425 = __acl_get_link */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 426 = __acl_set_link */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 427 = __acl_delete_link */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 428 = __acl_aclcheck_link */ + { AS(__acl_get_link_args), (sy_call_t *)__acl_get_link, AUE_NULL, NULL, 0, 0, 0 }, /* 425 = __acl_get_link */ + { AS(__acl_set_link_args), (sy_call_t *)__acl_set_link, AUE_NULL, NULL, 0, 0, 0 }, /* 426 = __acl_set_link */ + { AS(__acl_delete_link_args), (sy_call_t *)__acl_delete_link, AUE_NULL, NULL, 0, 0, 0 }, /* 427 = __acl_delete_link */ + { AS(__acl_aclcheck_link_args), (sy_call_t *)__acl_aclcheck_link, AUE_NULL, NULL, 0, 0, 0 }, /* 428 = __acl_aclcheck_link */ { AS(sigwait_args), (sy_call_t *)sigwait, AUE_SIGWAIT, NULL, 0, 0, 0 }, /* 429 = sigwait */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 430 = thr_create; */ { AS(thr_exit_args), (sy_call_t *)thr_exit, AUE_NULL, NULL, 0, 0, 0 }, /* 431 = thr_exit */ From owner-svn-src-stable-8@FreeBSD.ORG Fri Dec 11 12:36:03 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4624E1065701; Fri, 11 Dec 2009 12:36:03 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 327E28FC15; Fri, 11 Dec 2009 12:36:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBBCa3cR008579; Fri, 11 Dec 2009 12:36:03 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBBCa3rY008576; Fri, 11 Dec 2009 12:36:03 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <200912111236.nBBCa3rY008576@svn.freebsd.org> From: Fabien Thomas Date: Fri, 11 Dec 2009 12:36:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200406 - stable/8/sys/dev/hwpmc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2009 12:36:03 -0000 Author: fabient Date: Fri Dec 11 12:36:02 2009 New Revision: 200406 URL: http://svn.freebsd.org/changeset/base/200406 Log: MFC 196739: Add counters for the i7 architecture which were accidentally left out of the original commit of i7 support. These are all the counters on pages A-32 and A-33 of the _Intel(R) 64 and IA32 Architectures Software Developer's Manual Vol 3B_, June 2009. Almost all of these counters relate to operations on the L2 cache. Modified: stable/8/sys/dev/hwpmc/hwpmc_core.c stable/8/sys/dev/hwpmc/pmc_events.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- stable/8/sys/dev/hwpmc/hwpmc_core.c Fri Dec 11 11:07:48 2009 (r200405) +++ stable/8/sys/dev/hwpmc/hwpmc_core.c Fri Dec 11 12:36:02 2009 (r200406) @@ -1182,6 +1182,29 @@ static struct iap_event_descr iap_events IAPDESCR(DBH_01H, 0xDB, 0x01, IAP_F_FM | IAP_F_I7), IAPDESCR(E4H_01H, 0xE4, 0x01, IAP_F_FM | IAP_F_I7), IAPDESCR(E5H_01H, 0xE5, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(E6H_01H, 0xE6, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(E6H_02H, 0xE6, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(E8H_01H, 0xE8, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(E8H_02H, 0xE8, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(E8H_03H, 0xE8, 0x03, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_01H, 0xF0, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_02H, 0xF0, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_04H, 0xF0, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_08H, 0xF0, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_10H, 0xF0, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_20H, 0xF0, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_40H, 0xF0, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_80H, 0xF0, 0x80, IAP_F_FM | IAP_F_I7), + IAPDESCR(F1H_02H, 0xF1, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(F1H_04H, 0xF1, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(F1H_07H, 0xF1, 0x07, IAP_F_FM | IAP_F_I7), + IAPDESCR(F2H_01H, 0xF2, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(F2H_02H, 0xF2, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(F2H_04H, 0xF2, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(F2H_08H, 0xF2, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(F2H_0FH, 0xF2, 0x0F, IAP_F_FM | IAP_F_I7), + IAPDESCR(F3H_01H, 0xF3, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(F3H_02H, 0xF3, 0x02, IAP_F_FM | IAP_F_I7), IAPDESCR(F3H_04H, 0xF3, 0x04, IAP_F_FM | IAP_F_I7), IAPDESCR(F3H_08H, 0xF3, 0x08, IAP_F_FM | IAP_F_I7), IAPDESCR(F3H_10H, 0xF3, 0x10, IAP_F_FM | IAP_F_I7), Modified: stable/8/sys/dev/hwpmc/pmc_events.h ============================================================================== --- stable/8/sys/dev/hwpmc/pmc_events.h Fri Dec 11 11:07:48 2009 (r200405) +++ stable/8/sys/dev/hwpmc/pmc_events.h Fri Dec 11 12:36:02 2009 (r200406) @@ -29,8 +29,18 @@ #ifndef _DEV_HWPMC_PMC_EVENTS_H_ #define _DEV_HWPMC_PMC_EVENTS_H_ -/* - * PMC event codes. +/* + * Note: Documentation on adding events can be found both in + * the source tree at src/share/doc/papers/hwpmc/hwpmc.ms + * as well as on-line at: + * + * http://wiki.freebsd.org/PmcTools/PmcHardwareHowTo + * + * Please refer to those resources before you attempt to modify + * this file or the hwpmc driver/subsystem. + */ + +/* * PMC event codes. * * __PMC_EV(CLASS, SYMBOLIC-NAME) * @@ -973,7 +983,30 @@ __PMC_EV(IAP, EVENT_FDH_04H) \ __PMC_EV(IAP, EVENT_FDH_08H) \ __PMC_EV(IAP, EVENT_FDH_10H) \ __PMC_EV(IAP, EVENT_FDH_20H) \ -__PMC_EV(IAP, EVENT_FDH_40H) +__PMC_EV(IAP, EVENT_FDH_40H) \ +__PMC_EV(IAP, EVENT_E6H_02H) \ +__PMC_EV(IAP, EVENT_E8H_01H) \ +__PMC_EV(IAP, EVENT_E8H_02H) \ +__PMC_EV(IAP, EVENT_E8H_03H) \ +__PMC_EV(IAP, EVENT_F0H_01H) \ +__PMC_EV(IAP, EVENT_F0H_02H) \ +__PMC_EV(IAP, EVENT_F0H_04H) \ +__PMC_EV(IAP, EVENT_F0H_08H) \ +__PMC_EV(IAP, EVENT_F0H_10H) \ +__PMC_EV(IAP, EVENT_F0H_20H) \ +__PMC_EV(IAP, EVENT_F0H_40H) \ +__PMC_EV(IAP, EVENT_F0H_80H) \ +__PMC_EV(IAP, EVENT_F1H_02H) \ +__PMC_EV(IAP, EVENT_F1H_04H) \ +__PMC_EV(IAP, EVENT_F1H_07H) \ +__PMC_EV(IAP, EVENT_F2H_01H) \ +__PMC_EV(IAP, EVENT_F2H_02H) \ +__PMC_EV(IAP, EVENT_F2H_04H) \ +__PMC_EV(IAP, EVENT_F2H_08H) \ +__PMC_EV(IAP, EVENT_F2H_0FH) \ +__PMC_EV(IAP, EVENT_F3H_01H) \ +__PMC_EV(IAP, EVENT_F3H_02H) + #define PMC_EV_IAP_FIRST PMC_EV_IAP_EVENT_02H_81H #define PMC_EV_IAP_LAST PMC_EV_IAP_EVENT_FDH_40H @@ -1894,6 +1927,29 @@ __PMC_EV_ALIAS("UOP_UNFUSION", IAP_EV __PMC_EV_ALIAS("BR_INST_DECODED", IAP_EVENT_E0H_01H) \ __PMC_EV_ALIAS("BOGUS_BR", IAP_EVENT_E4H_01H) \ __PMC_EV_ALIAS("BPU_MISSED_CALL_RET", IAP_EVENT_E5H_01H) \ +__PMC_EV_ALIAS("BACLEAR.CLEAR", IAP_EVENT_E6H_01H) \ +__PMC_EV_ALIAS("BACLEAR.BAD_TARGET", IAP_EVENT_E6H_02H) \ +__PMC_EV_ALIAS("BPU_CLEARS.EARLY", IAP_EVENT_E8H_01H) \ +__PMC_EV_ALIAS("BPU_CLEARS.LATE", IAP_EVENT_E8H_02H) \ +__PMC_EV_ALIAS("BPU_CLEARS.ANY", IAP_EVENT_E8H_03H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.LOAD", IAP_EVENT_F0H_01H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.RFO", IAP_EVENT_F0H_02H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.IFETCH", IAP_EVENT_F0H_04H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.PREFETCH", IAP_EVENT_F0H_08H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.L1D_WB", IAP_EVENT_F0H_10H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.FILL", IAP_EVENT_F0H_20H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.WB", IAP_EVENT_F0H_40H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.ANY", IAP_EVENT_F0H_80H) \ +__PMC_EV_ALIAS("L2_LINES_IN.S_STATE", IAP_EVENT_F1H_02H) \ +__PMC_EV_ALIAS("L2_LINES_IN.E_STATE", IAP_EVENT_F1H_04H) \ +__PMC_EV_ALIAS("L2_LINES_IN.ANY", IAP_EVENT_F1H_07H) \ +__PMC_EV_ALIAS("L2_LINES_OUT.DEMAND_CLEAN", IAP_EVENT_F2H_01H) \ +__PMC_EV_ALIAS("L2_LINES_OUT.DEMAND_DIRTY", IAP_EVENT_F2H_02H) \ +__PMC_EV_ALIAS("L2_LINES_OUT.PREFETCH_CLEAN", IAP_EVENT_F2H_04H) \ +__PMC_EV_ALIAS("L2_LINES_OUT.PREFETCH_DIRTY", IAP_EVENT_F2H_08H) \ +__PMC_EV_ALIAS("L2_LINES_OUT.ANY", IAP_EVENT_F2H_0FH) \ +__PMC_EV_ALIAS("L2_HW_PREFETCH.HIT", IAP_EVENT_F3H_01H) \ +__PMC_EV_ALIAS("L2_HW_PREFETCH.ALLOC", IAP_EVENT_F3H_02H) \ __PMC_EV_ALIAS("L2_HW_PREFETCH.DATA_TRIGGER", IAP_EVENT_F3H_04H) \ __PMC_EV_ALIAS("L2_HW_PREFETCH.CODE_TRIGGER", IAP_EVENT_F3H_08H) \ __PMC_EV_ALIAS("L2_HW_PREFETCH.DCA_TRIGGER", IAP_EVENT_F3H_10H) \ From owner-svn-src-stable-8@FreeBSD.ORG Fri Dec 11 12:44:45 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2EA5B106566C; Fri, 11 Dec 2009 12:44:45 +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 1CB928FC08; Fri, 11 Dec 2009 12:44:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBBCij79009016; Fri, 11 Dec 2009 12:44:45 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBBCiih6009014; Fri, 11 Dec 2009 12:44:44 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912111244.nBBCiih6009014@svn.freebsd.org> From: Alexander Motin Date: Fri, 11 Dec 2009 12:44:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200409 - stable/8/sys/dev/ata X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2009 12:44:45 -0000 Author: mav Date: Fri Dec 11 12:44:44 2009 New Revision: 200409 URL: http://svn.freebsd.org/changeset/base/200409 Log: MFC r200353: Limit maximum I/O size, depending on command set supported by device. It is required to suppot non-LBA48 devices with MAXPHYS above 128K. Same is done in ada(4). Modified: stable/8/sys/dev/ata/ata-disk.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ata/ata-disk.c ============================================================================== --- stable/8/sys/dev/ata/ata-disk.c Fri Dec 11 12:38:15 2009 (r200408) +++ stable/8/sys/dev/ata/ata-disk.c Fri Dec 11 12:44:44 2009 (r200409) @@ -126,6 +126,10 @@ ad_attach(device_t dev) adp->disk->d_name = "ad"; adp->disk->d_drv1 = dev; adp->disk->d_maxsize = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; + if (atadev->param.support.command2 & ATA_SUPPORT_ADDRESS48) + adp->disk->d_maxsize = min(adp->disk->d_maxsize, 65536 * DEV_BSIZE); + else /* 28bit ATA command limit */ + adp->disk->d_maxsize = min(adp->disk->d_maxsize, 256 * DEV_BSIZE); adp->disk->d_sectorsize = DEV_BSIZE; adp->disk->d_mediasize = DEV_BSIZE * (off_t)adp->total_secs; adp->disk->d_fwsectors = adp->sectors; From owner-svn-src-stable-8@FreeBSD.ORG Fri Dec 11 12:53:09 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C61CB1065695; Fri, 11 Dec 2009 12:53:09 +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 B44558FC12; Fri, 11 Dec 2009 12:53:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBBCr9Qx009435; Fri, 11 Dec 2009 12:53:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBBCr9FE009432; Fri, 11 Dec 2009 12:53:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912111253.nBBCr9FE009432@svn.freebsd.org> From: Alexander Motin Date: Fri, 11 Dec 2009 12:53:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200411 - in stable/8/sys/cam: . ata X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2009 12:53:09 -0000 Author: mav Date: Fri Dec 11 12:53:09 2009 New Revision: 200411 URL: http://svn.freebsd.org/changeset/base/200411 Log: MFC r200180: If we panicked with SIM lock held, do not try to flush caches. Extra lock recursing will not make debugging easier. Modified: stable/8/sys/cam/ata/ata_da.c stable/8/sys/cam/cam_periph.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Fri Dec 11 12:46:41 2009 (r200410) +++ stable/8/sys/cam/ata/ata_da.c Fri Dec 11 12:53:09 2009 (r200411) @@ -1040,6 +1040,9 @@ adashutdown(void * arg, int howto) TAILQ_FOREACH(periph, &adadriver.units, unit_links) { union ccb ccb; + /* If we paniced with lock held - not recurse here. */ + if (cam_periph_owned(periph)) + continue; cam_periph_lock(periph); softc = (struct ada_softc *)periph->softc; /* Modified: stable/8/sys/cam/cam_periph.h ============================================================================== --- stable/8/sys/cam/cam_periph.h Fri Dec 11 12:46:41 2009 (r200410) +++ stable/8/sys/cam/cam_periph.h Fri Dec 11 12:53:09 2009 (r200411) @@ -190,5 +190,11 @@ cam_periph_unlock(struct cam_periph *per mtx_unlock(periph->sim->mtx); } +static __inline int +cam_periph_owned(struct cam_periph *periph) +{ + return (mtx_owned(periph->sim->mtx)); +} + #endif /* _KERNEL */ #endif /* _CAM_CAM_PERIPH_H */ From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 12 02:31:16 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AA60106566B; Sat, 12 Dec 2009 02:31:16 +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 48C158FC15; Sat, 12 Dec 2009 02:31:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBC2VGgf027427; Sat, 12 Dec 2009 02:31:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBC2VG7i027425; Sat, 12 Dec 2009 02:31:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200912120231.nBC2VG7i027425@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 12 Dec 2009 02:31:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200426 - stable/8/sys/powerpc/aim X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 02:31:16 -0000 Author: nwhitehorn Date: Sat Dec 12 02:31:16 2009 New Revision: 200426 URL: http://svn.freebsd.org/changeset/base/200426 Log: MFC r200083: The first argument of dcbz interprets r0 as a literal zero, not the second. This worked before by accident. Modified: stable/8/sys/powerpc/aim/machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/powerpc/aim/machdep.c ============================================================================== --- stable/8/sys/powerpc/aim/machdep.c Sat Dec 12 02:19:41 2009 (r200425) +++ stable/8/sys/powerpc/aim/machdep.c Sat Dec 12 02:31:16 2009 (r200426) @@ -374,7 +374,7 @@ powerpc_init(u_int startkernel, u_int en for (cacheline_size = 0; cacheline_size < 0x100; cacheline_size++) cache_check[cacheline_size] = 0xff; - __asm __volatile("dcbz %0,0":: "r" (cache_check) : "memory"); + __asm __volatile("dcbz 0,%0":: "r" (cache_check) : "memory"); /* Find the first byte dcbz did not zero to get the cache line size */ for (cacheline_size = 0; cacheline_size < 0x100 && From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 12 02:34:00 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9ACA6106566B; Sat, 12 Dec 2009 02:34:00 +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 883A38FC17; Sat, 12 Dec 2009 02:34:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBC2Y0Bs027535; Sat, 12 Dec 2009 02:34:00 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBC2Y08W027531; Sat, 12 Dec 2009 02:34:00 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200912120234.nBC2Y08W027531@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 12 Dec 2009 02:34:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200427 - stable/8/sys/dev/adb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 02:34:00 -0000 Author: nwhitehorn Date: Sat Dec 12 02:34:00 2009 New Revision: 200427 URL: http://svn.freebsd.org/changeset/base/200427 Log: MFC r199888: Add support for interpreting taps on ADB touchpads as a button click. Submitted by: Andreas Tobler Modified: stable/8/sys/dev/adb/adb.h stable/8/sys/dev/adb/adb_bus.c stable/8/sys/dev/adb/adb_mouse.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/adb/adb.h ============================================================================== --- stable/8/sys/dev/adb/adb.h Sat Dec 12 02:31:16 2009 (r200426) +++ stable/8/sys/dev/adb/adb.h Sat Dec 12 02:34:00 2009 (r200427) @@ -69,6 +69,7 @@ uint8_t adb_get_device_handler(device_t uint8_t adb_set_device_handler(device_t dev, uint8_t newhandler); size_t adb_read_register(device_t dev, u_char reg, void *data); +size_t adb_write_register(device_t dev, u_char reg, size_t len, void *data); /* Bits for implementing ADB host bus adapters */ extern devclass_t adb_devclass; Modified: stable/8/sys/dev/adb/adb_bus.c ============================================================================== --- stable/8/sys/dev/adb/adb_bus.c Sat Dec 12 02:31:16 2009 (r200426) +++ stable/8/sys/dev/adb/adb_bus.c Sat Dec 12 02:34:00 2009 (r200427) @@ -402,3 +402,21 @@ adb_read_register(device_t dev, u_char r return (result); } +size_t +adb_write_register(device_t dev, u_char reg, size_t len, void *data) +{ + struct adb_softc *sc; + struct adb_devinfo *dinfo; + size_t result; + + dinfo = device_get_ivars(dev); + sc = device_get_softc(device_get_parent(dev)); + + result = adb_send_raw_packet_sync(sc->sc_dev,dinfo->address, + ADB_COMMAND_LISTEN, reg, len, (u_char *)data, NULL); + + result = adb_send_raw_packet_sync(sc->sc_dev,dinfo->address, + ADB_COMMAND_TALK, reg, 0, NULL, NULL); + + return (result); +} Modified: stable/8/sys/dev/adb/adb_mouse.c ============================================================================== --- stable/8/sys/dev/adb/adb_mouse.c Sat Dec 12 02:31:16 2009 (r200426) +++ stable/8/sys/dev/adb/adb_mouse.c Sat Dec 12 02:34:00 2009 (r200427) @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -51,6 +52,8 @@ static int adb_mouse_probe(device_t dev); static int adb_mouse_attach(device_t dev); static int adb_mouse_detach(device_t dev); +static void adb_init_trackpad(device_t dev); +static int adb_tapping_sysctl(SYSCTL_HANDLER_ARGS); static d_open_t ams_open; static d_close_t ams_close; @@ -77,6 +80,8 @@ struct adb_mouse_softc { u_char id[4]; int buttons; + u_int sc_tapping; + int button_buf; int last_buttons; int xdelta, ydelta; @@ -167,6 +172,8 @@ adb_mouse_attach(device_t dev) sc->mode.packetsize = 5; sc->buttons = 0; + sc->sc_tapping = 0; + sc->button_buf = 0; sc->last_buttons = 0; sc->packet_read_len = 0; @@ -205,6 +212,7 @@ adb_mouse_attach(device_t dev) case 3: sc->flags |= AMS_TOUCHPAD; sc->hw.type = MOUSE_PAD; + adb_init_trackpad(dev); description = "Touchpad"; break; } @@ -259,6 +267,70 @@ adb_mouse_detach(device_t dev) return (0); } +static void +adb_init_trackpad(device_t dev) +{ + struct adb_mouse_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; + + size_t r1_len; + u_char r1[8]; + u_char r2[8]; + + sc = device_get_softc(dev); + + r1_len = adb_read_register(dev, 1, r1); + + /* An Extended Mouse register1 must return 8 bytes. */ + if (r1_len != 8) + return; + + if((r1[6] != 0x0d)) + { + r1[6] = 0x0d; + + adb_write_register(dev, 1, 8, r1); + + r1_len = adb_read_register(dev, 1, r1); + + if (r1[6] != 0x0d) + { + device_printf(dev, "ADB Mouse = 0x%x " + "(non-Extended Mode)\n", r1[6]); + return; + } else { + device_printf(dev, "ADB Mouse = 0x%x " + "(Extended Mode)\n", r1[6]); + + /* Set ADB Extended Features to default values, + enabled. */ + r2[0] = 0x19; /* Clicking: 0x19 disabled 0x99 enabled */ + r2[1] = 0x94; /* Dragging: 0x14 disabled 0x94 enabled */ + r2[2] = 0x19; + r2[3] = 0xff; /* DragLock: 0xff disabled 0xb2 enabled */ + r2[4] = 0xb2; + r2[5] = 0x8a; + r2[6] = 0x1b; + + r2[7] = 0x57; /* 0x57 bits 3:0 for W mode */ + + adb_write_register(dev, 2, 8, r2); + + } + } + + /* + * Set up sysctl + */ + ctx = device_get_sysctl_ctx(dev); + tree = device_get_sysctl_tree(dev); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "tapping", + CTLTYPE_INT | CTLFLAG_RW, sc, 0, adb_tapping_sysctl, + "I", "Tapping the pad causes button events"); + return; +} + static u_int adb_mouse_receive_packet(device_t dev, u_char status, u_char command, u_char reg, int len, u_char *data) @@ -266,7 +338,7 @@ adb_mouse_receive_packet(device_t dev, u struct adb_mouse_softc *sc; int i = 0; int xdelta, ydelta; - int buttons; + int buttons, tmp_buttons; sc = device_get_softc(dev); @@ -298,6 +370,30 @@ adb_mouse_receive_packet(device_t dev, u if (ydelta & (0x40 << 3*(len-2))) ydelta |= 0xffffffc0 << 3*(len - 2); + if ((sc->flags & AMS_TOUCHPAD) && (sc->sc_tapping == 1)) { + tmp_buttons = buttons; + if (buttons == 0x12) { + /* Map a double tap on button 3. + Keep the button state for the next sequence. + A double tap sequence is followed by a single tap + sequence. + */ + tmp_buttons = 0x3; + sc->button_buf = tmp_buttons; + } else if (buttons == 0x2) { + /* Map a single tap on button 2. But only if it is + not a successor from a double tap. + */ + if (sc->button_buf != 0x3) + tmp_buttons = 0x2; + else + tmp_buttons = 0; + + sc->button_buf = 0; + } + buttons = tmp_buttons; + } + /* * Some mice report high-numbered buttons on the wrong button number, * so set the highest-numbered real button as pressed if there are @@ -554,3 +650,36 @@ ams_ioctl(struct cdev *dev, u_long cmd, return (0); } +static int +adb_tapping_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct adb_mouse_softc *sc = arg1; + device_t dev; + int error; + u_char r2[8]; + u_int tapping; + + dev = sc->sc_dev; + tapping = sc->sc_tapping; + + error = sysctl_handle_int(oidp, &tapping, 0, req); + + if (error || !req->newptr) + return (error); + + if (tapping == 1) { + adb_read_register(dev, 2, r2); + r2[0] = 0x99; /* enable tapping. */ + adb_write_register(dev, 2, 8, r2); + sc->sc_tapping = 1; + } else if (tapping == 0) { + adb_read_register(dev, 2, r2); + r2[0] = 0x19; /* disable tapping. */ + adb_write_register(dev, 2, 8, r2); + sc->sc_tapping = 0; + } + else + return (EINVAL); + + return (0); +} From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 12 04:34:23 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38F031065679; Sat, 12 Dec 2009 04:34:23 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 26FD18FC0C; Sat, 12 Dec 2009 04:34:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBC4YNDT041068; Sat, 12 Dec 2009 04:34:23 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBC4YNg7041066; Sat, 12 Dec 2009 04:34:23 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200912120434.nBC4YNg7041066@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 12 Dec 2009 04:34:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200429 - stable/8/sys/dev/iir X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 04:34:23 -0000 Author: marcel Date: Sat Dec 12 04:34:22 2009 New Revision: 200429 URL: http://svn.freebsd.org/changeset/base/200429 Log: MFC rev 200045: Include , to get the declarations of ostype and osrelease. Remove the duplicate declarations from this file. Modified: stable/8/sys/dev/iir/iir_ctrl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/iir/iir_ctrl.c ============================================================================== --- stable/8/sys/dev/iir/iir_ctrl.c Sat Dec 12 03:35:49 2009 (r200428) +++ stable/8/sys/dev/iir/iir_ctrl.c Sat Dec 12 04:34:22 2009 (r200429) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -83,8 +84,6 @@ static int iir_devsw_installed = 0; static int sdev_made = 0; #endif extern int gdt_cnt; -extern char ostype[]; -extern char osrelease[]; extern gdt_statist_t gdt_stat; /* From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 12 05:14:41 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 312EF106566B; Sat, 12 Dec 2009 05:14:41 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D4678FC1A; Sat, 12 Dec 2009 05:14:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBC5Ef5a042214; Sat, 12 Dec 2009 05:14:41 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBC5EeKt042203; Sat, 12 Dec 2009 05:14:40 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200912120514.nBC5EeKt042203@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 12 Dec 2009 05:14:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200431 - in stable/8/sys/ia64: ia64 include X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 05:14:41 -0000 Author: marcel Date: Sat Dec 12 05:14:40 2009 New Revision: 200431 URL: http://svn.freebsd.org/changeset/base/200431 Log: MFC rev 199893, 199941, 200200 and 200207: o Eliminate MAXCPU. o Revamp the PCPU structure. Modified: stable/8/sys/ia64/ia64/clock.c stable/8/sys/ia64/ia64/genassym.c stable/8/sys/ia64/ia64/interrupt.c stable/8/sys/ia64/ia64/machdep.c stable/8/sys/ia64/ia64/mp_machdep.c stable/8/sys/ia64/ia64/pmap.c stable/8/sys/ia64/include/kdb.h stable/8/sys/ia64/include/param.h stable/8/sys/ia64/include/pcpu.h stable/8/sys/ia64/include/pmap.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/ia64/ia64/clock.c ============================================================================== --- stable/8/sys/ia64/ia64/clock.c Sat Dec 12 04:50:04 2009 (r200430) +++ stable/8/sys/ia64/ia64/clock.c Sat Dec 12 05:14:40 2009 (r200431) @@ -64,9 +64,9 @@ void pcpu_initclock(void) { - PCPU_SET(clockadj, 0); - PCPU_SET(clock, ia64_get_itc()); - ia64_set_itm(PCPU_GET(clock) + ia64_clock_reload); + PCPU_SET(md.clockadj, 0); + PCPU_SET(md.clock, ia64_get_itc()); + ia64_set_itm(PCPU_GET(md.clock) + ia64_clock_reload); ia64_set_itv(CLOCK_VECTOR); /* highest priority class */ ia64_srlz_d(); } Modified: stable/8/sys/ia64/ia64/genassym.c ============================================================================== --- stable/8/sys/ia64/ia64/genassym.c Sat Dec 12 04:50:04 2009 (r200430) +++ stable/8/sys/ia64/ia64/genassym.c Sat Dec 12 05:14:40 2009 (r200431) @@ -91,7 +91,7 @@ ASSYM(MC_SPECIAL_RNAT, offsetof(mcontext ASSYM(PAGE_SHIFT, PAGE_SHIFT); ASSYM(PAGE_SIZE, PAGE_SIZE); -ASSYM(PC_CURRENT_PMAP, offsetof(struct pcpu, pc_current_pmap)); +ASSYM(PC_CURRENT_PMAP, offsetof(struct pcpu, pc_md.current_pmap)); ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); ASSYM(PC_IDLETHREAD, offsetof(struct pcpu, pc_idlethread)); Modified: stable/8/sys/ia64/ia64/interrupt.c ============================================================================== --- stable/8/sys/ia64/ia64/interrupt.c Sat Dec 12 04:50:04 2009 (r200430) +++ stable/8/sys/ia64/ia64/interrupt.c Sat Dec 12 05:14:40 2009 (r200431) @@ -84,28 +84,6 @@ dummy_perf(unsigned long vector, struct void (*perf_irq)(unsigned long, struct trapframe *) = dummy_perf; -static unsigned int ints[MAXCPU]; -SYSCTL_OPAQUE(_debug, OID_AUTO, ints, CTLFLAG_RW, &ints, sizeof(ints), "IU", - ""); - -static unsigned int clks[MAXCPU]; -#ifdef SMP -SYSCTL_OPAQUE(_debug, OID_AUTO, clks, CTLFLAG_RW, &clks, sizeof(clks), "IU", - ""); -#else -SYSCTL_INT(_debug, OID_AUTO, clks, CTLFLAG_RW, clks, 0, ""); -#endif - -#ifdef SMP -static unsigned int asts[MAXCPU]; -SYSCTL_OPAQUE(_debug, OID_AUTO, asts, CTLFLAG_RW, &asts, sizeof(asts), "IU", - ""); - -static unsigned int rdvs[MAXCPU]; -SYSCTL_OPAQUE(_debug, OID_AUTO, rdvs, CTLFLAG_RW, &rdvs, sizeof(rdvs), "IU", - ""); -#endif - SYSCTL_NODE(_debug, OID_AUTO, clock, CTLFLAG_RW, 0, "clock statistics"); static int adjust_edges = 0; @@ -139,6 +117,8 @@ interrupt(struct trapframe *tf) td = curthread; + PCPU_INC(cnt.v_intr); + vector = tf->tf_special.ifa; next: @@ -149,33 +129,35 @@ interrupt(struct trapframe *tf) * to add it to this switch-like construct. */ if (vector == 0) { + PCPU_INC(md.stats.pcs_nextints); inta = ib->ib_inta; - printf("ExtINT interrupt: vector=%u\n", (int)inta); if (inta == 15) { + PCPU_INC(md.stats.pcs_nstrays); __asm __volatile("mov cr.eoi = r0;; srlz.d"); goto stray; } vector = (int)inta; - } else if (vector == 15) + } else if (vector == 15) { + PCPU_INC(md.stats.pcs_nstrays); goto stray; + } if (vector == CLOCK_VECTOR) {/* clock interrupt */ /* CTR0(KTR_INTR, "clock interrupt"); */ itc = ia64_get_itc(); - PCPU_INC(cnt.v_intr); + PCPU_INC(md.stats.pcs_nclks); #ifdef EVCNT_COUNTERS clock_intr_evcnt.ev_count++; #else intrcnt[INTRCNT_CLOCK]++; #endif - clks[PCPU_GET(cpuid)]++; critical_enter(); - adj = PCPU_GET(clockadj); - clk = PCPU_GET(clock); + adj = PCPU_GET(md.clockadj); + clk = PCPU_GET(md.clock); delta = itc - clk; count = 0; while (delta >= ia64_clock_reload) { @@ -206,33 +188,36 @@ interrupt(struct trapframe *tf) adj = 0; adjust_excess++; } - PCPU_SET(clock, clk); - PCPU_SET(clockadj, adj); + PCPU_SET(md.clock, clk); + PCPU_SET(md.clockadj, adj); critical_exit(); ia64_srlz_d(); #ifdef SMP } else if (vector == ipi_vector[IPI_AST]) { - asts[PCPU_GET(cpuid)]++; + PCPU_INC(md.stats.pcs_nasts); CTR1(KTR_SMP, "IPI_AST, cpuid=%d", PCPU_GET(cpuid)); } else if (vector == ipi_vector[IPI_HIGH_FP]) { + PCPU_INC(md.stats.pcs_nhighfps); ia64_highfp_save_ipi(); } else if (vector == ipi_vector[IPI_RENDEZVOUS]) { - rdvs[PCPU_GET(cpuid)]++; + PCPU_INC(md.stats.pcs_nrdvs); CTR1(KTR_SMP, "IPI_RENDEZVOUS, cpuid=%d", PCPU_GET(cpuid)); enable_intr(); smp_rendezvous_action(); disable_intr(); } else if (vector == ipi_vector[IPI_STOP]) { + PCPU_INC(md.stats.pcs_nstops); cpumask_t mybit = PCPU_GET(cpumask); - savectx(PCPU_PTR(pcb)); + savectx(PCPU_PTR(md.pcb)); atomic_set_int(&stopped_cpus, mybit); while ((started_cpus & mybit) == 0) cpu_spinwait(); atomic_clear_int(&started_cpus, mybit); atomic_clear_int(&stopped_cpus, mybit); } else if (vector == ipi_vector[IPI_PREEMPT]) { + PCPU_INC(md.stats.pcs_npreempts); CTR1(KTR_SMP, "IPI_PREEMPT, cpuid=%d", PCPU_GET(cpuid)); __asm __volatile("mov cr.eoi = r0;; srlz.d"); enable_intr(); @@ -241,7 +226,7 @@ interrupt(struct trapframe *tf) goto stray; #endif } else { - ints[PCPU_GET(cpuid)]++; + PCPU_INC(md.stats.pcs_nhwints); atomic_add_int(&td->td_intr_nesting_level, 1); ia64_dispatch_intr(tf, vector); atomic_subtract_int(&td->td_intr_nesting_level, 1); Modified: stable/8/sys/ia64/ia64/machdep.c ============================================================================== --- stable/8/sys/ia64/ia64/machdep.c Sat Dec 12 04:50:04 2009 (r200430) +++ stable/8/sys/ia64/ia64/machdep.c Sat Dec 12 05:14:40 2009 (r200431) @@ -101,6 +101,8 @@ __FBSDID("$FreeBSD$"); #include +SYSCTL_NODE(_machdep, OID_AUTO, cpu, CTLFLAG_RD, 0, ""); + u_int64_t processor_frequency; u_int64_t bus_frequency; u_int64_t itc_frequency; @@ -139,8 +141,6 @@ SYSCTL_STRING(_hw, OID_AUTO, family, CTL extern vm_offset_t ksym_start, ksym_end; #endif -static void cpu_startup(void *); -SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL); struct msgbuf *msgbufp = NULL; @@ -247,9 +247,11 @@ identifycpu(void) } static void -cpu_startup(dummy) - void *dummy; +cpu_startup(void *dummy) { + char nodename[16]; + struct pcpu *pc; + struct pcpu_stats *pcs; /* * Good {morning,afternoon,evening,night}. @@ -302,7 +304,68 @@ cpu_startup(dummy) */ ia64_probe_sapics(); ia64_mca_init(); + + /* + * Create sysctl tree for per-CPU information. + */ + SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + snprintf(nodename, sizeof(nodename), "%u", pc->pc_cpuid); + sysctl_ctx_init(&pc->pc_md.sysctl_ctx); + pc->pc_md.sysctl_tree = SYSCTL_ADD_NODE(&pc->pc_md.sysctl_ctx, + SYSCTL_STATIC_CHILDREN(_machdep_cpu), OID_AUTO, nodename, + CTLFLAG_RD, NULL, ""); + if (pc->pc_md.sysctl_tree == NULL) + continue; + + pcs = &pc->pc_md.stats; + + SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, + SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, + "nasts", CTLFLAG_RD, &pcs->pcs_nasts, + "Number of IPI_AST interrupts"); + + SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, + SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, + "nclks", CTLFLAG_RD, &pcs->pcs_nclks, + "Number of clock interrupts"); + + SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, + SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, + "nextints", CTLFLAG_RD, &pcs->pcs_nextints, + "Number of ExtINT interrupts"); + + SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, + SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, + "nhighfps", CTLFLAG_RD, &pcs->pcs_nhighfps, + "Number of IPI_HIGH_FP interrupts"); + + SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, + SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, + "nhwints", CTLFLAG_RD, &pcs->pcs_nhwints, + "Number of hardware (device) interrupts"); + + SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, + SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, + "npreempts", CTLFLAG_RD, &pcs->pcs_npreempts, + "Number of IPI_PREEMPT interrupts"); + + SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, + SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, + "nrdvs", CTLFLAG_RD, &pcs->pcs_nrdvs, + "Number of IPI_RENDEZVOUS interrupts"); + + SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, + SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, + "nstops", CTLFLAG_RD, &pcs->pcs_nstops, + "Number of IPI_STOP interrupts"); + + SYSCTL_ADD_ULONG(&pc->pc_md.sysctl_ctx, + SYSCTL_CHILDREN(pc->pc_md.sysctl_tree), OID_AUTO, + "nstrays", CTLFLAG_RD, &pcs->pcs_nstrays, + "Number of stray vectors"); + } } +SYSINIT(cpu_startup, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL); void cpu_boot(int howto) Modified: stable/8/sys/ia64/ia64/mp_machdep.c ============================================================================== --- stable/8/sys/ia64/ia64/mp_machdep.c Sat Dec 12 04:50:04 2009 (r200430) +++ stable/8/sys/ia64/ia64/mp_machdep.c Sat Dec 12 05:14:40 2009 (r200431) @@ -76,7 +76,6 @@ void ia64_ap_startup(void); /* Variables used by os_boot_rendez and ia64_ap_startup */ struct pcpu *ap_pcpu; void *ap_stack; -uint64_t ap_vhpt; volatile int ap_delay; volatile int ap_awake; volatile int ap_spin; @@ -116,13 +115,15 @@ void ia64_ap_startup(void) { volatile struct ia64_interrupt_block *ib = IA64_INTERRUPT_BLOCK; + uint64_t vhpt; int vector; pcpup = ap_pcpu; ia64_set_k4((intptr_t)pcpup); - map_vhpt(ap_vhpt); - ia64_set_pta(ap_vhpt + (1 << 8) + (pmap_vhpt_log2size << 2) + 1); + vhpt = PCPU_GET(md.vhpt); + map_vhpt(vhpt); + ia64_set_pta(vhpt + (1 << 8) + (pmap_vhpt_log2size << 2) + 1); ia64_srlz_i(); ap_awake = 1; @@ -225,7 +226,7 @@ cpu_mp_add(u_int acpiid, u_int apicid, u pc = pcpup; pc->pc_acpi_id = acpiid; - pc->pc_lid = lid; + pc->pc_md.lid = lid; all_cpus |= (1UL << cpuid); } @@ -239,8 +240,8 @@ cpu_mp_announce() pc = pcpu_find(i); if (pc != NULL) { printf("cpu%d: ACPI Id=%x, SAPIC Id=%x, SAPIC Eid=%x", - i, pc->pc_acpi_id, LID_SAPIC_ID(pc->pc_lid), - LID_SAPIC_EID(pc->pc_lid)); + i, pc->pc_acpi_id, LID_SAPIC_ID(pc->pc_md.lid), + LID_SAPIC_EID(pc->pc_md.lid)); if (i == 0) printf(" (BSP)\n"); else @@ -257,13 +258,18 @@ cpu_mp_start() ap_spin = 1; SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { - pc->pc_current_pmap = kernel_pmap; + pc->pc_md.current_pmap = kernel_pmap; pc->pc_other_cpus = all_cpus & ~pc->pc_cpumask; if (pc->pc_cpuid > 0) { ap_pcpu = pc; + pc->pc_md.vhpt = pmap_alloc_vhpt(); + if (pc->pc_md.vhpt == 0) { + printf("SMP: WARNING: unable to allocate VHPT" + " for cpu%d", pc->pc_cpuid); + continue; + } ap_stack = malloc(KSTACK_PAGES * PAGE_SIZE, M_SMP, M_WAITOK); - ap_vhpt = pmap_vhpt_base[pc->pc_cpuid]; ap_delay = 2000; ap_awake = 0; @@ -275,13 +281,13 @@ cpu_mp_start() do { DELAY(1000); } while (--ap_delay > 0); - pc->pc_awake = ap_awake; + pc->pc_md.awake = ap_awake; if (!ap_awake) printf("SMP: WARNING: cpu%d did not wake up\n", pc->pc_cpuid); } else - pc->pc_awake = 1; + pc->pc_md.awake = 1; } } @@ -298,7 +304,7 @@ cpu_mp_unleash(void *dummy) smp_cpus = 0; SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { cpus++; - if (pc->pc_awake) { + if (pc->pc_md.awake) { kproc_create(ia64_store_mca_state, (void*)((uintptr_t)pc->pc_cpuid), NULL, 0, 0, "mca %u", pc->pc_cpuid); @@ -361,7 +367,7 @@ ipi_send(struct pcpu *cpu, int ipi) uint64_t vector; pipi = __MEMIO_ADDR(ia64_lapic_address | - ((cpu->pc_lid & LID_SAPIC_MASK) >> 12)); + ((cpu->pc_md.lid & LID_SAPIC_MASK) >> 12)); vector = (uint64_t)(ipi_vector[ipi] & 0xff); KASSERT(vector != 0, ("IPI %d is not assigned a vector", ipi)); *pipi = vector; Modified: stable/8/sys/ia64/ia64/pmap.c ============================================================================== --- stable/8/sys/ia64/ia64/pmap.c Sat Dec 12 04:50:04 2009 (r200430) +++ stable/8/sys/ia64/ia64/pmap.c Sat Dec 12 05:14:40 2009 (r200431) @@ -217,8 +217,6 @@ int pmap_vhpt_nbuckets; SYSCTL_INT(_machdep_vhpt, OID_AUTO, nbuckets, CTLFLAG_RD, &pmap_vhpt_nbuckets, 0, ""); -uint64_t pmap_vhpt_base[MAXCPU]; - int pmap_vhpt_log2size = 0; TUNABLE_INT("machdep.vhpt.log2size", &pmap_vhpt_log2size); SYSCTL_INT(_machdep_vhpt, OID_AUTO, log2size, CTLFLAG_RD, @@ -277,6 +275,40 @@ pmap_steal_memory(vm_size_t size) return va; } +static void +pmap_initialize_vhpt(vm_offset_t vhpt) +{ + struct ia64_lpte *pte; + u_int i; + + pte = (struct ia64_lpte *)vhpt; + for (i = 0; i < pmap_vhpt_nbuckets; i++) { + pte[i].pte = 0; + pte[i].itir = 0; + pte[i].tag = 1UL << 63; /* Invalid tag */ + pte[i].chain = (uintptr_t)(pmap_vhpt_bucket + i); + } +} + +#ifdef SMP +MALLOC_DECLARE(M_SMP); + +vm_offset_t +pmap_alloc_vhpt(void) +{ + vm_offset_t vhpt; + vm_size_t size; + + size = 1UL << pmap_vhpt_log2size; + vhpt = (uintptr_t)contigmalloc(size, M_SMP, 0, 0UL, ~0UL, size, 0UL); + if (vhpt != 0) { + vhpt = IA64_PHYS_TO_RR7(ia64_tpa(vhpt)); + pmap_initialize_vhpt(vhpt); + } + return (vhpt); +} +#endif + /* * Bootstrap the system enough to run with virtual memory. */ @@ -284,8 +316,7 @@ void pmap_bootstrap() { struct ia64_pal_result res; - struct ia64_lpte *pte; - vm_offset_t base, limit; + vm_offset_t base; size_t size; int i, j, count, ridbits; @@ -365,94 +396,52 @@ pmap_bootstrap() ; count = i+2; - /* - * Figure out a useful size for the VHPT, based on the size of - * physical memory and try to locate a region which is large - * enough to contain the VHPT (which must be a power of two in - * size and aligned to a natural boundary). - * We silently bump up the VHPT size to the minimum size if the - * user has set the tunable too small. Likewise, the VHPT size - * is silently capped to the maximum allowed. - */ TUNABLE_INT_FETCH("machdep.vhpt.log2size", &pmap_vhpt_log2size); - if (pmap_vhpt_log2size == 0) { - pmap_vhpt_log2size = 15; - size = 1UL << pmap_vhpt_log2size; - while (size < Maxmem * 32) { - pmap_vhpt_log2size++; - size <<= 1; - } - } else if (pmap_vhpt_log2size < 15) + if (pmap_vhpt_log2size == 0) + pmap_vhpt_log2size = 20; + else if (pmap_vhpt_log2size < 15) pmap_vhpt_log2size = 15; - if (pmap_vhpt_log2size > 61) + else if (pmap_vhpt_log2size > 61) pmap_vhpt_log2size = 61; - pmap_vhpt_base[0] = 0; - base = limit = 0; + base = 0; size = 1UL << pmap_vhpt_log2size; - while (pmap_vhpt_base[0] == 0) { - if (bootverbose) - printf("Trying VHPT size 0x%lx\n", size); - for (i = 0; i < count; i += 2) { - base = (phys_avail[i] + size - 1) & ~(size - 1); - limit = base + MAXCPU * size; - if (limit <= phys_avail[i+1]) - /* - * VHPT can fit in this region - */ - break; - } - if (!phys_avail[i]) { - /* Can't fit, try next smaller size. */ - pmap_vhpt_log2size--; - size >>= 1; - } else - pmap_vhpt_base[0] = IA64_PHYS_TO_RR7(base); + for (i = 0; i < count; i += 2) { + base = (phys_avail[i] + size - 1) & ~(size - 1); + if (base + size <= phys_avail[i+1]) + break; } - if (pmap_vhpt_log2size < 15) - panic("Can't find space for VHPT"); - - if (bootverbose) - printf("Putting VHPT at 0x%lx\n", base); + if (!phys_avail[i]) + panic("Unable to allocate VHPT"); if (base != phys_avail[i]) { /* Split this region. */ - if (bootverbose) - printf("Splitting [%p-%p]\n", (void *)phys_avail[i], - (void *)phys_avail[i+1]); for (j = count; j > i; j -= 2) { phys_avail[j] = phys_avail[j-2]; phys_avail[j+1] = phys_avail[j-2+1]; } phys_avail[i+1] = base; - phys_avail[i+2] = limit; + phys_avail[i+2] = base + size; } else - phys_avail[i] = limit; + phys_avail[i] = base + size; - pmap_vhpt_nbuckets = size / sizeof(struct ia64_lpte); + base = IA64_PHYS_TO_RR7(base); + PCPU_SET(md.vhpt, base); + if (bootverbose) + printf("VHPT: address=%#lx, size=%#lx\n", base, size); + pmap_vhpt_nbuckets = size / sizeof(struct ia64_lpte); pmap_vhpt_bucket = (void *)pmap_steal_memory(pmap_vhpt_nbuckets * sizeof(struct ia64_bucket)); - pte = (struct ia64_lpte *)pmap_vhpt_base[0]; for (i = 0; i < pmap_vhpt_nbuckets; i++) { - pte[i].pte = 0; - pte[i].itir = 0; - pte[i].tag = 1UL << 63; /* Invalid tag */ - pte[i].chain = (uintptr_t)(pmap_vhpt_bucket + i); - /* Stolen memory is zeroed! */ + /* Stolen memory is zeroed. */ mtx_init(&pmap_vhpt_bucket[i].mutex, "VHPT bucket lock", NULL, MTX_NOWITNESS | MTX_SPIN); } - for (i = 1; i < MAXCPU; i++) { - pmap_vhpt_base[i] = pmap_vhpt_base[i - 1] + size; - bcopy((void *)pmap_vhpt_base[i - 1], (void *)pmap_vhpt_base[i], - size); - } - - map_vhpt(pmap_vhpt_base[0]); - ia64_set_pta(pmap_vhpt_base[0] + (1 << 8) + - (pmap_vhpt_log2size << 2) + 1); + pmap_initialize_vhpt(base); + map_vhpt(base); + ia64_set_pta(base + (1 << 8) + (pmap_vhpt_log2size << 2) + 1); ia64_srlz_i(); virtual_avail = VM_MIN_KERNEL_ADDRESS; @@ -466,7 +455,7 @@ pmap_bootstrap() kernel_pmap->pm_rid[i] = 0; kernel_pmap->pm_active = 1; TAILQ_INIT(&kernel_pmap->pm_pvlist); - PCPU_SET(current_pmap, kernel_pmap); + PCPU_SET(md.current_pmap, kernel_pmap); /* * Region 5 is mapped via the vhpt. @@ -551,15 +540,16 @@ static void pmap_invalidate_page(pmap_t pmap, vm_offset_t va) { struct ia64_lpte *pte; - int i, vhpt_ofs; + struct pcpu *pc; + u_int vhpt_ofs; - KASSERT((pmap == kernel_pmap || pmap == PCPU_GET(current_pmap)), + KASSERT((pmap == kernel_pmap || pmap == PCPU_GET(md.current_pmap)), ("invalidating TLB for non-current pmap")); - vhpt_ofs = ia64_thash(va) - pmap_vhpt_base[PCPU_GET(cpuid)]; + vhpt_ofs = ia64_thash(va) - PCPU_GET(md.vhpt); critical_enter(); - for (i = 0; i < MAXCPU; i++) { - pte = (struct ia64_lpte *)(pmap_vhpt_base[i] + vhpt_ofs); + SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + pte = (struct ia64_lpte *)(pc->pc_md.vhpt + vhpt_ofs); if (pte->tag == ia64_ttag(va)) pte->tag = 1UL << 63; } @@ -591,7 +581,7 @@ static void pmap_invalidate_all(pmap_t pmap) { - KASSERT((pmap == kernel_pmap || pmap == PCPU_GET(current_pmap)), + KASSERT((pmap == kernel_pmap || pmap == PCPU_GET(md.current_pmap)), ("invalidating TLB for non-current pmap")); #ifdef SMP @@ -1172,7 +1162,7 @@ pmap_remove_pte(pmap_t pmap, struct ia64 int error; vm_page_t m; - KASSERT((pmap == kernel_pmap || pmap == PCPU_GET(current_pmap)), + KASSERT((pmap == kernel_pmap || pmap == PCPU_GET(md.current_pmap)), ("removing pte for non-current pmap")); /* @@ -1340,7 +1330,7 @@ pmap_remove_page(pmap_t pmap, vm_offset_ { struct ia64_lpte *pte; - KASSERT((pmap == kernel_pmap || pmap == PCPU_GET(current_pmap)), + KASSERT((pmap == kernel_pmap || pmap == PCPU_GET(md.current_pmap)), ("removing page for non-current pmap")); pte = pmap_find_vhpt(va); @@ -2251,7 +2241,7 @@ pmap_switch(pmap_t pm) int i; critical_enter(); - prevpm = PCPU_GET(current_pmap); + prevpm = PCPU_GET(md.current_pmap); if (prevpm == pm) goto out; if (prevpm != NULL) @@ -2268,7 +2258,7 @@ pmap_switch(pmap_t pm) } atomic_set_32(&pm->pm_active, PCPU_GET(cpumask)); } - PCPU_SET(current_pmap, pm); + PCPU_SET(md.current_pmap, pm); ia64_srlz_d(); out: Modified: stable/8/sys/ia64/include/kdb.h ============================================================================== --- stable/8/sys/ia64/include/kdb.h Sat Dec 12 04:50:04 2009 (r200430) +++ stable/8/sys/ia64/include/kdb.h Sat Dec 12 05:14:40 2009 (r200431) @@ -33,7 +33,7 @@ #include #include -#define KDB_STOPPEDPCB(pc) (&(pc)->pc_pcb) +#define KDB_STOPPEDPCB(pc) (&(pc)->pc_md.pcb) static __inline void kdb_cpu_clear_singlestep(void) Modified: stable/8/sys/ia64/include/param.h ============================================================================== --- stable/8/sys/ia64/include/param.h Sat Dec 12 04:50:04 2009 (r200430) +++ stable/8/sys/ia64/include/param.h Sat Dec 12 05:14:40 2009 (r200431) @@ -70,7 +70,7 @@ #endif #if defined(SMP) || defined(KLD_MODULE) -#define MAXCPU 4 +#define MAXCPU 32 #else #define MAXCPU 1 #endif Modified: stable/8/sys/ia64/include/pcpu.h ============================================================================== --- stable/8/sys/ia64/include/pcpu.h Sat Dec 12 04:50:04 2009 (r200430) +++ stable/8/sys/ia64/include/pcpu.h Sat Dec 12 05:14:40 2009 (r200431) @@ -30,16 +30,39 @@ #ifndef _MACHINE_PCPU_H_ #define _MACHINE_PCPU_H_ +#include #include +struct pcpu_stats { + u_long pcs_nasts; /* IPI_AST counter. */ + u_long pcs_nclks; /* Clock interrupt counter. */ + u_long pcs_nextints; /* ExtINT counter. */ + u_long pcs_nhighfps; /* IPI_HIGH_FP counter. */ + u_long pcs_nhwints; /* Hardware int. counter. */ + u_long pcs_npreempts; /* IPI_PREEMPT counter. */ + u_long pcs_nrdvs; /* IPI_RENDEZVOUS counter. */ + u_long pcs_nstops; /* IPI_STOP counter. */ + u_long pcs_nstrays; /* Stray interrupt counter. */ +}; + +struct pcpu_md { + struct pcb pcb; /* Used by IPI_STOP */ + struct pmap *current_pmap; /* active pmap */ + vm_offset_t vhpt; /* Address of VHPT */ + uint64_t lid; /* local CPU ID */ + uint64_t clock; /* Clock counter. */ + uint64_t clockadj; /* Clock adjust. */ + uint32_t awake:1; /* CPU is awake? */ + struct pcpu_stats stats; /* Interrupt stats. */ +#ifdef _KERNEL + struct sysctl_ctx_list sysctl_ctx; + struct sysctl_oid *sysctl_tree; +#endif +}; + #define PCPU_MD_FIELDS \ - struct pcb pc_pcb; /* Used by IPI_STOP */ \ - struct pmap *pc_current_pmap; /* active pmap */ \ - uint64_t pc_lid; /* local CPU ID */ \ - uint64_t pc_clock; /* Clock counter. */ \ - uint64_t pc_clockadj; /* Clock adjust. */ \ - uint32_t pc_awake:1; /* CPU is awake? */ \ - uint32_t pc_acpi_id /* ACPI CPU id. */ + uint32_t pc_acpi_id; /* ACPI CPU id. */ \ + struct pcpu_md pc_md /* MD fields. */ #ifdef _KERNEL Modified: stable/8/sys/ia64/include/pmap.h ============================================================================== --- stable/8/sys/ia64/include/pmap.h Sat Dec 12 04:50:04 2009 (r200430) +++ stable/8/sys/ia64/include/pmap.h Sat Dec 12 05:14:40 2009 (r200431) @@ -125,6 +125,7 @@ extern int pmap_vhpt_log2size; #define pmap_unmapbios(va, sz) pmap_unmapdev(va, sz) vm_offset_t pmap_steal_memory(vm_size_t); +vm_offset_t pmap_alloc_vhpt(void); void pmap_bootstrap(void); void pmap_kenter(vm_offset_t va, vm_offset_t pa); vm_paddr_t pmap_kextract(vm_offset_t va); From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 12 10:37:32 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 036DF106566C; Sat, 12 Dec 2009 10:37:32 +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 E204F8FC16; Sat, 12 Dec 2009 10:37:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBCAbV71048848; Sat, 12 Dec 2009 10:37:31 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBCAbVeh048839; Sat, 12 Dec 2009 10:37:31 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912121037.nBCAbVeh048839@svn.freebsd.org> From: Alexander Motin Date: Sat, 12 Dec 2009 10:37:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200432 - in stable/8: . contrib/top lib/libusb sbin/atacontrol sys/arm/mv sys/cam/ata sys/cam/scsi sys/conf sys/dev/ata sys/dev/ata/chipsets sys/powerpc/powermac sys/powerpc/psim tools... X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 10:37:32 -0000 Author: mav Date: Sat Dec 12 10:37:31 2009 New Revision: 200432 URL: http://svn.freebsd.org/changeset/base/200432 Log: MFC r200171, r200182, r200275, r200295, r200359: Introduce ATA_CAM kernel option, turning ata(4) controller drivers into cam(4) interface modules. When enabled, this option deprecates all ata(4) peripheral drivers (ad, acd, ...) and interfaces and allows cam(4) drivers (ada, cd, ...) and interfaces to be natively used instead. As side effect of this, ata(4) mode setting code was completely rewritten to make controller API more strict and permit above change. While doing this, SATA revision was separated from PATA mode. It allows DMA-incapable SATA devices to operate and makes hw.ata.(ata|atapi)_dma tunable work again. Also allow ata(4) controller drivers (except some specific or broken ones) to handle larger data transfers. Previous constraint of 64K was artificial and is not really required by PCI ATA BM specification or hardware. Submitted by: nwitehorn (powerpc part) Modified: stable/8/sbin/atacontrol/atacontrol.c stable/8/sys/arm/mv/mv_sata.c stable/8/sys/cam/ata/ata_xpt.c stable/8/sys/cam/scsi/scsi_cd.c stable/8/sys/conf/NOTES stable/8/sys/conf/options stable/8/sys/dev/ata/ata-all.c stable/8/sys/dev/ata/ata-all.h stable/8/sys/dev/ata/ata-disk.c stable/8/sys/dev/ata/ata-dma.c stable/8/sys/dev/ata/ata-lowlevel.c stable/8/sys/dev/ata/ata-pci.c stable/8/sys/dev/ata/ata-pci.h stable/8/sys/dev/ata/ata-queue.c stable/8/sys/dev/ata/ata-sata.c stable/8/sys/dev/ata/ata_if.m stable/8/sys/dev/ata/atapi-cd.c stable/8/sys/dev/ata/atapi-fd.c stable/8/sys/dev/ata/atapi-tape.c stable/8/sys/dev/ata/chipsets/ata-acard.c stable/8/sys/dev/ata/chipsets/ata-acerlabs.c stable/8/sys/dev/ata/chipsets/ata-ahci.c stable/8/sys/dev/ata/chipsets/ata-amd.c stable/8/sys/dev/ata/chipsets/ata-ati.c stable/8/sys/dev/ata/chipsets/ata-cenatek.c stable/8/sys/dev/ata/chipsets/ata-cypress.c stable/8/sys/dev/ata/chipsets/ata-cyrix.c stable/8/sys/dev/ata/chipsets/ata-highpoint.c stable/8/sys/dev/ata/chipsets/ata-intel.c stable/8/sys/dev/ata/chipsets/ata-ite.c stable/8/sys/dev/ata/chipsets/ata-jmicron.c stable/8/sys/dev/ata/chipsets/ata-marvell.c stable/8/sys/dev/ata/chipsets/ata-micron.c stable/8/sys/dev/ata/chipsets/ata-national.c stable/8/sys/dev/ata/chipsets/ata-netcell.c stable/8/sys/dev/ata/chipsets/ata-nvidia.c stable/8/sys/dev/ata/chipsets/ata-promise.c stable/8/sys/dev/ata/chipsets/ata-serverworks.c stable/8/sys/dev/ata/chipsets/ata-siliconimage.c stable/8/sys/dev/ata/chipsets/ata-sis.c stable/8/sys/dev/ata/chipsets/ata-via.c stable/8/sys/powerpc/powermac/ata_dbdma.c stable/8/sys/powerpc/powermac/ata_kauai.c stable/8/sys/powerpc/powermac/ata_macio.c stable/8/sys/powerpc/psim/ata_iobus.c Directory Properties: stable/8/ (props changed) stable/8/ObsoleteFiles.inc (props changed) stable/8/UPDATING (props changed) stable/8/bin/csh/ (props changed) stable/8/bin/ps/ (props changed) stable/8/bin/sh/ (props changed) stable/8/cddl/compat/opensolaris/ (props changed) stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/lib/libnvpair/ (props changed) stable/8/contrib/bind9/ (props changed) stable/8/contrib/bsnmp/ (props changed) stable/8/contrib/bzip2/ (props changed) stable/8/contrib/cpio/ (props changed) stable/8/contrib/csup/ (props changed) stable/8/contrib/ee/ (props changed) stable/8/contrib/file/ (props changed) stable/8/contrib/gdb/ (props changed) stable/8/contrib/gdtoa/ (props changed) stable/8/contrib/less/ (props changed) stable/8/contrib/libpcap/ (props changed) stable/8/contrib/ncurses/ (props changed) stable/8/contrib/netcat/ (props changed) stable/8/contrib/ntp/ (props changed) stable/8/contrib/openbsm/ (props changed) stable/8/contrib/openpam/ (props changed) stable/8/contrib/pf/ (props changed) stable/8/contrib/sendmail/ (props changed) stable/8/contrib/tcpdump/ (props changed) stable/8/contrib/tcsh/ (props changed) stable/8/contrib/top/ (props changed) stable/8/contrib/top/install-sh (props changed) stable/8/contrib/traceroute/ (props changed) stable/8/contrib/wpa/ (props changed) stable/8/crypto/openssh/ (props changed) stable/8/crypto/openssl/ (props changed) stable/8/etc/ (props changed) stable/8/games/factor/ (props changed) stable/8/games/fortune/ (props changed) stable/8/games/fortune/datfiles/ (props changed) stable/8/gnu/usr.bin/groff/ (props changed) stable/8/gnu/usr.bin/patch/ (props changed) stable/8/include/ (props changed) stable/8/kerberos5/lib/libgssapi_krb5/ (props changed) stable/8/kerberos5/lib/libgssapi_spnego/ (props changed) stable/8/lib/bind/ (props changed) stable/8/lib/libarchive/ (props changed) stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libdevinfo/ (props changed) stable/8/lib/libdisk/ (props changed) stable/8/lib/libfetch/ (props changed) stable/8/lib/libkvm/ (props changed) stable/8/lib/libpmc/ (props changed) stable/8/lib/libradius/ (props changed) stable/8/lib/libstand/ (props changed) stable/8/lib/libthr/ (props changed) stable/8/lib/libusb/ (props changed) stable/8/lib/libusb/usb.h (props changed) stable/8/lib/libutil/ (props changed) stable/8/libexec/rtld-elf/ (props changed) stable/8/release/ (props changed) stable/8/release/doc/ (props changed) stable/8/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/8/sbin/ (props changed) stable/8/sbin/atacontrol/ (props changed) stable/8/sbin/bsdlabel/ (props changed) stable/8/sbin/camcontrol/ (props changed) stable/8/sbin/ddb/ (props changed) stable/8/sbin/dhclient/ (props changed) stable/8/sbin/fsck/ (props changed) stable/8/sbin/geom/ (props changed) stable/8/sbin/ifconfig/ (props changed) stable/8/sbin/ipfw/ (props changed) stable/8/sbin/mksnap_ffs/ (props changed) stable/8/sbin/mount/ (props changed) stable/8/sbin/mount_cd9660/ (props changed) stable/8/sbin/mount_nfs/ (props changed) stable/8/sbin/umount/ (props changed) stable/8/secure/usr.bin/bdes/ (props changed) stable/8/share/man/man3/ (props changed) stable/8/share/man/man4/ (props changed) stable/8/share/man/man5/ (props changed) stable/8/share/man/man7/ (props changed) stable/8/share/man/man9/ (props changed) stable/8/share/misc/ (props changed) stable/8/share/timedef/ (props changed) stable/8/share/zoneinfo/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/tools/kerneldoc/subsys/ (props changed) stable/8/tools/regression/bin/sh/ (props changed) stable/8/tools/regression/lib/libc/ (props changed) stable/8/tools/regression/lib/msun/test-conj.t (props changed) stable/8/tools/regression/poll/ (props changed) stable/8/tools/regression/priv/ (props changed) stable/8/tools/regression/usr.bin/pkill/pgrep-_g.t (props changed) stable/8/tools/regression/usr.bin/pkill/pgrep-_s.t (props changed) stable/8/tools/regression/usr.bin/pkill/pkill-_g.t (props changed) stable/8/tools/tools/ath/common/dumpregs.h (props changed) stable/8/tools/tools/ath/common/dumpregs_5210.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5211.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5212.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5416.c (props changed) stable/8/tools/tools/termcap/termcap.pl (props changed) stable/8/tools/tools/vimage/ (props changed) stable/8/usr.bin/calendar/calendars/calendar.freebsd (props changed) stable/8/usr.bin/csup/ (props changed) stable/8/usr.bin/find/ (props changed) stable/8/usr.bin/fstat/ (props changed) stable/8/usr.bin/gcore/ (props changed) stable/8/usr.bin/gzip/ (props changed) stable/8/usr.bin/kdump/ (props changed) stable/8/usr.bin/locale/ (props changed) stable/8/usr.bin/look/ (props changed) stable/8/usr.bin/netstat/ (props changed) stable/8/usr.bin/perror/ (props changed) stable/8/usr.bin/procstat/ (props changed) stable/8/usr.bin/systat/ (props changed) stable/8/usr.bin/unifdef/ (props changed) stable/8/usr.bin/vmstat/ (props changed) stable/8/usr.bin/w/ (props changed) stable/8/usr.bin/whois/ (props changed) stable/8/usr.sbin/ (props changed) stable/8/usr.sbin/acpi/ (props changed) stable/8/usr.sbin/arp/ (props changed) stable/8/usr.sbin/cdcontrol/ (props changed) stable/8/usr.sbin/crashinfo/ (props changed) stable/8/usr.sbin/dumpcis/cardinfo.h (props changed) stable/8/usr.sbin/dumpcis/cis.h (props changed) stable/8/usr.sbin/freebsd-update/ (props changed) stable/8/usr.sbin/iostat/ (props changed) stable/8/usr.sbin/jail/ (props changed) stable/8/usr.sbin/jls/ (props changed) stable/8/usr.sbin/lpr/ (props changed) stable/8/usr.sbin/makefs/ffs/ffs_bswap.c (props changed) stable/8/usr.sbin/makefs/ffs/ffs_subr.c (props changed) stable/8/usr.sbin/makefs/ffs/ufs_bswap.h (props changed) stable/8/usr.sbin/makefs/getid.c (props changed) stable/8/usr.sbin/mfiutil/mfiutil.8 (props changed) stable/8/usr.sbin/ndp/ (props changed) stable/8/usr.sbin/ntp/ (props changed) stable/8/usr.sbin/ppp/ (props changed) stable/8/usr.sbin/pstat/ (props changed) stable/8/usr.sbin/sysinstall/ (props changed) stable/8/usr.sbin/traceroute6/ (props changed) stable/8/usr.sbin/usbconfig/ (props changed) stable/8/usr.sbin/wpa/ (props changed) stable/8/usr.sbin/zic/ (props changed) Modified: stable/8/sbin/atacontrol/atacontrol.c ============================================================================== --- stable/8/sbin/atacontrol/atacontrol.c Sat Dec 12 05:14:40 2009 (r200431) +++ stable/8/sbin/atacontrol/atacontrol.c Sat Dec 12 10:37:31 2009 (r200432) @@ -42,7 +42,7 @@ static const char * mode2str(int mode) { - switch (mode) { + switch (mode & 0xff) { case ATA_PIO: return "BIOSPIO"; case ATA_PIO0: return "PIO0"; case ATA_PIO1: return "PIO1"; @@ -59,13 +59,23 @@ mode2str(int mode) case ATA_UDMA4: return "UDMA66"; case ATA_UDMA5: return "UDMA100"; case ATA_UDMA6: return "UDMA133"; - case ATA_SA150: return "SATA150"; - case ATA_SA300: return "SATA300"; case ATA_DMA: return "BIOSDMA"; default: return "???"; } } +static const char * +satarev2str(int mode) +{ + switch ((mode & 0xff00) >> 8) { + case 0: return ""; + case 1: return "SATA 1.5Gb/s"; + case 2: return "SATA 3Gb/s"; + case 3: return "SATA 6Gb/s"; + default: return "???"; + } +} + static int str2mode(char *str) { @@ -79,7 +89,9 @@ str2mode(char *str) if (!strcasecmp(str, "WDMA1")) return ATA_WDMA1; if (!strcasecmp(str, "WDMA2")) return ATA_WDMA2; if (!strcasecmp(str, "UDMA0")) return ATA_UDMA0; + if (!strcasecmp(str, "UDMA16")) return ATA_UDMA0; if (!strcasecmp(str, "UDMA1")) return ATA_UDMA1; + if (!strcasecmp(str, "UDMA25")) return ATA_UDMA1; if (!strcasecmp(str, "UDMA2")) return ATA_UDMA2; if (!strcasecmp(str, "UDMA33")) return ATA_UDMA2; if (!strcasecmp(str, "UDMA3")) return ATA_UDMA3; @@ -90,8 +102,6 @@ str2mode(char *str) if (!strcasecmp(str, "UDMA100")) return ATA_UDMA5; if (!strcasecmp(str, "UDMA6")) return ATA_UDMA6; if (!strcasecmp(str, "UDMA133")) return ATA_UDMA6; - if (!strcasecmp(str, "SATA150")) return ATA_SA150; - if (!strcasecmp(str, "SATA300")) return ATA_SA300; if (!strcasecmp(str, "BIOSDMA")) return ATA_DMA; return -1; } @@ -382,7 +392,8 @@ main(int argc, char **argv) if (argc == 3 || argc == 4) { if (ioctl(fd, IOCATAGMODE, &mode) < 0) err(1, "ioctl(IOCATAGMODE)"); - printf("current mode = %s\n", mode2str(mode)); + printf("current mode = %s %s\n", + mode2str(mode), satarev2str(mode)); } exit(EX_OK); } Modified: stable/8/sys/arm/mv/mv_sata.c ============================================================================== --- stable/8/sys/arm/mv/mv_sata.c Sat Dec 12 05:14:40 2009 (r200431) +++ stable/8/sys/arm/mv/mv_sata.c Sat Dec 12 10:37:31 2009 (r200432) @@ -136,7 +136,8 @@ static int sata_channel_detach(device_t static int sata_channel_begin_transaction(struct ata_request *request); static int sata_channel_end_transaction(struct ata_request *request); static int sata_channel_status(device_t dev); -static void sata_channel_setmode(device_t parent, device_t dev); +static int sata_channel_setmode(device_t dev, int target, int mode); +static int sata_channel_getrev(device_t dev, int target); static void sata_channel_reset(device_t dev); static void sata_channel_dmasetprd(void *xsc, bus_dma_segment_t *segs, int nsegs, int error); @@ -423,7 +424,7 @@ sata_channel_attach(device_t dev) ch->dev = dev; ch->unit = device_get_unit(dev); - ch->flags |= ATA_USE_16BIT | ATA_NO_SLAVE; + ch->flags |= ATA_USE_16BIT | ATA_NO_SLAVE | ATA_SATA; /* Set legacy ATA resources. */ for (i = ATA_DATA; i <= ATA_COMMAND; i++) { @@ -748,19 +749,22 @@ sata_channel_reset(device_t dev) SATA_OUTL(sc, SATA_EDMA_IEMR(ch->unit), 0xFFFFFFFF); } -static void -sata_channel_setmode(device_t parent, device_t dev) +static int +sata_channel_setmode(device_t parent, int target, int mode) { - struct ata_device *atadev; - - atadev = device_get_softc(dev); /* Disable EDMA before using legacy registers */ sata_edma_ctrl(parent, 0); + return (ata_sata_setmode(parent, target, mode)); +} - ata_sata_setmode(dev, ATA_PIO_MAX); - if (atadev->mode >= ATA_DMA) - ata_sata_setmode(dev, atadev->mode); +static int +sata_channel_getrev(device_t parent, int target) +{ + + /* Disable EDMA before using legacy registers */ + sata_edma_ctrl(parent, 0); + return (ata_sata_getrev(parent, target)); } static void @@ -849,6 +853,7 @@ static device_method_t sata_channel_meth /* ATA channel interface */ DEVMETHOD(ata_reset, sata_channel_reset), DEVMETHOD(ata_setmode, sata_channel_setmode), + DEVMETHOD(ata_getrev, sata_channel_getrev), { 0, 0 } }; Modified: stable/8/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/8/sys/cam/ata/ata_xpt.c Sat Dec 12 05:14:40 2009 (r200431) +++ stable/8/sys/cam/ata/ata_xpt.c Sat Dec 12 10:37:31 2009 (r200432) @@ -366,7 +366,7 @@ negotiate: cts.xport_specific.sata.valid = CTS_SATA_VALID_MODE; } xpt_action((union ccb *)&cts); - /* Fetch user modes from SIM. */ + /* Fetch current modes from SIM. */ bzero(&cts, sizeof(cts)); xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; @@ -395,10 +395,25 @@ negotiate: } case PROBE_SET_MULTI: { - u_int sectors; - - sectors = max(1, min(ident_buf->sectors_intr & 0xff, 16)); + u_int sectors, bytecount; + bytecount = 8192; /* SATA maximum */ + /* Fetch user bytecount from SIM. */ + bzero(&cts, sizeof(cts)); + xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); + cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; + cts.type = CTS_TYPE_USER_SETTINGS; + xpt_action((union ccb *)&cts); + if (path->device->transport == XPORT_ATA) { + if (cts.xport_specific.ata.valid & CTS_ATA_VALID_BYTECOUNT) + bytecount = cts.xport_specific.ata.bytecount; + } else { + if (cts.xport_specific.sata.valid & CTS_SATA_VALID_BYTECOUNT) + bytecount = cts.xport_specific.sata.bytecount; + } + /* Honor device capabilities. */ + sectors = max(1, min(ident_buf->sectors_intr & 0xff, + bytecount / ata_logical_sector_size(ident_buf))); /* Report bytecount to SIM. */ bzero(&cts, sizeof(cts)); xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); @@ -414,6 +429,20 @@ negotiate: cts.xport_specific.sata.valid = CTS_SATA_VALID_BYTECOUNT; } xpt_action((union ccb *)&cts); + /* Fetch current bytecount from SIM. */ + bzero(&cts, sizeof(cts)); + xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); + cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; + cts.type = CTS_TYPE_CURRENT_SETTINGS; + xpt_action((union ccb *)&cts); + if (path->device->transport == XPORT_ATA) { + if (cts.xport_specific.ata.valid & CTS_ATA_VALID_BYTECOUNT) + bytecount = cts.xport_specific.ata.bytecount; + } else { + if (cts.xport_specific.sata.valid & CTS_SATA_VALID_BYTECOUNT) + bytecount = cts.xport_specific.sata.bytecount; + } + sectors = bytecount / ata_logical_sector_size(ident_buf); cam_fill_ataio(ataio, 1, @@ -427,6 +456,45 @@ negotiate: break; } case PROBE_INQUIRY: + { + u_int bytecount; + + bytecount = 8192; /* SATA maximum */ + /* Fetch user bytecount from SIM. */ + bzero(&cts, sizeof(cts)); + xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); + cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; + cts.type = CTS_TYPE_USER_SETTINGS; + xpt_action((union ccb *)&cts); + if (path->device->transport == XPORT_ATA) { + if (cts.xport_specific.ata.valid & CTS_ATA_VALID_BYTECOUNT) + bytecount = cts.xport_specific.ata.bytecount; + } else { + if (cts.xport_specific.sata.valid & CTS_SATA_VALID_BYTECOUNT) + bytecount = cts.xport_specific.sata.bytecount; + } + /* Honor device capabilities. */ + bytecount &= ~1; + bytecount = max(2, min(65534, bytecount)); + if (ident_buf->satacapabilities != 0x0000 && + ident_buf->satacapabilities != 0xffff) { + bytecount = min(8192, bytecount); + } + /* Report bytecount to SIM. */ + bzero(&cts, sizeof(cts)); + xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); + cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; + cts.type = CTS_TYPE_CURRENT_SETTINGS; + if (path->device->transport == XPORT_ATA) { + cts.xport_specific.ata.bytecount = bytecount; + cts.xport_specific.ata.valid = CTS_ATA_VALID_BYTECOUNT; + } else { + cts.xport_specific.sata.bytecount = bytecount; + cts.xport_specific.sata.valid = CTS_SATA_VALID_BYTECOUNT; + } + xpt_action((union ccb *)&cts); + /* FALLTHROUGH */ + } case PROBE_FULL_INQUIRY: { u_int inquiry_len; Modified: stable/8/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_cd.c Sat Dec 12 05:14:40 2009 (r200431) +++ stable/8/sys/cam/scsi/scsi_cd.c Sat Dec 12 10:37:31 2009 (r200432) @@ -673,6 +673,7 @@ cdregister(struct cam_periph *periph, vo softc->quirks = CD_Q_NONE; /* Check if the SIM does not want 6 byte commands */ + bzero(&cpi, sizeof(cpi)); xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NORMAL); cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); @@ -726,6 +727,12 @@ cdregister(struct cam_periph *periph, vo softc->disk->d_name = "cd"; softc->disk->d_unit = periph->unit_number; softc->disk->d_drv1 = periph; + if (cpi.maxio == 0) + softc->disk->d_maxsize = DFLTPHYS; /* traditional default */ + else if (cpi.maxio > MAXPHYS) + softc->disk->d_maxsize = MAXPHYS; /* for safety */ + else + softc->disk->d_maxsize = cpi.maxio; softc->disk->d_flags = 0; disk_create(softc->disk, DISK_VERSION); cam_periph_lock(periph); @@ -2768,7 +2775,6 @@ cdcheckmedia(struct cam_periph *periph) softc = (struct cd_softc *)periph->softc; cdprevent(periph, PR_PREVENT); - softc->disk->d_maxsize = DFLTPHYS; softc->disk->d_sectorsize = 2048; softc->disk->d_mediasize = 0; @@ -2870,7 +2876,6 @@ cdcheckmedia(struct cam_periph *periph) } softc->flags |= CD_FLAG_VALID_TOC; - softc->disk->d_maxsize = DFLTPHYS; softc->disk->d_sectorsize = softc->params.blksize; softc->disk->d_mediasize = (off_t)softc->params.blksize * softc->params.disksize; Modified: stable/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Sat Dec 12 05:14:40 2009 (r200431) +++ stable/8/sys/conf/NOTES Sat Dec 12 10:37:31 2009 (r200432) @@ -1718,9 +1718,15 @@ hint.ata.1.irq="15" # else the device numbers are dynamically allocated. # ATA_REQUEST_TIMEOUT: the number of seconds to wait for an ATA request # before timing out. +# ATA_CAM: Turn ata(4) subsystem controller drivers into cam(4) +# interface modules. This deprecates all ata(4) +# peripheral device drivers (atadisk, ataraid, atapicd, +# atapifd. atapist, atapicam) and all user-level APIs. +# cam(4) drivers and APIs will be connected instead. options ATA_STATIC_ID #options ATA_REQUEST_TIMEOUT=10 +#options ATA_CAM # # Standard floppy disk controllers and floppy tapes, supports Modified: stable/8/sys/conf/options ============================================================================== --- stable/8/sys/conf/options Sat Dec 12 05:14:40 2009 (r200431) +++ stable/8/sys/conf/options Sat Dec 12 10:37:31 2009 (r200432) @@ -351,6 +351,7 @@ ISCSI_INITIATOR_DEBUG opt_iscsi_initiato ATA_STATIC_ID opt_ata.h ATA_NOPCI opt_ata.h ATA_REQUEST_TIMEOUT opt_ata.h +ATA_CAM opt_ata.h # Net stuff. ACCEPT_FILTER_DATA Modified: stable/8/sys/dev/ata/ata-all.c ============================================================================== --- stable/8/sys/dev/ata/ata-all.c Sat Dec 12 05:14:40 2009 (r200431) +++ stable/8/sys/dev/ata/ata-all.c Sat Dec 12 10:37:31 2009 (r200432) @@ -50,6 +50,16 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef ATA_CAM +#include +#include +#include +#include +#include +#include +#endif + +#ifndef ATA_CAM /* device structure */ static d_ioctl_t ata_ioctl; static struct cdevsw ata_cdevsw = { @@ -58,14 +68,21 @@ static struct cdevsw ata_cdevsw = { .d_ioctl = ata_ioctl, .d_name = "ata", }; +#endif /* prototypes */ +#ifndef ATA_CAM static void ata_boot_attach(void); static device_t ata_add_child(device_t, struct ata_device *, int); +#else +static void ataaction(struct cam_sim *sim, union ccb *ccb); +static void atapoll(struct cam_sim *sim); +#endif static void ata_conn_event(void *, int); static void bswap(int8_t *, int); static void btrim(int8_t *, int); static void bpack(int8_t *, int8_t *, int); +static void ata_interrupt_locked(void *data); /* global vars */ MALLOC_DEFINE(M_ATA, "ata_generic", "ATA driver generic layer"); @@ -115,6 +132,10 @@ ata_attach(device_t dev) { struct ata_channel *ch = device_get_softc(dev); int error, rid; +#ifdef ATA_CAM + struct cam_devq *devq; + int i; +#endif /* check that we have a virgin channel to attach */ if (ch->r_irq) @@ -129,11 +150,23 @@ ata_attach(device_t dev) mtx_init(&ch->queue_mtx, "ATA queue lock", NULL, MTX_DEF); TAILQ_INIT(&ch->ata_queue); TASK_INIT(&ch->conntask, 0, ata_conn_event, dev); +#ifdef ATA_CAM + for (i = 0; i < 16; i++) { + ch->user[i].mode = 0; + if (ch->flags & ATA_SATA) + ch->user[i].bytecount = 8192; + else + ch->user[i].bytecount = MAXPHYS; + ch->curr[i] = ch->user[i]; + } +#endif /* reset the controller HW, the channel and device(s) */ while (ATA_LOCKING(dev, ATA_LF_LOCK) != ch->unit) pause("ataatch", 1); +#ifndef ATA_CAM ATA_RESET(dev); +#endif ATA_LOCKING(dev, ATA_LF_UNLOCK); /* allocate DMA resources if DMA HW present*/ @@ -154,18 +187,61 @@ ata_attach(device_t dev) return error; } +#ifndef ATA_CAM /* probe and attach devices on this channel unless we are in early boot */ if (!ata_delayed_attach) ata_identify(dev); - return 0; + return (0); +#else + mtx_lock(&ch->state_mtx); + /* Create the device queue for our SIM. */ + devq = cam_simq_alloc(1); + if (devq == NULL) { + device_printf(dev, "Unable to allocate simq\n"); + error = ENOMEM; + goto err1; + } + /* Construct SIM entry */ + ch->sim = cam_sim_alloc(ataaction, atapoll, "ata", ch, + device_get_unit(dev), &ch->state_mtx, 1, 0, devq); + if (ch->sim == NULL) { + device_printf(dev, "unable to allocate sim\n"); + error = ENOMEM; + goto err2; + } + if (xpt_bus_register(ch->sim, dev, 0) != CAM_SUCCESS) { + device_printf(dev, "unable to register xpt bus\n"); + error = ENXIO; + goto err2; + } + if (xpt_create_path(&ch->path, /*periph*/NULL, cam_sim_path(ch->sim), + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + device_printf(dev, "unable to create path\n"); + error = ENXIO; + goto err3; + } + mtx_unlock(&ch->state_mtx); + return (0); + +err3: + xpt_bus_deregister(cam_sim_path(ch->sim)); +err2: + cam_sim_free(ch->sim, /*free_devq*/TRUE); +err1: + bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq); + mtx_unlock(&ch->state_mtx); + return (error); +#endif } int ata_detach(device_t dev) { struct ata_channel *ch = device_get_softc(dev); +#ifndef ATA_CAM device_t *children; int nchildren, i; +#endif /* check that we have a valid channel to detach */ if (!ch->r_irq) @@ -176,6 +252,7 @@ ata_detach(device_t dev) ch->state |= ATA_STALL_QUEUE; mtx_unlock(&ch->state_mtx); +#ifndef ATA_CAM /* detach & delete all children */ if (!device_get_children(dev, &children, &nchildren)) { for (i = 0; i < nchildren; i++) @@ -183,8 +260,18 @@ ata_detach(device_t dev) device_delete_child(dev, children[i]); free(children, M_TEMP); } +#endif taskqueue_drain(taskqueue_thread, &ch->conntask); +#ifdef ATA_CAM + mtx_lock(&ch->state_mtx); + xpt_async(AC_LOST_DEVICE, ch->path, NULL); + xpt_free_path(ch->path); + xpt_bus_deregister(cam_sim_path(ch->sim)); + cam_sim_free(ch->sim, /*free_devq*/TRUE); + mtx_unlock(&ch->state_mtx); +#endif + /* release resources */ bus_teardown_intr(dev, ch->r_irq, ch->ih); bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq); @@ -203,8 +290,11 @@ static void ata_conn_event(void *context, int dummy) { device_t dev = (device_t)context; + struct ata_channel *ch = device_get_softc(dev); + mtx_lock(&ch->state_mtx); ata_reinit(dev); + mtx_unlock(&ch->state_mtx); } int @@ -212,6 +302,7 @@ ata_reinit(device_t dev) { struct ata_channel *ch = device_get_softc(dev); struct ata_request *request; +#ifndef ATA_CAM device_t *children; int nchildren, i; @@ -298,7 +389,23 @@ ata_reinit(device_t dev) /* kick off requests on the queue */ ata_start(dev); - return 0; +#else + if ((request = ch->running)) { + ch->running = NULL; + if (ch->state == ATA_ACTIVE) + ch->state = ATA_IDLE; + callout_stop(&request->callout); + if (ch->dma.unload) + ch->dma.unload(request); + request->result = ERESTART; + ata_cam_end_transaction(dev, request); + } + /* reset the controller HW, the channel and device(s) */ + ATA_RESET(dev); + /* Tell the XPT about the event */ + xpt_async(AC_BUS_RESET, ch->path, NULL); +#endif + return(0); } int @@ -310,6 +417,7 @@ ata_suspend(device_t dev) if (!dev || !(ch = device_get_softc(dev))) return ENXIO; +#ifndef ATA_CAM /* wait for the channel to be IDLE or detached before suspending */ while (ch->r_irq) { mtx_lock(&ch->state_mtx); @@ -322,7 +430,8 @@ ata_suspend(device_t dev) tsleep(ch, PRIBIO, "atasusp", hz/10); } ATA_LOCKING(dev, ATA_LF_UNLOCK); - return 0; +#endif + return(0); } int @@ -337,18 +446,36 @@ ata_resume(device_t dev) /* reinit the devices, we dont know what mode/state they are in */ error = ata_reinit(dev); +#ifndef ATA_CAM /* kick off requests on the queue */ ata_start(dev); +#endif return error; } void ata_interrupt(void *data) { +#ifdef ATA_CAM + struct ata_channel *ch = (struct ata_channel *)data; + + mtx_lock(&ch->state_mtx); +#endif + ata_interrupt_locked(data); +#ifdef ATA_CAM + mtx_unlock(&ch->state_mtx); +#endif +} + +static void +ata_interrupt_locked(void *data) +{ struct ata_channel *ch = (struct ata_channel *)data; struct ata_request *request; +#ifndef ATA_CAM mtx_lock(&ch->state_mtx); +#endif do { /* ignore interrupt if its not for us */ if (ch->hw.status && !ch->hw.status(ch->dev)) @@ -374,18 +501,71 @@ ata_interrupt(void *data) ch->running = NULL; if (ch->state == ATA_ACTIVE) ch->state = ATA_IDLE; +#ifdef ATA_CAM + ata_cam_end_transaction(ch->dev, request); +#else mtx_unlock(&ch->state_mtx); ATA_LOCKING(ch->dev, ATA_LF_UNLOCK); ata_finish(request); +#endif return; } } while (0); +#ifndef ATA_CAM mtx_unlock(&ch->state_mtx); +#endif +} + +void +ata_print_cable(device_t dev, u_int8_t *who) +{ + device_printf(dev, + "DMA limited to UDMA33, %s found non-ATA66 cable\n", who); +} + +int +ata_check_80pin(device_t dev, int mode) +{ + struct ata_device *atadev = device_get_softc(dev); + + if (!ata_dma_check_80pin) { + if (bootverbose) + device_printf(dev, "Skipping 80pin cable check\n"); + return mode; + } + + if (mode > ATA_UDMA2 && !(atadev->param.hwres & ATA_CABLE_ID)) { + ata_print_cable(dev, "device"); + mode = ATA_UDMA2; + } + return mode; +} + +void +ata_setmode(device_t dev) +{ + struct ata_channel *ch = device_get_softc(device_get_parent(dev)); + struct ata_device *atadev = device_get_softc(dev); + int error, mode, pmode; + + mode = atadev->mode; + do { + pmode = mode = ata_limit_mode(dev, mode, ATA_DMA_MAX); + mode = ATA_SETMODE(device_get_parent(dev), atadev->unit, mode); + if ((ch->flags & (ATA_CHECKS_CABLE | ATA_SATA)) == 0) + mode = ata_check_80pin(dev, mode); + } while (pmode != mode); /* Interate till successfull negotiation. */ + error = ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode); + if (bootverbose) + device_printf(dev, "%ssetting %s\n", + (error) ? "FAILURE " : "", ata_mode2str(mode)); + atadev->mode = mode; } /* * device related interfaces */ +#ifndef ATA_CAM static int ata_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int32_t flag, struct thread *td) @@ -467,6 +647,7 @@ ata_ioctl(struct cdev *dev, u_long cmd, } return error; } +#endif int ata_device_ioctl(device_t dev, u_long cmd, caddr_t data) @@ -549,11 +730,12 @@ ata_device_ioctl(device_t dev, u_long cm case IOCATASMODE: atadev->mode = *mode; - ATA_SETMODE(device_get_parent(dev), dev); + ata_setmode(dev); return 0; case IOCATAGMODE: - *mode = atadev->mode; + *mode = atadev->mode | + (ATA_GETREV(device_get_parent(dev), atadev->unit) << 8); return 0; case IOCATASSPINDOWN: atadev->spindown = *mode; @@ -566,6 +748,7 @@ ata_device_ioctl(device_t dev, u_long cm } } +#ifndef ATA_CAM static void ata_boot_attach(void) { @@ -590,11 +773,12 @@ ata_boot_attach(void) mtx_unlock(&Giant); /* newbus suckage dealt with, release Giant */ } - +#endif /* * misc support functions */ +#ifndef ATA_CAM static device_t ata_add_child(device_t parent, struct ata_device *atadev, int unit) { @@ -609,6 +793,7 @@ ata_add_child(device_t parent, struct at } return child; } +#endif int ata_getparam(struct ata_device *atadev, int init) @@ -705,6 +890,7 @@ ata_getparam(struct ata_device *atadev, return error; } +#ifndef ATA_CAM int ata_identify(device_t dev) { @@ -778,6 +964,7 @@ ata_identify(device_t dev) mtx_unlock(&Giant); return 0; } +#endif void ata_default_registers(device_t dev) @@ -920,7 +1107,7 @@ ata_unit2str(struct ata_device *atadev) return str; } -char * +const char * ata_mode2str(int mode) { switch (mode) { @@ -950,6 +1137,18 @@ ata_mode2str(int mode) } } +const char * +ata_satarev2str(int rev) +{ + switch (rev) { + case 0: return ""; + case 1: return "SATA 1.5Gb/s"; + case 2: return "SATA 3Gb/s"; + case 3: return "SATA 6Gb/s"; + default: return "???"; + } +} + int ata_atapi(device_t dev) { @@ -1081,6 +1280,358 @@ bpack(int8_t *src, int8_t *dst, int len) dst[j] = 0x00; } +#ifdef ATA_CAM +void +ata_cam_begin_transaction(device_t dev, union ccb *ccb) +{ + struct ata_channel *ch = device_get_softc(dev); + struct ata_request *request; + + if (!(request = ata_alloc_request())) { + device_printf(dev, "FAILURE - out of memory in start\n"); + ccb->ccb_h.status = CAM_REQ_INVALID; + xpt_done(ccb); + return; + } + bzero(request, sizeof(*request)); + + /* setup request */ + request->dev = NULL; + request->parent = dev; + request->unit = ccb->ccb_h.target_id; + if (ccb->ccb_h.func_code == XPT_ATA_IO) { + request->data = ccb->ataio.data_ptr; + request->bytecount = ccb->ataio.dxfer_len; + request->u.ata.command = ccb->ataio.cmd.command; + request->u.ata.feature = ((uint16_t)ccb->ataio.cmd.features_exp << 8) | + (uint16_t)ccb->ataio.cmd.features; + request->u.ata.count = ((uint16_t)ccb->ataio.cmd.sector_count_exp << 8) | + (uint16_t)ccb->ataio.cmd.sector_count; + if (ccb->ataio.cmd.flags & CAM_ATAIO_48BIT) { + request->flags |= ATA_R_48BIT; + request->u.ata.lba = + ((uint64_t)ccb->ataio.cmd.lba_high_exp << 40) | + ((uint64_t)ccb->ataio.cmd.lba_mid_exp << 32) | + ((uint64_t)ccb->ataio.cmd.lba_low_exp << 24); + } else { + request->u.ata.lba = + ((uint64_t)(ccb->ataio.cmd.device & 0x0f) << 24); + } + request->u.ata.lba |= ((uint64_t)ccb->ataio.cmd.lba_high << 16) | + ((uint64_t)ccb->ataio.cmd.lba_mid << 8) | + (uint64_t)ccb->ataio.cmd.lba_low; + if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE && + ccb->ataio.cmd.flags & CAM_ATAIO_DMA) + request->flags |= ATA_R_DMA; + if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) + request->flags |= ATA_R_READ; + if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) + request->flags |= ATA_R_WRITE; + } else { + request->data = ccb->csio.data_ptr; + request->bytecount = ccb->csio.dxfer_len; + bcopy((ccb->ccb_h.flags & CAM_CDB_POINTER) ? + ccb->csio.cdb_io.cdb_ptr : ccb->csio.cdb_io.cdb_bytes, + request->u.atapi.ccb, ccb->csio.cdb_len); + request->flags |= ATA_R_ATAPI; + if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE && + ch->curr[ccb->ccb_h.target_id].mode >= ATA_DMA) + request->flags |= ATA_R_DMA; + if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) + request->flags |= ATA_R_READ; + if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) + request->flags |= ATA_R_WRITE; + } + request->transfersize = min(request->bytecount, + ch->curr[ccb->ccb_h.target_id].bytecount); +// request->callback = ad_done; + request->retries = 0; + request->timeout = (ccb->ccb_h.timeout + 999) / 1000; + callout_init_mtx(&request->callout, &ch->state_mtx, CALLOUT_RETURNUNLOCKED); + request->ccb = ccb; + + ch->running = request; + ch->state = ATA_ACTIVE; + if (ch->hw.begin_transaction(request) == ATA_OP_FINISHED) { + ch->running = NULL; + ch->state = ATA_IDLE; + ata_cam_end_transaction(dev, request); + return; + } +} + +void +ata_cam_end_transaction(device_t dev, struct ata_request *request) +{ + struct ata_channel *ch = device_get_softc(dev); + union ccb *ccb = request->ccb; + int fatalerr = 0; + + ccb->ccb_h.status &= ~CAM_STATUS_MASK; + if (request->flags & ATA_R_TIMEOUT) { + xpt_freeze_simq(ch->sim, 1); + ccb->ccb_h.status &= ~CAM_STATUS_MASK; + ccb->ccb_h.status |= CAM_CMD_TIMEOUT | CAM_RELEASE_SIMQ; + fatalerr = 1; + } else if (request->status & ATA_S_ERROR) { + if (ccb->ccb_h.func_code == XPT_ATA_IO) { + ccb->ccb_h.status |= CAM_ATA_STATUS_ERROR; + } else { + ccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR; + ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; + } + } else if (request->result == ERESTART) + ccb->ccb_h.status |= CAM_REQUEUE_REQ; + else if (request->result != 0) + ccb->ccb_h.status |= CAM_REQ_CMP_ERR; + else + ccb->ccb_h.status |= CAM_REQ_CMP; + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP && + !(ccb->ccb_h.status & CAM_DEV_QFRZN)) { + xpt_freeze_devq(ccb->ccb_h.path, 1); + ccb->ccb_h.status |= CAM_DEV_QFRZN; + } + if (ccb->ccb_h.func_code == XPT_ATA_IO && + ((request->status & ATA_S_ERROR) || + (ccb->ataio.cmd.flags & CAM_ATAIO_NEEDRESULT))) { + struct ata_res *res = &ccb->ataio.res; + res->status = request->status; + res->error = request->error; + res->lba_low = request->u.ata.lba; + res->lba_mid = request->u.ata.lba >> 8; + res->lba_high = request->u.ata.lba >> 16; + res->device = request->u.ata.lba >> 24; + res->lba_low_exp = request->u.ata.lba >> 24; + res->lba_mid_exp = request->u.ata.lba >> 32; + res->lba_high_exp = request->u.ata.lba >> 40; + res->sector_count = request->u.ata.count; + res->sector_count_exp = request->u.ata.count >> 8; + } + ata_free_request(request); + xpt_done(ccb); + /* Do error recovery if needed. */ + if (fatalerr) + ata_reinit(dev); +} + +static void +ataaction(struct cam_sim *sim, union ccb *ccb) +{ + device_t dev; + struct ata_channel *ch; + + CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("ataaction func_code=%x\n", + ccb->ccb_h.func_code)); + + ch = (struct ata_channel *)cam_sim_softc(sim); + dev = ch->dev; + switch (ccb->ccb_h.func_code) { + /* Common cases first */ + case XPT_ATA_IO: /* Execute the requested I/O operation */ + case XPT_SCSI_IO: + if ((ch->devices & ((ATA_ATA_MASTER | ATA_ATAPI_MASTER) + << ccb->ccb_h.target_id)) == 0) { + ccb->ccb_h.status = CAM_SEL_TIMEOUT; + xpt_done(ccb); + break; + } + if (ch->running) + device_printf(dev, "already running!\n"); + if (ccb->ccb_h.func_code == XPT_ATA_IO && + (ccb->ataio.cmd.flags & CAM_ATAIO_CONTROL) && + (ccb->ataio.cmd.control & ATA_A_RESET)) { + struct ata_res *res = &ccb->ataio.res; + + bzero(res, sizeof(*res)); + if (ch->devices & (ATA_ATA_MASTER << ccb->ccb_h.target_id)) { + res->lba_high = 0; + res->lba_mid = 0; + } else { + res->lba_high = 0xeb; + res->lba_mid = 0x14; + } + ccb->ccb_h.status = CAM_REQ_CMP; + xpt_done(ccb); + break; + } + ata_cam_begin_transaction(dev, ccb); + break; + case XPT_EN_LUN: /* Enable LUN as a target */ + case XPT_TARGET_IO: /* Execute target I/O request */ + case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */ + case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/ + case XPT_ABORT: /* Abort the specified CCB */ + /* XXX Implement */ + ccb->ccb_h.status = CAM_REQ_INVALID; + xpt_done(ccb); + break; + case XPT_SET_TRAN_SETTINGS: + { + struct ccb_trans_settings *cts = &ccb->cts; + struct ata_cam_device *d; + + if (cts->type == CTS_TYPE_CURRENT_SETTINGS) + d = &ch->curr[ccb->ccb_h.target_id]; + else + d = &ch->user[ccb->ccb_h.target_id]; + if ((ch->flags & ATA_SATA) && (ch->flags & ATA_NO_SLAVE)) { + if (cts->xport_specific.sata.valid & CTS_SATA_VALID_REVISION) + d->revision = cts->xport_specific.sata.revision; + if (cts->xport_specific.ata.valid & CTS_SATA_VALID_MODE) { + if (cts->type == CTS_TYPE_CURRENT_SETTINGS) { + d->mode = ATA_SETMODE(ch->dev, + ccb->ccb_h.target_id, + cts->xport_specific.sata.mode); + } else + d->mode = cts->xport_specific.sata.mode; + } + if (cts->xport_specific.ata.valid & CTS_SATA_VALID_BYTECOUNT) + d->bytecount = min(8192, cts->xport_specific.sata.bytecount); + } else { + if (cts->xport_specific.ata.valid & CTS_ATA_VALID_MODE) { + if (cts->type == CTS_TYPE_CURRENT_SETTINGS) { + d->mode = ATA_SETMODE(ch->dev, + ccb->ccb_h.target_id, + cts->xport_specific.ata.mode); + } else + d->mode = cts->xport_specific.ata.mode; + } + if (cts->xport_specific.ata.valid & CTS_ATA_VALID_BYTECOUNT) + d->bytecount = cts->xport_specific.ata.bytecount; + if (ch->flags & ATA_SATA) + d->bytecount = min(8192, d->bytecount); + } + ccb->ccb_h.status = CAM_REQ_CMP; + xpt_done(ccb); + break; + } + case XPT_GET_TRAN_SETTINGS: + { + struct ccb_trans_settings *cts = &ccb->cts; + struct ata_cam_device *d; + + if (cts->type == CTS_TYPE_CURRENT_SETTINGS) + d = &ch->curr[ccb->ccb_h.target_id]; + else + d = &ch->user[ccb->ccb_h.target_id]; + cts->protocol = PROTO_ATA; + cts->protocol_version = PROTO_VERSION_UNSPECIFIED; + if ((ch->flags & ATA_SATA) && (ch->flags & ATA_NO_SLAVE)) { + cts->transport = XPORT_SATA; + cts->transport_version = XPORT_VERSION_UNSPECIFIED; + cts->xport_specific.sata.mode = d->mode; + cts->xport_specific.sata.valid |= CTS_SATA_VALID_MODE; + cts->xport_specific.sata.bytecount = d->bytecount; + cts->xport_specific.sata.valid |= CTS_SATA_VALID_BYTECOUNT; + if (cts->type == CTS_TYPE_CURRENT_SETTINGS) { + cts->xport_specific.sata.revision = + ATA_GETREV(dev, ccb->ccb_h.target_id); + } else + cts->xport_specific.sata.revision = d->revision; + cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION; + } else { + cts->transport = XPORT_ATA; + cts->transport_version = XPORT_VERSION_UNSPECIFIED; + cts->xport_specific.ata.mode = d->mode; + cts->xport_specific.ata.valid |= CTS_ATA_VALID_MODE; + cts->xport_specific.ata.bytecount = d->bytecount; + cts->xport_specific.ata.valid |= CTS_ATA_VALID_BYTECOUNT; + } + ccb->ccb_h.status = CAM_REQ_CMP; + xpt_done(ccb); + break; + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 12 12:08:14 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAFAF106566C for ; Sat, 12 Dec 2009 12:08:14 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id 963FC8FC18 for ; Sat, 12 Dec 2009 12:08:14 +0000 (UTC) Received: from compute2.internal (compute2.internal [10.202.2.42]) by gateway1.messagingengine.com (Postfix) with ESMTP id 1E11DC5915; Sat, 12 Dec 2009 06:52:57 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute2.internal (MEProxy); Sat, 12 Dec 2009 06:52:57 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:date:from:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; s=smtpout; bh=nB/Xdrb74IME5XV8ZeLD6JgIOcg=; b=cqJSffEwFynVTii2sn3z0py4CXOYM+M+K2t8NxQlCj9AerecIrjLQd9eA1ABChbsYZf6HqesjUUc6YqBhG5aaYCyJb9vH7wlG34oLRC4CiUWuak8NvjFADCUg4RqZeVi5mory4Rf/1UiC1O4SnLW7274bHeNC9N8wQphpcBcT9w= X-Sasl-enc: 2Hc8hmCfuMpbhh9NUFtuhjLDwIdX4adR9iH1gFv+LPj5 1260618776 Received: from empiric.lon.incunabulum.net (cpc2-dals7-0-0-cust253.hari.cable.virginmedia.com [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id 3372A4ACAB0; Sat, 12 Dec 2009 06:52:56 -0500 (EST) Message-ID: <4B238416.5070904@FreeBSD.org> Date: Sat, 12 Dec 2009 11:52:54 +0000 From: Bruce Simpson User-Agent: Thunderbird 2.0.0.23 (X11/20091203) MIME-Version: 1.0 To: Alexander Motin References: <200912121037.nBCAbVeh048839@svn.freebsd.org> In-Reply-To: <200912121037.nBCAbVeh048839@svn.freebsd.org> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r200432 - in stable/8: . contrib/top lib/libusb sbin/atacontrol sys/arm/mv sys/cam/ata sys/cam/scsi sys/conf sys/dev/ata sys/dev/ata/chipsets sys/powerpc/powermac sys/powerpc/psim tools... X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 12:08:14 -0000 Alexander Motin wrote: > Log: > MFC r200171, r200182, r200275, r200295, r200359: > Introduce ATA_CAM kernel option, turning ata(4) controller drivers into > cam(4) interface modules. When enabled, this option deprecates all ata(4) > peripheral drivers (ad, acd, ...) and interfaces and allows cam(4) drivers > (ada, cd, ...) and interfaces to be natively used instead. > Does this not mean there are now two AHCI drivers? i.e. ata(4) with ATA_CAM, and ahci(4). If so, which one is preferred? ahci(4) seems subjectively faster (I have not measured it), although it has a minor issue on my motherboard with ATI SB700 that it does not turn off the HDD activity led. I can see though that this could be difficult to roll out/deploy for default installations from universal media (-RELEASE disc1, memstick), different drivers yield different device names. In one embedded product build I've had to deal with, I use atapicam just to make sure the kernel expects to mount / from the same device, vs when it's booted from an attached USB CDROM drive. I'm using GEOM labels on my home systems to deal with this now, which was a little tricky to set up, but deals with the problem very nicely, as well as making it possible for me to swap disks between physical controllers. tunefs will return no error when the -L option is used when booted into single-user mode -- but if the fs is then mounted, the superblock change seems to be lost. In all other cases, rewriting the superblock is denied. Anyway thanks for all your hard work on this so far... cheers! BMS From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 12 12:31:11 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F7521065670; Sat, 12 Dec 2009 12:31:11 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DEAA8FC14; Sat, 12 Dec 2009 12:31:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBCCVBi3052594; Sat, 12 Dec 2009 12:31:11 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBCCVBEw052592; Sat, 12 Dec 2009 12:31:11 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <200912121231.nBCCVBEw052592@svn.freebsd.org> From: Antoine Brodin Date: Sat, 12 Dec 2009 12:31:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200433 - stable/8/sys/net80211 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 12:31:11 -0000 Author: antoine Date: Sat Dec 12 12:31:11 2009 New Revision: 200433 URL: http://svn.freebsd.org/changeset/base/200433 Log: MFC r199186 to stable/8: Fix off by one in ieee80211_send_action_register Found by: phk's FlexeLint in September Reviewed by: rpaulo@ Modified: stable/8/sys/net80211/ieee80211_action.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/net80211/ieee80211_action.c ============================================================================== --- stable/8/sys/net80211/ieee80211_action.c Sat Dec 12 10:37:31 2009 (r200432) +++ stable/8/sys/net80211/ieee80211_action.c Sat Dec 12 12:31:11 2009 (r200433) @@ -105,7 +105,7 @@ ieee80211_send_action_register(int cat, meshlm_send_action[act] = f; return 0; case IEEE80211_ACTION_CAT_MESHPATH: - if (act > N(hwmp_send_action)) + if (act >= N(hwmp_send_action)) break; hwmp_send_action[act] = f; return 0; From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 12 12:34:21 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32E041065670; Sat, 12 Dec 2009 12:34:21 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2165C8FC16; Sat, 12 Dec 2009 12:34:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBCCYLOc052717; Sat, 12 Dec 2009 12:34:21 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBCCYLxf052715; Sat, 12 Dec 2009 12:34:21 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <200912121234.nBCCYLxf052715@svn.freebsd.org> From: Antoine Brodin Date: Sat, 12 Dec 2009 12:34:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200434 - stable/8/sys/net80211 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 12:34:21 -0000 Author: antoine Date: Sat Dec 12 12:34:20 2009 New Revision: 200434 URL: http://svn.freebsd.org/changeset/base/200434 Log: MFC r199187 to stable/8: Remove trailing ";" in struct ieee80211_beacon_offsets declaration Found by: phk's FlexeLint in September Reviewed by: rpaulo@ Modified: stable/8/sys/net80211/ieee80211_proto.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/net80211/ieee80211_proto.h ============================================================================== --- stable/8/sys/net80211/ieee80211_proto.h Sat Dec 12 12:31:11 2009 (r200433) +++ stable/8/sys/net80211/ieee80211_proto.h Sat Dec 12 12:34:20 2009 (r200434) @@ -315,7 +315,7 @@ struct ieee80211_beacon_offsets { uint8_t *bo_ath; /* start of ATH parameters */ uint8_t *bo_appie; /* start of AppIE element */ uint16_t bo_appie_len; /* AppIE length in bytes */ - uint16_t bo_csa_trailer_len;; + uint16_t bo_csa_trailer_len; uint8_t *bo_csa; /* start of CSA element */ uint8_t *bo_meshconf; /* start of MESHCONF element */ uint8_t *bo_spare[3]; From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 12 12:36:42 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0AF57106566C; Sat, 12 Dec 2009 12:36:42 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED4178FC1C; Sat, 12 Dec 2009 12:36:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBCCafde052796; Sat, 12 Dec 2009 12:36:41 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBCCafcu052794; Sat, 12 Dec 2009 12:36:41 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <200912121236.nBCCafcu052794@svn.freebsd.org> From: Antoine Brodin Date: Sat, 12 Dec 2009 12:36:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200435 - stable/8/sys/boot/uboot/lib X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 12:36:42 -0000 Author: antoine Date: Sat Dec 12 12:36:41 2009 New Revision: 200435 URL: http://svn.freebsd.org/changeset/base/200435 Log: MFC r199193 to stable/8: - Remove trailing ";" after if statement - Remove #if 0 section that was never needed/used Reviewed by: raj@ Modified: stable/8/sys/boot/uboot/lib/glue.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/boot/uboot/lib/glue.c ============================================================================== --- stable/8/sys/boot/uboot/lib/glue.c Sat Dec 12 12:34:20 2009 (r200434) +++ stable/8/sys/boot/uboot/lib/glue.c Sat Dec 12 12:36:41 2009 (r200435) @@ -467,7 +467,7 @@ ub_stor_type(int type) if (type & DT_STOR_USB) return ("USB"); - if (type & DT_STOR_MMC); + if (type & DT_STOR_MMC) return ("MMC"); return ("Unknown"); @@ -581,11 +581,6 @@ ub_env_enum(const char *last) if (!env) /* no more env. variables to enumerate */ return (NULL); -#if 0 - if (last && strncmp(env, last, strlen(last)) == 0); - /* error, trying to enumerate non existing env. variable */ - return NULL; -#endif /* next enumerated env var */ memset(env_name, 0, 256); From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 12 12:54:29 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A724D1065670; Sat, 12 Dec 2009 12:54:29 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.156]) by mx1.freebsd.org (Postfix) with ESMTP id D88618FC14; Sat, 12 Dec 2009 12:54:28 +0000 (UTC) Received: by fg-out-1718.google.com with SMTP id 19so763367fgg.13 for ; Sat, 12 Dec 2009 04:54:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=cofd5VTDAnPHN9pih7qEuwQ5Okeu//y6FlWlT4t8dE4=; b=d6lU77lDKhmmjlI12zhootkp9yhT/e/NyKpjqTLwrqoOvMu1dy2tbYPrUvMCZnLt8q QwZP9zcd63gL3wKMe/gPK+zO0yT+0p39J/m0ycrxJDqvVNInqkAjJQTPGG3RQSlSfJEN isxo1y24ungAUBxGN9cu29qDzH0I1xMBlJT6A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=LrkvMBOBwmnMlgmEYygd246Y4PQ9DJGdgkjmruwfb2v5utW34Jf4r9bxponLhd6aGO abLTYNJYQRGqr+xRb7jcZ/fp3LnTPECmDETvi+WCetUII1C5j9jDIm0btCGBaMQkETtv f8p7qgyz/DBgBdvbPLjhSAk8v9DcgOyRgKBwY= Received: by 10.86.206.16 with SMTP id d16mr3223808fgg.5.1260620665174; Sat, 12 Dec 2009 04:24:25 -0800 (PST) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id 16sm965307fxm.8.2009.12.12.04.24.24 (version=SSLv3 cipher=RC4-MD5); Sat, 12 Dec 2009 04:24:24 -0800 (PST) Sender: Alexander Motin Message-ID: <4B238B76.70807@FreeBSD.org> Date: Sat, 12 Dec 2009 14:24:22 +0200 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20090901) MIME-Version: 1.0 To: Bruce Simpson References: <200912121037.nBCAbVeh048839@svn.freebsd.org> <4B238416.5070904@FreeBSD.org> In-Reply-To: <4B238416.5070904@FreeBSD.org> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r200432 - in stable/8: . contrib/top lib/libusb sbin/atacontrol sys/arm/mv sys/cam/ata sys/cam/scsi sys/conf sys/dev/ata sys/dev/ata/chipsets sys/powerpc/powermac sys/powerpc/psim tools... X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 12:54:29 -0000 Bruce Simpson wrote: > Alexander Motin wrote: >> Log: >> MFC r200171, r200182, r200275, r200295, r200359: >> Introduce ATA_CAM kernel option, turning ata(4) controller drivers into >> cam(4) interface modules. When enabled, this option deprecates all >> ata(4) >> peripheral drivers (ad, acd, ...) and interfaces and allows cam(4) >> drivers >> (ada, cd, ...) and interfaces to be natively used instead. >> > Does this not mean there are now two AHCI drivers? i.e. ata(4) with > ATA_CAM, and ahci(4). Yes, you are right: ataahci of ata(4) and ahci(4). Same is for atasiliconimage of ata(4) and siis(4). > If so, which one is preferred? ahci(4) definitely. If you load both, ahci(4) will win attachment. ataahci give you almost no benefits of AHCI. It is only needed for some time to support AHCI hardware in legacy mode, where it is the only alternative. It will be dropped after ATA to CAM migration complete. > ahci(4) seems subjectively faster (I have not measured it), As it should be. On some heavily parallel loads I have got almost double speedup, while speedup of 20-30% is quite usual. > although > it has a minor issue on my motherboard with ATI SB700 that it does not > turn off the HDD activity led. I haven't seen that on my board. Describe it more in private please. -- Alexander Motin From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 12 14:44:04 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E249D1065670; Sat, 12 Dec 2009 14:44:04 +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 CFD2B8FC12; Sat, 12 Dec 2009 14:44:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBCEi46d055610; Sat, 12 Dec 2009 14:44:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBCEi4cF055608; Sat, 12 Dec 2009 14:44:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912121444.nBCEi4cF055608@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 12 Dec 2009 14:44:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200438 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 14:44:05 -0000 Author: kib Date: Sat Dec 12 14:44:04 2009 New Revision: 200438 URL: http://svn.freebsd.org/changeset/base/200438 Log: MFC r200162: Change VOP_FSYNC for zfs vnode from VOP_PANIC to zfs_freebsd_fsync(). Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Dec 12 13:24:06 2009 (r200437) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Dec 12 14:44:04 2009 (r200438) @@ -4983,7 +4983,7 @@ struct vop_vector zfs_vnodeops = { struct vop_vector zfs_fifoops = { .vop_default = &fifo_specops, - .vop_fsync = VOP_PANIC, + .vop_fsync = zfs_freebsd_fsync, .vop_access = zfs_freebsd_access, .vop_getattr = zfs_freebsd_getattr, .vop_inactive = zfs_freebsd_inactive, From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 12 20:06:25 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4BAB1065672; Sat, 12 Dec 2009 20:06:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF9178FC33; Sat, 12 Dec 2009 20:06:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBCK6PJP062093; Sat, 12 Dec 2009 20:06:25 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBCK6PHv062071; Sat, 12 Dec 2009 20:06:25 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912122006.nBCK6PHv062071@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 12 Dec 2009 20:06:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200443 - in stable/8/sys: amd64/amd64 arm/arm i386/i386 ia64/ia64 mips/include mips/mips powerpc/aim powerpc/booke sparc64/include sparc64/sparc64 sun4v/sun4v sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 20:06:26 -0000 Author: kib Date: Sat Dec 12 20:06:25 2009 New Revision: 200443 URL: http://svn.freebsd.org/changeset/base/200443 Log: MFC r199135: Extract the code that records syscall results in the frame into MD function cpu_set_syscall_retval(). Modified: stable/8/sys/amd64/amd64/trap.c stable/8/sys/amd64/amd64/vm_machdep.c stable/8/sys/arm/arm/trap.c stable/8/sys/arm/arm/vm_machdep.c stable/8/sys/i386/i386/trap.c stable/8/sys/i386/i386/vm_machdep.c stable/8/sys/ia64/ia64/trap.c stable/8/sys/ia64/ia64/vm_machdep.c stable/8/sys/mips/include/pcb.h stable/8/sys/mips/mips/trap.c stable/8/sys/mips/mips/vm_machdep.c stable/8/sys/powerpc/aim/trap.c stable/8/sys/powerpc/aim/vm_machdep.c stable/8/sys/powerpc/booke/trap.c stable/8/sys/powerpc/booke/vm_machdep.c stable/8/sys/sparc64/include/pcb.h stable/8/sys/sparc64/sparc64/trap.c stable/8/sys/sparc64/sparc64/vm_machdep.c stable/8/sys/sun4v/sun4v/trap.c stable/8/sys/sun4v/sun4v/vm_machdep.c stable/8/sys/sys/proc.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/amd64/trap.c ============================================================================== --- stable/8/sys/amd64/amd64/trap.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/amd64/amd64/trap.c Sat Dec 12 20:06:25 2009 (r200443) @@ -1004,39 +1004,7 @@ syscall(struct trapframe *frame) #endif } - switch (error) { - case 0: - frame->tf_rax = td->td_retval[0]; - frame->tf_rdx = td->td_retval[1]; - frame->tf_rflags &= ~PSL_C; - break; - - case ERESTART: - /* - * Reconstruct pc, we know that 'syscall' is 2 bytes. - * We have to do a full context restore so that %r10 - * (which was holding the value of %rcx) is restored for - * the next iteration. - */ - frame->tf_rip -= frame->tf_err; - frame->tf_r10 = frame->tf_rcx; - td->td_pcb->pcb_flags |= PCB_FULLCTX; - break; - - case EJUSTRETURN: - break; - - default: - if (p->p_sysent->sv_errsize) { - if (error >= p->p_sysent->sv_errsize) - error = -1; /* XXX */ - else - error = p->p_sysent->sv_errtbl[error]; - } - frame->tf_rax = error; - frame->tf_rflags |= PSL_C; - break; - } + cpu_set_syscall_retval(td, error); /* * Traced syscall. Modified: stable/8/sys/amd64/amd64/vm_machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/vm_machdep.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/amd64/amd64/vm_machdep.c Sat Dec 12 20:06:25 2009 (r200443) @@ -317,6 +317,45 @@ cpu_thread_free(struct thread *td) cpu_thread_clean(td); } +void +cpu_set_syscall_retval(struct thread *td, int error) +{ + + switch (error) { + case 0: + td->td_frame->tf_rax = td->td_retval[0]; + td->td_frame->tf_rdx = td->td_retval[1]; + td->td_frame->tf_rflags &= ~PSL_C; + break; + + case ERESTART: + /* + * Reconstruct pc, we know that 'syscall' is 2 bytes. + * We have to do a full context restore so that %r10 + * (which was holding the value of %rcx) is restored + * for the next iteration. + */ + td->td_frame->tf_rip -= td->td_frame->tf_err; + td->td_frame->tf_r10 = td->td_frame->tf_rcx; + td->td_pcb->pcb_flags |= PCB_FULLCTX; + break; + + case EJUSTRETURN: + break; + + default: + if (td->td_proc->p_sysent->sv_errsize) { + if (error >= td->td_proc->p_sysent->sv_errsize) + error = -1; /* XXX */ + else + error = td->td_proc->p_sysent->sv_errtbl[error]; + } + td->td_frame->tf_rax = error; + td->td_frame->tf_rflags |= PSL_C; + break; + } +} + /* * Initialize machine state (pcb and trap frame) for a new thread about to * upcall. Put enough state in the new thread's PCB to get it to go back Modified: stable/8/sys/arm/arm/trap.c ============================================================================== --- stable/8/sys/arm/arm/trap.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/arm/arm/trap.c Sat Dec 12 20:06:25 2009 (r200443) @@ -932,43 +932,8 @@ syscall(struct thread *td, trapframe_t * KASSERT(td->td_ar == NULL, ("returning from syscall with td_ar set!")); } - switch (error) { - case 0: -#ifdef __ARMEB__ - if ((insn & 0x000fffff) == SYS___syscall && - code != SYS_freebsd6_lseek && code != SYS_lseek) { - /* - * 64-bit return, 32-bit syscall. Fixup byte order - */ - frame->tf_r0 = 0; - frame->tf_r1 = td->td_retval[0]; - } else { - frame->tf_r0 = td->td_retval[0]; - frame->tf_r1 = td->td_retval[1]; - } -#else - frame->tf_r0 = td->td_retval[0]; - frame->tf_r1 = td->td_retval[1]; -#endif - - frame->tf_spsr &= ~PSR_C_bit; /* carry bit */ - break; - - case ERESTART: - /* - * Reconstruct the pc to point at the swi. - */ - frame->tf_pc -= INSN_SIZE; - break; - case EJUSTRETURN: - /* nothing to do */ - break; - default: bad: - frame->tf_r0 = error; - frame->tf_spsr |= PSR_C_bit; /* carry bit */ - break; - } + cpu_set_syscall_retval(td, error); WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning", (code >= 0 && code < SYS_MAXSYSCALL) ? syscallnames[code] : "???"); Modified: stable/8/sys/arm/arm/vm_machdep.c ============================================================================== --- stable/8/sys/arm/arm/vm_machdep.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/arm/arm/vm_machdep.c Sat Dec 12 20:06:25 2009 (r200443) @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -261,6 +263,57 @@ done: #endif } +void +cpu_set_syscall_retval(struct thread *td, int error) +{ + trapframe_t *frame; + int fixup; +#ifdef __ARMEB__ + uint32_t insn; +#endif + + frame = td->td_frame; + fixup = 0; + +#ifdef __ARMEB__ + insn = *(u_int32_t *)(frame->tf_pc - INSN_SIZE); + if ((insn & 0x000fffff) == SYS___syscall) { + register_t *ap = &frame->tf_r0; + register_t code = ap[_QUAD_LOWWORD]; + if (td->td_proc->p_sysent->sv_mask) + code &= td->td_proc->p_sysent->sv_mask; + fixup = (code != SYS_freebsd6_lseek && code != SYS_lseek) + ? 1 : 0; + } +#endif + + switch (error) { + case 0: + if (fixup) { + frame->tf_r0 = 0; + frame->tf_r1 = td->td_retval[0]; + } else { + frame->tf_r0 = td->td_retval[0]; + frame->tf_r1 = td->td_retval[1]; + } + frame->tf_spsr &= ~PSR_C_bit; /* carry bit */ + break; + case ERESTART: + /* + * Reconstruct the pc to point at the swi. + */ + frame->tf_pc -= INSN_SIZE; + break; + case EJUSTRETURN: + /* nothing to do */ + break; + default: + frame->tf_r0 = error; + frame->tf_spsr |= PSR_C_bit; /* carry bit */ + break; + } +} + /* * Initialize machine state (pcb and trap frame) for a new thread about to * upcall. Put enough state in the new thread's PCB to get it to go back Modified: stable/8/sys/i386/i386/trap.c ============================================================================== --- stable/8/sys/i386/i386/trap.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/i386/i386/trap.c Sat Dec 12 20:06:25 2009 (r200443) @@ -1093,35 +1093,7 @@ syscall(struct trapframe *frame) #endif } - switch (error) { - case 0: - frame->tf_eax = td->td_retval[0]; - frame->tf_edx = td->td_retval[1]; - frame->tf_eflags &= ~PSL_C; - break; - - case ERESTART: - /* - * Reconstruct pc, assuming lcall $X,y is 7 bytes, - * int 0x80 is 2 bytes. We saved this in tf_err. - */ - frame->tf_eip -= frame->tf_err; - break; - - case EJUSTRETURN: - break; - - default: - if (p->p_sysent->sv_errsize) { - if (error >= p->p_sysent->sv_errsize) - error = -1; /* XXX */ - else - error = p->p_sysent->sv_errtbl[error]; - } - frame->tf_eax = error; - frame->tf_eflags |= PSL_C; - break; - } + cpu_set_syscall_retval(td, error); /* * Traced syscall. Modified: stable/8/sys/i386/i386/vm_machdep.c ============================================================================== --- stable/8/sys/i386/i386/vm_machdep.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/i386/i386/vm_machdep.c Sat Dec 12 20:06:25 2009 (r200443) @@ -381,6 +381,41 @@ cpu_thread_free(struct thread *td) cpu_thread_clean(td); } +void +cpu_set_syscall_retval(struct thread *td, int error) +{ + + switch (error) { + case 0: + td->td_frame->tf_eax = td->td_retval[0]; + td->td_frame->tf_edx = td->td_retval[1]; + td->td_frame->tf_eflags &= ~PSL_C; + break; + + case ERESTART: + /* + * Reconstruct pc, assuming lcall $X,y is 7 bytes, int + * 0x80 is 2 bytes. We saved this in tf_err. + */ + td->td_frame->tf_eip -= td->td_frame->tf_err; + break; + + case EJUSTRETURN: + break; + + default: + if (td->td_proc->p_sysent->sv_errsize) { + if (error >= td->td_proc->p_sysent->sv_errsize) + error = -1; /* XXX */ + else + error = td->td_proc->p_sysent->sv_errtbl[error]; + } + td->td_frame->tf_eax = error; + td->td_frame->tf_eflags |= PSL_C; + break; + } +} + /* * Initialize machine state (pcb and trap frame) for a new thread about to * upcall. Put enough state in the new thread's PCB to get it to go back Modified: stable/8/sys/ia64/ia64/trap.c ============================================================================== --- stable/8/sys/ia64/ia64/trap.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/ia64/ia64/trap.c Sat Dec 12 20:06:25 2009 (r200443) @@ -976,26 +976,7 @@ syscall(struct trapframe *tf) error = (*callp->sy_call)(td, args); AUDIT_SYSCALL_EXIT(error, td); - if (error != EJUSTRETURN) { - /* - * Save the "raw" error code in r10. We use this to handle - * syscall restarts (see do_ast()). - */ - tf->tf_scratch.gr10 = error; - if (error == 0) { - tf->tf_scratch.gr8 = td->td_retval[0]; - tf->tf_scratch.gr9 = td->td_retval[1]; - } else if (error != ERESTART) { - if (error < p->p_sysent->sv_errsize) - error = p->p_sysent->sv_errtbl[error]; - /* - * Translated error codes are returned in r8. User - * processes use the translated error code. - */ - tf->tf_scratch.gr8 = error; - } - } - + cpu_set_syscall_retval(td, error); td->td_syscalls++; /* Modified: stable/8/sys/ia64/ia64/vm_machdep.c ============================================================================== --- stable/8/sys/ia64/ia64/vm_machdep.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/ia64/ia64/vm_machdep.c Sat Dec 12 20:06:25 2009 (r200443) @@ -73,6 +73,7 @@ #include #include #include +#include #include #include #include @@ -140,6 +141,36 @@ cpu_thread_swapout(struct thread *td) } void +cpu_set_syscall_retval(struct thread *td, int error) +{ + struct proc *p; + struct trapframe *tf; + + if (error == EJUSTRETURN) + return; + + tf = td->td_frame; + + /* + * Save the "raw" error code in r10. We use this to handle + * syscall restarts (see do_ast()). + */ + tf->tf_scratch.gr10 = error; + if (error == 0) { + tf->tf_scratch.gr8 = td->td_retval[0]; + tf->tf_scratch.gr9 = td->td_retval[1]; + } else if (error != ERESTART) { + p = td->td_proc; + if (error < p->p_sysent->sv_errsize) + error = p->p_sysent->sv_errtbl[error]; + /* + * Translated error codes are returned in r8. User + */ + tf->tf_scratch.gr8 = error; + } +} + +void cpu_set_upcall(struct thread *td, struct thread *td0) { struct pcb *pcb; Modified: stable/8/sys/mips/include/pcb.h ============================================================================== --- stable/8/sys/mips/include/pcb.h Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/mips/include/pcb.h Sat Dec 12 20:06:25 2009 (r200443) @@ -52,6 +52,7 @@ struct pcb struct trapframe pcb_regs; /* saved CPU and registers */ label_t pcb_context; /* kernel context for resume */ int pcb_onfault; /* for copyin/copyout faults */ + register_t pcb_tpc; }; /* these match the regnum's in regnum.h Modified: stable/8/sys/mips/mips/trap.c ============================================================================== --- stable/8/sys/mips/mips/trap.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/mips/mips/trap.c Sat Dec 12 20:06:25 2009 (r200443) @@ -644,7 +644,6 @@ dofault: struct trapframe *locr0 = td->td_frame; struct sysent *callp; unsigned int code; - unsigned int tpc; int nargs, nsaved; register_t args[8]; @@ -660,7 +659,7 @@ dofault: thread_user_enter(td); #endif /* compute next PC after syscall instruction */ - tpc = trapframe->pc; /* Remember if restart */ + td->td_pcb->pcb_tpc = trapframe->pc; /* Remember if restart */ if (DELAYBRANCH(trapframe->cause)) { /* Check BD bit */ locr0->pc = MipsEmulateBranch(locr0, trapframe->pc, 0, 0); @@ -761,44 +760,7 @@ dofault: locr0 = td->td_frame; #endif trapdebug_enter(locr0, -code); - switch (i) { - case 0: - if (quad_syscall && code != SYS_lseek) { - /* - * System call invoked through the - * SYS___syscall interface but the - * return value is really just 32 - * bits. - */ - locr0->v0 = td->td_retval[0]; - if (_QUAD_LOWWORD) - locr0->v1 = td->td_retval[0]; - locr0->a3 = 0; - } else { - locr0->v0 = td->td_retval[0]; - locr0->v1 = td->td_retval[1]; - locr0->a3 = 0; - } - break; - - case ERESTART: - locr0->pc = tpc; - break; - - case EJUSTRETURN: - break; /* nothing to do */ - - default: - if (quad_syscall && code != SYS_lseek) { - locr0->v0 = i; - if (_QUAD_LOWWORD) - locr0->v1 = i; - locr0->a3 = 1; - } else { - locr0->v0 = i; - locr0->a3 = 1; - } - } + cpu_set_syscall_retval(td, i); /* * The sync'ing of I & D caches for SYS_ptrace() is Modified: stable/8/sys/mips/mips/vm_machdep.c ============================================================================== --- stable/8/sys/mips/mips/vm_machdep.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/mips/mips/vm_machdep.c Sat Dec 12 20:06:25 2009 (r200443) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -256,6 +257,62 @@ cpu_thread_alloc(struct thread *td) } } +void +cpu_set_syscall_retval(struct thread *td, int error) +{ + struct trapframe *locr0 = td->td_frame; + unsigned int code; + int quad_syscall; + + code = locr0->v0; + quad_syscall = 0; + if (code == SYS_syscall) + code = locr0->a0; + else if (code == SYS___syscall) { + code = _QUAD_LOWWORD ? locr0->a1 : locr0->a0; + quad_syscall = 1; + } + + switch (error) { + case 0: + if (quad_syscall && code != SYS_lseek) { + /* + * System call invoked through the + * SYS___syscall interface but the + * return value is really just 32 + * bits. + */ + locr0->v0 = td->td_retval[0]; + if (_QUAD_LOWWORD) + locr0->v1 = td->td_retval[0]; + locr0->a3 = 0; + } else { + locr0->v0 = td->td_retval[0]; + locr0->v1 = td->td_retval[1]; + locr0->a3 = 0; + } + break; + + case ERESTART: + locr0->pc = td->td_pcb->pcb_tpc; + break; + + case EJUSTRETURN: + break; /* nothing to do */ + + default: + if (quad_syscall && code != SYS_lseek) { + locr0->v0 = error; + if (_QUAD_LOWWORD) + locr0->v1 = error; + locr0->a3 = 1; + } else { + locr0->v0 = error; + locr0->a3 = 1; + } + } +} + /* * Initialize machine state (pcb and trap frame) for a new thread about to * upcall. Put enough state in the new thread's PCB to get it to go back Modified: stable/8/sys/powerpc/aim/trap.c ============================================================================== --- stable/8/sys/powerpc/aim/trap.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/powerpc/aim/trap.c Sat Dec 12 20:06:25 2009 (r200443) @@ -417,43 +417,8 @@ syscall(struct trapframe *frame) CTR3(KTR_SYSC, "syscall: p=%s %s ret=%x", td->td_name, syscallnames[code], td->td_retval[0]); } - switch (error) { - case 0: - if (frame->fixreg[0] == SYS___syscall && - code != SYS_freebsd6_lseek && code != SYS_lseek) { - /* - * 64-bit return, 32-bit syscall. Fixup byte order - */ - frame->fixreg[FIRSTARG] = 0; - frame->fixreg[FIRSTARG + 1] = td->td_retval[0]; - } else { - frame->fixreg[FIRSTARG] = td->td_retval[0]; - frame->fixreg[FIRSTARG + 1] = td->td_retval[1]; - } - /* XXX: Magic number */ - frame->cr &= ~0x10000000; - break; - case ERESTART: - /* - * Set user's pc back to redo the system call. - */ - frame->srr0 -= 4; - break; - case EJUSTRETURN: - /* nothing to do */ - break; - default: - if (p->p_sysent->sv_errsize) { - if (error >= p->p_sysent->sv_errsize) - error = -1; /* XXX */ - else - error = p->p_sysent->sv_errtbl[error]; - } - frame->fixreg[FIRSTARG] = error; - /* XXX: Magic number: Carry Flag Equivalent? */ - frame->cr |= 0x10000000; - break; - } + + cpu_set_syscall_retval(td, error); /* * Check for misbehavior. Modified: stable/8/sys/powerpc/aim/vm_machdep.c ============================================================================== --- stable/8/sys/powerpc/aim/vm_machdep.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/powerpc/aim/vm_machdep.c Sat Dec 12 20:06:25 2009 (r200443) @@ -81,7 +81,9 @@ #include #include #include +#include #include +#include #include #include @@ -422,6 +424,59 @@ cpu_thread_swapout(struct thread *td) } void +cpu_set_syscall_retval(struct thread *td, int error) +{ + struct proc *p; + struct trapframe *tf; + int fixup; + + if (error == EJUSTRETURN) + return; + + p = td->td_proc; + tf = td->td_frame; + + if (tf->fixreg[0] == SYS___syscall) { + int code = tf->fixreg[FIRSTARG + 1]; + if (p->p_sysent->sv_mask) + code &= p->p_sysent->sv_mask; + fixup = (code != SYS_freebsd6_lseek && code != SYS_lseek) ? + 1 : 0; + } else + fixup = 0; + + switch (error) { + case 0: + if (fixup) { + /* + * 64-bit return, 32-bit syscall. Fixup byte order + */ + tf->fixreg[FIRSTARG] = 0; + tf->fixreg[FIRSTARG + 1] = td->td_retval[0]; + } else { + tf->fixreg[FIRSTARG] = td->td_retval[0]; + tf->fixreg[FIRSTARG + 1] = td->td_retval[1]; + } + tf->cr &= ~0x10000000; /* XXX: Magic number */ + break; + case ERESTART: + /* + * Set user's pc back to redo the system call. + */ + tf->srr0 -= 4; + break; + default: + if (p->p_sysent->sv_errsize) { + error = (error < p->p_sysent->sv_errsize) ? + p->p_sysent->sv_errtbl[error] : -1; + } + tf->fixreg[FIRSTARG] = error; + tf->cr |= 0x10000000; /* XXX: Magic number */ + break; + } +} + +void cpu_set_upcall(struct thread *td, struct thread *td0) { struct pcb *pcb2; Modified: stable/8/sys/powerpc/booke/trap.c ============================================================================== --- stable/8/sys/powerpc/booke/trap.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/powerpc/booke/trap.c Sat Dec 12 20:06:25 2009 (r200443) @@ -417,42 +417,7 @@ syscall(struct trapframe *frame) syscallnames[code], td->td_retval[0]); } - switch (error) { - case 0: - if (frame->fixreg[0] == SYS___syscall && SYS_lseek) { - /* - * 64-bit return, 32-bit syscall. Fixup byte order - */ - frame->fixreg[FIRSTARG] = 0; - frame->fixreg[FIRSTARG + 1] = td->td_retval[0]; - } else { - frame->fixreg[FIRSTARG] = td->td_retval[0]; - frame->fixreg[FIRSTARG + 1] = td->td_retval[1]; - } - /* XXX: Magic number */ - frame->cr &= ~0x10000000; - break; - case ERESTART: - /* - * Set user's pc back to redo the system call. - */ - frame->srr0 -= 4; - break; - case EJUSTRETURN: - /* nothing to do */ - break; - default: - if (p->p_sysent->sv_errsize) { - if (error >= p->p_sysent->sv_errsize) - error = -1; /* XXX */ - else - error = p->p_sysent->sv_errtbl[error]; - } - frame->fixreg[FIRSTARG] = error; - /* XXX: Magic number: Carry Flag Equivalent? */ - frame->cr |= 0x10000000; - break; - } + cpu_set_syscall_retval(td, error); /* * Check for misbehavior. Modified: stable/8/sys/powerpc/booke/vm_machdep.c ============================================================================== --- stable/8/sys/powerpc/booke/vm_machdep.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/powerpc/booke/vm_machdep.c Sat Dec 12 20:06:25 2009 (r200443) @@ -113,7 +113,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -423,6 +425,59 @@ cpu_thread_swapout(struct thread *td) } void +cpu_set_syscall_retval(struct thread *td, int error) +{ + struct proc *p; + struct trapframe *tf; + int fixup; + + p = td->td_proc; + tf = td->td_frame; + + if (tf->fixreg[0] == SYS___syscall) { + int code = tf->fixreg[FIRSTARG + 1]; + if (p->p_sysent->sv_mask) + code &= p->p_sysent->sv_mask; + fixup = (code != SYS_freebsd6_lseek && code != SYS_lseek) ? + 1 : 0; + } else + fixup = 0; + + switch (error) { + case 0: + if (fixup) { + /* + * 64-bit return, 32-bit syscall. Fixup byte order + */ + tf->fixreg[FIRSTARG] = 0; + tf->fixreg[FIRSTARG + 1] = td->td_retval[0]; + } else { + tf->fixreg[FIRSTARG] = td->td_retval[0]; + tf->fixreg[FIRSTARG + 1] = td->td_retval[1]; + } + tf->cr &= ~0x10000000; /* XXX: Magic number */ + break; + case ERESTART: + /* + * Set user's pc back to redo the system call. + */ + tf->srr0 -= 4; + break; + case EJUSTRETURN: + /* nothing to do */ + break; + default: + if (p->p_sysent->sv_errsize) { + error = (error < p->p_sysent->sv_errsize) ? + p->p_sysent->sv_errtbl[error] : -1; + } + tf->fixreg[FIRSTARG] = error; + tf->cr |= 0x10000000; /* XXX: Magic number */ + break; + } +} + +void cpu_set_upcall(struct thread *td, struct thread *td0) { struct pcb *pcb2; Modified: stable/8/sys/sparc64/include/pcb.h ============================================================================== --- stable/8/sys/sparc64/include/pcb.h Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/sparc64/include/pcb.h Sat Dec 12 20:06:25 2009 (r200443) @@ -49,7 +49,8 @@ struct pcb { uint64_t pcb_nsaved; uint64_t pcb_pc; uint64_t pcb_sp; - uint64_t pcb_pad[4]; + uint64_t pcb_tpc; + uint64_t pcb_pad[3]; } __aligned(64); #ifdef _KERNEL Modified: stable/8/sys/sparc64/sparc64/trap.c ============================================================================== --- stable/8/sys/sparc64/sparc64/trap.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/sparc64/sparc64/trap.c Sat Dec 12 20:06:25 2009 (r200443) @@ -538,7 +538,6 @@ syscall(struct trapframe *tf) register_t *argp; struct proc *p; u_long code; - u_long tpc; int reg; int regcnt; int narg; @@ -562,7 +561,7 @@ syscall(struct trapframe *tf) * For syscalls, we don't want to retry the faulting instruction * (usually), instead we need to advance one instruction. */ - tpc = tf->tf_tpc; + td->td_pcb->pcb_tpc = tf->tf_tpc; TF_DONE(tf); reg = 0; @@ -626,39 +625,7 @@ syscall(struct trapframe *tf) td->td_retval[1]); } - /* - * MP SAFE (we may or may not have the MP lock at this point) - */ - switch (error) { - case 0: - tf->tf_out[0] = td->td_retval[0]; - tf->tf_out[1] = td->td_retval[1]; - tf->tf_tstate &= ~TSTATE_XCC_C; - break; - - case ERESTART: - /* - * Undo the tpc advancement we have done above, we want to - * reexecute the system call. - */ - tf->tf_tpc = tpc; - tf->tf_tnpc -= 4; - break; - - case EJUSTRETURN: - break; - - default: - if (p->p_sysent->sv_errsize) { - if (error >= p->p_sysent->sv_errsize) - error = -1; /* XXX */ - else - error = p->p_sysent->sv_errtbl[error]; - } - tf->tf_out[0] = error; - tf->tf_tstate |= TSTATE_XCC_C; - break; - } + cpu_set_syscall_retval(td, error); /* * Check for misbehavior. Modified: stable/8/sys/sparc64/sparc64/vm_machdep.c ============================================================================== --- stable/8/sys/sparc64/sparc64/vm_machdep.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/sparc64/sparc64/vm_machdep.c Sat Dec 12 20:06:25 2009 (r200443) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -166,6 +167,42 @@ cpu_thread_swapout(struct thread *td) } void +cpu_set_syscall_retval(struct thread *td, int error) +{ + + switch (error) { + case 0: + td->td_frame->tf_out[0] = td->td_retval[0]; + td->td_frame->tf_out[1] = td->td_retval[1]; + td->td_frame->tf_tstate &= ~TSTATE_XCC_C; + break; + + case ERESTART: + /* + * Undo the tpc advancement we have done on syscall + * enter, we want to reexecute the system call. + */ + td->td_frame->tf_tpc = td->td_pcb->pcb_tpc; + td->td_frame->tf_tnpc -= 4; + break; + + case EJUSTRETURN: + break; + + default: + if (td->td_proc->p_sysent->sv_errsize) { + if (error >= td->td_proc->p_sysent->sv_errsize) + error = -1; /* XXX */ + else + error = td->td_proc->p_sysent->sv_errtbl[error]; + } + td->td_frame->tf_out[0] = error; + td->td_frame->tf_tstate |= TSTATE_XCC_C; + break; + } +} + +void cpu_set_upcall(struct thread *td, struct thread *td0) { struct trapframe *tf; Modified: stable/8/sys/sun4v/sun4v/trap.c ============================================================================== --- stable/8/sys/sun4v/sun4v/trap.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/sun4v/sun4v/trap.c Sat Dec 12 20:06:25 2009 (r200443) @@ -81,6 +81,7 @@ #include #include #include +#include #include #include #include @@ -582,7 +583,6 @@ syscall(struct trapframe *tf) register_t *argp; struct proc *p; u_long code; - u_long tpc; int reg; int regcnt; int narg; @@ -606,7 +606,7 @@ syscall(struct trapframe *tf) * For syscalls, we don't want to retry the faulting instruction * (usually), instead we need to advance one instruction. */ - tpc = tf->tf_tpc; + td->td_pcb->pcb_tpc = tf->tf_tpc; TF_DONE(tf); reg = 0; @@ -673,40 +673,8 @@ syscall(struct trapframe *tf) error, syscallnames[code], td->td_retval[0], td->td_retval[1]); } - - /* - * MP SAFE (we may or may not have the MP lock at this point) - */ - switch (error) { - case 0: - tf->tf_out[0] = td->td_retval[0]; - tf->tf_out[1] = td->td_retval[1]; - tf->tf_tstate &= ~TSTATE_XCC_C; - break; - case ERESTART: - /* - * Undo the tpc advancement we have done above, we want to - * reexecute the system call. - */ - tf->tf_tpc = tpc; - tf->tf_tnpc -= 4; - break; - - case EJUSTRETURN: - break; - - default: - if (p->p_sysent->sv_errsize) { - if (error >= p->p_sysent->sv_errsize) - error = -1; /* XXX */ - else - error = p->p_sysent->sv_errtbl[error]; - } - tf->tf_out[0] = error; - tf->tf_tstate |= TSTATE_XCC_C; - break; - } + cpu_set_syscall_retval(td, error); /* * Handle reschedule and other end-of-syscall issues Modified: stable/8/sys/sun4v/sun4v/vm_machdep.c ============================================================================== --- stable/8/sys/sun4v/sun4v/vm_machdep.c Sat Dec 12 18:18:46 2009 (r200442) +++ stable/8/sys/sun4v/sun4v/vm_machdep.c Sat Dec 12 20:06:25 2009 (r200443) @@ -57,6 +57,7 @@ #include #include #include +#include #include #include @@ -142,6 +143,42 @@ cpu_thread_swapout(struct thread *td) } void +cpu_set_syscall_retval(struct thread *td, int error) +{ + + switch (error) { + case 0: + td->td_frame->tf_out[0] = td->td_retval[0]; + td->td_frame->tf_out[1] = td->td_retval[1]; + td->td_frame->tf_tstate &= ~TSTATE_XCC_C; + break; + + case ERESTART: + /* + * Undo the tpc advancement we have done on syscall + * enter, we want to reexecute the system call. + */ + td->td_frame->tf_tpc = td->td_pcb->pcb_tpc; + td->td_frame->tf_tnpc -= 4; + break; + + case EJUSTRETURN: + break; + + default: + if (td->td_proc->p_sysent->sv_errsize) { + if (error >= td->td_proc->p_sysent->sv_errsize) + error = -1; /* XXX */ + else + error = td->td_proc->p_sysent->sv_errtbl[error]; + } + td->td_frame->tf_out[0] = error; + td->td_frame->tf_tstate |= TSTATE_XCC_C; + break; + } +} + +void cpu_set_upcall(struct thread *td, struct thread *td0) { struct trapframe *tf; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 12 20:24:13 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14A791065692; Sat, 12 Dec 2009 20:24:13 +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 02C2E8FC0A; Sat, 12 Dec 2009 20:24:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBCKOCRE062538; Sat, 12 Dec 2009 20:24:12 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBCKOCsh062536; Sat, 12 Dec 2009 20:24:12 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200912122024.nBCKOCsh062536@svn.freebsd.org> From: Marius Strobl Date: Sat, 12 Dec 2009 20:24:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200445 - stable/8/sys/sparc64/sparc64 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 20:24:13 -0000 Author: marius Date: Sat Dec 12 20:24:12 2009 New Revision: 200445 URL: http://svn.freebsd.org/changeset/base/200445 Log: MFC: r200215 Add missed in r199135 (MFC'ed in r200443). Modified: stable/8/sys/sparc64/sparc64/trap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/sparc64/sparc64/trap.c ============================================================================== --- stable/8/sys/sparc64/sparc64/trap.c Sat Dec 12 20:11:31 2009 (r200444) +++ stable/8/sys/sparc64/sparc64/trap.c Sat Dec 12 20:24:12 2009 (r200445) @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-svn-src-stable-8@FreeBSD.ORG Sat Dec 12 20:26:11 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B382106568F; Sat, 12 Dec 2009 20:26:11 +0000 (UTC) (envelope-from syrinx@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 793EB8FC16; Sat, 12 Dec 2009 20:26:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBCKQBOO062617; Sat, 12 Dec 2009 20:26:11 GMT (envelope-from syrinx@svn.freebsd.org) Received: (from syrinx@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBCKQBcm062615; Sat, 12 Dec 2009 20:26:11 GMT (envelope-from syrinx@svn.freebsd.org) Message-Id: <200912122026.nBCKQBcm062615@svn.freebsd.org> From: Shteryana Shopova Date: Sat, 12 Dec 2009 20:26:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200446 - stable/8/usr.sbin/bsnmpd/modules/snmp_pf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 20:26:11 -0000 Author: syrinx Date: Sat Dec 12 20:26:11 2009 New Revision: 200446 URL: http://svn.freebsd.org/changeset/base/200446 Log: MFC r200122 Make sure enough memory is allocated for a struct pft_entry when refreshing the list of pf tables. Modified: stable/8/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c Directory Properties: stable/8/usr.sbin/bsnmpd/ (props changed) Modified: stable/8/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c ============================================================================== --- stable/8/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c Sat Dec 12 20:24:12 2009 (r200445) +++ stable/8/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c Sat Dec 12 20:26:11 2009 (r200446) @@ -1104,7 +1104,7 @@ pft_refresh(void) } for (i = 0; i < numtbls; i++) { - e = malloc(sizeof(struct pfr_tstats)); + e = malloc(sizeof(struct pft_entry)); if (e == NULL) goto err1; e->index = i + 1;