From owner-svn-src-stable-7@FreeBSD.ORG Sun Dec 20 01:00:41 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD9CC106566C; Sun, 20 Dec 2009 01:00:41 +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 CAFBA8FC0A; Sun, 20 Dec 2009 01:00: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 nBK10fNr048263; Sun, 20 Dec 2009 01:00:41 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBK10fFV048255; Sun, 20 Dec 2009 01:00:41 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200912200100.nBK10fFV048255@svn.freebsd.org> From: Andriy Gapon Date: Sun, 20 Dec 2009 01:00:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200742 - in stable/7/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 01:00:42 -0000 Author: avg Date: Sun Dec 20 01:00:41 2009 New Revision: 200742 URL: http://svn.freebsd.org/changeset/base/200742 Log: MFC r197070: Consolidate CPUID to CPU family/model macros for amd64 and i386 This is to fix breakage caused by r200064. I do this MFC instead of just fixing r200064 to reduce difference from head and make things easier for future MFCs. Original change is by jkim. Pointy hat to: avg Modified: stable/7/sys/amd64/amd64/identcpu.c stable/7/sys/amd64/amd64/initcpu.c stable/7/sys/amd64/amd64/msi.c stable/7/sys/amd64/include/specialreg.h stable/7/sys/i386/i386/identcpu.c stable/7/sys/i386/i386/msi.c stable/7/sys/i386/include/specialreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/amd64/amd64/identcpu.c ============================================================================== --- stable/7/sys/amd64/amd64/identcpu.c Sat Dec 19 20:50:48 2009 (r200741) +++ stable/7/sys/amd64/amd64/identcpu.c Sun Dec 20 01:00:41 2009 (r200742) @@ -371,21 +371,21 @@ printcpuinfo(void) switch (cpu_vendor_id) { case CPU_VENDOR_AMD: if ((amd_pminfo & AMDPM_TSC_INVARIANT) || - AMD64_CPU_FAMILY(cpu_id) >= 0x10 || + CPUID_TO_FAMILY(cpu_id) >= 0x10 || cpu_id == 0x60fb2) tsc_is_invariant = 1; break; case CPU_VENDOR_INTEL: if ((amd_pminfo & AMDPM_TSC_INVARIANT) || - (AMD64_CPU_FAMILY(cpu_id) == 0x6 && - AMD64_CPU_MODEL(cpu_id) >= 0xe) || - (AMD64_CPU_FAMILY(cpu_id) == 0xf && - AMD64_CPU_MODEL(cpu_id) >= 0x3)) + (CPUID_TO_FAMILY(cpu_id) == 0x6 && + CPUID_TO_MODEL(cpu_id) >= 0xe) || + (CPUID_TO_FAMILY(cpu_id) == 0xf && + CPUID_TO_MODEL(cpu_id) >= 0x3)) tsc_is_invariant = 1; break; case CPU_VENDOR_CENTAUR: - if (AMD64_CPU_FAMILY(cpu_id) == 0x6 && - AMD64_CPU_MODEL(cpu_id) >= 0xf && + if (CPUID_TO_FAMILY(cpu_id) == 0x6 && + CPUID_TO_MODEL(cpu_id) >= 0xf && (rdmsr(0x1203) & 0x100000000ULL) == 0) tsc_is_invariant = 1; break; @@ -638,8 +638,8 @@ print_AMD_info(void) * impratical at this stage, print out a warning string if the broken * model and family are identified. */ - if (AMD64_CPU_FAMILY(cpu_id) == 0xf && - AMD64_CPU_MODEL(cpu_id) >= 0x20 && AMD64_CPU_MODEL(cpu_id) <= 0x3f) + if (CPUID_TO_FAMILY(cpu_id) == 0xf && + CPUID_TO_MODEL(cpu_id) >= 0x20 && CPUID_TO_MODEL(cpu_id) <= 0x3f) printf("WARNING: This architecture revision has known SMP " "hardware bugs which may cause random instability\n"); } Modified: stable/7/sys/amd64/amd64/initcpu.c ============================================================================== --- stable/7/sys/amd64/amd64/initcpu.c Sat Dec 19 20:50:48 2009 (r200741) +++ stable/7/sys/amd64/amd64/initcpu.c Sun Dec 20 01:00:41 2009 (r200742) @@ -153,7 +153,7 @@ initializecpu(void) pg_nx = PG_NX; } if (cpu_vendor_id == CPU_VENDOR_CENTAUR && - AMD64_CPU_FAMILY(cpu_id) == 0x6 && - AMD64_CPU_MODEL(cpu_id) >= 0xf) + CPUID_TO_FAMILY(cpu_id) == 0x6 && + CPUID_TO_MODEL(cpu_id) >= 0xf) init_via(); } Modified: stable/7/sys/amd64/amd64/msi.c ============================================================================== --- stable/7/sys/amd64/amd64/msi.c Sat Dec 19 20:50:48 2009 (r200741) +++ stable/7/sys/amd64/amd64/msi.c Sun Dec 20 01:00:41 2009 (r200742) @@ -218,8 +218,8 @@ msi_init(void) case CPU_VENDOR_AMD: break; case CPU_VENDOR_CENTAUR: - if (AMD64_CPU_FAMILY(cpu_id) == 0x6 && - AMD64_CPU_MODEL(cpu_id) >= 0xf) + if (CPUID_TO_FAMILY(cpu_id) == 0x6 && + CPUID_TO_MODEL(cpu_id) >= 0xf) break; /* FALLTHROUGH */ default: Modified: stable/7/sys/amd64/include/specialreg.h ============================================================================== --- stable/7/sys/amd64/include/specialreg.h Sat Dec 19 20:50:48 2009 (r200741) +++ stable/7/sys/amd64/include/specialreg.h Sun Dec 20 01:00:41 2009 (r200742) @@ -169,10 +169,10 @@ #define CPUID_FAMILY 0x00000f00 #define CPUID_EXT_MODEL 0x000f0000 #define CPUID_EXT_FAMILY 0x0ff00000 -#define AMD64_CPU_MODEL(id) \ +#define CPUID_TO_MODEL(id) \ ((((id) & CPUID_MODEL) >> 4) | \ (((id) & CPUID_EXT_MODEL) >> 12)) -#define AMD64_CPU_FAMILY(id) \ +#define CPUID_TO_FAMILY(id) \ ((((id) & CPUID_FAMILY) >> 8) + \ (((id) & CPUID_EXT_FAMILY) >> 20)) Modified: stable/7/sys/i386/i386/identcpu.c ============================================================================== --- stable/7/sys/i386/i386/identcpu.c Sat Dec 19 20:50:48 2009 (r200741) +++ stable/7/sys/i386/i386/identcpu.c Sun Dec 20 01:00:41 2009 (r200742) @@ -859,7 +859,7 @@ printcpuinfo(void) switch (cpu_vendor_id) { case CPU_VENDOR_AMD: if ((amd_pminfo & AMDPM_TSC_INVARIANT) || - I386_CPU_FAMILY(cpu_id) >= 0x10 || + CPUID_TO_FAMILY(cpu_id) >= 0x10 || cpu_id == 0x60fb2) tsc_is_invariant = 1; break; @@ -868,8 +868,8 @@ printcpuinfo(void) tsc_is_invariant = 1; break; case CPU_VENDOR_CENTAUR: - if (I386_CPU_FAMILY(cpu_id) == 0x6 && - I386_CPU_MODEL(cpu_id) >= 0xf && + if (CPUID_TO_FAMILY(cpu_id) == 0x6 && + CPUID_TO_MODEL(cpu_id) >= 0xf && (rdmsr(0x1203) & 0x100000000ULL) == 0) tsc_is_invariant = 1; break; @@ -1123,8 +1123,8 @@ finishidentcpu(void) * XXX This is only done on the BSP package. */ if (cpu_vendor_id == CPU_VENDOR_INTEL && cpu_high > 0 && cpu_high < 4 && - ((I386_CPU_FAMILY(cpu_id) == 0xf && I386_CPU_MODEL(cpu_id) >= 0x3) || - (I386_CPU_FAMILY(cpu_id) == 0x6 && I386_CPU_MODEL(cpu_id) >= 0xe))) { + ((CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x3) || + (CPUID_TO_FAMILY(cpu_id) == 0x6 && CPUID_TO_MODEL(cpu_id) >= 0xe))) { uint64_t msr; msr = rdmsr(MSR_IA32_MISC_ENABLE); if ((msr & 0x400000ULL) != 0) { @@ -1331,8 +1331,8 @@ print_AMD_info(void) * impratical at this stage, print out a warning string if the broken * model and family are identified. */ - if (I386_CPU_FAMILY(cpu_id) == 0xf && I386_CPU_MODEL(cpu_id) >= 0x20 && - I386_CPU_MODEL(cpu_id) <= 0x3f) + if (CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x20 && + CPUID_TO_MODEL(cpu_id) <= 0x3f) printf("WARNING: This architecture revision has known SMP " "hardware bugs which may cause random instability\n"); } Modified: stable/7/sys/i386/i386/msi.c ============================================================================== --- stable/7/sys/i386/i386/msi.c Sat Dec 19 20:50:48 2009 (r200741) +++ stable/7/sys/i386/i386/msi.c Sun Dec 20 01:00:41 2009 (r200742) @@ -218,8 +218,8 @@ msi_init(void) case CPU_VENDOR_AMD: break; case CPU_VENDOR_CENTAUR: - if (I386_CPU_FAMILY(cpu_id) == 0x6 && - I386_CPU_MODEL(cpu_id) >= 0xf) + if (CPUID_TO_FAMILY(cpu_id) == 0x6 && + CPUID_TO_MODEL(cpu_id) >= 0xf) break; /* FALLTHROUGH */ default: Modified: stable/7/sys/i386/include/specialreg.h ============================================================================== --- stable/7/sys/i386/include/specialreg.h Sat Dec 19 20:50:48 2009 (r200741) +++ stable/7/sys/i386/include/specialreg.h Sun Dec 20 01:00:41 2009 (r200742) @@ -166,11 +166,11 @@ #define CPUID_FAMILY 0x00000f00 #define CPUID_EXT_MODEL 0x000f0000 #define CPUID_EXT_FAMILY 0x0ff00000 -#define I386_CPU_MODEL(id) \ +#define CPUID_TO_MODEL(id) \ ((((id) & CPUID_MODEL) >> 4) | \ ((((id) & CPUID_FAMILY) >= 0x600) ? \ (((id) & CPUID_EXT_MODEL) >> 12) : 0)) -#define I386_CPU_FAMILY(id) \ +#define CPUID_TO_FAMILY(id) \ ((((id) & CPUID_FAMILY) >> 8) + \ ((((id) & CPUID_FAMILY) == 0xf00) ? \ (((id) & CPUID_EXT_FAMILY) >> 20) : 0)) From owner-svn-src-stable-7@FreeBSD.ORG Sun Dec 20 01:38:21 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E68CE106568B; Sun, 20 Dec 2009 01:38:21 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D52628FC16; Sun, 20 Dec 2009 01:38: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 nBK1cLf5049085; Sun, 20 Dec 2009 01:38:21 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBK1cLuk049082; Sun, 20 Dec 2009 01:38:21 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200912200138.nBK1cLuk049082@svn.freebsd.org> From: Marius Strobl Date: Sun, 20 Dec 2009 01:38:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200745 - stable/7/sys/dev/ata X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 01:38:22 -0000 Author: marius Date: Sun Dec 20 01:38:21 2009 New Revision: 200745 URL: http://svn.freebsd.org/changeset/base/200745 Log: MFC: r200481 Specify the capability and media bits of the capabilities page in native, i.e. big-endian, format and convert as appropriate like we also do with the multibyte fields of the other pages. This fixes the output of acd_describe() to match reality on big-endian machines without breaking it on little-endian ones. While at it, also convert the remaining multibyte fields of the pages read although they are currently unused for consistency and in order to prevent possible similar bugs in the future. Modified: stable/7/sys/dev/ata/atapi-cd.c stable/7/sys/dev/ata/atapi-cd.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ata/atapi-cd.c ============================================================================== --- stable/7/sys/dev/ata/atapi-cd.c Sun Dec 20 01:38:01 2009 (r200744) +++ stable/7/sys/dev/ata/atapi-cd.c Sun Dec 20 01:38:21 2009 (r200745) @@ -1211,6 +1211,7 @@ acd_read_track_info(device_t dev, int32_ if ((error = ata_atapicmd(dev, ccb, (caddr_t)info, sizeof(*info), ATA_R_READ, 30))) return error; + info->data_length = ntohs(info->data_length); info->track_start_addr = ntohl(info->track_start_addr); info->next_writeable_addr = ntohl(info->next_writeable_addr); info->free_blocks = ntohl(info->free_blocks); @@ -1649,12 +1650,17 @@ acd_get_cap(device_t dev) for (count = 0 ; count < 5 ; count++) { if (!ata_atapicmd(dev, ccb, (caddr_t)&cdp->cap, sizeof(cdp->cap), ATA_R_READ | ATA_R_QUIET, 5)) { + cdp->cap.data_length = ntohs(cdp->cap.data_length); + cdp->cap.blk_desc_len = ntohs(cdp->cap.blk_desc_len); + cdp->cap.media = ntohs(cdp->cap.media); + cdp->cap.capabilities = ntohs(cdp->cap.capabilities); cdp->cap.max_read_speed = ntohs(cdp->cap.max_read_speed); + cdp->cap.max_vol_levels = ntohs(cdp->cap.max_vol_levels); + cdp->cap.buf_size = ntohs(cdp->cap.buf_size); cdp->cap.cur_read_speed = ntohs(cdp->cap.cur_read_speed); cdp->cap.max_write_speed = ntohs(cdp->cap.max_write_speed); cdp->cap.cur_write_speed = max(ntohs(cdp->cap.cur_write_speed),177); - cdp->cap.max_vol_levels = ntohs(cdp->cap.max_vol_levels); - cdp->cap.buf_size = ntohs(cdp->cap.buf_size); + cdp->cap.copy_protect_rev = ntohs(cdp->cap.copy_protect_rev); } } } Modified: stable/7/sys/dev/ata/atapi-cd.h ============================================================================== --- stable/7/sys/dev/ata/atapi-cd.h Sun Dec 20 01:38:01 2009 (r200744) +++ stable/7/sys/dev/ata/atapi-cd.h Sun Dec 20 01:38:21 2009 (r200745) @@ -112,34 +112,34 @@ struct cappage { u_int8_t param_len; u_int16_t media; -#define MST_READ_CDR 0x0001 -#define MST_READ_CDRW 0x0002 -#define MST_READ_PACKET 0x0004 -#define MST_READ_DVDROM 0x0008 -#define MST_READ_DVDR 0x0010 -#define MST_READ_DVDRAM 0x0020 -#define MST_WRITE_CDR 0x0100 -#define MST_WRITE_CDRW 0x0200 -#define MST_WRITE_TEST 0x0400 -#define MST_WRITE_DVDR 0x1000 -#define MST_WRITE_DVDRAM 0x2000 +#define MST_READ_CDR 0x0100 +#define MST_READ_CDRW 0x0200 +#define MST_READ_PACKET 0x0400 +#define MST_READ_DVDROM 0x0800 +#define MST_READ_DVDR 0x1000 +#define MST_READ_DVDRAM 0x2000 +#define MST_WRITE_CDR 0x0001 +#define MST_WRITE_CDRW 0x0002 +#define MST_WRITE_TEST 0x0004 +#define MST_WRITE_DVDR 0x0010 +#define MST_WRITE_DVDRAM 0x0020 u_int16_t capabilities; -#define MST_AUDIO_PLAY 0x0001 -#define MST_COMPOSITE 0x0002 -#define MST_AUDIO_P1 0x0004 -#define MST_AUDIO_P2 0x0008 -#define MST_MODE2_f1 0x0010 -#define MST_MODE2_f2 0x0020 -#define MST_MULTISESSION 0x0040 -#define MST_BURNPROOF 0x0080 -#define MST_READ_CDDA 0x0100 -#define MST_CDDA_STREAM 0x0200 -#define MST_COMBINED_RW 0x0400 -#define MST_CORRECTED_RW 0x0800 -#define MST_SUPPORT_C2 0x1000 -#define MST_ISRC 0x2000 -#define MST_UPC 0x4000 +#define MST_AUDIO_PLAY 0x0100 +#define MST_COMPOSITE 0x0200 +#define MST_AUDIO_P1 0x0400 +#define MST_AUDIO_P2 0x0800 +#define MST_MODE2_f1 0x1000 +#define MST_MODE2_f2 0x2000 +#define MST_MULTISESSION 0x4000 +#define MST_BURNPROOF 0x8000 +#define MST_READ_CDDA 0x0001 +#define MST_CDDA_STREAM 0x0002 +#define MST_COMBINED_RW 0x0004 +#define MST_CORRECTED_RW 0x0008 +#define MST_SUPPORT_C2 0x0010 +#define MST_ISRC 0x0020 +#define MST_UPC 0x0040 u_int8_t mechanism; #define MST_LOCKABLE 0x01 From owner-svn-src-stable-7@FreeBSD.ORG Sun Dec 20 01:46:24 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C40C1065695; Sun, 20 Dec 2009 01:46:24 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C89B8FC17; Sun, 20 Dec 2009 01:46: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 nBK1kNJm049343; Sun, 20 Dec 2009 01:46:23 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBK1kNjA049341; Sun, 20 Dec 2009 01:46:23 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200912200146.nBK1kNjA049341@svn.freebsd.org> From: Marius Strobl Date: Sun, 20 Dec 2009 01:46:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200747 - stable/7/sys/dev/ata X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 01:46:24 -0000 Author: marius Date: Sun Dec 20 01:46:23 2009 New Revision: 200747 URL: http://svn.freebsd.org/changeset/base/200747 Log: MFC: r200482 Properly support M5229 revision 0xc7 and 0xc8: - These revisions no longer have cable detection capability. - The UDMA support bit of register 0x4b has been dropped without an replacement. - According to Linux it's crucial for working ATAPI DMA support to also set the reserved bit 1 of regsiter 0x53 with these revisions. Modified: stable/7/sys/dev/ata/ata-chipset.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ata/ata-chipset.c ============================================================================== --- stable/7/sys/dev/ata/ata-chipset.c Sun Dec 20 01:44:47 2009 (r200746) +++ stable/7/sys/dev/ata/ata-chipset.c Sun Dec 20 01:46:23 2009 (r200747) @@ -1135,11 +1135,14 @@ ata_ali_chipinit(device_t dev) /* use device interrupt as byte count end */ pci_write_config(dev, 0x4a, pci_read_config(dev, 0x4a, 1) | 0x20, 1); - /* enable cable detection and UDMA support on newer chips */ - pci_write_config(dev, 0x4b, pci_read_config(dev, 0x4b, 1) | 0x09, 1); - - /* enable ATAPI UDMA mode */ - pci_write_config(dev, 0x53, pci_read_config(dev, 0x53, 1) | 0x01, 1); + /* enable cable detection and UDMA support on revisions < 0xc7 */ + if (ctlr->chip->chiprev < 0xc7) + pci_write_config(dev, 0x4b, pci_read_config(dev, 0x4b, 1) | + 0x09, 1); + + /* enable ATAPI UDMA mode (even if we are going to do PIO) */ + pci_write_config(dev, 0x53, pci_read_config(dev, 0x53, 1) | + (ctlr->chip->chiprev >= 0xc7 ? 0x03 : 0x01), 1); /* only chips with revision > 0xc4 can do 48bit DMA */ if (ctlr->chip->chiprev <= 0xc4) @@ -1263,7 +1266,7 @@ ata_ali_setmode(device_t dev, int mode) mode = ata_limit_mode(dev, mode, ctlr->chip->max_dma); - if (ctlr->chip->cfg2 & ALINEW) { + if (ctlr->chip->cfg2 & ALINEW && ctlr->chip->chiprev < 0xc7) { if (mode > ATA_UDMA2 && pci_read_config(gparent, 0x4a, 1) & (1 << ch->unit)) { ata_print_cable(dev, "controller"); From owner-svn-src-stable-7@FreeBSD.ORG Sun Dec 20 10:40:14 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 070581065676; Sun, 20 Dec 2009 10:40:14 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 9EF2B8FC0C; Sun, 20 Dec 2009 10:40:12 +0000 (UTC) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id MAA12282; Sun, 20 Dec 2009 12:40:09 +0200 (EET) (envelope-from avg@freebsd.org) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1NMJCr-0007j7-D6; Sun, 20 Dec 2009 12:40:09 +0200 Message-ID: <4B2DFEA5.6000706@freebsd.org> Date: Sun, 20 Dec 2009 12:38:29 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.23 (X11/20091128) MIME-Version: 1.0 To: jhell References: <200912191045.nBJAjvfc030388@svn.freebsd.org> In-Reply-To: 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-7@freebsd.org Subject: Re: svn commit: r200714 - in stable/7/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 10:40:14 -0000 on 19/12/2009 21:19 jhell said the following: > [FYI] > Following errors are being generated on stable/7 i386 "Intel" based > machine. If more information is needed, let me know. > > cc1: warnings being treated as errors > /usr/src/sys/i386/i386/mca.c: In function 'mca_init': > /usr/src/sys/i386/i386/mca.c:510: warning: implicit declaration of > function 'CPUID_TO_FAMILY' > /usr/src/sys/i386/i386/mca.c:510: warning: nested extern declaration of > 'CPUID_TO_FAMILY' > /usr/src/sys/i386/i386/mca.c:511: warning: implicit declaration of > function 'CPUID_TO_MODEL' > /usr/src/sys/i386/i386/mca.c:511: warning: nested extern declaration of > 'CPUID_TO_MODEL' > *** Error code 1 Thank you for the information! Unfortunately, I took a shortcut during the MFC of what I thought was an almost trivial change and didn't realize that I was breaking the build. Should be fixed with r200742. -- Andriy Gapon From owner-svn-src-stable-7@FreeBSD.ORG Mon Dec 21 06:24:45 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED3C91065672; Mon, 21 Dec 2009 06:24:44 +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 DB03E8FC17; Mon, 21 Dec 2009 06:24: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 nBL6OiLw086124; Mon, 21 Dec 2009 06:24:44 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBL6OiR9086118; Mon, 21 Dec 2009 06:24:44 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200912210624.nBL6OiR9086118@svn.freebsd.org> From: Andriy Gapon Date: Mon, 21 Dec 2009 06:24:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200766 - in stable/7/sys: amd64/conf conf dev/amdsbwd i386/conf modules modules/amdsbwd X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 06:24:45 -0000 Author: avg Date: Mon Dec 21 06:24:44 2009 New Revision: 200766 URL: http://svn.freebsd.org/changeset/base/200766 Log: MFC r199969: amdsbwd: new driver for AMD SB600/SB7xx watchdog timer Added: stable/7/sys/dev/amdsbwd/ - copied from r199969, head/sys/dev/amdsbwd/ stable/7/sys/modules/amdsbwd/ - copied from r199969, head/sys/modules/amdsbwd/ Modified: stable/7/sys/amd64/conf/NOTES stable/7/sys/conf/files.amd64 stable/7/sys/conf/files.i386 stable/7/sys/i386/conf/NOTES stable/7/sys/modules/Makefile Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/amd64/conf/NOTES ============================================================================== --- stable/7/sys/amd64/conf/NOTES Mon Dec 21 05:58:55 2009 (r200765) +++ stable/7/sys/amd64/conf/NOTES Mon Dec 21 06:24:44 2009 (r200766) @@ -449,8 +449,10 @@ device xrpu # Hardware watchdog timers: # # ichwd: Intel ICH watchdog timer +# amdsbwd: AMD SB7xx watchdog timer # device ichwd +device amdsbwd # # Temperature sensors: Modified: stable/7/sys/conf/files.amd64 ============================================================================== --- stable/7/sys/conf/files.amd64 Mon Dec 21 05:58:55 2009 (r200765) +++ stable/7/sys/conf/files.amd64 Mon Dec 21 06:24:44 2009 (r200766) @@ -135,6 +135,7 @@ crypto/via/padlock.c optional padlock crypto/via/padlock_cipher.c optional padlock crypto/via/padlock_hash.c optional padlock dev/acpica/acpi_if.m standard +dev/amdsbwd/amdsbwd.c optional amdsbwd dev/amdtemp/amdtemp.c optional amdtemp dev/arcmsr/arcmsr.c optional arcmsr pci dev/atkbdc/atkbd.c optional atkbd atkbdc Modified: stable/7/sys/conf/files.i386 ============================================================================== --- stable/7/sys/conf/files.i386 Mon Dec 21 05:58:55 2009 (r200765) +++ stable/7/sys/conf/files.i386 Mon Dec 21 06:24:44 2009 (r200766) @@ -131,6 +131,7 @@ crypto/via/padlock_cipher.c optional pad crypto/via/padlock_hash.c optional padlock dev/advansys/adv_isa.c optional adv isa dev/aic/aic_isa.c optional aic isa +dev/amdsbwd/amdsbwd.c optional amdsbwd dev/amdtemp/amdtemp.c optional amdtemp dev/arcmsr/arcmsr.c optional arcmsr pci dev/ar/if_ar.c optional ar Modified: stable/7/sys/i386/conf/NOTES ============================================================================== --- stable/7/sys/i386/conf/NOTES Mon Dec 21 05:58:55 2009 (r200765) +++ stable/7/sys/i386/conf/NOTES Mon Dec 21 06:24:44 2009 (r200766) @@ -863,8 +863,10 @@ hint.pcf.0.irq="5" # Hardware watchdog timers: # # ichwd: Intel ICH watchdog timer +# amdsbwd: AMD SB7xx watchdog timer # device ichwd +device amdsbwd # # Temperature sensors: Modified: stable/7/sys/modules/Makefile ============================================================================== --- stable/7/sys/modules/Makefile Mon Dec 21 05:58:55 2009 (r200765) +++ stable/7/sys/modules/Makefile Mon Dec 21 06:24:44 2009 (r200766) @@ -19,6 +19,7 @@ SUBDIR= ${_3dfx} \ alc \ ale \ ${_amd} \ + ${_amdsbwd} \ ${_amdtemp} \ amr \ ${_an} \ @@ -459,6 +460,7 @@ _zfs= zfs _aac= aac _acpi= acpi _ahb= ahb +_amdsbwd= amdsbwd _amdtemp= amdtemp _arcmsr= arcmsr _arl= arl @@ -513,6 +515,7 @@ _aac= aac _acpi= acpi _agp= agp _an= an +_amdsbwd= amdsbwd _amdtemp= amdtemp _arcmsr= arcmsr _cardbus= cardbus From owner-svn-src-stable-7@FreeBSD.ORG Mon Dec 21 13:53:36 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4BD91065670; Mon, 21 Dec 2009 13:53:36 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 99FEF8FC18; Mon, 21 Dec 2009 13:53: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 nBLDrajX029606; Mon, 21 Dec 2009 13:53:36 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLDranv029604; Mon, 21 Dec 2009 13:53:36 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <200912211353.nBLDranv029604@svn.freebsd.org> From: Ruslan Ermilov Date: Mon, 21 Dec 2009 13:53:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200772 - in stable: 7/sys/dev/ipmi 8/sys/dev/ipmi X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 13:53:36 -0000 Author: ru Date: Mon Dec 21 13:53:33 2009 New Revision: 200772 URL: http://svn.freebsd.org/changeset/base/200772 Log: MFC r200666: Fixed incorrect watchdog timeout setting. PR: kern/130512 Modified: stable/7/sys/dev/ipmi/ipmi.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Changes in other areas also in this revision: Modified: stable/8/sys/dev/ipmi/ipmi.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/7/sys/dev/ipmi/ipmi.c ============================================================================== --- stable/7/sys/dev/ipmi/ipmi.c Mon Dec 21 12:32:13 2009 (r200771) +++ stable/7/sys/dev/ipmi/ipmi.c Mon Dec 21 13:53:33 2009 (r200772) @@ -588,12 +588,15 @@ ipmi_polled_enqueue_request(struct ipmi_ * Watchdog event handler. */ -static void -ipmi_set_watchdog(struct ipmi_softc *sc, int sec) +static int +ipmi_set_watchdog(struct ipmi_softc *sc, unsigned int sec) { struct ipmi_request *req; int error; + if (sec > 0xffff / 10) + return (EINVAL); + req = ipmi_alloc_driver_request(IPMI_ADDR(IPMI_APP_REQUEST, 0), IPMI_SET_WDOG, 6, 0); @@ -604,7 +607,7 @@ ipmi_set_watchdog(struct ipmi_softc *sc, req->ir_request[2] = 0; req->ir_request[3] = 0; /* Timer use */ req->ir_request[4] = (sec * 10) & 0xff; - req->ir_request[5] = (sec * 10) / 2550; + req->ir_request[5] = (sec * 10) >> 8; } else { req->ir_request[0] = IPMI_SET_WD_TIMER_SMS_OS; req->ir_request[1] = 0; @@ -617,8 +620,7 @@ ipmi_set_watchdog(struct ipmi_softc *sc, error = ipmi_submit_driver_request(sc, req, 0); if (error) device_printf(sc->ipmi_dev, "Failed to set watchdog\n"); - - if (error == 0 && sec) { + else if (sec) { ipmi_free_request(req); req = ipmi_alloc_driver_request(IPMI_ADDR(IPMI_APP_REQUEST, 0), @@ -631,6 +633,7 @@ ipmi_set_watchdog(struct ipmi_softc *sc, } ipmi_free_request(req); + return (error); /* dump_watchdog(sc); */ @@ -641,14 +644,22 @@ ipmi_wd_event(void *arg, unsigned int cm { struct ipmi_softc *sc = arg; unsigned int timeout; + int e; cmd &= WD_INTERVAL; if (cmd > 0 && cmd <= 63) { - timeout = ((uint64_t)1 << cmd) / 1800000000; - ipmi_set_watchdog(sc, timeout); - *error = 0; + timeout = ((uint64_t)1 << cmd) / 1000000000; + if (timeout == 0) + timeout = 1; + e = ipmi_set_watchdog(sc, timeout); + if (e == 0) + *error = 0; + else + (void)ipmi_set_watchdog(sc, 0); } else { - ipmi_set_watchdog(sc, 0); + e = ipmi_set_watchdog(sc, 0); + if (e != 0 && cmd == 0) + *error = EOPNOTSUPP; } } From owner-svn-src-stable-7@FreeBSD.ORG Mon Dec 21 14:03:41 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3694C1065670; Mon, 21 Dec 2009 14:03:41 +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 246388FC12; Mon, 21 Dec 2009 14:03: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 nBLE3eAW029948; Mon, 21 Dec 2009 14:03:41 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLE3eWT029946; Mon, 21 Dec 2009 14:03:40 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200912211403.nBLE3eWT029946@svn.freebsd.org> From: Andriy Gapon Date: Mon, 21 Dec 2009 14:03:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200773 - in stable/7/sys: conf i386/cpufreq modules/cpufreq X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 14:03:41 -0000 Author: avg Date: Mon Dec 21 14:03:40 2009 New Revision: 200773 URL: http://svn.freebsd.org/changeset/base/200773 Log: MFC r190501,190521,192029: Add support for Phenom (Family 10h) to cpufreq. This also has changes from r197070 (earlier partial MFC). Added: stable/7/sys/i386/cpufreq/hwpstate.c - copied, changed from r190501, head/sys/i386/cpufreq/hwpstate.c Modified: stable/7/sys/conf/files.amd64 stable/7/sys/conf/files.i386 stable/7/sys/modules/cpufreq/Makefile Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/conf/files.amd64 ============================================================================== --- stable/7/sys/conf/files.amd64 Mon Dec 21 13:53:33 2009 (r200772) +++ stable/7/sys/conf/files.amd64 Mon Dec 21 14:03:40 2009 (r200773) @@ -272,6 +272,7 @@ i386/bios/smbios.c optional smbios i386/bios/vpd.c optional vpd i386/cpufreq/powernow.c optional cpufreq i386/cpufreq/est.c optional cpufreq +i386/cpufreq/hwpstate.c optional cpufreq i386/cpufreq/p4tcc.c optional cpufreq # libkern/memset.c standard Modified: stable/7/sys/conf/files.i386 ============================================================================== --- stable/7/sys/conf/files.i386 Mon Dec 21 13:53:33 2009 (r200772) +++ stable/7/sys/conf/files.i386 Mon Dec 21 14:03:40 2009 (r200773) @@ -251,6 +251,7 @@ i386/bios/smapi_bios.S optional smapi i386/bios/smbios.c optional smbios i386/bios/vpd.c optional vpd i386/cpufreq/est.c optional cpufreq +i386/cpufreq/hwpstate.c optional cpufreq i386/cpufreq/p4tcc.c optional cpufreq i386/cpufreq/powernow.c optional cpufreq i386/cpufreq/smist.c optional cpufreq Copied and modified: stable/7/sys/i386/cpufreq/hwpstate.c (from r190501, head/sys/i386/cpufreq/hwpstate.c) ============================================================================== --- head/sys/i386/cpufreq/hwpstate.c Sat Mar 28 08:54:47 2009 (r190501, copy source) +++ stable/7/sys/i386/cpufreq/hwpstate.c Mon Dec 21 14:03:40 2009 (r200773) @@ -8,7 +8,7 @@ * Copyright (c) 2008-2009 Gen Otsuji * * This code is depending on kern_cpu.c, est.c, powernow.c, p4tcc.c, smist.c - * in various parts. The authors of these files are + * in various parts. The authors of these files are Nate Lawson, * Colin Percival, Bruno Durcot, and FUKUDA Nobuhiko. * This code contains patches by Michael Reifenberger and Norikatsu Shigemura. * Thank you. @@ -82,12 +82,6 @@ __FBSDID("$FreeBSD$"); #define AMD_10H_11H_CUR_DID(msr) (((msr) >> 6) & 0x07) #define AMD_10H_11H_CUR_FID(msr) ((msr) & 0x3F) -#if defined(__amd64__) -#define CPU_FAMILY(id) AMD64_CPU_FAMILY(id) -#elif defined(__i386__) -#define CPU_FAMILY(id) I386_CPU_FAMILY(id) -#endif - #define HWPSTATE_DEBUG(dev, msg...) \ do{ \ if(hwpstate_verbose) \ @@ -161,7 +155,6 @@ DRIVER_MODULE(hwpstate, cpu, hwpstate_dr static int hwpstate_goto_pstate(device_t dev, int pstate) { - struct hwpstate_softc *sc; struct pcpu *pc; int i; uint64_t msr; @@ -170,7 +163,6 @@ hwpstate_goto_pstate(device_t dev, int p int id = pstate; int error; - sc = device_get_softc(dev); /* get the current pstate limit */ msr = rdmsr(MSR_AMD_10H_11H_LIMIT); limit = AMD_10H_11H_GET_PSTATE_LIMIT(msr); @@ -299,12 +291,11 @@ hwpstate_type(device_t dev, int *type) static void hwpstate_identify(driver_t *driver, device_t parent) { - device_t child; if (device_find_child(parent, "hwpstate", -1) != NULL) return; - if (cpu_vendor_id != CPU_VENDOR_AMD || CPU_FAMILY(cpu_id) < 0x10) + if (cpu_vendor_id != CPU_VENDOR_AMD || CPUID_TO_FAMILY(cpu_id) < 0x10) return; /* @@ -318,7 +309,7 @@ hwpstate_identify(driver_t *driver, devi if (resource_disabled("hwpstate", 0)) return; - if ((child = BUS_ADD_CHILD(parent, 10, "hwpstate", -1)) == NULL) + if (BUS_ADD_CHILD(parent, 10, "hwpstate", -1) == NULL) device_printf(parent, "hwpstate: add child failed\n"); } @@ -407,7 +398,7 @@ hwpstate_get_info_from_msr(device_t dev) uint64_t msr; int family, i, fid, did; - family = CPU_FAMILY(cpu_id); + family = CPUID_TO_FAMILY(cpu_id); sc = device_get_softc(dev); /* Get pstate count */ msr = rdmsr(MSR_AMD_10H_11H_LIMIT); Modified: stable/7/sys/modules/cpufreq/Makefile ============================================================================== --- stable/7/sys/modules/cpufreq/Makefile Mon Dec 21 13:53:33 2009 (r200772) +++ stable/7/sys/modules/cpufreq/Makefile Mon Dec 21 14:03:40 2009 (r200773) @@ -12,7 +12,7 @@ SRCS+= bus_if.h cpufreq_if.h device_if.h CFLAGS+= -I${.CURDIR}/../../contrib/dev/acpica SRCS+= acpi_if.h opt_acpi.h -SRCS+= est.c p4tcc.c powernow.c +SRCS+= est.c hwpstate.c p4tcc.c powernow.c .endif .if ${MACHINE} == "i386" From owner-svn-src-stable-7@FreeBSD.ORG Mon Dec 21 18:09:41 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB7461065694; Mon, 21 Dec 2009 18:09:41 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C853A8FC20; Mon, 21 Dec 2009 18:09: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 nBLI9fqn035684; Mon, 21 Dec 2009 18:09:41 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLI9fYZ035680; Mon, 21 Dec 2009 18:09:41 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200912211809.nBLI9fYZ035680@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 21 Dec 2009 18:09:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200784 - stable/7/sys/dev/et X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 18:09:42 -0000 Author: yongari Date: Mon Dec 21 18:09:41 2009 New Revision: 200784 URL: http://svn.freebsd.org/changeset/base/200784 Log: MFC r199548: Remove complex macros that were used to compute bits values. Although these macros may have its own strength, its complex definition make hard to read the code. Approved by: delphij Modified: stable/7/sys/dev/et/if_et.c stable/7/sys/dev/et/if_etreg.h stable/7/sys/dev/et/if_etvar.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/et/if_et.c ============================================================================== --- stable/7/sys/dev/et/if_et.c Mon Dec 21 18:07:15 2009 (r200783) +++ stable/7/sys/dev/et/if_et.c Mon Dec 21 18:09:41 2009 (r200784) @@ -404,8 +404,8 @@ et_miibus_readreg(device_t dev, int phy, /* Stop any pending operations */ CSR_WRITE_4(sc, ET_MII_CMD, 0); - val = __SHIFTIN(phy, ET_MII_ADDR_PHY) | - __SHIFTIN(reg, ET_MII_ADDR_REG); + val = (phy << ET_MII_ADDR_PHY_SHIFT) & ET_MII_ADDR_PHY_MASK; + val |= (reg << ET_MII_ADDR_REG_SHIFT) & ET_MII_ADDR_REG_MASK; CSR_WRITE_4(sc, ET_MII_ADDR, val); /* Start reading */ @@ -429,7 +429,7 @@ et_miibus_readreg(device_t dev, int phy, #undef NRETRY val = CSR_READ_4(sc, ET_MII_STAT); - ret = __SHIFTOUT(val, ET_MII_STAT_VALUE); + ret = val & ET_MII_STAT_VALUE_MASK; back: /* Make sure that the current operation is stopped */ @@ -447,12 +447,13 @@ et_miibus_writereg(device_t dev, int phy /* Stop any pending operations */ CSR_WRITE_4(sc, ET_MII_CMD, 0); - val = __SHIFTIN(phy, ET_MII_ADDR_PHY) | - __SHIFTIN(reg, ET_MII_ADDR_REG); + val = (phy << ET_MII_ADDR_PHY_SHIFT) & ET_MII_ADDR_PHY_MASK; + val |= (reg << ET_MII_ADDR_REG_SHIFT) & ET_MII_ADDR_REG_MASK; CSR_WRITE_4(sc, ET_MII_ADDR, val); /* Start writing */ - CSR_WRITE_4(sc, ET_MII_CTRL, __SHIFTIN(val0, ET_MII_CTRL_VALUE)); + CSR_WRITE_4(sc, ET_MII_CTRL, + (val0 << ET_MII_CTRL_VALUE_SHIFT) & ET_MII_CTRL_VALUE_MASK); #define NRETRY 100 @@ -601,8 +602,13 @@ et_bus_config(device_t dev) /* * Set L0s and L1 latency timer to 2us */ - val = ET_PCIV_L0S_LATENCY(2) | ET_PCIV_L1_LATENCY(2); - pci_write_config(dev, ET_PCIR_L0S_L1_LATENCY, val, 1); + val = pci_read_config(dev, ET_PCIR_L0S_L1_LATENCY, 4); + val &= ~(PCIM_LINK_CAP_L0S_EXIT | PCIM_LINK_CAP_L1_EXIT); + /* L0s exit latency : 2us */ + val |= 0x00005000; + /* L1 exit latency : 2us */ + val |= 0x00028000; + pci_write_config(dev, ET_PCIR_L0S_L1_LATENCY, val, 4); /* * Set max read request size to 2048 bytes @@ -1021,10 +1027,10 @@ et_chip_attach(struct et_softc *sc) /* * Setup half duplex mode */ - val = __SHIFTIN(10, ET_MAC_HDX_ALT_BEB_TRUNC) | - __SHIFTIN(15, ET_MAC_HDX_REXMIT_MAX) | - __SHIFTIN(55, ET_MAC_HDX_COLLWIN) | - ET_MAC_HDX_EXC_DEFER; + val = (10 << ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT) | + (15 << ET_MAC_HDX_REXMIT_MAX_SHIFT) | + (55 << ET_MAC_HDX_COLLWIN_SHIFT) | + ET_MAC_HDX_EXC_DEFER; CSR_WRITE_4(sc, ET_MAC_HDX, val); /* Clear MAC control */ @@ -1655,19 +1661,19 @@ et_init_mac(struct et_softc *sc) /* * Setup inter packet gap */ - val = __SHIFTIN(56, ET_IPG_NONB2B_1) | - __SHIFTIN(88, ET_IPG_NONB2B_2) | - __SHIFTIN(80, ET_IPG_MINIFG) | - __SHIFTIN(96, ET_IPG_B2B); + val = (56 << ET_IPG_NONB2B_1_SHIFT) | + (88 << ET_IPG_NONB2B_2_SHIFT) | + (80 << ET_IPG_MINIFG_SHIFT) | + (96 << ET_IPG_B2B_SHIFT); CSR_WRITE_4(sc, ET_IPG, val); /* * Setup half duplex mode */ - val = __SHIFTIN(10, ET_MAC_HDX_ALT_BEB_TRUNC) | - __SHIFTIN(15, ET_MAC_HDX_REXMIT_MAX) | - __SHIFTIN(55, ET_MAC_HDX_COLLWIN) | - ET_MAC_HDX_EXC_DEFER; + val = (10 << ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT) | + (15 << ET_MAC_HDX_REXMIT_MAX_SHIFT) | + (55 << ET_MAC_HDX_COLLWIN_SHIFT) | + ET_MAC_HDX_EXC_DEFER; CSR_WRITE_4(sc, ET_MAC_HDX, val); /* Clear MAC control */ @@ -1738,7 +1744,7 @@ et_init_rxmac(struct et_softc *sc) * since this is the size of the PCI-Express TLP's * that the ET1310 uses. */ - val = __SHIFTIN(ET_RXMAC_SEGSZ(256), ET_RXMAC_MC_SEGSZ_MAX) | + val = (ET_RXMAC_SEGSZ(256) & ET_RXMAC_MC_SEGSZ_MAX_MASK) | ET_RXMAC_MC_SEGSZ_ENABLE; } else { val = 0; @@ -1761,7 +1767,9 @@ et_init_rxmac(struct et_softc *sc) /* * Configure runt filtering (may not work on certain chip generation) */ - val = __SHIFTIN(ETHER_MIN_LEN, ET_PKTFILT_MINLEN) | ET_PKTFILT_FRAG; + val = (ETHER_MIN_LEN << ET_PKTFILT_MINLEN_SHIFT) & + ET_PKTFILT_MINLEN_MASK; + val |= ET_PKTFILT_FRAG; CSR_WRITE_4(sc, ET_PKTFILT, val); /* Enable RX MAC but leave WOL disabled */ @@ -1793,11 +1801,9 @@ et_start_rxdma(struct et_softc *sc) { uint32_t val = 0; - val |= __SHIFTIN(sc->sc_rx_data[0].rbd_bufsize, - ET_RXDMA_CTRL_RING0_SIZE) | + val |= (sc->sc_rx_data[0].rbd_bufsize & ET_RXDMA_CTRL_RING0_SIZE_MASK) | ET_RXDMA_CTRL_RING0_ENABLE; - val |= __SHIFTIN(sc->sc_rx_data[1].rbd_bufsize, - ET_RXDMA_CTRL_RING1_SIZE) | + val |= (sc->sc_rx_data[1].rbd_bufsize & ET_RXDMA_CTRL_RING1_SIZE_MASK) | ET_RXDMA_CTRL_RING1_ENABLE; CSR_WRITE_4(sc, ET_RXDMA_CTRL, val); @@ -1892,7 +1898,8 @@ et_rxeof(struct et_softc *sc) rxs_stat_ring = rxsd->rxsd_status->rxs_stat_ring; rxst_wrap = (rxs_stat_ring & ET_RXS_STATRING_WRAP) ? 1 : 0; - rxst_index = __SHIFTOUT(rxs_stat_ring, ET_RXS_STATRING_INDEX); + rxst_index = (rxs_stat_ring & ET_RXS_STATRING_INDEX_MASK) >> + ET_RXS_STATRING_INDEX_SHIFT; while (rxst_index != rxst_ring->rsr_index || rxst_wrap != rxst_ring->rsr_wrap) { @@ -1906,16 +1913,18 @@ et_rxeof(struct et_softc *sc) MPASS(rxst_ring->rsr_index < ET_RX_NSTAT); st = &rxst_ring->rsr_stat[rxst_ring->rsr_index]; - buflen = __SHIFTOUT(st->rxst_info2, ET_RXST_INFO2_LEN); - buf_idx = __SHIFTOUT(st->rxst_info2, ET_RXST_INFO2_BUFIDX); - ring_idx = __SHIFTOUT(st->rxst_info2, ET_RXST_INFO2_RINGIDX); + buflen = (st->rxst_info2 & ET_RXST_INFO2_LEN_MASK) >> + ET_RXST_INFO2_LEN_SHIFT; + buf_idx = (st->rxst_info2 & ET_RXST_INFO2_BUFIDX_MASK) >> + ET_RXST_INFO2_BUFIDX_SHIFT; + ring_idx = (st->rxst_info2 & ET_RXST_INFO2_RINGIDX_MASK) >> + ET_RXST_INFO2_RINGIDX_SHIFT; if (++rxst_ring->rsr_index == ET_RX_NSTAT) { rxst_ring->rsr_index = 0; rxst_ring->rsr_wrap ^= 1; } - rxstat_pos = __SHIFTIN(rxst_ring->rsr_index, - ET_RXSTAT_POS_INDEX); + rxstat_pos = rxst_ring->rsr_index & ET_RXSTAT_POS_INDEX_MASK; if (rxst_ring->rsr_wrap) rxstat_pos |= ET_RXSTAT_POS_WRAP; CSR_WRITE_4(sc, ET_RXSTAT_POS, rxstat_pos); @@ -1968,7 +1977,7 @@ et_rxeof(struct et_softc *sc) rx_ring->rr_index = 0; rx_ring->rr_wrap ^= 1; } - rxring_pos = __SHIFTIN(rx_ring->rr_index, ET_RX_RING_POS_INDEX); + rxring_pos = rx_ring->rr_index & ET_RX_RING_POS_INDEX_MASK; if (rx_ring->rr_wrap) rxring_pos |= ET_RX_RING_POS_WRAP; CSR_WRITE_4(sc, rx_ring->rr_posreg, rxring_pos); @@ -2056,7 +2065,7 @@ et_encap(struct et_softc *sc, struct mbu td = &tx_ring->tr_desc[idx]; td->td_addr_hi = ET_ADDR_HI(segs[i].ds_addr); td->td_addr_lo = ET_ADDR_LO(segs[i].ds_addr); - td->td_ctrl1 = __SHIFTIN(segs[i].ds_len, ET_TDCTRL1_LEN); + td->td_ctrl1 = segs[i].ds_len & ET_TDCTRL1_LEN_MASK; if (i == ctx.nsegs - 1) { /* Last frag */ td->td_ctrl2 = last_td_ctrl2; @@ -2083,8 +2092,7 @@ et_encap(struct et_softc *sc, struct mbu bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, BUS_DMASYNC_PREWRITE); - tx_ready_pos = __SHIFTIN(tx_ring->tr_ready_index, - ET_TX_READY_POS_INDEX); + tx_ready_pos = tx_ring->tr_ready_index & ET_TX_READY_POS_INDEX_MASK; if (tx_ring->tr_ready_wrap) tx_ready_pos |= ET_TX_READY_POS_WRAP; CSR_WRITE_4(sc, ET_TX_READY_POS, tx_ready_pos); @@ -2119,7 +2127,7 @@ et_txeof(struct et_softc *sc) return; tx_done = CSR_READ_4(sc, ET_TX_DONE_POS); - end = __SHIFTOUT(tx_done, ET_TX_DONE_POS_INDEX); + end = tx_done & ET_TX_DONE_POS_INDEX_MASK; wrap = (tx_done & ET_TX_DONE_POS_WRAP) ? 1 : 0; while (tbd->tbd_start_index != end || tbd->tbd_start_wrap != wrap) { @@ -2352,7 +2360,8 @@ et_setmedia(struct et_softc *sc) cfg2 &= ~(ET_MAC_CFG2_MODE_MII | ET_MAC_CFG2_MODE_GMII | ET_MAC_CFG2_FDX | ET_MAC_CFG2_BIGFRM); cfg2 |= ET_MAC_CFG2_LENCHK | ET_MAC_CFG2_CRC | ET_MAC_CFG2_PADCRC | - __SHIFTIN(7, ET_MAC_CFG2_PREAMBLE_LEN); + ((7 << ET_MAC_CFG2_PREAMBLE_LEN_SHIFT) & + ET_MAC_CFG2_PREAMBLE_LEN_MASK); ctrl = CSR_READ_4(sc, ET_MAC_CTRL); ctrl &= ~(ET_MAC_CTRL_GHDX | ET_MAC_CTRL_MODE_MII); @@ -2384,7 +2393,7 @@ et_setup_rxdesc(struct et_rxbuf_data *rb desc->rd_addr_hi = ET_ADDR_HI(paddr); desc->rd_addr_lo = ET_ADDR_LO(paddr); - desc->rd_ctrl = __SHIFTIN(buf_idx, ET_RDCTRL_BUFIDX); + desc->rd_ctrl = buf_idx & ET_RDCTRL_BUFIDX_MASK; bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap, BUS_DMASYNC_PREWRITE); Modified: stable/7/sys/dev/et/if_etreg.h ============================================================================== --- stable/7/sys/dev/et/if_etreg.h Mon Dec 21 18:07:15 2009 (r200783) +++ stable/7/sys/dev/et/if_etreg.h Mon Dec 21 18:09:41 2009 (r200784) @@ -73,50 +73,6 @@ #ifndef _IF_ETREG_H #define _IF_ETREG_H -/* - * __BIT(n): Return a bitmask with bit n set, where the least - * significant bit is bit 0. - * - * __BITS(m, n): Return a bitmask with bits m through n, inclusive, - * set. It does not matter whether m>n or m<=n. The - * least significant bit is bit 0. - * - * A "bitfield" is a span of consecutive bits defined by a bitmask, - * where 1s select the bits in the bitfield. __SHIFTIN, __SHIFTOUT, - * and __SHIFTOUT_MASK help read and write bitfields from device - * registers. - * - * __SHIFTIN(v, mask): Left-shift bits `v' into the bitfield - * defined by `mask', and return them. No - * side-effects. - * - * __SHIFTOUT(v, mask): Extract and return the bitfield selected - * by `mask' from `v', right-shifting the - * bits so that the rightmost selected bit - * is at bit 0. No side-effects. - * - * __SHIFTOUT_MASK(mask): Right-shift the bits in `mask' so that - * the rightmost non-zero bit is at bit - * 0. This is useful for finding the - * greatest unsigned value that a bitfield - * can hold. No side-effects. Note that - * __SHIFTOUT_MASK(m) = __SHIFTOUT(m, m). - */ - -/* __BIT(n): nth bit, where __BIT(0) == 0x1. */ -#define __BIT(__n) (((__n) == 32) ? 0 : ((uint32_t)1 << (__n))) - -/* __BITS(m, n): bits m through n, m < n. */ -#define __BITS(__m, __n) \ - ((__BIT(MAX((__m), (__n)) + 1) - 1) ^ (__BIT(MIN((__m), (__n))) - 1)) - -/* Find least significant bit that is set */ -#define __LOWEST_SET_BIT(__mask) ((((__mask) - 1) & (__mask)) ^ (__mask)) - -#define __SHIFTOUT(__x, __mask) (((__x) & (__mask)) / __LOWEST_SET_BIT(__mask)) -#define __SHIFTIN(__x, __mask) ((__x) * __LOWEST_SET_BIT(__mask)) -#define __SHIFTOUT_MASK(__mask) __SHIFTOUT((__mask), (__mask)) - #define ET_MEM_TXSIZE_EX 182 #define ET_MEM_RXSIZE_MIN 608 #define ET_MEM_RXSIZE_DEFAULT 11216 @@ -159,10 +115,6 @@ #define ET_PCIV_REPLAY_TIMER_256 (1248 + ET_REPLAY_TIMER_RX_L0S_ADJ) #define ET_PCIR_L0S_L1_LATENCY 0xcf -#define ET_PCIM_L0S_LATENCY __BITS(2, 0) -#define ET_PCIM_L1_LATENCY __BITS(5, 3) -#define ET_PCIV_L0S_LATENCY(l) __SHIFTIN((l) - 1, ET_PCIM_L0S_LATENCY) -#define ET_PCIV_L1_LATENCY(l) __SHIFTIN((l) - 1, ET_PCIM_L1_LATENCY) /* * CSR @@ -176,22 +128,22 @@ #define ET_QUEUE_ADDR_END ET_QUEUE_ADDR(ET_MEM_SIZE) #define ET_PM 0x0010 -#define ET_PM_SYSCLK_GATE __BIT(3) -#define ET_PM_TXCLK_GATE __BIT(4) -#define ET_PM_RXCLK_GATE __BIT(5) +#define ET_PM_SYSCLK_GATE 0x00000008 +#define ET_PM_TXCLK_GATE 0x00000010 +#define ET_PM_RXCLK_GATE 0x00000020 #define ET_INTR_STATUS 0x0018 #define ET_INTR_MASK 0x001c #define ET_SWRST 0x0028 -#define ET_SWRST_TXDMA __BIT(0) -#define ET_SWRST_RXDMA __BIT(1) -#define ET_SWRST_TXMAC __BIT(2) -#define ET_SWRST_RXMAC __BIT(3) -#define ET_SWRST_MAC __BIT(4) -#define ET_SWRST_MAC_STAT __BIT(5) -#define ET_SWRST_MMC __BIT(6) -#define ET_SWRST_SELFCLR_DISABLE __BIT(31) +#define ET_SWRST_TXDMA 0x00000001 +#define ET_SWRST_RXDMA 0x00000002 +#define ET_SWRST_TXMAC 0x00000004 +#define ET_SWRST_RXMAC 0x00000008 +#define ET_SWRST_MAC 0x00000010 +#define ET_SWRST_MAC_STAT 0x00000020 +#define ET_SWRST_MMC 0x00000040 +#define ET_SWRST_SELFCLR_DISABLE 0x80000000 #define ET_MSI_CFG 0x0030 @@ -200,9 +152,9 @@ #define ET_TIMER 0x0038 #define ET_TXDMA_CTRL 0x1000 -#define ET_TXDMA_CTRL_HALT __BIT(0) -#define ET_TXDMA_CTRL_CACHE_THR __BITS(7, 4) -#define ET_TXDMA_CTRL_SINGLE_EPKT __BIT(8) /* ??? */ +#define ET_TXDMA_CTRL_HALT 0x00000001 +#define ET_TXDMA_CTRL_CACHE_THR_MASK 0x000000F0 +#define ET_TXDMA_CTRL_SINGLE_EPKT 0x00000100 /* ??? */ #define ET_TX_RING_HI 0x1004 #define ET_TX_RING_LO 0x1008 @@ -212,28 +164,28 @@ #define ET_TX_STATUS_LO 0x1020 #define ET_TX_READY_POS 0x1024 -#define ET_TX_READY_POS_INDEX __BITS(9, 0) -#define ET_TX_READY_POS_WRAP __BIT(10) +#define ET_TX_READY_POS_INDEX_MASK 0x000003FF +#define ET_TX_READY_POS_WRAP 0x00000400 #define ET_TX_DONE_POS 0x1060 -#define ET_TX_DONE_POS_INDEX __BITS(9, 0) -#define ET_TX_DONE_POS_WRAP __BIT(10) +#define ET_TX_DONE_POS_INDEX_MASK 0x0000003FF +#define ET_TX_DONE_POS_WRAP 0x000000400 #define ET_RXDMA_CTRL 0x2000 -#define ET_RXDMA_CTRL_HALT __BIT(0) -#define ET_RXDMA_CTRL_RING0_SIZE __BITS(9, 8) -#define ET_RXDMA_CTRL_RING0_128 0 /* 127 */ -#define ET_RXDMA_CTRL_RING0_256 1 /* 255 */ -#define ET_RXDMA_CTRL_RING0_512 2 /* 511 */ -#define ET_RXDMA_CTRL_RING0_1024 3 /* 1023 */ -#define ET_RXDMA_CTRL_RING0_ENABLE __BIT(10) -#define ET_RXDMA_CTRL_RING1_SIZE __BITS(12, 11) -#define ET_RXDMA_CTRL_RING1_2048 0 /* 2047 */ -#define ET_RXDMA_CTRL_RING1_4096 1 /* 4095 */ -#define ET_RXDMA_CTRL_RING1_8192 2 /* 8191 */ -#define ET_RXDMA_CTRL_RING1_16384 3 /* 16383 (9022?) */ -#define ET_RXDMA_CTRL_RING1_ENABLE __BIT(13) -#define ET_RXDMA_CTRL_HALTED __BIT(17) +#define ET_RXDMA_CTRL_HALT 0x00000001 +#define ET_RXDMA_CTRL_RING0_SIZE_MASK 0x00000300 +#define ET_RXDMA_CTRL_RING0_128 0x00000000 /* 127 */ +#define ET_RXDMA_CTRL_RING0_256 0x00000100 /* 255 */ +#define ET_RXDMA_CTRL_RING0_512 0x00000200 /* 511 */ +#define ET_RXDMA_CTRL_RING0_1024 0x00000300 /* 1023 */ +#define ET_RXDMA_CTRL_RING0_ENABLE 0x00000400 +#define ET_RXDMA_CTRL_RING1_SIZE_MASK 0x00001800 +#define ET_RXDMA_CTRL_RING1_2048 0x00000000 /* 2047 */ +#define ET_RXDMA_CTRL_RING1_4096 0x00000800 /* 4095 */ +#define ET_RXDMA_CTRL_RING1_8192 0x00001000 /* 8191 */ +#define ET_RXDMA_CTRL_RING1_16384 0x00001800 /* 16383 (9022?) */ +#define ET_RXDMA_CTRL_RING1_ENABLE 0x00002000 +#define ET_RXDMA_CTRL_HALTED 0x00020000 #define ET_RX_STATUS_LO 0x2004 #define ET_RX_STATUS_HI 0x2008 @@ -246,8 +198,8 @@ #define ET_RXSTAT_CNT 0x2028 #define ET_RXSTAT_POS 0x2030 -#define ET_RXSTAT_POS_INDEX __BITS(11, 0) -#define ET_RXSTAT_POS_WRAP __BIT(12) +#define ET_RXSTAT_POS_INDEX_MASK 0x00000FFF +#define ET_RXSTAT_POS_WRAP 0x00001000 #define ET_RXSTAT_MINCNT 0x2038 @@ -256,8 +208,8 @@ #define ET_RX_RING0_CNT 0x2044 #define ET_RX_RING0_POS 0x204c -#define ET_RX_RING0_POS_INDEX __BITS(9, 0) -#define ET_RX_RING0_POS_WRAP __BIT(10) +#define ET_RX_RING0_POS_INDEX_MASK 0x000003FF +#define ET_RX_RING0_POS_WRAP 0x00000400 #define ET_RX_RING0_MINCNT 0x2054 @@ -266,21 +218,21 @@ #define ET_RX_RING1_CNT 0x2060 #define ET_RX_RING1_POS 0x2068 -#define ET_RX_RING1_POS_INDEX __BITS(9, 0) -#define ET_RX_RING1_POS_WRAP __BIT(10) +#define ET_RX_RING1_POS_INDEX 0x000003FF +#define ET_RX_RING1_POS_WRAP 0x00000400 #define ET_RX_RING1_MINCNT 0x2070 #define ET_TXMAC_CTRL 0x3000 -#define ET_TXMAC_CTRL_ENABLE __BIT(0) -#define ET_TXMAC_CTRL_FC_DISABLE __BIT(3) +#define ET_TXMAC_CTRL_ENABLE 0x00000001 +#define ET_TXMAC_CTRL_FC_DISABLE 0x00000008 #define ET_TXMAC_FLOWCTRL 0x3010 #define ET_RXMAC_CTRL 0x4000 -#define ET_RXMAC_CTRL_ENABLE __BIT(0) -#define ET_RXMAC_CTRL_NO_PKTFILT __BIT(2) -#define ET_RXMAC_CTRL_WOL_DISABLE __BIT(3) +#define ET_RXMAC_CTRL_ENABLE 0x00000001 +#define ET_RXMAC_CTRL_NO_PKTFILT 0x00000004 +#define ET_RXMAC_CTRL_WOL_DISABLE 0x00000008 #define ET_WOL_CRC 0x4004 #define ET_WOL_SA_LO 0x4010 @@ -294,16 +246,17 @@ #define ET_MULTI_HASH 0x4074 #define ET_PKTFILT 0x4084 -#define ET_PKTFILT_BCAST __BIT(0) -#define ET_PKTFILT_MCAST __BIT(1) -#define ET_PKTFILT_UCAST __BIT(2) -#define ET_PKTFILT_FRAG __BIT(3) -#define ET_PKTFILT_MINLEN __BITS(22, 16) +#define ET_PKTFILT_BCAST 0x00000001 +#define ET_PKTFILT_MCAST 0x00000002 +#define ET_PKTFILT_UCAST 0x00000004 +#define ET_PKTFILT_FRAG 0x00000008 +#define ET_PKTFILT_MINLEN_MASK 0x007F0000 +#define ET_PKTFILT_MINLEN_SHIFT 16 #define ET_RXMAC_MC_SEGSZ 0x4088 -#define ET_RXMAC_MC_SEGSZ_ENABLE __BIT(0) -#define ET_RXMAC_MC_SEGSZ_FC __BIT(1) -#define ET_RXMAC_MC_SEGSZ_MAX __BITS(9, 2) +#define ET_RXMAC_MC_SEGSZ_ENABLE 0x00000001 +#define ET_RXMAC_MC_SEGSZ_FC 0x00000002 +#define ET_RXMAC_MC_SEGSZ_MAX_MASK 0x000003FC #define ET_RXMAC_SEGSZ(segsz) ((segsz) / ET_MEM_UNIT) #define ET_RXMAC_CUT_THRU_FRMLEN 8074 @@ -311,110 +264,121 @@ #define ET_RXMAC_SPACE_AVL 0x4094 #define ET_RXMAC_MGT 0x4098 -#define ET_RXMAC_MGT_PASS_ECRC __BIT(4) -#define ET_RXMAC_MGT_PASS_ELEN __BIT(5) -#define ET_RXMAC_MGT_PASS_ETRUNC __BIT(16) -#define ET_RXMAC_MGT_CHECK_PKT __BIT(17) +#define ET_RXMAC_MGT_PASS_ECRC 0x00000010 +#define ET_RXMAC_MGT_PASS_ELEN 0x00000020 +#define ET_RXMAC_MGT_PASS_ETRUNC 0x00010000 +#define ET_RXMAC_MGT_CHECK_PKT 0x00020000 #define ET_MAC_CFG1 0x5000 -#define ET_MAC_CFG1_TXEN __BIT(0) -#define ET_MAC_CFG1_SYNC_TXEN __BIT(1) -#define ET_MAC_CFG1_RXEN __BIT(2) -#define ET_MAC_CFG1_SYNC_RXEN __BIT(3) -#define ET_MAC_CFG1_TXFLOW __BIT(4) -#define ET_MAC_CFG1_RXFLOW __BIT(5) -#define ET_MAC_CFG1_LOOPBACK __BIT(8) -#define ET_MAC_CFG1_RST_TXFUNC __BIT(16) -#define ET_MAC_CFG1_RST_RXFUNC __BIT(17) -#define ET_MAC_CFG1_RST_TXMC __BIT(18) -#define ET_MAC_CFG1_RST_RXMC __BIT(19) -#define ET_MAC_CFG1_SIM_RST __BIT(30) -#define ET_MAC_CFG1_SOFT_RST __BIT(31) +#define ET_MAC_CFG1_TXEN 0x00000001 +#define ET_MAC_CFG1_SYNC_TXEN 0x00000002 +#define ET_MAC_CFG1_RXEN 0x00000004 +#define ET_MAC_CFG1_SYNC_RXEN 0x00000008 +#define ET_MAC_CFG1_TXFLOW 0x00000010 +#define ET_MAC_CFG1_RXFLOW 0x00000020 +#define ET_MAC_CFG1_LOOPBACK 0x00000100 +#define ET_MAC_CFG1_RST_TXFUNC 0x00010000 +#define ET_MAC_CFG1_RST_RXFUNC 0x00020000 +#define ET_MAC_CFG1_RST_TXMC 0x00040000 +#define ET_MAC_CFG1_RST_RXMC 0x00080000 +#define ET_MAC_CFG1_SIM_RST 0x40000000 +#define ET_MAC_CFG1_SOFT_RST 0x80000000 #define ET_MAC_CFG2 0x5004 -#define ET_MAC_CFG2_FDX __BIT(0) -#define ET_MAC_CFG2_CRC __BIT(1) -#define ET_MAC_CFG2_PADCRC __BIT(2) -#define ET_MAC_CFG2_LENCHK __BIT(4) -#define ET_MAC_CFG2_BIGFRM __BIT(5) -#define ET_MAC_CFG2_MODE_MII __BIT(8) -#define ET_MAC_CFG2_MODE_GMII __BIT(9) -#define ET_MAC_CFG2_PREAMBLE_LEN __BITS(15, 12) +#define ET_MAC_CFG2_FDX 0x00000001 +#define ET_MAC_CFG2_CRC 0x00000002 +#define ET_MAC_CFG2_PADCRC 0x00000004 +#define ET_MAC_CFG2_LENCHK 0x00000010 +#define ET_MAC_CFG2_BIGFRM 0x00000020 +#define ET_MAC_CFG2_MODE_MII 0x00000100 +#define ET_MAC_CFG2_MODE_GMII 0x00000200 +#define ET_MAC_CFG2_PREAMBLE_LEN_MASK 0x0000F000 +#define ET_MAC_CFG2_PREAMBLE_LEN_SHIFT 12 #define ET_IPG 0x5008 -#define ET_IPG_B2B __BITS(6, 0) -#define ET_IPG_MINIFG __BITS(15, 8) -#define ET_IPG_NONB2B_2 __BITS(22, 16) -#define ET_IPG_NONB2B_1 __BITS(30, 24) +#define ET_IPG_B2B_MASK 0x0000007F +#define ET_IPG_MINIFG_MASK 0x0000FF00 +#define ET_IPG_NONB2B_2_MASK 0x007F0000 +#define ET_IPG_NONB2B_1_MASK 0x7F000000 +#define ET_IPG_B2B_SHIFT 0 +#define ET_IPG_MINIFG_SHIFT 8 +#define ET_IPG_NONB2B_2_SHIFT 16 +#define ET_IPG_NONB2B_1_SHIFT 24 #define ET_MAC_HDX 0x500c -#define ET_MAC_HDX_COLLWIN __BITS(9, 0) -#define ET_MAC_HDX_REXMIT_MAX __BITS(15, 12) -#define ET_MAC_HDX_EXC_DEFER __BIT(16) -#define ET_MAC_HDX_NOBACKOFF __BIT(17) -#define ET_MAC_HDX_BP_NOBACKOFF __BIT(18) -#define ET_MAC_HDX_ALT_BEB __BIT(19) -#define ET_MAC_HDX_ALT_BEB_TRUNC __BITS(23, 20) +#define ET_MAC_HDX_COLLWIN_MASK 0x000003FF +#define ET_MAC_HDX_REXMIT_MAX_MASK 0x0000F000 +#define ET_MAC_HDX_EXC_DEFER 0x00010000 +#define ET_MAC_HDX_NOBACKOFF 0x00020000 +#define ET_MAC_HDX_BP_NOBACKOFF 0x00040000 +#define ET_MAC_HDX_ALT_BEB 0x00080000 +#define ET_MAC_HDX_ALT_BEB_TRUNC_MASK 0x00F00000 +#define ET_MAC_HDX_COLLWIN_SHIFT 0 +#define ET_MAC_HDX_REXMIT_MAX_SHIFT 12 +#define ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT 20 #define ET_MAX_FRMLEN 0x5010 #define ET_MII_CFG 0x5020 -#define ET_MII_CFG_CLKRST __BITS(2, 0) -#define ET_MII_CFG_PREAMBLE_SUP __BIT(4) -#define ET_MII_CFG_SCAN_AUTOINC __BIT(5) -#define ET_MII_CFG_RST __BIT(31) +#define ET_MII_CFG_CLKRST 0x00000007 +#define ET_MII_CFG_PREAMBLE_SUP 0x00000010 +#define ET_MII_CFG_SCAN_AUTOINC 0x00000020 +#define ET_MII_CFG_RST 0x80000000 #define ET_MII_CMD 0x5024 -#define ET_MII_CMD_READ __BIT(0) +#define ET_MII_CMD_READ 0x00000001 #define ET_MII_ADDR 0x5028 -#define ET_MII_ADDR_REG __BITS(4, 0) -#define ET_MII_ADDR_PHY __BITS(12, 8) +#define ET_MII_ADDR_REG_MASK 0x0000001F +#define ET_MII_ADDR_PHY_MASK 0x00001F00 +#define ET_MII_ADDR_REG_SHIFT 0 +#define ET_MII_ADDR_PHY_SHIFT 8 #define ET_MII_CTRL 0x502c -#define ET_MII_CTRL_VALUE __BITS(15, 0) +#define ET_MII_CTRL_VALUE_MASK 0x0000FFFF +#define ET_MII_CTRL_VALUE_SHIFT 0 #define ET_MII_STAT 0x5030 -#define ET_MII_STAT_VALUE __BITS(15, 0) +#define ET_MII_STAT_VALUE_MASK 0x0000FFFF #define ET_MII_IND 0x5034 -#define ET_MII_IND_BUSY __BIT(0) -#define ET_MII_IND_INVALID __BIT(2) +#define ET_MII_IND_BUSY 0x00000001 +#define ET_MII_IND_INVALID 0x00000004 #define ET_MAC_CTRL 0x5038 -#define ET_MAC_CTRL_MODE_MII __BIT(24) -#define ET_MAC_CTRL_LHDX __BIT(25) -#define ET_MAC_CTRL_GHDX __BIT(26) +#define ET_MAC_CTRL_MODE_MII 0x01000000 +#define ET_MAC_CTRL_LHDX 0x02000000 +#define ET_MAC_CTRL_GHDX 0x04000000 #define ET_MAC_ADDR1 0x5040 #define ET_MAC_ADDR2 0x5044 #define ET_MMC_CTRL 0x7000 -#define ET_MMC_CTRL_ENABLE __BIT(0) -#define ET_MMC_CTRL_ARB_DISABLE __BIT(1) -#define ET_MMC_CTRL_RXMAC_DISABLE __BIT(2) -#define ET_MMC_CTRL_TXMAC_DISABLE __BIT(3) -#define ET_MMC_CTRL_TXDMA_DISABLE __BIT(4) -#define ET_MMC_CTRL_RXDMA_DISABLE __BIT(5) -#define ET_MMC_CTRL_FORCE_CE __BIT(6) +#define ET_MMC_CTRL_ENABLE 0x00000001 +#define ET_MMC_CTRL_ARB_DISABLE 0x00000002 +#define ET_MMC_CTRL_RXMAC_DISABLE 0x00000004 +#define ET_MMC_CTRL_TXMAC_DISABLE 0x00000008 +#define ET_MMC_CTRL_TXDMA_DISABLE 0x00000010 +#define ET_MMC_CTRL_RXDMA_DISABLE 0x00000020 +#define ET_MMC_CTRL_FORCE_CE 0x00000040 /* * Interrupts */ -#define ET_INTR_TXEOF __BIT(3) -#define ET_INTR_TXDMA_ERROR __BIT(4) -#define ET_INTR_RXEOF __BIT(5) -#define ET_INTR_RXRING0_LOW __BIT(6) -#define ET_INTR_RXRING1_LOW __BIT(7) -#define ET_INTR_RXSTAT_LOW __BIT(8) -#define ET_INTR_RXDMA_ERROR __BIT(9) -#define ET_INTR_TIMER __BIT(14) -#define ET_INTR_WOL __BIT(15) -#define ET_INTR_PHY __BIT(16) -#define ET_INTR_TXMAC __BIT(17) -#define ET_INTR_RXMAC __BIT(18) -#define ET_INTR_MAC_STATS __BIT(19) -#define ET_INTR_SLAVE_TO __BIT(20) +#define ET_INTR_TXEOF 0x00000008 +#define ET_INTR_TXDMA_ERROR 0x00000010 +#define ET_INTR_RXEOF 0x00000020 +#define ET_INTR_RXRING0_LOW 0x00000040 +#define ET_INTR_RXRING1_LOW 0x00000080 +#define ET_INTR_RXSTAT_LOW 0x00000100 +#define ET_INTR_RXDMA_ERROR 0x00000200 +#define ET_INTR_TIMER 0x00004000 +#define ET_INTR_WOL 0x00008000 +#define ET_INTR_PHY 0x00010000 +#define ET_INTR_TXMAC 0x00020000 +#define ET_INTR_RXMAC 0x00040000 +#define ET_INTR_MAC_STATS 0x00080000 +#define ET_INTR_SLAVE_TO 0x00100000 #define ET_INTRS (ET_INTR_TXEOF | \ ET_INTR_RXEOF | \ @@ -423,8 +387,8 @@ /* * RX ring position uses same layout */ -#define ET_RX_RING_POS_INDEX __BITS(9, 0) -#define ET_RX_RING_POS_WRAP __BIT(10) +#define ET_RX_RING_POS_INDEX_MASK 0x000003FF +#define ET_RX_RING_POS_WRAP 0x00000400 /* * PCI IDs Modified: stable/7/sys/dev/et/if_etvar.h ============================================================================== --- stable/7/sys/dev/et/if_etvar.h Mon Dec 21 18:07:15 2009 (r200783) +++ stable/7/sys/dev/et/if_etvar.h Mon Dec 21 18:09:41 2009 (r200784) @@ -106,11 +106,11 @@ struct et_txdesc { uint32_t td_ctrl2; /* ET_TDCTRL2_ */ } __packed; -#define ET_TDCTRL1_LEN __BITS(15, 0) +#define ET_TDCTRL1_LEN_MASK 0x0000FFFF -#define ET_TDCTRL2_LAST_FRAG __BIT(0) -#define ET_TDCTRL2_FIRST_FRAG __BIT(1) -#define ET_TDCTRL2_INTR __BIT(2) +#define ET_TDCTRL2_LAST_FRAG 0x00000001 +#define ET_TDCTRL2_FIRST_FRAG 0x00000002 +#define ET_TDCTRL2_INTR 0x00000004 struct et_rxdesc { uint32_t rd_addr_lo; @@ -118,24 +118,28 @@ struct et_rxdesc { uint32_t rd_ctrl; /* ET_RDCTRL_ */ } __packed; -#define ET_RDCTRL_BUFIDX __BITS(9, 0) +#define ET_RDCTRL_BUFIDX_MASK 0x000003FF struct et_rxstat { uint32_t rxst_info1; uint32_t rxst_info2; /* ET_RXST_INFO2_ */ } __packed; -#define ET_RXST_INFO2_LEN __BITS(15, 0) -#define ET_RXST_INFO2_BUFIDX __BITS(25, 16) -#define ET_RXST_INFO2_RINGIDX __BITS(27, 26) +#define ET_RXST_INFO2_LEN_MASK 0x0000FFFF +#define ET_RXST_INFO2_LEN_SHIFT 0 +#define ET_RXST_INFO2_BUFIDX_MASK 0x03FF0000 +#define ET_RXST_INFO2_BUFIDX_SHIFT 16 +#define ET_RXST_INFO2_RINGIDX_MASK 0x0C000000 +#define ET_RXST_INFO2_RINGIDX_SHIFT 26 struct et_rxstatus { uint32_t rxs_ring; uint32_t rxs_stat_ring; /* ET_RXS_STATRING_ */ } __packed; -#define ET_RXS_STATRING_INDEX __BITS(27, 16) -#define ET_RXS_STATRING_WRAP __BIT(28) +#define ET_RXS_STATRING_INDEX_MASK 0x0FFF0000 +#define ET_RXS_STATRING_INDEX_SHIFT 16 +#define ET_RXS_STATRING_WRAP 0x10000000 struct et_dmamap_ctx { int nsegs; From owner-svn-src-stable-7@FreeBSD.ORG Mon Dec 21 18:18:10 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DC9B106566C; Mon, 21 Dec 2009 18:18:10 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B6D38FC13; Mon, 21 Dec 2009 18:18: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 nBLIIAA6036007; Mon, 21 Dec 2009 18:18:10 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLIIAgk036004; Mon, 21 Dec 2009 18:18:10 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200912211818.nBLIIAgk036004@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 21 Dec 2009 18:18:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200786 - stable/7/sys/dev/et X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 18:18:10 -0000 Author: yongari Date: Mon Dec 21 18:18:10 2009 New Revision: 200786 URL: http://svn.freebsd.org/changeset/base/200786 Log: MFC r199550-199552: r199550: Remove support code for FreeBSD 6.x versions. r199551: Destroy driver mutex in device detach. r199552: Add MSI support. Modified: stable/7/sys/dev/et/if_et.c stable/7/sys/dev/et/if_etvar.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/et/if_et.c ============================================================================== --- stable/7/sys/dev/et/if_et.c Mon Dec 21 18:16:07 2009 (r200785) +++ stable/7/sys/dev/et/if_et.c Mon Dec 21 18:18:10 2009 (r200786) @@ -76,6 +76,10 @@ MODULE_DEPEND(et, pci, 1, 1, 1); MODULE_DEPEND(et, ether, 1, 1, 1); MODULE_DEPEND(et, miibus, 1, 1, 1); +/* Tunables. */ +static int msi_disable = 0; +TUNABLE_INT("hw.re.msi_disable", &msi_disable); + static int et_probe(device_t); static int et_attach(device_t); static int et_detach(device_t); @@ -230,7 +234,7 @@ et_attach(device_t dev) struct et_softc *sc; struct ifnet *ifp; uint8_t eaddr[ETHER_ADDR_LEN]; - int error; + int cap, error, msic; sc = device_get_softc(dev); sc->dev = dev; @@ -268,13 +272,38 @@ et_attach(device_t dev) sc->sc_mem_bt = rman_get_bustag(sc->sc_mem_res); sc->sc_mem_bh = rman_get_bushandle(sc->sc_mem_res); + msic = 0; + if (pci_find_extcap(dev, PCIY_EXPRESS, &cap) == 0) { + sc->sc_expcap = cap; + sc->sc_flags |= ET_FLAG_PCIE; + msic = pci_msi_count(dev); + if (bootverbose) + device_printf(dev, "MSI count : %d\n", msic); + } + if (msic > 0 && msi_disable == 0) { + msic = 1; + if (pci_alloc_msi(dev, &msic) == 0) { + if (msic == 1) { + device_printf(dev, "Using %d MSI message\n", + msic); + sc->sc_flags |= ET_FLAG_MSI; + } else + pci_release_msi(dev); + } + } + /* * Allocate IRQ */ - sc->sc_irq_rid = 0; - sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->sc_irq_rid, - RF_SHAREABLE | RF_ACTIVE); + if ((sc->sc_flags & ET_FLAG_MSI) == 0) { + sc->sc_irq_rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &sc->sc_irq_rid, RF_SHAREABLE | RF_ACTIVE); + } else { + sc->sc_irq_rid = 1; + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &sc->sc_irq_rid, RF_ACTIVE); + } if (sc->sc_irq_res == NULL) { device_printf(dev, "can't allocate irq\n"); error = ENXIO; @@ -322,14 +351,8 @@ et_attach(device_t dev) ether_ifattach(ifp, eaddr); callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0); -#if __FreeBSD_version > 700030 - error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_NET | INTR_MPSAFE, - NULL, et_intr, sc, &sc->sc_irq_handle); -#else error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_NET | INTR_MPSAFE, - et_intr, sc, &sc->sc_irq_handle); -#endif - + NULL, et_intr, sc, &sc->sc_irq_handle); if (error) { ether_ifdetach(ifp); device_printf(dev, "can't setup intr\n"); @@ -368,6 +391,8 @@ et_detach(device_t dev) bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, sc->sc_irq_res); } + if ((sc->sc_flags & ET_FLAG_MSI) != 0) + pci_release_msi(dev); if (sc->sc_mem_res != NULL) { bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_mem_rid, @@ -378,7 +403,8 @@ et_detach(device_t dev) if_free(sc->ifp); et_dma_free(dev); - /* XXX Destroy lock here */ + + mtx_destroy(&sc->sc_mtx); return 0; } @@ -1437,7 +1463,8 @@ et_chip_init(struct et_softc *sc) CSR_WRITE_4(sc, ET_LOOPBACK, 0); /* Clear MSI configure */ - CSR_WRITE_4(sc, ET_MSI_CFG, 0); + if ((sc->sc_flags & ET_FLAG_MSI) == 0) + CSR_WRITE_4(sc, ET_MSI_CFG, 0); /* Disable timer */ CSR_WRITE_4(sc, ET_TIMER, 0); Modified: stable/7/sys/dev/et/if_etvar.h ============================================================================== --- stable/7/sys/dev/et/if_etvar.h Mon Dec 21 18:16:07 2009 (r200785) +++ stable/7/sys/dev/et/if_etvar.h Mon Dec 21 18:18:10 2009 (r200786) @@ -238,6 +238,7 @@ struct et_softc { struct arpcom arpcom; int sc_if_flags; uint32_t sc_flags; /* ET_FLAG_ */ + int sc_expcap; int sc_mem_rid; @@ -277,7 +278,9 @@ struct et_softc { #define ET_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define ET_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) -#define ET_FLAG_TXRX_ENABLED 0x1 -#define ET_FLAG_JUMBO 0x2 +#define ET_FLAG_PCIE 0x0001 +#define ET_FLAG_MSI 0x0002 +#define ET_FLAG_TXRX_ENABLED 0x0100 +#define ET_FLAG_JUMBO 0x0200 #endif /* !_IF_ETVAR_H */ From owner-svn-src-stable-7@FreeBSD.ORG Mon Dec 21 18:30:25 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 447CB1065672; Mon, 21 Dec 2009 18:30:25 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 317248FC14; Mon, 21 Dec 2009 18:30: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 nBLIUPDo036406; Mon, 21 Dec 2009 18:30:25 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLIUPq4036402; Mon, 21 Dec 2009 18:30:25 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200912211830.nBLIUPq4036402@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 21 Dec 2009 18:30:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200788 - stable/7/sys/dev/et X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 18:30:25 -0000 Author: yongari Date: Mon Dec 21 18:30:24 2009 New Revision: 200788 URL: http://svn.freebsd.org/changeset/base/200788 Log: MFC r199553,199556 r199553: Remove extra spce at the EOL. r199556: style(9) Modified: stable/7/sys/dev/et/if_et.c stable/7/sys/dev/et/if_etreg.h stable/7/sys/dev/et/if_etvar.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/et/if_et.c ============================================================================== --- stable/7/sys/dev/et/if_et.c Mon Dec 21 18:28:37 2009 (r200787) +++ stable/7/sys/dev/et/if_et.c Mon Dec 21 18:30:24 2009 (r200788) @@ -222,10 +222,10 @@ et_probe(device_t dev) for (d = et_devices; d->desc != NULL; ++d) { if (vid == d->vid && did == d->did) { device_set_desc(dev, d->desc); - return 0; + return (0); } } - return ENXIO; + return (ENXIO); } static int @@ -267,7 +267,7 @@ et_attach(device_t dev) &sc->sc_mem_rid, RF_ACTIVE); if (sc->sc_mem_res == NULL) { device_printf(dev, "can't allocate IO memory\n"); - return ENXIO; + return (ENXIO); } sc->sc_mem_bt = rman_get_bustag(sc->sc_mem_res); sc->sc_mem_bh = rman_get_bushandle(sc->sc_mem_res); @@ -361,10 +361,10 @@ et_attach(device_t dev) et_add_sysctls(sc); - return 0; + return (0); fail: et_detach(dev); - return error; + return (error); } static int @@ -406,7 +406,7 @@ et_detach(device_t dev) mtx_destroy(&sc->sc_mtx); - return 0; + return (0); } static int @@ -417,7 +417,7 @@ et_shutdown(device_t dev) ET_LOCK(sc); et_stop(sc); ET_UNLOCK(sc); - return 0; + return (0); } static int @@ -460,7 +460,7 @@ et_miibus_readreg(device_t dev, int phy, back: /* Make sure that the current operation is stopped */ CSR_WRITE_4(sc, ET_MII_CMD, 0); - return ret; + return (ret); } static int @@ -499,7 +499,7 @@ et_miibus_writereg(device_t dev, int phy /* Make sure that the current operation is stopped */ CSR_WRITE_4(sc, ET_MII_CMD, 0); - return 0; + return (0); } static void @@ -522,7 +522,7 @@ et_ifmedia_upd_locked(struct ifnet *ifp) } mii_mediachg(mii); - return 0; + return (0); } static int @@ -535,7 +535,7 @@ et_ifmedia_upd(struct ifnet *ifp) res = et_ifmedia_upd_locked(ifp); ET_UNLOCK(sc); - return res; + return (res); } static void @@ -590,7 +590,7 @@ et_bus_config(device_t dev) val = pci_read_config(dev, ET_PCIR_EEPROM_STATUS, 1); if (val & ET_PCIM_EEPROM_STATUS_ERROR) { device_printf(dev, "EEPROM status error 0x%02x\n", val); - return ENXIO; + return (ENXIO); } /* TODO: LED */ @@ -644,7 +644,7 @@ et_bus_config(device_t dev) val |= ET_PCIV_DEVICE_CTRL_RRSZ_2K; pci_write_config(dev, ET_PCIR_DEVICE_CTRL, val, 2); - return 0; + return (0); } static void @@ -716,7 +716,7 @@ et_dma_alloc(device_t dev) 0, NULL, NULL, &sc->sc_dtag); if (error) { device_printf(dev, "can't create DMA tag\n"); - return error; + return (error); } /* @@ -727,7 +727,7 @@ et_dma_alloc(device_t dev) &tx_ring->tr_paddr, &tx_ring->tr_dmap); if (error) { device_printf(dev, "can't create TX ring DMA stuffs\n"); - return error; + return (error); } /* @@ -738,7 +738,7 @@ et_dma_alloc(device_t dev) &txsd->txsd_paddr, &txsd->txsd_dmap); if (error) { device_printf(dev, "can't create TX status DMA stuffs\n"); - return error; + return (error); } /* @@ -758,7 +758,7 @@ et_dma_alloc(device_t dev) if (error) { device_printf(dev, "can't create DMA stuffs for " "the %d RX ring\n", i); - return error; + return (error); } rx_ring->rr_posreg = rx_ring_posreg[i]; } @@ -772,7 +772,7 @@ et_dma_alloc(device_t dev) &rxst_ring->rsr_paddr, &rxst_ring->rsr_dmap); if (error) { device_printf(dev, "can't create RX stat ring DMA stuffs\n"); - return error; + return (error); } /* @@ -784,7 +784,7 @@ et_dma_alloc(device_t dev) &rxsd->rxsd_paddr, &rxsd->rxsd_dmap); if (error) { device_printf(dev, "can't create RX status DMA stuffs\n"); - return error; + return (error); } /* @@ -792,9 +792,9 @@ et_dma_alloc(device_t dev) */ error = et_dma_mbuf_create(dev); if (error) - return error; + return (error); - return 0; + return (0); } static void @@ -873,7 +873,7 @@ et_dma_mbuf_create(device_t dev) BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_mbuf_dtag); if (error) { device_printf(dev, "can't create mbuf DMA tag\n"); - return error; + return (error); } /* @@ -884,7 +884,7 @@ et_dma_mbuf_create(device_t dev) device_printf(dev, "can't create spare mbuf DMA map\n"); bus_dma_tag_destroy(sc->sc_mbuf_dtag); sc->sc_mbuf_dtag = NULL; - return error; + return (error); } /* @@ -903,7 +903,7 @@ et_dma_mbuf_create(device_t dev) "for %d RX ring\n", j, i); rx_done[i] = j; et_dma_mbuf_destroy(dev, 0, rx_done); - return error; + return (error); } } rx_done[i] = ET_RX_NDESC; @@ -922,11 +922,11 @@ et_dma_mbuf_create(device_t dev) device_printf(dev, "can't create %d TX mbuf " "DMA map\n", i); et_dma_mbuf_destroy(dev, i, rx_done); - return error; + return (error); } } - return 0; + return (0); } static void @@ -991,7 +991,7 @@ et_dma_mem_create(device_t dev, bus_size 0, NULL, NULL, dtag); if (error) { device_printf(dev, "can't create DMA tag\n"); - return error; + return (error); } error = bus_dmamem_alloc(*dtag, addr, BUS_DMA_WAITOK | BUS_DMA_ZERO, @@ -1000,7 +1000,7 @@ et_dma_mem_create(device_t dev, bus_size device_printf(dev, "can't allocate DMA mem\n"); bus_dma_tag_destroy(*dtag); *dtag = NULL; - return error; + return (error); } error = bus_dmamap_load(*dtag, *dmap, *addr, size, @@ -1010,9 +1010,9 @@ et_dma_mem_create(device_t dev, bus_size bus_dmamem_free(*dtag, *addr, *dmap); bus_dma_tag_destroy(*dtag); *dtag = NULL; - return error; + return (error); } - return 0; + return (0); } static void @@ -1230,7 +1230,7 @@ et_ioctl(struct ifnet *ifp, u_long cmd, error = ether_ioctl(ifp, cmd, data); break; } - return error; + return (error); } static void @@ -1309,9 +1309,9 @@ et_stop_rxdma(struct et_softc *sc) DELAY(5); if ((CSR_READ_4(sc, ET_RXDMA_CTRL) & ET_RXDMA_CTRL_HALTED) == 0) { if_printf(sc->ifp, "can't stop RX DMA engine\n"); - return ETIMEDOUT; + return (ETIMEDOUT); } - return 0; + return (0); } static int @@ -1319,7 +1319,7 @@ et_stop_txdma(struct et_softc *sc) { CSR_WRITE_4(sc, ET_TXDMA_CTRL, ET_TXDMA_CTRL_HALT | ET_TXDMA_CTRL_SINGLE_EPKT); - return 0; + return (0); } static void @@ -1358,7 +1358,7 @@ et_free_rx_ring(struct et_softc *sc) struct et_rxbuf *rb = &rbd->rbd_buf[i]; if (rb->rb_mbuf != NULL) { - bus_dmamap_unload(sc->sc_mbuf_dtag, + bus_dmamap_unload(sc->sc_mbuf_dtag, rb->rb_dmap); m_freem(rb->rb_mbuf); rb->rb_mbuf = NULL; @@ -1484,14 +1484,14 @@ et_chip_init(struct et_softc *sc) /* Initialize RX DMA engine */ error = et_init_rxdma(sc); if (error) - return error; + return (error); /* Initialize TX DMA engine */ error = et_init_txdma(sc); if (error) - return error; + return (error); - return 0; + return (0); } static int @@ -1512,7 +1512,7 @@ et_init_tx_ring(struct et_softc *sc) bzero(txsd->txsd_status, sizeof(uint32_t)); bus_dmamap_sync(txsd->txsd_dtag, txsd->txsd_dmap, BUS_DMASYNC_PREWRITE); - return 0; + return (0); } static int @@ -1531,7 +1531,7 @@ et_init_rx_ring(struct et_softc *sc) if (error) { if_printf(sc->ifp, "%d ring %d buf, " "newbuf failed: %d\n", n, i, error); - return error; + return (error); } } } @@ -1544,7 +1544,7 @@ et_init_rx_ring(struct et_softc *sc) bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap, BUS_DMASYNC_PREWRITE); - return 0; + return (0); } static void @@ -1578,7 +1578,7 @@ et_init_rxdma(struct et_softc *sc) error = et_stop_rxdma(sc); if (error) { if_printf(sc->ifp, "can't init RX DMA engine\n"); - return error; + return (error); } /* @@ -1634,7 +1634,7 @@ et_init_rxdma(struct et_softc *sc) CSR_WRITE_4(sc, ET_RX_INTR_NPKTS, sc->sc_rx_intr_npkts); CSR_WRITE_4(sc, ET_RX_INTR_DELAY, sc->sc_rx_intr_delay); - return 0; + return (0); } static int @@ -1647,7 +1647,7 @@ et_init_txdma(struct et_softc *sc) error = et_stop_txdma(sc); if (error) { if_printf(sc->ifp, "can't init TX DMA engine\n"); - return error; + return (error); } /* @@ -1669,7 +1669,7 @@ et_init_txdma(struct et_softc *sc) tx_ring->tr_ready_index = 0; tx_ring->tr_ready_wrap = 0; - return 0; + return (0); } static void @@ -1839,16 +1839,16 @@ et_start_rxdma(struct et_softc *sc) if (CSR_READ_4(sc, ET_RXDMA_CTRL) & ET_RXDMA_CTRL_HALTED) { if_printf(sc->ifp, "can't start RX DMA engine\n"); - return ETIMEDOUT; + return (ETIMEDOUT); } - return 0; + return (0); } static int et_start_txdma(struct et_softc *sc) { CSR_WRITE_4(sc, ET_TXDMA_CTRL, ET_TXDMA_CTRL_SINGLE_EPKT); - return 0; + return (0); } static int @@ -1881,7 +1881,7 @@ et_enable_txrx(struct et_softc *sc, int } if (i == NRETRY) { if_printf(ifp, "can't enable RX/TX\n"); - return 0; + return (0); } sc->sc_flags |= ET_FLAG_TXRX_ENABLED; @@ -1892,13 +1892,13 @@ et_enable_txrx(struct et_softc *sc, int */ error = et_start_rxdma(sc); if (error) - return error; + return (error); error = et_start_txdma(sc); if (error) - return error; + return (error); - return 0; + return (0); } static void @@ -2130,7 +2130,7 @@ back: m_freem(m); *m0 = NULL; } - return error; + return (error); } static void @@ -2218,13 +2218,13 @@ et_tick(void *xsc) static int et_newbuf_cluster(struct et_rxbuf_data *rbd, int buf_idx, int init) { - return et_newbuf(rbd, buf_idx, init, MCLBYTES); + return (et_newbuf(rbd, buf_idx, init, MCLBYTES)); } static int et_newbuf_hdr(struct et_rxbuf_data *rbd, int buf_idx, int init) { - return et_newbuf(rbd, buf_idx, init, MHLEN); + return (et_newbuf(rbd, buf_idx, init, MHLEN)); } static int @@ -2248,7 +2248,7 @@ et_newbuf(struct et_rxbuf_data *rbd, int if (init) { if_printf(sc->ifp, "m_getl failed, size %d\n", len0); - return error; + return (error); } else { goto back; } @@ -2275,7 +2275,7 @@ et_newbuf(struct et_rxbuf_data *rbd, int if (init) { if_printf(sc->ifp, "can't load RX mbuf\n"); - return error; + return (error); } else { goto back; } @@ -2299,7 +2299,7 @@ et_newbuf(struct et_rxbuf_data *rbd, int error = 0; back: et_setup_rxdesc(rbd, buf_idx, rb->rb_paddr); - return error; + return (error); } /* @@ -2349,7 +2349,7 @@ et_sysctl_rx_intr_npkts(SYSCTL_HANDLER_A sc->sc_rx_intr_npkts = v; } back: - return error; + return (error); } static int @@ -2374,7 +2374,7 @@ et_sysctl_rx_intr_delay(SYSCTL_HANDLER_A sc->sc_rx_intr_delay = v; } back: - return error; + return (error); } static void Modified: stable/7/sys/dev/et/if_etreg.h ============================================================================== --- stable/7/sys/dev/et/if_etreg.h Mon Dec 21 18:28:37 2009 (r200787) +++ stable/7/sys/dev/et/if_etreg.h Mon Dec 21 18:30:24 2009 (r200788) @@ -1,13 +1,13 @@ /*- * Copyright (c) 2007 The DragonFly Project. All rights reserved. - * + * * This code is derived from software contributed to The DragonFly Project * by Sepherosa Ziehau - * + * * 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 @@ -17,7 +17,7 @@ * 3. Neither the name of The DragonFly Project nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific, prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -30,7 +30,7 @@ * 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. - * + * * $DragonFly: src/sys/dev/netif/et/if_etreg.h,v 1.3 2007/10/23 14:28:42 sephe Exp $ * $FreeBSD$ */ Modified: stable/7/sys/dev/et/if_etvar.h ============================================================================== --- stable/7/sys/dev/et/if_etvar.h Mon Dec 21 18:28:37 2009 (r200787) +++ stable/7/sys/dev/et/if_etvar.h Mon Dec 21 18:30:24 2009 (r200788) @@ -1,13 +1,13 @@ /*- * Copyright (c) 2007 The DragonFly Project. All rights reserved. - * + * * This code is derived from software contributed to The DragonFly Project * by Sepherosa Ziehau - * + * * 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 @@ -17,7 +17,7 @@ * 3. Neither the name of The DragonFly Project nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific, prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -30,7 +30,7 @@ * 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. - * + * * $DragonFly: src/sys/dev/netif/et/if_etvar.h,v 1.4 2007/10/23 14:28:42 sephe Exp $ * $FreeBSD$ */ @@ -40,7 +40,7 @@ /* DragonFly compatibility */ #define EVL_ENCAPLEN ETHER_VLAN_ENCAP_LEN - + /* * Allocate the right type of mbuf for the desired total length. */ From owner-svn-src-stable-7@FreeBSD.ORG Mon Dec 21 18:36:15 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9A19106566B; Mon, 21 Dec 2009 18:36:15 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A74778FC12; Mon, 21 Dec 2009 18:36:15 +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 nBLIaFdv036667; Mon, 21 Dec 2009 18:36:15 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLIaFKI036664; Mon, 21 Dec 2009 18:36:15 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200912211836.nBLIaFKI036664@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 21 Dec 2009 18:36:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200790 - stable/7/sys/dev/et X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 18:36:15 -0000 Author: yongari Date: Mon Dec 21 18:36:15 2009 New Revision: 200790 URL: http://svn.freebsd.org/changeset/base/200790 Log: MFC r199558,199561 r199558: Use bus_{read,write}_4 rather than bus_space_{read,write}_4. r199561: Use capability pointer to access PCIe registers rather than directly access them at fixed address. Frequently the register offset could be changed if additional PCI capabilities are added to controller. One odd thing is ET_PCIR_L0S_L1_LATENCY register. I think it's PCIe link capabilities register but the location of the register does not match with PCIe capability pointer + offset. I'm not sure it's shadow register of PCIe link capabilities register. Modified: stable/7/sys/dev/et/if_et.c stable/7/sys/dev/et/if_etvar.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/et/if_et.c ============================================================================== --- stable/7/sys/dev/et/if_et.c Mon Dec 21 18:34:18 2009 (r200789) +++ stable/7/sys/dev/et/if_et.c Mon Dec 21 18:36:15 2009 (r200790) @@ -142,7 +142,7 @@ static int et_stop_rxdma(struct et_softc static int et_stop_txdma(struct et_softc *); static int et_enable_txrx(struct et_softc *, int); static void et_reset(struct et_softc *); -static int et_bus_config(device_t); +static int et_bus_config(struct et_softc *); static void et_get_eaddr(device_t, uint8_t[]); static void et_setmulti(struct et_softc *); static void et_tick(void *); @@ -269,8 +269,6 @@ et_attach(device_t dev) device_printf(dev, "can't allocate IO memory\n"); return (ENXIO); } - sc->sc_mem_bt = rman_get_bustag(sc->sc_mem_res); - sc->sc_mem_bh = rman_get_bushandle(sc->sc_mem_res); msic = 0; if (pci_find_extcap(dev, PCIY_EXPRESS, &cap) == 0) { @@ -310,7 +308,7 @@ et_attach(device_t dev) goto fail; } - error = et_bus_config(dev); + error = et_bus_config(sc); if (error) goto fail; @@ -577,7 +575,7 @@ et_stop(struct et_softc *sc) } static int -et_bus_config(device_t dev) +et_bus_config(struct et_softc *sc) { uint32_t val, max_plsz; uint16_t ack_latency, replay_timer; @@ -586,21 +584,25 @@ et_bus_config(device_t dev) * Test whether EEPROM is valid * NOTE: Read twice to get the correct value */ - pci_read_config(dev, ET_PCIR_EEPROM_STATUS, 1); - val = pci_read_config(dev, ET_PCIR_EEPROM_STATUS, 1); + pci_read_config(sc->dev, ET_PCIR_EEPROM_STATUS, 1); + val = pci_read_config(sc->dev, ET_PCIR_EEPROM_STATUS, 1); if (val & ET_PCIM_EEPROM_STATUS_ERROR) { - device_printf(dev, "EEPROM status error 0x%02x\n", val); + device_printf(sc->dev, "EEPROM status error 0x%02x\n", val); return (ENXIO); } /* TODO: LED */ + if ((sc->sc_flags & ET_FLAG_PCIE) == 0) + return (0); + /* * Configure ACK latency and replay timer according to * max playload size */ - val = pci_read_config(dev, ET_PCIR_DEVICE_CAPS, 4); - max_plsz = val & ET_PCIM_DEVICE_CAPS_MAX_PLSZ; + val = pci_read_config(sc->dev, + sc->sc_expcap + PCIR_EXPRESS_DEVICE_CAP, 4); + max_plsz = val & PCIM_EXP_CAP_MAX_PAYLOAD; switch (max_plsz) { case ET_PCIV_DEVICE_CAPS_PLSZ_128: @@ -614,35 +616,39 @@ et_bus_config(device_t dev) break; default: - ack_latency = pci_read_config(dev, ET_PCIR_ACK_LATENCY, 2); - replay_timer = pci_read_config(dev, ET_PCIR_REPLAY_TIMER, 2); - device_printf(dev, "ack latency %u, replay timer %u\n", + ack_latency = pci_read_config(sc->dev, ET_PCIR_ACK_LATENCY, 2); + replay_timer = pci_read_config(sc->dev, + ET_PCIR_REPLAY_TIMER, 2); + device_printf(sc->dev, "ack latency %u, replay timer %u\n", ack_latency, replay_timer); break; } if (ack_latency != 0) { - pci_write_config(dev, ET_PCIR_ACK_LATENCY, ack_latency, 2); - pci_write_config(dev, ET_PCIR_REPLAY_TIMER, replay_timer, 2); + pci_write_config(sc->dev, ET_PCIR_ACK_LATENCY, ack_latency, 2); + pci_write_config(sc->dev, ET_PCIR_REPLAY_TIMER, replay_timer, + 2); } /* * Set L0s and L1 latency timer to 2us */ - val = pci_read_config(dev, ET_PCIR_L0S_L1_LATENCY, 4); + val = pci_read_config(sc->dev, ET_PCIR_L0S_L1_LATENCY, 4); val &= ~(PCIM_LINK_CAP_L0S_EXIT | PCIM_LINK_CAP_L1_EXIT); /* L0s exit latency : 2us */ val |= 0x00005000; /* L1 exit latency : 2us */ val |= 0x00028000; - pci_write_config(dev, ET_PCIR_L0S_L1_LATENCY, val, 4); + pci_write_config(sc->dev, ET_PCIR_L0S_L1_LATENCY, val, 4); /* * Set max read request size to 2048 bytes */ - val = pci_read_config(dev, ET_PCIR_DEVICE_CTRL, 2); - val &= ~ET_PCIM_DEVICE_CTRL_MAX_RRSZ; + val = pci_read_config(sc->dev, + sc->sc_expcap + PCIR_EXPRESS_DEVICE_CTL, 2); + val &= ~PCIM_EXP_CTL_MAX_READ_REQUEST; val |= ET_PCIV_DEVICE_CTRL_RRSZ_2K; - pci_write_config(dev, ET_PCIR_DEVICE_CTRL, val, 2); + pci_write_config(sc->dev, + sc->sc_expcap + PCIR_EXPRESS_DEVICE_CTL, val, 2); return (0); } Modified: stable/7/sys/dev/et/if_etvar.h ============================================================================== --- stable/7/sys/dev/et/if_etvar.h Mon Dec 21 18:34:18 2009 (r200789) +++ stable/7/sys/dev/et/if_etvar.h Mon Dec 21 18:36:15 2009 (r200790) @@ -92,9 +92,9 @@ m_getl(int len, int how, int type, int f #define ET_JUMBO_MEM_SIZE (ET_JSLOTS * ET_JLEN) #define CSR_WRITE_4(sc, reg, val) \ - bus_space_write_4((sc)->sc_mem_bt, (sc)->sc_mem_bh, (reg), (val)) + bus_write_4((sc)->sc_mem_res, (reg), (val)) #define CSR_READ_4(sc, reg) \ - bus_space_read_4((sc)->sc_mem_bt, (sc)->sc_mem_bh, (reg)) + bus_read_4((sc)->sc_mem_res, (reg)) #define ET_ADDR_HI(addr) ((uint64_t) (addr) >> 32) #define ET_ADDR_LO(addr) ((uint64_t) (addr) & 0xffffffff) @@ -229,8 +229,6 @@ struct et_softc { device_t dev; struct mtx sc_mtx; device_t sc_miibus; - bus_space_handle_t sc_mem_bh; - bus_space_tag_t sc_mem_bt; void *sc_irq_handle; struct resource *sc_irq_res; struct resource *sc_mem_res; From owner-svn-src-stable-7@FreeBSD.ORG Mon Dec 21 18:56:55 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8EC3106568B; Mon, 21 Dec 2009 18:56:55 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D66568FC16; Mon, 21 Dec 2009 18: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 nBLIutBX037354; Mon, 21 Dec 2009 18:56:55 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLIutit037351; Mon, 21 Dec 2009 18:56:55 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200912211856.nBLIutit037351@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 21 Dec 2009 18:56:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200792 - stable/7/sys/dev/et X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 18:56:56 -0000 Author: yongari Date: Mon Dec 21 18:56:55 2009 New Revision: 200792 URL: http://svn.freebsd.org/changeset/base/200792 Log: MFC r199563,199608-199613 r199563: Fix copy & paste error and remove extra space before colon. r199608: Remove unnecessary structure packing. r199609: Add initial endianness support. It seems the controller supports both big-endian and little-endian format in descriptors for Rx path but I couldn't find equivalent feature in Tx path. So just stick to little-endian for now. r199610: Because we know received bytes including CRC there is no reason to call m_adj(9). The controller also seems to have a capability to strip CRC bytes but I failed to activate this feature except for loopback traffic. r199611: Add IPv4/TCP/UDP Tx checksum offloading support. It seems the controller also has support for IP/TCP checksum offloading for Rx path. But I failed to find to way to enable Rx MAC to compute the checksum of received frames. r199612: Add __FBSDID. r199613: Only Tx checksum offloading is supported now. Remove experimental code sneaked in r199611. Modified: stable/7/sys/dev/et/if_et.c stable/7/sys/dev/et/if_etvar.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/et/if_et.c ============================================================================== --- stable/7/sys/dev/et/if_et.c Mon Dec 21 18:52:38 2009 (r200791) +++ stable/7/sys/dev/et/if_et.c Mon Dec 21 18:56:55 2009 (r200792) @@ -32,9 +32,11 @@ * SUCH DAMAGE. * * $DragonFly: src/sys/dev/netif/et/if_et.c,v 1.10 2008/05/18 07:47:14 sephe Exp $ - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include @@ -78,7 +80,9 @@ MODULE_DEPEND(et, miibus, 1, 1, 1); /* Tunables. */ static int msi_disable = 0; -TUNABLE_INT("hw.re.msi_disable", &msi_disable); +TUNABLE_INT("hw.et.msi_disable", &msi_disable); + +#define ET_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) static int et_probe(device_t); static int et_attach(device_t); @@ -276,7 +280,7 @@ et_attach(device_t dev) sc->sc_flags |= ET_FLAG_PCIE; msic = pci_msi_count(dev); if (bootverbose) - device_printf(dev, "MSI count : %d\n", msic); + device_printf(dev, "MSI count: %d\n", msic); } if (msic > 0 && msi_disable == 0) { msic = 1; @@ -332,7 +336,7 @@ et_attach(device_t dev) ifp->if_ioctl = et_ioctl; ifp->if_start = et_start; ifp->if_mtu = ETHERMTU; - ifp->if_capabilities = IFCAP_VLAN_MTU; + ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_VLAN_MTU; ifp->if_capenable = ifp->if_capabilities; IFQ_SET_MAXLEN(&ifp->if_snd, ET_TX_NDESC); IFQ_SET_READY(&ifp->if_snd); @@ -1175,7 +1179,7 @@ et_ioctl(struct ifnet *ifp, u_long cmd, struct et_softc *sc = ifp->if_softc; struct mii_data *mii = device_get_softc(sc->sc_miibus); struct ifreq *ifr = (struct ifreq *)data; - int error = 0, max_framelen; + int error = 0, mask, max_framelen; /* XXX LOCKSUSED */ switch (cmd) { @@ -1232,6 +1236,20 @@ et_ioctl(struct ifnet *ifp, u_long cmd, } break; + case SIOCSIFCAP: + ET_LOCK(sc); + mask = ifr->ifr_reqcap ^ ifp->if_capenable; + if ((mask & IFCAP_TXCSUM) != 0 && + (IFCAP_TXCSUM & ifp->if_capabilities) != 0) { + ifp->if_capenable ^= IFCAP_TXCSUM; + if ((IFCAP_TXCSUM & ifp->if_capenable) != 0) + ifp->if_hwassist |= ET_CSUM_FEATURES; + else + ifp->if_hwassist &= ~ET_CSUM_FEATURES; + } + ET_UNLOCK(sc); + break; + default: error = ether_ioctl(ifp, cmd, data); break; @@ -1913,7 +1931,7 @@ et_rxeof(struct et_softc *sc) struct ifnet *ifp; struct et_rxstatus_data *rxsd; struct et_rxstat_ring *rxst_ring; - uint32_t rxs_stat_ring; + uint32_t rxs_stat_ring, rxst_info2; int rxst_wrap, rxst_index; ET_LOCK_ASSERT(sc); @@ -1929,7 +1947,7 @@ et_rxeof(struct et_softc *sc) bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap, BUS_DMASYNC_POSTREAD); - rxs_stat_ring = rxsd->rxsd_status->rxs_stat_ring; + rxs_stat_ring = le32toh(rxsd->rxsd_status->rxs_stat_ring); rxst_wrap = (rxs_stat_ring & ET_RXS_STATRING_WRAP) ? 1 : 0; rxst_index = (rxs_stat_ring & ET_RXS_STATRING_INDEX_MASK) >> ET_RXS_STATRING_INDEX_SHIFT; @@ -1945,12 +1963,12 @@ et_rxeof(struct et_softc *sc) MPASS(rxst_ring->rsr_index < ET_RX_NSTAT); st = &rxst_ring->rsr_stat[rxst_ring->rsr_index]; - - buflen = (st->rxst_info2 & ET_RXST_INFO2_LEN_MASK) >> + rxst_info2 = le32toh(st->rxst_info2); + buflen = (rxst_info2 & ET_RXST_INFO2_LEN_MASK) >> ET_RXST_INFO2_LEN_SHIFT; - buf_idx = (st->rxst_info2 & ET_RXST_INFO2_BUFIDX_MASK) >> + buf_idx = (rxst_info2 & ET_RXST_INFO2_BUFIDX_MASK) >> ET_RXST_INFO2_BUFIDX_SHIFT; - ring_idx = (st->rxst_info2 & ET_RXST_INFO2_RINGIDX_MASK) >> + ring_idx = (rxst_info2 & ET_RXST_INFO2_RINGIDX_MASK) >> ET_RXST_INFO2_RINGIDX_SHIFT; if (++rxst_ring->rsr_index == ET_RX_NSTAT) { @@ -1982,11 +2000,9 @@ et_rxeof(struct et_softc *sc) m = NULL; ifp->if_ierrors++; } else { - m->m_pkthdr.len = m->m_len = buflen; + m->m_pkthdr.len = m->m_len = + buflen - ETHER_CRC_LEN; m->m_pkthdr.rcvif = ifp; - - m_adj(m, -ETHER_CRC_LEN); - ifp->if_ipackets++; ET_UNLOCK(sc); ifp->if_input(ifp, m); @@ -2028,7 +2044,7 @@ et_encap(struct et_softc *sc, struct mbu struct et_txdesc *td; bus_dmamap_t map; int error, maxsegs, first_idx, last_idx, i; - uint32_t tx_ready_pos, last_td_ctrl2; + uint32_t csum_flags, tx_ready_pos, last_td_ctrl2; maxsegs = ET_TX_NDESC - tbd->tbd_used; if (maxsegs > ET_NSEG_MAX) @@ -2090,20 +2106,29 @@ et_encap(struct et_softc *sc, struct mbu last_td_ctrl2 |= ET_TDCTRL2_INTR; } + csum_flags = 0; + if ((m->m_pkthdr.csum_flags & ET_CSUM_FEATURES) != 0) { + if ((m->m_pkthdr.csum_flags & CSUM_IP) != 0) + csum_flags |= ET_TDCTRL2_CSUM_IP; + if ((m->m_pkthdr.csum_flags & CSUM_UDP) != 0) + csum_flags |= ET_TDCTRL2_CSUM_UDP; + else if ((m->m_pkthdr.csum_flags & CSUM_TCP) != 0) + csum_flags |= ET_TDCTRL2_CSUM_TCP; + } last_idx = -1; for (i = 0; i < ctx.nsegs; ++i) { int idx; idx = (first_idx + i) % ET_TX_NDESC; td = &tx_ring->tr_desc[idx]; - td->td_addr_hi = ET_ADDR_HI(segs[i].ds_addr); - td->td_addr_lo = ET_ADDR_LO(segs[i].ds_addr); - td->td_ctrl1 = segs[i].ds_len & ET_TDCTRL1_LEN_MASK; - + td->td_addr_hi = htole32(ET_ADDR_HI(segs[i].ds_addr)); + td->td_addr_lo = htole32(ET_ADDR_LO(segs[i].ds_addr)); + td->td_ctrl1 = htole32(segs[i].ds_len & ET_TDCTRL1_LEN_MASK); if (i == ctx.nsegs - 1) { /* Last frag */ - td->td_ctrl2 = last_td_ctrl2; + td->td_ctrl2 = htole32(last_td_ctrl2 | csum_flags); last_idx = idx; - } + } else + td->td_ctrl2 = htole32(csum_flags); MPASS(tx_ring->tr_ready_index < ET_TX_NDESC); if (++tx_ring->tr_ready_index == ET_TX_NDESC) { @@ -2112,7 +2137,7 @@ et_encap(struct et_softc *sc, struct mbu } } td = &tx_ring->tr_desc[first_idx]; - td->td_ctrl2 |= ET_TDCTRL2_FIRST_FRAG; /* First frag */ + td->td_ctrl2 |= htole32(ET_TDCTRL2_FIRST_FRAG); /* First frag */ MPASS(last_idx >= 0); tbd->tbd_buf[first_idx].tb_dmap = tbd->tbd_buf[last_idx].tb_dmap; @@ -2424,9 +2449,9 @@ et_setup_rxdesc(struct et_rxbuf_data *rb MPASS(buf_idx < ET_RX_NDESC); desc = &rx_ring->rr_desc[buf_idx]; - desc->rd_addr_hi = ET_ADDR_HI(paddr); - desc->rd_addr_lo = ET_ADDR_LO(paddr); - desc->rd_ctrl = buf_idx & ET_RDCTRL_BUFIDX_MASK; + desc->rd_addr_hi = htole32(ET_ADDR_HI(paddr)); + desc->rd_addr_lo = htole32(ET_ADDR_LO(paddr)); + desc->rd_ctrl = htole32(buf_idx & ET_RDCTRL_BUFIDX_MASK); bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap, BUS_DMASYNC_PREWRITE); Modified: stable/7/sys/dev/et/if_etvar.h ============================================================================== --- stable/7/sys/dev/et/if_etvar.h Mon Dec 21 18:52:38 2009 (r200791) +++ stable/7/sys/dev/et/if_etvar.h Mon Dec 21 18:56:55 2009 (r200792) @@ -104,26 +104,38 @@ struct et_txdesc { uint32_t td_addr_lo; uint32_t td_ctrl1; /* ET_TDCTRL1_ */ uint32_t td_ctrl2; /* ET_TDCTRL2_ */ -} __packed; +}; #define ET_TDCTRL1_LEN_MASK 0x0000FFFF #define ET_TDCTRL2_LAST_FRAG 0x00000001 #define ET_TDCTRL2_FIRST_FRAG 0x00000002 #define ET_TDCTRL2_INTR 0x00000004 +#define ET_TDCTRL2_CTRL_WORD 0x00000008 +#define ET_TDCTRL2_HDX_BACKP 0x00000010 +#define ET_TDCTRL2_XMIT_PAUSE 0x00000020 +#define ET_TDCTRL2_FRAME_ERR 0x00000040 +#define ET_TDCTRL2_NO_CRC 0x00000080 +#define ET_TDCTRL2_MAC_OVRRD 0x00000100 +#define ET_TDCTRL2_PAD_PACKET 0x00000200 +#define ET_TDCTRL2_JUMBO_PACKET 0x00000400 +#define ET_TDCTRL2_INS_VLAN 0x00000800 +#define ET_TDCTRL2_CSUM_IP 0x00001000 +#define ET_TDCTRL2_CSUM_TCP 0x00002000 +#define ET_TDCTRL2_CSUM_UDP 0x00004000 struct et_rxdesc { uint32_t rd_addr_lo; uint32_t rd_addr_hi; uint32_t rd_ctrl; /* ET_RDCTRL_ */ -} __packed; +}; #define ET_RDCTRL_BUFIDX_MASK 0x000003FF struct et_rxstat { uint32_t rxst_info1; uint32_t rxst_info2; /* ET_RXST_INFO2_ */ -} __packed; +}; #define ET_RXST_INFO2_LEN_MASK 0x0000FFFF #define ET_RXST_INFO2_LEN_SHIFT 0 @@ -135,7 +147,7 @@ struct et_rxstat { struct et_rxstatus { uint32_t rxs_ring; uint32_t rxs_stat_ring; /* ET_RXS_STATRING_ */ -} __packed; +}; #define ET_RXS_STATRING_INDEX_MASK 0x0FFF0000 #define ET_RXS_STATRING_INDEX_SHIFT 16 From owner-svn-src-stable-7@FreeBSD.ORG Tue Dec 22 13:49:37 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3BF2106566B; Tue, 22 Dec 2009 13:49:37 +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 C23C18FC19; Tue, 22 Dec 2009 13:49: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 nBMDnb3e065589; Tue, 22 Dec 2009 13:49:37 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMDnbVQ065587; Tue, 22 Dec 2009 13:49:37 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200912221349.nBMDnbVQ065587@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 22 Dec 2009 13:49:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200837 - stable/7/lib/libc/sys X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 13:49:37 -0000 Author: jilles Date: Tue Dec 22 13:49:37 2009 New Revision: 200837 URL: http://svn.freebsd.org/changeset/base/200837 Log: MFC r200589: cpuset(2): fix a typo and a markup error in the man page Modified: stable/7/lib/libc/sys/cpuset.2 Directory Properties: stable/7/lib/libc/ (props changed) Modified: stable/7/lib/libc/sys/cpuset.2 ============================================================================== --- stable/7/lib/libc/sys/cpuset.2 Tue Dec 22 13:45:29 2009 (r200836) +++ stable/7/lib/libc/sys/cpuset.2 Tue Dec 22 13:49:37 2009 (r200837) @@ -96,7 +96,7 @@ The .Fa which argument may have the following values: .Bl -column CPU_WHICH_CPUSET -offset indent -.It Dv CPU_WHICH_TID Ta "id is lpwid_t (thread id)" +.It Dv CPU_WHICH_TID Ta "id is lwpid_t (thread id)" .It Dv CPU_WHICH_PID Ta "id is pid_t (process id)" .It Dv CPU_WHICH_CPUSET Ta "id is a cpusetid_t (cpuset id)" .It Dv CPU_WHICH_IRQ Ta "id is an irq number" @@ -209,7 +209,7 @@ The calling process did not have the cre operation. .It Bq Er ENFILE There was no free -.Fn cpusetid_t +.Ft cpusetid_t for allocation. .El .Sh SEE ALSO From owner-svn-src-stable-7@FreeBSD.ORG Tue Dec 22 14:13:13 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55FA7106568D; Tue, 22 Dec 2009 14:13:13 +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 441B38FC29; Tue, 22 Dec 2009 14:13: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 nBMEDDnG066248; Tue, 22 Dec 2009 14:13:13 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMEDDrp066246; Tue, 22 Dec 2009 14:13:13 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912221413.nBMEDDrp066246@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 22 Dec 2009 14:13:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200839 - stable/7/libexec/rtld-elf X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 14:13:13 -0000 Author: kib Date: Tue Dec 22 14:13:13 2009 New Revision: 200839 URL: http://svn.freebsd.org/changeset/base/200839 Log: MFC r190883: Update comment, fix spacing. MFC r190885: Change the way the mapping of the ELF objects is constructed, by first mapping PROT_NONE anonymous memory over the whole range, and then mapping the segments of the object over it. MFC r195743: Only perform .bss mapping and cleaning operations when segment file size is not equal to its memory size. Tested by: Mykola Dzham Modified: stable/7/libexec/rtld-elf/map_object.c Directory Properties: stable/7/libexec/rtld-elf/ (props changed) Modified: stable/7/libexec/rtld-elf/map_object.c ============================================================================== --- stable/7/libexec/rtld-elf/map_object.c Tue Dec 22 13:53:34 2009 (r200838) +++ stable/7/libexec/rtld-elf/map_object.c Tue Dec 22 14:13:13 2009 (r200839) @@ -91,8 +91,7 @@ map_object(int fd, const char *path, con /* * Scan the program header entries, and save key information. * - * We rely on there being exactly two load segments, text and data, - * in that order. + * We expect that the loadable segments are ordered by load address. */ phdr = (Elf_Phdr *) ((char *)hdr + hdr->e_phoff); phsize = hdr->e_phnum * sizeof (phdr[0]); @@ -153,8 +152,8 @@ map_object(int fd, const char *path, con mapsize = base_vlimit - base_vaddr; base_addr = hdr->e_type == ET_EXEC ? (caddr_t) base_vaddr : NULL; - mapbase = mmap(base_addr, mapsize, convert_prot(segs[0]->p_flags), - convert_flags(segs[0]->p_flags), fd, base_offset); + mapbase = mmap(base_addr, mapsize, PROT_NONE, MAP_ANON | MAP_PRIVATE | + MAP_NOCORE, -1, 0); if (mapbase == (caddr_t) -1) { _rtld_error("%s: mmap of entire address space failed: %s", path, strerror(errno)); @@ -167,7 +166,7 @@ map_object(int fd, const char *path, con return NULL; } - for (i = 0; i <= nsegs; i++) { + for (i = 0; i <= nsegs; i++) { /* Overlay the segment onto the proper region. */ data_offset = trunc_page(segs[i]->p_offset); data_vaddr = trunc_page(segs[i]->p_vaddr); @@ -175,45 +174,49 @@ map_object(int fd, const char *path, con data_addr = mapbase + (data_vaddr - base_vaddr); data_prot = convert_prot(segs[i]->p_flags); data_flags = convert_flags(segs[i]->p_flags) | MAP_FIXED; - /* Do not call mmap on the first segment - this is redundant */ - if (i && mmap(data_addr, data_vlimit - data_vaddr, data_prot, + if (mmap(data_addr, data_vlimit - data_vaddr, data_prot, data_flags, fd, data_offset) == (caddr_t) -1) { _rtld_error("%s: mmap of data failed: %s", path, strerror(errno)); return NULL; } - /* Clear any BSS in the last page of the segment. */ - clear_vaddr = segs[i]->p_vaddr + segs[i]->p_filesz; - clear_addr = mapbase + (clear_vaddr - base_vaddr); - clear_page = mapbase + (trunc_page(clear_vaddr) - base_vaddr); - if ((nclear = data_vlimit - clear_vaddr) > 0) { - /* Make sure the end of the segment is writable */ - if ((data_prot & PROT_WRITE) == 0 && - -1 == mprotect(clear_page, PAGE_SIZE, data_prot|PROT_WRITE)) { + /* Do BSS setup */ + if (segs[i]->p_filesz != segs[i]->p_memsz) { + + /* Clear any BSS in the last page of the segment. */ + clear_vaddr = segs[i]->p_vaddr + segs[i]->p_filesz; + clear_addr = mapbase + (clear_vaddr - base_vaddr); + clear_page = mapbase + (trunc_page(clear_vaddr) - base_vaddr); + + if ((nclear = data_vlimit - clear_vaddr) > 0) { + /* Make sure the end of the segment is writable */ + if ((data_prot & PROT_WRITE) == 0 && -1 == + mprotect(clear_page, PAGE_SIZE, data_prot|PROT_WRITE)) { _rtld_error("%s: mprotect failed: %s", path, strerror(errno)); return NULL; - } + } - memset(clear_addr, 0, nclear); + memset(clear_addr, 0, nclear); - /* Reset the data protection back */ - if ((data_prot & PROT_WRITE) == 0) - mprotect(clear_page, PAGE_SIZE, data_prot); - } + /* Reset the data protection back */ + if ((data_prot & PROT_WRITE) == 0) + mprotect(clear_page, PAGE_SIZE, data_prot); + } - /* Overlay the BSS segment onto the proper region. */ - bss_vaddr = data_vlimit; - bss_vlimit = round_page(segs[i]->p_vaddr + segs[i]->p_memsz); - bss_addr = mapbase + (bss_vaddr - base_vaddr); - if (bss_vlimit > bss_vaddr) { /* There is something to do */ - if (mmap(bss_addr, bss_vlimit - bss_vaddr, data_prot, - MAP_PRIVATE|MAP_FIXED|MAP_ANON, -1, 0) == (caddr_t) -1) { - _rtld_error("%s: mmap of bss failed: %s", path, + /* Overlay the BSS segment onto the proper region. */ + bss_vaddr = data_vlimit; + bss_vlimit = round_page(segs[i]->p_vaddr + segs[i]->p_memsz); + bss_addr = mapbase + (bss_vaddr - base_vaddr); + if (bss_vlimit > bss_vaddr) { /* There is something to do */ + if (mprotect(bss_addr, bss_vlimit - bss_vaddr, data_prot) == -1) { + _rtld_error("%s: mprotect of bss failed: %s", path, strerror(errno)); - return NULL; + return NULL; + } } } + if (phdr_vaddr == 0 && data_offset <= hdr->e_phoff && (data_vlimit - data_vaddr + data_offset) >= (hdr->e_phoff + hdr->e_phnum * sizeof (Elf_Phdr))) { From owner-svn-src-stable-7@FreeBSD.ORG Tue Dec 22 14:58:44 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 833B310656C1; Tue, 22 Dec 2009 14:58:44 +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 71FBB8FC1C; Tue, 22 Dec 2009 14:58: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 nBMEwiFg067299; Tue, 22 Dec 2009 14:58:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMEwioW067297; Tue, 22 Dec 2009 14:58:44 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200912221458.nBMEwioW067297@svn.freebsd.org> From: John Baldwin Date: Tue, 22 Dec 2009 14:58:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200842 - stable/7/sys/i386/conf X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 14:58:44 -0000 Author: jhb Date: Tue Dec 22 14:58:44 2009 New Revision: 200842 URL: http://svn.freebsd.org/changeset/base/200842 Log: MFC 200514: Remove comment claiming that building acpi into the kernel is deprecated. Modified: stable/7/sys/i386/conf/NOTES Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/i386/conf/NOTES ============================================================================== --- stable/7/sys/i386/conf/NOTES Tue Dec 22 14:58:23 2009 (r200841) +++ stable/7/sys/i386/conf/NOTES Tue Dec 22 14:58:44 2009 (r200842) @@ -510,9 +510,6 @@ device tdfx_linux # Enable Linuxulator # defined when it is built). # # ACPI_NO_SEMAPHORES makes the AcpiOs*Semaphore routines a no-op. -# -# Note that building ACPI into the kernel is deprecated; the module is -# normally loaded automatically by the loader. device acpi options ACPI_DEBUG From owner-svn-src-stable-7@FreeBSD.ORG Tue Dec 22 19:51:50 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F6C21065692; Tue, 22 Dec 2009 19:51:50 +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 5B4E38FC13; Tue, 22 Dec 2009 19:51: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 nBMJpoLW073910; Tue, 22 Dec 2009 19:51:50 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMJpojJ073900; Tue, 22 Dec 2009 19:51:50 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912221951.nBMJpojJ073900@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 22 Dec 2009 19:51:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200858 - in stable/7/sys: amd64/include arm/include compat/svr4 i386/include ia64/include kern powerpc/include sparc64/include sun4v/include X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 19:51:50 -0000 Author: kib Date: Tue Dec 22 19:51:49 2009 New Revision: 200858 URL: http://svn.freebsd.org/changeset/base/200858 Log: MFC r186212 (by imp): AT_DEBUG and AT_BRK were OBE like 10 years ago, so retire them. MFC r186225: Remove two remnant uses of AT_DEBUG. Modified: stable/7/sys/amd64/include/elf.h stable/7/sys/arm/include/elf.h stable/7/sys/compat/svr4/svr4_sysvec.c stable/7/sys/i386/include/elf.h stable/7/sys/ia64/include/elf.h stable/7/sys/kern/imgact_elf.c stable/7/sys/powerpc/include/elf.h stable/7/sys/sparc64/include/elf.h stable/7/sys/sun4v/include/elf.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/amd64/include/elf.h ============================================================================== --- stable/7/sys/amd64/include/elf.h Tue Dec 22 19:48:06 2009 (r200857) +++ stable/7/sys/amd64/include/elf.h Tue Dec 22 19:51:49 2009 (r200858) @@ -81,18 +81,6 @@ __ElfType(Auxinfo); #define AT_BASE 7 /* Interpreter's base address. */ #define AT_FLAGS 8 /* Flags (unused for i386). */ #define AT_ENTRY 9 /* Where interpreter should transfer control. */ - -/* - * The following non-standard values are used for passing information - * from John Polstra's testbed program to the dynamic linker. These - * are expected to go away soon. - * - * Unfortunately, these overlap the Linux non-standard values, so they - * must not be used in the same context. - */ -#define AT_BRK 10 /* Starting point for sbrk and brk. */ -#define AT_DEBUG 11 /* Debugging level. */ - /* * The following non-standard values are used in Linux ELF binaries. */ Modified: stable/7/sys/arm/include/elf.h ============================================================================== --- stable/7/sys/arm/include/elf.h Tue Dec 22 19:48:06 2009 (r200857) +++ stable/7/sys/arm/include/elf.h Tue Dec 22 19:51:49 2009 (r200858) @@ -70,10 +70,6 @@ __ElfType(Auxinfo); #define AT_BASE 7 /* Interpreter's base address. */ #define AT_FLAGS 8 /* Flags (unused). */ #define AT_ENTRY 9 /* Where interpreter should transfer control. */ - -#define AT_BRK 10 /* Starting point for sbrk and brk. */ -#define AT_DEBUG 11 /* Debugging level. */ - #define AT_NOTELF 10 /* Program is not ELF ?? */ #define AT_UID 11 /* Real uid. */ #define AT_EUID 12 /* Effective uid. */ Modified: stable/7/sys/compat/svr4/svr4_sysvec.c ============================================================================== --- stable/7/sys/compat/svr4/svr4_sysvec.c Tue Dec 22 19:48:06 2009 (r200857) +++ stable/7/sys/compat/svr4/svr4_sysvec.c Tue Dec 22 19:51:49 2009 (r200858) @@ -222,8 +222,6 @@ svr4_fixup(register_t **stack_base, stru args = (Elf32_Auxargs *)imgp->auxargs; pos = *stack_base + (imgp->args->argc + imgp->args->envc + 2); - if (args->trace) - AUXARGS_ENTRY(pos, AT_DEBUG, 1); if (args->execfd != -1) AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd); AUXARGS_ENTRY(pos, AT_PHDR, args->phdr); Modified: stable/7/sys/i386/include/elf.h ============================================================================== --- stable/7/sys/i386/include/elf.h Tue Dec 22 19:48:06 2009 (r200857) +++ stable/7/sys/i386/include/elf.h Tue Dec 22 19:51:49 2009 (r200858) @@ -84,18 +84,6 @@ __ElfType(Auxinfo); #define AT_BASE 7 /* Interpreter's base address. */ #define AT_FLAGS 8 /* Flags (unused for i386). */ #define AT_ENTRY 9 /* Where interpreter should transfer control. */ - -/* - * The following non-standard values are used for passing information - * from John Polstra's testbed program to the dynamic linker. These - * are expected to go away soon. - * - * Unfortunately, these overlap the Linux non-standard values, so they - * must not be used in the same context. - */ -#define AT_BRK 10 /* Starting point for sbrk and brk. */ -#define AT_DEBUG 11 /* Debugging level. */ - /* * The following non-standard values are used in Linux ELF binaries. */ Modified: stable/7/sys/ia64/include/elf.h ============================================================================== --- stable/7/sys/ia64/include/elf.h Tue Dec 22 19:48:06 2009 (r200857) +++ stable/7/sys/ia64/include/elf.h Tue Dec 22 19:51:49 2009 (r200858) @@ -82,18 +82,6 @@ __ElfType(Auxinfo); #define AT_BASE 7 /* Interpreter's base address. */ #define AT_FLAGS 8 /* Flags (unused for i386). */ #define AT_ENTRY 9 /* Where interpreter should transfer control. */ - -/* - * The following non-standard values are used for passing information - * from John Polstra's testbed program to the dynamic linker. These - * are expected to go away soon. - * - * Unfortunately, these overlap the Linux non-standard values, so they - * must not be used in the same context. - */ -#define AT_BRK 10 /* Starting point for sbrk and brk. */ -#define AT_DEBUG 11 /* Debugging level. */ - /* * The following non-standard values are used in Linux ELF binaries. */ Modified: stable/7/sys/kern/imgact_elf.c ============================================================================== --- stable/7/sys/kern/imgact_elf.c Tue Dec 22 19:48:06 2009 (r200857) +++ stable/7/sys/kern/imgact_elf.c Tue Dec 22 19:51:49 2009 (r200858) @@ -943,9 +943,6 @@ __elfN(freebsd_fixup)(register_t **stack base = (Elf_Addr *)*stack_base; pos = base + (imgp->args->argc + imgp->args->envc + 2); - if (args->trace) { - AUXARGS_ENTRY(pos, AT_DEBUG, 1); - } if (args->execfd != -1) { AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd); } Modified: stable/7/sys/powerpc/include/elf.h ============================================================================== --- stable/7/sys/powerpc/include/elf.h Tue Dec 22 19:48:06 2009 (r200857) +++ stable/7/sys/powerpc/include/elf.h Tue Dec 22 19:51:49 2009 (r200858) @@ -80,9 +80,6 @@ __ElfType(Auxinfo); #define AT_COUNT 13 /* Count of defined aux entry types. */ -/* Used in John Polstra's testbed stuff. */ -#define AT_DEBUG 14 /* Debugging level. */ - /* * Relocation types. */ Modified: stable/7/sys/sparc64/include/elf.h ============================================================================== --- stable/7/sys/sparc64/include/elf.h Tue Dec 22 19:48:06 2009 (r200857) +++ stable/7/sys/sparc64/include/elf.h Tue Dec 22 19:51:49 2009 (r200858) @@ -78,18 +78,6 @@ __ElfType(Auxinfo); #define AT_BASE 7 /* Interpreter's base address. */ #define AT_FLAGS 8 /* Flags (unused). */ #define AT_ENTRY 9 /* Where interpreter should transfer control. */ - -/* - * The following non-standard values are used for passing information - * from John Polstra's testbed program to the dynamic linker. These - * are expected to go away soon. - * - * Unfortunately, these overlap the Linux non-standard values, so they - * must not be used in the same context. - */ -#define T_BRK 10 /* Starting point for sbrk and brk. */ -#define AT_DEBUG 11 /* Debugging level. */ - /* * The following non-standard values are used in Linux ELF binaries. */ Modified: stable/7/sys/sun4v/include/elf.h ============================================================================== --- stable/7/sys/sun4v/include/elf.h Tue Dec 22 19:48:06 2009 (r200857) +++ stable/7/sys/sun4v/include/elf.h Tue Dec 22 19:51:49 2009 (r200858) @@ -78,18 +78,6 @@ __ElfType(Auxinfo); #define AT_BASE 7 /* Interpreter's base address. */ #define AT_FLAGS 8 /* Flags (unused). */ #define AT_ENTRY 9 /* Where interpreter should transfer control. */ - -/* - * The following non-standard values are used for passing information - * from John Polstra's testbed program to the dynamic linker. These - * are expected to go away soon. - * - * Unfortunately, these overlap the Linux non-standard values, so they - * must not be used in the same context. - */ -#define T_BRK 10 /* Starting point for sbrk and brk. */ -#define AT_DEBUG 11 /* Debugging level. */ - /* * The following non-standard values are used in Linux ELF binaries. */ From owner-svn-src-stable-7@FreeBSD.ORG Tue Dec 22 19:54:11 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E149A106568B; Tue, 22 Dec 2009 19:54:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D074B8FC1F; Tue, 22 Dec 2009 19:54: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 nBMJsBce074038; Tue, 22 Dec 2009 19:54:11 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMJsBbS074036; Tue, 22 Dec 2009 19:54:11 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912221954.nBMJsBbS074036@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 22 Dec 2009 19:54:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200859 - stable/7/sys/sys X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 19:54:12 -0000 Author: kib Date: Tue Dec 22 19:54:11 2009 New Revision: 200859 URL: http://svn.freebsd.org/changeset/base/200859 Log: MFC r189925: Add some definitions for the DT_FLAGS_1 tag flags. Modified: stable/7/sys/sys/elf_common.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sys/elf_common.h ============================================================================== --- stable/7/sys/sys/elf_common.h Tue Dec 22 19:51:49 2009 (r200858) +++ stable/7/sys/sys/elf_common.h Tue Dec 22 19:54:11 2009 (r200859) @@ -398,6 +398,11 @@ typedef struct { executable contains code using a static thread-local storage scheme. */ +/* Values for DT_FLAGS_1 */ +#define DF_1_BIND_NOW 0x00000001 /* Same as DF_BIND_NOW */ +#define DF_1_GLOBAL 0x00000002 /* Set the RTLD_GLOBAL for object */ +#define DF_1_ORIGIN 0x00000080 /* Process $ORIGIN */ + /* Values for n_type. Used in core files. */ #define NT_PRSTATUS 1 /* Process status. */ #define NT_FPREGSET 2 /* Floating point registers. */ From owner-svn-src-stable-7@FreeBSD.ORG Tue Dec 22 19:59:02 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00DA1106568B; Tue, 22 Dec 2009 19:59:02 +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 E12648FC21; Tue, 22 Dec 2009 19:59:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMJx1Mp074299; Tue, 22 Dec 2009 19:59:01 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMJx17i074291; Tue, 22 Dec 2009 19:59:01 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912221959.nBMJx17i074291@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 22 Dec 2009 19:59:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200861 - in stable/7/sys: amd64/include arm/include i386/include ia64/include powerpc/include sparc64/include sun4v/include X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 19:59:02 -0000 Author: kib Date: Tue Dec 22 19:59:01 2009 New Revision: 200861 URL: http://svn.freebsd.org/changeset/base/200861 Log: MFC r189926: Add AT_EXECPATH ELF auxinfo entry type. Modified: stable/7/sys/amd64/include/elf.h stable/7/sys/arm/include/elf.h stable/7/sys/i386/include/elf.h stable/7/sys/ia64/include/elf.h stable/7/sys/powerpc/include/elf.h stable/7/sys/sparc64/include/elf.h stable/7/sys/sun4v/include/elf.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/amd64/include/elf.h ============================================================================== --- stable/7/sys/amd64/include/elf.h Tue Dec 22 19:56:35 2009 (r200860) +++ stable/7/sys/amd64/include/elf.h Tue Dec 22 19:59:01 2009 (r200861) @@ -81,16 +81,14 @@ __ElfType(Auxinfo); #define AT_BASE 7 /* Interpreter's base address. */ #define AT_FLAGS 8 /* Flags (unused for i386). */ #define AT_ENTRY 9 /* Where interpreter should transfer control. */ -/* - * The following non-standard values are used in Linux ELF binaries. - */ #define AT_NOTELF 10 /* Program is not ELF ?? */ #define AT_UID 11 /* Real uid. */ #define AT_EUID 12 /* Effective uid. */ #define AT_GID 13 /* Real gid. */ #define AT_EGID 14 /* Effective gid. */ +#define AT_EXECPATH 15 /* Path to the executable. */ -#define AT_COUNT 15 /* Count of defined aux entry types. */ +#define AT_COUNT 16 /* Count of defined aux entry types. */ /* * Relocation types. Modified: stable/7/sys/arm/include/elf.h ============================================================================== --- stable/7/sys/arm/include/elf.h Tue Dec 22 19:56:35 2009 (r200860) +++ stable/7/sys/arm/include/elf.h Tue Dec 22 19:59:01 2009 (r200861) @@ -75,8 +75,9 @@ __ElfType(Auxinfo); #define AT_EUID 12 /* Effective uid. */ #define AT_GID 13 /* Real gid. */ #define AT_EGID 14 /* Effective gid. */ +#define AT_EXECPATH 15 /* Path to the executable. */ -#define AT_COUNT 15 /* Count of defined aux entry types. */ +#define AT_COUNT 16 /* Count of defined aux entry types. */ #define R_ARM_COUNT 33 /* Count of defined relocation types. */ Modified: stable/7/sys/i386/include/elf.h ============================================================================== --- stable/7/sys/i386/include/elf.h Tue Dec 22 19:56:35 2009 (r200860) +++ stable/7/sys/i386/include/elf.h Tue Dec 22 19:59:01 2009 (r200861) @@ -84,16 +84,14 @@ __ElfType(Auxinfo); #define AT_BASE 7 /* Interpreter's base address. */ #define AT_FLAGS 8 /* Flags (unused for i386). */ #define AT_ENTRY 9 /* Where interpreter should transfer control. */ -/* - * The following non-standard values are used in Linux ELF binaries. - */ #define AT_NOTELF 10 /* Program is not ELF ?? */ #define AT_UID 11 /* Real uid. */ #define AT_EUID 12 /* Effective uid. */ #define AT_GID 13 /* Real gid. */ #define AT_EGID 14 /* Effective gid. */ +#define AT_EXECPATH 15 /* Path to the executable. */ -#define AT_COUNT 15 /* Count of defined aux entry types. */ +#define AT_COUNT 16 /* Count of defined aux entry types. */ /* * Relocation types. Modified: stable/7/sys/ia64/include/elf.h ============================================================================== --- stable/7/sys/ia64/include/elf.h Tue Dec 22 19:56:35 2009 (r200860) +++ stable/7/sys/ia64/include/elf.h Tue Dec 22 19:59:01 2009 (r200861) @@ -82,16 +82,14 @@ __ElfType(Auxinfo); #define AT_BASE 7 /* Interpreter's base address. */ #define AT_FLAGS 8 /* Flags (unused for i386). */ #define AT_ENTRY 9 /* Where interpreter should transfer control. */ -/* - * The following non-standard values are used in Linux ELF binaries. - */ #define AT_NOTELF 10 /* Program is not ELF ?? */ #define AT_UID 11 /* Real uid. */ #define AT_EUID 12 /* Effective uid. */ #define AT_GID 13 /* Real gid. */ #define AT_EGID 14 /* Effective gid. */ +#define AT_EXECPATH 15 /* Path to the executable. */ -#define AT_COUNT 15 /* Count of defined aux entry types. */ +#define AT_COUNT 16 /* Count of defined aux entry types. */ /* * Values for e_flags. Modified: stable/7/sys/powerpc/include/elf.h ============================================================================== --- stable/7/sys/powerpc/include/elf.h Tue Dec 22 19:56:35 2009 (r200860) +++ stable/7/sys/powerpc/include/elf.h Tue Dec 22 19:59:01 2009 (r200861) @@ -77,8 +77,9 @@ __ElfType(Auxinfo); #define AT_DCACHEBSIZE 10 /* Data cache block size for the processor. */ #define AT_ICACHEBSIZE 11 /* Instruction cache block size for the uP. */ #define AT_UCACHEBSIZE 12 /* Cache block size, or `0' if cache not unified. */ +#define AT_EXECPATH 13 /* Path to the executable. */ -#define AT_COUNT 13 /* Count of defined aux entry types. */ +#define AT_COUNT 14 /* Count of defined aux entry types. */ /* * Relocation types. Modified: stable/7/sys/sparc64/include/elf.h ============================================================================== --- stable/7/sys/sparc64/include/elf.h Tue Dec 22 19:56:35 2009 (r200860) +++ stable/7/sys/sparc64/include/elf.h Tue Dec 22 19:59:01 2009 (r200861) @@ -78,16 +78,14 @@ __ElfType(Auxinfo); #define AT_BASE 7 /* Interpreter's base address. */ #define AT_FLAGS 8 /* Flags (unused). */ #define AT_ENTRY 9 /* Where interpreter should transfer control. */ -/* - * The following non-standard values are used in Linux ELF binaries. - */ #define AT_NOTELF 10 /* Program is not ELF ?? */ #define AT_UID 11 /* Real uid. */ #define AT_EUID 12 /* Effective uid. */ #define AT_GID 13 /* Real gid. */ #define AT_EGID 14 /* Effective gid. */ +#define AT_EXECPATH 15 /* Path to the executable. */ -#define AT_COUNT 15 /* Count of defined aux entry types. */ +#define AT_COUNT 16 /* Count of defined aux entry types. */ /* Define "machine" characteristics */ #if __ELF_WORD_SIZE == 32 Modified: stable/7/sys/sun4v/include/elf.h ============================================================================== --- stable/7/sys/sun4v/include/elf.h Tue Dec 22 19:56:35 2009 (r200860) +++ stable/7/sys/sun4v/include/elf.h Tue Dec 22 19:59:01 2009 (r200861) @@ -78,16 +78,14 @@ __ElfType(Auxinfo); #define AT_BASE 7 /* Interpreter's base address. */ #define AT_FLAGS 8 /* Flags (unused). */ #define AT_ENTRY 9 /* Where interpreter should transfer control. */ -/* - * The following non-standard values are used in Linux ELF binaries. - */ #define AT_NOTELF 10 /* Program is not ELF ?? */ #define AT_UID 11 /* Real uid. */ #define AT_EUID 12 /* Effective uid. */ #define AT_GID 13 /* Real gid. */ #define AT_EGID 14 /* Effective gid. */ +#define AT_EXECPATH 15 /* Path to the executable. */ -#define AT_COUNT 15 /* Count of defined aux entry types. */ +#define AT_COUNT 16 /* Count of defined aux entry types. */ /* Define "machine" characteristics */ #if __ELF_WORD_SIZE == 32 From owner-svn-src-stable-7@FreeBSD.ORG Tue Dec 22 20:02:07 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40F6F106566C; Tue, 22 Dec 2009 20:02:07 +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 EC1228FC3B; Tue, 22 Dec 2009 20:02: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 nBMK26q8074512; Tue, 22 Dec 2009 20:02:06 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMK26r3074510; Tue, 22 Dec 2009 20:02:06 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912222002.nBMK26r3074510@svn.freebsd.org> From: Alexander Motin Date: Tue, 22 Dec 2009 20:02:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200863 - stable/7/sys/dev/ata X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 20:02:07 -0000 Author: mav Date: Tue Dec 22 20:02:06 2009 New Revision: 200863 URL: http://svn.freebsd.org/changeset/base/200863 Log: MFC r200414: CFA support doesn't exclude FLUSH support. Modified: stable/7/sys/dev/ata/ata-disk.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ata/ata-disk.c ============================================================================== --- stable/7/sys/dev/ata/ata-disk.c Tue Dec 22 20:00:20 2009 (r200862) +++ stable/7/sys/dev/ata/ata-disk.c Tue Dec 22 20:02:06 2009 (r200863) @@ -161,10 +161,10 @@ ad_attach(device_t dev) adp->disk->d_fwheads = adp->heads; adp->disk->d_unit = device_get_unit(dev); if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE) - adp->disk->d_flags = DISKFLAG_CANFLUSHCACHE; + adp->disk->d_flags |= DISKFLAG_CANFLUSHCACHE; if ((atadev->param.support.command2 & ATA_SUPPORT_CFA) || atadev->param.config == ATA_PROTO_CFA) - adp->disk->d_flags = DISKFLAG_CANDELETE; + adp->disk->d_flags |= DISKFLAG_CANDELETE; snprintf(adp->disk->d_ident, sizeof(adp->disk->d_ident), "ad:%s", atadev->param.serial); disk_create(adp->disk, DISK_VERSION); From owner-svn-src-stable-7@FreeBSD.ORG Tue Dec 22 20:05:09 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0CE6106566C; Tue, 22 Dec 2009 20:05:09 +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 BEB228FC2E; Tue, 22 Dec 2009 20:05: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 nBMK59sR074621; Tue, 22 Dec 2009 20:05:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMK59on074616; Tue, 22 Dec 2009 20:05:09 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912222005.nBMK59on074616@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 22 Dec 2009 20:05:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200864 - in stable/7/sys: compat/ia32 kern sys X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 20:05:09 -0000 Author: kib Date: Tue Dec 22 20:05:09 2009 New Revision: 200864 URL: http://svn.freebsd.org/changeset/base/200864 Log: MFC r189927: Supply AT_EXECPATH auxinfo entry to the interpreter, both for native and compat32 binaries. Note that the merge was edited due to fexecve(2) support not present in stable/7. Tested by: bms, Mykola Dzham Modified: stable/7/sys/compat/ia32/ia32_sysvec.c stable/7/sys/kern/imgact_elf.c stable/7/sys/kern/kern_exec.c stable/7/sys/sys/imgact.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- stable/7/sys/compat/ia32/ia32_sysvec.c Tue Dec 22 20:02:06 2009 (r200863) +++ stable/7/sys/compat/ia32/ia32_sysvec.c Tue Dec 22 20:05:09 2009 (r200864) @@ -203,15 +203,21 @@ ia32_copyout_strings(struct image_params char *stringp, *destp; u_int32_t *stack_base; struct freebsd32_ps_strings *arginfo; + size_t execpath_len; int szsigcode; /* * Calculate string base and vector table pointers. * Also deal with signal trampoline code for this exec type. */ + if (imgp->execpath != NULL && imgp->auxargs != NULL) + execpath_len = strlen(imgp->execpath) + 1; + else + execpath_len = 0; arginfo = (struct freebsd32_ps_strings *)FREEBSD32_PS_STRINGS; szsigcode = *(imgp->proc->p_sysent->sv_szsigcode); destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE - + roundup(execpath_len, sizeof(char *)) - roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); /* @@ -222,6 +228,15 @@ ia32_copyout_strings(struct image_params ((caddr_t)arginfo - szsigcode), szsigcode); /* + * Copy the image path for the rtld. + */ + if (execpath_len != 0) { + imgp->execpathp = (uintptr_t)arginfo - szsigcode - execpath_len; + copyout(imgp->execpath, (void *)imgp->execpathp, + execpath_len); + } + + /* * If we have a valid auxargs ptr, prepare some room * on the stack. */ @@ -237,9 +252,9 @@ ia32_copyout_strings(struct image_params * the arg and env vector sets,and imgp->auxarg_size is room * for argument of Runtime loader. */ - vectp = (u_int32_t *) (destp - (imgp->args->argc + imgp->args->envc + 2 + - imgp->auxarg_size) * sizeof(u_int32_t)); - + vectp = (u_int32_t *) (destp - (imgp->args->argc + + imgp->args->envc + 2 + imgp->auxarg_size + execpath_len) * + sizeof(u_int32_t)); } else /* * The '+ 2' is for the null pointers at the end of each of Modified: stable/7/sys/kern/imgact_elf.c ============================================================================== --- stable/7/sys/kern/imgact_elf.c Tue Dec 22 20:02:06 2009 (r200863) +++ stable/7/sys/kern/imgact_elf.c Tue Dec 22 20:05:09 2009 (r200864) @@ -953,6 +953,8 @@ __elfN(freebsd_fixup)(register_t **stack AUXARGS_ENTRY(pos, AT_FLAGS, args->flags); AUXARGS_ENTRY(pos, AT_ENTRY, args->entry); AUXARGS_ENTRY(pos, AT_BASE, args->base); + if (imgp->execpathp != 0) + AUXARGS_ENTRY(pos, AT_EXECPATH, imgp->execpathp); AUXARGS_ENTRY(pos, AT_NULL, 0); free(imgp->auxargs, M_TEMP); Modified: stable/7/sys/kern/kern_exec.c ============================================================================== --- stable/7/sys/kern/kern_exec.c Tue Dec 22 20:02:06 2009 (r200863) +++ stable/7/sys/kern/kern_exec.c Tue Dec 22 20:05:09 2009 (r200864) @@ -360,6 +360,8 @@ do_execve(td, args, mac_p) imgp->ps_strings = 0; imgp->auxarg_size = 0; imgp->args = args; + imgp->execpath = imgp->freepath = NULL; + imgp->execpathp = 0; #ifdef MAC error = mac_execve_enter(imgp, mac_p); @@ -486,6 +488,10 @@ interpret: * of the sv_copyout_strings/sv_fixup operations require the vnode. */ VOP_UNLOCK(imgp->vp, 0, td); + + if (imgp->auxargs != NULL) + vn_fullpath(td, imgp->vp, &imgp->execpath, &imgp->freepath); + /* * Copy out strings (args and env) and initialize stack base */ @@ -814,6 +820,8 @@ exec_fail_dealloc: if (imgp->object != NULL) vm_object_deallocate(imgp->object); + free(imgp->freepath, M_TEMP); + if (error == 0) { /* * Stop the process here if its stop event mask has @@ -1125,18 +1133,24 @@ exec_copyout_strings(imgp) register_t *stack_base; struct ps_strings *arginfo; struct proc *p; + size_t execpath_len; int szsigcode; /* * Calculate string base and vector table pointers. * Also deal with signal trampoline code for this exec type. */ + if (imgp->execpath != NULL && imgp->auxargs != NULL) + execpath_len = strlen(imgp->execpath) + 1; + else + execpath_len = 0; p = imgp->proc; szsigcode = 0; arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; if (p->p_sysent->sv_szsigcode != NULL) szsigcode = *(p->p_sysent->sv_szsigcode); destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE - + roundup(execpath_len, sizeof(char *)) - roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); /* @@ -1147,6 +1161,15 @@ exec_copyout_strings(imgp) szsigcode), szsigcode); /* + * Copy the image path for the rtld. + */ + if (execpath_len != 0) { + imgp->execpathp = (uintptr_t)arginfo - szsigcode - execpath_len; + copyout(imgp->execpath, (void *)imgp->execpathp, + execpath_len); + } + + /* * If we have a valid auxargs ptr, prepare some room * on the stack. */ @@ -1163,9 +1186,8 @@ exec_copyout_strings(imgp) * for argument of Runtime loader. */ vectp = (char **)(destp - (imgp->args->argc + - imgp->args->envc + 2 + imgp->auxarg_size) * + imgp->args->envc + 2 + imgp->auxarg_size + execpath_len) * sizeof(char *)); - } else { /* * The '+ 2' is for the null pointers at the end of each of Modified: stable/7/sys/sys/imgact.h ============================================================================== --- stable/7/sys/sys/imgact.h Tue Dec 22 20:02:06 2009 (r200863) +++ stable/7/sys/sys/imgact.h Tue Dec 22 20:05:09 2009 (r200864) @@ -65,6 +65,9 @@ struct image_params { size_t auxarg_size; struct image_args *args; /* system call arguments */ struct sysentvec *sysent; /* system entry vector */ + char *execpath; + unsigned long execpathp; + char *freepath; }; #ifdef _KERNEL From owner-svn-src-stable-7@FreeBSD.ORG Tue Dec 22 20:20:51 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0BF0106566C; Tue, 22 Dec 2009 20:20:51 +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 DE81D8FC14; Tue, 22 Dec 2009 20:20: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 nBMKKpKi075324; Tue, 22 Dec 2009 20:20:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMKKpeH075320; Tue, 22 Dec 2009 20:20:51 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912222020.nBMKKpeH075320@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 22 Dec 2009 20:20:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200867 - stable/7/libexec/rtld-elf X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 20:20:52 -0000 Author: kib Date: Tue Dec 22 20:20:51 2009 New Revision: 200867 URL: http://svn.freebsd.org/changeset/base/200867 Log: MFC r189959: Implement the dynamic string token substitution in the rpath and soneeded pathes. MFC r190505: Do not dereference NULL pointer. MFC r199828: Flag controlling origin expansion in DT_FLAGS is DF_ORIGIN, not DF_1_ORIGIN. Merge requested by: bms Tested by: bms, Mykola Dzham Modified: stable/7/libexec/rtld-elf/map_object.c stable/7/libexec/rtld-elf/rtld.c stable/7/libexec/rtld-elf/rtld.h Directory Properties: stable/7/libexec/rtld-elf/ (props changed) Modified: stable/7/libexec/rtld-elf/map_object.c ============================================================================== --- stable/7/libexec/rtld-elf/map_object.c Tue Dec 22 20:17:03 2009 (r200866) +++ stable/7/libexec/rtld-elf/map_object.c Tue Dec 22 20:20:51 2009 (r200867) @@ -351,6 +351,8 @@ obj_free(Obj_Entry *obj) free(obj->vertab); if (obj->origin_path) free(obj->origin_path); + if (obj->z_origin) + free(obj->rpath); if (obj->priv) free(obj->priv); if (obj->path) Modified: stable/7/libexec/rtld-elf/rtld.c ============================================================================== --- stable/7/libexec/rtld-elf/rtld.c Tue Dec 22 20:17:03 2009 (r200866) +++ stable/7/libexec/rtld-elf/rtld.c Tue Dec 22 20:20:51 2009 (r200867) @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -118,6 +119,7 @@ static void objlist_remove_unref(Objlist static void *path_enumerate(const char *, path_enum_proc, void *); static int relocate_objects(Obj_Entry *, bool, Obj_Entry *); static int rtld_dirname(const char *, char *); +static int rtld_dirname_abs(const char *, char *); static void rtld_exit(void); static char *search_library_path(const char *, const char *); static const void **get_program_var_addr(const char *); @@ -134,6 +136,9 @@ static void unlink_object(Obj_Entry *); static void unload_object(Obj_Entry *); static void unref_dag(Obj_Entry *); static void ref_dag(Obj_Entry *); +static int origin_subst_one(char **res, const char *real, const char *kw, + const char *subst, char *may_free); +static char *origin_subst(const char *real, const char *origin_path); static int rtld_verify_versions(const Objlist *); static int rtld_verify_object_versions(Obj_Entry *); static void object_add_name(Obj_Entry *, const char *); @@ -419,7 +424,25 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ die(); } - obj_main->path = xstrdup(argv0); + if (aux_info[AT_EXECPATH] != 0) { + char *kexecpath; + char buf[MAXPATHLEN]; + + kexecpath = aux_info[AT_EXECPATH]->a_un.a_ptr; + dbg("AT_EXECPATH %p %s", kexecpath, kexecpath); + if (kexecpath[0] == '/') + obj_main->path = kexecpath; + else if (getcwd(buf, sizeof(buf)) == NULL || + strlcat(buf, "/", sizeof(buf)) >= sizeof(buf) || + strlcat(buf, kexecpath, sizeof(buf)) >= sizeof(buf)) + obj_main->path = xstrdup(argv0); + else + obj_main->path = xstrdup(buf); + } else { + dbg("No AT_EXECPATH"); + obj_main->path = xstrdup(argv0); + } + dbg("obj_main path %s", obj_main->path); obj_main->mainprog = true; /* @@ -621,6 +644,83 @@ basename(const char *name) return p != NULL ? p + 1 : name; } +static struct utsname uts; + +static int +origin_subst_one(char **res, const char *real, const char *kw, const char *subst, + char *may_free) +{ + const char *p, *p1; + char *res1; + int subst_len; + int kw_len; + + res1 = *res = NULL; + p = real; + subst_len = kw_len = 0; + for (;;) { + p1 = strstr(p, kw); + if (p1 != NULL) { + if (subst_len == 0) { + subst_len = strlen(subst); + kw_len = strlen(kw); + } + if (*res == NULL) { + *res = xmalloc(PATH_MAX); + res1 = *res; + } + if ((res1 - *res) + subst_len + (p1 - p) >= PATH_MAX) { + _rtld_error("Substitution of %s in %s cannot be performed", + kw, real); + if (may_free != NULL) + free(may_free); + free(res); + return (false); + } + memcpy(res1, p, p1 - p); + res1 += p1 - p; + memcpy(res1, subst, subst_len); + res1 += subst_len; + p = p1 + kw_len; + } else { + if (*res == NULL) { + if (may_free != NULL) + *res = may_free; + else + *res = xstrdup(real); + return (true); + } + *res1 = '\0'; + if (may_free != NULL) + free(may_free); + if (strlcat(res1, p, PATH_MAX - (res1 - *res)) >= PATH_MAX) { + free(res); + return (false); + } + return (true); + } + } +} + +static char * +origin_subst(const char *real, const char *origin_path) +{ + char *res1, *res2, *res3, *res4; + + if (uts.sysname[0] == '\0') { + if (uname(&uts) != 0) { + _rtld_error("utsname failed: %d", errno); + return (NULL); + } + } + if (!origin_subst_one(&res1, real, "$ORIGIN", origin_path, NULL) || + !origin_subst_one(&res2, res1, "$OSNAME", uts.sysname, res1) || + !origin_subst_one(&res3, res2, "$OSREL", uts.release, res2) || + !origin_subst_one(&res4, res3, "$PLATFORM", uts.machine, res3)) + return (NULL); + return (res4); +} + static void die(void) { @@ -790,11 +890,8 @@ digest_dynamic(Obj_Entry *obj, int early break; case DT_FLAGS: - if (dynp->d_un.d_val & DF_ORIGIN) { - obj->origin_path = xmalloc(PATH_MAX); - if (rtld_dirname(obj->path, obj->origin_path) == -1) - die(); - } + if ((dynp->d_un.d_val & DF_ORIGIN) && trust) + obj->z_origin = true; if (dynp->d_un.d_val & DF_SYMBOLIC) obj->symbolic = true; if (dynp->d_un.d_val & DF_TEXTREL) @@ -805,6 +902,15 @@ digest_dynamic(Obj_Entry *obj, int early ; break; + case DT_FLAGS_1: + if ((dynp->d_un.d_val & DF_1_ORIGIN) && trust) + obj->z_origin = true; + if (dynp->d_un.d_val & DF_1_GLOBAL) + /* XXX */; + if (dynp->d_un.d_val & DF_1_BIND_NOW) + obj->bind_now = true; + break; + default: if (!early) { dbg("Ignoring d_tag %ld = %#lx", (long)dynp->d_tag, @@ -823,8 +929,17 @@ digest_dynamic(Obj_Entry *obj, int early obj->pltrelsize = 0; } - if (dyn_rpath != NULL) - obj->rpath = obj->strtab + dyn_rpath->d_un.d_val; + if (obj->z_origin && obj->origin_path == NULL) { + obj->origin_path = xmalloc(PATH_MAX); + if (rtld_dirname_abs(obj->path, obj->origin_path) == -1) + die(); + } + + if (dyn_rpath != NULL) { + obj->rpath = (char *)obj->strtab + dyn_rpath->d_un.d_val; + if (obj->z_origin) + obj->rpath = origin_subst(obj->rpath, obj->origin_path); + } if (dyn_soname != NULL) object_add_name(obj, obj->strtab + dyn_soname->d_un.d_val); @@ -982,7 +1097,10 @@ find_library(const char *xname, const Ob xname); return NULL; } - return xstrdup(xname); + if (refobj != NULL && refobj->z_origin) + return origin_subst(xname, refobj->origin_path); + else + return xstrdup(xname); } if (libmap_disable || (refobj == NULL) || @@ -2295,6 +2413,23 @@ rtld_dirname(const char *path, char *bna return (0); } +static int +rtld_dirname_abs(const char *path, char *base) +{ + char base_rel[PATH_MAX]; + + if (rtld_dirname(path, base) == -1) + return (-1); + if (base[0] == '/') + return (0); + if (getcwd(base_rel, sizeof(base_rel)) == NULL || + strlcat(base_rel, "/", sizeof(base_rel)) >= sizeof(base_rel) || + strlcat(base_rel, base, sizeof(base_rel)) >= sizeof(base_rel)) + return (-1); + strcpy(base, base_rel); + return (0); +} + static void linkmap_add(Obj_Entry *obj) { Modified: stable/7/libexec/rtld-elf/rtld.h ============================================================================== --- stable/7/libexec/rtld-elf/rtld.h Tue Dec 22 20:17:03 2009 (r200866) +++ stable/7/libexec/rtld-elf/rtld.h Tue Dec 22 20:20:51 2009 (r200867) @@ -190,7 +190,7 @@ typedef struct Struct_Obj_Entry { const Elf_Hashelt *chains; /* Hash table chain array */ unsigned long nchains; /* Number of chains */ - const char *rpath; /* Search path specified in object */ + char *rpath; /* Search path specified in object */ Needed_Entry *needed; /* Shared objects needed by this one (%) */ STAILQ_HEAD(, Struct_Name_Entry) names; /* List of names for this object we @@ -211,6 +211,7 @@ typedef struct Struct_Obj_Entry { bool init_done : 1; /* Already have added object to init list */ bool tls_done : 1; /* Already allocated offset for static TLS */ bool phdr_alloc : 1; /* Phdr is allocated and needs to be freed. */ + bool z_origin : 1; /* Process rpath and soname tokens */ struct link_map linkmap; /* for GDB and dlinfo() */ Objlist dldags; /* Object belongs to these dlopened DAGs (%) */ From owner-svn-src-stable-7@FreeBSD.ORG Tue Dec 22 20:24:07 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00EC31065670; Tue, 22 Dec 2009 20:24:07 +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 A33BF8FC0A; Tue, 22 Dec 2009 20:24: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 nBMKO6qm075460; Tue, 22 Dec 2009 20:24:06 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMKO64K075458; Tue, 22 Dec 2009 20:24:06 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912222024.nBMKO64K075458@svn.freebsd.org> From: Alexander Motin Date: Tue, 22 Dec 2009 20:24:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200868 - stable/7/sys/dev/sound/pci/hda X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 20:24:07 -0000 Author: mav Date: Tue Dec 22 20:24:06 2009 New Revision: 200868 URL: http://svn.freebsd.org/changeset/base/200868 Log: MFC r200375: Add one more set of codec IDs. Modified: stable/7/sys/dev/sound/pci/hda/hdac.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/7/sys/dev/sound/pci/hda/hdac.c Tue Dec 22 20:20:51 2009 (r200867) +++ stable/7/sys/dev/sound/pci/hda/hdac.c Tue Dec 22 20:24:06 2009 (r200868) @@ -606,6 +606,7 @@ static const struct { #define CIRRUSLOGIC_VENDORID 0x1013 #define HDA_CODEC_CS4206 HDA_CODEC_CONSTRUCT(CIRRUSLOGIC, 0x4206) #define HDA_CODEC_CS4207 HDA_CODEC_CONSTRUCT(CIRRUSLOGIC, 0x4207) +#define HDA_CODEC_CSXXXX HDA_CODEC_CONSTRUCT(CIRRUSLOGIC, 0xffff) /* Realtek */ #define REALTEK_VENDORID 0x10ec @@ -679,7 +680,9 @@ static const struct { #define HDA_CODEC_IDT92HD700D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7639) #define HDA_CODEC_IDT92HD206X HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7645) #define HDA_CODEC_IDT92HD206D HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7646) +#define HDA_CODEC_CXD9872RDK HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7661) #define HDA_CODEC_STAC9872AK HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7662) +#define HDA_CODEC_CXD9872AKD HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7664) #define HDA_CODEC_STAC9221 HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7680) #define HDA_CODEC_STAC922XD HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7681) #define HDA_CODEC_STAC9221_A2 HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7682) @@ -727,6 +730,7 @@ static const struct { #define HDA_CODEC_CX20549 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5045) #define HDA_CODEC_CX20551 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5047) #define HDA_CODEC_CX20561 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5051) +#define HDA_CODEC_CX20582 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5066) #define HDA_CODEC_CXXXXX HDA_CODEC_CONSTRUCT(CONEXANT, 0xffff) /* VIA */ @@ -842,6 +846,8 @@ static const struct { { HDA_CODEC_AD1988B, "Analog Devices AD1988B" }, { HDA_CODEC_AD1989B, "Analog Devices AD1989B" }, { HDA_CODEC_CMI9880, "CMedia CMI9880" }, + { HDA_CODEC_CXD9872RDK, "Sigmatel CXD9872RD/K" }, + { HDA_CODEC_CXD9872AKD, "Sigmatel CXD9872AKD" }, { HDA_CODEC_STAC9200D, "Sigmatel STAC9200D" }, { HDA_CODEC_STAC9204X, "Sigmatel STAC9204X" }, { HDA_CODEC_STAC9204D, "Sigmatel STAC9204D" }, @@ -896,6 +902,7 @@ static const struct { { HDA_CODEC_CX20549, "Conexant CX20549 (Venice)" }, { HDA_CODEC_CX20551, "Conexant CX20551 (Waikiki)" }, { HDA_CODEC_CX20561, "Conexant CX20561 (Hermosa)" }, + { HDA_CODEC_CX20582, "Conexant CX20582 (Pebble)" }, { HDA_CODEC_VT1708_8, "VIA VT1708_8" }, { HDA_CODEC_VT1708_9, "VIA VT1708_9" }, { HDA_CODEC_VT1708_A, "VIA VT1708_A" }, @@ -961,6 +968,7 @@ static const struct { /* Unknown codec */ { HDA_CODEC_ALCXXXX, "Realtek (Unknown)" }, { HDA_CODEC_ADXXXX, "Analog Devices (Unknown)" }, + { HDA_CODEC_CSXXXX, "Cirrus Logic (Unknown)" }, { HDA_CODEC_CMIXXXX, "CMedia (Unknown)" }, { HDA_CODEC_STACXXXX, "Sigmatel (Unknown)" }, { HDA_CODEC_SIIXXXX, "Silicon Image (Unknown)" }, From owner-svn-src-stable-7@FreeBSD.ORG Thu Dec 24 12:26:14 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48BDD1065694; Thu, 24 Dec 2009 12:26:14 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D7968FC08; Thu, 24 Dec 2009 12:26: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 nBOCQEZU030172; Thu, 24 Dec 2009 12:26:14 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOCQDwS030169; Thu, 24 Dec 2009 12:26:13 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200912241226.nBOCQDwS030169@svn.freebsd.org> From: Takahashi Yoshihiro Date: Thu, 24 Dec 2009 12:26:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200937 - in stable/7/sys/boot: i386/libi386 pc98/libpc98 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Dec 2009 12:26:14 -0000 Author: nyan Date: Thu Dec 24 12:26:13 2009 New Revision: 200937 URL: http://svn.freebsd.org/changeset/base/200937 Log: MFC: revision 200631 Fix debug messages of bd_io(). Modified: stable/7/sys/boot/i386/libi386/biosdisk.c stable/7/sys/boot/pc98/libpc98/biosdisk.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- stable/7/sys/boot/i386/libi386/biosdisk.c Thu Dec 24 12:19:52 2009 (r200936) +++ stable/7/sys/boot/i386/libi386/biosdisk.c Thu Dec 24 12:26:13 2009 (r200937) @@ -1274,11 +1274,11 @@ bd_io(struct open_disk *od, daddr_t dblk } if (write) - DEBUG("%d sectors from %lld to %p (0x%x) %s", x, dblk, p, VTOP(p), - result ? "failed" : "ok"); + DEBUG("Write %d sector(s) from %p (0x%x) to %lld %s", x, + p, VTOP(p), dblk, result ? "failed" : "ok"); else - DEBUG("%d sectors from %p (0x%x) to %lld %s", x, p, VTOP(p), dblk, - result ? "failed" : "ok"); + DEBUG("Read %d sector(s) from %lld to %p (0x%x) %s", x, + dblk, p, VTOP(p), result ? "failed" : "ok"); if (result) { return(-1); } Modified: stable/7/sys/boot/pc98/libpc98/biosdisk.c ============================================================================== --- stable/7/sys/boot/pc98/libpc98/biosdisk.c Thu Dec 24 12:19:52 2009 (r200936) +++ stable/7/sys/boot/pc98/libpc98/biosdisk.c Thu Dec 24 12:26:13 2009 (r200937) @@ -846,11 +846,11 @@ bd_io(struct open_disk *od, daddr_t dblk } if (write) - DEBUG("%d sectors from %lld to %p (0x%x) %s", x, dblk, p, VTOP(p), - result ? "failed" : "ok"); + DEBUG("Write %d sector(s) from %p (0x%x) to %lld %s", x, + p, VTOP(p), dblk, result ? "failed" : "ok"); else - DEBUG("%d sectors from %p (0x%x) to %lld %s", x, p, VTOP(p), dblk, - result ? "failed" : "ok"); + DEBUG("Read %d sector(s) from %lld to %p (0x%x) %s", x, + dblk, p, VTOP(p), result ? "failed" : "ok"); if (result) { return(-1); } From owner-svn-src-stable-7@FreeBSD.ORG Thu Dec 24 20:31:27 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 448721065679; Thu, 24 Dec 2009 20:31:27 +0000 (UTC) (envelope-from roam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 331B18FC17; Thu, 24 Dec 2009 20:31: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 nBOKVRMP040464; Thu, 24 Dec 2009 20:31:27 GMT (envelope-from roam@svn.freebsd.org) Received: (from roam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOKVRKN040462; Thu, 24 Dec 2009 20:31:27 GMT (envelope-from roam@svn.freebsd.org) Message-Id: <200912242031.nBOKVRKN040462@svn.freebsd.org> From: Peter Pentchev Date: Thu, 24 Dec 2009 20:31:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200961 - stable/7/share/man/man4 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Dec 2009 20:31:27 -0000 Author: roam (doc,ports committer) Date: Thu Dec 24 20:31:26 2009 New Revision: 200961 URL: http://svn.freebsd.org/changeset/base/200961 Log: MFC r199863: Fix the cross-reference to sctp_opt_info in the text - section 3, not 2. PR: 140938 Submitted by: Bruce Cran Modified: stable/7/share/man/man4/sctp.4 Directory Properties: stable/7/share/man/man4/ (props changed) Modified: stable/7/share/man/man4/sctp.4 ============================================================================== --- stable/7/share/man/man4/sctp.4 Thu Dec 24 20:29:58 2009 (r200960) +++ stable/7/share/man/man4/sctp.4 Thu Dec 24 20:31:26 2009 (r200961) @@ -179,7 +179,7 @@ supports a number of socket options whic and tested with .Xr getsockopt 2 or -.Xr sctp_opt_info 2 : +.Xr sctp_opt_info 3 : .Bl -tag -width ".Dv SCTP_SET_PEER_PRIMARY_ADDR" .It Dv SCTP_NODELAY Under most circumstances, From owner-svn-src-stable-7@FreeBSD.ORG Thu Dec 24 20:35:41 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DACF0106566B; Thu, 24 Dec 2009 20:35:41 +0000 (UTC) (envelope-from roam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C98E28FC1A; Thu, 24 Dec 2009 20:35: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 nBOKZftJ040665; Thu, 24 Dec 2009 20:35:41 GMT (envelope-from roam@svn.freebsd.org) Received: (from roam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOKZfUx040663; Thu, 24 Dec 2009 20:35:41 GMT (envelope-from roam@svn.freebsd.org) Message-Id: <200912242035.nBOKZfUx040663@svn.freebsd.org> From: Peter Pentchev Date: Thu, 24 Dec 2009 20:35:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200963 - stable/7/lib/libc/locale X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Dec 2009 20:35:42 -0000 Author: roam (doc,ports committer) Date: Thu Dec 24 20:35:41 2009 New Revision: 200963 URL: http://svn.freebsd.org/changeset/base/200963 Log: MFC r199244: Fix the grammar in the isgraph(3) description, almost as per the PR. PR: 140455 Submitted by: Jeremy Huddleston Modified: stable/7/lib/libc/locale/isgraph.3 Directory Properties: stable/7/lib/libc/ (props changed) Modified: stable/7/lib/libc/locale/isgraph.3 ============================================================================== --- stable/7/lib/libc/locale/isgraph.3 Thu Dec 24 20:35:01 2009 (r200962) +++ stable/7/lib/libc/locale/isgraph.3 Thu Dec 24 20:35:41 2009 (r200963) @@ -50,7 +50,7 @@ The function tests for any printing character except space .Pq Ql "\ " and other -locale specific space-like characters. +locale-specific space-like characters. The value of the argument must be representable as an .Vt "unsigned char" or the value of From owner-svn-src-stable-7@FreeBSD.ORG Fri Dec 25 21:28:16 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A4B6106568F; Fri, 25 Dec 2009 21:28:16 +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 78BFE8FC15; Fri, 25 Dec 2009 21:28: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 nBPLSGi7072013; Fri, 25 Dec 2009 21:28:16 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPLSGik072011; Fri, 25 Dec 2009 21:28:16 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200912252128.nBPLSGik072011@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 25 Dec 2009 21:28:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201002 - in stable/7/bin: . pwait X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Dec 2009 21:28:16 -0000 Author: jilles Date: Fri Dec 25 21:28:16 2009 New Revision: 201002 URL: http://svn.freebsd.org/changeset/base/201002 Log: MFC r199458: Add pwait utility, which waits for any process to terminate. This is similar to the Solaris utility of the same name. Some use cases: * rc.subr's wait_for_pids * interactive use, e.g. to shut down the computer when some task is done even if the task is already running Added: stable/7/bin/pwait/ - copied from r199458, head/bin/pwait/ Modified: stable/7/bin/Makefile Directory Properties: stable/7/bin/ (props changed) stable/7/bin/chflags/ (props changed) stable/7/bin/chio/ (props changed) stable/7/bin/cp/ (props changed) stable/7/bin/csh/ (props changed) stable/7/bin/dd/ (props changed) stable/7/bin/df/ (props changed) stable/7/bin/ln/ (props changed) stable/7/bin/pax/ (props changed) stable/7/bin/ps/ (props changed) stable/7/bin/rm/ (props changed) stable/7/bin/sh/ (props changed) Modified: stable/7/bin/Makefile ============================================================================== --- stable/7/bin/Makefile Fri Dec 25 21:14:34 2009 (r201001) +++ stable/7/bin/Makefile Fri Dec 25 21:28:16 2009 (r201002) @@ -26,6 +26,7 @@ SUBDIR= cat \ mv \ pax \ ps \ + pwait \ pwd \ ${_rcp} \ realpath \