From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 01:19:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 006951065693; Sun, 7 Nov 2010 01:19:41 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1E738FC08; Sun, 7 Nov 2010 01:19:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA71JeoO005370; Sun, 7 Nov 2010 01:19:40 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA71JeVl005368; Sun, 7 Nov 2010 01:19:40 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011070119.oA71JeVl005368@svn.freebsd.org> From: Lawrence Stewart Date: Sun, 7 Nov 2010 01:19: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: r214900 - stable/7/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 01:19:41 -0000 Author: lstewart Date: Sun Nov 7 01:19:40 2010 New Revision: 214900 URL: http://svn.freebsd.org/changeset/base/214900 Log: Remove siis.4 from the man4/Makefile. It was incorrectly included in r214875 as part of the SIFTR MFC and breaks buildworld as siis.4 doesn't exist in stable/7. This is an intentional direct commit to the 7-STABLE branch. Pointy hat to: lstewart Noticed by: Michael Butler Modified: stable/7/share/man/man4/Makefile Modified: stable/7/share/man/man4/Makefile ============================================================================== --- stable/7/share/man/man4/Makefile Sat Nov 6 22:07:22 2010 (r214899) +++ stable/7/share/man/man4/Makefile Sun Nov 7 01:19:40 2010 (r214900) @@ -315,7 +315,6 @@ MAN= aac.4 \ sge.4 \ si.4 \ siftr.4 \ - siis.4 \ sio.4 \ sis.4 \ sk.4 \ From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 03:09:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04FC9106566B; Sun, 7 Nov 2010 03:09:03 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E595E8FC18; Sun, 7 Nov 2010 03:09:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7392Ok011432; Sun, 7 Nov 2010 03:09:02 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7392v4011422; Sun, 7 Nov 2010 03:09:02 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201011070309.oA7392v4011422@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 7 Nov 2010 03:09:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214903 - in head/sys: conf mips/include mips/mips sys vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 03:09:03 -0000 Author: gonzo Date: Sun Nov 7 03:09:02 2010 New Revision: 214903 URL: http://svn.freebsd.org/changeset/base/214903 Log: - Add minidump support for FreeBSD/mips Added: head/sys/mips/mips/minidump_machdep.c (contents, props changed) Modified: head/sys/conf/files.mips head/sys/mips/include/cpuregs.h head/sys/mips/include/md_var.h head/sys/mips/include/pmap.h head/sys/mips/mips/dump_machdep.c head/sys/mips/mips/machdep.c head/sys/sys/kerneldump.h head/sys/vm/vm_page.c Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Sun Nov 7 02:20:34 2010 (r214902) +++ head/sys/conf/files.mips Sun Nov 7 03:09:02 2010 (r214903) @@ -55,6 +55,7 @@ mips/mips/db_trace.c optional ddb mips/mips/dump_machdep.c standard mips/mips/in_cksum.c optional inet mips/mips/locore.S standard no-obj +mips/mips/minidump_machdep.c standard mips/mips/mem.c optional mem mips/mips/nexus.c standard mips/mips/stack_machdep.c optional ddb | stack Modified: head/sys/mips/include/cpuregs.h ============================================================================== --- head/sys/mips/include/cpuregs.h Sun Nov 7 02:20:34 2010 (r214902) +++ head/sys/mips/include/cpuregs.h Sun Nov 7 03:09:02 2010 (r214903) @@ -181,6 +181,9 @@ #define MIPS_XUSEG_END 0x0000010000000000 #define MIPS_XKSEG_START 0xc000000000000000 #define MIPS_XKSEG_END 0xc00000ff80000000 +#define MIPS_XKSEG_COMPAT32_START 0xffffffff80000000 +#define MIPS_XKSEG_COMPAT32_END 0xffffffffffffffff +#define MIPS_XKSEG_TO_COMPAT32(va) ((va) & 0xffffffff) #ifdef __mips_n64 #define MIPS_DIRECT_MAPPABLE(pa) 1 Modified: head/sys/mips/include/md_var.h ============================================================================== --- head/sys/mips/include/md_var.h Sun Nov 7 02:20:34 2010 (r214902) +++ head/sys/mips/include/md_var.h Sun Nov 7 03:09:02 2010 (r214903) @@ -42,6 +42,8 @@ extern long Maxmem; extern char sigcode[]; extern int szsigcode, szosigcode; +extern uint32_t *vm_page_dump; +extern int vm_page_dump_size; extern vm_offset_t kstack0; extern vm_offset_t kernel_kseg0_end; @@ -74,4 +76,7 @@ void platform_identify(void); extern int busdma_swi_pending; void busdma_swi(void); + +struct dumperinfo; +void minidumpsys(struct dumperinfo *); #endif /* !_MACHINE_MD_VAR_H_ */ Modified: head/sys/mips/include/pmap.h ============================================================================== --- head/sys/mips/include/pmap.h Sun Nov 7 02:20:34 2010 (r214902) +++ head/sys/mips/include/pmap.h Sun Nov 7 03:09:02 2010 (r214903) @@ -144,6 +144,8 @@ extern vm_offset_t physmem_desc[PHYS_AVA extern vm_offset_t virtual_avail; extern vm_offset_t virtual_end; +extern vm_paddr_t dump_avail[PHYS_AVAIL_ENTRIES + 2]; + #define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT #define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) #define pmap_page_set_memattr(m, ma) (void)0 Modified: head/sys/mips/mips/dump_machdep.c ============================================================================== --- head/sys/mips/mips/dump_machdep.c Sun Nov 7 02:20:34 2010 (r214902) +++ head/sys/mips/mips/dump_machdep.c Sun Nov 7 03:09:02 2010 (r214903) @@ -1,35 +1,362 @@ /*- - * Copyright (c) 2006 Oleksandr Tymoshenko + * Copyright (c) 2002 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification, immediately at the beginning of the file. - * 2. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); -/* Note to writer, when using pmap_kenter_temporary() you must, - * after using the va to write out the page, call - * pmap_kenter_temporary_free(). You should probably also - * pin the dump thread to the CPU with sched_pin(). +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +CTASSERT(sizeof(struct kerneldumpheader) == 512); + +int do_minidump = 1; +TUNABLE_INT("debug.minidump", &do_minidump); +SYSCTL_INT(_debug, OID_AUTO, minidump, CTLFLAG_RW, &do_minidump, 0, + "Enable mini crash dumps"); + +/* + * Don't touch the first SIZEOF_METADATA bytes on the dump device. This + * is to protect us from metadata and to protect metadata from us. */ +#define SIZEOF_METADATA (64*1024) + +#define MD_ALIGN(x) (((off_t)(x) + PAGE_MASK) & ~PAGE_MASK) +#define DEV_ALIGN(x) (((off_t)(x) + (DEV_BSIZE-1)) & ~(DEV_BSIZE-1)) +extern struct pcb dumppcb; + +struct md_pa { + vm_paddr_t md_start; + vm_paddr_t md_size; +}; + +typedef int callback_t(struct md_pa *, int, void *); + +static struct kerneldumpheader kdh; +static off_t dumplo, fileofs; + +/* Handle buffered writes. */ +static char buffer[DEV_BSIZE]; +static size_t fragsz; + +/* XXX: I suppose 20 should be enough. */ +static struct md_pa dump_map[20]; + +static void +md_pa_init(void) +{ + int n, idx; + + bzero(dump_map, sizeof(dump_map)); + for (n = 0; n < sizeof(dump_map) / sizeof(dump_map[0]); n++) { + idx = n * 2; + if (dump_avail[idx] == 0 && dump_avail[idx + 1] == 0) + break; + dump_map[n].md_start = dump_avail[idx]; + dump_map[n].md_size = dump_avail[idx + 1] - dump_avail[idx]; + } +} + +static struct md_pa * +md_pa_first(void) +{ + + return (&dump_map[0]); +} + +static struct md_pa * +md_pa_next(struct md_pa *mdp) +{ + + mdp++; + if (mdp->md_size == 0) + mdp = NULL; + return (mdp); +} + +static int +buf_write(struct dumperinfo *di, char *ptr, size_t sz) +{ + size_t len; + int error; + + while (sz) { + len = DEV_BSIZE - fragsz; + if (len > sz) + len = sz; + bcopy(ptr, buffer + fragsz, len); + fragsz += len; + ptr += len; + sz -= len; + if (fragsz == DEV_BSIZE) { + error = dump_write(di, buffer, 0, dumplo, + DEV_BSIZE); + if (error) + return error; + dumplo += DEV_BSIZE; + fragsz = 0; + } + } + + return (0); +} + +static int +buf_flush(struct dumperinfo *di) +{ + int error; + + if (fragsz == 0) + return (0); + + error = dump_write(di, buffer, 0, dumplo, DEV_BSIZE); + dumplo += DEV_BSIZE; + fragsz = 0; + return (error); +} + +extern vm_offset_t kernel_l1kva; +extern char *pouet2; + +static int +cb_dumpdata(struct md_pa *mdp, int seqnr, void *arg) +{ + struct dumperinfo *di = (struct dumperinfo*)arg; + vm_paddr_t pa; + uint32_t pgs; + size_t counter, sz, chunk; + int c, error; + + error = 0; /* catch case in which chunk size is 0 */ + counter = 0; + pgs = mdp->md_size / PAGE_SIZE; + pa = mdp->md_start; + + printf(" chunk %d: %dMB (%d pages)", seqnr, pgs * PAGE_SIZE / ( + 1024*1024), pgs); + + /* Make sure we write coherent datas. */ + mips_dcache_wbinv_all(); + while (pgs) { + chunk = pgs; + if (chunk > MAXDUMPPGS) + chunk = MAXDUMPPGS; + sz = chunk << PAGE_SHIFT; + counter += sz; + if (counter >> 24) { + printf(" %d", pgs * PAGE_SIZE); + counter &= (1<<24) - 1; + } + + error = dump_write(di, (void *)(pa),0, dumplo, sz); + if (error) + break; + dumplo += sz; + pgs -= chunk; + pa += sz; + + /* Check for user abort. */ + c = cncheckc(); + if (c == 0x03) + return (ECANCELED); + if (c != -1) + printf(" (CTRL-C to abort) "); + } + printf(" ... %s\n", (error) ? "fail" : "ok"); + return (error); +} + +static int +cb_dumphdr(struct md_pa *mdp, int seqnr, void *arg) +{ + struct dumperinfo *di = (struct dumperinfo*)arg; + Elf_Phdr phdr; + uint64_t size; + int error; + + size = mdp->md_size; + bzero(&phdr, sizeof(phdr)); + phdr.p_type = PT_LOAD; + phdr.p_flags = PF_R; /* XXX */ + phdr.p_offset = fileofs; + phdr.p_vaddr = mdp->md_start; + phdr.p_paddr = mdp->md_start; + phdr.p_filesz = size; + phdr.p_memsz = size; + phdr.p_align = PAGE_SIZE; + + error = buf_write(di, (char*)&phdr, sizeof(phdr)); + fileofs += phdr.p_filesz; + return (error); +} + +static int +cb_size(struct md_pa *mdp, int seqnr, void *arg) +{ + uint32_t *sz = (uint32_t*)arg; + + *sz += (uint32_t)mdp->md_size; + return (0); +} + +static int +foreach_chunk(callback_t cb, void *arg) +{ + struct md_pa *mdp; + int error, seqnr; + + seqnr = 0; + mdp = md_pa_first(); + while (mdp != NULL) { + error = (*cb)(mdp, seqnr++, arg); + if (error) + return (-error); + mdp = md_pa_next(mdp); + } + return (seqnr); +} + +void +dumpsys(struct dumperinfo *di) +{ + Elf_Ehdr ehdr; + uint32_t dumpsize; + off_t hdrgap; + size_t hdrsz; + int error; + + if (do_minidump) { + minidumpsys(di); + return; + } + + bzero(&ehdr, sizeof(ehdr)); + ehdr.e_ident[EI_MAG0] = ELFMAG0; + ehdr.e_ident[EI_MAG1] = ELFMAG1; + ehdr.e_ident[EI_MAG2] = ELFMAG2; + ehdr.e_ident[EI_MAG3] = ELFMAG3; + ehdr.e_ident[EI_CLASS] = ELF_CLASS; +#if BYTE_ORDER == LITTLE_ENDIAN + ehdr.e_ident[EI_DATA] = ELFDATA2LSB; +#else + ehdr.e_ident[EI_DATA] = ELFDATA2MSB; +#endif + ehdr.e_ident[EI_VERSION] = EV_CURRENT; + ehdr.e_ident[EI_OSABI] = ELFOSABI_STANDALONE; /* XXX big picture? */ + ehdr.e_type = ET_CORE; + ehdr.e_machine = EM_MIPS; + ehdr.e_phoff = sizeof(ehdr); + ehdr.e_flags = 0; + ehdr.e_ehsize = sizeof(ehdr); + ehdr.e_phentsize = sizeof(Elf_Phdr); + ehdr.e_shentsize = sizeof(Elf_Shdr); + + md_pa_init(); + + /* Calculate dump size. */ + dumpsize = 0L; + ehdr.e_phnum = foreach_chunk(cb_size, &dumpsize); + hdrsz = ehdr.e_phoff + ehdr.e_phnum * ehdr.e_phentsize; + fileofs = MD_ALIGN(hdrsz); + dumpsize += fileofs; + hdrgap = fileofs - DEV_ALIGN(hdrsz); + + /* Determine dump offset on device. */ + if (di->mediasize < SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2) { + error = ENOSPC; + goto fail; + } + dumplo = di->mediaoffset + di->mediasize - dumpsize; + dumplo -= sizeof(kdh) * 2; + + mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_MIPS_VERSION, dumpsize, di->blocksize); + + printf("Dumping %llu MB (%d chunks)\n", (long long)dumpsize >> 20, + ehdr.e_phnum); + + /* Dump leader */ + error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + if (error) + goto fail; + dumplo += sizeof(kdh); + + /* Dump ELF header */ + error = buf_write(di, (char*)&ehdr, sizeof(ehdr)); + if (error) + goto fail; + + /* Dump program headers */ + error = foreach_chunk(cb_dumphdr, di); + if (error < 0) + goto fail; + buf_flush(di); + + /* + * All headers are written using blocked I/O, so we know the + * current offset is (still) block aligned. Skip the alignement + * in the file to have the segment contents aligned at page + * boundary. We cannot use MD_ALIGN on dumplo, because we don't + * care and may very well be unaligned within the dump device. + */ + dumplo += hdrgap; + + /* Dump memory chunks (updates dumplo) */ + error = foreach_chunk(cb_dumpdata, di); + if (error < 0) + goto fail; + + /* Dump trailer */ + error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + if (error) + goto fail; + + /* Signal completion, signoff and exit stage left. */ + dump_write(di, NULL, 0, 0, 0); + printf("\nDump complete\n"); + return; + + fail: + if (error < 0) + error = -error; + + if (error == ECANCELED) + printf("\nDump aborted\n"); + else if (error == ENOSPC) + printf("\nDump failed. Partition too small.\n"); + else + printf("\n** DUMP FAILED (ERROR %d) **\n", error); +} Modified: head/sys/mips/mips/machdep.c ============================================================================== --- head/sys/mips/mips/machdep.c Sun Nov 7 02:20:34 2010 (r214902) +++ head/sys/mips/mips/machdep.c Sun Nov 7 03:09:02 2010 (r214903) @@ -138,6 +138,7 @@ struct pcpu *pcpup = (struct pcpu *)pcpu vm_offset_t phys_avail[PHYS_AVAIL_ENTRIES + 2]; vm_offset_t physmem_desc[PHYS_AVAIL_ENTRIES + 2]; +vm_paddr_t dump_avail[PHYS_AVAIL_ENTRIES + 2]; #ifdef UNIMPLEMENTED struct platform platform; @@ -488,13 +489,6 @@ cpu_idle(int busy) panic("ints disabled in idleproc!"); } -void -dumpsys(struct dumperinfo *di __unused) -{ - - printf("Kernel dumps not implemented on this architecture\n"); -} - int cpu_idle_wakeup(int cpu) { Added: head/sys/mips/mips/minidump_machdep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mips/minidump_machdep.c Sun Nov 7 03:09:02 2010 (r214903) @@ -0,0 +1,340 @@ +/*- + * Copyright (c) 2010 Oleksandr Tymoshenko + * Copyright (c) 2008 Semihalf, Grzegorz Bernacki + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * from: FreeBSD: src/sys/arm/arm/minidump_machdep.c v214223 + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +CTASSERT(sizeof(struct kerneldumpheader) == 512); + +/* + * Don't touch the first SIZEOF_METADATA bytes on the dump device. This + * is to protect us from metadata and to protect metadata from us. + */ +#define SIZEOF_METADATA (64*1024) + +uint32_t *vm_page_dump; +int vm_page_dump_size; + +static struct kerneldumpheader kdh; +static off_t dumplo; +static off_t origdumplo; + +/* Handle chunked writes. */ +static uint64_t counter, progress; +/* Just auxiliary bufffer */ +static char tmpbuffer[PAGE_SIZE]; + +extern pd_entry_t *kernel_segmap; + +CTASSERT(sizeof(*vm_page_dump) == 4); + +static int +is_dumpable(vm_paddr_t pa) +{ + int i; + + for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { + if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) + return (1); + } + return (0); +} + +static void +dump_add_page(vm_paddr_t pa) +{ + int idx, bit; + + pa >>= PAGE_SHIFT; + idx = pa >> 5; /* 2^5 = 32 */ + bit = pa & 31; + atomic_set_int(&vm_page_dump[idx], 1ul << bit); +} + +static void +dump_drop_page(vm_paddr_t pa) +{ + int idx, bit; + + pa >>= PAGE_SHIFT; + idx = pa >> 5; /* 2^5 = 32 */ + bit = pa & 31; + atomic_clear_int(&vm_page_dump[idx], 1ul << bit); +} + +#define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8) + +static int +write_buffer(struct dumperinfo *di, char *ptr, size_t sz) +{ + size_t len; + int error, c; + u_int maxdumpsz; + + maxdumpsz = di->maxiosize; + + if (maxdumpsz == 0) /* seatbelt */ + maxdumpsz = PAGE_SIZE; + + error = 0; + + while (sz) { + len = min(maxdumpsz, sz); + counter += len; + progress -= len; + + if (counter >> 22) { + printf(" %jd", PG2MB(progress >> PAGE_SHIFT)); + counter &= (1<<22) - 1; + } + + if (ptr) { + error = dump_write(di, ptr, 0, dumplo, len); + if (error) + return (error); + dumplo += len; + ptr += len; + sz -= len; + } else { + panic("pa is not supported"); + } + + /* Check for user abort. */ + c = cncheckc(); + if (c == 0x03) + return (ECANCELED); + if (c != -1) + printf(" (CTRL-C to abort) "); + } + + return (0); +} + +void +minidumpsys(struct dumperinfo *di) +{ + struct minidumphdr mdhdr; + uint64_t dumpsize; + uint32_t ptesize; + uint32_t bits; + vm_paddr_t pa; + vm_offset_t prev_pte = 0; + uint32_t count = 0; + vm_offset_t va; + pt_entry_t *pte; + int i, bit, error; + void *dump_va; + + /* Flush cache */ + mips_dcache_wbinv_all(); + + counter = 0; + /* Walk page table pages, set bits in vm_page_dump */ + ptesize = 0; + + for (va = VM_MIN_KERNEL_ADDRESS; va < kernel_vm_end; va += NBPDR) { + ptesize += PAGE_SIZE; + pte = pmap_pte(kernel_pmap, va); + KASSERT(pte != NULL, ("pte for %jx is NULL", (uintmax_t)va)); + for (i = 0; i < NPTEPG; i++) { + if (pte_test(&pte[i], PTE_V)) { + pa = TLBLO_PTE_TO_PA(pte[i]); + if (is_dumpable(pa)) + dump_add_page(pa); + } + } + } + + /* + * Now mark pages from 0 to phys_avail[0], that's where kernel + * and pages allocated by pmap_steal reside + */ + for (pa = 0; pa < phys_avail[0]; pa += PAGE_SIZE) { + if (is_dumpable(pa)) + dump_add_page(pa); + } + + /* Calculate dump size. */ + dumpsize = ptesize; + dumpsize += round_page(msgbufp->msg_size); + dumpsize += round_page(vm_page_dump_size); + + for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) { + bits = vm_page_dump[i]; + while (bits) { + bit = ffs(bits) - 1; + pa = (((uint64_t)i * sizeof(*vm_page_dump) * NBBY) + + bit) * PAGE_SIZE; + /* Clear out undumpable pages now if needed */ + if (is_dumpable(pa)) + dumpsize += PAGE_SIZE; + else + dump_drop_page(pa); + bits &= ~(1ul << bit); + } + } + + dumpsize += PAGE_SIZE; + + /* Determine dump offset on device. */ + if (di->mediasize < SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2) { + error = ENOSPC; + goto fail; + } + + origdumplo = dumplo = di->mediaoffset + di->mediasize - dumpsize; + dumplo -= sizeof(kdh) * 2; + progress = dumpsize; + + /* Initialize mdhdr */ + bzero(&mdhdr, sizeof(mdhdr)); + strcpy(mdhdr.magic, MINIDUMP_MAGIC); + mdhdr.version = MINIDUMP_VERSION; + mdhdr.msgbufsize = msgbufp->msg_size; + mdhdr.bitmapsize = vm_page_dump_size; + mdhdr.ptesize = ptesize; + mdhdr.kernbase = VM_MIN_KERNEL_ADDRESS; + + mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_MIPS_VERSION, dumpsize, + di->blocksize); + + printf("Physical memory: %ju MB\n", + (uintmax_t)ptoa((uintmax_t)physmem) / 1048576); + printf("Dumping %llu MB:", (long long)dumpsize >> 20); + + /* Dump leader */ + error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + if (error) + goto fail; + dumplo += sizeof(kdh); + + /* Dump my header */ + bzero(tmpbuffer, sizeof(tmpbuffer)); + bcopy(&mdhdr, tmpbuffer, sizeof(mdhdr)); + error = write_buffer(di, tmpbuffer, PAGE_SIZE); + if (error) + goto fail; + + /* Dump msgbuf up front */ + error = write_buffer(di, (char *)msgbufp->msg_ptr, + round_page(msgbufp->msg_size)); + if (error) + goto fail; + + /* Dump bitmap */ + error = write_buffer(di, (char *)vm_page_dump, + round_page(vm_page_dump_size)); + if (error) + goto fail; + + /* Dump kernel page table pages */ + for (va = VM_MIN_KERNEL_ADDRESS; va < kernel_vm_end; va += NBPDR) { + pte = pmap_pte(kernel_pmap, va); + KASSERT(pte != NULL, ("pte for %jx is NULL", (uintmax_t)va)); + if (!count) { + prev_pte = (vm_offset_t)pte; + count++; + } + else { + if ((vm_offset_t)pte == (prev_pte + count * PAGE_SIZE)) + count++; + else { + error = write_buffer(di, (char*)prev_pte, + count * PAGE_SIZE); + if (error) + goto fail; + count = 1; + prev_pte = (vm_offset_t)pte; + } + } + } + + if (count) { + error = write_buffer(di, (char*)prev_pte, count * PAGE_SIZE); + if (error) + goto fail; + count = 0; + prev_pte = 0; + } + + /* Dump memory chunks page by page*/ + for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) { + bits = vm_page_dump[i]; + while (bits) { + bit = ffs(bits) - 1; + pa = (((uint64_t)i * sizeof(*vm_page_dump) * NBBY) + + bit) * PAGE_SIZE; + dump_va = pmap_kenter_temporary(pa, 0); + error = write_buffer(di, dump_va, PAGE_SIZE); + if (error) + goto fail; + pmap_kenter_temporary_free(pa); + bits &= ~(1ul << bit); + } + } + + /* Dump trailer */ + error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + if (error) + goto fail; + dumplo += sizeof(kdh); + + /* Signal completion, signoff and exit stage left. */ + dump_write(di, NULL, 0, 0, 0); + printf("\nDump complete\n"); + return; + +fail: + if (error < 0) + error = -error; + + if (error == ECANCELED) + printf("\nDump aborted\n"); + else if (error == ENOSPC) + printf("\nDump failed. Partition too small.\n"); + else + printf("\n** DUMP FAILED (ERROR %d) **\n", error); +} Modified: head/sys/sys/kerneldump.h ============================================================================== --- head/sys/sys/kerneldump.h Sun Nov 7 02:20:34 2010 (r214902) +++ head/sys/sys/kerneldump.h Sun Nov 7 03:09:02 2010 (r214903) @@ -71,6 +71,7 @@ struct kerneldumpheader { #define KERNELDUMP_ARM_VERSION 1 #define KERNELDUMP_I386_VERSION 2 #define KERNELDUMP_IA64_VERSION 1 +#define KERNELDUMP_MIPS_VERSION 1 #define KERNELDUMP_POWERPC_VERSION 1 #define KERNELDUMP_SPARC64_VERSION 1 #define KERNELDUMP_TEXT_VERSION 1 Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Nov 7 02:20:34 2010 (r214902) +++ head/sys/vm/vm_page.c Sun Nov 7 03:09:02 2010 (r214903) @@ -359,7 +359,8 @@ vm_page_startup(vm_offset_t vaddr) bzero((void *)mapped, end - new_end); uma_startup((void *)mapped, boot_pages); -#if defined(__amd64__) || defined(__i386__) || defined(__arm__) +#if defined(__amd64__) || defined(__i386__) || defined(__arm__) || \ + defined(__mips__) /* * Allocate a bitmap to indicate that a random physical page * needs to be included in a minidump. From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 03:26:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 476DD106566C; Sun, 7 Nov 2010 03:26:23 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 348418FC14; Sun, 7 Nov 2010 03:26:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA73QNPL012381; Sun, 7 Nov 2010 03:26:23 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA73QNcK012376; Sun, 7 Nov 2010 03:26:23 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201011070326.oA73QNcK012376@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 7 Nov 2010 03:26:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214904 - head/lib/libkvm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 03:26:23 -0000 Author: gonzo Date: Sun Nov 7 03:26:22 2010 New Revision: 214904 URL: http://svn.freebsd.org/changeset/base/214904 Log: Add minidump support for MIPS Added: head/lib/libkvm/kvm_minidump_mips.c (contents, props changed) Modified: head/lib/libkvm/Makefile head/lib/libkvm/kvm_mips.c head/lib/libkvm/kvm_private.h Modified: head/lib/libkvm/Makefile ============================================================================== --- head/lib/libkvm/Makefile Sun Nov 7 03:09:02 2010 (r214903) +++ head/lib/libkvm/Makefile Sun Nov 7 03:26:22 2010 (r214904) @@ -20,7 +20,7 @@ WARNS?= 0 SRCS= kvm.c kvm_${KVM_ARCH}.c kvm_cptime.c kvm_file.c kvm_getloadavg.c \ kvm_getswapinfo.c kvm_pcpu.c kvm_proc.c kvm_vnet.c .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \ - ${MACHINE_CPUARCH} == "arm" + ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips" SRCS+= kvm_minidump_${KVM_ARCH}.c .endif INCS= kvm.h Added: head/lib/libkvm/kvm_minidump_mips.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libkvm/kvm_minidump_mips.c Sun Nov 7 03:26:22 2010 (r214904) @@ -0,0 +1,275 @@ +/*- + * Copyright (c) 2010 Oleksandr Tymoshenko + * Copyright (c) 2008 Semihalf, Grzegorz Bernacki + * Copyright (c) 2006 Peter Wemm + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * From: FreeBSD: src/lib/libkvm/kvm_minidump_arm.c r214223 + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * MIPS machine dependent routines for kvm and minidumps. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include "kvm_private.h" + +struct hpte { + struct hpte *next; + uint64_t pa; + int64_t off; +}; + +#define HPT_SIZE 1024 + +/* minidump must be the first field */ +struct vmstate { + int minidump; /* 1 = minidump mode */ + struct minidumphdr hdr; + void *hpt_head[HPT_SIZE]; + uint32_t *bitmap; + void *ptemap; +}; + +static void +hpt_insert(kvm_t *kd, uint64_t pa, int64_t off) +{ + struct hpte *hpte; + uint32_t fnv = FNV1_32_INIT; + + fnv = fnv_32_buf(&pa, sizeof(pa), fnv); + fnv &= (HPT_SIZE - 1); + hpte = malloc(sizeof(*hpte)); + hpte->pa = pa; + hpte->off = off; + hpte->next = kd->vmst->hpt_head[fnv]; + kd->vmst->hpt_head[fnv] = hpte; +} + +static int64_t +hpt_find(kvm_t *kd, uint64_t pa) +{ + struct hpte *hpte; + uint32_t fnv = FNV1_32_INIT; + + fnv = fnv_32_buf(&pa, sizeof(pa), fnv); + fnv &= (HPT_SIZE - 1); + for (hpte = kd->vmst->hpt_head[fnv]; hpte != NULL; hpte = hpte->next) + if (pa == hpte->pa) + return (hpte->off); + + return (-1); +} + +static int +inithash(kvm_t *kd, uint32_t *base, int len, off_t off) +{ + uint64_t idx, pa; + uint32_t bit, bits; + + for (idx = 0; idx < len / sizeof(*base); idx++) { + bits = base[idx]; + while (bits) { + bit = ffs(bits) - 1; + bits &= ~(1ul << bit); + pa = (idx * sizeof(*base) * NBBY + bit) * PAGE_SIZE; + hpt_insert(kd, pa, off); + off += PAGE_SIZE; + } + } + + return (off); +} + +void +_kvm_minidump_freevtop(kvm_t *kd) +{ + struct vmstate *vm = kd->vmst; + + if (vm->bitmap) + free(vm->bitmap); + if (vm->ptemap) + free(vm->ptemap); + free(vm); + kd->vmst = NULL; +} + +int +_kvm_minidump_initvtop(kvm_t *kd) +{ + u_long pa; + struct vmstate *vmst; + off_t off; + + vmst = _kvm_malloc(kd, sizeof(*vmst)); + if (vmst == 0) { + _kvm_err(kd, kd->program, "cannot allocate vm"); + return (-1); + } + + kd->vmst = vmst; + vmst->minidump = 1; + + off = lseek(kd->pmfd, 0, SEEK_CUR); + if (pread(kd->pmfd, &vmst->hdr, + sizeof(vmst->hdr), 0) != sizeof(vmst->hdr)) { + _kvm_err(kd, kd->program, "cannot read dump header"); + return (-1); + } + + if (strncmp(MINIDUMP_MAGIC, vmst->hdr.magic, + sizeof(vmst->hdr.magic)) != 0) { + _kvm_err(kd, kd->program, "not a minidump for this platform"); + return (-1); + } + if (vmst->hdr.version != MINIDUMP_VERSION) { + _kvm_err(kd, kd->program, "wrong minidump version. " + "Expected %d got %d", MINIDUMP_VERSION, vmst->hdr.version); + return (-1); + } + + /* Skip header and msgbuf */ + off = PAGE_SIZE + round_page(vmst->hdr.msgbufsize); + + vmst->bitmap = _kvm_malloc(kd, vmst->hdr.bitmapsize); + if (vmst->bitmap == NULL) { + _kvm_err(kd, kd->program, "cannot allocate %d bytes for " + "bitmap", vmst->hdr.bitmapsize); + return (-1); + } + + if (pread(kd->pmfd, vmst->bitmap, vmst->hdr.bitmapsize, off) != + vmst->hdr.bitmapsize) { + _kvm_err(kd, kd->program, "cannot read %d bytes for page bitmap", + vmst->hdr.bitmapsize); + return (-1); + } + off += round_page(vmst->hdr.bitmapsize); + + vmst->ptemap = _kvm_malloc(kd, vmst->hdr.ptesize); + if (vmst->ptemap == NULL) { + _kvm_err(kd, kd->program, "cannot allocate %d bytes for " + "ptemap", vmst->hdr.ptesize); + return (-1); + } + + if (pread(kd->pmfd, vmst->ptemap, vmst->hdr.ptesize, off) != + vmst->hdr.ptesize) { + _kvm_err(kd, kd->program, "cannot read %d bytes for ptemap", + vmst->hdr.ptesize); + return (-1); + } + + off += vmst->hdr.ptesize; + + /* Build physical address hash table for sparse pages */ + inithash(kd, vmst->bitmap, vmst->hdr.bitmapsize, off); + + return (0); +} + +int +_kvm_minidump_kvatop(kvm_t *kd, u_long va, off_t *pa) +{ + struct vmstate *vm; + pt_entry_t pte; + u_long offset, pteindex, a; + off_t ofs; + pt_entry_t *ptemap; + int i; + + if (ISALIVE(kd)) { + _kvm_err(kd, 0, "kvm_kvatop called in live kernel!"); + return (0); + } + + offset = va & PAGE_MASK; + /* Operate with page-aligned address */ + va &= ~PAGE_MASK; + + vm = kd->vmst; + ptemap = vm->ptemap; + +#if defined(__mips_n64) + if (va >= MIPS_XKPHYS_START && va < MIPS_XKPHYS_END) + a = (MIPS_XKPHYS_TO_PHYS(va)); + else +#endif + if (va >= MIPS_KSEG0_START && va < MIPS_KSEG0_END) + a = (MIPS_KSEG0_TO_PHYS(va)); + else if (va >= MIPS_KSEG1_START && va < MIPS_KSEG1_END) + a = (MIPS_KSEG1_TO_PHYS(va)); + else if (va >= vm->hdr.kernbase) { + pteindex = (va - vm->hdr.kernbase) >> PAGE_SHIFT; + pte = ptemap[pteindex]; + if (!pte) { + _kvm_err(kd, kd->program, "_kvm_vatop: pte not valid"); + goto invalid; + } + + a = TLBLO_PTE_TO_PA(pte); + + } else { + _kvm_err(kd, kd->program, "_kvm_vatop: virtual address 0x%lx " + "not minidumped", va); + return (0); + } + + ofs = hpt_find(kd, a); + if (ofs == -1) { + _kvm_err(kd, kd->program, "_kvm_vatop: physical " + "address 0x%lx not in minidump", a); + goto invalid; + } + + *pa = ofs + offset; + return (PAGE_SIZE - offset); + + +invalid: + _kvm_err(kd, 0, "invalid address (0x%lx)", va); + return (0); +} Modified: head/lib/libkvm/kvm_mips.c ============================================================================== --- head/lib/libkvm/kvm_mips.c Sun Nov 7 03:09:02 2010 (r214903) +++ head/lib/libkvm/kvm_mips.c Sun Nov 7 03:26:22 2010 (r214904) @@ -49,29 +49,62 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include "kvm_private.h" +/* minidump must be the first item! */ +struct vmstate { + int minidump; /* 1 = minidump mode */ + void *mmapbase; + size_t mmapsize; +}; + void _kvm_freevtop(kvm_t *kd) { - - _kvm_err(kd, 0, "Unimplemented function"); + if (kd->vmst != 0) { + if (kd->vmst->minidump) + return (_kvm_minidump_freevtop(kd)); + if (kd->vmst->mmapbase != NULL) + munmap(kd->vmst->mmapbase, kd->vmst->mmapsize); + free(kd->vmst); + kd->vmst = NULL; + } } int _kvm_initvtop(kvm_t *kd) { + char minihdr[8]; - _kvm_err(kd, 0, "Unimplemented function"); - return (0); + if (!kd->rawdump) { + if (pread(kd->pmfd, &minihdr, 8, 0) == 8) { + if (memcmp(&minihdr, "minidump", 8) == 0) + return (_kvm_minidump_initvtop(kd)); + } else { + _kvm_err(kd, kd->program, "cannot read header"); + return (-1); + } + } + + _kvm_err(kd, 0, "_kvm_initvtop: Unsupported image type"); + return (-1); } int -_kvm_kvatop(kvm_t *kd, u_long va __unused, off_t *pa __unused) +_kvm_kvatop(kvm_t *kd, u_long va , off_t *pa) { - _kvm_err(kd, 0, "Unimplemented function"); + u_long offset = va & (PAGE_SIZE - 1); + struct vmstate *vm = kd->vmst; + + if (kd->vmst->minidump) + return _kvm_minidump_kvatop(kd, va, pa); + + + _kvm_err(kd, 0, "_kvm_kvatop: Unsupported image type"); return (0); } @@ -81,10 +114,8 @@ _kvm_kvatop(kvm_t *kd, u_long va __unuse * have to deal with these NOT being constants! (i.e. m68k) */ int -_kvm_mdopen(kd) - kvm_t *kd; +_kvm_mdopen(kvm_t *kd __unused) { - _kvm_err(kd, 0, "Unimplemented function"); return (0); } Modified: head/lib/libkvm/kvm_private.h ============================================================================== --- head/lib/libkvm/kvm_private.h Sun Nov 7 03:09:02 2010 (r214903) +++ head/lib/libkvm/kvm_private.h Sun Nov 7 03:26:22 2010 (r214904) @@ -104,7 +104,8 @@ uintptr_t _kvm_vnet_validaddr(kvm_t *, u int _kvm_dpcpu_initialized(kvm_t *, int); uintptr_t _kvm_dpcpu_validaddr(kvm_t *, uintptr_t); -#if defined(__amd64__) || defined(__i386__) || defined(__arm__) +#if defined(__amd64__) || defined(__i386__) || defined(__arm__) || \ + defined(__mips__) void _kvm_minidump_freevtop(kvm_t *); int _kvm_minidump_initvtop(kvm_t *); int _kvm_minidump_kvatop(kvm_t *, u_long, off_t *); From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 03:40:37 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A3051065672; Sun, 7 Nov 2010 03:40:37 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77FA38FC12; Sun, 7 Nov 2010 03:40:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA73ebMx013350; Sun, 7 Nov 2010 03:40:37 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA73ebRw013346; Sun, 7 Nov 2010 03:40:37 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201011070340.oA73ebRw013346@svn.freebsd.org> From: Tim Kientzle Date: Sun, 7 Nov 2010 03:40:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214905 - in head/lib/libarchive: . test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 03:40:37 -0000 Author: kientzle Date: Sun Nov 7 03:40:37 2010 New Revision: 214905 URL: http://svn.freebsd.org/changeset/base/214905 Log: If the Zip reader doesn't see a PK signature block because there's inter-entry garbage, just scan forward to find the next one. This allows us to handle a lot of Zip archives that have been modified in-place. Thanks to: Gleb Kurtsou for sending me a sample archive Added: head/lib/libarchive/test/test_compat_zip_2.zip.uu (contents, props changed) Modified: head/lib/libarchive/archive_read_support_format_zip.c head/lib/libarchive/test/test_compat_zip.c Modified: head/lib/libarchive/archive_read_support_format_zip.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_zip.c Sun Nov 7 03:26:22 2010 (r214904) +++ head/lib/libarchive/archive_read_support_format_zip.c Sun Nov 7 03:40:37 2010 (r214905) @@ -128,6 +128,7 @@ static int archive_read_format_zip_read_ static int archive_read_format_zip_read_data_skip(struct archive_read *a); static int archive_read_format_zip_read_header(struct archive_read *, struct archive_entry *); +static int search_next_signature(struct archive_read *); static int zip_read_data_deflate(struct archive_read *a, const void **buff, size_t *size, off_t *offset); static int zip_read_data_none(struct archive_read *a, const void **buff, @@ -317,10 +318,17 @@ archive_read_format_zip_read_header(stru signature = (const char *)h; } + /* If we don't see a PK signature here, scan forward. */ if (signature[0] != 'P' || signature[1] != 'K') { - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Bad ZIP file"); - return (ARCHIVE_FATAL); + r = search_next_signature(a); + if (r != ARCHIVE_OK) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Bad ZIP file"); + return (ARCHIVE_FATAL); + } + if ((h = __archive_read_ahead(a, 4, NULL)) == NULL) + return (ARCHIVE_FATAL); + signature = (const char *)h; } /* @@ -375,6 +383,42 @@ archive_read_format_zip_read_header(stru } static int +search_next_signature(struct archive_read *a) +{ + const void *h; + const char *p, *q; + size_t skip; + ssize_t bytes; + int64_t skipped = 0; + + for (;;) { + h = __archive_read_ahead(a, 4, &bytes); + if (h == NULL) + return (ARCHIVE_FATAL); + p = h; + q = p + bytes; + + while (p + 4 <= q) { + if (p[0] == 'P' && p[1] == 'K') { + if ((p[2] == '\001' && p[3] == '\002') + || (p[2] == '\003' && p[3] == '\004') + || (p[2] == '\005' && p[3] == '\006') + || (p[2] == '\007' && p[3] == '\010') + || (p[2] == '0' && p[3] == '0')) { + skip = p - (const char *)h; + __archive_read_consume(a, skip); + return (ARCHIVE_OK); + } + } + ++p; + } + skip = p - (const char *)h; + __archive_read_consume(a, skip); + skipped += skip; + } +} + +static int zip_read_file_header(struct archive_read *a, struct archive_entry *entry, struct zip *zip) { @@ -888,6 +932,9 @@ process_extra(const void* extra, struct if (datasize >= 4) zip->gid = archive_le16dec(p + offset + 2); break; + case 0x7875: + /* Info-Zip Unix Extra Field (type 3) "ux". */ + break; default: break; } Modified: head/lib/libarchive/test/test_compat_zip.c ============================================================================== --- head/lib/libarchive/test/test_compat_zip.c Sun Nov 7 03:26:22 2010 (r214904) +++ head/lib/libarchive/test/test_compat_zip.c Sun Nov 7 03:40:37 2010 (r214905) @@ -71,10 +71,43 @@ finish: #endif } +/* + * Verify that we skip junk between entries. The compat_zip_2.zip file + * has several bytes of junk between 'file1' and 'file2'. Such + * junk is routinely introduced by some Zip writers when they manipulate + * existing zip archives. + */ +static void +test_compat_zip_2(void) +{ + char name[] = "test_compat_zip_2.zip"; + struct archive_entry *ae; + struct archive *a; + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); + extract_reference_file(name); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240)); + + /* Read first entry. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("file1", archive_entry_pathname(ae)); + + /* Read first entry. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("file2", archive_entry_pathname(ae)); + + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + DEFINE_TEST(test_compat_zip) { test_compat_zip_1(); + test_compat_zip_2(); } Added: head/lib/libarchive/test/test_compat_zip_2.zip.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_compat_zip_2.zip.uu Sun Nov 7 03:40:37 2010 (r214905) @@ -0,0 +1,10 @@ +$FreeBSD$ + +begin 644 test_compat_zip_2.zip +M4$L#!`H``````'V59CT````````````````%````9FEL93$M2E5.2RU02P,$ +M"@``````@95F/<>D!,D&````!@````4```!F:6QE,F9I;&4R"E!+`0(>`PH` +M`````'V59CT````````````````%``````````````"D@0````!F:6QE,5!+ +M`0(>`PH``````(&59CW'I`3)!@````8````%``````````````"D@2D```!F +::6QE,E!+!08``````@`"`&8```!2```````` +` +end From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 04:09:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C17C106567A; Sun, 7 Nov 2010 04:09:46 +0000 (UTC) (envelope-from swell.k@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id E0B778FC12; Sun, 7 Nov 2010 04:09:45 +0000 (UTC) Received: by ywh2 with SMTP id 2so2998508ywh.13 for ; Sat, 06 Nov 2010 21:09:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type; bh=ydTEUQzrK+zOVsvg0sI3hnN7CRiwANdHzVw1kynBnxA=; b=B3/eAjwVyvZM94Ctmv6y/gM+lPwJCnNROc0P71on5kIfUQCOaCAcyG2CIbGKLAr4yJ P78ZUG20aQ/dmCvk/PWfiSt5eS0+7q7mKB9dvK2NGay5unPnI1f8m4S6NvtJKIuuOOts /vmPJovtlzLOCIgMMR34hxDg7nomYzEx3lCX8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=df4REDT+LmkyMTe4KeCf35QJ61IYDxote99C7QxUc9F4wTHj386T9qCVX259McaYP5 bJEnVcUKn6AQrBJYd5sQmb2HAhTNZ6pNNYy60thnnLGGTIf1H8269WwciPeQkio1ACN8 CJNqC8Mx/KmT47ZlD8VkbkHiex/dTruTKc99A= Received: by 10.91.11.15 with SMTP id o15mr3418488agi.206.1289102984160; Sat, 06 Nov 2010 21:09:44 -0700 (PDT) Received: from localhost ([200.58.118.143]) by mx.google.com with ESMTPS id r18sm3960344ann.29.2010.11.06.21.09.35 (version=SSLv3 cipher=RC4-MD5); Sat, 06 Nov 2010 21:09:43 -0700 (PDT) From: Anonymous To: Tim Kientzle References: <201011070340.oA73ebRw013346@svn.freebsd.org> Date: Sun, 07 Nov 2010 07:09:24 +0300 In-Reply-To: <201011070340.oA73ebRw013346@svn.freebsd.org> (Tim Kientzle's message of "Sun, 7 Nov 2010 03:40:37 +0000 (UTC)") Message-ID: <86wroppyff.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214905 - in head/lib/libarchive: . test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 04:09:46 -0000 Tim Kientzle writes: > Author: kientzle > Date: Sun Nov 7 03:40:37 2010 > New Revision: 214905 > URL: http://svn.freebsd.org/changeset/base/214905 > > Log: > If the Zip reader doesn't see a PK signature block > because there's inter-entry garbage, just scan forward > to find the next one. This allows us to handle a lot > of Zip archives that have been modified in-place. It's unrelated but can you also look at archives produces by Mojo Setup? http://icculus.org/mojosetup/examples/ $ /usr/bin/unzip duke3d-mojosetup-linux-x86.bin Archive: duke3d-mojosetup-linux-x86.bin unzip: Unrecognized archive format zsh: exit 1 $ LOCALBASE/bin/unzip duke3d-mojosetup-linux-x86.bin Archive: duke3d-mojosetup-linux-x86.bin warning [duke3d-mojosetup-linux-x86.bin]: 157716 extra bytes at beginning or within zipfile (attempting to process anyway) creating: data/ inflating: data/duke3d_readme.txt inflating: data/duke3d.png inflating: data/mojosetup_readme.txt inflating: data/gpl.txt creating: guis/ inflating: guis/libmojosetupgui_ncurses.so inflating: guis/libmojosetupgui_gtkplus2.so creating: meta/ inflating: meta/splash.bmp creating: meta/xdg-utils/ inflating: meta/xdg-utils/xdg-desktop-menu inflating: meta/xdg-utils/xdg-open creating: scripts/ inflating: scripts/config.luac inflating: scripts/localization.luac inflating: scripts/mojosetup_init.luac inflating: scripts/app_localization.luac inflating: scripts/mojosetup_mainline.luac zsh: exit 1 From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 07:16:35 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92501106566C; Sun, 7 Nov 2010 07:16:35 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8130F8FC08; Sun, 7 Nov 2010 07:16:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA77GZDv024795; Sun, 7 Nov 2010 07:16:35 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA77GZhG024793; Sun, 7 Nov 2010 07:16:35 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201011070716.oA77GZhG024793@svn.freebsd.org> From: Joel Dahl Date: Sun, 7 Nov 2010 07:16:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214907 - head/usr.sbin/apmd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 07:16:35 -0000 Author: joel (doc committer) Date: Sun Nov 7 07:16:35 2010 New Revision: 214907 URL: http://svn.freebsd.org/changeset/base/214907 Log: Remove extraneous Aq. Modified: head/usr.sbin/apmd/apmd.8 Modified: head/usr.sbin/apmd/apmd.8 ============================================================================== --- head/usr.sbin/apmd/apmd.8 Sun Nov 7 06:46:52 2010 (r214906) +++ head/usr.sbin/apmd/apmd.8 Sun Nov 7 07:16:35 2010 (r214907) @@ -1,6 +1,6 @@ .\" Copyright (c) 1999 Mitsuru IWASAKI .\" Copyright (c) 1999 KOIE Hidetaka -.\" Copyright (c) 1999 Yoshihiko SARUMARU Aq +.\" Copyright (c) 1999 Yoshihiko SARUMARU .\" Copyright (c) 1999 Norihiro Kumagai .\" All rights reserved. .\" From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 10:49:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 906991065673; Sun, 7 Nov 2010 10:49:40 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 64A168FC0A; Sun, 7 Nov 2010 10:49:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7Ane22038729; Sun, 7 Nov 2010 10:49:40 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Ane6b038728; Sun, 7 Nov 2010 10:49:40 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201011071049.oA7Ane6b038728@svn.freebsd.org> From: Ulrich Spoerlein Date: Sun, 7 Nov 2010 10:49:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214908 - head/usr.bin/objformat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 10:49:40 -0000 Author: uqs Date: Sun Nov 7 10:49:40 2010 New Revision: 214908 URL: http://svn.freebsd.org/changeset/base/214908 Log: Retire objformat(1), take two. It's been almost four years, and this placeholder has not been needed. Deleted: head/usr.bin/objformat/ From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 11:12:30 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F44A106566B; Sun, 7 Nov 2010 11:12:30 +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 785618FC14; Sun, 7 Nov 2010 11:12:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7BCU06040098; Sun, 7 Nov 2010 11:12:30 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7BCTLa040057; Sun, 7 Nov 2010 11:12:30 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071112.oA7BCTLa040057@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 11:12:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214909 - in stable/8/sys: arm/xscale/ixp425 dev/ae dev/age dev/alc dev/ale dev/bfe dev/bge dev/bm dev/cas dev/dc dev/fxp dev/gem dev/hme dev/jme dev/mge dev/mii dev/msk dev/pcn dev/re ... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 11:12:30 -0000 Author: marius Date: Sun Nov 7 11:12:29 2010 New Revision: 214909 URL: http://svn.freebsd.org/changeset/base/214909 Log: MFC: r213893, r213908, r214566, r214605, r214846 Convert the PHY drivers to honor the mii_flags passed down and convert the NIC drivers as well as the PHY drivers to take advantage of the mii_attach() introduced in r213878 (MFC'ed to stable/8 in r214684) to get rid of certain hacks. For the most part these were: - Artificially limiting miibus_{read,write}reg methods to certain PHY addresses; we now let mii_attach() only probe the PHY at the desired address(es) instead. - PHY drivers setting MIIF_* flags based on the NIC driver they hang off from, partly even based on grabbing and using the softc of the parent; we now pass these flags down from the NIC to the PHY drivers via mii_attach(). This got us rid of all such hacks except those of brgphy() in combination with bce(4) and bge(4), which is way beyond what can be expressed with simple flags. While at it, I took the opportunity to change the NIC drivers to pass up the error returned by mii_attach() (previously by mii_phy_probe()) and unify the error message used in this case where and as appropriate as mii_attach() actually can fail for a number of reasons, not just because of no PHY(s) being present at the expected address(es). Reviewed by: jhb, yongari Modified: stable/8/sys/arm/xscale/ixp425/if_npe.c stable/8/sys/dev/ae/if_ae.c stable/8/sys/dev/ae/if_aevar.h stable/8/sys/dev/age/if_age.c stable/8/sys/dev/alc/if_alc.c stable/8/sys/dev/ale/if_ale.c stable/8/sys/dev/bfe/if_bfe.c stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.h stable/8/sys/dev/bm/if_bm.c stable/8/sys/dev/cas/if_cas.c stable/8/sys/dev/cas/if_casvar.h stable/8/sys/dev/dc/dcphy.c stable/8/sys/dev/dc/if_dc.c stable/8/sys/dev/dc/pnphy.c stable/8/sys/dev/fxp/if_fxp.c stable/8/sys/dev/gem/if_gem.c stable/8/sys/dev/gem/if_gemvar.h stable/8/sys/dev/hme/if_hme.c stable/8/sys/dev/jme/if_jme.c stable/8/sys/dev/mge/if_mge.c stable/8/sys/dev/mii/acphy.c stable/8/sys/dev/mii/amphy.c stable/8/sys/dev/mii/atphy.c stable/8/sys/dev/mii/axphy.c stable/8/sys/dev/mii/bmtphy.c stable/8/sys/dev/mii/brgphy.c stable/8/sys/dev/mii/ciphy.c stable/8/sys/dev/mii/e1000phy.c stable/8/sys/dev/mii/exphy.c stable/8/sys/dev/mii/gentbi.c stable/8/sys/dev/mii/icsphy.c stable/8/sys/dev/mii/inphy.c stable/8/sys/dev/mii/ip1000phy.c stable/8/sys/dev/mii/jmphy.c stable/8/sys/dev/mii/lxtphy.c stable/8/sys/dev/mii/miivar.h stable/8/sys/dev/mii/mlphy.c stable/8/sys/dev/mii/nsgphy.c stable/8/sys/dev/mii/nsphy.c stable/8/sys/dev/mii/nsphyter.c stable/8/sys/dev/mii/pnaphy.c stable/8/sys/dev/mii/qsphy.c stable/8/sys/dev/mii/rgephy.c stable/8/sys/dev/mii/rlphy.c stable/8/sys/dev/mii/rlswitch.c stable/8/sys/dev/mii/ruephy.c stable/8/sys/dev/mii/smcphy.c stable/8/sys/dev/mii/tdkphy.c stable/8/sys/dev/mii/tlphy.c stable/8/sys/dev/mii/truephy.c stable/8/sys/dev/mii/ukphy.c stable/8/sys/dev/mii/xmphy.c stable/8/sys/dev/msk/if_msk.c stable/8/sys/dev/pcn/if_pcn.c stable/8/sys/dev/re/if_re.c stable/8/sys/dev/sk/if_sk.c stable/8/sys/dev/ste/if_ste.c stable/8/sys/dev/stge/if_stge.c stable/8/sys/dev/tsec/if_tsec.c stable/8/sys/dev/vge/if_vge.c stable/8/sys/dev/vr/if_vr.c stable/8/sys/dev/vr/if_vrreg.h stable/8/sys/dev/xl/if_xl.c stable/8/sys/pci/if_rl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/arm/xscale/ixp425/if_npe.c ============================================================================== --- stable/8/sys/arm/xscale/ixp425/if_npe.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/arm/xscale/ixp425/if_npe.c Sun Nov 7 11:12:29 2010 (r214909) @@ -137,7 +137,6 @@ struct npe_softc { int rx_freeqid; /* rx free buffers qid */ int tx_qid; /* tx qid */ int tx_doneqid; /* tx completed qid */ - int sc_phy; /* PHY id */ struct ifmib_iso_8802_3 mibdata; bus_dma_tag_t sc_stats_tag; /* bus dma tag for stats block */ struct npestats *sc_stats; @@ -668,7 +667,7 @@ static int npe_activate(device_t dev) { struct npe_softc *sc = device_get_softc(dev); - int error, i, macbase, miibase; + int error, i, macbase, miibase, phy; /* * Setup NEP ID, MAC, and MII bindings. We allow override @@ -693,8 +692,8 @@ npe_activate(device_t dev) } /* PHY */ - if (!override_unit(dev, "phy", &sc->sc_phy, 0, MII_NPHY-1)) - sc->sc_phy = npeconfig[sc->sc_npeid].phy; + if (!override_unit(dev, "phy", &phy, 0, MII_NPHY - 1)) + phy = npeconfig[sc->sc_npeid].phy; if (!override_addr(dev, "mii", &miibase)) miibase = npeconfig[sc->sc_npeid].miibase; device_printf(sc->sc_dev, "MII at 0x%x\n", miibase); @@ -721,10 +720,12 @@ npe_activate(device_t dev) return error; } - /* probe for PHY */ - if (mii_phy_probe(dev, &sc->sc_mii, npe_ifmedia_update, npe_ifmedia_status)) { - device_printf(dev, "cannot find PHY %d.\n", sc->sc_phy); - return ENXIO; + /* attach PHY */ + error = mii_attach(dev, &sc->sc_mii, sc->sc_ifp, npe_ifmedia_update, + npe_ifmedia_status, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); + return error; } error = npe_dma_setup(sc, &sc->txdma, "tx", npe_txbuf, NPE_MAXSEG); @@ -1700,8 +1701,6 @@ npe_miibus_readreg(device_t dev, int phy struct npe_softc *sc = device_get_softc(dev); uint32_t v; - if (phy != sc->sc_phy) /* XXX no auto-detect */ - return 0xffff; v = (phy << NPE_MII_ADDR_SHL) | (reg << NPE_MII_REG_SHL) | NPE_MII_GO; npe_mii_mdio_write(sc, NPE_MAC_MDIO_CMD, v); if (npe_mii_mdio_wait(sc)) @@ -1717,8 +1716,6 @@ npe_miibus_writereg(device_t dev, int ph struct npe_softc *sc = device_get_softc(dev); uint32_t v; - if (phy != sc->sc_phy) /* XXX */ - return (0); v = (phy << NPE_MII_ADDR_SHL) | (reg << NPE_MII_REG_SHL) | data | NPE_MII_WRITE | NPE_MII_GO; Modified: stable/8/sys/dev/ae/if_ae.c ============================================================================== --- stable/8/sys/dev/ae/if_ae.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/ae/if_ae.c Sun Nov 7 11:12:29 2010 (r214909) @@ -360,9 +360,6 @@ ae_attach(device_t dev) if (error != 0) goto fail; - /* Set default PHY address. */ - sc->phyaddr = AE_PHYADDR_DEFAULT; - ifp = sc->ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { device_printf(dev, "could not allocate ifnet structure.\n"); @@ -390,10 +387,11 @@ ae_attach(device_t dev) /* * Configure and attach MII bus. */ - error = mii_phy_probe(dev, &sc->miibus, ae_mediachange, - ae_mediastatus); + error = mii_attach(dev, &sc->miibus, ifp, ae_mediachange, + ae_mediastatus, BMSR_DEFCAPMASK, AE_PHYADDR_DEFAULT, + MII_OFFSET_ANY, 0); if (error != 0) { - device_printf(dev, "no PHY found.\n"); + device_printf(dev, "attaching PHYs failed\n"); goto fail; } @@ -813,9 +811,6 @@ ae_miibus_readreg(device_t dev, int phy, * Locking is done in upper layers. */ - if (phy != sc->phyaddr) - return (0); - val = ((reg << AE_MDIO_REGADDR_SHIFT) & AE_MDIO_REGADDR_MASK) | AE_MDIO_START | AE_MDIO_READ | AE_MDIO_SUP_PREAMBLE | ((AE_MDIO_CLK_25_4 << AE_MDIO_CLK_SHIFT) & AE_MDIO_CLK_MASK); @@ -851,9 +846,6 @@ ae_miibus_writereg(device_t dev, int phy * Locking is done in upper layers. */ - if (phy != sc->phyaddr) - return (0); - aereg = ((reg << AE_MDIO_REGADDR_SHIFT) & AE_MDIO_REGADDR_MASK) | AE_MDIO_START | AE_MDIO_SUP_PREAMBLE | ((AE_MDIO_CLK_25_4 << AE_MDIO_CLK_SHIFT) & AE_MDIO_CLK_MASK) | Modified: stable/8/sys/dev/ae/if_aevar.h ============================================================================== --- stable/8/sys/dev/ae/if_aevar.h Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/ae/if_aevar.h Sun Nov 7 11:12:29 2010 (r214909) @@ -111,7 +111,6 @@ typedef struct ae_softc { struct mtx mtx; - int phyaddr; uint8_t eaddr[ETHER_ADDR_LEN]; uint8_t flags; int if_flags; Modified: stable/8/sys/dev/age/if_age.c ============================================================================== --- stable/8/sys/dev/age/if_age.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/age/if_age.c Sun Nov 7 11:12:29 2010 (r214909) @@ -210,8 +210,6 @@ age_miibus_readreg(device_t dev, int phy int i; sc = device_get_softc(dev); - if (phy != sc->age_phyaddr) - return (0); CSR_WRITE_4(sc, AGE_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | MDIO_SUP_PREAMBLE | MDIO_CLK_25_4 | MDIO_REG_ADDR(reg)); @@ -241,8 +239,6 @@ age_miibus_writereg(device_t dev, int ph int i; sc = device_get_softc(dev); - if (phy != sc->age_phyaddr) - return (0); CSR_WRITE_4(sc, AGE_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | (val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT | @@ -621,9 +617,11 @@ age_attach(device_t dev) ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ - if ((error = mii_phy_probe(dev, &sc->age_miibus, age_mediachange, - age_mediastatus)) != 0) { - device_printf(dev, "no PHY found!\n"); + error = mii_attach(dev, &sc->age_miibus, ifp, age_mediachange, + age_mediastatus, BMSR_DEFCAPMASK, sc->age_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/8/sys/dev/alc/if_alc.c ============================================================================== --- stable/8/sys/dev/alc/if_alc.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/alc/if_alc.c Sun Nov 7 11:12:29 2010 (r214909) @@ -235,9 +235,6 @@ alc_miibus_readreg(device_t dev, int phy sc = device_get_softc(dev); - if (phy != sc->alc_phyaddr) - return (0); - /* * For AR8132 fast ethernet controller, do not report 1000baseT * capability to mii(4). Even though AR8132 uses the same @@ -274,9 +271,6 @@ alc_miibus_writereg(device_t dev, int ph sc = device_get_softc(dev); - if (phy != sc->alc_phyaddr) - return (0); - CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | (val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT | MDIO_SUP_PREAMBLE | MDIO_CLK_25_4 | MDIO_REG_ADDR(reg)); @@ -978,9 +972,11 @@ alc_attach(device_t dev) ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ - if ((error = mii_phy_probe(dev, &sc->alc_miibus, alc_mediachange, - alc_mediastatus)) != 0) { - device_printf(dev, "no PHY found!\n"); + error = mii_attach(dev, &sc->alc_miibus, ifp, alc_mediachange, + alc_mediastatus, BMSR_DEFCAPMASK, sc->alc_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/8/sys/dev/ale/if_ale.c ============================================================================== --- stable/8/sys/dev/ale/if_ale.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/ale/if_ale.c Sun Nov 7 11:12:29 2010 (r214909) @@ -208,9 +208,6 @@ ale_miibus_readreg(device_t dev, int phy sc = device_get_softc(dev); - if (phy != sc->ale_phyaddr) - return (0); - CSR_WRITE_4(sc, ALE_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | MDIO_SUP_PREAMBLE | MDIO_CLK_25_4 | MDIO_REG_ADDR(reg)); for (i = ALE_PHY_TIMEOUT; i > 0; i--) { @@ -237,9 +234,6 @@ ale_miibus_writereg(device_t dev, int ph sc = device_get_softc(dev); - if (phy != sc->ale_phyaddr) - return (0); - CSR_WRITE_4(sc, ALE_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | (val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT | MDIO_SUP_PREAMBLE | MDIO_CLK_25_4 | MDIO_REG_ADDR(reg)); @@ -605,9 +599,11 @@ ale_attach(device_t dev) ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ - if ((error = mii_phy_probe(dev, &sc->ale_miibus, ale_mediachange, - ale_mediastatus)) != 0) { - device_printf(dev, "no PHY found!\n"); + error = mii_attach(dev, &sc->ale_miibus, ifp, ale_mediachange, + ale_mediastatus, BMSR_DEFCAPMASK, sc->ale_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/8/sys/dev/bfe/if_bfe.c ============================================================================== --- stable/8/sys/dev/bfe/if_bfe.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/bfe/if_bfe.c Sun Nov 7 11:12:29 2010 (r214909) @@ -505,10 +505,11 @@ bfe_attach(device_t dev) bfe_chip_reset(sc); BFE_UNLOCK(sc); - if (mii_phy_probe(dev, &sc->bfe_miibus, - bfe_ifmedia_upd, bfe_ifmedia_sts)) { - device_printf(dev, "MII without any PHY!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->bfe_miibus, ifp, bfe_ifmedia_upd, + bfe_ifmedia_sts, BMSR_DEFCAPMASK, sc->bfe_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } @@ -631,8 +632,6 @@ bfe_miibus_readreg(device_t dev, int phy u_int32_t ret; sc = device_get_softc(dev); - if (phy != sc->bfe_phyaddr) - return (0); bfe_readphy(sc, reg, &ret); return (ret); @@ -644,8 +643,6 @@ bfe_miibus_writereg(device_t dev, int ph struct bfe_softc *sc; sc = device_get_softc(dev); - if (phy != sc->bfe_phyaddr) - return (0); bfe_writephy(sc, reg, val); return (0); Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/bge/if_bge.c Sun Nov 7 11:12:29 2010 (r214909) @@ -782,10 +782,6 @@ bge_miibus_readreg(device_t dev, int phy sc = device_get_softc(dev); - /* Prevent the probe from finding incorrect devices. */ - if (phy != sc->bge_phy_addr) - return (0); - /* Clear the autopoll bit if set, otherwise may trigger PCI errors. */ if ((sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) != 0) { CSR_WRITE_4(sc, BGE_MI_MODE, @@ -2572,7 +2568,7 @@ bge_attach(device_t dev) struct bge_softc *sc; uint32_t hwcfg = 0, misccfg; u_char eaddr[ETHER_ADDR_LEN]; - int error, msicount, reg, rid, trys; + int error, msicount, phy_addr, reg, rid, trys; sc = device_get_softc(dev); sc->bge_dev = dev; @@ -2605,7 +2601,7 @@ bge_attach(device_t dev) sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid); /* Set default PHY address. */ - sc->bge_phy_addr = 1; + phy_addr = 1; /* * Don't enable Ethernet@WireSpeed for the 5700, 5906, or the @@ -2972,17 +2968,17 @@ bge_attach(device_t dev) again: bge_asf_driver_up(sc); - if (mii_phy_probe(dev, &sc->bge_miibus, - bge_ifmedia_upd, bge_ifmedia_sts)) { + error = (mii_attach(dev, &sc->bge_miibus, ifp, + bge_ifmedia_upd, bge_ifmedia_sts, BMSR_DEFCAPMASK, + phy_addr, MII_OFFSET_ANY, 0)); + if (error != 0) { if (trys++ < 4) { device_printf(sc->bge_dev, "Try again\n"); bge_miibus_writereg(sc->bge_dev, 1, MII_BMCR, BMCR_RESET); goto again; } - - device_printf(sc->bge_dev, "MII without any PHY!\n"); - error = ENXIO; + device_printf(sc->bge_dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/bge/if_bgereg.h Sun Nov 7 11:12:29 2010 (r214909) @@ -2762,7 +2762,6 @@ struct bge_softc { uint32_t bge_tx_buf_ratio; uint32_t bge_mi_mode; int bge_if_flags; - int bge_phy_addr; int bge_txcnt; int bge_link; /* link state */ int bge_link_evt; /* pending link event */ Modified: stable/8/sys/dev/bm/if_bm.c ============================================================================== --- stable/8/sys/dev/bm/if_bm.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/bm/if_bm.c Sun Nov 7 11:12:29 2010 (r214909) @@ -594,11 +594,19 @@ bm_attach(device_t dev) /* reset the adapter */ bm_chip_setup(sc); - /* setup MII */ - error = mii_phy_probe(dev, &sc->sc_miibus, bm_ifmedia_upd, - bm_ifmedia_sts); - if (error != 0) - device_printf(dev,"PHY probe failed: %d\n", error); + /* + * Setup MII + * On Apple BMAC controllers, we end up in a weird state of + * partially-completed autonegotiation on boot. So we force + * autonegotation to try again. + */ + error = mii_attach(dev, &sc->sc_miibus, ifp, bm_ifmedia_upd, + bm_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, + MIIF_FORCEANEG); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); + return (error); + } sc->sc_mii = device_get_softc(sc->sc_miibus); Modified: stable/8/sys/dev/cas/if_cas.c ============================================================================== --- stable/8/sys/dev/cas/if_cas.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/cas/if_cas.c Sun Nov 7 11:12:29 2010 (r214909) @@ -344,13 +344,9 @@ cas_attach(struct cas_softc *sc) BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } - switch (sc->sc_variant) { - default: - sc->sc_phyad = -1; - break; - } - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - cas_mediachange, cas_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, + MII_PHY_ANY, MII_OFFSET_ANY, 0); } /* * Fall back on an internal PHY if no external PHY was found. @@ -368,13 +364,9 @@ cas_attach(struct cas_softc *sc) BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } - switch (sc->sc_variant) { - default: - sc->sc_phyad = -1; - break; - } - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - cas_mediachange, cas_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, + MII_PHY_ANY, MII_OFFSET_ANY, 0); } } else { /* @@ -394,12 +386,12 @@ cas_attach(struct cas_softc *sc) CAS_WRITE_4(sc, CAS_PCS_CONF, CAS_PCS_CONF_EN); CAS_BARRIER(sc, CAS_PCS_CONF, 4, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - sc->sc_phyad = CAS_PHYAD_EXTERNAL; - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - cas_mediachange, cas_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, + CAS_PHYAD_EXTERNAL, MII_OFFSET_ANY, 0); } if (error != 0) { - device_printf(sc->sc_dev, "PHY probe failed: %d\n", error); + device_printf(sc->sc_dev, "attaching PHYs failed\n"); goto fail_rxmap; } sc->sc_mii = device_get_softc(sc->sc_miibus); @@ -2172,9 +2164,6 @@ cas_mii_readreg(device_t dev, int phy, i #endif sc = device_get_softc(dev); - if (sc->sc_phyad != -1 && phy != sc->sc_phyad) - return (0); - if ((sc->sc_flags & CAS_SERDES) != 0) { switch (reg) { case MII_BMCR: @@ -2233,9 +2222,6 @@ cas_mii_writereg(device_t dev, int phy, #endif sc = device_get_softc(dev); - if (sc->sc_phyad != -1 && phy != sc->sc_phyad) - return (0); - if ((sc->sc_flags & CAS_SERDES) != 0) { switch (reg) { case MII_BMSR: @@ -2318,8 +2304,7 @@ cas_mii_statchg(device_t dev) #ifdef CAS_DEBUG if ((ifp->if_flags & IFF_DEBUG) != 0) - device_printf(sc->sc_dev, "%s: status change: PHY = %d\n", - __func__, sc->sc_phyad); + device_printf(sc->sc_dev, "%s: status changen", __func__); #endif if ((sc->sc_mii->mii_media_status & IFM_ACTIVE) != 0 && Modified: stable/8/sys/dev/cas/if_casvar.h ============================================================================== --- stable/8/sys/dev/cas/if_casvar.h Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/cas/if_casvar.h Sun Nov 7 11:12:29 2010 (r214909) @@ -154,8 +154,6 @@ struct cas_softc { bus_dma_tag_t sc_cdmatag; /* control data bus DMA tag */ bus_dmamap_t sc_dmamap; /* bus DMA handle */ - u_int sc_phyad; /* PHY to use or -1 for any */ - u_int sc_variant; #define CAS_UNKNOWN 0 /* don't know */ #define CAS_CAS 1 /* Sun Cassini */ Modified: stable/8/sys/dev/dc/dcphy.c ============================================================================== --- stable/8/sys/dev/dc/dcphy.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/dc/dcphy.c Sun Nov 7 11:12:29 2010 (r214909) @@ -149,6 +149,7 @@ dcphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = dcphy_service; @@ -211,7 +212,6 @@ dcphy_service(struct mii_softc *sc, stru if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; - sc->mii_flags = 0; mii->mii_media_active = IFM_NONE; mode = CSR_READ_4(dc_sc, DC_NETCFG); mode &= ~(DC_NETCFG_FULLDUPLEX | DC_NETCFG_PORTSEL | Modified: stable/8/sys/dev/dc/if_dc.c ============================================================================== --- stable/8/sys/dev/dc/if_dc.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/dc/if_dc.c Sun Nov 7 11:12:29 2010 (r214909) @@ -778,26 +778,6 @@ dc_miibus_readreg(device_t dev, int phy, sc = device_get_softc(dev); bzero(&frame, sizeof(frame)); - /* - * Note: both the AL981 and AN983 have internal PHYs, - * however the AL981 provides direct access to the PHY - * registers while the AN983 uses a serial MII interface. - * The AN983's MII interface is also buggy in that you - * can read from any MII address (0 to 31), but only address 1 - * behaves normally. To deal with both cases, we pretend - * that the PHY is at MII address 1. - */ - if (DC_IS_ADMTEK(sc) && phy != DC_ADMTEK_PHYADDR) - return (0); - - /* - * Note: the ukphy probes of the RS7112 report a PHY at - * MII address 0 (possibly HomePNA?) and 1 (ethernet) - * so we only respond to correct one. - */ - if (DC_IS_CONEXANT(sc) && phy != DC_CONEXANT_PHYADDR) - return (0); - if (sc->dc_pmode != DC_PMODE_MII) { if (phy == (MII_NPHY - 1)) { switch (reg) { @@ -900,12 +880,6 @@ dc_miibus_writereg(device_t dev, int phy sc = device_get_softc(dev); bzero(&frame, sizeof(frame)); - if (DC_IS_ADMTEK(sc) && phy != DC_ADMTEK_PHYADDR) - return (0); - - if (DC_IS_CONEXANT(sc) && phy != DC_CONEXANT_PHYADDR) - return (0); - if (DC_IS_PNIC(sc)) { CSR_WRITE_4(sc, DC_PN_MII, DC_PN_MIIOPCODE_WRITE | (phy << 23) | (reg << 10) | data); @@ -1814,14 +1788,12 @@ dc_dma_map_addr(void *arg, bus_dma_segme static int dc_attach(device_t dev) { - int tmp = 0; uint32_t eaddr[(ETHER_ADDR_LEN+3)/4]; u_int32_t command; struct dc_softc *sc; struct ifnet *ifp; u_int32_t reg, revision; - int error = 0, rid, mac_offset; - int i; + int error, i, mac_offset, phy, rid, tmp; u_int8_t *mac; sc = device_get_softc(dev); @@ -2202,6 +2174,7 @@ dc_attach(device_t dev) * old selection (SIA only or SIA/SYM) and attach the dcphy * driver instead. */ + tmp = 0; if (DC_IS_INTEL(sc)) { dc_apply_fixup(sc, IFM_AUTO); tmp = sc->dc_pmode; @@ -2210,7 +2183,7 @@ dc_attach(device_t dev) /* * Setup General Purpose port mode and data so the tulip can talk - * to the MII. This needs to be done before mii_phy_probe so that + * to the MII. This needs to be done before mii_attach so that * we can actually see them. */ if (DC_IS_XIRCOM(sc)) { @@ -2222,16 +2195,37 @@ dc_attach(device_t dev) DELAY(10); } - error = mii_phy_probe(dev, &sc->dc_miibus, - dc_ifmedia_upd, dc_ifmedia_sts); + phy = MII_PHY_ANY; + /* + * Note: both the AL981 and AN983 have internal PHYs, however the + * AL981 provides direct access to the PHY registers while the AN983 + * uses a serial MII interface. The AN983's MII interface is also + * buggy in that you can read from any MII address (0 to 31), but + * only address 1 behaves normally. To deal with both cases, we + * pretend that the PHY is at MII address 1. + */ + if (DC_IS_ADMTEK(sc)) + phy = DC_ADMTEK_PHYADDR; + + /* + * Note: the ukphy probes of the RS7112 report a PHY at MII address + * 0 (possibly HomePNA?) and 1 (ethernet) so we only respond to the + * correct one. + */ + if (DC_IS_CONEXANT(sc)) + phy = DC_CONEXANT_PHYADDR; + + error = mii_attach(dev, &sc->dc_miibus, ifp, dc_ifmedia_upd, + dc_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); if (error && DC_IS_INTEL(sc)) { sc->dc_pmode = tmp; if (sc->dc_pmode != DC_PMODE_SIA) sc->dc_pmode = DC_PMODE_SYM; sc->dc_flags |= DC_21143_NWAY; - mii_phy_probe(dev, &sc->dc_miibus, - dc_ifmedia_upd, dc_ifmedia_sts); + mii_attach(dev, &sc->dc_miibus, ifp, dc_ifmedia_upd, + dc_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, 0); /* * For non-MII cards, we need to have the 21143 * drive the LEDs. Except there are some systems @@ -2246,7 +2240,7 @@ dc_attach(device_t dev) } if (error) { - device_printf(dev, "MII without any PHY!\n"); + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/8/sys/dev/dc/pnphy.c ============================================================================== --- stable/8/sys/dev/dc/pnphy.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/dc/pnphy.c Sun Nov 7 11:12:29 2010 (r214909) @@ -132,6 +132,7 @@ pnphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = pnphy_service; @@ -169,8 +170,6 @@ pnphy_service(struct mii_softc *sc, stru if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; - sc->mii_flags = 0; - switch (IFM_SUBTYPE(ife->ifm_media)) { case IFM_AUTO: /* NWAY is busted on this chip */ Modified: stable/8/sys/dev/fxp/if_fxp.c ============================================================================== --- stable/8/sys/dev/fxp/if_fxp.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/fxp/if_fxp.c Sun Nov 7 11:12:29 2010 (r214909) @@ -804,10 +804,14 @@ fxp_attach(device_t dev) ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_MANUAL, 0, NULL); ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_MANUAL); } else { - if (mii_phy_probe(dev, &sc->miibus, fxp_ifmedia_upd, - fxp_ifmedia_sts)) { - device_printf(dev, "MII without any PHY!\n"); - error = ENXIO; + /* + * i82557 wedge when isolating all of their PHYs. + */ + error = mii_attach(dev, &sc->miibus, ifp, fxp_ifmedia_upd, + fxp_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, MIIF_NOISOLATE); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } } Modified: stable/8/sys/dev/gem/if_gem.c ============================================================================== --- stable/8/sys/dev/gem/if_gem.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/gem/if_gem.c Sun Nov 7 11:12:29 2010 (r214909) @@ -149,7 +149,7 @@ gem_attach(struct gem_softc *sc) { struct gem_txsoft *txs; struct ifnet *ifp; - int error, i; + int error, i, phy; uint32_t v; if (bootverbose) @@ -294,14 +294,15 @@ gem_attach(struct gem_softc *sc) BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); switch (sc->sc_variant) { case GEM_SUN_ERI: - sc->sc_phyad = GEM_PHYAD_EXTERNAL; + phy = GEM_PHYAD_EXTERNAL; break; default: - sc->sc_phyad = -1; + phy = MII_PHY_ANY; break; } - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - gem_mediachange, gem_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, phy, + MII_OFFSET_ANY, 0); } /* @@ -318,17 +319,18 @@ gem_attach(struct gem_softc *sc) switch (sc->sc_variant) { case GEM_SUN_ERI: case GEM_APPLE_K2_GMAC: - sc->sc_phyad = GEM_PHYAD_INTERNAL; + phy = GEM_PHYAD_INTERNAL; break; case GEM_APPLE_GMAC: - sc->sc_phyad = GEM_PHYAD_EXTERNAL; + phy = GEM_PHYAD_EXTERNAL; break; default: - sc->sc_phyad = -1; + phy = MII_PHY_ANY; break; } - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - gem_mediachange, gem_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, phy, + MII_OFFSET_ANY, 0); } /* @@ -348,12 +350,12 @@ gem_attach(struct gem_softc *sc) GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4, BUS_SPACE_BARRIER_WRITE); sc->sc_flags |= GEM_SERDES; - sc->sc_phyad = GEM_PHYAD_EXTERNAL; - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - gem_mediachange, gem_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, + GEM_PHYAD_EXTERNAL, MII_OFFSET_ANY, 0); } if (error != 0) { - device_printf(sc->sc_dev, "PHY probe failed: %d\n", error); + device_printf(sc->sc_dev, "attaching PHYs failed\n"); goto fail_rxd; } sc->sc_mii = device_get_softc(sc->sc_miibus); @@ -1848,9 +1850,6 @@ gem_mii_readreg(device_t dev, int phy, i #endif sc = device_get_softc(dev); - if (sc->sc_phyad != -1 && phy != sc->sc_phyad) - return (0); - if ((sc->sc_flags & GEM_SERDES) != 0) { switch (reg) { case MII_BMCR: @@ -1909,9 +1908,6 @@ gem_mii_writereg(device_t dev, int phy, #endif sc = device_get_softc(dev); - if (sc->sc_phyad != -1 && phy != sc->sc_phyad) - return (0); - if ((sc->sc_flags & GEM_SERDES) != 0) { switch (reg) { case MII_BMSR: @@ -1992,8 +1988,7 @@ gem_mii_statchg(device_t dev) #ifdef GEM_DEBUG if ((sc->sc_ifp->if_flags & IFF_DEBUG) != 0) - device_printf(sc->sc_dev, "%s: status change: PHY = %d\n", - __func__, sc->sc_phyad); + device_printf(sc->sc_dev, "%s: status change\n", __func__); #endif if ((sc->sc_mii->mii_media_status & IFM_ACTIVE) != 0 && Modified: stable/8/sys/dev/gem/if_gemvar.h ============================================================================== --- stable/8/sys/dev/gem/if_gemvar.h Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/gem/if_gemvar.h Sun Nov 7 11:12:29 2010 (r214909) @@ -126,8 +126,6 @@ struct gem_softc { bus_dma_tag_t sc_cdmatag; /* control data bus DMA tag */ bus_dmamap_t sc_dmamap; /* bus DMA handle */ - int sc_phyad; /* PHY to use or -1 for any */ - u_int sc_variant; #define GEM_UNKNOWN 0 /* don't know */ #define GEM_SUN_GEM 1 /* Sun GEM */ Modified: stable/8/sys/dev/hme/if_hme.c ============================================================================== --- stable/8/sys/dev/hme/if_hme.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/hme/if_hme.c Sun Nov 7 11:12:29 2010 (r214909) @@ -315,9 +315,20 @@ hme_config(struct hme_softc *sc) hme_mifinit(sc); - if ((error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, hme_mediachange, - hme_mediastatus)) != 0) { - device_printf(sc->sc_dev, "phy probe failed: %d\n", error); + /* + * DP83840A used with HME chips don't advertise their media + * capabilities themselves properly so force writing the ANAR + * according to the BMSR in mii_phy_setmedia(). + */ + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, hme_mediachange, + hme_mediastatus, BMSR_DEFCAPMASK, HME_PHYAD_EXTERNAL, + MII_OFFSET_ANY, MIIF_FORCEANEG); + i = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, hme_mediachange, + hme_mediastatus, BMSR_DEFCAPMASK, HME_PHYAD_INTERNAL, + MII_OFFSET_ANY, MIIF_FORCEANEG); + if (error != 0 && i != 0) { + error = ENXIO; + device_printf(sc->sc_dev, "attaching PHYs failed\n"); goto fail_rxdesc; } sc->sc_mii = device_get_softc(sc->sc_miibus); @@ -1404,10 +1415,6 @@ hme_mii_readreg(device_t dev, int phy, i int n; u_int32_t v; - /* We can at most have two PHYs. */ - if (phy != HME_PHYAD_EXTERNAL && phy != HME_PHYAD_INTERNAL) - return (0); - sc = device_get_softc(dev); /* Select the desired PHY in the MIF configuration register */ v = HME_MIF_READ_4(sc, HME_MIFI_CFG); @@ -1445,10 +1452,6 @@ hme_mii_writereg(device_t dev, int phy, int n; u_int32_t v; - /* We can at most have two PHYs. */ - if (phy != HME_PHYAD_EXTERNAL && phy != HME_PHYAD_INTERNAL) - return (0); - sc = device_get_softc(dev); /* Select the desired PHY in the MIF configuration register */ v = HME_MIF_READ_4(sc, HME_MIFI_CFG); Modified: stable/8/sys/dev/jme/if_jme.c ============================================================================== --- stable/8/sys/dev/jme/if_jme.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/jme/if_jme.c Sun Nov 7 11:12:29 2010 (r214909) @@ -224,13 +224,8 @@ jme_miibus_readreg(device_t dev, int phy sc = device_get_softc(dev); /* For FPGA version, PHY address 0 should be ignored. */ - if ((sc->jme_flags & JME_FLAG_FPGA) != 0) { - if (phy == 0) - return (0); - } else { - if (sc->jme_phyaddr != phy) - return (0); - } + if ((sc->jme_flags & JME_FLAG_FPGA) != 0 && phy == 0) + return (0); CSR_WRITE_4(sc, JME_SMI, SMI_OP_READ | SMI_OP_EXECUTE | SMI_PHY_ADDR(phy) | SMI_REG_ADDR(reg)); @@ -260,13 +255,8 @@ jme_miibus_writereg(device_t dev, int ph sc = device_get_softc(dev); /* For FPGA version, PHY address 0 should be ignored. */ - if ((sc->jme_flags & JME_FLAG_FPGA) != 0) { - if (phy == 0) - return (0); - } else { - if (sc->jme_phyaddr != phy) - return (0); - } + if ((sc->jme_flags & JME_FLAG_FPGA) != 0 && phy == 0) + return (0); CSR_WRITE_4(sc, JME_SMI, SMI_OP_WRITE | SMI_OP_EXECUTE | ((val << SMI_DATA_SHIFT) & SMI_DATA_MASK) | @@ -751,9 +741,11 @@ jme_attach(device_t dev) ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ - if ((error = mii_phy_probe(dev, &sc->jme_miibus, jme_mediachange, - jme_mediastatus)) != 0) { - device_printf(dev, "no PHY found!\n"); + error = mii_attach(dev, &sc->jme_miibus, ifp, jme_mediachange, + jme_mediastatus, BMSR_DEFCAPMASK, sc->jme_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/8/sys/dev/mge/if_mge.c ============================================================================== --- stable/8/sys/dev/mge/if_mge.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/mge/if_mge.c Sun Nov 7 11:12:29 2010 (r214909) @@ -608,7 +608,7 @@ mge_attach(device_t dev) struct mge_softc *sc; struct ifnet *ifp; uint8_t hwaddr[ETHER_ADDR_LEN]; - int i, error ; + int i, error, phy; sc = device_get_softc(dev); sc->dev = dev; @@ -619,6 +619,13 @@ mge_attach(device_t dev) /* Set chip version-dependent parameters */ mge_ver_params(sc); + /* + * We assume static PHY address <=> device unit mapping: + * PHY Address = MII_ADDR_BASE + devce unit. + * This is true for most Marvell boards. + */ + phy = MII_ADDR_BASE + device_get_unit(dev); + /* Initialize mutexes */ mtx_init(&sc->transmit_lock, device_get_nameunit(dev), "mge TX lock", MTX_DEF); mtx_init(&sc->receive_lock, device_get_nameunit(dev), "mge RX lock", MTX_DEF); @@ -680,10 +687,11 @@ mge_attach(device_t dev) ether_ifattach(ifp, hwaddr); callout_init(&sc->wd_callout, 0); - /* Probe PHY(s) */ - error = mii_phy_probe(dev, &sc->miibus, mge_ifmedia_upd, mge_ifmedia_sts); + /* Attach PHY(s) */ + error = mii_attach(dev, &sc->miibus, ifp, mge_ifmedia_upd, + mge_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); if (error) { - device_printf(dev, "MII failed to find PHY\n"); + device_printf(dev, "attaching PHYs failed\n"); if_free(ifp); sc->ifp = NULL; mge_detach(dev); @@ -1259,19 +1267,6 @@ mge_miibus_readreg(device_t dev, int phy { uint32_t retries; - /* - * We assume static PHY address <=> device unit mapping: - * PHY Address = MII_ADDR_BASE + devce unit. - * This is true for most Marvell boards. - * - * Code below grants proper PHY detection on each device - * unit. - */ - - - if ((MII_ADDR_BASE + device_get_unit(dev)) != phy) - return (0); - MGE_WRITE(sc_mge0, MGE_REG_SMI, 0x1fffffff & (MGE_SMI_READ | (reg << 21) | (phy << 16))); @@ -1290,9 +1285,6 @@ mge_miibus_writereg(device_t dev, int ph { uint32_t retries; - if ((MII_ADDR_BASE + device_get_unit(dev)) != phy) - return (0); - MGE_WRITE(sc_mge0, MGE_REG_SMI, 0x1fffffff & (MGE_SMI_WRITE | (reg << 21) | (phy << 16) | (value & 0xffff))); Modified: stable/8/sys/dev/mii/acphy.c ============================================================================== --- stable/8/sys/dev/mii/acphy.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/mii/acphy.c Sun Nov 7 11:12:29 2010 (r214909) @@ -132,6 +132,7 @@ acphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = acphy_service; Modified: stable/8/sys/dev/mii/amphy.c ============================================================================== --- stable/8/sys/dev/mii/amphy.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/mii/amphy.c Sun Nov 7 11:12:29 2010 (r214909) @@ -109,6 +109,7 @@ amphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = amphy_service; Modified: stable/8/sys/dev/mii/atphy.c ============================================================================== --- stable/8/sys/dev/mii/atphy.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/mii/atphy.c Sun Nov 7 11:12:29 2010 (r214909) @@ -113,6 +113,7 @@ atphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = atphy_service; Modified: stable/8/sys/dev/mii/axphy.c ============================================================================== --- stable/8/sys/dev/mii/axphy.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/mii/axphy.c Sun Nov 7 11:12:29 2010 (r214909) @@ -97,6 +97,7 @@ axphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = axphy_service; Modified: stable/8/sys/dev/mii/bmtphy.c ============================================================================== --- stable/8/sys/dev/mii/bmtphy.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/mii/bmtphy.c Sun Nov 7 11:12:29 2010 (r214909) @@ -147,6 +147,7 @@ bmtphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = bmtphy_service; Modified: stable/8/sys/dev/mii/brgphy.c ============================================================================== --- stable/8/sys/dev/mii/brgphy.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/mii/brgphy.c Sun Nov 7 11:12:29 2010 (r214909) @@ -191,6 +191,7 @@ brgphy_attach(device_t dev) LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); /* Initialize mii_softc structure */ + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = brgphy_service; Modified: stable/8/sys/dev/mii/ciphy.c ============================================================================== --- stable/8/sys/dev/mii/ciphy.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/mii/ciphy.c Sun Nov 7 11:12:29 2010 (r214909) @@ -57,9 +57,7 @@ __FBSDID("$FreeBSD$"); #include "miibus_if.h" #include -/* -#include -*/ + static int ciphy_probe(device_t); static int ciphy_attach(device_t); @@ -118,6 +116,7 @@ ciphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = ciphy_service; Modified: stable/8/sys/dev/mii/e1000phy.c ============================================================================== --- stable/8/sys/dev/mii/e1000phy.c Sun Nov 7 10:49:40 2010 (r214908) +++ stable/8/sys/dev/mii/e1000phy.c Sun Nov 7 11:12:29 2010 (r214909) @@ -59,9 +59,6 @@ __FBSDID("$FreeBSD$"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 11:12:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24CBA106566C; Sun, 7 Nov 2010 11:12:31 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E0038FC15; Sun, 7 Nov 2010 11:12:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7BCVnA040135; Sun, 7 Nov 2010 11:12:31 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7BCUYl040102; Sun, 7 Nov 2010 11:12:30 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071112.oA7BCUYl040102@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 11:12:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214910 - in stable/7/sys: arm/xscale/ixp425 dev/ae dev/age dev/alc dev/ale dev/bfe dev/bge dev/bm dev/cas dev/dc dev/fxp dev/gem dev/hme dev/jme dev/mii dev/msk dev/pcn dev/re dev/sk d... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 11:12:31 -0000 Author: marius Date: Sun Nov 7 11:12:30 2010 New Revision: 214910 URL: http://svn.freebsd.org/changeset/base/214910 Log: MFC: r213893, r213908, r214566, r214605, r214846 Convert the PHY drivers to honor the mii_flags passed down and convert the NIC drivers as well as the PHY drivers to take advantage of the mii_attach() introduced in r213878 (MFC'ed to stable/8 in r214685) to get rid of certain hacks. For the most part these were: - Artificially limiting miibus_{read,write}reg methods to certain PHY addresses; we now let mii_attach() only probe the PHY at the desired address(es) instead. - PHY drivers setting MIIF_* flags based on the NIC driver they hang off from, partly even based on grabbing and using the softc of the parent; we now pass these flags down from the NIC to the PHY drivers via mii_attach(). This got us rid of all such hacks except those of brgphy() in combination with bce(4) and bge(4), which is way beyond what can be expressed with simple flags. While at it, I took the opportunity to change the NIC drivers to pass up the error returned by mii_attach() (previously by mii_phy_probe()) and unify the error message used in this case where and as appropriate as mii_attach() actually can fail for a number of reasons, not just because of no PHY(s) being present at the expected address(es). Reviewed by: jhb, yongari Modified: stable/7/sys/arm/xscale/ixp425/if_npe.c stable/7/sys/dev/ae/if_ae.c stable/7/sys/dev/ae/if_aevar.h stable/7/sys/dev/age/if_age.c stable/7/sys/dev/alc/if_alc.c stable/7/sys/dev/ale/if_ale.c stable/7/sys/dev/bfe/if_bfe.c stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h stable/7/sys/dev/bm/if_bm.c stable/7/sys/dev/cas/if_cas.c stable/7/sys/dev/cas/if_casvar.h stable/7/sys/dev/dc/if_dc.c stable/7/sys/dev/dc/pnphy.c stable/7/sys/dev/fxp/if_fxp.c stable/7/sys/dev/gem/if_gem.c stable/7/sys/dev/gem/if_gemvar.h stable/7/sys/dev/hme/if_hme.c stable/7/sys/dev/jme/if_jme.c stable/7/sys/dev/mii/acphy.c stable/7/sys/dev/mii/amphy.c stable/7/sys/dev/mii/atphy.c stable/7/sys/dev/mii/bmtphy.c stable/7/sys/dev/mii/brgphy.c stable/7/sys/dev/mii/ciphy.c stable/7/sys/dev/mii/e1000phy.c stable/7/sys/dev/mii/exphy.c stable/7/sys/dev/mii/gentbi.c stable/7/sys/dev/mii/icsphy.c stable/7/sys/dev/mii/inphy.c stable/7/sys/dev/mii/ip1000phy.c stable/7/sys/dev/mii/jmphy.c stable/7/sys/dev/mii/lxtphy.c stable/7/sys/dev/mii/mlphy.c stable/7/sys/dev/mii/nsgphy.c stable/7/sys/dev/mii/nsphy.c stable/7/sys/dev/mii/nsphyter.c stable/7/sys/dev/mii/pnaphy.c stable/7/sys/dev/mii/qsphy.c stable/7/sys/dev/mii/rgephy.c stable/7/sys/dev/mii/rlphy.c stable/7/sys/dev/mii/rlswitch.c stable/7/sys/dev/mii/ruephy.c stable/7/sys/dev/mii/tdkphy.c stable/7/sys/dev/mii/tlphy.c stable/7/sys/dev/mii/truephy.c stable/7/sys/dev/mii/ukphy.c stable/7/sys/dev/mii/xmphy.c stable/7/sys/dev/msk/if_msk.c stable/7/sys/dev/pcn/if_pcn.c stable/7/sys/dev/re/if_re.c stable/7/sys/dev/sk/if_sk.c stable/7/sys/dev/ste/if_ste.c stable/7/sys/dev/stge/if_stge.c stable/7/sys/dev/vge/if_vge.c stable/7/sys/dev/vr/if_vr.c stable/7/sys/dev/vr/if_vrreg.h stable/7/sys/pci/if_rl.c stable/7/sys/pci/if_xl.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/arm/xscale/ixp425/if_npe.c ============================================================================== --- stable/7/sys/arm/xscale/ixp425/if_npe.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/arm/xscale/ixp425/if_npe.c Sun Nov 7 11:12:30 2010 (r214910) @@ -318,11 +318,13 @@ npe_attach(device_t dev) npe_getmac(sc, eaddr); - /* NB: must be setup prior to invoking mii code */ sc->sc_ifp = ifp = if_alloc(IFT_ETHER); - if (mii_phy_probe(dev, &sc->sc_mii, npe_ifmedia_update, npe_ifmedia_status)) { - device_printf(dev, "Cannot find my PHY.\n"); - error = ENXIO; + error = mii_attach(dev, &sc->sc_mii, ifp, npe_ifmedia_update, + npe_ifmedia_status, BMSR_DEFCAPMASK, sc->sc_phy, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); + return error; goto out; } @@ -1596,8 +1598,6 @@ npe_miibus_readreg(device_t dev, int phy struct npe_softc *sc = device_get_softc(dev); uint32_t v; - if (phy != sc->sc_phy) /* XXX no auto-detect */ - return 0xffff; v = (phy << NPE_MII_ADDR_SHL) | (reg << NPE_MII_REG_SHL) | NPE_MII_GO; npe_mii_mdio_write(sc, NPE_MAC_MDIO_CMD, v); @@ -1615,8 +1615,6 @@ npe_miibus_writereg(device_t dev, int ph struct npe_softc *sc = device_get_softc(dev); uint32_t v; - if (phy != sc->sc_phy) /* XXX */ - return; v = (phy << NPE_MII_ADDR_SHL) | (reg << NPE_MII_REG_SHL) | data | NPE_MII_WRITE | NPE_MII_GO; Modified: stable/7/sys/dev/ae/if_ae.c ============================================================================== --- stable/7/sys/dev/ae/if_ae.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/ae/if_ae.c Sun Nov 7 11:12:30 2010 (r214910) @@ -360,9 +360,6 @@ ae_attach(device_t dev) if (error != 0) goto fail; - /* Set default PHY address. */ - sc->phyaddr = AE_PHYADDR_DEFAULT; - ifp = sc->ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { device_printf(dev, "could not allocate ifnet structure.\n"); @@ -390,10 +387,11 @@ ae_attach(device_t dev) /* * Configure and attach MII bus. */ - error = mii_phy_probe(dev, &sc->miibus, ae_mediachange, - ae_mediastatus); + error = mii_attach(dev, &sc->miibus, ifp, ae_mediachange, + ae_mediastatus, BMSR_DEFCAPMASK, AE_PHYADDR_DEFAULT, + MII_OFFSET_ANY, 0); if (error != 0) { - device_printf(dev, "no PHY found.\n"); + device_printf(dev, "attaching PHYs failed\n"); goto fail; } @@ -813,9 +811,6 @@ ae_miibus_readreg(device_t dev, int phy, * Locking is done in upper layers. */ - if (phy != sc->phyaddr) - return (0); - val = ((reg << AE_MDIO_REGADDR_SHIFT) & AE_MDIO_REGADDR_MASK) | AE_MDIO_START | AE_MDIO_READ | AE_MDIO_SUP_PREAMBLE | ((AE_MDIO_CLK_25_4 << AE_MDIO_CLK_SHIFT) & AE_MDIO_CLK_MASK); @@ -851,9 +846,6 @@ ae_miibus_writereg(device_t dev, int phy * Locking is done in upper layers. */ - if (phy != sc->phyaddr) - return (0); - aereg = ((reg << AE_MDIO_REGADDR_SHIFT) & AE_MDIO_REGADDR_MASK) | AE_MDIO_START | AE_MDIO_SUP_PREAMBLE | ((AE_MDIO_CLK_25_4 << AE_MDIO_CLK_SHIFT) & AE_MDIO_CLK_MASK) | Modified: stable/7/sys/dev/ae/if_aevar.h ============================================================================== --- stable/7/sys/dev/ae/if_aevar.h Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/ae/if_aevar.h Sun Nov 7 11:12:30 2010 (r214910) @@ -111,7 +111,6 @@ typedef struct ae_softc { struct mtx mtx; - int phyaddr; uint8_t eaddr[ETHER_ADDR_LEN]; uint8_t flags; int if_flags; Modified: stable/7/sys/dev/age/if_age.c ============================================================================== --- stable/7/sys/dev/age/if_age.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/age/if_age.c Sun Nov 7 11:12:30 2010 (r214910) @@ -210,8 +210,6 @@ age_miibus_readreg(device_t dev, int phy int i; sc = device_get_softc(dev); - if (phy != sc->age_phyaddr) - return (0); CSR_WRITE_4(sc, AGE_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | MDIO_SUP_PREAMBLE | MDIO_CLK_25_4 | MDIO_REG_ADDR(reg)); @@ -241,8 +239,6 @@ age_miibus_writereg(device_t dev, int ph int i; sc = device_get_softc(dev); - if (phy != sc->age_phyaddr) - return (0); CSR_WRITE_4(sc, AGE_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | (val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT | @@ -621,9 +617,11 @@ age_attach(device_t dev) ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ - if ((error = mii_phy_probe(dev, &sc->age_miibus, age_mediachange, - age_mediastatus)) != 0) { - device_printf(dev, "no PHY found!\n"); + error = mii_attach(dev, &sc->age_miibus, ifp, age_mediachange, + age_mediastatus, BMSR_DEFCAPMASK, sc->age_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/alc/if_alc.c ============================================================================== --- stable/7/sys/dev/alc/if_alc.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/alc/if_alc.c Sun Nov 7 11:12:30 2010 (r214910) @@ -235,9 +235,6 @@ alc_miibus_readreg(device_t dev, int phy sc = device_get_softc(dev); - if (phy != sc->alc_phyaddr) - return (0); - /* * For AR8132 fast ethernet controller, do not report 1000baseT * capability to mii(4). Even though AR8132 uses the same @@ -274,9 +271,6 @@ alc_miibus_writereg(device_t dev, int ph sc = device_get_softc(dev); - if (phy != sc->alc_phyaddr) - return (0); - CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | (val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT | MDIO_SUP_PREAMBLE | MDIO_CLK_25_4 | MDIO_REG_ADDR(reg)); @@ -978,9 +972,11 @@ alc_attach(device_t dev) ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ - if ((error = mii_phy_probe(dev, &sc->alc_miibus, alc_mediachange, - alc_mediastatus)) != 0) { - device_printf(dev, "no PHY found!\n"); + error = mii_attach(dev, &sc->alc_miibus, ifp, alc_mediachange, + alc_mediastatus, BMSR_DEFCAPMASK, sc->alc_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/ale/if_ale.c ============================================================================== --- stable/7/sys/dev/ale/if_ale.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/ale/if_ale.c Sun Nov 7 11:12:30 2010 (r214910) @@ -208,9 +208,6 @@ ale_miibus_readreg(device_t dev, int phy sc = device_get_softc(dev); - if (phy != sc->ale_phyaddr) - return (0); - CSR_WRITE_4(sc, ALE_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | MDIO_SUP_PREAMBLE | MDIO_CLK_25_4 | MDIO_REG_ADDR(reg)); for (i = ALE_PHY_TIMEOUT; i > 0; i--) { @@ -237,9 +234,6 @@ ale_miibus_writereg(device_t dev, int ph sc = device_get_softc(dev); - if (phy != sc->ale_phyaddr) - return (0); - CSR_WRITE_4(sc, ALE_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | (val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT | MDIO_SUP_PREAMBLE | MDIO_CLK_25_4 | MDIO_REG_ADDR(reg)); @@ -605,9 +599,11 @@ ale_attach(device_t dev) ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ - if ((error = mii_phy_probe(dev, &sc->ale_miibus, ale_mediachange, - ale_mediastatus)) != 0) { - device_printf(dev, "no PHY found!\n"); + error = mii_attach(dev, &sc->ale_miibus, ifp, ale_mediachange, + ale_mediastatus, BMSR_DEFCAPMASK, sc->ale_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/bfe/if_bfe.c ============================================================================== --- stable/7/sys/dev/bfe/if_bfe.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/bfe/if_bfe.c Sun Nov 7 11:12:30 2010 (r214910) @@ -498,10 +498,11 @@ bfe_attach(device_t dev) bfe_chip_reset(sc); BFE_UNLOCK(sc); - if (mii_phy_probe(dev, &sc->bfe_miibus, - bfe_ifmedia_upd, bfe_ifmedia_sts)) { - device_printf(dev, "MII without any PHY!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->bfe_miibus, ifp, bfe_ifmedia_upd, + bfe_ifmedia_sts, BMSR_DEFCAPMASK, sc->bfe_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } @@ -624,8 +625,6 @@ bfe_miibus_readreg(device_t dev, int phy u_int32_t ret; sc = device_get_softc(dev); - if (phy != sc->bfe_phyaddr) - return (0); bfe_readphy(sc, reg, &ret); return (ret); @@ -637,8 +636,6 @@ bfe_miibus_writereg(device_t dev, int ph struct bfe_softc *sc; sc = device_get_softc(dev); - if (phy != sc->bfe_phyaddr) - return (0); bfe_writephy(sc, reg, val); return (0); Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/bge/if_bge.c Sun Nov 7 11:12:30 2010 (r214910) @@ -782,10 +782,6 @@ bge_miibus_readreg(device_t dev, int phy sc = device_get_softc(dev); - /* Prevent the probe from finding incorrect devices. */ - if (phy != sc->bge_phy_addr) - return (0); - /* Clear the autopoll bit if set, otherwise may trigger PCI errors. */ if ((sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) != 0) { CSR_WRITE_4(sc, BGE_MI_MODE, @@ -2572,7 +2568,7 @@ bge_attach(device_t dev) struct bge_softc *sc; uint32_t hwcfg = 0, misccfg; u_char eaddr[ETHER_ADDR_LEN]; - int error, msicount, reg, rid, trys; + int error, msicount, phy_addr, reg, rid, trys; sc = device_get_softc(dev); sc->bge_dev = dev; @@ -2605,7 +2601,7 @@ bge_attach(device_t dev) sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid); /* Set default PHY address. */ - sc->bge_phy_addr = 1; + phy_addr = 1; /* * Don't enable Ethernet@WireSpeed for the 5700, 5906, or the @@ -2972,17 +2968,17 @@ bge_attach(device_t dev) again: bge_asf_driver_up(sc); - if (mii_phy_probe(dev, &sc->bge_miibus, - bge_ifmedia_upd, bge_ifmedia_sts)) { + error = (mii_attach(dev, &sc->bge_miibus, ifp, + bge_ifmedia_upd, bge_ifmedia_sts, BMSR_DEFCAPMASK, + phy_addr, MII_OFFSET_ANY, 0)); + if (error != 0) { if (trys++ < 4) { device_printf(sc->bge_dev, "Try again\n"); bge_miibus_writereg(sc->bge_dev, 1, MII_BMCR, BMCR_RESET); goto again; } - - device_printf(sc->bge_dev, "MII without any PHY!\n"); - error = ENXIO; + device_printf(sc->bge_dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/bge/if_bgereg.h Sun Nov 7 11:12:30 2010 (r214910) @@ -2762,7 +2762,6 @@ struct bge_softc { uint32_t bge_tx_buf_ratio; uint32_t bge_mi_mode; int bge_if_flags; - int bge_phy_addr; int bge_txcnt; int bge_link; /* link state */ int bge_link_evt; /* pending link event */ Modified: stable/7/sys/dev/bm/if_bm.c ============================================================================== --- stable/7/sys/dev/bm/if_bm.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/bm/if_bm.c Sun Nov 7 11:12:30 2010 (r214910) @@ -594,11 +594,19 @@ bm_attach(device_t dev) /* reset the adapter */ bm_chip_setup(sc); - /* setup MII */ - error = mii_phy_probe(dev, &sc->sc_miibus, bm_ifmedia_upd, - bm_ifmedia_sts); - if (error != 0) - device_printf(dev,"PHY probe failed: %d\n", error); + /* + * Setup MII + * On Apple BMAC controllers, we end up in a weird state of + * partially-completed autonegotiation on boot. So we force + * autonegotation to try again. + */ + error = mii_attach(dev, &sc->sc_miibus, ifp, bm_ifmedia_upd, + bm_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, + MIIF_FORCEANEG); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); + return (error); + } sc->sc_mii = device_get_softc(sc->sc_miibus); Modified: stable/7/sys/dev/cas/if_cas.c ============================================================================== --- stable/7/sys/dev/cas/if_cas.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/cas/if_cas.c Sun Nov 7 11:12:30 2010 (r214910) @@ -344,13 +344,9 @@ cas_attach(struct cas_softc *sc) BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } - switch (sc->sc_variant) { - default: - sc->sc_phyad = -1; - break; - } - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - cas_mediachange, cas_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, + MII_PHY_ANY, MII_OFFSET_ANY, 0); } /* * Fall back on an internal PHY if no external PHY was found. @@ -368,13 +364,9 @@ cas_attach(struct cas_softc *sc) BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } - switch (sc->sc_variant) { - default: - sc->sc_phyad = -1; - break; - } - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - cas_mediachange, cas_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, + MII_PHY_ANY, MII_OFFSET_ANY, 0); } } else { /* @@ -394,12 +386,12 @@ cas_attach(struct cas_softc *sc) CAS_WRITE_4(sc, CAS_PCS_CONF, CAS_PCS_CONF_EN); CAS_BARRIER(sc, CAS_PCS_CONF, 4, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - sc->sc_phyad = CAS_PHYAD_EXTERNAL; - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - cas_mediachange, cas_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, + CAS_PHYAD_EXTERNAL, MII_OFFSET_ANY, 0); } if (error != 0) { - device_printf(sc->sc_dev, "PHY probe failed: %d\n", error); + device_printf(sc->sc_dev, "attaching PHYs failed\n"); goto fail_rxmap; } sc->sc_mii = device_get_softc(sc->sc_miibus); @@ -2172,9 +2164,6 @@ cas_mii_readreg(device_t dev, int phy, i #endif sc = device_get_softc(dev); - if (sc->sc_phyad != -1 && phy != sc->sc_phyad) - return (0); - if ((sc->sc_flags & CAS_SERDES) != 0) { switch (reg) { case MII_BMCR: @@ -2233,9 +2222,6 @@ cas_mii_writereg(device_t dev, int phy, #endif sc = device_get_softc(dev); - if (sc->sc_phyad != -1 && phy != sc->sc_phyad) - return (0); - if ((sc->sc_flags & CAS_SERDES) != 0) { switch (reg) { case MII_BMSR: @@ -2318,8 +2304,7 @@ cas_mii_statchg(device_t dev) #ifdef CAS_DEBUG if ((ifp->if_flags & IFF_DEBUG) != 0) - device_printf(sc->sc_dev, "%s: status change: PHY = %d\n", - __func__, sc->sc_phyad); + device_printf(sc->sc_dev, "%s: status changen", __func__); #endif if ((sc->sc_mii->mii_media_status & IFM_ACTIVE) != 0 && Modified: stable/7/sys/dev/cas/if_casvar.h ============================================================================== --- stable/7/sys/dev/cas/if_casvar.h Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/cas/if_casvar.h Sun Nov 7 11:12:30 2010 (r214910) @@ -154,8 +154,6 @@ struct cas_softc { bus_dma_tag_t sc_cdmatag; /* control data bus DMA tag */ bus_dmamap_t sc_dmamap; /* bus DMA handle */ - u_int sc_phyad; /* PHY to use or -1 for any */ - u_int sc_variant; #define CAS_UNKNOWN 0 /* don't know */ #define CAS_CAS 1 /* Sun Cassini */ Modified: stable/7/sys/dev/dc/if_dc.c ============================================================================== --- stable/7/sys/dev/dc/if_dc.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/dc/if_dc.c Sun Nov 7 11:12:30 2010 (r214910) @@ -779,26 +779,6 @@ dc_miibus_readreg(device_t dev, int phy, sc = device_get_softc(dev); bzero(&frame, sizeof(frame)); - /* - * Note: both the AL981 and AN983 have internal PHYs, - * however the AL981 provides direct access to the PHY - * registers while the AN983 uses a serial MII interface. - * The AN983's MII interface is also buggy in that you - * can read from any MII address (0 to 31), but only address 1 - * behaves normally. To deal with both cases, we pretend - * that the PHY is at MII address 1. - */ - if (DC_IS_ADMTEK(sc) && phy != DC_ADMTEK_PHYADDR) - return (0); - - /* - * Note: the ukphy probes of the RS7112 report a PHY at - * MII address 0 (possibly HomePNA?) and 1 (ethernet) - * so we only respond to correct one. - */ - if (DC_IS_CONEXANT(sc) && phy != DC_CONEXANT_PHYADDR) - return (0); - if (sc->dc_pmode != DC_PMODE_MII) { if (phy == (MII_NPHY - 1)) { switch (reg) { @@ -901,12 +881,6 @@ dc_miibus_writereg(device_t dev, int phy sc = device_get_softc(dev); bzero(&frame, sizeof(frame)); - if (DC_IS_ADMTEK(sc) && phy != DC_ADMTEK_PHYADDR) - return (0); - - if (DC_IS_CONEXANT(sc) && phy != DC_CONEXANT_PHYADDR) - return (0); - if (DC_IS_PNIC(sc)) { CSR_WRITE_4(sc, DC_PN_MII, DC_PN_MIIOPCODE_WRITE | (phy << 23) | (reg << 10) | data); @@ -1815,14 +1789,12 @@ dc_dma_map_addr(void *arg, bus_dma_segme static int dc_attach(device_t dev) { - int tmp = 0; uint32_t eaddr[(ETHER_ADDR_LEN+3)/4]; u_int32_t command; struct dc_softc *sc; struct ifnet *ifp; u_int32_t reg, revision; - int error = 0, rid, mac_offset; - int i; + int error, i, mac_offset, phy, rid, tmp; u_int8_t *mac; sc = device_get_softc(dev); @@ -2203,6 +2175,7 @@ dc_attach(device_t dev) * old selection (SIA only or SIA/SYM) and attach the dcphy * driver instead. */ + tmp = 0; if (DC_IS_INTEL(sc)) { dc_apply_fixup(sc, IFM_AUTO); tmp = sc->dc_pmode; @@ -2211,7 +2184,7 @@ dc_attach(device_t dev) /* * Setup General Purpose port mode and data so the tulip can talk - * to the MII. This needs to be done before mii_phy_probe so that + * to the MII. This needs to be done before mii_attach so that * we can actually see them. */ if (DC_IS_XIRCOM(sc)) { @@ -2223,16 +2196,37 @@ dc_attach(device_t dev) DELAY(10); } - error = mii_phy_probe(dev, &sc->dc_miibus, - dc_ifmedia_upd, dc_ifmedia_sts); + phy = MII_PHY_ANY; + /* + * Note: both the AL981 and AN983 have internal PHYs, however the + * AL981 provides direct access to the PHY registers while the AN983 + * uses a serial MII interface. The AN983's MII interface is also + * buggy in that you can read from any MII address (0 to 31), but + * only address 1 behaves normally. To deal with both cases, we + * pretend that the PHY is at MII address 1. + */ + if (DC_IS_ADMTEK(sc)) + phy = DC_ADMTEK_PHYADDR; + + /* + * Note: the ukphy probes of the RS7112 report a PHY at MII address + * 0 (possibly HomePNA?) and 1 (ethernet) so we only respond to the + * correct one. + */ + if (DC_IS_CONEXANT(sc)) + phy = DC_CONEXANT_PHYADDR; + + error = mii_attach(dev, &sc->dc_miibus, ifp, dc_ifmedia_upd, + dc_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); if (error && DC_IS_INTEL(sc)) { sc->dc_pmode = tmp; if (sc->dc_pmode != DC_PMODE_SIA) sc->dc_pmode = DC_PMODE_SYM; sc->dc_flags |= DC_21143_NWAY; - mii_phy_probe(dev, &sc->dc_miibus, - dc_ifmedia_upd, dc_ifmedia_sts); + mii_attach(dev, &sc->dc_miibus, ifp, dc_ifmedia_upd, + dc_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, 0); /* * For non-MII cards, we need to have the 21143 * drive the LEDs. Except there are some systems @@ -2247,7 +2241,7 @@ dc_attach(device_t dev) } if (error) { - device_printf(dev, "MII without any PHY!\n"); + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/dc/pnphy.c ============================================================================== --- stable/7/sys/dev/dc/pnphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/dc/pnphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -132,6 +132,7 @@ pnphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = pnphy_service; @@ -169,8 +170,6 @@ pnphy_service(struct mii_softc *sc, stru if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; - sc->mii_flags = 0; - switch (IFM_SUBTYPE(ife->ifm_media)) { case IFM_AUTO: /* NWAY is busted on this chip */ Modified: stable/7/sys/dev/fxp/if_fxp.c ============================================================================== --- stable/7/sys/dev/fxp/if_fxp.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/fxp/if_fxp.c Sun Nov 7 11:12:30 2010 (r214910) @@ -805,10 +805,14 @@ fxp_attach(device_t dev) ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_MANUAL, 0, NULL); ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_MANUAL); } else { - if (mii_phy_probe(dev, &sc->miibus, fxp_ifmedia_upd, - fxp_ifmedia_sts)) { - device_printf(dev, "MII without any PHY!\n"); - error = ENXIO; + /* + * i82557 wedge when isolating all of their PHYs. + */ + error = mii_attach(dev, &sc->miibus, ifp, fxp_ifmedia_upd, + fxp_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, MIIF_NOISOLATE); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } } Modified: stable/7/sys/dev/gem/if_gem.c ============================================================================== --- stable/7/sys/dev/gem/if_gem.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/gem/if_gem.c Sun Nov 7 11:12:30 2010 (r214910) @@ -149,7 +149,7 @@ gem_attach(struct gem_softc *sc) { struct gem_txsoft *txs; struct ifnet *ifp; - int error, i; + int error, i, phy; uint32_t v; if (bootverbose) @@ -294,14 +294,15 @@ gem_attach(struct gem_softc *sc) BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); switch (sc->sc_variant) { case GEM_SUN_ERI: - sc->sc_phyad = GEM_PHYAD_EXTERNAL; + phy = GEM_PHYAD_EXTERNAL; break; default: - sc->sc_phyad = -1; + phy = MII_PHY_ANY; break; } - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - gem_mediachange, gem_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, phy, + MII_OFFSET_ANY, 0); } /* @@ -318,17 +319,18 @@ gem_attach(struct gem_softc *sc) switch (sc->sc_variant) { case GEM_SUN_ERI: case GEM_APPLE_K2_GMAC: - sc->sc_phyad = GEM_PHYAD_INTERNAL; + phy = GEM_PHYAD_INTERNAL; break; case GEM_APPLE_GMAC: - sc->sc_phyad = GEM_PHYAD_EXTERNAL; + phy = GEM_PHYAD_EXTERNAL; break; default: - sc->sc_phyad = -1; + phy = MII_PHY_ANY; break; } - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - gem_mediachange, gem_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, phy, + MII_OFFSET_ANY, 0); } /* @@ -348,12 +350,12 @@ gem_attach(struct gem_softc *sc) GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4, BUS_SPACE_BARRIER_WRITE); sc->sc_flags |= GEM_SERDES; - sc->sc_phyad = GEM_PHYAD_EXTERNAL; - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - gem_mediachange, gem_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, + GEM_PHYAD_EXTERNAL, MII_OFFSET_ANY, 0); } if (error != 0) { - device_printf(sc->sc_dev, "PHY probe failed: %d\n", error); + device_printf(sc->sc_dev, "attaching PHYs failed\n"); goto fail_rxd; } sc->sc_mii = device_get_softc(sc->sc_miibus); @@ -1848,9 +1850,6 @@ gem_mii_readreg(device_t dev, int phy, i #endif sc = device_get_softc(dev); - if (sc->sc_phyad != -1 && phy != sc->sc_phyad) - return (0); - if ((sc->sc_flags & GEM_SERDES) != 0) { switch (reg) { case MII_BMCR: @@ -1909,9 +1908,6 @@ gem_mii_writereg(device_t dev, int phy, #endif sc = device_get_softc(dev); - if (sc->sc_phyad != -1 && phy != sc->sc_phyad) - return (0); - if ((sc->sc_flags & GEM_SERDES) != 0) { switch (reg) { case MII_BMSR: @@ -1992,8 +1988,7 @@ gem_mii_statchg(device_t dev) #ifdef GEM_DEBUG if ((sc->sc_ifp->if_flags & IFF_DEBUG) != 0) - device_printf(sc->sc_dev, "%s: status change: PHY = %d\n", - __func__, sc->sc_phyad); + device_printf(sc->sc_dev, "%s: status change\n", __func__); #endif if ((sc->sc_mii->mii_media_status & IFM_ACTIVE) != 0 && Modified: stable/7/sys/dev/gem/if_gemvar.h ============================================================================== --- stable/7/sys/dev/gem/if_gemvar.h Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/gem/if_gemvar.h Sun Nov 7 11:12:30 2010 (r214910) @@ -126,8 +126,6 @@ struct gem_softc { bus_dma_tag_t sc_cdmatag; /* control data bus DMA tag */ bus_dmamap_t sc_dmamap; /* bus DMA handle */ - int sc_phyad; /* PHY to use or -1 for any */ - u_int sc_variant; #define GEM_UNKNOWN 0 /* don't know */ #define GEM_SUN_GEM 1 /* Sun GEM */ Modified: stable/7/sys/dev/hme/if_hme.c ============================================================================== --- stable/7/sys/dev/hme/if_hme.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/hme/if_hme.c Sun Nov 7 11:12:30 2010 (r214910) @@ -315,9 +315,20 @@ hme_config(struct hme_softc *sc) hme_mifinit(sc); - if ((error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, hme_mediachange, - hme_mediastatus)) != 0) { - device_printf(sc->sc_dev, "phy probe failed: %d\n", error); + /* + * DP83840A used with HME chips don't advertise their media + * capabilities themselves properly so force writing the ANAR + * according to the BMSR in mii_phy_setmedia(). + */ + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, hme_mediachange, + hme_mediastatus, BMSR_DEFCAPMASK, HME_PHYAD_EXTERNAL, + MII_OFFSET_ANY, MIIF_FORCEANEG); + i = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, hme_mediachange, + hme_mediastatus, BMSR_DEFCAPMASK, HME_PHYAD_INTERNAL, + MII_OFFSET_ANY, MIIF_FORCEANEG); + if (error != 0 && i != 0) { + error = ENXIO; + device_printf(sc->sc_dev, "attaching PHYs failed\n"); goto fail_rxdesc; } sc->sc_mii = device_get_softc(sc->sc_miibus); @@ -1404,10 +1415,6 @@ hme_mii_readreg(device_t dev, int phy, i int n; u_int32_t v; - /* We can at most have two PHYs. */ - if (phy != HME_PHYAD_EXTERNAL && phy != HME_PHYAD_INTERNAL) - return (0); - sc = device_get_softc(dev); /* Select the desired PHY in the MIF configuration register */ v = HME_MIF_READ_4(sc, HME_MIFI_CFG); @@ -1445,10 +1452,6 @@ hme_mii_writereg(device_t dev, int phy, int n; u_int32_t v; - /* We can at most have two PHYs. */ - if (phy != HME_PHYAD_EXTERNAL && phy != HME_PHYAD_INTERNAL) - return (0); - sc = device_get_softc(dev); /* Select the desired PHY in the MIF configuration register */ v = HME_MIF_READ_4(sc, HME_MIFI_CFG); Modified: stable/7/sys/dev/jme/if_jme.c ============================================================================== --- stable/7/sys/dev/jme/if_jme.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/jme/if_jme.c Sun Nov 7 11:12:30 2010 (r214910) @@ -224,13 +224,8 @@ jme_miibus_readreg(device_t dev, int phy sc = device_get_softc(dev); /* For FPGA version, PHY address 0 should be ignored. */ - if ((sc->jme_flags & JME_FLAG_FPGA) != 0) { - if (phy == 0) - return (0); - } else { - if (sc->jme_phyaddr != phy) - return (0); - } + if ((sc->jme_flags & JME_FLAG_FPGA) != 0 && phy == 0) + return (0); CSR_WRITE_4(sc, JME_SMI, SMI_OP_READ | SMI_OP_EXECUTE | SMI_PHY_ADDR(phy) | SMI_REG_ADDR(reg)); @@ -260,13 +255,8 @@ jme_miibus_writereg(device_t dev, int ph sc = device_get_softc(dev); /* For FPGA version, PHY address 0 should be ignored. */ - if ((sc->jme_flags & JME_FLAG_FPGA) != 0) { - if (phy == 0) - return (0); - } else { - if (sc->jme_phyaddr != phy) - return (0); - } + if ((sc->jme_flags & JME_FLAG_FPGA) != 0 && phy == 0) + return (0); CSR_WRITE_4(sc, JME_SMI, SMI_OP_WRITE | SMI_OP_EXECUTE | ((val << SMI_DATA_SHIFT) & SMI_DATA_MASK) | @@ -751,9 +741,11 @@ jme_attach(device_t dev) ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ - if ((error = mii_phy_probe(dev, &sc->jme_miibus, jme_mediachange, - jme_mediastatus)) != 0) { - device_printf(dev, "no PHY found!\n"); + error = mii_attach(dev, &sc->jme_miibus, ifp, jme_mediachange, + jme_mediastatus, BMSR_DEFCAPMASK, sc->jme_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/mii/acphy.c ============================================================================== --- stable/7/sys/dev/mii/acphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/acphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -132,6 +132,7 @@ acphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = acphy_service; Modified: stable/7/sys/dev/mii/amphy.c ============================================================================== --- stable/7/sys/dev/mii/amphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/amphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -109,6 +109,7 @@ amphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = amphy_service; Modified: stable/7/sys/dev/mii/atphy.c ============================================================================== --- stable/7/sys/dev/mii/atphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/atphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -113,6 +113,7 @@ atphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = atphy_service; Modified: stable/7/sys/dev/mii/bmtphy.c ============================================================================== --- stable/7/sys/dev/mii/bmtphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/bmtphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -147,6 +147,7 @@ bmtphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = bmtphy_service; Modified: stable/7/sys/dev/mii/brgphy.c ============================================================================== --- stable/7/sys/dev/mii/brgphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/brgphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -191,6 +191,7 @@ brgphy_attach(device_t dev) LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); /* Initialize mii_softc structure */ + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = brgphy_service; Modified: stable/7/sys/dev/mii/ciphy.c ============================================================================== --- stable/7/sys/dev/mii/ciphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/ciphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -57,9 +57,7 @@ __FBSDID("$FreeBSD$"); #include "miibus_if.h" #include -/* -#include -*/ + static int ciphy_probe(device_t); static int ciphy_attach(device_t); @@ -118,6 +116,7 @@ ciphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = ciphy_service; Modified: stable/7/sys/dev/mii/e1000phy.c ============================================================================== --- stable/7/sys/dev/mii/e1000phy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/e1000phy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -59,9 +59,6 @@ __FBSDID("$FreeBSD$"); #include "miidevs.h" #include -/* XXX */ -#include -#include #include "miibus_if.h" @@ -71,7 +68,6 @@ static int e1000phy_attach(device_t); struct e1000phy_softc { struct mii_softc mii_sc; int mii_model; - struct msk_mii_data *mmd; }; static device_method_t e1000phy_methods[] = { @@ -144,6 +140,7 @@ e1000phy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = e1000phy_service; @@ -151,14 +148,9 @@ e1000phy_attach(device_t dev) esc->mii_model = MII_MODEL(ma->mii_id2); ifp = sc->mii_pdata->mii_ifp; - if (strcmp(ifp->if_dname, "msk") == 0) { - /* XXX */ - esc->mmd = device_get_ivars( - device_get_parent(device_get_parent(dev))); - if (esc->mmd != NULL && - (esc->mmd->mii_flags & MIIF_HAVEFIBER) != 0) - sc->mii_flags |= MIIF_HAVEFIBER; - } + if (strcmp(ifp->if_dname, "msk") == 0 && + (sc->mii_flags & MIIF_MACPRIV0) != 0) + sc->mii_flags |= MIIF_PHYPRIV0; switch (esc->mii_model) { case MII_MODEL_MARVELL_E1011: @@ -214,7 +206,7 @@ e1000phy_reset(struct mii_softc *sc) reg &= ~E1000_SCR_MODE_MASK; reg |= E1000_SCR_MODE_1000BX; PHY_WRITE(sc, E1000_SCR, reg); - if (esc->mmd != NULL && esc->mmd->pmd == 'P') { + if ((sc->mii_flags & MIIF_MACPRIV0) != 0) { /* Set SIGDET polarity low for SFP module. */ PHY_WRITE(sc, E1000_EADR, 1); reg = PHY_READ(sc, E1000_SCR); Modified: stable/7/sys/dev/mii/exphy.c ============================================================================== --- stable/7/sys/dev/mii/exphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/exphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -138,6 +138,7 @@ exphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = exphy_service; Modified: stable/7/sys/dev/mii/gentbi.c ============================================================================== --- stable/7/sys/dev/mii/gentbi.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/gentbi.c Sun Nov 7 11:12:30 2010 (r214910) @@ -166,6 +166,7 @@ gentbi_attach(device_t dev) MII_OUI(ma->mii_id1, ma->mii_id2), MII_MODEL(ma->mii_id2), MII_REV(ma->mii_id2)); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = gentbi_service; Modified: stable/7/sys/dev/mii/icsphy.c ============================================================================== --- stable/7/sys/dev/mii/icsphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/icsphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -141,6 +141,7 @@ icsphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = icsphy_service; Modified: stable/7/sys/dev/mii/inphy.c ============================================================================== --- stable/7/sys/dev/mii/inphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/inphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -107,6 +107,7 @@ inphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = inphy_service; Modified: stable/7/sys/dev/mii/ip1000phy.c ============================================================================== --- stable/7/sys/dev/mii/ip1000phy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/ip1000phy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -114,6 +114,7 @@ ip1000phy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = ip1000phy_service; @@ -123,6 +124,10 @@ ip1000phy_attach(device_t dev) isc->model = MII_MODEL(ma->mii_id2); isc->revision = MII_REV(ma->mii_id2); + if (isc->model == MII_MODEL_ICPLUS_IP1000A && + strcmp(mii->mii_ifp->if_dname, "stge") == 0 && + (sc->mii_flags & MIIF_MACPRIV0) != 0) + sc->mii_flags |= MIIF_PHYPRIV0; sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; if (sc->mii_capabilities & BMSR_EXTSTAT) @@ -412,12 +417,8 @@ ip1000phy_load_dspcode(struct mii_softc static void ip1000phy_reset(struct mii_softc *sc) { - struct ip1000phy_softc *isc; - struct stge_softc *stge_sc; - struct mii_data *mii; uint32_t reg; - isc = (struct ip1000phy_softc *)sc; mii_phy_reset(sc); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 11:39:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 65D591065670; Sun, 7 Nov 2010 11:39:48 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 53BD58FC20; Sun, 7 Nov 2010 11:39:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7BdmXN041513; Sun, 7 Nov 2010 11:39:48 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Bdm3I041511; Sun, 7 Nov 2010 11:39:48 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201011071139.oA7Bdm3I041511@svn.freebsd.org> From: Xin LI Date: Sun, 7 Nov 2010 11:39:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214911 - stable/8/etc/periodic/security X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 11:39:48 -0000 Author: delphij Date: Sun Nov 7 11:39:48 2010 New Revision: 214911 URL: http://svn.freebsd.org/changeset/base/214911 Log: Revert r214897 in order to finish the merge properly without stopping svn2cvs. Pointy hat to: delphij Deleted: stable/8/etc/periodic/security/460.chkportsum Modified: stable/8/etc/periodic/security/Makefile Modified: stable/8/etc/periodic/security/Makefile ============================================================================== --- stable/8/etc/periodic/security/Makefile Sun Nov 7 11:12:30 2010 (r214910) +++ stable/8/etc/periodic/security/Makefile Sun Nov 7 11:39:48 2010 (r214911) @@ -6,7 +6,6 @@ FILES= 100.chksetuid \ 200.chkmounts \ 300.chkuid0 \ 400.passwdless \ - 460.chkportsum \ 410.logincheck \ 700.kernelmsg \ 800.loginfail \ From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 11:51:58 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00B2A106566B; Sun, 7 Nov 2010 11:51:58 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C81A88FC1C; Sun, 7 Nov 2010 11:51:57 +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 oA7BpvWl042200; Sun, 7 Nov 2010 11:51:57 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7BpvdX042196; Sun, 7 Nov 2010 11:51:57 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201011071151.oA7BpvdX042196@svn.freebsd.org> From: Xin LI Date: Sun, 7 Nov 2010 11:51:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214912 - in stable/8/etc: defaults periodic/security X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 11:51:58 -0000 Author: delphij Date: Sun Nov 7 11:51:57 2010 New Revision: 214912 URL: http://svn.freebsd.org/changeset/base/214912 Log: Redo r214897: MFC r211141 (gabor) - Fixes to the chkportsum script to handle better some special cases, like spaces in filename Submitted by: Alex Kozlov MFC r210254 (gabor) - Add a periodic script, which can be used to find installed ports' files with mismatched checksum PR: conf/124641 Submitted by: Alex Kozlov Added: stable/8/etc/periodic/security/460.chkportsum - copied, changed from r210254, head/etc/periodic/security/460.chkportsum Modified: stable/8/etc/defaults/periodic.conf stable/8/etc/periodic/security/Makefile Directory Properties: stable/8/etc/periodic/security/ (props changed) Modified: stable/8/etc/defaults/periodic.conf ============================================================================== --- stable/8/etc/defaults/periodic.conf Sun Nov 7 11:39:48 2010 (r214911) +++ stable/8/etc/defaults/periodic.conf Sun Nov 7 11:51:57 2010 (r214912) @@ -171,6 +171,9 @@ daily_status_security_passwdless_enable= # 410.logincheck daily_status_security_logincheck_enable="YES" +# 460.chkportsum +daily_status_security_chkportsum_enable="NO" # Check ports w/ wrong checksum + # 500.ipfwdenied daily_status_security_ipfwdenied_enable="YES" Copied and modified: stable/8/etc/periodic/security/460.chkportsum (from r210254, head/etc/periodic/security/460.chkportsum) ============================================================================== --- head/etc/periodic/security/460.chkportsum Mon Jul 19 20:19:14 2010 (r210254, copy source) +++ stable/8/etc/periodic/security/460.chkportsum Sun Nov 7 11:51:57 2010 (r214912) @@ -42,20 +42,20 @@ echo 'Checking for ports with mismatched case "${daily_status_security_chkportsum_enable}" in [Yy][Ee][Ss]) + set -f pkg_info -ga 2>/dev/null | \ - while read one two three; do - case ${one} in + while IFS= read -r line; do + set -- $line + case $1 in Information) - case ${two} in - for) name=${three%%:} ;; - *) name='??' ;; + case $2 in + for) name="${3%%:}" ;; + *) name='??' ;; esac ;; Mismatched|'') ;; - *) - if [ -n ${name} ]; then - echo ${name}: ${one} - fi + *) [ -n "${name}" ] && + echo "${name}: ${line%% fails the original MD5 checksum}" ;; esac done Modified: stable/8/etc/periodic/security/Makefile ============================================================================== --- stable/8/etc/periodic/security/Makefile Sun Nov 7 11:39:48 2010 (r214911) +++ stable/8/etc/periodic/security/Makefile Sun Nov 7 11:51:57 2010 (r214912) @@ -7,6 +7,7 @@ FILES= 100.chksetuid \ 300.chkuid0 \ 400.passwdless \ 410.logincheck \ + 460.chkportsum \ 700.kernelmsg \ 800.loginfail \ 900.tcpwrap \ From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 12:29:27 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2150C1065672; Sun, 7 Nov 2010 12:29:27 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0FCCD8FC1B; Sun, 7 Nov 2010 12:29: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 oA7CTQCt044233; Sun, 7 Nov 2010 12:29:26 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7CTQa6044231; Sun, 7 Nov 2010 12:29:26 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071229.oA7CTQa6044231@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 12:29:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214913 - head/sys/dev/wb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 12:29:27 -0000 Author: marius Date: Sun Nov 7 12:29:26 2010 New Revision: 214913 URL: http://svn.freebsd.org/changeset/base/214913 Log: Fix indentation in r213894. Modified: head/sys/dev/wb/if_wb.c Modified: head/sys/dev/wb/if_wb.c ============================================================================== --- head/sys/dev/wb/if_wb.c Sun Nov 7 11:51:57 2010 (r214912) +++ head/sys/dev/wb/if_wb.c Sun Nov 7 12:29:26 2010 (r214913) @@ -857,7 +857,7 @@ wb_attach(dev) */ error = mii_attach(dev, &sc->wb_miibus, ifp, wb_ifmedia_upd, wb_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); - if (error != 0) { + if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; } From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 14:28:01 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7829E1065670; Sun, 7 Nov 2010 14:28:01 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 676ED8FC15; Sun, 7 Nov 2010 14:28: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 oA7ES15Z051087; Sun, 7 Nov 2010 14:28:01 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7ES1Sd051085; Sun, 7 Nov 2010 14:28:01 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201011071428.oA7ES1Sd051085@svn.freebsd.org> From: Jaakko Heinonen Date: Sun, 7 Nov 2010 14:28:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214917 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 14:28:01 -0000 Author: jh Date: Sun Nov 7 14:28:01 2010 New Revision: 214917 URL: http://svn.freebsd.org/changeset/base/214917 Log: Add missing curly brackets. By chance, the missing brackets didn't alter the code behavior. Submitted by: Lucius Windschuh Modified: head/sys/kern/kern_conf.c Modified: head/sys/kern/kern_conf.c ============================================================================== --- head/sys/kern/kern_conf.c Sun Nov 7 13:50:42 2010 (r214916) +++ head/sys/kern/kern_conf.c Sun Nov 7 14:28:01 2010 (r214917) @@ -752,7 +752,7 @@ make_dev_credv(int flags, struct cdev ** return (res); } dev = newdev(devsw, unit, dev_new); - if ((dev->si_flags & SI_NAMED) == 0) + if ((dev->si_flags & SI_NAMED) == 0) { res = prep_devname(dev, fmt, ap); if (res != 0) { if ((flags & MAKEDEV_CHECKNAME) == 0) { @@ -766,6 +766,7 @@ make_dev_credv(int flags, struct cdev ** devfs_free(dev); } return (res); + } } if (flags & MAKEDEV_REF) dev_refl(dev); From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 14:39:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1284B106564A; Sun, 7 Nov 2010 14:39:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 013C28FC13; Sun, 7 Nov 2010 14:39: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 oA7Edeit051987; Sun, 7 Nov 2010 14:39:40 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7EdekE051983; Sun, 7 Nov 2010 14:39:40 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201011071439.oA7EdekE051983@svn.freebsd.org> From: Michael Tuexen Date: Sun, 7 Nov 2010 14:39:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214918 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 14:39:41 -0000 Author: tuexen Date: Sun Nov 7 14:39:40 2010 New Revision: 214918 URL: http://svn.freebsd.org/changeset/base/214918 Log: Not only stop all timers when entering the SHUTDOWN_SENT state, but also when entering the SHUTDOWN_ACK_SEND state. MFC after: 3 days. Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sun Nov 7 14:28:01 2010 (r214917) +++ head/sys/netinet/sctp_indata.c Sun Nov 7 14:39:40 2010 (r214918) @@ -4369,7 +4369,7 @@ again: SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); sctp_send_shutdown_ack(stcb, stcb->asoc.primary_destination); - + sctp_stop_timers_for_shutdown(stcb); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb->sctp_ep, stcb, asoc->primary_destination); } @@ -5081,7 +5081,7 @@ done_with_it: SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); sctp_send_shutdown_ack(stcb, stcb->asoc.primary_destination); - + sctp_stop_timers_for_shutdown(stcb); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb->sctp_ep, stcb, asoc->primary_destination); return; Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sun Nov 7 14:28:01 2010 (r214917) +++ head/sys/netinet/sctp_input.c Sun Nov 7 14:39:40 2010 (r214918) @@ -908,9 +908,7 @@ sctp_handle_shutdown(struct sctp_shutdow } SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); - sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, net, - SCTP_FROM_SCTP_INPUT + SCTP_LOC_7); - /* start SHUTDOWN timer */ + sctp_stop_timers_for_shutdown(stcb); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb->sctp_ep, stcb, net); } Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sun Nov 7 14:28:01 2010 (r214917) +++ head/sys/netinet/sctputil.c Sun Nov 7 14:39:40 2010 (r214918) @@ -725,6 +725,31 @@ sctp_audit_log(uint8_t ev, uint8_t fd) #endif /* + * sctp_stop_timers_for_shutdown() should be called + * when entering the SHUTDOWN_SENT or SHUTDOWN_ACK_SENT + * state to make sure that all timers are stopped. + */ +void +sctp_stop_timers_for_shutdown(struct sctp_tcb *stcb) +{ + struct sctp_association *asoc; + struct sctp_nets *net; + + asoc = &stcb->asoc; + + (void)SCTP_OS_TIMER_STOP(&asoc->hb_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer); + TAILQ_FOREACH(net, &asoc->nets, sctp_next) { + (void)SCTP_OS_TIMER_STOP(&net->fr_timer.timer); + (void)SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer); + } +} + +/* * a list of sizes based on typical mtu's, used only if next hop size not * returned. */ @@ -749,26 +774,6 @@ static int sctp_mtu_sizes[] = { 65535 }; -void -sctp_stop_timers_for_shutdown(struct sctp_tcb *stcb) -{ - struct sctp_association *asoc; - struct sctp_nets *net; - - asoc = &stcb->asoc; - - (void)SCTP_OS_TIMER_STOP(&asoc->hb_timer.timer); - (void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer); - (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer); - (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer); - (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer); - (void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer); - TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - (void)SCTP_OS_TIMER_STOP(&net->fr_timer.timer); - (void)SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer); - } -} - int find_next_best_mtu(int totsz) { From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 15:36:07 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B01271065670; Sun, 7 Nov 2010 15:36:07 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F7958FC0A; Sun, 7 Nov 2010 15:36:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7Fa7nl055279; Sun, 7 Nov 2010 15:36:07 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Fa7Av055277; Sun, 7 Nov 2010 15:36:07 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <201011071536.oA7Fa7Av055277@svn.freebsd.org> From: Nick Hibma Date: Sun, 7 Nov 2010 15:36:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214919 - head/sys/dev/usb/serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 15:36:07 -0000 Author: n_hibma Date: Sun Nov 7 15:36:07 2010 New Revision: 214919 URL: http://svn.freebsd.org/changeset/base/214919 Log: Bugfix: Set the bit that marks a device number in use. This would cause a panic when disconnecting the second serial device. Submitted by: Lucius Windschuh Modified: head/sys/dev/usb/serial/usb_serial.c Modified: head/sys/dev/usb/serial/usb_serial.c ============================================================================== --- head/sys/dev/usb/serial/usb_serial.c Sun Nov 7 14:39:40 2010 (r214918) +++ head/sys/dev/usb/serial/usb_serial.c Sun Nov 7 15:36:07 2010 (r214919) @@ -200,9 +200,12 @@ ucom_unit_alloc(void) mtx_lock(&ucom_bitmap_mtx); - for (unit = 0; unit < UCOM_UNIT_MAX; unit++) - if ((ucom_bitmap[unit / 8] & (1 << (unit % 8))) == 0) + for (unit = 0; unit < UCOM_UNIT_MAX; unit++) { + if ((ucom_bitmap[unit / 8] & (1 << (unit % 8))) == 0) { + ucom_bitmap[unit / 8] |= (1 << (unit % 8)); break; + } + } mtx_unlock(&ucom_bitmap_mtx); From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 16:05:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 466661065672; Sun, 7 Nov 2010 16:05:05 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E2668FC16; Sun, 7 Nov 2010 16:05:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7G55Al057432; Sun, 7 Nov 2010 16:05:05 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7G55Yh057429; Sun, 7 Nov 2010 16:05:05 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201011071605.oA7G55Yh057429@svn.freebsd.org> From: Olivier Houchard Date: Sun, 7 Nov 2010 16:05:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214921 - in head/usr.sbin/makefs: . cd9660 compat ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 16:05:05 -0000 Author: cognet Date: Sun Nov 7 16:05:04 2010 New Revision: 214921 URL: http://svn.freebsd.org/changeset/base/214921 Log: Sync with the latest version from NetBSD. It notably addds ISO9660 support. Submitted by: bapt Added: head/usr.sbin/makefs/cd9660/ head/usr.sbin/makefs/cd9660.c (contents, props changed) head/usr.sbin/makefs/cd9660.h (contents, props changed) head/usr.sbin/makefs/cd9660/Makefile.inc (contents, props changed) head/usr.sbin/makefs/cd9660/cd9660_archimedes.c (contents, props changed) head/usr.sbin/makefs/cd9660/cd9660_archimedes.h (contents, props changed) head/usr.sbin/makefs/cd9660/cd9660_conversion.c (contents, props changed) head/usr.sbin/makefs/cd9660/cd9660_debug.c (contents, props changed) head/usr.sbin/makefs/cd9660/cd9660_eltorito.c (contents, props changed) head/usr.sbin/makefs/cd9660/cd9660_eltorito.h (contents, props changed) head/usr.sbin/makefs/cd9660/cd9660_strings.c (contents, props changed) head/usr.sbin/makefs/cd9660/cd9660_write.c (contents, props changed) head/usr.sbin/makefs/cd9660/iso9660_rrip.c (contents, props changed) head/usr.sbin/makefs/cd9660/iso9660_rrip.h (contents, props changed) head/usr.sbin/makefs/compat/Makefile.inc (contents, props changed) head/usr.sbin/makefs/ffs.h (contents, props changed) head/usr.sbin/makefs/ffs/Makefile.inc (contents, props changed) Modified: head/usr.sbin/makefs/Makefile head/usr.sbin/makefs/ffs.c head/usr.sbin/makefs/ffs/buf.c head/usr.sbin/makefs/ffs/ffs_alloc.c head/usr.sbin/makefs/ffs/mkfs.c head/usr.sbin/makefs/makefs.8 head/usr.sbin/makefs/makefs.c head/usr.sbin/makefs/makefs.h head/usr.sbin/makefs/walk.c Modified: head/usr.sbin/makefs/Makefile ============================================================================== --- head/usr.sbin/makefs/Makefile Sun Nov 7 15:41:41 2010 (r214920) +++ head/usr.sbin/makefs/Makefile Sun Nov 7 16:05:04 2010 (r214921) @@ -1,22 +1,23 @@ # $FreeBSD$ PROG= makefs + +CFLAGS+=-I${.CURDIR} + +SRCS= cd9660.c ffs.c \ + getid.c \ + makefs.c \ + walk.c MAN= makefs.8 WARNS?= 2 -CFLAGS+=-I${.CURDIR} -SRCS= ffs.c getid.c makefs.c walk.c +.include "${.CURDIR}/cd9660/Makefile.inc" +.include "${.CURDIR}/ffs/Makefile.inc" +.include "${.CURDIR}/compat/Makefile.inc" -.PATH: ${.CURDIR}/ffs -CFLAGS+=-I${.CURDIR}/ffs CFLAGS+=-DHAVE_STRUCT_STAT_ST_FLAGS=1 CFLAGS+=-DHAVE_STRUCT_STAT_ST_GEN=1 -SRCS+= buf.c ffs_alloc.c ffs_balloc.c ffs_bswap.c ffs_subr.c mkfs.c ufs_bmap.c - -.PATH: ${.CURDIR}/compat -CFLAGS+=-I${.CURDIR}/compat -SRCS+= pwcache.c strsuftoll.c .PATH: ${.CURDIR}/../mtree CFLAGS+=-I${.CURDIR}/../mtree Added: head/usr.sbin/makefs/cd9660.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/makefs/cd9660.c Sun Nov 7 16:05:04 2010 (r214921) @@ -0,0 +1,2154 @@ +/* $NetBSD: cd9660.c,v 1.27 2010/10/27 18:51:34 christos Exp $ */ + +/* + * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan + * Perez-Rathke and Ram Vedam. All rights reserved. + * + * This code was written by Daniel Watt, Walter Deignan, Ryan Gabrys, + * Alan Perez-Rathke and Ram Vedam. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY DANIEL WATT, WALTER DEIGNAN, RYAN + * GABRYS, ALAN PEREZ-RATHKE AND RAM VEDAM ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL DANIEL WATT, WALTER DEIGNAN, RYAN + * GABRYS, ALAN PEREZ-RATHKE AND RAM VEDAM BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + */ +/* + * Copyright (c) 2001 Wasabi Systems, Inc. + * All rights reserved. + * + * Written by Luke Mewburn for Wasabi Systems, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed for the NetBSD Project by + * Wasabi Systems, Inc. + * 4. The name of Wasabi Systems, Inc. may not be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University 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 REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include "makefs.h" +#include "cd9660.h" +#include "cd9660/iso9660_rrip.h" +#include "cd9660/cd9660_archimedes.h" + +/* + * Global variables + */ +iso9660_disk diskStructure; + +static void cd9660_finalize_PVD(void); +static cd9660node *cd9660_allocate_cd9660node(void); +static void cd9660_set_defaults(void); +static int cd9660_arguments_set_string(const char *, const char *, int, + char, char *); +static void cd9660_populate_iso_dir_record( + struct _iso_directory_record_cd9660 *, u_char, u_char, u_char, + const char *); +static void cd9660_setup_root_node(void); +static int cd9660_setup_volume_descriptors(void); +#if 0 +static int cd9660_fill_extended_attribute_record(cd9660node *); +#endif +static void cd9660_sort_nodes(cd9660node *); +static int cd9960_translate_node_common(cd9660node *); +static int cd9660_translate_node(fsnode *, cd9660node *); +static int cd9660_compare_filename(const char *, const char *); +static void cd9660_sorted_child_insert(cd9660node *, cd9660node *); +static int cd9660_handle_collisions(cd9660node *, int); +static cd9660node *cd9660_rename_filename(cd9660node *, int, int); +static void cd9660_copy_filenames(cd9660node *); +static void cd9660_sorting_nodes(cd9660node *); +static int cd9660_count_collisions(cd9660node *); +static cd9660node *cd9660_rrip_move_directory(cd9660node *); +static int cd9660_add_dot_records(cd9660node *); + +static void cd9660_convert_structure(fsnode *, cd9660node *, int, + int *, int *); +static void cd9660_free_structure(cd9660node *); +static int cd9660_generate_path_table(void); +static int cd9660_level1_convert_filename(const char *, char *, int); +static int cd9660_level2_convert_filename(const char *, char *, int); +#if 0 +static int cd9660_joliet_convert_filename(const char *, char *, int); +#endif +static int cd9660_convert_filename(const char *, char *, int); +static void cd9660_populate_dot_records(cd9660node *); +static int64_t cd9660_compute_offsets(cd9660node *, int64_t); +#if 0 +static int cd9660_copy_stat_info(cd9660node *, cd9660node *, int); +#endif +static cd9660node *cd9660_create_virtual_entry(const char *, cd9660node *, int, + int); +static cd9660node *cd9660_create_file(const char *, cd9660node *, cd9660node *); +static cd9660node *cd9660_create_directory(const char *, cd9660node *, + cd9660node *); +static cd9660node *cd9660_create_special_directory(u_char, cd9660node *); + + +/* + * Allocate and initalize a cd9660node + * @returns struct cd9660node * Pointer to new node, or NULL on error + */ +static cd9660node * +cd9660_allocate_cd9660node(void) +{ + cd9660node *temp; + + if ((temp = calloc(1, sizeof(cd9660node))) == NULL) + err(EXIT_FAILURE, "%s: calloc", __func__); + TAILQ_INIT(&temp->cn_children); + temp->parent = temp->dot_record = temp->dot_dot_record = NULL; + temp->ptnext = temp->ptprev = temp->ptlast = NULL; + temp->node = NULL; + temp->isoDirRecord = NULL; + temp->isoExtAttributes = NULL; + temp->rr_real_parent = temp->rr_relocated = NULL; + temp->su_tail_data = NULL; + return temp; +} + +int cd9660_defaults_set = 0; + +/** +* Set default values for cd9660 extension to makefs +*/ +static void +cd9660_set_defaults(void) +{ + /*Fix the sector size for now, though the spec allows for other sizes*/ + diskStructure.sectorSize = 2048; + + /* Set up defaults in our own structure */ + diskStructure.verbose_level = 0; + diskStructure.keep_bad_images = 0; + diskStructure.follow_sym_links = 0; + diskStructure.isoLevel = 2; + + diskStructure.rock_ridge_enabled = 0; + diskStructure.rock_ridge_renamed_dir_name = 0; + diskStructure.rock_ridge_move_count = 0; + diskStructure.rr_moved_dir = 0; + + diskStructure.archimedes_enabled = 0; + + diskStructure.include_padding_areas = 1; + + /* Spec breaking functionality */ + diskStructure.allow_deep_trees = + diskStructure.allow_start_dot = + diskStructure.allow_max_name = + diskStructure.allow_illegal_chars = + diskStructure.allow_lowercase = + diskStructure.allow_multidot = + diskStructure.omit_trailing_period = 0; + + /* Make sure the PVD is clear */ + memset(&diskStructure.primaryDescriptor, 0, 2048); + + memset(diskStructure.primaryDescriptor.volume_set_id, 0x20,32); + memset(diskStructure.primaryDescriptor.publisher_id, 0x20,128); + memset(diskStructure.primaryDescriptor.preparer_id, 0x20,128); + memset(diskStructure.primaryDescriptor.application_id, 0x20,128); + memset(diskStructure.primaryDescriptor.copyright_file_id, 0x20,128); + memset(diskStructure.primaryDescriptor.abstract_file_id, 0x20,128); + memset(diskStructure.primaryDescriptor.bibliographic_file_id, 0x20,128); + + strcpy(diskStructure.primaryDescriptor.system_id,"NetBSD"); + + cd9660_defaults_set = 1; + + /* Boot support: Initially disabled */ + diskStructure.has_generic_bootimage = 0; + diskStructure.generic_bootimage = NULL; + + diskStructure.boot_image_directory = 0; + /*memset(diskStructure.boot_descriptor, 0, 2048);*/ + + diskStructure.is_bootable = 0; + TAILQ_INIT(&diskStructure.boot_images); + LIST_INIT(&diskStructure.boot_entries); +} + +void +cd9660_prep_opts(fsinfo_t *fsopts __unused) +{ + cd9660_set_defaults(); +} + +void +cd9660_cleanup_opts(fsinfo_t *fsopts __unused) +{ + +} + +static int +cd9660_arguments_set_string(const char *val, const char *fieldtitle, int length, + char testmode, char * dest) +{ + int len, test; + + if (val == NULL) + warnx("error: The %s requires a string argument", fieldtitle); + else if ((len = strlen(val)) <= length) { + if (testmode == 'd') + test = cd9660_valid_d_chars(val); + else + test = cd9660_valid_a_chars(val); + if (test) { + memcpy(dest, val, len); + if (test == 2) + cd9660_uppercase_characters(dest, len); + return 1; + } else + warnx("error: The %s must be composed of " + "%c-characters", fieldtitle, testmode); + } else + warnx("error: The %s must be at most 32 characters long", + fieldtitle); + return 0; +} + +/* + * Command-line parsing function + */ + +int +cd9660_parse_opts(const char *option, fsinfo_t *fsopts) +{ + char *var, *val; + int rv; + /* Set up allowed options - integer options ONLY */ + option_t cd9660_options[] = { + { "l", &diskStructure.isoLevel, 1, 3, "ISO Level" }, + { "isolevel", &diskStructure.isoLevel, 1, 3, "ISO Level" }, + { "verbose", &diskStructure.verbose_level, 0, 2, + "Turns on verbose output" }, + { "v", &diskStructure.verbose_level, 0 , 2, + "Turns on verbose output"}, + { .name = NULL } + }; + + if (cd9660_defaults_set == 0) + cd9660_set_defaults(); + + /* + * Todo : finish implementing this, and make a function that + * parses them + */ + /* + string_option_t cd9660_string_options[] = { + { "L", "Label", &diskStructure.primaryDescriptor.volume_id, 1, 32, "Disk Label", ISO_STRING_FILTER_DCHARS }, + { NULL } + } + */ + + assert(option != NULL); + + if (debug & DEBUG_FS_PARSE_OPTS) + printf("cd9660_parse_opts: got `%s'\n", option); + + if ((var = strdup(option)) == NULL) + err(1, "allocating memory for copy of option string"); + rv = 1; + + val = strchr(var, '='); + if (val != NULL) + *val++ = '\0'; + + /* First handle options with no parameters */ + if (strcmp(var, "h") == 0) { + diskStructure.displayHelp = 1; + rv = 1; + } else if (CD9660_IS_COMMAND_ARG_DUAL(var, "S", "follow-symlinks")) { + /* this is not handled yet */ + diskStructure.follow_sym_links = 1; + rv = 1; + } else if (CD9660_IS_COMMAND_ARG_DUAL(var, "L", "label")) { + rv = cd9660_arguments_set_string(val, "Disk Label", 32, 'd', + diskStructure.primaryDescriptor.volume_id); + } else if (CD9660_IS_COMMAND_ARG_DUAL(var, "A", "applicationid")) { + rv = cd9660_arguments_set_string(val, "Application Identifier", 128, 'a', + diskStructure.primaryDescriptor.application_id); + } else if(CD9660_IS_COMMAND_ARG_DUAL(var, "P", "publisher")) { + rv = cd9660_arguments_set_string(val, "Publisher Identifier", + 128, 'a', diskStructure.primaryDescriptor.publisher_id); + } else if (CD9660_IS_COMMAND_ARG_DUAL(var, "p", "preparer")) { + rv = cd9660_arguments_set_string(val, "Preparer Identifier", + 128, 'a', diskStructure.primaryDescriptor.preparer_id); + } else if (CD9660_IS_COMMAND_ARG_DUAL(var, "V", "volumeid")) { + rv = cd9660_arguments_set_string(val, "Volume Set Identifier", + 128, 'a', diskStructure.primaryDescriptor.volume_set_id); + /* Boot options */ + } else if (CD9660_IS_COMMAND_ARG_DUAL(var, "B", "bootimage")) { + if (val == NULL) + warnx("error: The Boot Image parameter requires a valid boot information string"); + else + rv = cd9660_add_boot_disk(val); + } else if (CD9660_IS_COMMAND_ARG(var, "bootimagedir")) { + /* + * XXXfvdl this is unused. + */ + if (val == NULL) + errx(1, "error: The Boot Image Directory parameter" + " requires a directory name\n"); + else { + if ((diskStructure.boot_image_directory = + malloc(strlen(val) + 1)) == NULL) { + CD9660_MEM_ALLOC_ERROR("cd9660_parse_opts"); + exit(1); + } + + /* BIG TODO: Add the max length function here */ + cd9660_arguments_set_string(val, "Boot Image Directory", + 12 , 'd', diskStructure.boot_image_directory); + } + } else if (CD9660_IS_COMMAND_ARG_DUAL(var, "G", "generic-bootimage")) { + if (val == NULL) + warnx("error: The Boot Image parameter requires a valid boot information string"); + else + rv = cd9660_add_generic_bootimage(val); + } else if (CD9660_IS_COMMAND_ARG(var, "no-trailing-padding")) + diskStructure.include_padding_areas = 0; + /* RRIP */ + else if (CD9660_IS_COMMAND_ARG_DUAL(var, "R", "rockridge")) + diskStructure.rock_ridge_enabled = 1; + else if (CD9660_IS_COMMAND_ARG_DUAL(var, "A", "archimedes")) + diskStructure.archimedes_enabled = 1; + else if (CD9660_IS_COMMAND_ARG_DUAL(var, "K", "keep-bad-images")) + diskStructure.keep_bad_images = 1; + else if (CD9660_IS_COMMAND_ARG(var, "allow-deep-trees")) + diskStructure.allow_deep_trees = 1; + else if (CD9660_IS_COMMAND_ARG(var, "allow-max-name")) + diskStructure.allow_max_name = 1; + else if (CD9660_IS_COMMAND_ARG(var, "allow-illegal-chars")) + diskStructure.allow_illegal_chars = 1; + else if (CD9660_IS_COMMAND_ARG(var, "allow-lowercase")) + diskStructure.allow_lowercase = 1; + else if (CD9660_IS_COMMAND_ARG(var,"allow-multidot")) + diskStructure.allow_multidot = 1; + else if (CD9660_IS_COMMAND_ARG(var, "omit-trailing-period")) + diskStructure.omit_trailing_period = 1; + else if (CD9660_IS_COMMAND_ARG(var, "no-emul-boot") || + CD9660_IS_COMMAND_ARG(var, "no-boot") || + CD9660_IS_COMMAND_ARG(var, "hard-disk-boot")) { + cd9660_eltorito_add_boot_option(var, 0); + + /* End of flag variables */ + } else if (CD9660_IS_COMMAND_ARG(var, "boot-load-segment")) { + if (val == NULL) { + warnx("Option `%s' doesn't contain a value", var); + rv = 0; + } else { + cd9660_eltorito_add_boot_option(var, val); + } + } else { + if (val == NULL) { + warnx("Option `%s' doesn't contain a value", var); + rv = 0; + } else + rv = set_option(cd9660_options, var, val); + } + + if (var) + free(var); + return (rv); +} + +/* + * Main function for cd9660_makefs + * Builds the ISO image file + * @param const char *image The image filename to create + * @param const char *dir The directory that is being read + * @param struct fsnode *root The root node of the filesystem tree + * @param struct fsinfo_t *fsopts Any options + */ +void +cd9660_makefs(const char *image, const char *dir, fsnode *root, + fsinfo_t *fsopts) +{ + int64_t startoffset; + int numDirectories; + uint64_t pathTableSectors; + int64_t firstAvailableSector; + int64_t totalSpace; + int error; + cd9660node *real_root; + + if (diskStructure.verbose_level > 0) + printf("cd9660_makefs: ISO level is %i\n", + diskStructure.isoLevel); + if (diskStructure.isoLevel < 2 && + diskStructure.allow_multidot) + errx(1, "allow-multidot requires iso level of 2\n"); + + assert(image != NULL); + assert(dir != NULL); + assert(root != NULL); + + if (diskStructure.displayHelp) { + /* + * Display help here - probably want to put it in + * a separate function + */ + return; + } + + diskStructure.rootFilesystemPath = dir; + + if (diskStructure.verbose_level > 0) + printf("cd9660_makefs: image %s directory %s root %p\n", + image, dir, root); + + /* Set up some constants. Later, these will be defined with options */ + + /* Counter needed for path tables */ + numDirectories = 0; + + /* Convert tree to our own format */ + /* Actually, we now need to add the REAL root node, at level 0 */ + + real_root = cd9660_allocate_cd9660node(); + if ((real_root->isoDirRecord = + malloc( sizeof(iso_directory_record_cd9660) )) == NULL) { + CD9660_MEM_ALLOC_ERROR("cd9660_makefs"); + exit(1); + } + + /* Leave filename blank for root */ + memset(real_root->isoDirRecord->name, 0, + ISO_FILENAME_MAXLENGTH_WITH_PADDING); + + real_root->level = 0; + diskStructure.rootNode = real_root; + real_root->type = CD9660_TYPE_DIR; + error = 0; + real_root->node = root; + cd9660_convert_structure(root, real_root, 1, &numDirectories, &error); + + if (TAILQ_EMPTY(&real_root->cn_children)) { + errx(1, "cd9660_makefs: converted directory is empty. " + "Tree conversion failed\n"); + } else if (error != 0) { + errx(1, "cd9660_makefs: tree conversion failed\n"); + } else { + if (diskStructure.verbose_level > 0) + printf("cd9660_makefs: tree converted\n"); + } + + /* Add the dot and dot dot records */ + cd9660_add_dot_records(real_root); + + cd9660_setup_root_node(); + + if (diskStructure.verbose_level > 0) + printf("cd9660_makefs: done converting tree\n"); + + /* non-SUSP extensions */ + if (diskStructure.archimedes_enabled) + archimedes_convert_tree(diskStructure.rootNode); + + /* Rock ridge / SUSP init pass */ + if (diskStructure.rock_ridge_enabled) { + cd9660_susp_initialize(diskStructure.rootNode, + diskStructure.rootNode, NULL); + } + + /* Build path table structure */ + diskStructure.pathTableLength = cd9660_generate_path_table(); + + pathTableSectors = CD9660_BLOCKS(diskStructure.sectorSize, + diskStructure.pathTableLength); + + firstAvailableSector = cd9660_setup_volume_descriptors(); + if (diskStructure.is_bootable) { + firstAvailableSector = cd9660_setup_boot(firstAvailableSector); + if (firstAvailableSector < 0) + errx(1, "setup_boot failed"); + } + /* LE first, then BE */ + diskStructure.primaryLittleEndianTableSector = firstAvailableSector; + diskStructure.primaryBigEndianTableSector = + diskStructure.primaryLittleEndianTableSector + pathTableSectors; + + /* Set the secondary ones to -1, not going to use them for now */ + diskStructure.secondaryBigEndianTableSector = -1; + diskStructure.secondaryLittleEndianTableSector = -1; + + diskStructure.dataFirstSector = + diskStructure.primaryBigEndianTableSector + pathTableSectors; + if (diskStructure.verbose_level > 0) + printf("cd9660_makefs: Path table conversion complete. " + "Each table is %i bytes, or %" PRIu64 " sectors.\n", + diskStructure.pathTableLength, pathTableSectors); + + startoffset = diskStructure.sectorSize*diskStructure.dataFirstSector; + + totalSpace = cd9660_compute_offsets(real_root, startoffset); + + diskStructure.totalSectors = diskStructure.dataFirstSector + + CD9660_BLOCKS(diskStructure.sectorSize, totalSpace); + + /* Disabled until pass 1 is done */ + if (diskStructure.rock_ridge_enabled) { + diskStructure.susp_continuation_area_start_sector = + diskStructure.totalSectors; + diskStructure.totalSectors += + CD9660_BLOCKS(diskStructure.sectorSize, + diskStructure.susp_continuation_area_size); + cd9660_susp_finalize(diskStructure.rootNode); + } + + + cd9660_finalize_PVD(); + + /* Add padding sectors, just for testing purposes right now */ + /* diskStructure.totalSectors+=150; */ + + /* Debugging output */ + if (diskStructure.verbose_level > 0) { + printf("cd9660_makefs: Sectors 0-15 reserved\n"); + printf("cd9660_makefs: Primary path tables starts in sector %" + PRId64 "\n", diskStructure.primaryLittleEndianTableSector); + printf("cd9660_makefs: File data starts in sector %" + PRId64 "\n", diskStructure.dataFirstSector); + printf("cd9660_makefs: Total sectors: %" + PRId64 "\n", diskStructure.totalSectors); + } + + /* + * Add padding sectors at the end + * TODO: Clean this up and separate padding + */ + if (diskStructure.include_padding_areas) + diskStructure.totalSectors += 150; + + cd9660_write_image(image); + + if (diskStructure.verbose_level > 1) { + debug_print_volume_descriptor_information(); + debug_print_tree(real_root,0); + debug_print_path_tree(real_root); + } + + /* Clean up data structures */ + cd9660_free_structure(real_root); + + if (diskStructure.verbose_level > 0) + printf("cd9660_makefs: done\n"); +} + +/* Generic function pointer - implement later */ +typedef int (*cd9660node_func)(cd9660node *); + +static void +cd9660_finalize_PVD(void) +{ + time_t tim; + unsigned char *temp; + + /* Copy the root directory record */ + temp = (unsigned char *) &diskStructure.primaryDescriptor; + + /* root should be a fixed size of 34 bytes since it has no name */ + memcpy(diskStructure.primaryDescriptor.root_directory_record, + diskStructure.rootNode->dot_record->isoDirRecord, 34); + + /* In RRIP, this might be longer than 34 */ + diskStructure.primaryDescriptor.root_directory_record[0] = 34; + + /* Set up all the important numbers in the PVD */ + cd9660_bothendian_dword(diskStructure.totalSectors, + (unsigned char *)diskStructure.primaryDescriptor.volume_space_size); + cd9660_bothendian_word(1, + (unsigned char *)diskStructure.primaryDescriptor.volume_set_size); + cd9660_bothendian_word(1, + (unsigned char *) + diskStructure.primaryDescriptor.volume_sequence_number); + cd9660_bothendian_word(diskStructure.sectorSize, + (unsigned char *) + diskStructure.primaryDescriptor.logical_block_size); + cd9660_bothendian_dword(diskStructure.pathTableLength, + (unsigned char *)diskStructure.primaryDescriptor.path_table_size); + + cd9660_731(diskStructure.primaryLittleEndianTableSector, + (u_char *)diskStructure.primaryDescriptor.type_l_path_table); + cd9660_732(diskStructure.primaryBigEndianTableSector, + (u_char *)diskStructure.primaryDescriptor.type_m_path_table); + + diskStructure.primaryDescriptor.file_structure_version[0] = 1; + + /* Pad all strings with spaces instead of nulls */ + cd9660_pad_string_spaces(diskStructure.primaryDescriptor.volume_id, 32); + cd9660_pad_string_spaces(diskStructure.primaryDescriptor.system_id, 32); + cd9660_pad_string_spaces(diskStructure.primaryDescriptor.volume_set_id, + 128); + cd9660_pad_string_spaces(diskStructure.primaryDescriptor.publisher_id, + 128); + cd9660_pad_string_spaces(diskStructure.primaryDescriptor.preparer_id, + 128); + cd9660_pad_string_spaces(diskStructure.primaryDescriptor.application_id, + 128); + cd9660_pad_string_spaces( + diskStructure.primaryDescriptor.copyright_file_id, 128); + cd9660_pad_string_spaces( + diskStructure.primaryDescriptor.abstract_file_id, 128); + cd9660_pad_string_spaces( + diskStructure.primaryDescriptor.bibliographic_file_id, 128); + + /* Setup dates */ + time(&tim); + cd9660_time_8426( + (unsigned char *)diskStructure.primaryDescriptor.creation_date, + tim); + cd9660_time_8426( + (unsigned char *)diskStructure.primaryDescriptor.modification_date, + tim); + + /* + cd9660_set_date(diskStructure.primaryDescriptor.expiration_date, now); + */ + + memset(diskStructure.primaryDescriptor.expiration_date, '0' ,17); + cd9660_time_8426( + (unsigned char *)diskStructure.primaryDescriptor.effective_date, + tim); +} + +static void +cd9660_populate_iso_dir_record(struct _iso_directory_record_cd9660 *record, + u_char ext_attr_length, u_char flags, + u_char name_len, const char * name) +{ + record->ext_attr_length[0] = ext_attr_length; + record->flags[0] = ISO_FLAG_CLEAR | flags; + record->file_unit_size[0] = 0; + record->interleave[0] = 0; + cd9660_bothendian_word(1, record->volume_sequence_number); + record->name_len[0] = name_len; + memset(record->name, '\0', sizeof (record->name)); + memcpy(record->name, name, name_len); + record->length[0] = 33 + name_len; + + /* Todo : better rounding */ + record->length[0] += (record->length[0] & 1) ? 1 : 0; +} + +static void +cd9660_setup_root_node(void) +{ + cd9660_populate_iso_dir_record(diskStructure.rootNode->isoDirRecord, + 0, ISO_FLAG_DIRECTORY, 1, "\0"); + +} + +/*********** SUPPORT FUNCTIONS ***********/ +static int +cd9660_setup_volume_descriptors(void) +{ + /* Boot volume descriptor should come second */ + int sector = 16; + /* For now, a fixed 2 : PVD and terminator */ + volume_descriptor *temp, *t; + + /* Set up the PVD */ + if ((temp = malloc(sizeof(volume_descriptor))) == NULL) { + CD9660_MEM_ALLOC_ERROR("cd9660_setup_volume_descriptors"); + exit(1); + } + + temp->volumeDescriptorData = + (unsigned char *)&diskStructure.primaryDescriptor; + temp->volumeDescriptorData[0] = ISO_VOLUME_DESCRIPTOR_PVD; + temp->volumeDescriptorData[6] = 1; + temp->sector = sector; + memcpy(temp->volumeDescriptorData + 1, + ISO_VOLUME_DESCRIPTOR_STANDARD_ID, 5); + diskStructure.firstVolumeDescriptor = temp; + + sector++; + /* Set up boot support if enabled. BVD must reside in sector 17 */ + if (diskStructure.is_bootable) { + if ((t = malloc(sizeof(volume_descriptor))) == NULL) { + CD9660_MEM_ALLOC_ERROR( + "cd9660_setup_volume_descriptors"); + exit(1); + } + if ((t->volumeDescriptorData = malloc(2048)) == NULL) { + CD9660_MEM_ALLOC_ERROR( + "cd9660_setup_volume_descriptors"); + exit(1); + } + temp->next = t; + temp = t; + memset(t->volumeDescriptorData, 0, 2048); + t->sector = 17; + if (diskStructure.verbose_level > 0) + printf("Setting up boot volume descriptor\n"); + cd9660_setup_boot_volume_descriptor(t); + sector++; + } + + /* Set up the terminator */ + if ((t = malloc(sizeof(volume_descriptor))) == NULL) { + CD9660_MEM_ALLOC_ERROR("cd9660_setup_volume_descriptors"); + exit(1); + } + if ((t->volumeDescriptorData = malloc(2048)) == NULL) { + CD9660_MEM_ALLOC_ERROR("cd9660_setup_volume_descriptors"); + exit(1); + } + + temp->next = t; + memset(t->volumeDescriptorData, 0, 2048); + t->volumeDescriptorData[0] = ISO_VOLUME_DESCRIPTOR_TERMINATOR; + t->next = 0; + t->volumeDescriptorData[6] = 1; + t->sector = sector; + memcpy(t->volumeDescriptorData + 1, + ISO_VOLUME_DESCRIPTOR_STANDARD_ID, 5); + + sector++; + return sector; +} + +#if 0 +/* + * Populate EAR at some point. Not required, but is used by NetBSD's + * cd9660 support + */ +static int +cd9660_fill_extended_attribute_record(cd9660node *node) +{ + if ((node->isoExtAttributes = + malloc(sizeof(struct iso_extended_attributes))) == NULL) { + CD9660_MEM_ALLOC_ERROR("cd9660_fill_extended_attribute_record"); + exit(1); + }; + + return 1; +} +#endif + +static int +cd9960_translate_node_common(cd9660node *newnode) +{ + time_t tim; + int test; + u_char flag; + char temp[ISO_FILENAME_MAXLENGTH_WITH_PADDING]; + + /* Now populate the isoDirRecord structure */ + memset(temp, 0, ISO_FILENAME_MAXLENGTH_WITH_PADDING); + + test = cd9660_convert_filename(newnode->node->name, + temp, !(S_ISDIR(newnode->node->type))); + + flag = ISO_FLAG_CLEAR; + if (S_ISDIR(newnode->node->type)) + flag |= ISO_FLAG_DIRECTORY; + + cd9660_populate_iso_dir_record(newnode->isoDirRecord, 0, + flag, strlen(temp), temp); + + /* Set the various dates */ + + /* If we want to use the current date and time */ + time(&tim); + + cd9660_time_915(newnode->isoDirRecord->date, tim); + + cd9660_bothendian_dword(newnode->fileDataLength, + newnode->isoDirRecord->size); + /* If the file is a link, we want to set the size to 0 */ + if (S_ISLNK(newnode->node->type)) + newnode->fileDataLength = 0; + + return 1; +} + +/* + * Translate fsnode to cd9960node + * Translate filenames and other metadata, including dates, sizes, + * permissions, etc + * @param struct fsnode * The node generated by makefs + * @param struct cd9660node * The intermediate node to be written to + * @returns int 0 on failure, 1 on success + */ +static int +cd9660_translate_node(fsnode *node, cd9660node *newnode) +{ + if (node == NULL) { + if (diskStructure.verbose_level > 0) + printf("cd9660_translate_node: NULL node passed, " + "returning\n"); + return 0; + } + if ((newnode->isoDirRecord = + malloc(sizeof(iso_directory_record_cd9660))) == NULL) { + CD9660_MEM_ALLOC_ERROR("cd9660_translate_node"); + return 0; + } + + /* Set the node pointer */ + newnode->node = node; + + /* Set the size */ + if (!(S_ISDIR(node->type))) + newnode->fileDataLength = node->inode->st.st_size; + + if (cd9960_translate_node_common(newnode) == 0) + return 0; + + /* Finally, overwrite some of the values that are set by default */ + cd9660_time_915(newnode->isoDirRecord->date, node->inode->st.st_mtime); + + return 1; +} + +/* + * Compares two ISO filenames + * @param const char * The first file name + * @param const char * The second file name + * @returns : -1 if first is less than second, 0 if they are the same, 1 if + * the second is greater than the first + */ +static int +cd9660_compare_filename(const char *first, const char *second) +{ + /* + * This can be made more optimal once it has been tested + * (the extra character, for example, is for testing) + */ + + int p1 = 0; + int p2 = 0; + char c1, c2; + /* First, on the filename */ + + while (p1 < ISO_FILENAME_MAXLENGTH_BEFORE_VERSION-1 + && p2 < ISO_FILENAME_MAXLENGTH_BEFORE_VERSION-1) { + c1 = first[p1]; + c2 = second[p2]; + if (c1 == '.' && c2 =='.') + break; + else if (c1 == '.') { + p2++; + c1 = ' '; + } else if (c2 == '.') { + p1++; + c2 = ' '; + } else { + p1++; + p2++; + } + + if (c1 < c2) + return -1; + else if (c1 > c2) { + return 1; + } + } + + if (first[p1] == '.' && second[p2] == '.') { + p1++; + p2++; + while (p1 < ISO_FILENAME_MAXLENGTH_BEFORE_VERSION - 1 + && p2 < ISO_FILENAME_MAXLENGTH_BEFORE_VERSION - 1) { + c1 = first[p1]; + c2 = second[p2]; + if (c1 == ';' && c2 == ';') + break; + else if (c1 == ';') { + p2++; + c1 = ' '; + } else if (c2 == ';') { + p1++; + c2 = ' '; + } else { + p1++; + p2++; + } + + if (c1 < c2) + return -1; + else if (c1 > c2) + return 1; + } + } + return 0; +} + +/* + * Insert a node into list with ISO sorting rules + * @param cd9660node * The head node of the list + * @param cd9660node * The node to be inserted + */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 16:24:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C03D106564A; Sun, 7 Nov 2010 16:24:52 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (unknown [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id F3B9C8FC12; Sun, 7 Nov 2010 16:24:51 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id 051D02A28CEB; Sun, 7 Nov 2010 17:24:51 +0100 (CET) Date: Sun, 7 Nov 2010 17:24:51 +0100 From: Ed Schouten To: Olivier Houchard Message-ID: <20101107162451.GD2054@hoeg.nl> References: <201011071605.oA7G55Yh057429@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="A1Iwnsx6rNfRhs6P" Content-Disposition: inline In-Reply-To: <201011071605.oA7G55Yh057429@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214921 - in head/usr.sbin/makefs: . cd9660 compat ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 16:24:52 -0000 --A1Iwnsx6rNfRhs6P Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Olivier Houchard , 20101107 17:05: > Sync with the latest version from NetBSD. It notably addds ISO9660 suppor= t. Thank you! --=20 Ed Schouten WWW: http://80386.nl/ --A1Iwnsx6rNfRhs6P Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkzW0tMACgkQ52SDGA2eCwWWdwCfRrRCG0pQZIJQvLjrKugoncxz u5EAn2WqIKPULZd1R4AvIfLwZvB75np3 =gXyU -----END PGP SIGNATURE----- --A1Iwnsx6rNfRhs6P-- From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 16:56:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98CB5106564A; Sun, 7 Nov 2010 16:56:29 +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 832B38FC15; Sun, 7 Nov 2010 16:56:29 +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 oA7GuTOw062065; Sun, 7 Nov 2010 16:56:29 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7GuTdt062047; Sun, 7 Nov 2010 16:56:29 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071656.oA7GuTdt062047@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 16:56:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214922 - in stable/8/sys: arm/at91 dev/bce dev/ed dev/et dev/lge dev/nfe dev/nge dev/nve dev/sf dev/sge dev/sis dev/smc dev/tl dev/tx dev/usb/net dev/wb mips/idt X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 16:56:29 -0000 Author: marius Date: Sun Nov 7 16:56:29 2010 New Revision: 214922 URL: http://svn.freebsd.org/changeset/base/214922 Log: MFC: r213894, r213896, r214913 Converted the remainder of the NIC drivers to use the mii_attach() introduced in r213878 (MFC'ed to stable/8 in r214685) instead of mii_phy_probe(). Unlike r213893 (MFC'ed to stable/8 in r214909) these are only straight forward conversions though. Reviewed by: yongari Modified: stable/8/sys/arm/at91/if_ate.c stable/8/sys/dev/bce/if_bce.c stable/8/sys/dev/ed/if_ed_pccard.c stable/8/sys/dev/et/if_et.c stable/8/sys/dev/lge/if_lge.c stable/8/sys/dev/nfe/if_nfe.c stable/8/sys/dev/nge/if_nge.c stable/8/sys/dev/nve/if_nve.c stable/8/sys/dev/sf/if_sf.c stable/8/sys/dev/sge/if_sge.c stable/8/sys/dev/sis/if_sis.c stable/8/sys/dev/smc/if_smc.c stable/8/sys/dev/tl/if_tl.c stable/8/sys/dev/tx/if_tx.c stable/8/sys/dev/usb/net/usb_ethernet.c stable/8/sys/dev/wb/if_wb.c stable/8/sys/mips/idt/if_kr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/arm/at91/if_ate.c ============================================================================== --- stable/8/sys/arm/at91/if_ate.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/arm/at91/if_ate.c Sun Nov 7 16:56:29 2010 (r214922) @@ -258,9 +258,10 @@ ate_attach(device_t dev) } sc->ifp = ifp = if_alloc(IFT_ETHER); - if (mii_phy_probe(dev, &sc->miibus, ate_ifmedia_upd, ate_ifmedia_sts)) { - device_printf(dev, "Cannot find my PHY.\n"); - err = ENXIO; + err = mii_attach(dev, &sc->miibus, ifp, ate_ifmedia_upd, + ate_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (err != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto out; } Modified: stable/8/sys/dev/bce/if_bce.c ============================================================================== --- stable/8/sys/dev/bce/if_bce.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/dev/bce/if_bce.c Sun Nov 7 16:56:29 2010 (r214922) @@ -1134,12 +1134,13 @@ bce_attach(device_t dev) /* Handle any special PHY initialization for SerDes PHYs. */ bce_init_media(sc); - /* MII child bus by probing the PHY. */ - if (mii_phy_probe(dev, &sc->bce_miibus, bce_ifmedia_upd, - bce_ifmedia_sts)) { - BCE_PRINTF("%s(%d): No PHY found on child MII bus!\n", - __FILE__, __LINE__); - rc = ENXIO; + /* MII child bus by attaching the PHY. */ + rc = mii_attach(dev, &sc->bce_miibus, ifp, bce_ifmedia_upd, + bce_ifmedia_sts, BMSR_DEFCAPMASK, sc->bce_phy_addr, + MII_OFFSET_ANY, 0); + if (rc != 0) { + BCE_PRINTF("%s(%d): attaching PHYs failed\n", __FILE__, + __LINE__); goto bce_attach_fail; } Modified: stable/8/sys/dev/ed/if_ed_pccard.c ============================================================================== --- stable/8/sys/dev/ed/if_ed_pccard.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/dev/ed/if_ed_pccard.c Sun Nov 7 16:56:29 2010 (r214922) @@ -578,25 +578,21 @@ ed_pccard_attach(device_t dev) goto bad; if (sc->chip_type == ED_CHIP_TYPE_DL10019 || sc->chip_type == ED_CHIP_TYPE_DL10022) { - /* Probe for an MII bus, but ignore errors. */ + /* Try to attach an MII bus, but ignore errors. */ ed_pccard_dl100xx_mii_reset(sc); - (void)mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd, - ed_ifmedia_sts); + (void)mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd, + ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, 0); } else if (sc->chip_type == ED_CHIP_TYPE_AX88190 || - sc->chip_type == ED_CHIP_TYPE_AX88790) { - if ((error = mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd, - ed_ifmedia_sts)) != 0) { - device_printf(dev, "Missing mii %d!\n", error); + sc->chip_type == ED_CHIP_TYPE_AX88790 || + sc->chip_type == ED_CHIP_TYPE_TC5299J) { + error = mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd, + ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto bad; } - - } else if (sc->chip_type == ED_CHIP_TYPE_TC5299J) { - if ((error = mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd, - ed_ifmedia_sts)) != 0) { - device_printf(dev, "Missing mii!\n"); - goto bad; - } - } if (sc->miibus != NULL) { sc->sc_tick = ed_pccard_tick; Modified: stable/8/sys/dev/et/if_et.c ============================================================================== --- stable/8/sys/dev/et/if_et.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/dev/et/if_et.c Sun Nov 7 16:56:29 2010 (r214922) @@ -63,8 +63,8 @@ __FBSDID("$FreeBSD$"); #include +#include #include -#include #include #include @@ -343,10 +343,10 @@ et_attach(device_t dev) et_chip_attach(sc); - error = mii_phy_probe(dev, &sc->sc_miibus, - et_ifmedia_upd, et_ifmedia_sts); + error = mii_attach(dev, &sc->sc_miibus, ifp, et_ifmedia_upd, + et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); if (error) { - device_printf(dev, "can't probe any PHY\n"); + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/8/sys/dev/lge/if_lge.c ============================================================================== --- stable/8/sys/dev/lge/if_lge.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/dev/lge/if_lge.c Sun Nov 7 16:56:29 2010 (r214922) @@ -558,10 +558,10 @@ lge_attach(dev) /* * Do MII setup. */ - if (mii_phy_probe(dev, &sc->lge_miibus, - lge_ifmedia_upd, lge_ifmedia_sts)) { - device_printf(dev, "MII without any PHY!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->lge_miibus, ifp, lge_ifmedia_upd, + lge_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/8/sys/dev/nfe/if_nfe.c ============================================================================== --- stable/8/sys/dev/nfe/if_nfe.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/dev/nfe/if_nfe.c Sun Nov 7 16:56:29 2010 (r214922) @@ -600,10 +600,10 @@ nfe_attach(device_t dev) #endif /* Do MII setup */ - if (mii_phy_probe(dev, &sc->nfe_miibus, nfe_ifmedia_upd, - nfe_ifmedia_sts)) { - device_printf(dev, "MII without any phy!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->nfe_miibus, ifp, nfe_ifmedia_upd, + nfe_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } ether_ifattach(ifp, sc->eaddr); Modified: stable/8/sys/dev/nge/if_nge.c ============================================================================== --- stable/8/sys/dev/nge/if_nge.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/dev/nge/if_nge.c Sun Nov 7 16:56:29 2010 (r214922) @@ -1079,10 +1079,10 @@ nge_attach(device_t dev) /* * Do MII setup. */ - error = mii_phy_probe(dev, &sc->nge_miibus, nge_mediachange, - nge_mediastatus); + error = mii_attach(dev, &sc->nge_miibus, ifp, nge_mediachange, + nge_mediastatus, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); if (error != 0) { - device_printf(dev, "no PHY found!\n"); + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/8/sys/dev/nve/if_nve.c ============================================================================== --- stable/8/sys/dev/nve/if_nve.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/dev/nve/if_nve.c Sun Nov 7 16:56:29 2010 (r214922) @@ -543,11 +543,12 @@ nve_attach(device_t dev) ifp->if_capabilities |= IFCAP_VLAN_MTU; ifp->if_capenable |= IFCAP_VLAN_MTU; - /* Probe device for MII interface to PHY */ - DEBUGOUT(NVE_DEBUG_INIT, "nve: do mii_phy_probe\n"); - if (mii_phy_probe(dev, &sc->miibus, nve_ifmedia_upd, nve_ifmedia_sts)) { - device_printf(dev, "MII without any phy!\n"); - error = ENXIO; + /* Attach device for MII interface to PHY */ + DEBUGOUT(NVE_DEBUG_INIT, "nve: do mii_attach\n"); + error = mii_attach(dev, &sc->miibus, ifp, nve_ifmedia_upd, + nve_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } @@ -555,10 +556,10 @@ nve_attach(device_t dev) ether_ifattach(ifp, eaddr); /* Activate our interrupt handler. - attach last to avoid lock */ - error = bus_setup_intr(sc->dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, + error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, NULL, nve_intr, sc, &sc->sc_ih); if (error) { - device_printf(sc->dev, "couldn't set up interrupt handler\n"); + device_printf(dev, "couldn't set up interrupt handler\n"); goto fail; } DEBUGOUT(NVE_DEBUG_INIT, "nve: nve_attach - exit\n"); Modified: stable/8/sys/dev/sf/if_sf.c ============================================================================== --- stable/8/sys/dev/sf/if_sf.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/dev/sf/if_sf.c Sun Nov 7 16:56:29 2010 (r214922) @@ -866,10 +866,10 @@ sf_attach(device_t dev) } /* Do MII setup. */ - if (mii_phy_probe(dev, &sc->sf_miibus, sf_ifmedia_upd, - sf_ifmedia_sts)) { - device_printf(dev, "MII without any phy!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->sf_miibus, ifp, sf_ifmedia_upd, + sf_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/8/sys/dev/sge/if_sge.c ============================================================================== --- stable/8/sys/dev/sge/if_sge.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/dev/sge/if_sge.c Sun Nov 7 16:56:29 2010 (r214922) @@ -627,10 +627,10 @@ sge_attach(device_t dev) /* * Do MII setup. */ - if (mii_phy_probe(dev, &sc->sge_miibus, sge_ifmedia_upd, - sge_ifmedia_sts)) { - device_printf(dev, "no PHY found!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->sge_miibus, ifp, sge_ifmedia_upd, + sge_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/8/sys/dev/sis/if_sis.c ============================================================================== --- stable/8/sys/dev/sis/if_sis.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/dev/sis/if_sis.c Sun Nov 7 16:56:29 2010 (r214922) @@ -1164,10 +1164,10 @@ sis_attach(device_t dev) /* * Do MII setup. */ - if (mii_phy_probe(dev, &sc->sis_miibus, - sis_ifmedia_upd, sis_ifmedia_sts)) { - device_printf(dev, "MII without any PHY!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->sis_miibus, ifp, sis_ifmedia_upd, + sis_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/8/sys/dev/smc/if_smc.c ============================================================================== --- stable/8/sys/dev/smc/if_smc.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/dev/smc/if_smc.c Sun Nov 7 16:56:29 2010 (r214922) @@ -324,8 +324,9 @@ smc_attach(device_t dev) callout_init_mtx(&sc->smc_mii_tick_ch, &sc->smc_mtx, CALLOUT_RETURNUNLOCKED); if (sc->smc_chip >= REV_CHIP_91110FD) { - mii_phy_probe(dev, &sc->smc_miibus, smc_mii_ifmedia_upd, - smc_mii_ifmedia_sts); + (void)mii_attach(dev, &sc->smc_miibus, ifp, + smc_mii_ifmedia_upd, smc_mii_ifmedia_sts, BMSR_DEFCAPMASK, + MII_PHY_ANY, MII_OFFSET_ANY, 0); if (sc->smc_miibus != NULL) { sc->smc_mii_tick = smc_mii_tick; sc->smc_mii_mediachg = smc_mii_mediachg; Modified: stable/8/sys/dev/tl/if_tl.c ============================================================================== --- stable/8/sys/dev/tl/if_tl.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/dev/tl/if_tl.c Sun Nov 7 16:56:29 2010 (r214922) @@ -1280,9 +1280,11 @@ tl_attach(dev) * Do MII setup. If no PHYs are found, then this is a * bitrate ThunderLAN chip that only supports 10baseT * and AUI/BNC. + * XXX mii_attach() can fail for reason different than + * no PHYs found! */ - if (mii_phy_probe(dev, &sc->tl_miibus, - tl_ifmedia_upd, tl_ifmedia_sts)) { + if (mii_attach(dev, &sc->tl_miibus, ifp, tl_ifmedia_upd, + tl_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0)) { struct ifmedia *ifm; sc->tl_bitrate = 1; ifmedia_init(&sc->ifmedia, 0, tl_ifmedia_upd, tl_ifmedia_sts); Modified: stable/8/sys/dev/tx/if_tx.c ============================================================================== --- stable/8/sys/dev/tx/if_tx.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/dev/tx/if_tx.c Sun Nov 7 16:56:29 2010 (r214922) @@ -379,10 +379,10 @@ epic_attach(device_t dev) device_printf(dev, "unknown card vendor %04xh\n", sc->cardvend); /* Do ifmedia setup. */ - if (mii_phy_probe(dev, &sc->miibus, - epic_ifmedia_upd, epic_ifmedia_sts)) { - device_printf(dev, "ERROR! MII without any PHY!?\n"); - error = ENXIO; + error = mii_attach(dev, &sc->miibus, ifp, epic_ifmedia_upd, + epic_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/8/sys/dev/usb/net/usb_ethernet.c ============================================================================== --- stable/8/sys/dev/usb/net/usb_ethernet.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/dev/usb/net/usb_ethernet.c Sun Nov 7 16:56:29 2010 (r214922) @@ -222,11 +222,12 @@ ue_attach_post_task(struct usb_proc_msg if (ue->ue_methods->ue_mii_upd != NULL && ue->ue_methods->ue_mii_sts != NULL) { mtx_lock(&Giant); /* device_xxx() depends on this */ - error = mii_phy_probe(ue->ue_dev, &ue->ue_miibus, - ue_ifmedia_upd, ue->ue_methods->ue_mii_sts); + error = mii_attach(ue->ue_dev, &ue->ue_miibus, ifp, + ue_ifmedia_upd, ue->ue_methods->ue_mii_sts, + BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); mtx_unlock(&Giant); if (error) { - device_printf(ue->ue_dev, "MII without any PHY\n"); + device_printf(ue->ue_dev, "attaching PHYs failed\n"); goto error; } } Modified: stable/8/sys/dev/wb/if_wb.c ============================================================================== --- stable/8/sys/dev/wb/if_wb.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/dev/wb/if_wb.c Sun Nov 7 16:56:29 2010 (r214922) @@ -859,9 +859,10 @@ wb_attach(dev) /* * Do MII setup. */ - if (mii_phy_probe(dev, &sc->wb_miibus, - wb_ifmedia_upd, wb_ifmedia_sts)) { - error = ENXIO; + error = mii_attach(dev, &sc->wb_miibus, ifp, wb_ifmedia_upd, + wb_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/8/sys/mips/idt/if_kr.c ============================================================================== --- stable/8/sys/mips/idt/if_kr.c Sun Nov 7 16:05:04 2010 (r214921) +++ stable/8/sys/mips/idt/if_kr.c Sun Nov 7 16:56:29 2010 (r214922) @@ -265,10 +265,10 @@ kr_attach(device_t dev) CSR_WRITE_4(sc, KR_MIIMCFG, 0); /* Do MII setup. */ - if (mii_phy_probe(dev, &sc->kr_miibus, - kr_ifmedia_upd, kr_ifmedia_sts)) { - device_printf(dev, "MII without any phy!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->kr_miibus, ifp, kr_ifmedia_upd, + kr_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 17:33:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0384D106566B; Sun, 7 Nov 2010 17:33:05 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E631F8FC0A; Sun, 7 Nov 2010 17:33:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7HX49S064985; Sun, 7 Nov 2010 17:33:04 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7HX4FM064983; Sun, 7 Nov 2010 17:33:04 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201011071733.oA7HX4FM064983@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 7 Nov 2010 17:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214923 - head/tools/regression/acltools X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:33:05 -0000 Author: trasz Date: Sun Nov 7 17:33:04 2010 New Revision: 214923 URL: http://svn.freebsd.org/changeset/base/214923 Log: Remove useless comment. Modified: head/tools/regression/acltools/tools-nfs4.test Modified: head/tools/regression/acltools/tools-nfs4.test ============================================================================== --- head/tools/regression/acltools/tools-nfs4.test Sun Nov 7 16:56:29 2010 (r214922) +++ head/tools/regression/acltools/tools-nfs4.test Sun Nov 7 17:33:04 2010 (r214923) @@ -527,7 +527,6 @@ $ setfacl -a0 owner@:r:allow,group@:w:de $ ls -ld ddd | cut -d' ' -f1 > dr----x---+ -# XXX: This one is fishy. Shouldn't it be "dr---wx---+"? $ rmdir ddd $ mkdir ddd $ chmod 0 ddd From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 17:35:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B88FA106564A; Sun, 7 Nov 2010 17:35:42 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C2398FC18; Sun, 7 Nov 2010 17:35:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7HZgf2065264; Sun, 7 Nov 2010 17:35:42 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7HZgfi065262; Sun, 7 Nov 2010 17:35:42 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071735.oA7HZgfi065262@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 17:35:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214924 - stable/8/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:35:42 -0000 Author: marius Date: Sun Nov 7 17:35:42 2010 New Revision: 214924 URL: http://svn.freebsd.org/changeset/base/214924 Log: MFC: r214262 - Take advantage of mii_phy_dev_probe(). - Use mii_phy_add_media() instead of mii_add_media(). I'm not sure how this driver actually managed to work before as mii_add_media() is intended to be used to gether with mii_anar() while mii_phy_add_media() is intended to be used with mii_phy_setmedia(), however this driver mii_add_media() along with mii_phy_setmedia(). Modified: stable/8/sys/dev/mii/smcphy.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/mii/smcphy.c ============================================================================== --- stable/8/sys/dev/mii/smcphy.c Sun Nov 7 17:33:04 2010 (r214923) +++ stable/8/sys/dev/mii/smcphy.c Sun Nov 7 17:35:42 2010 (r214924) @@ -76,20 +76,16 @@ static driver_t smcphy_driver = { DRIVER_MODULE(smcphy, miibus, smcphy_driver, smcphy_devclass, 0, 0); +static const struct mii_phydesc smcphys[] = { + MII_PHY_DESC(SMSC, LAN83C183), + MII_PHY_END +}; + static int smcphy_probe(device_t dev) { - struct mii_attach_args *ma; - - ma = device_get_ivars(dev); - if (MII_OUI(ma->mii_id1, ma->mii_id2) != MII_OUI_SMSC || - MII_MODEL(ma->mii_id2) != MII_MODEL_SMSC_LAN83C183) - return (ENXIO); - - device_set_desc(dev, MII_STR_SMSC_LAN83C183); - - return (0); + return (mii_phy_dev_probe(dev, smcphys, BUS_PROBE_DEFAULT)); } static int @@ -111,7 +107,7 @@ smcphy_attach(device_t dev) sc->mii_service = smcphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; if (smcphy_reset(sc) != 0) { device_printf(dev, "reset failed\n"); @@ -122,7 +118,7 @@ smcphy_attach(device_t dev) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - mii_add_media(sc); + mii_phy_add_media(sc); printf("\n"); MIIBUS_MEDIAINIT(sc->mii_dev); From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 17:38:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7C901065670; Sun, 7 Nov 2010 17:38:54 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A272E8FC17; Sun, 7 Nov 2010 17:38:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7Hcsfr065600; Sun, 7 Nov 2010 17:38:54 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Hcsw3065580; Sun, 7 Nov 2010 17:38:54 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071738.oA7Hcsw3065580@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 17:38:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214925 - in stable/7/sys: arm/at91 dev/bce dev/ed dev/et dev/lge dev/nfe dev/nge dev/nve dev/sf dev/sge dev/sis dev/tx dev/usb pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:38:54 -0000 Author: marius Date: Sun Nov 7 17:38:54 2010 New Revision: 214925 URL: http://svn.freebsd.org/changeset/base/214925 Log: MFC: r213894, r213896, r214913 Converted the remainder of the NIC drivers to use the mii_attach() introduced in r213878 (MFC'ed to stable/7 in r214685) instead of mii_phy_probe(). Unlike r213893 (MFC'ed to stable/7 in r214910) these are mostly straight forward conversions though. Modified: stable/7/sys/arm/at91/if_ate.c stable/7/sys/dev/bce/if_bce.c stable/7/sys/dev/ed/if_ed_pccard.c stable/7/sys/dev/et/if_et.c stable/7/sys/dev/lge/if_lge.c stable/7/sys/dev/nfe/if_nfe.c stable/7/sys/dev/nge/if_nge.c stable/7/sys/dev/nve/if_nve.c stable/7/sys/dev/sf/if_sf.c stable/7/sys/dev/sge/if_sge.c stable/7/sys/dev/sis/if_sis.c stable/7/sys/dev/tx/if_tx.c stable/7/sys/dev/usb/if_aue.c stable/7/sys/dev/usb/if_axe.c stable/7/sys/dev/usb/if_rue.c stable/7/sys/dev/usb/if_udav.c stable/7/sys/pci/if_tl.c stable/7/sys/pci/if_wb.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/arm/at91/if_ate.c ============================================================================== --- stable/7/sys/arm/at91/if_ate.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/arm/at91/if_ate.c Sun Nov 7 17:38:54 2010 (r214925) @@ -215,9 +215,10 @@ ate_attach(device_t dev) ate_set_mac(sc, eaddr); sc->ifp = ifp = if_alloc(IFT_ETHER); - if (mii_phy_probe(dev, &sc->miibus, ate_ifmedia_upd, ate_ifmedia_sts)) { - device_printf(dev, "Cannot find my PHY.\n"); - err = ENXIO; + err = mii_attach(dev, &sc->miibus, ifp, ate_ifmedia_upd, + ate_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (err != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto out; } Modified: stable/7/sys/dev/bce/if_bce.c ============================================================================== --- stable/7/sys/dev/bce/if_bce.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/bce/if_bce.c Sun Nov 7 17:38:54 2010 (r214925) @@ -1134,12 +1134,13 @@ bce_attach(device_t dev) /* Handle any special PHY initialization for SerDes PHYs. */ bce_init_media(sc); - /* MII child bus by probing the PHY. */ - if (mii_phy_probe(dev, &sc->bce_miibus, bce_ifmedia_upd, - bce_ifmedia_sts)) { - BCE_PRINTF("%s(%d): No PHY found on child MII bus!\n", - __FILE__, __LINE__); - rc = ENXIO; + /* MII child bus by attaching the PHY. */ + rc = mii_attach(dev, &sc->bce_miibus, ifp, bce_ifmedia_upd, + bce_ifmedia_sts, BMSR_DEFCAPMASK, sc->bce_phy_addr, + MII_OFFSET_ANY, 0); + if (rc != 0) { + BCE_PRINTF("%s(%d): attaching PHYs failed\n", __FILE__, + __LINE__); goto bce_attach_fail; } Modified: stable/7/sys/dev/ed/if_ed_pccard.c ============================================================================== --- stable/7/sys/dev/ed/if_ed_pccard.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/ed/if_ed_pccard.c Sun Nov 7 17:38:54 2010 (r214925) @@ -540,23 +540,27 @@ ed_pccard_attach(device_t dev) goto bad; if (sc->chip_type == ED_CHIP_TYPE_DL10019 || sc->chip_type == ED_CHIP_TYPE_DL10022) { - /* Probe for an MII bus, but ignore errors. */ + /* Try to attach an MII bus, but ignore errors. */ ed_pccard_dl100xx_mii_reset(sc); - (void)mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd, - ed_ifmedia_sts); + (void)mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd, + ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, 0); } else if (sc->chip_type == ED_CHIP_TYPE_AX88190) { ed_pccard_ax88x90_mii_reset(sc); - if ((error = mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd, - ed_ifmedia_sts)) != 0) { - device_printf(dev, "Missing mii!\n"); + error = mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd, + ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto bad; } - } else if (sc->chip_type == ED_CHIP_TYPE_TC5299J) { ed_pccard_tc5299j_mii_reset(sc); - if ((error = mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd, - ed_ifmedia_sts)) != 0) { - device_printf(dev, "Missing mii!\n"); + error = mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd, + ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto bad; } Modified: stable/7/sys/dev/et/if_et.c ============================================================================== --- stable/7/sys/dev/et/if_et.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/et/if_et.c Sun Nov 7 17:38:54 2010 (r214925) @@ -63,8 +63,8 @@ __FBSDID("$FreeBSD$"); #include +#include #include -#include #include #include @@ -343,10 +343,10 @@ et_attach(device_t dev) et_chip_attach(sc); - error = mii_phy_probe(dev, &sc->sc_miibus, - et_ifmedia_upd, et_ifmedia_sts); + error = mii_attach(dev, &sc->sc_miibus, ifp, et_ifmedia_upd, + et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); if (error) { - device_printf(dev, "can't probe any PHY\n"); + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/lge/if_lge.c ============================================================================== --- stable/7/sys/dev/lge/if_lge.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/lge/if_lge.c Sun Nov 7 17:38:54 2010 (r214925) @@ -558,10 +558,10 @@ lge_attach(dev) /* * Do MII setup. */ - if (mii_phy_probe(dev, &sc->lge_miibus, - lge_ifmedia_upd, lge_ifmedia_sts)) { - device_printf(dev, "MII without any PHY!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->lge_miibus, ifp, lge_ifmedia_upd, + lge_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/nfe/if_nfe.c ============================================================================== --- stable/7/sys/dev/nfe/if_nfe.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/nfe/if_nfe.c Sun Nov 7 17:38:54 2010 (r214925) @@ -601,10 +601,10 @@ nfe_attach(device_t dev) #endif /* Do MII setup */ - if (mii_phy_probe(dev, &sc->nfe_miibus, nfe_ifmedia_upd, - nfe_ifmedia_sts)) { - device_printf(dev, "MII without any phy!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->nfe_miibus, ifp, nfe_ifmedia_upd, + nfe_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } ether_ifattach(ifp, sc->eaddr); Modified: stable/7/sys/dev/nge/if_nge.c ============================================================================== --- stable/7/sys/dev/nge/if_nge.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/nge/if_nge.c Sun Nov 7 17:38:54 2010 (r214925) @@ -1079,10 +1079,10 @@ nge_attach(device_t dev) /* * Do MII setup. */ - error = mii_phy_probe(dev, &sc->nge_miibus, nge_mediachange, - nge_mediastatus); + error = mii_attach(dev, &sc->nge_miibus, ifp, nge_mediachange, + nge_mediastatus, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); if (error != 0) { - device_printf(dev, "no PHY found!\n"); + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/nve/if_nve.c ============================================================================== --- stable/7/sys/dev/nve/if_nve.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/nve/if_nve.c Sun Nov 7 17:38:54 2010 (r214925) @@ -544,11 +544,12 @@ nve_attach(device_t dev) ifp->if_capabilities |= IFCAP_VLAN_MTU; ifp->if_capenable |= IFCAP_VLAN_MTU; - /* Probe device for MII interface to PHY */ - DEBUGOUT(NVE_DEBUG_INIT, "nve: do mii_phy_probe\n"); - if (mii_phy_probe(dev, &sc->miibus, nve_ifmedia_upd, nve_ifmedia_sts)) { - device_printf(dev, "MII without any phy!\n"); - error = ENXIO; + /* Attach device for MII interface to PHY */ + DEBUGOUT(NVE_DEBUG_INIT, "nve: do mii_attach\n"); + error = mii_attach(dev, &sc->miibus, ifp, nve_ifmedia_upd, + nve_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } @@ -556,10 +557,10 @@ nve_attach(device_t dev) ether_ifattach(ifp, eaddr); /* Activate our interrupt handler. - attach last to avoid lock */ - error = bus_setup_intr(sc->dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, + error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, NULL, nve_intr, sc, &sc->sc_ih); if (error) { - device_printf(sc->dev, "couldn't set up interrupt handler\n"); + device_printf(dev, "couldn't set up interrupt handler\n"); goto fail; } DEBUGOUT(NVE_DEBUG_INIT, "nve: nve_attach - exit\n"); Modified: stable/7/sys/dev/sf/if_sf.c ============================================================================== --- stable/7/sys/dev/sf/if_sf.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/sf/if_sf.c Sun Nov 7 17:38:54 2010 (r214925) @@ -866,10 +866,10 @@ sf_attach(device_t dev) } /* Do MII setup. */ - if (mii_phy_probe(dev, &sc->sf_miibus, sf_ifmedia_upd, - sf_ifmedia_sts)) { - device_printf(dev, "MII without any phy!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->sf_miibus, ifp, sf_ifmedia_upd, + sf_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/sge/if_sge.c ============================================================================== --- stable/7/sys/dev/sge/if_sge.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/sge/if_sge.c Sun Nov 7 17:38:54 2010 (r214925) @@ -627,10 +627,10 @@ sge_attach(device_t dev) /* * Do MII setup. */ - if (mii_phy_probe(dev, &sc->sge_miibus, sge_ifmedia_upd, - sge_ifmedia_sts)) { - device_printf(dev, "no PHY found!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->sge_miibus, ifp, sge_ifmedia_upd, + sge_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/sis/if_sis.c ============================================================================== --- stable/7/sys/dev/sis/if_sis.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/sis/if_sis.c Sun Nov 7 17:38:54 2010 (r214925) @@ -1164,10 +1164,10 @@ sis_attach(device_t dev) /* * Do MII setup. */ - if (mii_phy_probe(dev, &sc->sis_miibus, - sis_ifmedia_upd, sis_ifmedia_sts)) { - device_printf(dev, "MII without any PHY!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->sis_miibus, ifp, sis_ifmedia_upd, + sis_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/tx/if_tx.c ============================================================================== --- stable/7/sys/dev/tx/if_tx.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/tx/if_tx.c Sun Nov 7 17:38:54 2010 (r214925) @@ -383,10 +383,10 @@ epic_attach(device_t dev) device_printf(dev, "unknown card vendor %04xh\n", sc->cardvend); /* Do ifmedia setup. */ - if (mii_phy_probe(dev, &sc->miibus, - epic_ifmedia_upd, epic_ifmedia_sts)) { - device_printf(dev, "ERROR! MII without any PHY!?\n"); - error = ENXIO; + error = mii_attach(dev, &sc->miibus, ifp, epic_ifmedia_upd, + epic_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/usb/if_aue.c ============================================================================== --- stable/7/sys/dev/usb/if_aue.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/usb/if_aue.c Sun Nov 7 17:38:54 2010 (r214925) @@ -649,7 +649,7 @@ aue_attach(device_t self) usbd_status err; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - int i; + int error, i; sc->aue_dev = self; sc->aue_udev = uaa->device; @@ -741,15 +741,16 @@ aue_attach(device_t self) * end up getting the children deleted twice, which will crash * the system. */ - if (mii_phy_probe(self, &sc->aue_miibus, - aue_ifmedia_upd, aue_ifmedia_sts)) { - device_printf(self, "MII without any PHY!\n"); + error = mii_attach(self, &sc->aue_miibus, ifp, aue_ifmedia_upd, + aue_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(self, "attaching PHYs failed\n"); if_free(ifp); AUE_SXUNLOCK(sc); mtx_destroy(&sc->aue_mtx); sx_destroy(&sc->aue_sx); usb_ether_task_destroy(&sc->aue_taskqueue); - return ENXIO; + return error; } sc->aue_qdat.ifp = ifp; Modified: stable/7/sys/dev/usb/if_axe.c ============================================================================== --- stable/7/sys/dev/usb/if_axe.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/usb/if_axe.c Sun Nov 7 17:38:54 2010 (r214925) @@ -544,7 +544,7 @@ axe_attach(device_t self) struct ifnet *ifp; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - int i; + int error, i; sc->axe_udev = uaa->device; sc->axe_dev = self; @@ -657,15 +657,16 @@ device_printf(sc->axe_dev, "%s, bufsz %d ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; IFQ_SET_READY(&ifp->if_snd); - if (mii_phy_probe(self, &sc->axe_miibus, - axe_ifmedia_upd, axe_ifmedia_sts)) { - device_printf(sc->axe_dev, "MII without any PHY!\n"); + error = mii_attach(self, &sc->axe_miibus, ifp, axe_ifmedia_upd, + axe_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(sc->axe_dev, "attaching PHYs failed\n"); if_free(ifp); AXE_UNLOCK(sc); AXE_SLEEPUNLOCK(sc); sx_destroy(&sc->axe_sleeplock); mtx_destroy(&sc->axe_mtx); - return ENXIO; + return error; } /* Modified: stable/7/sys/dev/usb/if_rue.c ============================================================================== --- stable/7/sys/dev/usb/if_rue.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/usb/if_rue.c Sun Nov 7 17:38:54 2010 (r214925) @@ -349,9 +349,6 @@ rue_miibus_readreg(device_t dev, int phy int rval; int ruereg; - if (phy != 0) /* RTL8150 supports PHY == 0, only */ - return (0); - switch (reg) { case MII_BMCR: ruereg = RUE_BMCR; @@ -392,9 +389,6 @@ rue_miibus_writereg(device_t dev, int ph struct rue_softc *sc = device_get_softc(dev); int ruereg; - if (phy != 0) /* RTL8150 supports PHY == 0, only */ - return (0); - switch (reg) { case MII_BMCR: ruereg = RUE_BMCR; @@ -584,13 +578,14 @@ rue_attach(device_t self) usbd_status err; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - int i; + int error, i; struct rue_type *t; sc->rue_dev = self; sc->rue_udev = uaa->device; if (usbd_set_config_no(sc->rue_udev, RUE_CONFIG_NO, 0)) { + error = ENXIO; device_printf(sc->rue_dev, "getting interface handle failed\n"); goto error; } @@ -599,6 +594,7 @@ rue_attach(device_t self) err = usbd_device2interface_handle(uaa->device, RUE_IFACE_IDX, &iface); if (err) { + error = ENXIO; device_printf(sc->rue_dev, "getting interface handle failed\n"); goto error; } @@ -621,6 +617,7 @@ rue_attach(device_t self) for (i = 0; i < id->bNumEndpoints; i++) { ed = usbd_interface2endpoint_descriptor(iface, i); if (ed == NULL) { + error = ENXIO; device_printf(sc->rue_dev, "couldn't get ep %d\n", i); goto error; } @@ -647,12 +644,14 @@ rue_attach(device_t self) err = rue_read_mem(sc, RUE_EEPROM_IDR0, (caddr_t)&eaddr, ETHER_ADDR_LEN); if (err) { + error = ENXIO; device_printf(sc->rue_dev, "couldn't get station address\n"); goto error1; } ifp = sc->rue_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { + error = ENXIO; device_printf(sc->rue_dev, "can not if_alloc()\n"); goto error1; } @@ -667,10 +666,14 @@ rue_attach(device_t self) ifp->if_init = rue_init; ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; - /* MII setup */ - if (mii_phy_probe(self, &sc->rue_miibus, - rue_ifmedia_upd, rue_ifmedia_sts)) { - device_printf(sc->rue_dev, "MII without any PHY!\n"); + /* + * MII setup + * RTL8150 supports PHY == 0 only + */ + error = mii_attach(self, &sc->rue_miibus, ifp, rue_ifmedia_upd, + rue_ifmedia_sts, BMSR_DEFCAPMASK, 0, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(sc->rue_dev, "attaching PHYs failed\n"); goto error2; } @@ -692,7 +695,7 @@ rue_attach(device_t self) RUE_UNLOCK(sc); mtx_destroy(&sc->rue_mtx); error: - return ENXIO; + return error; } static int Modified: stable/7/sys/dev/usb/if_udav.c ============================================================================== --- stable/7/sys/dev/usb/if_udav.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/usb/if_udav.c Sun Nov 7 17:38:54 2010 (r214925) @@ -298,6 +298,9 @@ udav_attach(device_t self) struct mii_data *mii; #endif u_char eaddr[ETHER_ADDR_LEN]; +#if defined(__FreeBSD__) + int error; +#endif int i; #if defined(__NetBSD__) int s; @@ -444,13 +447,16 @@ udav_attach(device_t self) if_attach(ifp); Ether_ifattach(ifp, eaddr); #elif defined(__FreeBSD__) - if (mii_phy_probe(self, &sc->sc_miibus, - udav_ifmedia_change, udav_ifmedia_status)) { - printf("%s: MII without any PHY!\n", device_get_nameunit(sc->sc_dev)); + /* one internal PHY only */ + error = mii_attach(self, &sc->sc_miibus, ifp, udav_ifmedia_change, + udav_ifmedia_status, BMSR_DEFCAPMASK, 0, MII_OFFSET_ANY, 0); + if (error != 0) { + printf("%s: attaching PHYs failed\\n", + device_get_nameunit(sc->sc_dev)); if_free(ifp); UDAV_UNLOCK(sc); mtx_destroy(&sc->sc_mtx); - return ENXIO; + return error; } sc->sc_qdat.ifp = ifp; @@ -1822,13 +1828,6 @@ udav_miibus_readreg(device_t dev, int ph return (0); } - /* XXX: one PHY only for the internal PHY */ - if (phy != 0) { - DPRINTFN(0xff, ("%s: %s: phy=%d is not supported\n", - device_get_nameunit(sc->sc_dev), __func__, phy)); - return (0); - } - udav_lock_mii(sc); /* select internal PHY and set PHY register address */ @@ -1878,13 +1877,6 @@ udav_miibus_writereg(device_t dev, int p return (0); /* XXX real error? */ } - /* XXX: one PHY only for the internal PHY */ - if (phy != 0) { - DPRINTFN(0xff, ("%s: %s: phy=%d is not supported\n", - device_get_nameunit(sc->sc_dev), __func__, phy)); - return (0); /* XXX real error? */ - } - udav_lock_mii(sc); /* select internal PHY and set PHY register address */ Modified: stable/7/sys/pci/if_tl.c ============================================================================== --- stable/7/sys/pci/if_tl.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/pci/if_tl.c Sun Nov 7 17:38:54 2010 (r214925) @@ -1280,9 +1280,11 @@ tl_attach(dev) * Do MII setup. If no PHYs are found, then this is a * bitrate ThunderLAN chip that only supports 10baseT * and AUI/BNC. + * XXX mii_attach() can fail for reason different than + * no PHYs found! */ - if (mii_phy_probe(dev, &sc->tl_miibus, - tl_ifmedia_upd, tl_ifmedia_sts)) { + if (mii_attach(dev, &sc->tl_miibus, ifp, tl_ifmedia_upd, + tl_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0)) { struct ifmedia *ifm; sc->tl_bitrate = 1; ifmedia_init(&sc->ifmedia, 0, tl_ifmedia_upd, tl_ifmedia_sts); Modified: stable/7/sys/pci/if_wb.c ============================================================================== --- stable/7/sys/pci/if_wb.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/pci/if_wb.c Sun Nov 7 17:38:54 2010 (r214925) @@ -859,9 +859,10 @@ wb_attach(dev) /* * Do MII setup. */ - if (mii_phy_probe(dev, &sc->wb_miibus, - wb_ifmedia_upd, wb_ifmedia_sts)) { - error = ENXIO; + error = mii_attach(dev, &sc->wb_miibus, ifp, wb_ifmedia_upd, + wb_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 17:40:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 230BD1065679; Sun, 7 Nov 2010 17:40:59 +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 EAF4C8FC0C; Sun, 7 Nov 2010 17:40:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7Hew5U065827; Sun, 7 Nov 2010 17:40:58 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Hewv6065825; Sun, 7 Nov 2010 17:40:58 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071740.oA7Hewv6065825@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 17:40:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214926 - stable/8/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:40:59 -0000 Author: marius Date: Sun Nov 7 17:40:58 2010 New Revision: 214926 URL: http://svn.freebsd.org/changeset/base/214926 Log: MFC: r214263 Take advantage of mii_phy_add_media()/mii_phy_setmedia(). Modified: stable/8/sys/dev/mii/pnaphy.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/mii/pnaphy.c ============================================================================== --- stable/8/sys/dev/mii/pnaphy.c Sun Nov 7 17:38:54 2010 (r214925) +++ stable/8/sys/dev/mii/pnaphy.c Sun Nov 7 17:40:58 2010 (r214926) @@ -102,7 +102,6 @@ pnaphy_attach(device_t dev) struct mii_softc *sc; struct mii_attach_args *ma; struct mii_data *mii; - const char *sep = ""; sc = device_get_softc(dev); ma = device_get_ivars(dev); @@ -116,29 +115,16 @@ pnaphy_attach(device_t dev) sc->mii_service = pnaphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE; - -#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) -#define PRINT(s) printf("%s%s", sep, s); sep = ", " + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_IS_HPNA; mii_phy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) - printf("no media present"); - else { - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_HPNA_1, 0, sc->mii_inst), 0); - PRINT("HomePNA"); - } - + mii_phy_add_media(sc); printf("\n"); -#undef ADD -#undef PRINT - MIIBUS_MEDIAINIT(sc->mii_dev); - return (0); } @@ -159,17 +145,11 @@ pnaphy_service(struct mii_softc *sc, str break; switch (IFM_SUBTYPE(ife->ifm_media)) { - case IFM_AUTO: - case IFM_10_T: - case IFM_100_TX: - case IFM_100_T4: - return (EINVAL); + case IFM_HPNA_1: + mii_phy_setmedia(sc); + break; default: - /* - * BMCR data is stored in the ifmedia entry. - */ - PHY_WRITE(sc, MII_ANAR, mii_anar(ife->ifm_media)); - PHY_WRITE(sc, MII_BMCR, ife->ifm_data); + return (EINVAL); } break; @@ -182,7 +162,7 @@ pnaphy_service(struct mii_softc *sc, str /* Update the media status. */ ukphy_status(sc); if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T) - mii->mii_media_active = IFM_ETHER|IFM_HPNA_1; + mii->mii_media_active = IFM_ETHER | IFM_HPNA_1; /* Callback if something changed. */ mii_phy_update(sc, cmd); From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 17:41:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29139106566B; Sun, 7 Nov 2010 17:41:10 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F0D8D8FC08; Sun, 7 Nov 2010 17:41: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 oA7Hf9Fc065874; Sun, 7 Nov 2010 17:41:09 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Hf93E065872; Sun, 7 Nov 2010 17:41:09 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071741.oA7Hf93E065872@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 17:41: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: r214927 - stable/7/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:41:10 -0000 Author: marius Date: Sun Nov 7 17:41:09 2010 New Revision: 214927 URL: http://svn.freebsd.org/changeset/base/214927 Log: MFC: r214263 Take advantage of mii_phy_add_media()/mii_phy_setmedia(). Modified: stable/7/sys/dev/mii/pnaphy.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/mii/pnaphy.c ============================================================================== --- stable/7/sys/dev/mii/pnaphy.c Sun Nov 7 17:40:58 2010 (r214926) +++ stable/7/sys/dev/mii/pnaphy.c Sun Nov 7 17:41:09 2010 (r214927) @@ -102,7 +102,6 @@ pnaphy_attach(device_t dev) struct mii_softc *sc; struct mii_attach_args *ma; struct mii_data *mii; - const char *sep = ""; sc = device_get_softc(dev); ma = device_get_ivars(dev); @@ -116,29 +115,16 @@ pnaphy_attach(device_t dev) sc->mii_service = pnaphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE; - -#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) -#define PRINT(s) printf("%s%s", sep, s); sep = ", " + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_IS_HPNA; mii_phy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) - printf("no media present"); - else { - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_HPNA_1, 0, sc->mii_inst), 0); - PRINT("HomePNA"); - } - + mii_phy_add_media(sc); printf("\n"); -#undef ADD -#undef PRINT - MIIBUS_MEDIAINIT(sc->mii_dev); - return (0); } @@ -159,17 +145,11 @@ pnaphy_service(struct mii_softc *sc, str break; switch (IFM_SUBTYPE(ife->ifm_media)) { - case IFM_AUTO: - case IFM_10_T: - case IFM_100_TX: - case IFM_100_T4: - return (EINVAL); + case IFM_HPNA_1: + mii_phy_setmedia(sc); + break; default: - /* - * BMCR data is stored in the ifmedia entry. - */ - PHY_WRITE(sc, MII_ANAR, mii_anar(ife->ifm_media)); - PHY_WRITE(sc, MII_BMCR, ife->ifm_data); + return (EINVAL); } break; @@ -182,7 +162,7 @@ pnaphy_service(struct mii_softc *sc, str /* Update the media status. */ ukphy_status(sc); if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T) - mii->mii_media_active = IFM_ETHER|IFM_HPNA_1; + mii->mii_media_active = IFM_ETHER | IFM_HPNA_1; /* Callback if something changed. */ mii_phy_update(sc, cmd); From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 17:44:04 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B687910656AA; Sun, 7 Nov 2010 17:44:04 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A514B8FC12; Sun, 7 Nov 2010 17:44:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7Hi4I9066179; Sun, 7 Nov 2010 17:44:04 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Hi4bT066177; Sun, 7 Nov 2010 17:44:04 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201011071744.oA7Hi4bT066177@svn.freebsd.org> From: Michael Tuexen Date: Sun, 7 Nov 2010 17:44:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214928 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:44:04 -0000 Author: tuexen Date: Sun Nov 7 17:44:04 2010 New Revision: 214928 URL: http://svn.freebsd.org/changeset/base/214928 Log: * Use exponential backoff for retransmission of SHUTDOWN and SHUTDOWN-ACK chunks. * While there, do some cleanups. MFC after: 3 days. Modified: head/sys/netinet/sctp_timer.c Modified: head/sys/netinet/sctp_timer.c ============================================================================== --- head/sys/netinet/sctp_timer.c Sun Nov 7 17:41:09 2010 (r214927) +++ head/sys/netinet/sctp_timer.c Sun Nov 7 17:44:04 2010 (r214928) @@ -291,6 +291,10 @@ sctp_threshold_management(struct sctp_in return (0); } +/* + * sctp_find_alternate_net() returns a non-NULL pointer as long + * the argument net is non-NULL. + */ struct sctp_nets * sctp_find_alternate_net(struct sctp_tcb *stcb, struct sctp_nets *net, @@ -440,8 +444,7 @@ sctp_find_alternate_net(struct sctp_tcb else if (mode == 1) { TAILQ_FOREACH(mnet, &stcb->asoc.nets, sctp_next) { if (((mnet->dest_state & SCTP_ADDR_REACHABLE) != SCTP_ADDR_REACHABLE) || - (mnet->dest_state & SCTP_ADDR_UNCONFIRMED) - ) { + (mnet->dest_state & SCTP_ADDR_UNCONFIRMED)) { /* * will skip ones that are not-reachable or * unconfirmed @@ -505,12 +508,10 @@ sctp_find_alternate_net(struct sctp_tcb } alt->src_addr_selected = 0; } - if ( - ((alt->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE) && - (alt->ro.ro_rt != NULL) && /* sa_ignore NO_NULL_CHK */ - (!(alt->dest_state & SCTP_ADDR_UNCONFIRMED)) - ) { + if (((alt->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE) && + (alt->ro.ro_rt != NULL) && + (!(alt->dest_state & SCTP_ADDR_UNCONFIRMED))) { /* Found a reachable address */ break; } @@ -549,8 +550,6 @@ sctp_find_alternate_net(struct sctp_tcb return (alt); } - - static void sctp_backoff_on_timeout(struct sctp_tcb *stcb, struct sctp_nets *net, @@ -1021,8 +1020,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, * used, then pick dest with largest ssthresh for any * retransmission. */ - alt = net; - alt = sctp_find_alternate_net(stcb, alt, 1); + alt = sctp_find_alternate_net(stcb, net, 1); /* * CUCv2: If a different dest is picked for the * retransmission, then new (rtx-)pseudo_cumack needs to be @@ -1213,7 +1211,7 @@ sctp_t1init_timer(struct sctp_inpcb *inp struct sctp_nets *alt; alt = sctp_find_alternate_net(stcb, stcb->asoc.primary_destination, 0); - if ((alt != NULL) && (alt != stcb->asoc.primary_destination)) { + if (alt != stcb->asoc.primary_destination) { sctp_move_chunks_from_net(stcb, stcb->asoc.primary_destination); stcb->asoc.primary_destination = alt; } @@ -1480,6 +1478,7 @@ sctp_delete_prim_timer(struct sctp_inpcb * For the shutdown and shutdown-ack, we do not keep one around on the * control queue. This means we must generate a new one and call the general * chunk output routine, AFTER having done threshold management. + * It is assumed that net is non-NULL. */ int sctp_shutdown_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, @@ -1492,18 +1491,13 @@ sctp_shutdown_timer(struct sctp_inpcb *i /* Assoc is over */ return (1); } + sctp_backoff_on_timeout(stcb, net, 1, 0, 0); /* second select an alternative */ alt = sctp_find_alternate_net(stcb, net, 0); /* third generate a shutdown into the queue for out net */ - if (alt) { - sctp_send_shutdown(stcb, alt); - } else { - /* - * if alt is NULL, there is no dest to send to?? - */ - return (0); - } + sctp_send_shutdown(stcb, alt); + /* fourth restart timer */ sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, inp, stcb, alt); return (0); @@ -1520,6 +1514,7 @@ sctp_shutdownack_timer(struct sctp_inpcb /* Assoc is over */ return (1); } + sctp_backoff_on_timeout(stcb, net, 1, 0, 0); /* second select an alternative */ alt = sctp_find_alternate_net(stcb, net, 0); From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 17:48:07 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 948F61065670; Sun, 7 Nov 2010 17:48:07 +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 812DC8FC1B; Sun, 7 Nov 2010 17:48:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7Hm7qe066582; Sun, 7 Nov 2010 17:48:07 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Hm776066577; Sun, 7 Nov 2010 17:48:07 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071748.oA7Hm776066577@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 17:48:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214929 - in stable/8/sys/dev: mii tl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:48:07 -0000 Author: marius Date: Sun Nov 7 17:48:07 2010 New Revision: 214929 URL: http://svn.freebsd.org/changeset/base/214929 Log: MFC: r214264 - Add IFM_10_2 and IFM_10_5 media via tlphy(4) only in case the respective interface also has such connectors. - In tl_attach() unify three different ways of obtaining the device and vendor IDs and remove the now obsolete tl_dinfo from tl_softc. - Given that tlphy(4) only handles the integrated PHYs of NICs driven by tl(4) make it only probe on the latter. - Switch mlphy(4) and tlphy(4) to use mii_phy_add_media()/mii_phy_setmedia(). - Simplify looking for the respective companion PHY in mlphy(4) and tlphy(4) by ignoring the native one by just comparing the device_t's directly rather than the device name. Modified: stable/8/sys/dev/mii/mlphy.c stable/8/sys/dev/mii/tlphy.c stable/8/sys/dev/tl/if_tl.c stable/8/sys/dev/tl/if_tlreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/mii/mlphy.c ============================================================================== --- stable/8/sys/dev/mii/mlphy.c Sun Nov 7 17:44:04 2010 (r214928) +++ stable/8/sys/dev/mii/mlphy.c Sun Nov 7 17:48:07 2010 (r214929) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); struct mlphy_softc { struct mii_softc ml_mii; + device_t ml_dev; int ml_state; int ml_linked; }; @@ -96,6 +97,7 @@ static driver_t mlphy_driver = { DRIVER_MODULE(mlphy, miibus, mlphy_driver, mlphy_devclass, 0, 0); +static struct mii_softc *mlphy_find_other(struct mlphy_softc *); static int mlphy_service(struct mii_softc *, struct mii_data *, int); static void mlphy_reset(struct mii_softc *); static void mlphy_status(struct mii_softc *); @@ -105,10 +107,8 @@ mlphy_probe(dev) device_t dev; { struct mii_attach_args *ma; - device_t parent; ma = device_get_ivars(dev); - parent = device_get_parent(device_get_parent(dev)); /* * Micro Linear PHY reports oui == 0 model == 0 @@ -122,7 +122,8 @@ mlphy_probe(dev) * encountered the 6692 on an Olicom card with a ThunderLAN * controller chip. */ - if (strcmp(device_get_name(parent), "tl") != 0) + if (strcmp(device_get_name(device_get_parent(device_get_parent(dev))), + "tl") != 0) return (ENXIO); device_set_desc(dev, "Micro Linear 6692 media interface"); @@ -141,6 +142,7 @@ mlphy_attach(dev) msc = device_get_softc(dev); sc = &msc->ml_mii; + msc->ml_dev = dev; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); mii = ma->mii_data; @@ -155,14 +157,15 @@ mlphy_attach(dev) #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), - BMCR_LOOP|BMCR_S100); + MII_MEDIA_100_TX); mii_phy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + /* Let the companion PHY (if any) only handle the media we don't. */ ma->mii_capmask = ~sc->mii_capabilities; device_printf(dev, " "); - mii_add_media(sc); + mii_phy_add_media(sc); printf("\n"); #undef ADD MIIBUS_MEDIAINIT(sc->mii_dev); @@ -170,20 +173,21 @@ mlphy_attach(dev) } static struct mii_softc * -mlphy_find_other(device_t mii) +mlphy_find_other(struct mlphy_softc *msc) { device_t *devlist; struct mii_softc *retval; int i, devs; retval = NULL; - if (device_get_children(mii, &devlist, &devs)) + if (device_get_children(msc->ml_mii.mii_dev, &devlist, &devs) != 0) return (NULL); - for (i = 0; i < devs; i++) - if (strcmp(device_get_name(devlist[i]), "mlphy")) { + for (i = 0; i < devs; i++) { + if (devlist[i] != msc->ml_dev) { retval = device_get_softc(devlist[i]); break; } + } free(devlist, M_TEMP); return (retval); } @@ -204,7 +208,7 @@ mlphy_service(xsc, mii, cmd) * See if there's another PHY on this bus with us. * If so, we may need it for 10Mbps modes. */ - other = mlphy_find_other(msc->ml_mii.mii_dev); + other = mlphy_find_other(msc); switch (cmd) { case MII_POLLSTAT: @@ -229,7 +233,7 @@ mlphy_service(xsc, mii, cmd) mii_phy_reset(other); PHY_WRITE(other, MII_BMCR, BMCR_ISO); } - (void) mii_phy_auto(sc); + (void)mii_phy_auto(sc); msc->ml_linked = 0; return (0); case IFM_10_T: @@ -246,8 +250,7 @@ mlphy_service(xsc, mii, cmd) mii_phy_reset(other); PHY_WRITE(other, MII_BMCR, ife->ifm_data); } - PHY_WRITE(sc, MII_ANAR, mii_anar(ife->ifm_media)); - PHY_WRITE(sc, MII_BMCR, ife->ifm_data); + mii_phy_setmedia(sc); msc->ml_state = 0; break; case IFM_100_TX: @@ -262,17 +265,11 @@ mlphy_service(xsc, mii, cmd) mii_phy_reset(other); PHY_WRITE(other, MII_BMCR, BMCR_ISO); } - PHY_WRITE(sc, MII_ANAR, mii_anar(ife->ifm_media)); - PHY_WRITE(sc, MII_BMCR, ife->ifm_data); + mii_phy_setmedia(sc); msc->ml_state = 0; break; - case IFM_100_T4: - /* - * XXX Not supported as a manual setting right now. - */ - return (EINVAL); default: - break; + return (EINVAL); } break; @@ -381,7 +378,7 @@ mlphy_status(sc) struct mii_softc *other = NULL; /* See if there's another PHY on the bus with us. */ - other = mlphy_find_other(msc->ml_mii.mii_dev); + other = mlphy_find_other(msc); if (other == NULL) return; Modified: stable/8/sys/dev/mii/tlphy.c ============================================================================== --- stable/8/sys/dev/mii/tlphy.c Sun Nov 7 17:44:04 2010 (r214928) +++ stable/8/sys/dev/mii/tlphy.c Sun Nov 7 17:48:07 2010 (r214929) @@ -124,6 +124,9 @@ static int tlphy_probe(device_t dev) { + if (strcmp(device_get_name(device_get_parent(device_get_parent(dev))), + "tl") != 0) + return (ENXIO); return (mii_phy_dev_probe(dev, tlphys, BUS_PROBE_DEFAULT)); } @@ -150,11 +153,17 @@ tlphy_attach(device_t dev) sc->sc_mii.mii_service = tlphy_service; sc->sc_mii.mii_pdata = mii; + /* + * Note that if we're on a device that also supports 100baseTX, + * we are not going to want to use the built-in 10baseT port, + * since there will be another PHY on the MII wired up to the + * UTP connector. + */ capmask = BMSR_DEFCAPMASK; if (mii->mii_instance && device_get_children(sc->sc_mii.mii_dev, &devlist, &devs) == 0) { for (i = 0; i < devs; i++) { - if (strcmp(device_get_name(devlist[i]), "tlphy")) { + if (devlist[i] != dev) { other = device_get_softc(devlist[i]); capmask &= ~other->mii_capabilities; break; @@ -167,38 +176,36 @@ tlphy_attach(device_t dev) mii_phy_reset(&sc->sc_mii); - /* - * Note that if we're on a device that also supports 100baseTX, - * we are not going to want to use the built-in 10baseT port, - * since there will be another PHY on the MII wired up to the - * UTP connector. The parent indicates this to us by specifying - * the TLPHY_MEDIA_NO_10_T bit. - */ sc->sc_mii.mii_capabilities = PHY_READ(&sc->sc_mii, MII_BMSR) & capmask; #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->sc_mii.mii_inst), - BMCR_ISO); - - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_LOOP, - sc->sc_mii.mii_inst), BMCR_LOOP); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_LOOP, sc->sc_mii.mii_inst), + MII_MEDIA_100_TX); #define PRINT(s) printf("%s%s", sep, s); sep = ", " - device_printf(dev, " "); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_2, 0, sc->sc_mii.mii_inst), 0); - PRINT("10base2/BNC"); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_5, 0, sc->sc_mii.mii_inst), 0); - PRINT("10base5/AUI"); - - if (sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) { + if ((sc->sc_mii.mii_flags & (MIIF_MACPRIV0 | MIIF_MACPRIV1)) != 0 && + (sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) != 0) + device_printf(dev, " "); + if ((sc->sc_mii.mii_flags & MIIF_MACPRIV0) != 0) { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_2, 0, sc->sc_mii.mii_inst), + 0); + PRINT("10base2/BNC"); + } + if ((sc->sc_mii.mii_flags & MIIF_MACPRIV1) != 0) { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_5, 0, sc->sc_mii.mii_inst), + 0); + PRINT("10base5/AUI"); + } + if ((sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) != 0) { printf("%s", sep); - mii_add_media(&sc->sc_mii); + mii_phy_add_media(&sc->sc_mii); } - - printf("\n"); + if ((sc->sc_mii.mii_flags & (MIIF_MACPRIV0 | MIIF_MACPRIV1)) != 0 && + (sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) != 0) + printf("\n"); #undef ADD #undef PRINT MIIBUS_MEDIAINIT(sc->sc_mii.mii_dev); @@ -233,7 +240,7 @@ tlphy_service(struct mii_softc *self, st * an autonegotiation cycle, so there's no such * thing as "already in auto mode". */ - (void) tlphy_auto(sc); + (void)tlphy_auto(sc); break; case IFM_10_2: case IFM_10_5: @@ -244,9 +251,7 @@ tlphy_service(struct mii_softc *self, st default: PHY_WRITE(&sc->sc_mii, MII_TLPHY_CTRL, 0); DELAY(100000); - PHY_WRITE(&sc->sc_mii, MII_ANAR, - mii_anar(ife->ifm_media)); - PHY_WRITE(&sc->sc_mii, MII_BMCR, ife->ifm_data); + mii_phy_setmedia(&sc->sc_mii); } break; @@ -283,7 +288,7 @@ tlphy_service(struct mii_softc *self, st sc->sc_mii.mii_ticks = 0; mii_phy_reset(&sc->sc_mii); - tlphy_auto(sc); + (void)tlphy_auto(sc); return (0); } Modified: stable/8/sys/dev/tl/if_tl.c ============================================================================== --- stable/8/sys/dev/tl/if_tl.c Sun Nov 7 17:44:04 2010 (r214928) +++ stable/8/sys/dev/tl/if_tl.c Sun Nov 7 17:48:07 2010 (r214929) @@ -1104,12 +1104,11 @@ static int tl_attach(dev) device_t dev; { - int i; u_int16_t did, vid; struct tl_type *t; struct ifnet *ifp; struct tl_softc *sc; - int unit, error = 0, rid; + int error, flags, i, rid, unit; u_char eaddr[6]; vid = pci_get_vendor(dev); @@ -1210,10 +1209,9 @@ tl_attach(dev) bzero(sc->tl_ldata, sizeof(struct tl_list_data)); - sc->tl_dinfo = t; - if (t->tl_vid == COMPAQ_VENDORID || t->tl_vid == TI_VENDORID) + if (vid == COMPAQ_VENDORID || vid == TI_VENDORID) sc->tl_eeaddr = TL_EEPROM_EADDR; - if (t->tl_vid == OLICOM_VENDORID) + if (vid == OLICOM_VENDORID) sc->tl_eeaddr = TL_EEPROM_EADDR_OC; /* Reset the adapter. */ @@ -1244,7 +1242,7 @@ tl_attach(dev) * word. To make things even more confusing, neither 00:00:28 * nor 00:00:24 appear in the IEEE OUI database. */ - if (sc->tl_dinfo->tl_vid == OLICOM_VENDORID) { + if (vid == OLICOM_VENDORID) { for (i = 0; i < ETHER_ADDR_LEN; i += 2) { u_int16_t *p; p = (u_int16_t *)&eaddr[i]; @@ -1283,6 +1281,20 @@ tl_attach(dev) * XXX mii_attach() can fail for reason different than * no PHYs found! */ + flags = 0; + if (vid == COMPAQ_VENDORID) { + if (did == COMPAQ_DEVICEID_NETEL_10_100_PROLIANT || + did == COMPAQ_DEVICEID_NETFLEX_3P_INTEGRATED || + did == COMPAQ_DEVICEID_NETFLEX_3P_BNC || + did == COMPAQ_DEVICEID_NETEL_10_T2_UTP_COAX) + flags |= MIIF_MACPRIV0; + if (did == COMPAQ_DEVICEID_NETEL_10 || + did == COMPAQ_DEVICEID_NETEL_10_100_DUAL || + did == COMPAQ_DEVICEID_NETFLEX_3P || + did == COMPAQ_DEVICEID_NETEL_10_100_EMBEDDED) + flags |= MIIF_MACPRIV1; + } else if (vid == OLICOM_VENDORID && did == OLICOM_DEVICEID_OC2183) + flags |= MIIF_MACPRIV0 | MIIF_MACPRIV1; if (mii_attach(dev, &sc->tl_miibus, ifp, tl_ifmedia_upd, tl_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0)) { struct ifmedia *ifm; Modified: stable/8/sys/dev/tl/if_tlreg.h ============================================================================== --- stable/8/sys/dev/tl/if_tlreg.h Sun Nov 7 17:44:04 2010 (r214928) +++ stable/8/sys/dev/tl/if_tlreg.h Sun Nov 7 17:48:07 2010 (r214929) @@ -118,7 +118,6 @@ struct tl_softc { struct resource *tl_irq; struct resource *tl_res; device_t tl_miibus; - struct tl_type *tl_dinfo; /* ThunderLAN adapter info */ u_int8_t tl_eeaddr; struct tl_list_data *tl_ldata; /* TX/RX lists and mbufs */ struct tl_chain_data tl_cdata; From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 17:48:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F9DB10656A4; Sun, 7 Nov 2010 17:48:13 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B8BA8FC19; Sun, 7 Nov 2010 17:48: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 oA7HmBWG066625; Sun, 7 Nov 2010 17:48:11 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7HmBBX066620; Sun, 7 Nov 2010 17:48:11 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071748.oA7HmBBX066620@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 17:48: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: r214930 - in stable/7/sys: dev/mii pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:48:13 -0000 Author: marius Date: Sun Nov 7 17:48:11 2010 New Revision: 214930 URL: http://svn.freebsd.org/changeset/base/214930 Log: MFC: r214264 - Add IFM_10_2 and IFM_10_5 media via tlphy(4) only in case the respective interface also has such connectors. - In tl_attach() unify three different ways of obtaining the device and vendor IDs and remove the now obsolete tl_dinfo from tl_softc. - Given that tlphy(4) only handles the integrated PHYs of NICs driven by tl(4) make it only probe on the latter. - Switch mlphy(4) and tlphy(4) to use mii_phy_add_media()/mii_phy_setmedia(). - Simplify looking for the respective companion PHY in mlphy(4) and tlphy(4) by ignoring the native one by just comparing the device_t's directly rather than the device name. Modified: stable/7/sys/dev/mii/mlphy.c stable/7/sys/dev/mii/tlphy.c stable/7/sys/pci/if_tl.c stable/7/sys/pci/if_tlreg.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/mii/mlphy.c ============================================================================== --- stable/7/sys/dev/mii/mlphy.c Sun Nov 7 17:48:07 2010 (r214929) +++ stable/7/sys/dev/mii/mlphy.c Sun Nov 7 17:48:11 2010 (r214930) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); struct mlphy_softc { struct mii_softc ml_mii; + device_t ml_dev; int ml_state; int ml_linked; }; @@ -96,6 +97,7 @@ static driver_t mlphy_driver = { DRIVER_MODULE(mlphy, miibus, mlphy_driver, mlphy_devclass, 0, 0); +static struct mii_softc *mlphy_find_other(struct mlphy_softc *); static int mlphy_service(struct mii_softc *, struct mii_data *, int); static void mlphy_reset(struct mii_softc *); static void mlphy_status(struct mii_softc *); @@ -105,10 +107,8 @@ mlphy_probe(dev) device_t dev; { struct mii_attach_args *ma; - device_t parent; ma = device_get_ivars(dev); - parent = device_get_parent(device_get_parent(dev)); /* * Micro Linear PHY reports oui == 0 model == 0 @@ -122,7 +122,8 @@ mlphy_probe(dev) * encountered the 6692 on an Olicom card with a ThunderLAN * controller chip. */ - if (strcmp(device_get_name(parent), "tl") != 0) + if (strcmp(device_get_name(device_get_parent(device_get_parent(dev))), + "tl") != 0) return (ENXIO); device_set_desc(dev, "Micro Linear 6692 media interface"); @@ -141,6 +142,7 @@ mlphy_attach(dev) msc = device_get_softc(dev); sc = &msc->ml_mii; + msc->ml_dev = dev; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); mii = ma->mii_data; @@ -155,14 +157,15 @@ mlphy_attach(dev) #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), - BMCR_LOOP|BMCR_S100); + MII_MEDIA_100_TX); mii_phy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + /* Let the companion PHY (if any) only handle the media we don't. */ ma->mii_capmask = ~sc->mii_capabilities; device_printf(dev, " "); - mii_add_media(sc); + mii_phy_add_media(sc); printf("\n"); #undef ADD MIIBUS_MEDIAINIT(sc->mii_dev); @@ -170,20 +173,21 @@ mlphy_attach(dev) } static struct mii_softc * -mlphy_find_other(device_t mii) +mlphy_find_other(struct mlphy_softc *msc) { device_t *devlist; struct mii_softc *retval; int i, devs; retval = NULL; - if (device_get_children(mii, &devlist, &devs)) + if (device_get_children(msc->ml_mii.mii_dev, &devlist, &devs) != 0) return (NULL); - for (i = 0; i < devs; i++) - if (strcmp(device_get_name(devlist[i]), "mlphy")) { + for (i = 0; i < devs; i++) { + if (devlist[i] != msc->ml_dev) { retval = device_get_softc(devlist[i]); break; } + } free(devlist, M_TEMP); return (retval); } @@ -204,7 +208,7 @@ mlphy_service(xsc, mii, cmd) * See if there's another PHY on this bus with us. * If so, we may need it for 10Mbps modes. */ - other = mlphy_find_other(msc->ml_mii.mii_dev); + other = mlphy_find_other(msc); switch (cmd) { case MII_POLLSTAT: @@ -229,7 +233,7 @@ mlphy_service(xsc, mii, cmd) mii_phy_reset(other); PHY_WRITE(other, MII_BMCR, BMCR_ISO); } - (void) mii_phy_auto(sc); + (void)mii_phy_auto(sc); msc->ml_linked = 0; return (0); case IFM_10_T: @@ -246,8 +250,7 @@ mlphy_service(xsc, mii, cmd) mii_phy_reset(other); PHY_WRITE(other, MII_BMCR, ife->ifm_data); } - PHY_WRITE(sc, MII_ANAR, mii_anar(ife->ifm_media)); - PHY_WRITE(sc, MII_BMCR, ife->ifm_data); + mii_phy_setmedia(sc); msc->ml_state = 0; break; case IFM_100_TX: @@ -262,17 +265,11 @@ mlphy_service(xsc, mii, cmd) mii_phy_reset(other); PHY_WRITE(other, MII_BMCR, BMCR_ISO); } - PHY_WRITE(sc, MII_ANAR, mii_anar(ife->ifm_media)); - PHY_WRITE(sc, MII_BMCR, ife->ifm_data); + mii_phy_setmedia(sc); msc->ml_state = 0; break; - case IFM_100_T4: - /* - * XXX Not supported as a manual setting right now. - */ - return (EINVAL); default: - break; + return (EINVAL); } break; @@ -381,7 +378,7 @@ mlphy_status(sc) struct mii_softc *other = NULL; /* See if there's another PHY on the bus with us. */ - other = mlphy_find_other(msc->ml_mii.mii_dev); + other = mlphy_find_other(msc); if (other == NULL) return; Modified: stable/7/sys/dev/mii/tlphy.c ============================================================================== --- stable/7/sys/dev/mii/tlphy.c Sun Nov 7 17:48:07 2010 (r214929) +++ stable/7/sys/dev/mii/tlphy.c Sun Nov 7 17:48:11 2010 (r214930) @@ -124,6 +124,9 @@ static int tlphy_probe(device_t dev) { + if (strcmp(device_get_name(device_get_parent(device_get_parent(dev))), + "tl") != 0) + return (ENXIO); return (mii_phy_dev_probe(dev, tlphys, BUS_PROBE_DEFAULT)); } @@ -150,11 +153,17 @@ tlphy_attach(device_t dev) sc->sc_mii.mii_service = tlphy_service; sc->sc_mii.mii_pdata = mii; + /* + * Note that if we're on a device that also supports 100baseTX, + * we are not going to want to use the built-in 10baseT port, + * since there will be another PHY on the MII wired up to the + * UTP connector. + */ capmask = BMSR_DEFCAPMASK; if (mii->mii_instance && device_get_children(sc->sc_mii.mii_dev, &devlist, &devs) == 0) { for (i = 0; i < devs; i++) { - if (strcmp(device_get_name(devlist[i]), "tlphy")) { + if (devlist[i] != dev) { other = device_get_softc(devlist[i]); capmask &= ~other->mii_capabilities; break; @@ -167,38 +176,36 @@ tlphy_attach(device_t dev) mii_phy_reset(&sc->sc_mii); - /* - * Note that if we're on a device that also supports 100baseTX, - * we are not going to want to use the built-in 10baseT port, - * since there will be another PHY on the MII wired up to the - * UTP connector. The parent indicates this to us by specifying - * the TLPHY_MEDIA_NO_10_T bit. - */ sc->sc_mii.mii_capabilities = PHY_READ(&sc->sc_mii, MII_BMSR) & capmask; #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->sc_mii.mii_inst), - BMCR_ISO); - - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_LOOP, - sc->sc_mii.mii_inst), BMCR_LOOP); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_LOOP, sc->sc_mii.mii_inst), + MII_MEDIA_100_TX); #define PRINT(s) printf("%s%s", sep, s); sep = ", " - device_printf(dev, " "); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_2, 0, sc->sc_mii.mii_inst), 0); - PRINT("10base2/BNC"); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_5, 0, sc->sc_mii.mii_inst), 0); - PRINT("10base5/AUI"); - - if (sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) { + if ((sc->sc_mii.mii_flags & (MIIF_MACPRIV0 | MIIF_MACPRIV1)) != 0 && + (sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) != 0) + device_printf(dev, " "); + if ((sc->sc_mii.mii_flags & MIIF_MACPRIV0) != 0) { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_2, 0, sc->sc_mii.mii_inst), + 0); + PRINT("10base2/BNC"); + } + if ((sc->sc_mii.mii_flags & MIIF_MACPRIV1) != 0) { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_5, 0, sc->sc_mii.mii_inst), + 0); + PRINT("10base5/AUI"); + } + if ((sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) != 0) { printf("%s", sep); - mii_add_media(&sc->sc_mii); + mii_phy_add_media(&sc->sc_mii); } - - printf("\n"); + if ((sc->sc_mii.mii_flags & (MIIF_MACPRIV0 | MIIF_MACPRIV1)) != 0 && + (sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) != 0) + printf("\n"); #undef ADD #undef PRINT MIIBUS_MEDIAINIT(sc->sc_mii.mii_dev); @@ -233,7 +240,7 @@ tlphy_service(struct mii_softc *self, st * an autonegotiation cycle, so there's no such * thing as "already in auto mode". */ - (void) tlphy_auto(sc); + (void)tlphy_auto(sc); break; case IFM_10_2: case IFM_10_5: @@ -244,9 +251,7 @@ tlphy_service(struct mii_softc *self, st default: PHY_WRITE(&sc->sc_mii, MII_TLPHY_CTRL, 0); DELAY(100000); - PHY_WRITE(&sc->sc_mii, MII_ANAR, - mii_anar(ife->ifm_media)); - PHY_WRITE(&sc->sc_mii, MII_BMCR, ife->ifm_data); + mii_phy_setmedia(&sc->sc_mii); } break; @@ -283,7 +288,7 @@ tlphy_service(struct mii_softc *self, st sc->sc_mii.mii_ticks = 0; mii_phy_reset(&sc->sc_mii); - tlphy_auto(sc); + (void)tlphy_auto(sc); return (0); } Modified: stable/7/sys/pci/if_tl.c ============================================================================== --- stable/7/sys/pci/if_tl.c Sun Nov 7 17:48:07 2010 (r214929) +++ stable/7/sys/pci/if_tl.c Sun Nov 7 17:48:11 2010 (r214930) @@ -1104,12 +1104,11 @@ static int tl_attach(dev) device_t dev; { - int i; u_int16_t did, vid; struct tl_type *t; struct ifnet *ifp; struct tl_softc *sc; - int unit, error = 0, rid; + int error, flags, i, rid, unit; u_char eaddr[6]; vid = pci_get_vendor(dev); @@ -1210,10 +1209,9 @@ tl_attach(dev) bzero(sc->tl_ldata, sizeof(struct tl_list_data)); - sc->tl_dinfo = t; - if (t->tl_vid == COMPAQ_VENDORID || t->tl_vid == TI_VENDORID) + if (vid == COMPAQ_VENDORID || vid == TI_VENDORID) sc->tl_eeaddr = TL_EEPROM_EADDR; - if (t->tl_vid == OLICOM_VENDORID) + if (vid == OLICOM_VENDORID) sc->tl_eeaddr = TL_EEPROM_EADDR_OC; /* Reset the adapter. */ @@ -1244,7 +1242,7 @@ tl_attach(dev) * word. To make things even more confusing, neither 00:00:28 * nor 00:00:24 appear in the IEEE OUI database. */ - if (sc->tl_dinfo->tl_vid == OLICOM_VENDORID) { + if (vid == OLICOM_VENDORID) { for (i = 0; i < ETHER_ADDR_LEN; i += 2) { u_int16_t *p; p = (u_int16_t *)&eaddr[i]; @@ -1283,6 +1281,20 @@ tl_attach(dev) * XXX mii_attach() can fail for reason different than * no PHYs found! */ + flags = 0; + if (vid == COMPAQ_VENDORID) { + if (did == COMPAQ_DEVICEID_NETEL_10_100_PROLIANT || + did == COMPAQ_DEVICEID_NETFLEX_3P_INTEGRATED || + did == COMPAQ_DEVICEID_NETFLEX_3P_BNC || + did == COMPAQ_DEVICEID_NETEL_10_T2_UTP_COAX) + flags |= MIIF_MACPRIV0; + if (did == COMPAQ_DEVICEID_NETEL_10 || + did == COMPAQ_DEVICEID_NETEL_10_100_DUAL || + did == COMPAQ_DEVICEID_NETFLEX_3P || + did == COMPAQ_DEVICEID_NETEL_10_100_EMBEDDED) + flags |= MIIF_MACPRIV1; + } else if (vid == OLICOM_VENDORID && did == OLICOM_DEVICEID_OC2183) + flags |= MIIF_MACPRIV0 | MIIF_MACPRIV1; if (mii_attach(dev, &sc->tl_miibus, ifp, tl_ifmedia_upd, tl_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0)) { struct ifmedia *ifm; Modified: stable/7/sys/pci/if_tlreg.h ============================================================================== --- stable/7/sys/pci/if_tlreg.h Sun Nov 7 17:48:07 2010 (r214929) +++ stable/7/sys/pci/if_tlreg.h Sun Nov 7 17:48:11 2010 (r214930) @@ -118,7 +118,6 @@ struct tl_softc { struct resource *tl_irq; struct resource *tl_res; device_t tl_miibus; - struct tl_type *tl_dinfo; /* ThunderLAN adapter info */ u_int8_t tl_eeaddr; struct tl_list_data *tl_ldata; /* TX/RX lists and mbufs */ struct tl_chain_data tl_cdata; From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 17:50:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4EC9106564A; Sun, 7 Nov 2010 17:50:54 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78CEB8FC1A; Sun, 7 Nov 2010 17:50:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7Hos2N066921; Sun, 7 Nov 2010 17:50:54 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Hoss4066919; Sun, 7 Nov 2010 17:50:54 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071750.oA7Hoss4066919@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 17:50:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214931 - stable/8/sys/sparc64/sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:50:54 -0000 Author: marius Date: Sun Nov 7 17:50:54 2010 New Revision: 214931 URL: http://svn.freebsd.org/changeset/base/214931 Log: MFC: r214528 - When resetting pm_active and pm_context of a pmap in pmap_pinit() we need locking as otherwise we may race against the other parts of the MD code which expects a consistent state of these. While at it move the resetting of the pmap before entering it in the TSB. - Spell a 0 as TLB_CTX_KERNEL. Modified: stable/8/sys/sparc64/sparc64/pmap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/sparc64/sparc64/pmap.c ============================================================================== --- stable/8/sys/sparc64/sparc64/pmap.c Sun Nov 7 17:48:11 2010 (r214930) +++ stable/8/sys/sparc64/sparc64/pmap.c Sun Nov 7 17:50:54 2010 (r214931) @@ -1061,7 +1061,7 @@ pmap_pinit0(pmap_t pm) PMAP_LOCK_INIT(pm); for (i = 0; i < MAXCPU; i++) - pm->pm_context[i] = 0; + pm->pm_context[i] = TLB_CTX_KERNEL; pm->pm_active = 0; pm->pm_tsb = NULL; pm->pm_tsb_obj = NULL; @@ -1099,6 +1099,12 @@ pmap_pinit(pmap_t pm) if (pm->pm_tsb_obj == NULL) pm->pm_tsb_obj = vm_object_allocate(OBJT_DEFAULT, TSB_PAGES); + mtx_lock_spin(&sched_lock); + for (i = 0; i < MAXCPU; i++) + pm->pm_context[i] = -1; + pm->pm_active = 0; + mtx_unlock_spin(&sched_lock); + VM_OBJECT_LOCK(pm->pm_tsb_obj); for (i = 0; i < TSB_PAGES; i++) { m = vm_page_grab(pm->pm_tsb_obj, i, VM_ALLOC_NOBUSY | @@ -1110,9 +1116,6 @@ pmap_pinit(pmap_t pm) VM_OBJECT_UNLOCK(pm->pm_tsb_obj); pmap_qenter((vm_offset_t)pm->pm_tsb, ma, TSB_PAGES); - for (i = 0; i < MAXCPU; i++) - pm->pm_context[i] = -1; - pm->pm_active = 0; bzero(&pm->pm_stats, sizeof(pm->pm_stats)); return (1); } From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 17:50:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47A49106577F; Sun, 7 Nov 2010 17:50:56 +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 340D98FC1C; Sun, 7 Nov 2010 17:50:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7HouSo066977; Sun, 7 Nov 2010 17:50:56 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Houk6066975; Sun, 7 Nov 2010 17:50:56 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071750.oA7Houk6066975@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 17:50:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214932 - stable/7/sys/sparc64/sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:50:56 -0000 Author: marius Date: Sun Nov 7 17:50:55 2010 New Revision: 214932 URL: http://svn.freebsd.org/changeset/base/214932 Log: MFC: r214528 - When resetting pm_active and pm_context of a pmap in pmap_pinit() we need locking as otherwise we may race against the other parts of the MD code which expects a consistent state of these. While at it move the resetting of the pmap before entering it in the TSB. - Spell a 0 as TLB_CTX_KERNEL. Modified: stable/7/sys/sparc64/sparc64/pmap.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/sparc64/pmap.c ============================================================================== --- stable/7/sys/sparc64/sparc64/pmap.c Sun Nov 7 17:50:54 2010 (r214931) +++ stable/7/sys/sparc64/sparc64/pmap.c Sun Nov 7 17:50:55 2010 (r214932) @@ -1056,7 +1056,7 @@ pmap_pinit0(pmap_t pm) PMAP_LOCK_INIT(pm); for (i = 0; i < MAXCPU; i++) - pm->pm_context[i] = 0; + pm->pm_context[i] = TLB_CTX_KERNEL; pm->pm_active = 0; pm->pm_tsb = NULL; pm->pm_tsb_obj = NULL; @@ -1094,6 +1094,12 @@ pmap_pinit(pmap_t pm) if (pm->pm_tsb_obj == NULL) pm->pm_tsb_obj = vm_object_allocate(OBJT_DEFAULT, TSB_PAGES); + mtx_lock_spin(&sched_lock); + for (i = 0; i < MAXCPU; i++) + pm->pm_context[i] = -1; + pm->pm_active = 0; + mtx_unlock_spin(&sched_lock); + VM_OBJECT_LOCK(pm->pm_tsb_obj); for (i = 0; i < TSB_PAGES; i++) { m = vm_page_grab(pm->pm_tsb_obj, i, VM_ALLOC_NOBUSY | @@ -1105,9 +1111,6 @@ pmap_pinit(pmap_t pm) VM_OBJECT_UNLOCK(pm->pm_tsb_obj); pmap_qenter((vm_offset_t)pm->pm_tsb, ma, TSB_PAGES); - for (i = 0; i < MAXCPU; i++) - pm->pm_context[i] = -1; - pm->pm_active = 0; bzero(&pm->pm_stats, sizeof(pm->pm_stats)); return (1); } From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 17:50:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83F9C1065782; Sun, 7 Nov 2010 17:50:56 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 71A258FC1D; Sun, 7 Nov 2010 17:50:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7Houv2066993; Sun, 7 Nov 2010 17:50:56 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Houem066990; Sun, 7 Nov 2010 17:50:56 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201011071750.oA7Houem066990@svn.freebsd.org> From: Michael Tuexen Date: Sun, 7 Nov 2010 17:50:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214933 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:50:56 -0000 Author: tuexen Date: Sun Nov 7 17:50:56 2010 New Revision: 214933 URL: http://svn.freebsd.org/changeset/base/214933 Log: Remove two functions which are not used. MFC after: 3 days. Modified: head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_timer.h Modified: head/sys/netinet/sctp_timer.c ============================================================================== --- head/sys/netinet/sctp_timer.c Sun Nov 7 17:50:55 2010 (r214932) +++ head/sys/netinet/sctp_timer.c Sun Nov 7 17:50:56 2010 (r214933) @@ -1670,30 +1670,6 @@ sctp_heartbeat_timer(struct sctp_inpcb * return (0); } -int -sctp_is_hb_timer_running(struct sctp_tcb *stcb) -{ - if (SCTP_OS_TIMER_PENDING(&stcb->asoc.hb_timer.timer)) { - /* its running */ - return (1); - } else { - /* nope */ - return (0); - } -} - -int -sctp_is_sack_timer_running(struct sctp_tcb *stcb) -{ - if (SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) { - /* its running */ - return (1); - } else { - /* nope */ - return (0); - } -} - #define SCTP_NUMBER_OF_MTU_SIZES 18 static uint32_t mtu_sizes[] = { 68, Modified: head/sys/netinet/sctp_timer.h ============================================================================== --- head/sys/netinet/sctp_timer.h Sun Nov 7 17:50:55 2010 (r214932) +++ head/sys/netinet/sctp_timer.h Sun Nov 7 17:50:56 2010 (r214933) @@ -65,9 +65,6 @@ int sctp_heartbeat_timer(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *, int); -int sctp_is_hb_timer_running(struct sctp_tcb *stcb); -int sctp_is_sack_timer_running(struct sctp_tcb *stcb); - int sctp_cookie_timer(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *); From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 17:54:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9465D1065672; Sun, 7 Nov 2010 17:54:41 +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 81C588FC12; Sun, 7 Nov 2010 17:54: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 oA7HsfDa067396; Sun, 7 Nov 2010 17:54:41 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Hsfs5067394; Sun, 7 Nov 2010 17:54:41 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071754.oA7Hsfs5067394@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 17:54:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214934 - stable/8/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:54:41 -0000 Author: marius Date: Sun Nov 7 17:54:41 2010 New Revision: 214934 URL: http://svn.freebsd.org/changeset/base/214934 Log: MFC: r214606 Try to make the style consistent (including regarding NetBSD bits not yet merged) and adhere style(9). Modified: stable/8/sys/dev/mii/mii_physubr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/mii/mii_physubr.c ============================================================================== --- stable/8/sys/dev/mii/mii_physubr.c Sun Nov 7 17:50:56 2010 (r214933) +++ stable/8/sys/dev/mii/mii_physubr.c Sun Nov 7 17:54:41 2010 (r214934) @@ -107,8 +107,8 @@ mii_phy_setmedia(struct mii_softc *sc) if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) { if ((PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN) == 0 || - (sc->mii_flags & MIIF_FORCEANEG)) - (void) mii_phy_auto(sc); + (sc->mii_flags & MIIF_FORCEANEG) != 0) + (void)mii_phy_auto(sc); return; } @@ -124,10 +124,10 @@ mii_phy_setmedia(struct mii_softc *sc) bmcr = mii_media_table[ife->ifm_data].mm_bmcr; gtcr = mii_media_table[ife->ifm_data].mm_gtcr; - if (mii->mii_media.ifm_media & IFM_ETH_MASTER) { + if ((mii->mii_media.ifm_media & IFM_ETH_MASTER) != 0) { switch (IFM_SUBTYPE(ife->ifm_media)) { case IFM_1000_T: - gtcr |= GTCR_MAN_MS|GTCR_ADV_MS; + gtcr |= GTCR_MAN_MS | GTCR_ADV_MS; break; default: @@ -135,53 +135,48 @@ mii_phy_setmedia(struct mii_softc *sc) } } - if (ife->ifm_media & IFM_LOOP) + if ((ife->ifm_media & IFM_LOOP) != 0) bmcr |= BMCR_LOOP; PHY_WRITE(sc, MII_ANAR, anar); PHY_WRITE(sc, MII_BMCR, bmcr); - if (sc->mii_flags & MIIF_HAVE_GTCR) + if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) PHY_WRITE(sc, MII_100T2CR, gtcr); } int mii_phy_auto(struct mii_softc *sc) { + int anar, gtcr; /* * Check for 1000BASE-X. Autonegotiation is a bit * different on such devices. */ - if (sc->mii_flags & MIIF_IS_1000X) { - uint16_t anar = 0; - - if (sc->mii_extcapabilities & EXTSR_1000XFDX) + if ((sc->mii_flags & MIIF_IS_1000X) != 0) { + anar = 0; + if ((sc->mii_extcapabilities & EXTSR_1000XFDX) != 0) anar |= ANAR_X_FD; - if (sc->mii_extcapabilities & EXTSR_1000XHDX) + if ((sc->mii_extcapabilities & EXTSR_1000XHDX) != 0) anar |= ANAR_X_HD; - if (sc->mii_flags & MIIF_DOPAUSE) { + if ((sc->mii_flags & MIIF_DOPAUSE) != 0) { /* XXX Asymmetric vs. symmetric? */ anar |= ANLPAR_X_PAUSE_TOWARDS; } - PHY_WRITE(sc, MII_ANAR, anar); } else { - uint16_t anar; - anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) | ANAR_CSMA; - if (sc->mii_flags & MIIF_DOPAUSE) + if ((sc->mii_flags & MIIF_DOPAUSE) != 0) anar |= ANAR_FC; PHY_WRITE(sc, MII_ANAR, anar); - if (sc->mii_flags & MIIF_HAVE_GTCR) { - uint16_t gtcr = 0; - - if (sc->mii_extcapabilities & EXTSR_1000TFDX) + if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) { + gtcr = 0; + if ((sc->mii_extcapabilities & EXTSR_1000TFDX) != 0) gtcr |= GTCR_ADV_1000TFDX; - if (sc->mii_extcapabilities & EXTSR_1000THDX) + if ((sc->mii_extcapabilities & EXTSR_1000THDX) != 0) gtcr |= GTCR_ADV_1000THDX; - PHY_WRITE(sc, MII_100T2CR, gtcr); } } @@ -213,7 +208,7 @@ mii_phy_tick(struct mii_softc *sc) /* Read the status register twice; BMSR_LINK is latch-low. */ reg = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR); - if (reg & BMSR_LINK) { + if ((reg & BMSR_LINK) != 0) { sc->mii_ticks = 0; /* reset autonegotiation timer. */ /* See above. */ return (0); @@ -243,7 +238,7 @@ mii_phy_reset(struct mii_softc *sc) struct ifmedia_entry *ife = sc->mii_pdata->mii_media.ifm_cur; int reg, i; - if (sc->mii_flags & MIIF_NOISOLATE) + if ((sc->mii_flags & MIIF_NOISOLATE) != 0) reg = BMCR_RESET; else reg = BMCR_RESET | BMCR_ISO; @@ -396,7 +391,10 @@ mii_phy_add_media(struct mii_softc *sc) return; } - /* Set aneg timer for 10/100 media. Gigabit media handled below. */ + /* + * Set the autonegotiation timer for 10/100 media. Gigabit media is + * handled below. + */ sc->mii_anegticks = MII_ANEGTICKS; #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) @@ -411,55 +409,54 @@ mii_phy_add_media(struct mii_softc *sc) * HomePNA PHYs. And there is really only one media type * that is supported. */ - if (sc->mii_flags & MIIF_IS_HPNA) { - if (sc->mii_capabilities & BMSR_10THDX) { + if ((sc->mii_flags & MIIF_IS_HPNA) != 0) { + if ((sc->mii_capabilities & BMSR_10THDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_HPNA_1, 0, - sc->mii_inst), - MII_MEDIA_10_T); + sc->mii_inst), MII_MEDIA_10_T); PRINT("HomePNA1"); } return; } - if (sc->mii_capabilities & BMSR_10THDX) { + if ((sc->mii_capabilities & BMSR_10THDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst), MII_MEDIA_10_T); PRINT("10baseT"); } - if (sc->mii_capabilities & BMSR_10TFDX) { + if ((sc->mii_capabilities & BMSR_10TFDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst), MII_MEDIA_10_T_FDX); PRINT("10baseT-FDX"); } - if (sc->mii_capabilities & BMSR_100TXHDX) { + if ((sc->mii_capabilities & BMSR_100TXHDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst), MII_MEDIA_100_TX); PRINT("100baseTX"); } - if (sc->mii_capabilities & BMSR_100TXFDX) { + if ((sc->mii_capabilities & BMSR_100TXFDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst), MII_MEDIA_100_TX_FDX); PRINT("100baseTX-FDX"); } - if (sc->mii_capabilities & BMSR_100T4) { + if ((sc->mii_capabilities & BMSR_100T4) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_T4, 0, sc->mii_inst), MII_MEDIA_100_T4); PRINT("100baseT4"); } - if (sc->mii_extcapabilities & EXTSR_MEDIAMASK) { + if ((sc->mii_extcapabilities & EXTSR_MEDIAMASK) != 0) { /* * XXX Right now only handle 1000SX and 1000TX. Need - * XXX to handle 1000LX and 1000CX some how. + * XXX to handle 1000LX and 1000CX somehow. */ - if (sc->mii_extcapabilities & EXTSR_1000XHDX) { + if ((sc->mii_extcapabilities & EXTSR_1000XHDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_IS_1000X; ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, 0, sc->mii_inst), MII_MEDIA_1000_X); PRINT("1000baseSX"); } - if (sc->mii_extcapabilities & EXTSR_1000XFDX) { + if ((sc->mii_extcapabilities & EXTSR_1000XFDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_IS_1000X; ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, @@ -475,7 +472,7 @@ mii_phy_add_media(struct mii_softc *sc) * * All 1000baseT PHYs have a 1000baseT control register. */ - if (sc->mii_extcapabilities & EXTSR_1000THDX) { + if ((sc->mii_extcapabilities & EXTSR_1000THDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_HAVE_GTCR; mii->mii_media.ifm_mask |= IFM_ETH_MASTER; @@ -483,7 +480,7 @@ mii_phy_add_media(struct mii_softc *sc) sc->mii_inst), MII_MEDIA_1000_T); PRINT("1000baseT"); } - if (sc->mii_extcapabilities & EXTSR_1000TFDX) { + if ((sc->mii_extcapabilities & EXTSR_1000TFDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_HAVE_GTCR; mii->mii_media.ifm_mask |= IFM_ETH_MASTER; @@ -493,7 +490,7 @@ mii_phy_add_media(struct mii_softc *sc) } } - if (sc->mii_capabilities & BMSR_ANEG) { + if ((sc->mii_capabilities & BMSR_ANEG) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), MII_NMEDIA); /* intentionally invalid index */ PRINT("auto"); @@ -511,8 +508,7 @@ mii_phy_detach(device_t dev) mii_phy_down(sc); sc->mii_dev = NULL; LIST_REMOVE(sc, mii_list); - - return(0); + return (0); } const struct mii_phydesc * @@ -545,6 +541,5 @@ mii_phy_dev_probe(device_t dev, const st device_set_desc(dev, mpd->mpd_name); return (mrv); } - return (ENXIO); } From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 17:54:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED714106574B; Sun, 7 Nov 2010 17:54:44 +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 3B16D8FC14; Sun, 7 Nov 2010 17:54: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 oA7Hsipo067432; Sun, 7 Nov 2010 17:54:44 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7HsiJO067430; Sun, 7 Nov 2010 17:54:44 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071754.oA7HsiJO067430@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 17:54: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: r214935 - stable/7/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:54:46 -0000 Author: marius Date: Sun Nov 7 17:54:43 2010 New Revision: 214935 URL: http://svn.freebsd.org/changeset/base/214935 Log: MFC: r214606 Try to make the style consistent (including regarding NetBSD bits not yet merged) and adhere style(9). Modified: stable/7/sys/dev/mii/mii_physubr.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/mii/mii_physubr.c ============================================================================== --- stable/7/sys/dev/mii/mii_physubr.c Sun Nov 7 17:54:41 2010 (r214934) +++ stable/7/sys/dev/mii/mii_physubr.c Sun Nov 7 17:54:43 2010 (r214935) @@ -107,8 +107,8 @@ mii_phy_setmedia(struct mii_softc *sc) if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) { if ((PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN) == 0 || - (sc->mii_flags & MIIF_FORCEANEG)) - (void) mii_phy_auto(sc); + (sc->mii_flags & MIIF_FORCEANEG) != 0) + (void)mii_phy_auto(sc); return; } @@ -124,10 +124,10 @@ mii_phy_setmedia(struct mii_softc *sc) bmcr = mii_media_table[ife->ifm_data].mm_bmcr; gtcr = mii_media_table[ife->ifm_data].mm_gtcr; - if (mii->mii_media.ifm_media & IFM_ETH_MASTER) { + if ((mii->mii_media.ifm_media & IFM_ETH_MASTER) != 0) { switch (IFM_SUBTYPE(ife->ifm_media)) { case IFM_1000_T: - gtcr |= GTCR_MAN_MS|GTCR_ADV_MS; + gtcr |= GTCR_MAN_MS | GTCR_ADV_MS; break; default: @@ -135,53 +135,48 @@ mii_phy_setmedia(struct mii_softc *sc) } } - if (ife->ifm_media & IFM_LOOP) + if ((ife->ifm_media & IFM_LOOP) != 0) bmcr |= BMCR_LOOP; PHY_WRITE(sc, MII_ANAR, anar); PHY_WRITE(sc, MII_BMCR, bmcr); - if (sc->mii_flags & MIIF_HAVE_GTCR) + if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) PHY_WRITE(sc, MII_100T2CR, gtcr); } int mii_phy_auto(struct mii_softc *sc) { + int anar, gtcr; /* * Check for 1000BASE-X. Autonegotiation is a bit * different on such devices. */ - if (sc->mii_flags & MIIF_IS_1000X) { - uint16_t anar = 0; - - if (sc->mii_extcapabilities & EXTSR_1000XFDX) + if ((sc->mii_flags & MIIF_IS_1000X) != 0) { + anar = 0; + if ((sc->mii_extcapabilities & EXTSR_1000XFDX) != 0) anar |= ANAR_X_FD; - if (sc->mii_extcapabilities & EXTSR_1000XHDX) + if ((sc->mii_extcapabilities & EXTSR_1000XHDX) != 0) anar |= ANAR_X_HD; - if (sc->mii_flags & MIIF_DOPAUSE) { + if ((sc->mii_flags & MIIF_DOPAUSE) != 0) { /* XXX Asymmetric vs. symmetric? */ anar |= ANLPAR_X_PAUSE_TOWARDS; } - PHY_WRITE(sc, MII_ANAR, anar); } else { - uint16_t anar; - anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) | ANAR_CSMA; - if (sc->mii_flags & MIIF_DOPAUSE) + if ((sc->mii_flags & MIIF_DOPAUSE) != 0) anar |= ANAR_FC; PHY_WRITE(sc, MII_ANAR, anar); - if (sc->mii_flags & MIIF_HAVE_GTCR) { - uint16_t gtcr = 0; - - if (sc->mii_extcapabilities & EXTSR_1000TFDX) + if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) { + gtcr = 0; + if ((sc->mii_extcapabilities & EXTSR_1000TFDX) != 0) gtcr |= GTCR_ADV_1000TFDX; - if (sc->mii_extcapabilities & EXTSR_1000THDX) + if ((sc->mii_extcapabilities & EXTSR_1000THDX) != 0) gtcr |= GTCR_ADV_1000THDX; - PHY_WRITE(sc, MII_100T2CR, gtcr); } } @@ -213,7 +208,7 @@ mii_phy_tick(struct mii_softc *sc) /* Read the status register twice; BMSR_LINK is latch-low. */ reg = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR); - if (reg & BMSR_LINK) { + if ((reg & BMSR_LINK) != 0) { sc->mii_ticks = 0; /* reset autonegotiation timer. */ /* See above. */ return (0); @@ -243,7 +238,7 @@ mii_phy_reset(struct mii_softc *sc) struct ifmedia_entry *ife = sc->mii_pdata->mii_media.ifm_cur; int reg, i; - if (sc->mii_flags & MIIF_NOISOLATE) + if ((sc->mii_flags & MIIF_NOISOLATE) != 0) reg = BMCR_RESET; else reg = BMCR_RESET | BMCR_ISO; @@ -396,7 +391,10 @@ mii_phy_add_media(struct mii_softc *sc) return; } - /* Set aneg timer for 10/100 media. Gigabit media handled below. */ + /* + * Set the autonegotiation timer for 10/100 media. Gigabit media is + * handled below. + */ sc->mii_anegticks = MII_ANEGTICKS; #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) @@ -411,55 +409,54 @@ mii_phy_add_media(struct mii_softc *sc) * HomePNA PHYs. And there is really only one media type * that is supported. */ - if (sc->mii_flags & MIIF_IS_HPNA) { - if (sc->mii_capabilities & BMSR_10THDX) { + if ((sc->mii_flags & MIIF_IS_HPNA) != 0) { + if ((sc->mii_capabilities & BMSR_10THDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_HPNA_1, 0, - sc->mii_inst), - MII_MEDIA_10_T); + sc->mii_inst), MII_MEDIA_10_T); PRINT("HomePNA1"); } return; } - if (sc->mii_capabilities & BMSR_10THDX) { + if ((sc->mii_capabilities & BMSR_10THDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst), MII_MEDIA_10_T); PRINT("10baseT"); } - if (sc->mii_capabilities & BMSR_10TFDX) { + if ((sc->mii_capabilities & BMSR_10TFDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst), MII_MEDIA_10_T_FDX); PRINT("10baseT-FDX"); } - if (sc->mii_capabilities & BMSR_100TXHDX) { + if ((sc->mii_capabilities & BMSR_100TXHDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst), MII_MEDIA_100_TX); PRINT("100baseTX"); } - if (sc->mii_capabilities & BMSR_100TXFDX) { + if ((sc->mii_capabilities & BMSR_100TXFDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst), MII_MEDIA_100_TX_FDX); PRINT("100baseTX-FDX"); } - if (sc->mii_capabilities & BMSR_100T4) { + if ((sc->mii_capabilities & BMSR_100T4) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_T4, 0, sc->mii_inst), MII_MEDIA_100_T4); PRINT("100baseT4"); } - if (sc->mii_extcapabilities & EXTSR_MEDIAMASK) { + if ((sc->mii_extcapabilities & EXTSR_MEDIAMASK) != 0) { /* * XXX Right now only handle 1000SX and 1000TX. Need - * XXX to handle 1000LX and 1000CX some how. + * XXX to handle 1000LX and 1000CX somehow. */ - if (sc->mii_extcapabilities & EXTSR_1000XHDX) { + if ((sc->mii_extcapabilities & EXTSR_1000XHDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_IS_1000X; ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, 0, sc->mii_inst), MII_MEDIA_1000_X); PRINT("1000baseSX"); } - if (sc->mii_extcapabilities & EXTSR_1000XFDX) { + if ((sc->mii_extcapabilities & EXTSR_1000XFDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_IS_1000X; ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, @@ -475,7 +472,7 @@ mii_phy_add_media(struct mii_softc *sc) * * All 1000baseT PHYs have a 1000baseT control register. */ - if (sc->mii_extcapabilities & EXTSR_1000THDX) { + if ((sc->mii_extcapabilities & EXTSR_1000THDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_HAVE_GTCR; mii->mii_media.ifm_mask |= IFM_ETH_MASTER; @@ -483,7 +480,7 @@ mii_phy_add_media(struct mii_softc *sc) sc->mii_inst), MII_MEDIA_1000_T); PRINT("1000baseT"); } - if (sc->mii_extcapabilities & EXTSR_1000TFDX) { + if ((sc->mii_extcapabilities & EXTSR_1000TFDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_HAVE_GTCR; mii->mii_media.ifm_mask |= IFM_ETH_MASTER; @@ -493,7 +490,7 @@ mii_phy_add_media(struct mii_softc *sc) } } - if (sc->mii_capabilities & BMSR_ANEG) { + if ((sc->mii_capabilities & BMSR_ANEG) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), MII_NMEDIA); /* intentionally invalid index */ PRINT("auto"); @@ -511,8 +508,7 @@ mii_phy_detach(device_t dev) mii_phy_down(sc); sc->mii_dev = NULL; LIST_REMOVE(sc, mii_list); - - return(0); + return (0); } const struct mii_phydesc * @@ -545,6 +541,5 @@ mii_phy_dev_probe(device_t dev, const st device_set_desc(dev, mpd->mpd_name); return (mrv); } - return (ENXIO); } From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 18:21:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCC1F1065670; Sun, 7 Nov 2010 18:21:42 +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 CA2098FC14; Sun, 7 Nov 2010 18:21:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7ILgPa069475; Sun, 7 Nov 2010 18:21:42 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7ILgdo069473; Sun, 7 Nov 2010 18:21:42 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201011071821.oA7ILgdo069473@svn.freebsd.org> From: Andriy Gapon Date: Sun, 7 Nov 2010 18:21:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214936 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 18:21:43 -0000 Author: avg Date: Sun Nov 7 18:21:42 2010 New Revision: 214936 URL: http://svn.freebsd.org/changeset/base/214936 Log: MFC r213937: zfs: add vop_getpages method implementation Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 7 17:54:43 2010 (r214935) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 7 18:21:42 2010 (r214936) @@ -4158,6 +4158,96 @@ zfs_setsecattr(vnode_t *vp, vsecattr_t * } static int +zfs_getpages(struct vnode *vp, vm_page_t *m, int count, int reqpage) +{ + znode_t *zp = VTOZ(vp); + zfsvfs_t *zfsvfs = zp->z_zfsvfs; + objset_t *os = zp->z_zfsvfs->z_os; + vm_page_t mreq; + vm_object_t object; + caddr_t va; + struct sf_buf *sf; + int i, error; + int pcount, size; + + ZFS_ENTER(zfsvfs); + ZFS_VERIFY_ZP(zp); + + pcount = round_page(count) / PAGE_SIZE; + mreq = m[reqpage]; + object = mreq->object; + error = 0; + + KASSERT(vp->v_object == object, ("mismatching object")); + + VM_OBJECT_LOCK(object); + + for (i = 0; i < pcount; i++) { + if (i != reqpage) { + vm_page_lock(m[i]); + vm_page_free(m[i]); + vm_page_unlock(m[i]); + } + } + + if (mreq->valid) { + if (mreq->valid != VM_PAGE_BITS_ALL) + vm_page_zero_invalid(mreq, TRUE); + VM_OBJECT_UNLOCK(object); + ZFS_EXIT(zfsvfs); + return (VM_PAGER_OK); + } + + PCPU_INC(cnt.v_vnodein); + PCPU_INC(cnt.v_vnodepgsin); + + if (IDX_TO_OFF(mreq->pindex) >= object->un_pager.vnp.vnp_size) { + VM_OBJECT_UNLOCK(object); + ZFS_EXIT(zfsvfs); + return (VM_PAGER_BAD); + } + + size = PAGE_SIZE; + if (IDX_TO_OFF(mreq->pindex) + size > object->un_pager.vnp.vnp_size) + size = object->un_pager.vnp.vnp_size - IDX_TO_OFF(mreq->pindex); + + VM_OBJECT_UNLOCK(object); + + va = zfs_map_page(mreq, &sf); + error = dmu_read(os, zp->z_id, IDX_TO_OFF(mreq->pindex), + size, va, DMU_READ_PREFETCH); + if (size != PAGE_SIZE) + bzero(va + size, PAGE_SIZE - size); + zfs_unmap_page(sf); + + VM_OBJECT_LOCK(object); + + if (!error) + mreq->valid = VM_PAGE_BITS_ALL; + KASSERT(mreq->dirty == 0, ("zfs_getpages: page %p is dirty", mreq)); + + VM_OBJECT_UNLOCK(object); + + ZFS_ACCESSTIME_STAMP(zfsvfs, zp); + ZFS_EXIT(zfsvfs); + return (error ? VM_PAGER_ERROR : VM_PAGER_OK); +} + +static int +zfs_freebsd_getpages(ap) + struct vop_getpages_args /* { + struct vnode *a_vp; + vm_page_t *a_m; + int a_count; + int a_reqpage; + vm_ooffset_t a_offset; + } */ *ap; +{ + + return (zfs_getpages(ap->a_vp, ap->a_m, ap->a_count, ap->a_reqpage)); +} + +static int zfs_freebsd_open(ap) struct vop_open_args /* { struct vnode *a_vp; @@ -5261,6 +5351,7 @@ struct vop_vector zfs_vnodeops = { .vop_getacl = zfs_freebsd_getacl, .vop_setacl = zfs_freebsd_setacl, .vop_aclcheck = zfs_freebsd_aclcheck, + .vop_getpages = zfs_freebsd_getpages, }; struct vop_vector zfs_fifoops = { From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 18:25:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7801B106564A; Sun, 7 Nov 2010 18:25:43 +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 4B7B28FC16; Sun, 7 Nov 2010 18:25:43 +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 oA7IPhRY069739; Sun, 7 Nov 2010 18:25:43 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7IPhSs069736; Sun, 7 Nov 2010 18:25:43 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201011071825.oA7IPhSs069736@svn.freebsd.org> From: Andriy Gapon Date: Sun, 7 Nov 2010 18:25:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214937 - in stable/8/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 18:25:43 -0000 Author: avg Date: Sun Nov 7 18:25:42 2010 New Revision: 214937 URL: http://svn.freebsd.org/changeset/base/214937 Log: MFC r214774: x86 topo_probe: do not probe smp topology if only one cpu is visible Modified: stable/8/sys/amd64/amd64/mp_machdep.c stable/8/sys/i386/i386/mp_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/amd64/mp_machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/mp_machdep.c Sun Nov 7 18:21:42 2010 (r214936) +++ stable/8/sys/amd64/amd64/mp_machdep.c Sun Nov 7 18:25:42 2010 (r214937) @@ -231,6 +231,9 @@ topo_probe_0x4(void) cpu_logical++; } + KASSERT(cpu_cores >= 1 && cpu_logical >= 1, + ("topo_probe_0x4 couldn't find BSP")); + cpu_cores /= cpu_logical; hyperthreading_cpus = cpu_logical; } @@ -302,7 +305,9 @@ topo_probe(void) return; logical_cpus_mask = 0; - if (cpu_vendor_id == CPU_VENDOR_AMD) + if (mp_ncpus <= 1) + cpu_cores = cpu_logical = 1; + else if (cpu_vendor_id == CPU_VENDOR_AMD) topo_probe_amd(); else if (cpu_vendor_id == CPU_VENDOR_INTEL) { /* @@ -324,10 +329,8 @@ topo_probe(void) * Fallback: assume each logical CPU is in separate * physical package. That is, no multi-core, no SMT. */ - if (cpu_cores == 0) - cpu_cores = 1; - if (cpu_logical == 0) - cpu_logical = 1; + if (cpu_cores == 0 || cpu_logical == 0) + cpu_cores = cpu_logical = 1; cpu_topo_probed = 1; } Modified: stable/8/sys/i386/i386/mp_machdep.c ============================================================================== --- stable/8/sys/i386/i386/mp_machdep.c Sun Nov 7 18:21:42 2010 (r214936) +++ stable/8/sys/i386/i386/mp_machdep.c Sun Nov 7 18:25:42 2010 (r214937) @@ -285,6 +285,9 @@ topo_probe_0x4(void) cpu_logical++; } + KASSERT(cpu_cores >= 1 && cpu_logical >= 1, + ("topo_probe_0x4 couldn't find BSP")); + cpu_cores /= cpu_logical; hyperthreading_cpus = cpu_logical; } @@ -356,7 +359,9 @@ topo_probe(void) return; logical_cpus_mask = 0; - if (cpu_vendor_id == CPU_VENDOR_AMD) + if (mp_ncpus <= 1) + cpu_cores = cpu_logical = 1; + else if (cpu_vendor_id == CPU_VENDOR_AMD) topo_probe_amd(); else if (cpu_vendor_id == CPU_VENDOR_INTEL) { /* @@ -378,10 +383,8 @@ topo_probe(void) * Fallback: assume each logical CPU is in separate * physical package. That is, no multi-core, no SMT. */ - if (cpu_cores == 0) - cpu_cores = 1; - if (cpu_logical == 0) - cpu_logical = 1; + if (cpu_cores == 0 || cpu_logical == 0) + cpu_cores = cpu_logical = 1; cpu_topo_probed = 1; } From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 18:42:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62A151065672; Sun, 7 Nov 2010 18:42:38 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5140D8FC15; Sun, 7 Nov 2010 18:42:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7IgboR070624; Sun, 7 Nov 2010 18:42:37 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Igb8Y070622; Sun, 7 Nov 2010 18:42:37 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201011071842.oA7Igb8Y070622@svn.freebsd.org> From: Alan Cox Date: Sun, 7 Nov 2010 18:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214938 - head/sys/i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 18:42:38 -0000 Author: alc Date: Sun Nov 7 18:42:37 2010 New Revision: 214938 URL: http://svn.freebsd.org/changeset/base/214938 Log: Eliminate a possible race between pmap_pinit() and pmap_kenter_pde() on superpage promotion or demotion. Micro-optimize pmap_kenter_pde(). Reviewed by: kib, jhb (an earlier version) MFC after: 1 week Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sun Nov 7 18:25:42 2010 (r214937) +++ head/sys/i386/i386/pmap.c Sun Nov 7 18:42:37 2010 (r214938) @@ -1678,11 +1678,19 @@ pmap_unuse_pt(pmap_t pmap, vm_offset_t v return (pmap_unwire_pte_hold(pmap, mpte, free)); } +/* + * Initialize the pmap for the swapper process. + */ void pmap_pinit0(pmap_t pmap) { PMAP_LOCK_INIT(pmap); + /* + * Since the page table directory is shared with the kernel pmap, + * which is already included in the list "allpmaps", this pmap does + * not need to be inserted into that list. + */ pmap->pm_pdir = (pd_entry_t *)(KERNBASE + (vm_offset_t)IdlePTD); #ifdef PAE pmap->pm_pdpt = (pdpt_entry_t *)(KERNBASE + (vm_offset_t)IdlePDPT); @@ -1692,9 +1700,6 @@ pmap_pinit0(pmap_t pmap) PCPU_SET(curpmap, pmap); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); - mtx_lock_spin(&allpmaps_lock); - LIST_INSERT_HEAD(&allpmaps, pmap, pm_list); - mtx_unlock_spin(&allpmaps_lock); } /* @@ -1759,9 +1764,9 @@ pmap_pinit(pmap_t pmap) mtx_lock_spin(&allpmaps_lock); LIST_INSERT_HEAD(&allpmaps, pmap, pm_list); - mtx_unlock_spin(&allpmaps_lock); - /* Wire in kernel global address entries. */ + /* Copy the kernel page table directory entries. */ bcopy(PTD + KPTDI, pmap->pm_pdir + KPTDI, nkpt * sizeof(pd_entry_t)); + mtx_unlock_spin(&allpmaps_lock); /* install self-referential address mapping entry(s) */ for (i = 0; i < NPGPTD; i++) { From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 18:50:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 202981065672; Sun, 7 Nov 2010 18:50:36 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F3FA88FC15; Sun, 7 Nov 2010 18:50:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7IoZDU070898; Sun, 7 Nov 2010 18:50:35 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7IoZDo070893; Sun, 7 Nov 2010 18:50:35 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201011071850.oA7IoZDo070893@svn.freebsd.org> From: Michael Tuexen Date: Sun, 7 Nov 2010 18:50:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214939 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 18:50:36 -0000 Author: tuexen Date: Sun Nov 7 18:50:35 2010 New Revision: 214939 URL: http://svn.freebsd.org/changeset/base/214939 Log: Do not have the MTU table twice in the code. Therefore move the function from the timer code to util, rename it appropriately and also fix a bug in sctp_get_prev_mtu(), where calling it with a value existing in the MTU table did not return a smaller one. MFC after: 3 days. Modified: head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctp_timer.c ============================================================================== --- head/sys/netinet/sctp_timer.c Sun Nov 7 18:42:37 2010 (r214938) +++ head/sys/netinet/sctp_timer.c Sun Nov 7 18:50:35 2010 (r214939) @@ -1670,46 +1670,6 @@ sctp_heartbeat_timer(struct sctp_inpcb * return (0); } -#define SCTP_NUMBER_OF_MTU_SIZES 18 -static uint32_t mtu_sizes[] = { - 68, - 296, - 508, - 512, - 544, - 576, - 1006, - 1492, - 1500, - 1536, - 2002, - 2048, - 4352, - 4464, - 8166, - 17914, - 32000, - 65535 -}; - - -static uint32_t -sctp_getnext_mtu(struct sctp_inpcb *inp, uint32_t cur_mtu) -{ - /* select another MTU that is just bigger than this one */ - int i; - - for (i = 0; i < SCTP_NUMBER_OF_MTU_SIZES; i++) { - if (cur_mtu < mtu_sizes[i]) { - /* no max_mtu is bigger than this one */ - return (mtu_sizes[i]); - } - } - /* here return the highest allowable */ - return (cur_mtu); -} - - void sctp_pathmtu_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, @@ -1717,7 +1677,7 @@ sctp_pathmtu_timer(struct sctp_inpcb *in { uint32_t next_mtu, mtu; - next_mtu = sctp_getnext_mtu(inp, net->mtu); + next_mtu = sctp_get_next_mtu(inp, net->mtu); if ((next_mtu > net->mtu) && (net->port == 0)) { if ((net->src_addr_selected == 0) || Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sun Nov 7 18:42:37 2010 (r214938) +++ head/sys/netinet/sctp_usrreq.c Sun Nov 7 18:50:35 2010 (r214939) @@ -194,7 +194,7 @@ sctp_notify_mbuf(struct sctp_inpcb *inp, * mtu is. Rats we will have to guess (in a educated fashion * of course) */ - nxtsz = find_next_best_mtu(totsz); + nxtsz = sctp_get_prev_mtu(totsz); } /* Stop any PMTU timer */ if (SCTP_OS_TIMER_PENDING(&net->pmtu_timer.timer)) { Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sun Nov 7 18:42:37 2010 (r214938) +++ head/sys/netinet/sctputil.c Sun Nov 7 18:50:35 2010 (r214939) @@ -50,8 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define NUMBER_OF_MTU_SIZES 18 - #ifndef KTR_SCTP #define KTR_SCTP KTR_SUBSYS @@ -753,7 +751,7 @@ sctp_stop_timers_for_shutdown(struct sct * a list of sizes based on typical mtu's, used only if next hop size not * returned. */ -static int sctp_mtu_sizes[] = { +static uint32_t sctp_mtu_sizes[] = { 68, 296, 508, @@ -774,25 +772,42 @@ static int sctp_mtu_sizes[] = { 65535 }; -int -find_next_best_mtu(int totsz) +/* + * Return the largest MTU smaller than val. If there is no + * entry, just return val. + */ +uint32_t +sctp_get_prev_mtu(uint32_t val) { - int i, perfer; + uint32_t i; - /* - * if we are in here we must find the next best fit based on the - * size of the dg that failed to be sent. - */ - perfer = 0; - for (i = 0; i < NUMBER_OF_MTU_SIZES; i++) { - if (totsz < sctp_mtu_sizes[i]) { - perfer = i - 1; - if (perfer < 0) - perfer = 0; + if (val <= sctp_mtu_sizes[0]) { + return (val); + } + for (i = 1; i < (sizeof(sctp_mtu_sizes) / sizeof(uint32_t)); i++) { + if (val <= sctp_mtu_sizes[i]) { break; } } - return (sctp_mtu_sizes[perfer]); + return (sctp_mtu_sizes[i - 1]); +} + +/* + * Return the smallest MTU larger than val. If there is no + * entry, just return val. + */ +uint32_t +sctp_get_next_mtu(struct sctp_inpcb *inp, uint32_t val) +{ + /* select another MTU that is just bigger than this one */ + uint32_t i; + + for (i = 0; i < (sizeof(sctp_mtu_sizes) / sizeof(uint32_t)); i++) { + if (val < sctp_mtu_sizes[i]) { + return (sctp_mtu_sizes[i]); + } + } + return (val); } void Modified: head/sys/netinet/sctputil.h ============================================================================== --- head/sys/netinet/sctputil.h Sun Nov 7 18:42:37 2010 (r214938) +++ head/sys/netinet/sctputil.h Sun Nov 7 18:50:35 2010 (r214939) @@ -124,7 +124,8 @@ sctp_append_to_readq(struct sctp_inpcb * void sctp_iterator_worker(void); -int find_next_best_mtu(int); +uint32_t sctp_get_prev_mtu(uint32_t); +uint32_t sctp_get_next_mtu(struct sctp_inpcb *, uint32_t); void sctp_timeout_handler(void *); From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 19:19:14 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F75E1065672; Sun, 7 Nov 2010 19:19:14 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from monday.kientzle.com (99-115-135-74.uvs.sntcca.sbcglobal.net [99.115.135.74]) by mx1.freebsd.org (Postfix) with ESMTP id 4F2608FC27; Sun, 7 Nov 2010 19:19:14 +0000 (UTC) Received: from [10.123.2.178] (DIR-655 [192.168.1.65]) by monday.kientzle.com (8.14.3/8.14.3) with ESMTP id oA7Iwe6n090209; Sun, 7 Nov 2010 18:58:40 GMT (envelope-from kientzle@FreeBSD.org) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Tim Kientzle In-Reply-To: <86wroppyff.fsf@gmail.com> Date: Sun, 7 Nov 2010 10:58:40 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201011070340.oA73ebRw013346@svn.freebsd.org> <86wroppyff.fsf@gmail.com> To: Anonymous X-Mailer: Apple Mail (2.1081) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r214905 - in head/lib/libarchive: . test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 19:19:14 -0000 On Nov 6, 2010, at 9:09 PM, Anonymous wrote: > Tim Kientzle writes: >=20 >> Author: kientzle >> Date: Sun Nov 7 03:40:37 2010 >> New Revision: 214905 >> URL: http://svn.freebsd.org/changeset/base/214905 >>=20 >> Log: >> If the Zip reader doesn't see a PK signature block >> because there's inter-entry garbage, just scan forward >> to find the next one. This allows us to handle a lot >> of Zip archives that have been modified in-place. >=20 > It's unrelated but can you also look at archives produces by Mojo = Setup? >=20 > http://icculus.org/mojosetup/examples/ >=20 > $ /usr/bin/unzip duke3d-mojosetup-linux-x86.bin > Archive: duke3d-mojosetup-linux-x86.bin > unzip: Unrecognized archive format > zsh: exit 1 >=20 > $ LOCALBASE/bin/unzip duke3d-mojosetup-linux-x86.bin > Archive: duke3d-mojosetup-linux-x86.bin > warning [duke3d-mojosetup-linux-x86.bin]: 157716 extra bytes at = beginning or within zipfile > (attempting to process anyway) > creating: data/ > inflating: data/duke3d_readme.txt Libarchive currently doesn't support self-extracting Zip archives (the "157716 extra bytes" that Info-Zip mentions). There's a hack in libarchive's Zip reader that mostly supports one particular common type of self-extracting Zip archive, but it's not very easy to generalize. There are a couple of possible options for addressing this, but I won't have time to work on any of those any time soon. Tim From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 19:23:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DD8F106566C; Sun, 7 Nov 2010 19:23:25 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C5738FC14; Sun, 7 Nov 2010 19:23: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 oA7JNPRe071985; Sun, 7 Nov 2010 19:23:25 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7JNPPw071983; Sun, 7 Nov 2010 19:23:25 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071923.oA7JNPPw071983@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 19:23:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214940 - head/release/sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 19:23:25 -0000 Author: marius Date: Sun Nov 7 19:23:25 2010 New Revision: 214940 URL: http://svn.freebsd.org/changeset/base/214940 Log: Add gpart and glabel to the release CD mfsroot. Modified: head/release/sparc64/boot_crunch.conf Modified: head/release/sparc64/boot_crunch.conf ============================================================================== --- head/release/sparc64/boot_crunch.conf Sun Nov 7 18:50:35 2010 (r214939) +++ head/release/sparc64/boot_crunch.conf Sun Nov 7 19:23:25 2010 (r214940) @@ -15,6 +15,7 @@ srcdirs /usr/src/sbin progs camcontrol progs dhclient progs fsck_ffs +progs geom progs ifconfig progs mount_nfs progs newfs @@ -23,6 +24,8 @@ progs rtsol progs tunefs ln fsck_ffs fsck_4.2bsd ln fsck_ffs fsck_ufs +ln geom glabel +ln geom gpart srcdirs /usr/src/usr.bin progs cpio @@ -40,5 +43,5 @@ progs sysinstall progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph -libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -lbsdxml +libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -lgeom -lbsdxml libs -larchive -lcrypto -lbz2 -llzma -lusb -ljail From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 19:32:04 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1521A106566B; Sun, 7 Nov 2010 19:32:04 +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 C93C78FC3A; Sun, 7 Nov 2010 19:32:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7JW3PU072221; Sun, 7 Nov 2010 19:32:03 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7JW3BY072220; Sun, 7 Nov 2010 19:32:03 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201011071932.oA7JW3BY072220@svn.freebsd.org> From: Andriy Gapon Date: Sun, 7 Nov 2010 19:32:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214941 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 19:32:04 -0000 Author: avg Date: Sun Nov 7 19:32:03 2010 New Revision: 214941 URL: http://svn.freebsd.org/changeset/base/214941 Log: Followup to r214936: zfs_getpages: account for differences from head in page locking Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 7 19:23:25 2010 (r214940) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 7 19:32:03 2010 (r214941) @@ -4181,14 +4181,13 @@ zfs_getpages(struct vnode *vp, vm_page_t KASSERT(vp->v_object == object, ("mismatching object")); VM_OBJECT_LOCK(object); - + vm_page_lock_queues(); for (i = 0; i < pcount; i++) { if (i != reqpage) { - vm_page_lock(m[i]); vm_page_free(m[i]); - vm_page_unlock(m[i]); } } + vm_page_unlock_queues(); if (mreq->valid) { if (mreq->valid != VM_PAGE_BITS_ALL) From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 19:51:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DED110656A3; Sun, 7 Nov 2010 19:51:52 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C2638FC14; Sun, 7 Nov 2010 19:51:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7Jppks072852; Sun, 7 Nov 2010 19:51:51 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Jppcd072851; Sun, 7 Nov 2010 19:51:51 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201011071951.oA7Jppcd072851@svn.freebsd.org> From: Alan Cox Date: Sun, 7 Nov 2010 19:51:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214942 - stable/8/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 19:51:52 -0000 Author: alc Date: Sun Nov 7 19:51:51 2010 New Revision: 214942 URL: http://svn.freebsd.org/changeset/base/214942 Log: MFC r214564 Correct some format strings used by sysctls. Modified: stable/8/sys/vm/vm_phys.c stable/8/sys/vm/vm_reserv.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/vm/vm_phys.c ============================================================================== --- stable/8/sys/vm/vm_phys.c Sun Nov 7 19:32:03 2010 (r214941) +++ stable/8/sys/vm/vm_phys.c Sun Nov 7 19:51:51 2010 (r214942) @@ -120,11 +120,11 @@ sysctl_vm_phys_free(SYSCTL_HANDLER_ARGS) sbuf_printf(&sbuf, "-- -- "); sbuf_printf(&sbuf, "--\n"); for (oind = VM_NFREEORDER - 1; oind >= 0; oind--) { - sbuf_printf(&sbuf, " %2.2d (%6.6dK)", oind, + sbuf_printf(&sbuf, " %2d (%6dK)", oind, 1 << (PAGE_SHIFT - 10 + oind)); for (pind = 0; pind < VM_NFREEPOOL; pind++) { fl = vm_phys_free_queues[flind][pind]; - sbuf_printf(&sbuf, " | %6.6d", fl[oind].lcnt); + sbuf_printf(&sbuf, " | %6d", fl[oind].lcnt); } sbuf_printf(&sbuf, "\n"); } Modified: stable/8/sys/vm/vm_reserv.c ============================================================================== --- stable/8/sys/vm/vm_reserv.c Sun Nov 7 19:32:03 2010 (r214941) +++ stable/8/sys/vm/vm_reserv.c Sun Nov 7 19:51:51 2010 (r214942) @@ -196,7 +196,7 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER unused_pages += VM_LEVEL_0_NPAGES - rv->popcnt; } mtx_unlock(&vm_page_queue_free_mtx); - sbuf_printf(&sbuf, "%5.5d: %6.6dK, %6.6d\n", level, + sbuf_printf(&sbuf, "%5d: %6dK, %6d\n", level, unused_pages * (PAGE_SIZE / 1024), counter); } sbuf_finish(&sbuf); From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 20:20:20 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C003106577E; Sun, 7 Nov 2010 20:20:20 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49DE08FC12; Sun, 7 Nov 2010 20:20:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7KKK0S075400; Sun, 7 Nov 2010 20:20:20 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7KKK1L075397; Sun, 7 Nov 2010 20:20:20 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201011072020.oA7KKK1L075397@svn.freebsd.org> From: Alan Cox Date: Sun, 7 Nov 2010 20:20:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214943 - stable/7/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 20:20:20 -0000 Author: alc Date: Sun Nov 7 20:20:19 2010 New Revision: 214943 URL: http://svn.freebsd.org/changeset/base/214943 Log: MFC r214564 Correct some format strings used by sysctls. Modified: stable/7/sys/vm/vm_phys.c stable/7/sys/vm/vm_reserv.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/vm/vm_phys.c ============================================================================== --- stable/7/sys/vm/vm_phys.c Sun Nov 7 19:51:51 2010 (r214942) +++ stable/7/sys/vm/vm_phys.c Sun Nov 7 20:20:19 2010 (r214943) @@ -120,11 +120,11 @@ sysctl_vm_phys_free(SYSCTL_HANDLER_ARGS) sbuf_printf(&sbuf, "-- -- "); sbuf_printf(&sbuf, "--\n"); for (oind = VM_NFREEORDER - 1; oind >= 0; oind--) { - sbuf_printf(&sbuf, " %2.2d (%6.6dK)", oind, + sbuf_printf(&sbuf, " %2d (%6dK)", oind, 1 << (PAGE_SHIFT - 10 + oind)); for (pind = 0; pind < VM_NFREEPOOL; pind++) { fl = vm_phys_free_queues[flind][pind]; - sbuf_printf(&sbuf, " | %6.6d", fl[oind].lcnt); + sbuf_printf(&sbuf, " | %6d", fl[oind].lcnt); } sbuf_printf(&sbuf, "\n"); } Modified: stable/7/sys/vm/vm_reserv.c ============================================================================== --- stable/7/sys/vm/vm_reserv.c Sun Nov 7 19:51:51 2010 (r214942) +++ stable/7/sys/vm/vm_reserv.c Sun Nov 7 20:20:19 2010 (r214943) @@ -196,7 +196,7 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER unused_pages += VM_LEVEL_0_NPAGES - rv->popcnt; } mtx_unlock(&vm_page_queue_free_mtx); - sbuf_printf(&sbuf, "%5.5d: %6.6dK, %6.6d\n", level, + sbuf_printf(&sbuf, "%5d: %6dK, %6d\n", level, unused_pages * (PAGE_SIZE / 1024), counter); } sbuf_finish(&sbuf); From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 20:29:39 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAD2C106564A; Sun, 7 Nov 2010 20:29:39 +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 C85958FC15; Sun, 7 Nov 2010 20:29:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7KTdcP076583; Sun, 7 Nov 2010 20:29:39 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7KTdKZ076581; Sun, 7 Nov 2010 20:29:39 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201011072029.oA7KTdKZ076581@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 7 Nov 2010 20:29:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214944 - stable/8/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 20:29:40 -0000 Author: jilles Date: Sun Nov 7 20:29:39 2010 New Revision: 214944 URL: http://svn.freebsd.org/changeset/base/214944 Log: MFC r214609: sh(1): Correct synopsis and make precise how $0 is set. In particular, the extra argument to set $0 with -c was not documented. Modified: stable/8/bin/sh/sh.1 Directory Properties: stable/8/bin/sh/ (props changed) Modified: stable/8/bin/sh/sh.1 ============================================================================== --- stable/8/bin/sh/sh.1 Sun Nov 7 20:20:19 2010 (r214943) +++ stable/8/bin/sh/sh.1 Sun Nov 7 20:29:39 2010 (r214944) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd October 16, 2010 +.Dd October 31, 2010 .Dt SH 1 .Os .Sh NAME @@ -40,9 +40,24 @@ .Nd command interpreter (shell) .Sh SYNOPSIS .Nm -.Op Fl /+abCEefIimnPpsTuVvx +.Op Fl /+abCEefIimnPpTuVvx .Op Fl /+o Ar longname -.Op Fl c Ar string +.Oo +.Ar script +.Op Ar arg ... +.Oc +.Nm +.Op Fl /+abCEefIimnPpTuVvx +.Op Fl /+o Ar longname +.Fl c Ar string +.Oo +.Ar name +.Op Ar arg ... +.Oc +.Nm +.Op Fl /+abCEefIimnPpTuVvx +.Op Fl /+o Ar longname +.Fl s .Op Ar arg ... .Sh DESCRIPTION The @@ -1105,7 +1120,12 @@ For a pipeline, the process ID is that of the last command in the pipeline. .It Li $0 -(zero) Expands to the name of the shell or shell script. +(zero) Expands to the name of the shell script if passed on the command line, +the +.Ar name +operand if given (with +.Fl c ) +or otherwise argument 0 passed to the shell. .El .Ss Word Expansions This clause describes the various expansions that are From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 20:33:37 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56EA51065696; Sun, 7 Nov 2010 20:33: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 06B528FC0A; Sun, 7 Nov 2010 20:33: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 oA7KXalh077809; Sun, 7 Nov 2010 20:33:36 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7KXa5C077807; Sun, 7 Nov 2010 20:33:36 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201011072033.oA7KXa5C077807@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 7 Nov 2010 20:33: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: r214945 - stable/7/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 20:33:37 -0000 Author: jilles Date: Sun Nov 7 20:33:36 2010 New Revision: 214945 URL: http://svn.freebsd.org/changeset/base/214945 Log: MFC r214609: sh(1): Correct synopsis and make precise how $0 is set. In particular, the extra argument to set $0 with -c was not documented. Modified: stable/7/bin/sh/sh.1 Directory Properties: stable/7/bin/sh/ (props changed) Modified: stable/7/bin/sh/sh.1 ============================================================================== --- stable/7/bin/sh/sh.1 Sun Nov 7 20:29:39 2010 (r214944) +++ stable/7/bin/sh/sh.1 Sun Nov 7 20:33:36 2010 (r214945) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd October 16, 2010 +.Dd October 31, 2010 .Dt SH 1 .Os .Sh NAME @@ -40,9 +40,24 @@ .Nd command interpreter (shell) .Sh SYNOPSIS .Nm -.Op Fl /+abCEefIimnPpsTuVvx +.Op Fl /+abCEefIimnPpTuVvx .Op Fl /+o Ar longname -.Op Fl c Ar string +.Oo +.Ar script +.Op Ar arg ... +.Oc +.Nm +.Op Fl /+abCEefIimnPpTuVvx +.Op Fl /+o Ar longname +.Fl c Ar string +.Oo +.Ar name +.Op Ar arg ... +.Oc +.Nm +.Op Fl /+abCEefIimnPpTuVvx +.Op Fl /+o Ar longname +.Fl s .Op Ar arg ... .Sh DESCRIPTION The @@ -1099,7 +1114,12 @@ For a pipeline, the process ID is that of the last command in the pipeline. .It Li $0 -(zero) Expands to the name of the shell or shell script. +(zero) Expands to the name of the shell script if passed on the command line, +the +.Ar name +operand if given (with +.Fl c ) +or otherwise argument 0 passed to the shell. .El .Ss Word Expansions This clause describes the various expansions that are From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 20:33:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06FDE106578B; Sun, 7 Nov 2010 20:33:40 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5FAA8FC25; Sun, 7 Nov 2010 20:33:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7KXd8g077861; Sun, 7 Nov 2010 20:33:39 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7KXdrc077855; Sun, 7 Nov 2010 20:33:39 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201011072033.oA7KXdrc077855@svn.freebsd.org> From: Andrew Thompson Date: Sun, 7 Nov 2010 20:33:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214946 - in head/sys/arm: conf xscale/ixp425 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 20:33:40 -0000 Author: thompsa Date: Sun Nov 7 20:33:39 2010 New Revision: 214946 URL: http://svn.freebsd.org/changeset/base/214946 Log: Hook up the five gpio pins on the Avila board to the gpio framework. There are actually 16 I/O lines but the other ones are used for system devices and interrupts. The IXP4XX platform can set interrupts on these pins for high/low/rising/falling/transitional but this is not implemented yet. The Cambria has the same interface but as all the pins are assigned to system functions the gpio header is toggled via a PLD on the i2c bus and is not supported by this commit. Added: head/sys/arm/xscale/ixp425/avila_gpio.c (contents, props changed) Modified: head/sys/arm/conf/AVILA head/sys/arm/conf/AVILA.hints head/sys/arm/xscale/ixp425/files.avila head/sys/arm/xscale/ixp425/ixp425reg.h Modified: head/sys/arm/conf/AVILA ============================================================================== --- head/sys/arm/conf/AVILA Sun Nov 7 20:33:36 2010 (r214945) +++ head/sys/arm/conf/AVILA Sun Nov 7 20:33:39 2010 (r214946) @@ -87,6 +87,10 @@ device ad7418 # AD7418 on I2C bus device avila_led +device gpio +device gpioled +device avila_gpio # GPIO pins on J8 + device ata device atadisk # ATA disk drives device avila_ata # Gateworks CF/IDE support Modified: head/sys/arm/conf/AVILA.hints ============================================================================== --- head/sys/arm/conf/AVILA.hints Sun Nov 7 20:33:36 2010 (r214945) +++ head/sys/arm/conf/AVILA.hints Sun Nov 7 20:33:39 2010 (r214946) @@ -41,6 +41,9 @@ hint.ata_avila.0.at="ixp0" # Front Panel LED hint.led_avila.0.at="ixp0" +# GPIO pins +hint.gpio_avila.0.at="ixp0" + # Analog Devices AD7418 temperature sensor hint.ad7418.0.at="iicbus0" hint.ad7418.0.addr=0x50 Added: head/sys/arm/xscale/ixp425/avila_gpio.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/xscale/ixp425/avila_gpio.c Sun Nov 7 20:33:39 2010 (r214946) @@ -0,0 +1,380 @@ +/*- + * Copyright (c) 2009, Oleksandr Tymoshenko + * Copyright (c) 2009, Luiz Otavio O Souza. + * Copyright (c) 2010, Andrew Thompson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * GPIO driver for Gateworks Avilia + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "gpio_if.h" + +#define GPIO_SET_BITS(sc, reg, bits) \ + GPIO_CONF_WRITE_4(sc, reg, GPIO_CONF_READ_4(sc, (reg)) | (bits)) + +#define GPIO_CLEAR_BITS(sc, reg, bits) \ + GPIO_CONF_WRITE_4(sc, reg, GPIO_CONF_READ_4(sc, (reg)) & ~(bits)) + +#define GPIO_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define GPIO_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) +#define GPIO_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) + +struct avila_gpio_softc { + device_t sc_dev; + struct mtx sc_mtx; + bus_space_tag_t sc_iot; + bus_space_handle_t sc_gpio_ioh; + uint32_t sc_valid; + struct gpio_pin sc_pins[IXP4XX_GPIO_PINS]; +}; + +struct avila_gpio_pin { + const char *name; + int pin; + int caps; +}; + +#define GPIO_PIN_IO (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT) +static struct avila_gpio_pin avila_gpio_pins[] = { + { "GPIO0", 0, GPIO_PIN_IO }, + { "GPIO1", 1, GPIO_PIN_IO }, + { "GPIO2", 2, GPIO_PIN_IO }, + { "GPIO3", 3, GPIO_PIN_IO }, + { "GPIO4", 4, GPIO_PIN_IO }, + /* + * The following pins are connected to system devices and should not + * really be frobbed. + */ +#if 0 + { "SER_ENA", 5, GPIO_PIN_IO }, + { "I2C_SCL", 6, GPIO_PIN_IO }, + { "I2C_SDA", 7, GPIO_PIN_IO }, + { "PCI_INTD", 8, GPIO_PIN_IO }, + { "PCI_INTC", 9, GPIO_PIN_IO }, + { "PCI_INTB", 10, GPIO_PIN_IO }, + { "PCI_INTA", 11, GPIO_PIN_IO }, + { "ATA_INT", 12, GPIO_PIN_IO }, + { "PCI_RST", 13, GPIO_PIN_IO }, + { "PCI_CLK", 14, GPIO_PIN_OUTPUT }, + { "EX_CLK", 15, GPIO_PIN_OUTPUT }, +#endif +}; +#undef GPIO_PIN_IO + +/* + * Helpers + */ +static void avila_gpio_pin_configure(struct avila_gpio_softc *sc, + struct gpio_pin *pin, uint32_t flags); +static int avila_gpio_pin_flags(struct avila_gpio_softc *sc, uint32_t pin); + +/* + * Driver stuff + */ +static int avila_gpio_probe(device_t dev); +static int avila_gpio_attach(device_t dev); +static int avila_gpio_detach(device_t dev); + +/* + * GPIO interface + */ +static int avila_gpio_pin_max(device_t dev, int *maxpin); +static int avila_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps); +static int avila_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t + *flags); +static int avila_gpio_pin_getname(device_t dev, uint32_t pin, char *name); +static int avila_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags); +static int avila_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value); +static int avila_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val); +static int avila_gpio_pin_toggle(device_t dev, uint32_t pin); + +static int +avila_gpio_pin_flags(struct avila_gpio_softc *sc, uint32_t pin) +{ + uint32_t v; + + v = GPIO_CONF_READ_4(sc, IXP425_GPIO_GPINR) & (1 << pin); + + return (v ? GPIO_PIN_INPUT : GPIO_PIN_OUTPUT); +} + +static void +avila_gpio_pin_configure(struct avila_gpio_softc *sc, struct gpio_pin *pin, + unsigned int flags) +{ + uint32_t mask; + + mask = 1 << pin->gp_pin; + GPIO_LOCK(sc); + + /* + * Manage input/output + */ + if (flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) { + pin->gp_flags &= ~(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT); + if (flags & GPIO_PIN_OUTPUT) { + pin->gp_flags |= GPIO_PIN_OUTPUT; + GPIO_CLEAR_BITS(sc, IXP425_GPIO_GPOER, mask); + } + else { + pin->gp_flags |= GPIO_PIN_INPUT; + GPIO_SET_BITS(sc, IXP425_GPIO_GPOER, mask); + } + } + + GPIO_UNLOCK(sc); +} + +static int +avila_gpio_pin_max(device_t dev, int *maxpin) +{ + + *maxpin = IXP4XX_GPIO_PINS - 1; + return (0); +} + +static int +avila_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) +{ + struct avila_gpio_softc *sc = device_get_softc(dev); + + if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & (1 << pin))) + return (EINVAL); + + GPIO_LOCK(sc); + *caps = sc->sc_pins[pin].gp_caps; + GPIO_UNLOCK(sc); + + return (0); +} + +static int +avila_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags) +{ + struct avila_gpio_softc *sc = device_get_softc(dev); + + if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & (1 << pin))) + return (EINVAL); + + GPIO_LOCK(sc); + /* refresh since we do not own all the pins */ + sc->sc_pins[pin].gp_flags = avila_gpio_pin_flags(sc, pin); + *flags = sc->sc_pins[pin].gp_flags; + GPIO_UNLOCK(sc); + + return (0); +} + +static int +avila_gpio_pin_getname(device_t dev, uint32_t pin, char *name) +{ + struct avila_gpio_softc *sc = device_get_softc(dev); + + if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & (1 << pin))) + return (EINVAL); + + GPIO_LOCK(sc); + memcpy(name, sc->sc_pins[pin].gp_name, GPIOMAXNAME); + GPIO_UNLOCK(sc); + + return (0); +} + +static int +avila_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) +{ + struct avila_gpio_softc *sc = device_get_softc(dev); + uint32_t mask = 1 << pin; + + if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & mask)) + return (EINVAL); + + /* Filter out unwanted flags */ + if ((flags &= sc->sc_pins[pin].gp_caps) != flags) + return (EINVAL); + + /* Can't mix input/output together */ + if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) == + (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) + return (EINVAL); + + avila_gpio_pin_configure(sc, &sc->sc_pins[pin], flags); + return (0); +} + +static int +avila_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) +{ + struct avila_gpio_softc *sc = device_get_softc(dev); + uint32_t mask = 1 << pin; + + if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & mask)) + return (EINVAL); + + GPIO_LOCK(sc); + if (value) + GPIO_SET_BITS(sc, IXP425_GPIO_GPOUTR, mask); + else + GPIO_CLEAR_BITS(sc, IXP425_GPIO_GPOUTR, mask); + GPIO_UNLOCK(sc); + + return (0); +} + +static int +avila_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) +{ + struct avila_gpio_softc *sc = device_get_softc(dev); + + if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & (1 << pin))) + return (EINVAL); + + GPIO_LOCK(sc); + *val = (GPIO_CONF_READ_4(sc, IXP425_GPIO_GPINR) & (1 << pin)) ? 1 : 0; + GPIO_UNLOCK(sc); + + return (0); +} + +static int +avila_gpio_pin_toggle(device_t dev, uint32_t pin) +{ + struct avila_gpio_softc *sc = device_get_softc(dev); + uint32_t mask = 1 << pin; + int res; + + if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & mask)) + return (EINVAL); + + GPIO_LOCK(sc); + res = (GPIO_CONF_READ_4(sc, IXP425_GPIO_GPINR) & mask) ? 1 : 0; + if (res) + GPIO_CLEAR_BITS(sc, IXP425_GPIO_GPOUTR, mask); + else + GPIO_SET_BITS(sc, IXP425_GPIO_GPOUTR, mask); + GPIO_UNLOCK(sc); + + return (0); +} + +static int +avila_gpio_probe(device_t dev) +{ + + device_set_desc(dev, "Gateworks Avila GPIO driver"); + return (0); +} + +static int +avila_gpio_attach(device_t dev) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + struct avila_gpio_softc *sc = device_get_softc(dev); + struct ixp425_softc *sa = device_get_softc(device_get_parent(dev)); + int i; + + sc->sc_dev = dev; + sc->sc_iot = sa->sc_iot; + sc->sc_gpio_ioh = sa->sc_gpio_ioh; + + mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF); + + for (i = 0; i < N(avila_gpio_pins); i++) { + struct avila_gpio_pin *p = &avila_gpio_pins[i]; + + strncpy(sc->sc_pins[p->pin].gp_name, p->name, GPIOMAXNAME); + sc->sc_pins[p->pin].gp_pin = p->pin; + sc->sc_pins[p->pin].gp_caps = p->caps; + sc->sc_pins[p->pin].gp_flags = avila_gpio_pin_flags(sc, p->pin); + sc->sc_valid |= 1 << p->pin; + } + + device_add_child(dev, "gpioc", device_get_unit(dev)); + device_add_child(dev, "gpiobus", device_get_unit(dev)); + return (bus_generic_attach(dev)); +#undef N +} + +static int +avila_gpio_detach(device_t dev) +{ + struct avila_gpio_softc *sc = device_get_softc(dev); + + KASSERT(mtx_initialized(&sc->sc_mtx), ("gpio mutex not initialized")); + + bus_generic_detach(dev); + + mtx_destroy(&sc->sc_mtx); + + return(0); +} + +static device_method_t gpio_avila_methods[] = { + DEVMETHOD(device_probe, avila_gpio_probe), + DEVMETHOD(device_attach, avila_gpio_attach), + DEVMETHOD(device_detach, avila_gpio_detach), + + /* GPIO protocol */ + DEVMETHOD(gpio_pin_max, avila_gpio_pin_max), + DEVMETHOD(gpio_pin_getname, avila_gpio_pin_getname), + DEVMETHOD(gpio_pin_getflags, avila_gpio_pin_getflags), + DEVMETHOD(gpio_pin_getcaps, avila_gpio_pin_getcaps), + DEVMETHOD(gpio_pin_setflags, avila_gpio_pin_setflags), + DEVMETHOD(gpio_pin_get, avila_gpio_pin_get), + DEVMETHOD(gpio_pin_set, avila_gpio_pin_set), + DEVMETHOD(gpio_pin_toggle, avila_gpio_pin_toggle), + {0, 0}, +}; + +static driver_t gpio_avila_driver = { + "gpio_avila", + gpio_avila_methods, + sizeof(struct avila_gpio_softc), +}; +static devclass_t gpio_avila_devclass; + +DRIVER_MODULE(gpio_avila, ixp, gpio_avila_driver, gpio_avila_devclass, 0, 0); Modified: head/sys/arm/xscale/ixp425/files.avila ============================================================================== --- head/sys/arm/xscale/ixp425/files.avila Sun Nov 7 20:33:36 2010 (r214945) +++ head/sys/arm/xscale/ixp425/files.avila Sun Nov 7 20:33:39 2010 (r214946) @@ -2,7 +2,9 @@ arm/xscale/ixp425/avila_machdep.c standard arm/xscale/ixp425/avila_ata.c optional avila_ata arm/xscale/ixp425/avila_led.c optional avila_led +arm/xscale/ixp425/avila_gpio.c optional avila_gpio arm/xscale/ixp425/cambria_exp_space.c standard arm/xscale/ixp425/cambria_fled.c optional cambria_fled arm/xscale/ixp425/cambria_led.c optional cambria_led +arm/xscale/ixp425/cambria_gpio.c optional cambria_gpio arm/xscale/ixp425/ixdp425_pci.c optional pci Modified: head/sys/arm/xscale/ixp425/ixp425reg.h ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425reg.h Sun Nov 7 20:33:36 2010 (r214945) +++ head/sys/arm/xscale/ixp425/ixp425reg.h Sun Nov 7 20:33:39 2010 (r214946) @@ -323,6 +323,8 @@ #define GPIO_TYPE(b,v) ((v) << (((b) & 0x7) * 3)) #define GPIO_TYPE_REG(b) (((b)&8)?IXP425_GPIO_GPIT2R:IXP425_GPIO_GPIT1R) +#define IXP4XX_GPIO_PINS 16 + /* * Expansion Bus Configuration Space. */ From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 20:37:26 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E518106566C; Sun, 7 Nov 2010 20:37:26 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1242F8FC13; Sun, 7 Nov 2010 20:37:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7KbPxL078599; Sun, 7 Nov 2010 20:37:25 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7KbPmg078597; Sun, 7 Nov 2010 20:37:25 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201011072037.oA7KbPmg078597@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 7 Nov 2010 20:37:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214947 - head/contrib/gdb/gdb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 20:37:26 -0000 Author: gonzo Date: Sun Nov 7 20:37:25 2010 New Revision: 214947 URL: http://svn.freebsd.org/changeset/base/214947 Log: Calculate offset from frame top for registers saved on a stack frame. Modified: head/contrib/gdb/gdb/mips-tdep.c Modified: head/contrib/gdb/gdb/mips-tdep.c ============================================================================== --- head/contrib/gdb/gdb/mips-tdep.c Sun Nov 7 20:33:39 2010 (r214946) +++ head/contrib/gdb/gdb/mips-tdep.c Sun Nov 7 20:37:25 2010 (r214947) @@ -1495,6 +1495,7 @@ mips_mdebug_frame_cache (struct frame_in int kernel_trap; /* What registers have been saved? Bitmasks. */ unsigned long gen_mask, float_mask; + long reg_offset; if ((*this_cache) != NULL) return (*this_cache); @@ -1513,6 +1514,8 @@ mips_mdebug_frame_cache (struct frame_in /* Extract the frame's base. */ cache->base = (frame_unwind_register_signed (next_frame, NUM_REGS + PROC_FRAME_REG (proc_desc)) + PROC_FRAME_OFFSET (proc_desc) - PROC_FRAME_ADJUST (proc_desc)); + /* Save registers offset from scratching by following find_proc_desc call */ + reg_offset = PROC_REG_OFFSET (proc_desc); kernel_trap = PROC_REG_MASK (proc_desc) & 1; gen_mask = kernel_trap ? 0xFFFFFFFF : PROC_REG_MASK (proc_desc); @@ -1567,8 +1570,7 @@ mips_mdebug_frame_cache (struct frame_in /* Fill in the offsets for the registers which gen_mask says were saved. */ { - CORE_ADDR reg_position = (cache->base - + PROC_REG_OFFSET (proc_desc)); + CORE_ADDR reg_position = (cache->base + reg_offset); int ireg; for (ireg = MIPS_NUMREGS - 1; gen_mask; --ireg, gen_mask <<= 1) if (gen_mask & 0x80000000) @@ -2162,15 +2164,18 @@ restart: { PROC_REG_MASK (&temp_proc_desc) |= 1 << reg; set_reg_offset (temp_saved_regs, reg, sp + low_word); + /* Do we have registers offset yet? */ + if (!PROC_REG_OFFSET (&temp_proc_desc)) + PROC_REG_OFFSET (&temp_proc_desc) = low_word - PROC_FRAME_OFFSET (&temp_proc_desc); } else if ((high_word & 0xFFE0) == 0xffa0) /* sd reg,offset($sp) */ { - /* Irix 6.2 N32 ABI uses sd instructions for saving $gp and $ra, - but the register size used is only 32 bits. Make the address - for the saved register point to the lower 32 bits. */ PROC_REG_MASK (&temp_proc_desc) |= 1 << reg; set_reg_offset (temp_saved_regs, reg, - sp + low_word + 8 - mips_regsize (current_gdbarch)); + sp + low_word); + /* Do we have registers offset yet? */ + if (!PROC_REG_OFFSET (&temp_proc_desc)) + PROC_REG_OFFSET (&temp_proc_desc) = low_word - PROC_FRAME_OFFSET (&temp_proc_desc); } else if (high_word == 0x27be) /* addiu $30,$sp,size */ { From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 20:38:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E41741065670; Sun, 7 Nov 2010 20:38:14 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D26528FC16; Sun, 7 Nov 2010 20:38: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 oA7KcEdB078727; Sun, 7 Nov 2010 20:38:14 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7KcERr078725; Sun, 7 Nov 2010 20:38:14 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201011072038.oA7KcERr078725@svn.freebsd.org> From: Andrew Thompson Date: Sun, 7 Nov 2010 20:38:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214948 - head/sys/arm/xscale/ixp425 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 20:38:15 -0000 Author: thompsa Date: Sun Nov 7 20:38:14 2010 New Revision: 214948 URL: http://svn.freebsd.org/changeset/base/214948 Log: Remove line for the uncommitted Cambria gpio drive that snuck in with r214946. Modified: head/sys/arm/xscale/ixp425/files.avila Modified: head/sys/arm/xscale/ixp425/files.avila ============================================================================== --- head/sys/arm/xscale/ixp425/files.avila Sun Nov 7 20:37:25 2010 (r214947) +++ head/sys/arm/xscale/ixp425/files.avila Sun Nov 7 20:38:14 2010 (r214948) @@ -6,5 +6,4 @@ arm/xscale/ixp425/avila_gpio.c optional arm/xscale/ixp425/cambria_exp_space.c standard arm/xscale/ixp425/cambria_fled.c optional cambria_fled arm/xscale/ixp425/cambria_led.c optional cambria_led -arm/xscale/ixp425/cambria_gpio.c optional cambria_gpio arm/xscale/ixp425/ixdp425_pci.c optional pci From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 20:40:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66E721065670; Sun, 7 Nov 2010 20:40:00 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54A468FC15; Sun, 7 Nov 2010 20:40:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7Ke0rb078984; Sun, 7 Nov 2010 20:40:00 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Ke0aT078981; Sun, 7 Nov 2010 20:40:00 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201011072040.oA7Ke0aT078981@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 7 Nov 2010 20:40:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214949 - head/contrib/gdb/gdb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 20:40:00 -0000 Author: gonzo Date: Sun Nov 7 20:40:00 2010 New Revision: 214949 URL: http://svn.freebsd.org/changeset/base/214949 Log: Change register numbers according to current struct reg and struct fpreg in src/sys/mips/include/reg.h Modified: head/contrib/gdb/gdb/mips-tdep.h head/contrib/gdb/gdb/mipsfbsd-tdep.h Modified: head/contrib/gdb/gdb/mips-tdep.h ============================================================================== --- head/contrib/gdb/gdb/mips-tdep.h Sun Nov 7 20:38:14 2010 (r214948) +++ head/contrib/gdb/gdb/mips-tdep.h Sun Nov 7 20:40:00 2010 (r214949) @@ -78,7 +78,7 @@ enum { MIPS_EMBED_BADVADDR_REGNUM = 35, MIPS_EMBED_CAUSE_REGNUM = 36, MIPS_EMBED_PC_REGNUM = 37, - MIPS_EMBED_FP0_REGNUM = 38 + MIPS_EMBED_FP0_REGNUM = 40 }; /* Defined in mips-tdep.c and used in remote-mips.c */ Modified: head/contrib/gdb/gdb/mipsfbsd-tdep.h ============================================================================== --- head/contrib/gdb/gdb/mipsfbsd-tdep.h Sun Nov 7 20:38:14 2010 (r214948) +++ head/contrib/gdb/gdb/mipsfbsd-tdep.h Sun Nov 7 20:40:00 2010 (r214949) @@ -34,7 +34,7 @@ void mipsfbsd_fill_reg (char *, int); void mipsfbsd_supply_fpreg (char *, int); void mipsfbsd_fill_fpreg (char *, int); -#define SIZEOF_STRUCT_REG (38 * mips_regsize (current_gdbarch)) -#define SIZEOF_STRUCT_FPREG (33 * mips_regsize (current_gdbarch)) +#define SIZEOF_STRUCT_REG (40 * mips_regsize (current_gdbarch)) +#define SIZEOF_STRUCT_FPREG (34 * mips_regsize (current_gdbarch)) #endif /* mipsfbsd_TDEP_H */ From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 20:44:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD750106566C; Sun, 7 Nov 2010 20:44:46 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB95B8FC14; Sun, 7 Nov 2010 20:44:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7KikZ1079635; Sun, 7 Nov 2010 20:44:46 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Kik8A079633; Sun, 7 Nov 2010 20:44:46 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201011072044.oA7Kik8A079633@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 7 Nov 2010 20:44:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214950 - head/contrib/binutils/bfd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 20:44:46 -0000 Author: gonzo Date: Sun Nov 7 20:44:46 2010 New Revision: 214950 URL: http://svn.freebsd.org/changeset/base/214950 Log: Prevent endless loop by detecting broken MIPS.options Modified: head/contrib/binutils/bfd/elfxx-mips.c Modified: head/contrib/binutils/bfd/elfxx-mips.c ============================================================================== --- head/contrib/binutils/bfd/elfxx-mips.c Sun Nov 7 20:40:00 2010 (r214949) +++ head/contrib/binutils/bfd/elfxx-mips.c Sun Nov 7 20:44:46 2010 (r214950) @@ -4330,6 +4330,15 @@ _bfd_mips_elf_section_processing (bfd *a bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l, &intopt); + if (intopt.size < sizeof (Elf_External_Options)) + { + (*_bfd_error_handler) + (_("Warning: bad `%s' option size %u smaller than its header"), + MIPS_ELF_OPTIONS_SECTION_NAME (abfd), intopt.size); + break; + } + + if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO) { bfd_byte buf[8]; @@ -4542,6 +4551,14 @@ _bfd_mips_elf_section_from_shdr (bfd *ab bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l, &intopt); + if (intopt.size < sizeof (Elf_External_Options)) + { + (*_bfd_error_handler) + (_("Warning: bad `%s' option size %u smaller than its header"), + MIPS_ELF_OPTIONS_SECTION_NAME (abfd), intopt.size); + break; + } + if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO) { Elf64_Internal_RegInfo intreg; From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 20:53:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7CCD106564A; Sun, 7 Nov 2010 20:53:19 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 527B38FC1E; Sun, 7 Nov 2010 20:53:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7KrJIf080866; Sun, 7 Nov 2010 20:53:19 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7KrJg6080863; Sun, 7 Nov 2010 20:53:19 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201011072053.oA7KrJg6080863@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 7 Nov 2010 20:53:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214951 - head/gnu/usr.bin/gdb/arch/mips X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 20:53:19 -0000 Author: gonzo Date: Sun Nov 7 20:53:19 2010 New Revision: 214951 URL: http://svn.freebsd.org/changeset/base/214951 Log: Link threads support to the build Modified: head/gnu/usr.bin/gdb/arch/mips/Makefile head/gnu/usr.bin/gdb/arch/mips/init.c Modified: head/gnu/usr.bin/gdb/arch/mips/Makefile ============================================================================== --- head/gnu/usr.bin/gdb/arch/mips/Makefile Sun Nov 7 20:44:46 2010 (r214950) +++ head/gnu/usr.bin/gdb/arch/mips/Makefile Sun Nov 7 20:53:19 2010 (r214951) @@ -1,7 +1,7 @@ # $FreeBSD$ .if !defined(GDB_CROSS_DEBUGGER) -LIBSRCS+= mipsfbsd-nat.c +LIBSRCS+= mipsfbsd-nat.c fbsd-threads.c .endif LIBSRCS+= solib.c solib-svr4.c LIBSRCS+= mips-tdep.c mipsfbsd-tdep.c fbsd-proc.c Modified: head/gnu/usr.bin/gdb/arch/mips/init.c ============================================================================== --- head/gnu/usr.bin/gdb/arch/mips/init.c Sun Nov 7 20:44:46 2010 (r214950) +++ head/gnu/usr.bin/gdb/arch/mips/init.c Sun Nov 7 20:53:19 2010 (r214951) @@ -131,6 +131,7 @@ initialize_all_files (void) _initialize_infptrace (); _initialize_inftarg (); _initialize_solib (); + _initialize_thread_db (); _initialize_svr4_solib (); #if 0 _initialize_svr4_lm (); From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 20:56:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D53F106564A; Sun, 7 Nov 2010 20:56:41 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6AC6B8FC08; Sun, 7 Nov 2010 20:56: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 oA7KufoG081201; Sun, 7 Nov 2010 20:56:41 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7KufOm081199; Sun, 7 Nov 2010 20:56:41 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201011072056.oA7KufOm081199@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 7 Nov 2010 20:56:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214952 - head/gnu/usr.bin/gdb/kgdb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 20:56:41 -0000 Author: gonzo Date: Sun Nov 7 20:56:41 2010 New Revision: 214952 URL: http://svn.freebsd.org/changeset/base/214952 Log: - Use proper constant for accessing PCB intead of hardcoded numbers - Minor clean-up Modified: head/gnu/usr.bin/gdb/kgdb/trgt_mips.c Modified: head/gnu/usr.bin/gdb/kgdb/trgt_mips.c ============================================================================== --- head/gnu/usr.bin/gdb/kgdb/trgt_mips.c Sun Nov 7 20:53:19 2010 (r214951) +++ head/gnu/usr.bin/gdb/kgdb/trgt_mips.c Sun Nov 7 20:56:41 2010 (r214952) @@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include "kgdb.h" void @@ -61,24 +63,26 @@ kgdb_trgt_fetch_registers(int regno __un warnx("kvm_read: %s", kvm_geterr(kvm)); memset(&pcb, 0, sizeof(pcb)); } - supply_register(MIPS_S0_REGNUM, (char *)&pcb.pcb_context[0]); - supply_register(MIPS_S1_REGNUM, (char *)&pcb.pcb_context[1]); - supply_register(MIPS_S2_REGNUM, (char *)&pcb.pcb_context[2]); - supply_register(MIPS_S3_REGNUM, (char *)&pcb.pcb_context[3]); - supply_register(MIPS_S4_REGNUM, (char *)&pcb.pcb_context[4]); - supply_register(MIPS_S5_REGNUM, (char *)&pcb.pcb_context[5]); - supply_register(MIPS_S6_REGNUM, (char *)&pcb.pcb_context[6]); - supply_register(MIPS_S7_REGNUM, (char *)&pcb.pcb_context[7]); - supply_register(MIPS_SP_REGNUM, (char *)&pcb.pcb_context[8]); - supply_register(MIPS_FP_REGNUM, (char *)&pcb.pcb_context[9]); - supply_register(MIPS_RA_REGNUM, (char *)&pcb.pcb_context[10]); + + supply_register(MIPS_S0_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S0]); + supply_register(MIPS_S1_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S1]); + supply_register(MIPS_S2_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S2]); + supply_register(MIPS_S3_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S3]); + supply_register(MIPS_S4_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S4]); + supply_register(MIPS_S5_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S5]); + supply_register(MIPS_S6_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S6]); + supply_register(MIPS_S7_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S7]); + supply_register(MIPS_SP_REGNUM, (char *)&pcb.pcb_context[PCB_REG_SP]); + supply_register(MIPS_FP_REGNUM, (char *)&pcb.pcb_context[PCB_REG_GP]); + supply_register(MIPS_RA_REGNUM, (char *)&pcb.pcb_context[PCB_REG_RA]); + supply_register(MIPS_EMBED_PC_REGNUM, (char *)&pcb.pcb_context[PCB_REG_PC]); } void kgdb_trgt_store_registers(int regno __unused) { - fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__); + fprintf_unfiltered(gdb_stderr, "Unimplemented function: %s\n", __func__); } void @@ -127,7 +131,7 @@ static int kgdb_trgt_frame_offset[] = { }; static struct kgdb_frame_cache * -kgdb_trgt_frame_cache(struct frame_info *next_frame __unused, void **this_cache __unused) +kgdb_trgt_frame_cache(struct frame_info *next_frame, void **this_cache) { char buf[MAX_REGISTER_SIZE]; struct kgdb_frame_cache *cache; @@ -192,7 +196,7 @@ static const struct frame_unwind kgdb_tr }; const struct frame_unwind * -kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame __unused) +kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame) { char *pname; CORE_ADDR pc; @@ -207,6 +211,5 @@ kgdb_trgt_trapframe_sniffer(struct frame (strcmp(pname, "MipsUserIntr") == 0) || (strcmp(pname, "MipsUserGenException") == 0)) return (&kgdb_trgt_trapframe_unwind); - /* printf("%s: %llx =%s\n", __func__, pc, pname); */ return (NULL); } From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 21:40:35 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EFE0106566B; Sun, 7 Nov 2010 21:40:35 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D81C8FC1C; Sun, 7 Nov 2010 21:40:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7LeYxx084698; Sun, 7 Nov 2010 21:40:34 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7LeY8j084696; Sun, 7 Nov 2010 21:40:34 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201011072140.oA7LeY8j084696@svn.freebsd.org> From: Alan Cox Date: Sun, 7 Nov 2010 21:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214953 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 21:40:35 -0000 Author: alc Date: Sun Nov 7 21:40:34 2010 New Revision: 214953 URL: http://svn.freebsd.org/changeset/base/214953 Log: In case the stack size reaches its limit and its growth must be restricted, ensure that grow_amount is a multiple of the page size. Otherwise, the kernel may crash in swap_reserve_by_uid() on HEAD and FreeBSD 8.x, and produce a core file with a missing stack on FreeBSD 7.x. Diagnosed and reported by: jilles Reviewed by: kib MFC after: 1 week Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sun Nov 7 20:56:41 2010 (r214952) +++ head/sys/vm/vm_map.c Sun Nov 7 21:40:34 2010 (r214953) @@ -3338,7 +3338,8 @@ Retry: if (grow_amount > stack_entry->avail_ssize) grow_amount = stack_entry->avail_ssize; if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > stacklim)) { - grow_amount = stacklim - ctob(vm->vm_ssize); + grow_amount = trunc_page((vm_size_t)stacklim) - + ctob(vm->vm_ssize); } /* If we would blow our VMEM resource limit, no go */ From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 21:48:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D73C9106566B; Sun, 7 Nov 2010 21:48:49 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C57618FC0C; Sun, 7 Nov 2010 21:48:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7LmnE1085414; Sun, 7 Nov 2010 21:48:49 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7LmnvE085412; Sun, 7 Nov 2010 21:48:49 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201011072148.oA7LmnvE085412@svn.freebsd.org> From: Alan Cox Date: Sun, 7 Nov 2010 21:48:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214954 - head/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 21:48:49 -0000 Author: alc Date: Sun Nov 7 21:48:49 2010 New Revision: 214954 URL: http://svn.freebsd.org/changeset/base/214954 Log: Don't call pmap_demote_DMAP() on MTRR entries from the BIOS that are marked as "bogus". Reported by: Jia-Shiun Li Modified: head/sys/amd64/amd64/amd64_mem.c Modified: head/sys/amd64/amd64/amd64_mem.c ============================================================================== --- head/sys/amd64/amd64/amd64_mem.c Sun Nov 7 21:40:34 2010 (r214953) +++ head/sys/amd64/amd64/amd64_mem.c Sun Nov 7 21:48:49 2010 (r214954) @@ -583,7 +583,7 @@ amd64_mrset(struct mem_range_softc *sc, i = (sc->mr_cap & MR686_FIXMTRR) ? MTRR_N64K + MTRR_N16K + MTRR_N4K : 0; mrd = sc->mr_desc + i; for (; i < sc->mr_ndesc; i++, mrd++) { - if (mrd->mr_flags & MDF_ACTIVE) + if ((mrd->mr_flags & (MDF_ACTIVE | MDF_BOGUS)) == MDF_ACTIVE) pmap_demote_DMAP(mrd->mr_base, mrd->mr_len, FALSE); } @@ -688,7 +688,7 @@ amd64_mrinit(struct mem_range_softc *sc) i = (sc->mr_cap & MR686_FIXMTRR) ? MTRR_N64K + MTRR_N16K + MTRR_N4K : 0; mrd = sc->mr_desc + i; for (; i < sc->mr_ndesc; i++, mrd++) { - if (mrd->mr_flags & MDF_ACTIVE) + if ((mrd->mr_flags & (MDF_ACTIVE | MDF_BOGUS)) == MDF_ACTIVE) pmap_demote_DMAP(mrd->mr_base, mrd->mr_len, TRUE); } } From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 21:57:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94A89106566C; Sun, 7 Nov 2010 21:57:57 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7713E8FC08; Sun, 7 Nov 2010 21:57:57 +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 oA7LvvVJ086192; Sun, 7 Nov 2010 21:57:57 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Lvvft086189; Sun, 7 Nov 2010 21:57:57 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <201011072157.oA7Lvvft086189@svn.freebsd.org> From: Nick Hibma Date: Sun, 7 Nov 2010 21:57:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214955 - head/tools/tools/nanobsd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 21:57:57 -0000 Author: n_hibma Date: Sun Nov 7 21:57:57 2010 New Revision: 214955 URL: http://svn.freebsd.org/changeset/base/214955 Log: - Set -x flag when executing customisation scripts to aid in debugging them. - Use KERNCONFDIR with KERNCONF instead of copying the kernel config into the source tree so included kernel configs work. - Put more stuff in the _.bk/_.ik log file, not just make statements. - Add the kernel config name to the pprint during kernel installation. - Add NANO_MODULES providing a list of modules to build and install. Reviewed by: imp MFC after: 2 weeks Modified: head/tools/tools/nanobsd/nanobsd.sh Modified: head/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- head/tools/tools/nanobsd/nanobsd.sh Sun Nov 7 21:48:49 2010 (r214954) +++ head/tools/tools/nanobsd/nanobsd.sh Sun Nov 7 21:57:57 2010 (r214955) @@ -75,6 +75,9 @@ CONF_WORLD=' ' # Kernel config file to use NANO_KERNEL=GENERIC +# Kernel modules to build; default is none +NANO_MODULES= + # Customize commands. NANO_CUSTOMIZE="" @@ -189,19 +192,26 @@ build_kernel ( ) ( pprint 2 "build kernel ($NANO_KERNEL)" pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.bk" + ( if [ -f ${NANO_KERNEL} ] ; then - cp ${NANO_KERNEL} ${NANO_SRC}/sys/${NANO_ARCH}/conf + kernconfdir=$(realpath $(dirname ${NANO_KERNEL})) + kernconf=$(basename ${NANO_KERNEL}) + else + kernconf=${NANO_KERNEL} fi - (cd ${NANO_SRC}; + cd ${NANO_SRC}; # unset these just in case to avoid compiler complaints # when cross-building unset TARGET_CPUTYPE unset TARGET_BIG_ENDIAN + # Note: We intentionally build all modules, not only the ones in + # NANO_MODULES so the built world can be reused by multiple images. env TARGET_ARCH=${NANO_ARCH} ${NANO_PMAKE} buildkernel \ - __MAKE_CONF=${NANO_MAKE_CONF_BUILD} KERNCONF=`basename ${NANO_KERNEL}` \ - > ${MAKEOBJDIRPREFIX}/_.bk 2>&1 - ) + __MAKE_CONF=${NANO_MAKE_CONF_BUILD} \ + ${kernconfdir:+"KERNCONFDIR="}${kernconfdir} \ + KERNCONF=${kernconf} + ) > ${MAKEOBJDIRPREFIX}/_.bk 2>&1 ) clean_world ( ) ( @@ -258,14 +268,25 @@ install_etc ( ) ( ) install_kernel ( ) ( - pprint 2 "install kernel" + pprint 2 "install kernel ($NANO_KERNEL)" pprint 3 "log: ${NANO_OBJ}/_.ik" + ( + if [ -f ${NANO_KERNEL} ] ; then + kernconfdir=$(realpath $(dirname ${NANO_KERNEL})) + kernconf=$(basename ${NANO_KERNEL}) + else + kernconf=${NANO_KERNEL} + fi + cd ${NANO_SRC} env TARGET_ARCH=${NANO_ARCH} ${NANO_PMAKE} installkernel \ DESTDIR=${NANO_WORLDDIR} \ - __MAKE_CONF=${NANO_MAKE_CONF_INSTALL} KERNCONF=`basename ${NANO_KERNEL}` \ - > ${NANO_OBJ}/_.ik 2>&1 + __MAKE_CONF=${NANO_MAKE_CONF_INSTALL} \ + ${kernconfdir:+"KERNCONFDIR="}${kernconfdir} \ + KERNCONF=${kernconf} \ + MODULES_OVERRIDE="${NANO_MODULES}" + ) > ${NANO_OBJ}/_.ik 2>&1 ) run_customize() ( @@ -276,7 +297,7 @@ run_customize() ( pprint 2 "customize \"$c\"" pprint 3 "log: ${NANO_OBJ}/_.cust.$c" pprint 4 "`type $c`" - ( $c ) > ${NANO_OBJ}/_.cust.$c 2>&1 + ( set -x ; $c ) > ${NANO_OBJ}/_.cust.$c 2>&1 done ) @@ -288,7 +309,7 @@ run_late_customize() ( pprint 2 "late customize \"$c\"" pprint 3 "log: ${NANO_OBJ}/_.late_cust.$c" pprint 4 "`type $c`" - ( $c ) > ${NANO_OBJ}/_.late_cust.$c 2>&1 + ( set -x ; $c ) > ${NANO_OBJ}/_.late_cust.$c 2>&1 done ) From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 22:24:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1922F1065672; Sun, 7 Nov 2010 22:24:18 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0404E8FC31; Sun, 7 Nov 2010 22:24:18 +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 oA7MOHRi088343; Sun, 7 Nov 2010 22:24:17 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7MOH72088341; Sun, 7 Nov 2010 22:24:17 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201011072224.oA7MOH72088341@svn.freebsd.org> From: Brian Somers Date: Sun, 7 Nov 2010 22:24:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214956 - in stable/8: sbin/growfs tools/regression/lib/msun tools/regression/sbin tools/regression/usr.bin/pkill tools/tools/ath/common tools/tools/termcap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 22:24:18 -0000 Author: brian Date: Sun Nov 7 22:24:17 2010 New Revision: 214956 URL: http://svn.freebsd.org/changeset/base/214956 Log: MFC r197763 and r212839: Handle extending a filesystem into unzeroed storage. Added: stable/8/tools/regression/sbin/ - copied from r212839, head/tools/regression/sbin/ Modified: stable/8/sbin/growfs/growfs.c Directory Properties: stable/8/sbin/growfs/ (props changed) stable/8/tools/ (props changed) stable/8/tools/build/mk/ (props changed) stable/8/tools/build/options/ (props changed) stable/8/tools/debugscripts/ (props changed) stable/8/tools/kerneldoc/subsys/ (props changed) stable/8/tools/regression/acltools/ (props changed) stable/8/tools/regression/aio/aiotest/ (props changed) stable/8/tools/regression/bin/sh/ (props changed) stable/8/tools/regression/fifo/ (props changed) stable/8/tools/regression/geom/ (props changed) stable/8/tools/regression/lib/libc/ (props changed) stable/8/tools/regression/lib/msun/test-conj.t (props changed) stable/8/tools/regression/mqueue/mqtest1/ (props changed) stable/8/tools/regression/mqueue/mqtest2/ (props changed) stable/8/tools/regression/mqueue/mqtest3/ (props changed) stable/8/tools/regression/mqueue/mqtest4/ (props changed) stable/8/tools/regression/mqueue/mqtest5/ (props changed) stable/8/tools/regression/poll/ (props changed) stable/8/tools/regression/posixsem/ (props changed) stable/8/tools/regression/priv/ (props changed) stable/8/tools/regression/usr.bin/ (props changed) stable/8/tools/regression/usr.bin/pkill/pgrep-_g.t (props changed) stable/8/tools/regression/usr.bin/pkill/pgrep-_s.t (props changed) stable/8/tools/regression/usr.bin/pkill/pkill-_g.t (props changed) stable/8/tools/regression/usr.bin/sed/ (props changed) stable/8/tools/regression/usr.bin/tr/ (props changed) stable/8/tools/test/ (props changed) stable/8/tools/tools/ (props changed) stable/8/tools/tools/ath/ (props changed) stable/8/tools/tools/ath/common/dumpregs.h (props changed) stable/8/tools/tools/ath/common/dumpregs_5210.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5211.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5212.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5416.c (props changed) stable/8/tools/tools/nanobsd/ (props changed) stable/8/tools/tools/netrate/ (props changed) stable/8/tools/tools/netrate/tcpp/ (props changed) stable/8/tools/tools/termcap/termcap.pl (props changed) stable/8/tools/tools/umastat/ (props changed) stable/8/tools/tools/vimage/ (props changed) Modified: stable/8/sbin/growfs/growfs.c ============================================================================== --- stable/8/sbin/growfs/growfs.c Sun Nov 7 21:57:57 2010 (r214955) +++ stable/8/sbin/growfs/growfs.c Sun Nov 7 22:24:17 2010 (r214956) @@ -371,16 +371,16 @@ static void initcg(int cylno, time_t utime, int fso, unsigned int Nflag) { DBG_FUNC("initcg") - static void *iobuf; + static caddr_t iobuf; long blkno, start; ufs2_daddr_t i, cbase, dmax; struct ufs1_dinode *dp1; struct csum *cs; uint d, dupper, dlower; - if (iobuf == NULL && (iobuf = malloc(sblock.fs_bsize)) == NULL) { + if (iobuf == NULL && (iobuf = malloc(sblock.fs_bsize * 3)) == NULL) errx(37, "panic: cannot allocate I/O buffer"); - } + /* * Determine block bounds for cylinder group. * Allow space for super block summary information in first @@ -400,7 +400,8 @@ initcg(int cylno, time_t utime, int fso, acg.cg_magic = CG_MAGIC; acg.cg_cgx = cylno; acg.cg_niblk = sblock.fs_ipg; - acg.cg_initediblk = sblock.fs_ipg; + acg.cg_initediblk = sblock.fs_ipg < 2 * INOPB(&sblock) ? + sblock.fs_ipg : 2 * INOPB(&sblock); acg.cg_ndblk = dmax - cbase; if (sblock.fs_contigsumsize > 0) acg.cg_nclusterblks = acg.cg_ndblk / sblock.fs_frag; @@ -533,11 +534,14 @@ initcg(int cylno, time_t utime, int fso, sblock.fs_cstotal.cs_nbfree += acg.cg_cs.cs_nbfree; sblock.fs_cstotal.cs_nifree += acg.cg_cs.cs_nifree; *cs = acg.cg_cs; + + memcpy(iobuf, &acg, sblock.fs_cgsize); + memset(iobuf + sblock.fs_cgsize, '\0', + sblock.fs_bsize * 3 - sblock.fs_cgsize); + wtfs(fsbtodb(&sblock, cgtod(&sblock, cylno)), - sblock.fs_bsize, (char *)&acg, fso, Nflag); - DBG_DUMP_CG(&sblock, - "new cg", - &acg); + sblock.fs_bsize * 3, iobuf, fso, Nflag); + DBG_DUMP_CG(&sblock, "new cg", &acg); DBG_LEAVE; return; @@ -2209,6 +2213,7 @@ main(int argc, char **argv) printf("Warning: %jd sector(s) cannot be allocated.\n", (intmax_t)fsbtodb(&sblock, sblock.fs_size % sblock.fs_fpg)); sblock.fs_size = sblock.fs_ncg * sblock.fs_fpg; + maxino -= sblock.fs_ipg; } /* From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 22:28:55 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C79A6106564A; Sun, 7 Nov 2010 22:28:55 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4FB18FC08; Sun, 7 Nov 2010 22:28:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7MStJV088960; Sun, 7 Nov 2010 22:28:55 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7MSt1c088958; Sun, 7 Nov 2010 22:28:55 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201011072228.oA7MSt1c088958@svn.freebsd.org> From: Brian Somers Date: Sun, 7 Nov 2010 22:28:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214957 - stable/8/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 22:28:55 -0000 Author: brian Date: Sun Nov 7 22:28:55 2010 New Revision: 214957 URL: http://svn.freebsd.org/changeset/base/214957 Log: MFC r198236 for now. Modified: stable/8/sbin/growfs/Makefile Directory Properties: stable/8/sbin/growfs/ (props changed) Modified: stable/8/sbin/growfs/Makefile ============================================================================== --- stable/8/sbin/growfs/Makefile Sun Nov 7 22:24:17 2010 (r214956) +++ stable/8/sbin/growfs/Makefile Sun Nov 7 22:28:55 2010 (r214957) @@ -10,8 +10,6 @@ PROG= growfs SRCS= growfs.c MAN= growfs.8 -WARNS?= 6 - .if defined(GFSDBG) SRCS+= debug.c .endif From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 22:33:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CD10106566B; Sun, 7 Nov 2010 22:33:56 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A36E8FC0C; Sun, 7 Nov 2010 22:33:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7MXtWn089241; Sun, 7 Nov 2010 22:33:55 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7MXtJF089239; Sun, 7 Nov 2010 22:33:55 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201011072233.oA7MXtJF089239@svn.freebsd.org> From: Brian Somers Date: Sun, 7 Nov 2010 22:33:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214958 - stable/8/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 22:33:56 -0000 Author: brian Date: Sun Nov 7 22:33:55 2010 New Revision: 214958 URL: http://svn.freebsd.org/changeset/base/214958 Log: MFC r212886 (by marcel): Unbreak the build on strong-aligned architectures. Modified: stable/8/sbin/growfs/growfs.c Directory Properties: stable/8/sbin/growfs/ (props changed) Modified: stable/8/sbin/growfs/growfs.c ============================================================================== --- stable/8/sbin/growfs/growfs.c Sun Nov 7 22:28:55 2010 (r214957) +++ stable/8/sbin/growfs/growfs.c Sun Nov 7 22:33:55 2010 (r214958) @@ -452,7 +452,7 @@ initcg(int cylno, time_t utime, int fso, bzero(iobuf, sblock.fs_bsize); for (i = 0; i < sblock.fs_ipg / INOPF(&sblock); i += sblock.fs_frag) { - dp1 = (struct ufs1_dinode *)iobuf; + dp1 = (struct ufs1_dinode *)(void *)iobuf; #ifdef FSIRAND for (j = 0; j < INOPB(&sblock); j++) { dp1->di_gen = random(); From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 22:51:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2A31106564A; Sun, 7 Nov 2010 22:51:54 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EDB88FC0A; Sun, 7 Nov 2010 22:51:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7Mpsjr090315; Sun, 7 Nov 2010 22:51:54 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7MpsBq090305; Sun, 7 Nov 2010 22:51:54 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201011072251.oA7MpsBq090305@svn.freebsd.org> From: "David E. O'Brien" Date: Sun, 7 Nov 2010 22:51:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214959 - head/usr.bin/yacc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 22:51:54 -0000 Author: obrien Date: Sun Nov 7 22:51:54 2010 New Revision: 214959 URL: http://svn.freebsd.org/changeset/base/214959 Log: Change to ANSI-C function definitions. Modified: head/usr.bin/yacc/Makefile head/usr.bin/yacc/closure.c head/usr.bin/yacc/error.c head/usr.bin/yacc/lalr.c head/usr.bin/yacc/lr0.c head/usr.bin/yacc/main.c head/usr.bin/yacc/mkpar.c head/usr.bin/yacc/output.c head/usr.bin/yacc/reader.c head/usr.bin/yacc/skeleton.c head/usr.bin/yacc/symtab.c head/usr.bin/yacc/verbose.c head/usr.bin/yacc/warshall.c Modified: head/usr.bin/yacc/Makefile ============================================================================== --- head/usr.bin/yacc/Makefile Sun Nov 7 22:33:55 2010 (r214958) +++ head/usr.bin/yacc/Makefile Sun Nov 7 22:51:54 2010 (r214959) @@ -9,6 +9,6 @@ MAN= yacc.1 yyfix.1 LINKS= ${BINDIR}/yacc ${BINDIR}/byacc MLINKS= yacc.1 byacc.1 -WARNS?= 2 +WARNS?= 6 .include Modified: head/usr.bin/yacc/closure.c ============================================================================== --- head/usr.bin/yacc/closure.c Sun Nov 7 22:33:55 2010 (r214958) +++ head/usr.bin/yacc/closure.c Sun Nov 7 22:51:54 2010 (r214959) @@ -62,7 +62,7 @@ static unsigned *EFF; static void -set_EFF() +set_EFF(void) { unsigned *row; int symbol; @@ -99,7 +99,7 @@ set_EFF() void -set_first_derives() +set_first_derives(void) { unsigned *rrow; unsigned *vrow; @@ -154,9 +154,7 @@ set_first_derives() void -closure(nucleus, n) -short *nucleus; -int n; +closure(short *nucleus, int n) { int ruleno; unsigned word; @@ -224,7 +222,7 @@ int n; void -finalize_closure() +finalize_closure(void) { FREE(itemset); FREE(ruleset); @@ -235,8 +233,7 @@ finalize_closure() #ifdef DEBUG static void -print_closure(n) -int n; +print_closure(int n) { short *isp; @@ -247,7 +244,7 @@ int n; static void -print_EFF() +print_EFF(void) { int i, j; unsigned *rowp; @@ -279,7 +276,7 @@ print_EFF() static void -print_first_derives() +print_first_derives(void) { int i; int j; Modified: head/usr.bin/yacc/error.c ============================================================================== --- head/usr.bin/yacc/error.c Sun Nov 7 22:33:55 2010 (r214958) +++ head/usr.bin/yacc/error.c Sun Nov 7 22:51:54 2010 (r214959) @@ -49,8 +49,7 @@ __FBSDID("$FreeBSD$"); static void print_pos(char *, char *); void -fatal(msg) -const char *msg; +fatal(const char *msg) { warnx("f - %s", msg); done(2); @@ -58,7 +57,7 @@ const char *msg; void -no_space() +no_space(void) { warnx("f - out of space"); done(2); @@ -66,8 +65,7 @@ no_space() void -open_error(filename) -const char *filename; +open_error(const char *filename) { warnx("f - cannot open \"%s\"", filename); done(2); @@ -75,7 +73,7 @@ const char *filename; void -unexpected_EOF() +unexpected_EOF(void) { warnx("e - line %d of \"%s\", unexpected end-of-file", lineno, input_file_name); @@ -84,9 +82,7 @@ unexpected_EOF() static void -print_pos(st_line, st_cptr) -char *st_line; -char *st_cptr; +print_pos(char *st_line, char *st_cptr) { char *s; @@ -112,10 +108,7 @@ char *st_cptr; void -syntax_error(st_lineno, st_line, st_cptr) -int st_lineno; -char *st_line; -char *st_cptr; +syntax_error(int st_lineno, char *st_line, char *st_cptr) { warnx("e - line %d of \"%s\", syntax error", st_lineno, input_file_name); @@ -125,10 +118,7 @@ char *st_cptr; void -unterminated_comment(c_lineno, c_line, c_cptr) -int c_lineno; -char *c_line; -char *c_cptr; +unterminated_comment(int c_lineno, char *c_line, char *c_cptr) { warnx("e - line %d of \"%s\", unmatched /*", c_lineno, input_file_name); @@ -138,10 +128,7 @@ char *c_cptr; void -unterminated_string(s_lineno, s_line, s_cptr) -int s_lineno; -char *s_line; -char *s_cptr; +unterminated_string(int s_lineno, char *s_line, char *s_cptr) { warnx("e - line %d of \"%s\", unterminated string", s_lineno, input_file_name); @@ -151,10 +138,7 @@ char *s_cptr; void -unterminated_text(t_lineno, t_line, t_cptr) -int t_lineno; -char *t_line; -char *t_cptr; +unterminated_text(int t_lineno, char *t_line, char *t_cptr) { warnx("e - line %d of \"%s\", unmatched %%{", t_lineno, input_file_name); @@ -164,10 +148,7 @@ char *t_cptr; void -unterminated_union(u_lineno, u_line, u_cptr) -int u_lineno; -char *u_line; -char *u_cptr; +unterminated_union(int u_lineno, char *u_line, char *u_cptr) { warnx("e - line %d of \"%s\", unterminated %%union declaration", u_lineno, input_file_name); @@ -177,8 +158,7 @@ char *u_cptr; void -over_unionized(u_cptr) -char *u_cptr; +over_unionized(char *u_cptr) { warnx("e - line %d of \"%s\", too many %%union declarations", lineno, input_file_name); @@ -188,10 +168,7 @@ char *u_cptr; void -illegal_tag(t_lineno, t_line, t_cptr) -int t_lineno; -char *t_line; -char *t_cptr; +illegal_tag(int t_lineno, char *t_line, char *t_cptr) { warnx("e - line %d of \"%s\", illegal tag", t_lineno, input_file_name); print_pos(t_line, t_cptr); @@ -200,8 +177,7 @@ char *t_cptr; void -illegal_character(c_cptr) -char *c_cptr; +illegal_character(char *c_cptr) { warnx("e - line %d of \"%s\", illegal character", lineno, input_file_name); print_pos(line, c_cptr); @@ -210,8 +186,7 @@ char *c_cptr; void -used_reserved(s) -char *s; +used_reserved(char *s) { warnx("e - line %d of \"%s\", illegal use of reserved symbol %s", lineno, input_file_name, s); @@ -220,8 +195,7 @@ char *s; void -tokenized_start(s) -char *s; +tokenized_start(char *s) { warnx("e - line %d of \"%s\", the start symbol %s cannot be \ declared to be a token", lineno, input_file_name, s); @@ -230,8 +204,7 @@ declared to be a token", lineno, input_f void -retyped_warning(s) -char *s; +retyped_warning(char *s) { warnx("w - line %d of \"%s\", the type of %s has been redeclared", lineno, input_file_name, s); @@ -239,8 +212,7 @@ char *s; void -reprec_warning(s) -char *s; +reprec_warning(char *s) { warnx("w - line %d of \"%s\", the precedence of %s has been redeclared", lineno, input_file_name, s); @@ -248,8 +220,7 @@ char *s; void -revalued_warning(s) -char *s; +revalued_warning(char *s) { warnx("w - line %d of \"%s\", the value of %s has been redeclared", lineno, input_file_name, s); @@ -257,8 +228,7 @@ char *s; void -terminal_start(s) -char *s; +terminal_start(char *s) { warnx("e - line %d of \"%s\", the start symbol %s is a token", lineno, input_file_name, s); @@ -267,7 +237,7 @@ char *s; void -restarted_warning() +restarted_warning(void) { warnx("w - line %d of \"%s\", the start symbol has been redeclared", lineno, input_file_name); @@ -275,7 +245,7 @@ restarted_warning() void -no_grammar() +no_grammar(void) { warnx("e - line %d of \"%s\", no grammar has been specified", lineno, input_file_name); @@ -284,8 +254,7 @@ no_grammar() void -terminal_lhs(s_lineno) -int s_lineno; +terminal_lhs(int s_lineno) { warnx("e - line %d of \"%s\", a token appears on the lhs of a production", s_lineno, input_file_name); @@ -294,7 +263,7 @@ int s_lineno; void -prec_redeclared() +prec_redeclared(void) { warnx("w - line %d of \"%s\", conflicting %%prec specifiers", lineno, input_file_name); @@ -302,10 +271,7 @@ prec_redeclared() void -unterminated_action(a_lineno, a_line, a_cptr) -int a_lineno; -char *a_line; -char *a_cptr; +unterminated_action(int a_lineno, char *a_line, char *a_cptr) { warnx("e - line %d of \"%s\", unterminated action", a_lineno, input_file_name); @@ -315,9 +281,7 @@ char *a_cptr; void -dollar_warning(a_lineno, i) -int a_lineno; -int i; +dollar_warning(int a_lineno, int i) { warnx("w - line %d of \"%s\", $%d references beyond the \ end of the current rule", a_lineno, input_file_name, i); @@ -325,10 +289,7 @@ end of the current rule", a_lineno, inpu void -dollar_error(a_lineno, a_line, a_cptr) -int a_lineno; -char *a_line; -char *a_cptr; +dollar_error(int a_lineno, char *a_line, char *a_cptr) { warnx("e - line %d of \"%s\", illegal $-name", a_lineno, input_file_name); print_pos(a_line, a_cptr); @@ -337,7 +298,7 @@ char *a_cptr; void -untyped_lhs() +untyped_lhs(void) { warnx("e - line %d of \"%s\", $$ is untyped", lineno, input_file_name); done(1); @@ -345,9 +306,7 @@ untyped_lhs() void -untyped_rhs(i, s) -int i; -char *s; +untyped_rhs(int i, char *s) { warnx("e - line %d of \"%s\", $%d (%s) is untyped", lineno, input_file_name, i, s); @@ -356,8 +315,7 @@ char *s; void -unknown_rhs(i) -int i; +unknown_rhs(int i) { warnx("e - line %d of \"%s\", $%d is untyped", lineno, input_file_name, i); done(1); @@ -365,7 +323,7 @@ int i; void -default_action_warning() +default_action_warning(void) { warnx("w - line %d of \"%s\", the default action assigns an \ undefined value to $$", lineno, input_file_name); @@ -373,8 +331,7 @@ undefined value to $$", lineno, input_fi void -undefined_goal(s) -char *s; +undefined_goal(char *s) { warnx("e - the start symbol %s is undefined", s); done(1); @@ -382,8 +339,7 @@ char *s; void -undefined_symbol_warning(s) -char *s; +undefined_symbol_warning(char *s) { warnx("w - the symbol %s is undefined", s); } Modified: head/usr.bin/yacc/lalr.c ============================================================================== --- head/usr.bin/yacc/lalr.c Sun Nov 7 22:33:55 2010 (r214958) +++ head/usr.bin/yacc/lalr.c Sun Nov 7 22:51:54 2010 (r214959) @@ -96,7 +96,7 @@ static int top; void -lalr() +lalr(void) { tokensetsize = WORDSIZE(ntokens); @@ -116,7 +116,7 @@ lalr() static void -set_state_table() +set_state_table(void) { core *sp; @@ -128,7 +128,7 @@ set_state_table() static void -set_accessing_symbol() +set_accessing_symbol(void) { core *sp; @@ -140,7 +140,7 @@ set_accessing_symbol() static void -set_shift_table() +set_shift_table(void) { shifts *sp; @@ -152,7 +152,7 @@ set_shift_table() static void -set_reduction_table() +set_reduction_table(void) { reductions *rp; @@ -164,7 +164,7 @@ set_reduction_table() static void -set_maxrhs() +set_maxrhs(void) { short *itemp; short *item_end; @@ -193,7 +193,7 @@ set_maxrhs() static void -initialize_LA() +initialize_LA(void) { int i, j, k; reductions *rp; @@ -231,7 +231,7 @@ initialize_LA() static void -set_goto_map() +set_goto_map(void) { shifts *sp; int i; @@ -301,9 +301,7 @@ set_goto_map() /* Map_goto maps a state/symbol pair into its numeric representation. */ static int -map_goto(state, symbol) -int state; -int symbol; +map_goto(int state, int symbol) { int high; int low; @@ -330,7 +328,7 @@ int symbol; static void -initialize_F() +initialize_F(void) { int i; int j; @@ -408,7 +406,7 @@ initialize_F() static void -build_relations() +build_relations(void) { int i; int j; @@ -501,8 +499,7 @@ build_relations() static void -add_lookback_edge(stateno, ruleno, gotono) -int stateno, ruleno, gotono; +add_lookback_edge(int stateno, int ruleno, int gotono) { int i, k; int found; @@ -529,9 +526,7 @@ int stateno, ruleno, gotono; static short ** -transpose(R, n) -short **R; -int n; +transpose(short **R, int n) { short **new_R; short **temp_R; @@ -587,14 +582,14 @@ int n; static void -compute_FOLLOWS() +compute_FOLLOWS(void) { digraph(includes); } static void -compute_lookaheads() +compute_lookaheads(void) { int i, n; unsigned *fp1, *fp2, *fp3; @@ -629,8 +624,7 @@ compute_lookaheads() static void -digraph(relation) -short **relation; +digraph(short **relation) { int i; @@ -655,9 +649,7 @@ short **relation; static void -traverse(i, R) -int i; -short **R; +traverse(int i, short **R) { unsigned *fp1; unsigned *fp2; Modified: head/usr.bin/yacc/lr0.c ============================================================================== --- head/usr.bin/yacc/lr0.c Sun Nov 7 22:33:55 2010 (r214958) +++ head/usr.bin/yacc/lr0.c Sun Nov 7 22:51:54 2010 (r214959) @@ -91,7 +91,7 @@ static short *kernel_items; static void -allocate_itemsets() +allocate_itemsets(void) { short *itemp; short *item_end; @@ -134,7 +134,7 @@ allocate_itemsets() static void -allocate_storage() +allocate_storage(void) { allocate_itemsets(); shiftset = NEW2(nsyms, short); @@ -144,7 +144,7 @@ allocate_storage() static void -append_states() +append_states(void) { int i; int j; @@ -174,7 +174,7 @@ append_states() static void -free_storage() +free_storage(void) { FREE(shift_symbol); FREE(redset); @@ -188,7 +188,7 @@ free_storage() static void -generate_states() +generate_states(void) { allocate_storage(); itemset = NEW2(nitems, short); @@ -216,8 +216,7 @@ generate_states() static int -get_state(symbol) -int symbol; +get_state(int symbol) { int key; short *isp1; @@ -281,7 +280,7 @@ int symbol; static void -initialize_states() +initialize_states(void) { int i; short *start_derives; @@ -309,7 +308,7 @@ initialize_states() static void -new_itemsets() +new_itemsets(void) { int i; int shiftcount; @@ -346,8 +345,7 @@ new_itemsets() static core * -new_state(symbol) -int symbol; +new_state(int symbol) { int n; core *p; @@ -387,7 +385,7 @@ int symbol; #if 0 /* show_cores is used for debugging */ -show_cores() +show_cores(void) { core *p; int i, j, k, n; @@ -422,7 +420,7 @@ show_cores() /* show_ritems is used for debugging */ -show_ritems() +show_ritems(void) { int i; @@ -432,7 +430,7 @@ show_ritems() /* show_rrhs is used for debugging */ -show_rrhs() +show_rrhs(void) { int i; @@ -443,7 +441,7 @@ show_rrhs() /* show_shifts is used for debugging */ -show_shifts() +show_shifts(void) { shifts *p; int i, j, k; @@ -463,7 +461,7 @@ show_shifts() static void -save_shifts() +save_shifts(void) { shifts *p; short *sp1; @@ -498,7 +496,7 @@ save_shifts() static void -save_reductions() +save_reductions(void) { short *isp; short *rp1; @@ -548,7 +546,7 @@ save_reductions() static void -set_derives() +set_derives(void) { int i, k; int lhs; @@ -588,7 +586,7 @@ free_derives() #ifdef DEBUG static void -print_derives() +print_derives(void) { int i; short *sp; @@ -611,7 +609,7 @@ print_derives() static void -set_nullable() +set_nullable(void) { int i, j; int empty; @@ -661,7 +659,7 @@ set_nullable() #if 0 -free_nullable() +free_nullable(void) { FREE(nullable); } @@ -669,7 +667,7 @@ free_nullable() void -lr0() +lr0(void) { set_derives(); set_nullable(); Modified: head/usr.bin/yacc/main.c ============================================================================== --- head/usr.bin/yacc/main.c Sun Nov 7 22:33:55 2010 (r214958) +++ head/usr.bin/yacc/main.c Sun Nov 7 22:51:54 2010 (r214959) @@ -115,8 +115,7 @@ static void usage(void); volatile sig_atomic_t sigdie; __dead2 void -done(k) -int k; +done(int k) { if (action_file) { fclose(action_file); unlink(action_file_name); } if (text_file) { fclose(text_file); unlink(text_file_name); } @@ -127,8 +126,7 @@ int k; static void -onintr(signo) - int signo __unused; +onintr(int signo __unused) { sigdie = 1; done(1); @@ -136,7 +134,7 @@ onintr(signo) static void -set_signals() +set_signals(void) { #ifdef SIGINT if (signal(SIGINT, SIG_IGN) != SIG_IGN) @@ -154,7 +152,7 @@ set_signals() static void -usage() +usage(void) { fprintf(stderr, "%s\n%s\n", "usage: yacc [-dlrtv] [-b file_prefix] [-o output_filename]", @@ -164,9 +162,7 @@ usage() static void -getargs(argc, argv) -int argc; -char *argv[]; +getargs(int argc, char *argv[]) { int ch; @@ -221,8 +217,7 @@ char *argv[]; char * -allocate(n) -unsigned n; +allocate(unsigned n) { char *p; @@ -237,7 +232,7 @@ unsigned n; static void -create_file_names() +create_file_names(void) { int i, len; const char *tmpdir; @@ -357,7 +352,7 @@ create_file_names() static void -open_files() +open_files(void) { int fd; Modified: head/usr.bin/yacc/mkpar.c ============================================================================== --- head/usr.bin/yacc/mkpar.c Sun Nov 7 22:33:55 2010 (r214958) +++ head/usr.bin/yacc/mkpar.c Sun Nov 7 22:51:54 2010 (r214959) @@ -73,7 +73,7 @@ static void unused_rules(void); void -make_parser() +make_parser(void) { int i; @@ -90,8 +90,7 @@ make_parser() static action * -parse_actions(stateno) -int stateno; +parse_actions(int stateno) { action *actions; @@ -102,8 +101,7 @@ int stateno; static action * -get_shifts(stateno) -int stateno; +get_shifts(int stateno) { action *actions, *temp; shifts *sp; @@ -137,9 +135,7 @@ int stateno; } static action * -add_reductions(stateno, actions) -int stateno; -action *actions; +add_reductions(int stateno, action *actions) { int i, j, m, n; int ruleno, tokensetsize; @@ -163,9 +159,7 @@ action *actions; static action * -add_reduce(actions, ruleno, symbol) -action *actions; -int ruleno, symbol; +add_reduce(action *actions, int ruleno, int symbol) { action *temp, *prev, *next; @@ -204,7 +198,7 @@ int ruleno, symbol; static void -find_final_state() +find_final_state(void) { int goal, i; short *tostate; @@ -222,7 +216,7 @@ find_final_state() static void -unused_rules() +unused_rules(void) { int i; action *p; @@ -256,7 +250,7 @@ unused_rules() static void -remove_conflicts() +remove_conflicts(void) { int i; int symbol; @@ -333,7 +327,7 @@ remove_conflicts() static void -total_conflicts() +total_conflicts(void) { /* Warn if s/r != expect or if any r/r */ if ((SRtotal != SRexpect) || RRtotal) @@ -352,8 +346,7 @@ total_conflicts() static int -sole_reduction(stateno) -int stateno; +sole_reduction(int stateno) { int count, ruleno; action *p; @@ -381,7 +374,7 @@ int stateno; static void -defreds() +defreds(void) { int i; @@ -391,8 +384,7 @@ defreds() } static void -free_action_row(p) -action *p; +free_action_row(action *p) { action *q; @@ -405,7 +397,7 @@ action *p; } void -free_parser() +free_parser(void) { int i; Modified: head/usr.bin/yacc/output.c ============================================================================== --- head/usr.bin/yacc/output.c Sun Nov 7 22:33:55 2010 (r214958) +++ head/usr.bin/yacc/output.c Sun Nov 7 22:51:54 2010 (r214959) @@ -95,7 +95,7 @@ static const char line_format[] = "#line void -output() +output(void) { free_itemsets(); free_shifts(); @@ -119,7 +119,7 @@ output() static void -output_prefix() +output_prefix(void) { if (symbol_prefix == NULL) symbol_prefix = "yy"; @@ -184,7 +184,7 @@ output_prefix() static void -output_rule_data() +output_rule_data(void) { int i; int j; @@ -232,7 +232,7 @@ output_rule_data() static void -output_yydefred() +output_yydefred(void) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 23:22:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51994106566B; Sun, 7 Nov 2010 23:22:23 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F40D8FC0A; Sun, 7 Nov 2010 23:22:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7NMNw3092307; Sun, 7 Nov 2010 23:22:23 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7NMNa4092305; Sun, 7 Nov 2010 23:22:23 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201011072322.oA7NMNa4092305@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 7 Nov 2010 23:22:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214960 - head/gnu/usr.bin/gdb/arch/mips X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 23:22:23 -0000 Author: gonzo Date: Sun Nov 7 23:22:22 2010 New Revision: 214960 URL: http://svn.freebsd.org/changeset/base/214960 Log: Fix initialization order:_initialize_svr4_solib should be called before _initialize_thread_db Modified: head/gnu/usr.bin/gdb/arch/mips/init.c Modified: head/gnu/usr.bin/gdb/arch/mips/init.c ============================================================================== --- head/gnu/usr.bin/gdb/arch/mips/init.c Sun Nov 7 22:51:54 2010 (r214959) +++ head/gnu/usr.bin/gdb/arch/mips/init.c Sun Nov 7 23:22:22 2010 (r214960) @@ -119,6 +119,8 @@ initialize_all_files (void) _initialize_mips_tdep (); _initialize_mipsfbsd_tdep (); _initialize_corelow (); + _initialize_solib (); + _initialize_svr4_solib (); _initialize_ser_hardwire (); _initialize_ser_pipe (); _initialize_ser_tcp (); @@ -130,9 +132,7 @@ initialize_all_files (void) _initialize_kernel_u_addr (); _initialize_infptrace (); _initialize_inftarg (); - _initialize_solib (); _initialize_thread_db (); - _initialize_svr4_solib (); #if 0 _initialize_svr4_lm (); #endif From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 23:22:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D973106566B; Sun, 7 Nov 2010 23:22:43 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A8F38FC14; Sun, 7 Nov 2010 23:22:43 +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 oA7NMh55092377; Sun, 7 Nov 2010 23:22:43 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7NMhb0092364; Sun, 7 Nov 2010 23:22:43 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201011072322.oA7NMhb0092364@svn.freebsd.org> From: "David E. O'Brien" Date: Sun, 7 Nov 2010 23:22:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214961 - head/usr.bin/yacc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 23:22:43 -0000 Author: obrien Date: Sun Nov 7 23:22:42 2010 New Revision: 214961 URL: http://svn.freebsd.org/changeset/base/214961 Log: Directly use memory allocation functions and remove needless casts in their usage. Also use associated modern types instead of k&r ones. Modified: head/usr.bin/yacc/closure.c head/usr.bin/yacc/defs.h head/usr.bin/yacc/lalr.c head/usr.bin/yacc/lr0.c head/usr.bin/yacc/main.c head/usr.bin/yacc/mkpar.c head/usr.bin/yacc/output.c head/usr.bin/yacc/reader.c head/usr.bin/yacc/skeleton.c head/usr.bin/yacc/symtab.c head/usr.bin/yacc/verbose.c Modified: head/usr.bin/yacc/closure.c ============================================================================== --- head/usr.bin/yacc/closure.c Sun Nov 7 23:22:22 2010 (r214960) +++ head/usr.bin/yacc/closure.c Sun Nov 7 23:22:42 2010 (r214961) @@ -149,7 +149,7 @@ set_first_derives(void) print_first_derives(); #endif - FREE(EFF); + free(EFF); } @@ -224,9 +224,9 @@ closure(short *nucleus, int n) void finalize_closure(void) { - FREE(itemset); - FREE(ruleset); - FREE(first_derives + ntokens * WORDSIZE(nrules)); + free(itemset); + free(ruleset); + free(first_derives + ntokens * WORDSIZE(nrules)); } Modified: head/usr.bin/yacc/defs.h ============================================================================== --- head/usr.bin/yacc/defs.h Sun Nov 7 23:22:22 2010 (r214960) +++ head/usr.bin/yacc/defs.h Sun Nov 7 23:22:42 2010 (r214961) @@ -133,12 +133,8 @@ /* storage allocation macros */ -#define CALLOC(k,n) (calloc((unsigned)(k),(unsigned)(n))) -#define FREE(x) (free((char*)(x))) -#define MALLOC(n) (malloc((unsigned)(n))) #define NEW(t) ((t*)allocate(sizeof(t))) -#define NEW2(n,t) ((t*)allocate((unsigned)((n)*sizeof(t)))) -#define REALLOC(p,n) (realloc((char*)(p),(unsigned)(n))) +#define NEW2(n,t) ((t*)allocate((n)*sizeof(t))) /* the structure of a symbol table entry */ @@ -304,7 +300,7 @@ extern short final_state; /* global functions */ -char *allocate(unsigned); +void *allocate(size_t); void closure(short *, int); void create_symbol_table(void); void default_action_warning(void); Modified: head/usr.bin/yacc/lalr.c ============================================================================== --- head/usr.bin/yacc/lalr.c Sun Nov 7 23:22:22 2010 (r214960) +++ head/usr.bin/yacc/lalr.c Sun Nov 7 23:22:42 2010 (r214961) @@ -293,7 +293,7 @@ set_goto_map(void) } } - FREE(temp_map + ntokens); + free(temp_map + ntokens); } @@ -396,11 +396,11 @@ initialize_F(void) for (i = 0; i < ngotos; i++) { if (reads[i]) - FREE(reads[i]); + free(reads[i]); } - FREE(reads); - FREE(edge); + free(reads); + free(edge); } @@ -487,14 +487,14 @@ build_relations(void) for (i = 0; i < ngotos; i++) if (includes[i]) - FREE(includes[i]); + free(includes[i]); - FREE(includes); + free(includes); includes = new_includes; - FREE(edge); - FREE(states); + free(edge); + free(states); } @@ -562,7 +562,7 @@ transpose(short **R, int n) } } - FREE(nedges); + free(nedges); for (i = 0; i < n; i++) { @@ -574,7 +574,7 @@ transpose(short **R, int n) } } - FREE(temp_R); + free(temp_R); return (new_R); } @@ -615,11 +615,11 @@ compute_lookaheads(void) for (sp = lookback[i]; sp; sp = next) { next = sp->next; - FREE(sp); + free(sp); } - FREE(lookback); - FREE(F); + free(lookback); + free(F); } @@ -642,8 +642,8 @@ digraph(short **relation) traverse(i, relation); } - FREE(INDEX); - FREE(VERTICES); + free(INDEX); + free(VERTICES); } Modified: head/usr.bin/yacc/lr0.c ============================================================================== --- head/usr.bin/yacc/lr0.c Sun Nov 7 23:22:22 2010 (r214960) +++ head/usr.bin/yacc/lr0.c Sun Nov 7 23:22:42 2010 (r214961) @@ -176,13 +176,13 @@ append_states(void) static void free_storage(void) { - FREE(shift_symbol); - FREE(redset); - FREE(shiftset); - FREE(kernel_base); - FREE(kernel_end); - FREE(kernel_items); - FREE(state_set); + free(shift_symbol); + free(redset); + free(shiftset); + free(kernel_base); + free(kernel_end); + free(kernel_items); + free(state_set); } @@ -290,7 +290,7 @@ initialize_states(void) for (i = 0; start_derives[i] >= 0; ++i) continue; - p = (core *) MALLOC(sizeof(core) + i*sizeof(short)); + p = malloc(sizeof(core) + i*sizeof(short)); if (p == 0) no_space(); p->next = 0; @@ -579,8 +579,8 @@ set_derives(void) #if 0 free_derives() { - FREE(derives[start_symbol]); - FREE(derives); + free(derives[start_symbol]); + free(derives); } #endif @@ -615,7 +615,7 @@ set_nullable(void) int empty; int done1; - nullable = MALLOC(nsyms); + nullable = malloc(nsyms); if (nullable == 0) no_space(); for (i = 0; i < nsyms; ++i) @@ -661,7 +661,7 @@ set_nullable(void) #if 0 free_nullable(void) { - FREE(nullable); + free(nullable); } #endif Modified: head/usr.bin/yacc/main.c ============================================================================== --- head/usr.bin/yacc/main.c Sun Nov 7 23:22:22 2010 (r214960) +++ head/usr.bin/yacc/main.c Sun Nov 7 23:22:42 2010 (r214961) @@ -216,15 +216,15 @@ getargs(int argc, char *argv[]) } -char * -allocate(unsigned n) +void * +allocate(size_t n) { - char *p; + void *p; p = NULL; if (n) { - p = CALLOC(1, n); + p = calloc(1, n); if (!p) no_space(); } return (p); @@ -245,11 +245,11 @@ create_file_names(void) if (len && tmpdir[len-1] != '/') ++i; - action_file_name = MALLOC(i); + action_file_name = malloc(i); if (action_file_name == 0) no_space(); - text_file_name = MALLOC(i); + text_file_name = malloc(i); if (text_file_name == 0) no_space(); - union_file_name = MALLOC(i); + union_file_name = malloc(i); if (union_file_name == 0) no_space(); strcpy(action_file_name, tmpdir); @@ -280,7 +280,7 @@ create_file_names(void) else { len = strlen(file_prefix); - output_file_name = MALLOC(len + 7); + output_file_name = malloc(len + 7); if (output_file_name == 0) no_space(); strcpy(output_file_name, file_prefix); @@ -289,7 +289,7 @@ create_file_names(void) if (rflag) { - code_file_name = MALLOC(len + 8); + code_file_name = malloc(len + 8); if (code_file_name == 0) no_space(); strcpy(code_file_name, file_prefix); @@ -314,7 +314,7 @@ create_file_names(void) if (dflag) { - defines_file_name = MALLOC(len + 7); + defines_file_name = malloc(len + 7); if (defines_file_name == 0) no_space(); strcpy(defines_file_name, file_prefix); @@ -332,7 +332,7 @@ create_file_names(void) if (vflag) { - verbose_file_name = MALLOC(len + 8); + verbose_file_name = malloc(len + 8); if (verbose_file_name == 0) no_space(); strcpy(verbose_file_name, file_prefix); Modified: head/usr.bin/yacc/mkpar.c ============================================================================== --- head/usr.bin/yacc/mkpar.c Sun Nov 7 23:22:22 2010 (r214960) +++ head/usr.bin/yacc/mkpar.c Sun Nov 7 23:22:42 2010 (r214961) @@ -221,7 +221,7 @@ unused_rules(void) int i; action *p; - rules_used = (short *) MALLOC(nrules*sizeof(short)); + rules_used = malloc(nrules*sizeof(short)); if (rules_used == 0) no_space(); for (i = 0; i < nrules; ++i) @@ -391,7 +391,7 @@ free_action_row(action *p) while (p) { q = p->next; - FREE(p); + free(p); p = q; } } @@ -404,5 +404,5 @@ free_parser(void) for (i = 0; i < nstates; i++) free_action_row(parser[i]); - FREE(parser); + free(parser); } Modified: head/usr.bin/yacc/output.c ============================================================================== --- head/usr.bin/yacc/output.c Sun Nov 7 23:22:22 2010 (r214960) +++ head/usr.bin/yacc/output.c Sun Nov 7 23:22:42 2010 (r214961) @@ -270,15 +270,15 @@ output_actions(void) width = NEW2(nvectors, short); token_actions(); - FREE(lookaheads); - FREE(LA); - FREE(LAruleno); - FREE(accessing_symbol); + free(lookaheads); + free(LA); + free(LAruleno); + free(accessing_symbol); goto_actions(); - FREE(goto_map + ntokens); - FREE(from_state); - FREE(to_state); + free(goto_map + ntokens); + free(from_state); + free(to_state); sort_actions(); pack_table(); @@ -370,7 +370,7 @@ token_actions(void) } } } - FREE(actionrow); + free(actionrow); } static void @@ -403,7 +403,7 @@ goto_actions(void) if (!rflag) outline += 2; fprintf(output_file, "\n};\n"); - FREE(state_count); + free(state_count); } static int @@ -555,14 +555,14 @@ pack_table(void) for (i = 0; i < nvectors; i++) { if (froms[i]) - FREE(froms[i]); + free(froms[i]); if (tos[i]) - FREE(tos[i]); + free(tos[i]); } - FREE(froms); - FREE(tos); - FREE(pos); + free(froms); + free(tos); + free(pos); } @@ -762,7 +762,7 @@ output_base(void) if (!rflag) outline += 2; fprintf(output_file, "\n};\n"); - FREE(base); + free(base); } @@ -795,7 +795,7 @@ output_table(void) if (!rflag) outline += 2; fprintf(output_file, "\n};\n"); - FREE(table); + free(table); } @@ -826,7 +826,7 @@ output_check(void) if (!rflag) outline += 2; fprintf(output_file, "\n};\n"); - FREE(check); + free(check); } @@ -972,7 +972,7 @@ output_debug(void) ++outline; fprintf(code_file, "#define YYMAXTOKEN %d\n", max); - symnam = (char **) MALLOC((max+1)*sizeof(char *)); + symnam = malloc((max+1)*sizeof(char *)); if (symnam == 0) no_space(); /* Note that it is not necessary to initialize the element */ @@ -1108,7 +1108,7 @@ output_debug(void) } if (!rflag) outline += 2; fprintf(output_file, "\n};\n"); - FREE(symnam); + free(symnam); if (!rflag) ++outline; fprintf(output_file, "const char * const %srule[] = {\n", symbol_prefix); @@ -1278,11 +1278,11 @@ free_itemsets(void) { core *cp, *next; - FREE(state_table); + free(state_table); for (cp = first_state; cp; cp = next) { next = cp->next; - FREE(cp); + free(cp); } } @@ -1292,11 +1292,11 @@ free_shifts(void) { shifts *sp, *next; - FREE(shift_table); + free(shift_table); for (sp = first_shift; sp; sp = next) { next = sp->next; - FREE(sp); + free(sp); } } @@ -1307,11 +1307,11 @@ free_reductions(void) { reductions *rp, *next; - FREE(reduction_table); + free(reduction_table); for (rp = first_reduction; rp; rp = next) { next = rp->next; - FREE(rp); + free(rp); } } @@ -1332,9 +1332,9 @@ increase_maxtable(int loc) newmax = maxtable; do { newmax += 200; } while (newmax <= loc); - table = (short *) REALLOC(table, newmax*sizeof(short)); + table = realloc(table, newmax*sizeof(short)); if (table == 0) no_space(); - check = (short *) REALLOC(check, newmax*sizeof(short)); + check = realloc(check, newmax*sizeof(short)); if (check == 0) no_space(); for (l = maxtable; l < newmax; ++l) { Modified: head/usr.bin/yacc/reader.c ============================================================================== --- head/usr.bin/yacc/reader.c Sun Nov 7 23:22:22 2010 (r214960) +++ head/usr.bin/yacc/reader.c Sun Nov 7 23:22:42 2010 (r214961) @@ -126,7 +126,7 @@ cachec(int c) if (cinc >= cache_size) { cache_size += 256; - cache = REALLOC(cache, cache_size); + cache = realloc(cache, cache_size); if (cache == 0) no_space(); } cache[cinc] = c; @@ -143,7 +143,7 @@ get_line(void) if (saw_eof || (c = getc(f)) == EOF) { - if (line) { FREE(line); line = 0; } + if (line) { free(line); line = 0; } cptr = 0; saw_eof = 1; return; @@ -151,9 +151,9 @@ get_line(void) if (line == 0 || linesize != (LINESIZE + 1)) { - if (line) FREE(line); + if (line) free(line); linesize = LINESIZE + 1; - line = MALLOC(linesize); + line = malloc(linesize); if (line == 0) no_space(); } @@ -166,7 +166,7 @@ get_line(void) if (++i >= linesize) { linesize += LINESIZE; - line = REALLOC(line, linesize); + line = realloc(line, linesize); if (line == 0) no_space(); } c = getc(f); @@ -189,7 +189,7 @@ dup_line(void) if (line == 0) return (0); s = line; while (*s != '\n') ++s; - p = MALLOC(s - line + 1); + p = malloc(s - line + 1); if (p == 0) no_space(); s = line; @@ -214,7 +214,7 @@ skip_comment(void) if (*s == '*' && s[1] == '/') { cptr = s + 2; - FREE(st_line); + free(st_line); return; } if (*s == '\n') @@ -435,7 +435,7 @@ loop: if (c == quote) { need_newline = 1; - FREE(s_line); + free(s_line); goto loop; } if (c == '\n') @@ -487,7 +487,7 @@ loop: { putc('/', f); ++cptr; - FREE(c_line); + free(c_line); goto loop; } if (c == '\n') @@ -507,7 +507,7 @@ loop: { if (need_newline) putc('\n', f); ++cptr; - FREE(t_line); + free(t_line); return; } /* FALLTHROUGH */ @@ -560,7 +560,7 @@ loop: if (--depth == 0) { fprintf(text_file, " YYSTYPE;\n"); - FREE(u_line); + free(u_line); return; } goto loop; @@ -580,7 +580,7 @@ loop: if (dflag) putc(c, union_file); if (c == quote) { - FREE(s_line); + free(s_line); goto loop; } if (c == '\n') @@ -642,7 +642,7 @@ loop: putc('/', text_file); if (dflag) putc('/', union_file); ++cptr; - FREE(c_line); + free(c_line); goto loop; } if (c == '\n') @@ -751,10 +751,10 @@ get_literal(void) } cachec(c); } - FREE(s_line); + free(s_line); n = cinc; - s = MALLOC(n); + s = malloc(n); if (s == 0) no_space(); for (i = 0; i < n; ++i) @@ -807,7 +807,7 @@ get_literal(void) bp->class = TERM; if (n == 1 && bp->value == UNDEFINED) bp->value = *(unsigned char *)s; - FREE(s); + free(s); return (bp); } @@ -900,17 +900,17 @@ get_tag(void) { tagmax += 16; tag_table = (char **) - (tag_table ? REALLOC(tag_table, tagmax*sizeof(char *)) - : MALLOC(tagmax*sizeof(char *))); + (tag_table ? realloc(tag_table, tagmax*sizeof(char *)) + : malloc(tagmax*sizeof(char *))); if (tag_table == 0) no_space(); } - s = MALLOC(cinc); + s = malloc(cinc); if (s == 0) no_space(); strcpy(s, cache); tag_table[ntags] = s; ++ntags; - FREE(t_line); + free(t_line); return (s); } @@ -1075,7 +1075,7 @@ read_declarations(void) int c, k; cache_size = 256; - cache = MALLOC(cache_size); + cache = malloc(cache_size); if (cache == 0) no_space(); for (;;) @@ -1128,7 +1128,7 @@ initialize_grammar(void) { nitems = 4; maxitems = 300; - pitem = (bucket **) MALLOC(maxitems*sizeof(bucket *)); + pitem = malloc(maxitems*sizeof(bucket *)); if (pitem == 0) no_space(); pitem[0] = 0; pitem[1] = 0; @@ -1137,17 +1137,17 @@ initialize_grammar(void) nrules = 3; maxrules = 100; - plhs = (bucket **) MALLOC(maxrules*sizeof(bucket *)); + plhs = malloc(maxrules*sizeof(bucket *)); if (plhs == 0) no_space(); plhs[0] = 0; plhs[1] = 0; plhs[2] = 0; - rprec = (short *) MALLOC(maxrules*sizeof(short)); + rprec = malloc(maxrules*sizeof(short)); if (rprec == 0) no_space(); rprec[0] = 0; rprec[1] = 0; rprec[2] = 0; - rassoc = (char *) MALLOC(maxrules*sizeof(char)); + rassoc = malloc(maxrules*sizeof(char)); if (rassoc == 0) no_space(); rassoc[0] = TOKEN; rassoc[1] = TOKEN; @@ -1159,7 +1159,7 @@ static void expand_items(void) { maxitems += 300; - pitem = (bucket **) REALLOC(pitem, maxitems*sizeof(bucket *)); + pitem = realloc(pitem, maxitems*sizeof(bucket *)); if (pitem == 0) no_space(); } @@ -1168,11 +1168,11 @@ static void expand_rules(void) { maxrules += 100; - plhs = (bucket **) REALLOC(plhs, maxrules*sizeof(bucket *)); + plhs = realloc(plhs, maxrules*sizeof(bucket *)); if (plhs == 0) no_space(); - rprec = (short *) REALLOC(rprec, maxrules*sizeof(short)); + rprec = realloc(rprec, maxrules*sizeof(short)); if (rprec == 0) no_space(); - rassoc = (char *) REALLOC(rassoc, maxrules*sizeof(char)); + rassoc = realloc(rassoc, maxrules*sizeof(char)); if (rassoc == 0) no_space(); } @@ -1367,7 +1367,7 @@ loop: { fprintf(f, "yyval.%s", tag); ++cptr; - FREE(d_line); + free(d_line); goto loop; } else if (isdigit(c)) @@ -1375,7 +1375,7 @@ loop: i = get_number(); if (i > n) dollar_warning(d_lineno, i); fprintf(f, "yyvsp[%d].%s", i - n, tag); - FREE(d_line); + free(d_line); goto loop; } else if (c == '-' && isdigit(cptr[1])) @@ -1383,7 +1383,7 @@ loop: ++cptr; i = -get_number() - n; fprintf(f, "yyvsp[%d].%s", i, tag); - FREE(d_line); + free(d_line); goto loop; } else @@ -1479,7 +1479,7 @@ loop: putc(c, f); if (c == quote) { - FREE(s_line); + free(s_line); goto loop; } if (c == '\n') @@ -1529,7 +1529,7 @@ loop: { putc('/', f); ++cptr; - FREE(c_line); + free(c_line); goto loop; } if (c == '\n') @@ -1636,9 +1636,9 @@ free_tags(void) for (i = 0; i < ntags; ++i) { assert(tag_table[i]); - FREE(tag_table[i]); + free(tag_table[i]); } - FREE(tag_table); + free(tag_table); } @@ -1651,7 +1651,7 @@ pack_names(void) name_pool_size = 13; /* 13 == sizeof("$end") + sizeof("$accept") */ for (bp = first_symbol; bp; bp = bp->next) name_pool_size += strlen(bp->name) + 1; - name_pool = MALLOC(name_pool_size); + name_pool = malloc(name_pool_size); if (name_pool == 0) no_space(); strcpy(name_pool, "$accept"); @@ -1662,7 +1662,7 @@ pack_names(void) p = t; s = bp->name; while ((*t++ = *s++)) continue; - FREE(bp->name); + free(bp->name); bp->name = p; } } @@ -1704,16 +1704,16 @@ pack_symbols(void) start_symbol = ntokens; nvars = nsyms - ntokens; - symbol_name = (char **) MALLOC(nsyms*sizeof(char *)); + symbol_name = malloc(nsyms*sizeof(char *)); if (symbol_name == 0) no_space(); - symbol_value = (short *) MALLOC(nsyms*sizeof(short)); + symbol_value = malloc(nsyms*sizeof(short)); if (symbol_value == 0) no_space(); - symbol_prec = (short *) MALLOC(nsyms*sizeof(short)); + symbol_prec = malloc(nsyms*sizeof(short)); if (symbol_prec == 0) no_space(); - symbol_assoc = MALLOC(nsyms); + symbol_assoc = malloc(nsyms); if (symbol_assoc == 0) no_space(); - v = (bucket **) MALLOC(nsyms*sizeof(bucket *)); + v = malloc(nsyms*sizeof(bucket *)); if (v == 0) no_space(); v[0] = 0; @@ -1808,7 +1808,7 @@ pack_symbols(void) symbol_assoc[k] = v[i]->assoc; } - FREE(v); + free(v); } @@ -1818,15 +1818,15 @@ pack_grammar(void) int i, j; int assoc, preced; - ritem = (short *) MALLOC(nitems*sizeof(short)); + ritem = malloc(nitems*sizeof(short)); if (ritem == 0) no_space(); - rlhs = (short *) MALLOC(nrules*sizeof(short)); + rlhs = malloc(nrules*sizeof(short)); if (rlhs == 0) no_space(); - rrhs = (short *) MALLOC((nrules+1)*sizeof(short)); + rrhs = malloc((nrules+1)*sizeof(short)); if (rrhs == 0) no_space(); - rprec = (short *) REALLOC(rprec, nrules*sizeof(short)); + rprec = realloc(rprec, nrules*sizeof(short)); if (rprec == 0) no_space(); - rassoc = REALLOC(rassoc, nrules); + rassoc = realloc(rassoc, nrules); if (rassoc == 0) no_space(); ritem[0] = -1; @@ -1867,8 +1867,8 @@ pack_grammar(void) } rrhs[i] = j; - FREE(plhs); - FREE(pitem); + free(plhs); + free(pitem); } Modified: head/usr.bin/yacc/skeleton.c ============================================================================== --- head/usr.bin/yacc/skeleton.c Sun Nov 7 23:22:22 2010 (r214960) +++ head/usr.bin/yacc/skeleton.c Sun Nov 7 23:22:42 2010 (r214961) @@ -157,14 +157,14 @@ const char *body[] = " else if ((newsize *= 2) > YYMAXDEPTH)", " newsize = YYMAXDEPTH;", " i = yyssp - yyss;", - " newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :", - " (short *)malloc(newsize * sizeof *newss);", + " newss = yyss ? realloc(yyss, newsize * sizeof *newss) :", + " malloc(newsize * sizeof *newss);", " if (newss == NULL)", " return -1;", " yyss = newss;", " yyssp = newss + i;", - " newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :", - " (YYSTYPE *)malloc(newsize * sizeof *newvs);", + " newvs = yyvs ? realloc(yyvs, newsize * sizeof *newvs) :", + " malloc(newsize * sizeof *newvs);", " if (newvs == NULL)", " return -1;", " yyvs = newvs;", Modified: head/usr.bin/yacc/symtab.c ============================================================================== --- head/usr.bin/yacc/symtab.c Sun Nov 7 23:22:22 2010 (r214960) +++ head/usr.bin/yacc/symtab.c Sun Nov 7 23:22:42 2010 (r214961) @@ -81,11 +81,11 @@ make_bucket(const char *name) bucket *bp; assert(name); - bp = (bucket *) MALLOC(sizeof(bucket)); + bp = malloc(sizeof(bucket)); if (bp == 0) no_space(); bp->link = 0; bp->next = 0; - bp->name = MALLOC(strlen(name) + 1); + bp->name = malloc(strlen(name) + 1); if (bp->name == 0) no_space(); bp->tag = 0; bp->value = UNDEFINED; @@ -130,7 +130,7 @@ create_symbol_table(void) int i; bucket *bp; - symbol_table = (bucket **) MALLOC(TABLE_SIZE*sizeof(bucket *)); + symbol_table = malloc(TABLE_SIZE*sizeof(bucket *)); if (symbol_table == 0) no_space(); for (i = 0; i < TABLE_SIZE; i++) symbol_table[i] = 0; @@ -148,7 +148,7 @@ create_symbol_table(void) void free_symbol_table(void) { - FREE(symbol_table); + free(symbol_table); symbol_table = 0; } @@ -161,6 +161,6 @@ free_symbols(void) for (p = first_symbol; p; p = q) { q = p->next; - FREE(p); + free(p); } } Modified: head/usr.bin/yacc/verbose.c ============================================================================== --- head/usr.bin/yacc/verbose.c Sun Nov 7 23:22:22 2010 (r214960) +++ head/usr.bin/yacc/verbose.c Sun Nov 7 23:22:42 2010 (r214961) @@ -66,12 +66,12 @@ verbose(void) if (!vflag) return; - null_rules = (short *) MALLOC(nrules*sizeof(short)); + null_rules = malloc(nrules*sizeof(short)); if (null_rules == 0) no_space(); fprintf(verbose_file, "\f\n"); for (i = 0; i < nstates; i++) print_state(i); - FREE(null_rules); + free(null_rules); if (nunused) log_unused(); From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 23:23:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79D7D1065670; Sun, 7 Nov 2010 23:23:48 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4EFCE8FC1B; Sun, 7 Nov 2010 23:23:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7NNmY8092504; Sun, 7 Nov 2010 23:23:48 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7NNmpp092502; Sun, 7 Nov 2010 23:23:48 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201011072323.oA7NNmpp092502@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 7 Nov 2010 23:23:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214962 - head/gnu/usr.bin/gdb/kgdb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 23:23:48 -0000 Author: gonzo Date: Sun Nov 7 23:23:48 2010 New Revision: 214962 URL: http://svn.freebsd.org/changeset/base/214962 Log: Fix cross-debugger build Modified: head/gnu/usr.bin/gdb/kgdb/trgt_mips.c Modified: head/gnu/usr.bin/gdb/kgdb/trgt_mips.c ============================================================================== --- head/gnu/usr.bin/gdb/kgdb/trgt_mips.c Sun Nov 7 23:22:42 2010 (r214961) +++ head/gnu/usr.bin/gdb/kgdb/trgt_mips.c Sun Nov 7 23:23:48 2010 (r214962) @@ -46,13 +46,16 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef CROSS_DEBUGGER #include +#endif #include "kgdb.h" void kgdb_trgt_fetch_registers(int regno __unused) { +#ifndef CROSS_DEBUGGER struct kthr *kt; struct pcb pcb; @@ -76,6 +79,7 @@ kgdb_trgt_fetch_registers(int regno __un supply_register(MIPS_FP_REGNUM, (char *)&pcb.pcb_context[PCB_REG_GP]); supply_register(MIPS_RA_REGNUM, (char *)&pcb.pcb_context[PCB_REG_RA]); supply_register(MIPS_EMBED_PC_REGNUM, (char *)&pcb.pcb_context[PCB_REG_PC]); +#endif } void @@ -90,6 +94,7 @@ kgdb_trgt_new_objfile(struct objfile *ob { } +#ifndef CROSS_DEBUGGER struct kgdb_frame_cache { CORE_ADDR pc; CORE_ADDR sp; @@ -194,10 +199,12 @@ static const struct frame_unwind kgdb_tr &kgdb_trgt_trapframe_this_id, &kgdb_trgt_trapframe_prev_register }; +#endif const struct frame_unwind * kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame) { +#ifndef CROSS_DEBUGGER char *pname; CORE_ADDR pc; @@ -211,5 +218,6 @@ kgdb_trgt_trapframe_sniffer(struct frame (strcmp(pname, "MipsUserIntr") == 0) || (strcmp(pname, "MipsUserGenException") == 0)) return (&kgdb_trgt_trapframe_unwind); +#endif return (NULL); } From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 23:34:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C77961065670; Sun, 7 Nov 2010 23:34:05 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B57F8FC08; Sun, 7 Nov 2010 23:34:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7NY5Qs093521; Sun, 7 Nov 2010 23:34:05 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7NY578093519; Sun, 7 Nov 2010 23:34:05 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201011072334.oA7NY578093519@svn.freebsd.org> From: "David E. O'Brien" Date: Sun, 7 Nov 2010 23:34:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214963 - head/usr.bin/yacc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 23:34:05 -0000 Author: obrien Date: Sun Nov 7 23:34:05 2010 New Revision: 214963 URL: http://svn.freebsd.org/changeset/base/214963 Log: Inherit WARNS from parent directory. Submitted by: marius Modified: head/usr.bin/yacc/Makefile Modified: head/usr.bin/yacc/Makefile ============================================================================== --- head/usr.bin/yacc/Makefile Sun Nov 7 23:23:48 2010 (r214962) +++ head/usr.bin/yacc/Makefile Sun Nov 7 23:34:05 2010 (r214963) @@ -9,6 +9,4 @@ MAN= yacc.1 yyfix.1 LINKS= ${BINDIR}/yacc ${BINDIR}/byacc MLINKS= yacc.1 byacc.1 -WARNS?= 6 - .include From owner-svn-src-all@FreeBSD.ORG Sun Nov 7 23:44:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59500106566C; Sun, 7 Nov 2010 23:44:41 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 470138FC0A; Sun, 7 Nov 2010 23:44: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 oA7Nif28094331; Sun, 7 Nov 2010 23:44:41 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Nifh9094328; Sun, 7 Nov 2010 23:44:41 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201011072344.oA7Nifh9094328@svn.freebsd.org> From: "David E. O'Brien" Date: Sun, 7 Nov 2010 23:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214964 - head/usr.bin/yacc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 23:44:41 -0000 Author: obrien Date: Sun Nov 7 23:44:40 2010 New Revision: 214964 URL: http://svn.freebsd.org/changeset/base/214964 Log: Add '-y' for bison compatibility. Obtained from: http://invisible-island.net Modified: head/usr.bin/yacc/main.c head/usr.bin/yacc/yacc.1 Modified: head/usr.bin/yacc/main.c ============================================================================== --- head/usr.bin/yacc/main.c Sun Nov 7 23:34:05 2010 (r214963) +++ head/usr.bin/yacc/main.c Sun Nov 7 23:44:40 2010 (r214964) @@ -166,7 +166,7 @@ getargs(int argc, char *argv[]) { int ch; - while ((ch = getopt(argc, argv, "b:dlo:p:rtv")) != -1) + while ((ch = getopt(argc, argv, "b:dlo:p:rtvy")) != -1) { switch (ch) { @@ -202,6 +202,10 @@ getargs(int argc, char *argv[]) vflag = 1; break; + case 'y': + /* for bison compatibility -- byacc is already POSIX compatible */ + break; + default: usage(); } Modified: head/usr.bin/yacc/yacc.1 ============================================================================== --- head/usr.bin/yacc/yacc.1 Sun Nov 7 23:34:05 2010 (r214963) +++ head/usr.bin/yacc/yacc.1 Sun Nov 7 23:44:40 2010 (r214964) @@ -44,7 +44,7 @@ .Nd an LALR(1) parser generator .Sh SYNOPSIS .Nm -.Op Fl dlrtv +.Op Fl dlrtvy .Op Fl b Ar file_prefix .Op Fl o Ar output_filename .Op Fl p Ar symbol_prefix @@ -118,6 +118,10 @@ so that debugging statements will be inc Cause a human-readable description of the generated parser to be written to the file .Pa y.output . +.It Fl y +NOOP for bison compatibility. +.Nm +is already designed to be POSIX yacc compatible. .El .Sh ENVIRONMENT .Bl -tag -width ".Ev TMPDIR" From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 00:26:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2CC71065679; Mon, 8 Nov 2010 00:26:49 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90ADC8FC12; Mon, 8 Nov 2010 00:26:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA80Qnlj097396; Mon, 8 Nov 2010 00:26:49 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA80QnYx097394; Mon, 8 Nov 2010 00:26:49 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201011080026.oA80QnYx097394@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Mon, 8 Nov 2010 00:26:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214965 - head/sys/mips/mips X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 00:26:49 -0000 Author: gonzo Date: Mon Nov 8 00:26:49 2010 New Revision: 214965 URL: http://svn.freebsd.org/changeset/base/214965 Log: - Provide more registers for GDB Modified: head/sys/mips/mips/gdb_machdep.c Modified: head/sys/mips/mips/gdb_machdep.c ============================================================================== --- head/sys/mips/mips/gdb_machdep.c Sun Nov 7 23:44:40 2010 (r214964) +++ head/sys/mips/mips/gdb_machdep.c Mon Nov 8 00:26:49 2010 (r214965) @@ -117,26 +117,33 @@ gdb_cpu_getreg(int regnum, size_t *regsz *regsz = gdb_cpu_regsz(regnum); if (kdb_thread == PCPU_GET(curthread)) { - switch (regnum) { - /* - * XXX: May need to add more registers - */ - case 2: return (&kdb_frame->v0); - case 3: return (&kdb_frame->v1); - } + register_t *zero_ptr = &kdb_frame->zero; + return zero_ptr + regnum; } + switch (regnum) { - case 16: return (&kdb_thrctx->pcb_context[0]); - case 17: return (&kdb_thrctx->pcb_context[1]); - case 18: return (&kdb_thrctx->pcb_context[2]); - case 19: return (&kdb_thrctx->pcb_context[3]); - case 20: return (&kdb_thrctx->pcb_context[4]); - case 21: return (&kdb_thrctx->pcb_context[5]); - case 22: return (&kdb_thrctx->pcb_context[6]); - case 23: return (&kdb_thrctx->pcb_context[7]); - case 29: return (&kdb_thrctx->pcb_context[8]); - case 30: return (&kdb_thrctx->pcb_context[9]); - case 31: return (&kdb_thrctx->pcb_context[10]); + /* + * S0..S7 + */ + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + return (&kdb_thrctx->pcb_context[PCB_REG_S0 + regnum - 16]); + case 28: + return (&kdb_thrctx->pcb_context[PCB_REG_GP]); + case 29: + return (&kdb_thrctx->pcb_context[PCB_REG_SP]); + case 30: + return (&kdb_thrctx->pcb_context[PCB_REG_S8]); + case 31: + return (&kdb_thrctx->pcb_context[PCB_REG_RA]); + case 37: + return (&kdb_thrctx->pcb_context[PCB_REG_PC]); } return (NULL); } From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 01:15:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 692981065672; Mon, 8 Nov 2010 01:15:43 +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 3C7B68FC16; Mon, 8 Nov 2010 01:15:43 +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 oA81FhFJ098889; Mon, 8 Nov 2010 01:15:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA81FhWX098888; Mon, 8 Nov 2010 01:15:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011080115.oA81FhWX098888@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Nov 2010 01:15:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214968 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 01:15:43 -0000 Author: yongari Date: Mon Nov 8 01:15:42 2010 New Revision: 214968 URL: http://svn.freebsd.org/changeset/base/214968 Log: Use shorten model name instead of showing all controller model numbers. bge(4) supports too many models such that it's unreasonable to list all these controllers in one line description of name. While I'm here mention that BCM590x/BCM5779x is Fast Ethernet controller. bge(4) still lacks support for some controllers but supporting these controllers should be easy now and adding new controllers do not require touching .Nd any more. Obtained from: OpenBSD Modified: head/share/man/man4/bge.4 Modified: head/share/man/man4/bge.4 ============================================================================== --- head/share/man/man4/bge.4 Mon Nov 8 00:42:32 2010 (r214967) +++ head/share/man/man4/bge.4 Mon Nov 8 01:15:42 2010 (r214968) @@ -31,12 +31,12 @@ .\" .\" $FreeBSD$ .\" -.Dd August 21, 2010 +.Dd November 7, 2010 .Dt BGE 4 .Os .Sh NAME .Nm bge -.Nd "Broadcom BCM570x/5714/5721/5722/5750/5751/5752/5761/5784/5789/57780 PCI Gigabit Ethernet adapter driver" +.Nd "Broadcom BCM57xx/BCM590x Gigabit/Fast Ethernet driver" .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -56,8 +56,8 @@ if_bge_load="YES" The .Nm driver provides support for various NICs based on the Broadcom BCM570x, -5714, 5721, 5722, 5750, 5751, 5752, 5761, 5784, 5789 and 57780 families -of Gigabit Ethernet controller chips. +571x, 572x, 575x, 576x, 578x, 5776x and 5778x Gigabit Ethernet controller +chips and the 590x and 5779x Fast Ethernet controller chips. .Pp All of these NICs are capable of 10, 100 and 1000Mbps speeds over CAT5 copper cable, except for the SysKonnect SK-9D41 which supports only @@ -82,7 +82,7 @@ copper gigabit transceivers, which support autonegotiation of 10, 100 and 1000Mbps modes in full or half duplex. .Pp -The BCM5700, BCM5701, BCM5702, BCM5703 and BCM5704 also support +The BCM5700, BCM5701, BCM5702, BCM5703, BCM5704 and BCM5717 also support jumbo frames, which can be configured via the interface MTU setting. Selecting an MTU larger than 1500 bytes with the From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 01:54:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2418106566B; Mon, 8 Nov 2010 01:54:42 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 80ABF8FC0C; Mon, 8 Nov 2010 01:54:42 +0000 (UTC) Received: by gxk9 with SMTP id 9so3213380gxk.13 for ; Sun, 07 Nov 2010 17:54:41 -0800 (PST) Received: by 10.151.14.7 with SMTP id r7mr7636842ybi.19.1289181280906; Sun, 07 Nov 2010 17:54:40 -0800 (PST) MIME-Version: 1.0 Sender: juli@clockworksquid.com Received: by 10.236.110.35 with HTTP; Sun, 7 Nov 2010 17:54:20 -0800 (PST) In-Reply-To: <201011072322.oA7NMhb0092364@svn.freebsd.org> References: <201011072322.oA7NMhb0092364@svn.freebsd.org> From: Juli Mallett Date: Sun, 7 Nov 2010 17:54:20 -0800 X-Google-Sender-Auth: 7xRZQ-cdP9xuEOJjnnbKbrERI44 Message-ID: To: "David E. O'Brien" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214961 - head/usr.bin/yacc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 01:54:43 -0000 David, On Sun, Nov 7, 2010 at 15:22, David E. O'Brien wrote: > Author: obrien > Date: Sun Nov =A07 23:22:42 2010 > New Revision: 214961 > URL: http://svn.freebsd.org/changeset/base/214961 > > Log: > =A0Directly use memory allocation functions and remove needless casts in > =A0their usage. =A0Also use associated modern types instead of k&r ones. You do know that changing skeleton.c affects the generated files, right? I'm wondering if whatever sed script you're judiciously-applying knows that. C++ does not do implicit conversions from "void *" so you need the casts on the mallocs there. With a C++ compiler: y.tab.c:116: error: invalid conversion from 'void*' to 'short int*' y.tab.c:122: error: invalid conversion from 'void*' to 'YYSTYPE*' Please back out the changes to the skeleton. From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 03:08:01 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FEAC106566B; Mon, 8 Nov 2010 03:08:01 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DEDA8FC17; Mon, 8 Nov 2010 03:08:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8381Sp005516; Mon, 8 Nov 2010 03:08:01 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8381oJ005514; Mon, 8 Nov 2010 03:08:01 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201011080308.oA8381oJ005514@svn.freebsd.org> From: Andrew Thompson Date: Mon, 8 Nov 2010 03:08:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214971 - head/sys/dev/gpio X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 03:08:01 -0000 Author: thompsa Date: Mon Nov 8 03:08:01 2010 New Revision: 214971 URL: http://svn.freebsd.org/changeset/base/214971 Log: Set the pin to output on attach, we can't assume it already is. Reviewed by: gonzo Modified: head/sys/dev/gpio/gpioled.c Modified: head/sys/dev/gpio/gpioled.c ============================================================================== --- head/sys/dev/gpio/gpioled.c Mon Nov 8 02:47:29 2010 (r214970) +++ head/sys/dev/gpio/gpioled.c Mon Nov 8 03:08:01 2010 (r214971) @@ -103,6 +103,9 @@ gpioled_attach(device_t dev) device_get_unit(dev), "name", &name)) name = NULL; + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, + GPIO_PIN_OUTPUT); + sc->sc_leddev = led_create(gpioled_control, sc, name ? name : device_get_nameunit(dev)); From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 07:54:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A3E81065780; Mon, 8 Nov 2010 07:54:25 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28DF78FC18; Mon, 8 Nov 2010 07:54: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 oA87sPFB017986; Mon, 8 Nov 2010 07:54:25 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA87sPvp017984; Mon, 8 Nov 2010 07:54:25 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201011080754.oA87sPvp017984@svn.freebsd.org> From: Kevin Lo Date: Mon, 8 Nov 2010 07:54:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214972 - head/sys/arm/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 07:54:25 -0000 Author: kevlo Date: Mon Nov 8 07:54:24 2010 New Revision: 214972 URL: http://svn.freebsd.org/changeset/base/214972 Log: Intel IXP425 SoC is based on the ARMv5TE architecture MFC after: 3 days Modified: head/sys/arm/include/cpuconf.h Modified: head/sys/arm/include/cpuconf.h ============================================================================== --- head/sys/arm/include/cpuconf.h Mon Nov 8 03:08:01 2010 (r214971) +++ head/sys/arm/include/cpuconf.h Mon Nov 8 07:54:24 2010 (r214972) @@ -70,7 +70,7 @@ */ #if (defined(CPU_ARM7TDMI) || defined(CPU_ARM8) || defined(CPU_ARM9) || \ defined(CPU_SA110) || defined(CPU_SA1100) || defined(CPU_SA1110) || \ - defined(CPU_IXP12X0) || defined(CPU_XSCALE_IXP425) || defined(CPU_FA526)) + defined(CPU_IXP12X0) || defined(CPU_FA526)) #define ARM_ARCH_4 1 #else #define ARM_ARCH_4 0 @@ -79,7 +79,8 @@ #if (defined(CPU_ARM9E) || defined(CPU_ARM10) || \ defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \ defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342) || \ - defined(CPU_XSCALE_PXA2X0) || defined(CPU_FA626TE)) + defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \ + defined(CPU_FA626TE)) #define ARM_ARCH_5 1 #else #define ARM_ARCH_5 0 From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 09:18:39 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C576106566B; Mon, 8 Nov 2010 09:18:39 +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 B08D48FC18; Mon, 8 Nov 2010 09:18:37 +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 LAA25673; Mon, 08 Nov 2010 11:18:36 +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 1PFNs4-0003iK-2i; Mon, 08 Nov 2010 11:18:36 +0200 Message-ID: <4CD7C06B.1090505@freebsd.org> Date: Mon, 08 Nov 2010 11:18:35 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.12) Gecko/20101029 Lightning/1.0b2 Thunderbird/3.1.6 MIME-Version: 1.0 To: Andriy Gapon References: <201011071932.oA7JW3BY072220@svn.freebsd.org> In-Reply-To: <201011071932.oA7JW3BY072220@svn.freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r214941 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 09:18:39 -0000 on 07/11/2010 21:32 Andriy Gapon said the following: > Author: avg > Date: Sun Nov 7 19:32:03 2010 > New Revision: 214941 > URL: http://svn.freebsd.org/changeset/base/214941 > > Log: > Followup to r214936: zfs_getpages: account for differences from head > in page locking Reported by: jhell@DataIX.net Report overlooked by: avg > Modified: > stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > > Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > ============================================================================== > --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 7 19:23:25 2010 (r214940) > +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 7 19:32:03 2010 (r214941) > @@ -4181,14 +4181,13 @@ zfs_getpages(struct vnode *vp, vm_page_t > KASSERT(vp->v_object == object, ("mismatching object")); > > VM_OBJECT_LOCK(object); > - > + vm_page_lock_queues(); > for (i = 0; i < pcount; i++) { > if (i != reqpage) { > - vm_page_lock(m[i]); > vm_page_free(m[i]); > - vm_page_unlock(m[i]); > } > } > + vm_page_unlock_queues(); > > if (mreq->valid) { > if (mreq->valid != VM_PAGE_BITS_ALL) -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 09:26:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BB371065670; Mon, 8 Nov 2010 09:26:56 +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 6E7DC8FC0A; Mon, 8 Nov 2010 09:26:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA89Quio021713; Mon, 8 Nov 2010 09:26:56 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA89Qu7J021711; Mon, 8 Nov 2010 09:26:56 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201011080926.oA89Qu7J021711@svn.freebsd.org> From: Ruslan Ermilov Date: Mon, 8 Nov 2010 09:26:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214973 - head/usr.bin/calendar/calendars X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 09:26:56 -0000 Author: ru Date: Mon Nov 8 09:26:56 2010 New Revision: 214973 URL: http://svn.freebsd.org/changeset/base/214973 Log: A traditional (once per three years) sort by month/day/year/login. While here, fixed badly formatted lines. Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Mon Nov 8 07:54:24 2010 (r214972) +++ head/usr.bin/calendar/calendars/calendar.freebsd Mon Nov 8 09:26:56 2010 (r214973) @@ -7,8 +7,8 @@ #ifndef _calendar_freebsd_ #define _calendar_freebsd_ -01/01 Alexander Langer born in Duesseldorf, Nordrhein-Westfalen, Germany, 1981 01/01 Dimitry Andric born in Utrecht, the Netherlands, 1969 +01/01 Alexander Langer born in Duesseldorf, Nordrhein-Westfalen, Germany, 1981 01/02 Ion-Mihai "IOnut" Tetcu born in Bucharest, Romania, 1980 01/02 Patrick Li born in Beijing, People's Republic of China, 1985 01/03 Tetsurou Okazaki born in Mobara, Chiba, Japan, 1972 @@ -24,13 +24,13 @@ 01/16 Vanilla I. Shu born in Taipei, Taiwan, Republic of China, 1978 01/18 Dejan Lesjak born in Ljubljana, Slovenia, Yugoslavia, 1977 01/19 Marshall Kirk McKusick born in Wilmington, Delaware, United States, 1954 -01/19 Marcelo S. Araujo born in Joinville, Santa Catarina, Brazil, 1981 01/19 Ruslan Ermilov born in Simferopol, USSR, 1974 +01/19 Marcelo S. Araujo born in Joinville, Santa Catarina, Brazil, 1981 01/20 Poul-Henning Kamp born in Korsoer, Denmark, 1966 01/22 Johann Visagie born in Cape Town, South Africa, 1970 01/23 Hideyuki KURASHINA born in Niigata, Japan, 1982 -01/24 Matteo Riondato born in Padova, Italy, 1986 01/24 Fabien Thomas born in Avignon, France, 1971 +01/24 Matteo Riondato born in Padova, Italy, 1986 01/25 Bernd Walter born in Moers, Nordrhein-Westfalen, Germany, 1974 01/26 Andrew Gallatin born in Buffalo, New York, United States, 1970 01/27 Nick Sayer born in San Diego, California, United States, 1968 @@ -43,19 +43,19 @@ 02/01 Christian Brueffer born in Gronau, Nordrhein-Westfalen, Germany, 1982 02/01 Steven Kreuzer born in Oceanside, New York, 1982 02/01 Juli Mallett born in Washington, Pennsylvania, United States, 1985 -02/02 Michael W Lucas born in Detroit, Michigan, United States, 1967 02/02 Diomidis D. Spinellis born in Athens, Greece, 1967 +02/02 Michael W Lucas born in Detroit, Michigan, United States, 1967 02/02 Yoichi Nakayama born in Tsu, Mie, Japan, 1976 02/05 Frank Laszlo born in Howell, Michigan, United States, 1983 02/10 David Greenman born in Portland, Oregon, United States, 1968 02/10 Paul Richards born in Ammanford, Carmarthenshire, United Kingdom, 1968 02/10 Simon Barner born in Rosenheim, Bayern, Germany, 1980 02/13 Jesper Skriver born in Aarhus, Denmark, 1975 +02/13 Steve Wills born in Lynchburg, Virginia, United States, 1975 02/13 Andrey Slusar born in Odessa, USSR, 1979 02/13 David W. Chapman Jr. born in Bethel, Connecticut, United States, 1981 -02/13 Steve Wills born in Lynchburg, Virginia, United States, 1975 -02/14 Erwin Lansing born in 's-Hertogenbosch, the Netherlands, 1975 02/14 Manolis Kiagias born in Chania, Greece, 1970 +02/14 Erwin Lansing born in 's-Hertogenbosch, the Netherlands, 1975 02/14 Martin Blapp born in Olten, Switzerland, 1976 02/19 Murray Stokely born in Jacksonville, Florida, United States, 1979 02/20 Anders Nordby born in Oslo, Norway, 1976 @@ -92,10 +92,10 @@ 03/17 Alexander Motin born in Simferopol, Ukraine, 1979 03/18 Koop Mast born in Dokkum, the Netherlands, 1981 03/19 Mikhail Teterin born in Kyiv, Ukraine, 1972 +03/20 Joseph S. Atkinson born in Batesville, Arkansas, United States, 1977 +03/20 Henrik Brix Andersen born in Aarhus, Denmark, 1978 03/20 MANTANI Nobutaka born in Hiroshima, Japan, 1978 03/20 Cameron Grant died in Hemel Hempstead, United Kingdom, 2005 -03/20 Henrik Brix Andersen born in Aarhus, Denmark, 1978 -03/20 Joseph S. Atkinson born in Batesville, Arkansas, United States, 1977 03/22 Brad Davis born in Farmington, New Mexico, United States, 1983 03/23 Daniel C. Sobral born in Brasilia, Distrito Federal, Brazil, 1971 03/23 Benno Rice born in Adelaide, South Australia, Australia, 1977 @@ -112,7 +112,7 @@ 04/03 Hellmuth Michaelis born in Kiel, Schleswig-Holstein, Germany, 1958 04/03 Tong Liu born in Beijing, People's Republic of China, 1981 04/03 Gabor Pali born in Kunhegyes, Hungary, 1982 -04/05 Stacey Son born in Burley, Idaho, United States. 1967 +04/05 Stacey Son born in Burley, Idaho, United States, 1967 04/07 Edward Tomasz Napierala born in Wolsztyn, Poland, 1981 04/08 Jordan K. Hubbard born in Honolulu, Hawaii, United States, 1963 04/09 Ceri Davies born in Haverfordwest, Pembrokeshire, United Kingdom, 1976 @@ -141,9 +141,9 @@ 05/11 Jesus Rodriguez born in Barcelona, Spain, 1972 05/11 Roman Kurakin born in Moscow, USSR, 1979 05/13 Pete Fritchman born in Lansdale, Pennsylvania, United States, 1983 -05/14 Bruce Cran born in Cambridge, United Kingdom, 1981 05/14 Tatsumi Hosokawa born in Tokyo, Japan, 1968 05/14 Shigeyuku Fukushima born in Osaka, Japan, 1974 +05/14 Bruce Cran born in Cambridge, United Kingdom, 1981 05/16 Johann Kois born in Wolfsberg, Austria, 1975 05/16 Marcus Alves Grando born in Florianopolis, Santa Catarina, Brazil, 1979 05/17 Thomas Abthorpe born in Port Arthur, Ontario, Canada, 1968 @@ -152,12 +152,12 @@ 05/21 Kris Kennaway born in Winnipeg, Manitoba, Canada, 1978 05/22 Clive Tong-I Lin born in Changhua, Taiwan, Republic of China, 1978 05/22 Michael Bushkov born in Rostov-on-Don, Russia, 1985 -05/22 Rui Paulo , born in Evora, Portugal, 1986 +05/22 Rui Paulo born in Evora, Portugal, 1986 05/23 Munechika Sumikawa born in Osaka, Osaka, Japan, 1972 05/24 Duncan McLennan Barclay born in London, Middlesex, United Kingdom, 1970 05/24 Oliver Lehmann born in Karlsburg, Germany, 1981 -05/25 Roman Divacky born in Brno, Czech Republic, 1983 05/25 Tom Rhodes born in Ellwood City, Pennsylvania, United States, 1981 +05/25 Roman Divacky born in Brno, Czech Republic, 1983 05/26 Jim Pirzyk born in Chicago, Illinois, United States, 1968 05/27 Ollivier Robert born in Paris, France, 1967 05/29 Wilko Bulte born in Arnhem, the Netherlands, 1965 @@ -168,13 +168,13 @@ 06/03 CHOI Junho born in Seoul, Korea, 1974 06/03 Wesley Shields born in Binghamton, NY, USA, 1981 06/04 Julian Elischer born in Perth, Australia, 1959 -06/04 Jason Evans born in Greeley, Colorado, United States, 1973 06/04 Justin Gibbs born in San Pedro, California, United States, 1973 +06/04 Jason Evans born in Greeley, Colorado, United States, 1973 06/04 Thomas Moestl born in Braunschweig, Niedersachsen, Germany, 1980 06/06 Sergei Kolobov born in Karpinsk, Russian Federation, 1972 06/06 Alan Eldridge died in Denver, Colorado, 2003 -06/07 Benjamin Close born in Adelaide, Australia, 1978 06/07 Jimmy Olgeni born in Milano, Italy, 1976 +06/07 Benjamin Close born in Adelaide, Australia, 1978 06/17 Tilman Linneweh born in Weinheim, Baden-Wuertemberg, Germany, 1978 06/18 Li-Wen Hsu born in Taipei, Taiwan, Republic of China, 1984 06/18 Roman Bogorodskiy born in Saratov, Russian Federation, 1986 @@ -232,12 +232,12 @@ 08/12 Max Brazhnikov born in Leningradskaya, Russia, 1979 08/14 Stefan Esser born in Cologne, Nordrhein-Westfalen, Germany, 1961 08/17 Olivier Houchard born in Nancy, France, 1980 -08/19 Pav Lucistnik born in Kutna Hora, Czech Republic, 1980 08/19 Chin-San Huang born in Yi-Lan, Taiwan, Republic of China, 1979 +08/19 Pav Lucistnik born in Kutna Hora, Czech Republic, 1980 08/20 Michael Heffner born in Cleona, Pennsylvania, United States, 1981 08/24 Mark Linimon born in Houston, Texas, United States, 1955 -08/25 Jean Milanez Melo born in Divinopolis, Minas Gerais, Brazil, 1982 08/25 Beech Rintoul born in Oakland, California, United States, 1952 +08/25 Jean Milanez Melo born in Divinopolis, Minas Gerais, Brazil, 1982 08/26 Dima Ruban born in Nalchik, USSR, 1970 08/26 Marc Fonvieille born in Avignon, France, 1972 08/26 Herve Quiroz born in Aix-en-Provence, France, 1977 @@ -257,8 +257,8 @@ 09/09 Yoshio Mita born in Hiroshima, Japan, 1972 09/10 Wesley R. Peters born in Hartford, Alabama, United States, 1961 09/12 Weongyo Jeong born in Haman, Korea, 1980 -09/12 William C. Fumerola II born in Detroit, Michigan, United States, 1981 09/12 Benedict Christopher Reuschling born in Darmstadt, Germany, 1981 +09/12 William C. Fumerola II born in Detroit, Michigan, United States, 1981 09/15 Dima Panov born in Khabarovsk, Russian Federation, 1978 09/17 Maxim Bolotin born in Rostov-on-Don, Russian Federation, 1976 09/18 Matthew Fleming born in Cleveland, Ohio, United States, 1975 @@ -287,7 +287,7 @@ 10/22 Jean-Sebastien Pedron born in Redon, Ille-et-Vilaine, France, 1980 10/23 Mario Sergio Fujikawa Ferreira born in Brasilia, Distrito Federal, Brazil, 1976 10/25 Eric Melville born in Los Gatos, California, United States, 1980 -10/26 Philip M. Gollucci born in Silver Spring, Maryland, United States, 1979 +10/26 Philip M. Gollucci born in Silver Spring, Maryland, United States, 1979 10/27 Takanori Watanabe born in Numazu, Shizuoka, Japan, 1972 11/05 M. Warner Losh born in Kansas City, Kansas, United States, 1966 11/09 Coleman Kane born in Cincinnati, OH, United States, 1980 @@ -310,7 +310,7 @@ 11/28 Stanislav Sedov born in Chelyabinsk, USSR, 1985 12/01 Hajimu Umemoto born in Nara, Japan, 1961 12/01 Alexey Dokuchaev born in Magadan, USSR, 1980 -12/02 Ermal Luçi born in Tirane, Albania, 1980 +12/02 Ermal Luçi born in Tirane, Albania, 1980 12/03 Diane Bruce born in Ottawa, Ontario, Canada, 1952 12/05 Ivan Voras born in Slavonski Brod, Croatia, 1981 12/06 Stefan Farfeleder born in Wien, Austria, 1980 From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 09:50:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4913E106564A; Mon, 8 Nov 2010 09:50:48 +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 35F518FC0A; Mon, 8 Nov 2010 09:50:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA89omXS022618; Mon, 8 Nov 2010 09:50:48 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA89omSP022616; Mon, 8 Nov 2010 09:50:48 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201011080950.oA89omSP022616@svn.freebsd.org> From: Ruslan Ermilov Date: Mon, 8 Nov 2010 09:50:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214974 - head/usr.bin/calendar/calendars X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 09:50:48 -0000 Author: ru Date: Mon Nov 8 09:50:47 2010 New Revision: 214974 URL: http://svn.freebsd.org/changeset/base/214974 Log: Add/expand country/state. Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Mon Nov 8 09:26:56 2010 (r214973) +++ head/usr.bin/calendar/calendars/calendar.freebsd Mon Nov 8 09:50:47 2010 (r214974) @@ -41,7 +41,7 @@ 02/01 Paul Saab born in Champaign-Urbana, Illinois, United States, 1978 02/01 Martin Wilke born in Ludwigsfelde, Brandenburg, Germany, 1980 02/01 Christian Brueffer born in Gronau, Nordrhein-Westfalen, Germany, 1982 -02/01 Steven Kreuzer born in Oceanside, New York, 1982 +02/01 Steven Kreuzer born in Oceanside, New York, United States, 1982 02/01 Juli Mallett born in Washington, Pennsylvania, United States, 1985 02/02 Diomidis D. Spinellis born in Athens, Greece, 1967 02/02 Michael W Lucas born in Detroit, Michigan, United States, 1967 @@ -151,7 +151,7 @@ 05/19 Ian Dowse born in Dublin, Ireland, 1975 05/21 Kris Kennaway born in Winnipeg, Manitoba, Canada, 1978 05/22 Clive Tong-I Lin born in Changhua, Taiwan, Republic of China, 1978 -05/22 Michael Bushkov born in Rostov-on-Don, Russia, 1985 +05/22 Michael Bushkov born in Rostov-on-Don, Russian Federation, 1985 05/22 Rui Paulo born in Evora, Portugal, 1986 05/23 Munechika Sumikawa born in Osaka, Osaka, Japan, 1972 05/24 Duncan McLennan Barclay born in London, Middlesex, United Kingdom, 1970 @@ -164,9 +164,9 @@ 05/29 Seigo Tanimura born in Kitakyushu, Fukuoka, Japan, 1976 05/31 Ville Skytta born in Helsinki, Finland, 1974 06/02 Jean-Marc Zucconi born in Pontarlier, France, 1954 -06/02 Alexander Botero-Lowry born in Austin, TX, USA, 1986 +06/02 Alexander Botero-Lowry born in Austin, Texas, United States, 1986 06/03 CHOI Junho born in Seoul, Korea, 1974 -06/03 Wesley Shields born in Binghamton, NY, USA, 1981 +06/03 Wesley Shields born in Binghamton, New York, United States, 1981 06/04 Julian Elischer born in Perth, Australia, 1959 06/04 Justin Gibbs born in San Pedro, California, United States, 1973 06/04 Jason Evans born in Greeley, Colorado, United States, 1973 @@ -229,7 +229,7 @@ 08/07 Jonathan Mini born in San Mateo, California, United States, 1979 08/10 Peter Pentchev born in Sofia, Bulgaria, 1977 08/12 Joe Marcus Clarke born in Lakeland, Florida, United States, 1976 -08/12 Max Brazhnikov born in Leningradskaya, Russia, 1979 +08/12 Max Brazhnikov born in Leningradskaya, Russian Federation, 1979 08/14 Stefan Esser born in Cologne, Nordrhein-Westfalen, Germany, 1961 08/17 Olivier Houchard born in Nancy, France, 1980 08/19 Chin-San Huang born in Yi-Lan, Taiwan, Republic of China, 1979 @@ -272,7 +272,7 @@ 10/02 Beat Gaetzi born in Zurich, Switzerland, 1980 10/05 Hiroki Sato born in Yamagata, Japan, 1977 10/05 Chris Costello born in Houston, Texas, United States, 1985 -10/09 Stefan Walter born in Werne, Nordrhein-Westfalen, 1978 +10/09 Stefan Walter born in Werne, Nordrhein-Westfalen, Germany, 1978 10/12 Pawel Jakub Dawidek born in Radzyn Podlaski, Poland, 1980 10/15 Maxim Konovalov born in Khabarovsk, USSR, 1973 10/16 Remko Lodder born in Rotterdam, the Netherlands, 1983 @@ -290,7 +290,7 @@ 10/26 Philip M. Gollucci born in Silver Spring, Maryland, United States, 1979 10/27 Takanori Watanabe born in Numazu, Shizuoka, Japan, 1972 11/05 M. Warner Losh born in Kansas City, Kansas, United States, 1966 -11/09 Coleman Kane born in Cincinnati, OH, United States, 1980 +11/09 Coleman Kane born in Cincinnati, Ohio, United States, 1980 11/09 Antoine Brodin born in Bagnolet, France, 1981 11/10 Gregory Neil Shapiro born in Providence, Rhode Island, United States, 1970 11/13 John Baldwin born in Stuart, Virginia, United States, 1977 From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 10:08:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48F22106566B; Mon, 8 Nov 2010 10:08:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3402C8FC0C; Mon, 8 Nov 2010 10:08:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8A8VNr023384; Mon, 8 Nov 2010 10:08:31 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8A8VkX023377; Mon, 8 Nov 2010 10:08:31 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201011081008.oA8A8VkX023377@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 8 Nov 2010 10:08:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214975 - in stable/8: sbin/geom/class/part sbin/geom/class/sched sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 10:08:31 -0000 Author: ae Date: Mon Nov 8 10:08:30 2010 New Revision: 214975 URL: http://svn.freebsd.org/changeset/base/214975 Log: MFC r214352 adapted to stable/8: Reimplemented "gpart destroy -F". Now it does all work in kernel. This was needed for recover implementation. Implement the recover command for GPT. Now GPT will marked as corrupt when any of three types of corruption will be detected: 1. Damaged primary GPT header or table 2. Damaged secondary GPT header or table 3. Secondary header is not located in the last LBA Marked GPT becomes read-only. Any changes with corrupt table are prohibited. Only "destroy" and "recover" commands are allowed. Approved by: kib (mentor) Modified: stable/8/sbin/geom/class/part/geom_part.c stable/8/sbin/geom/class/part/gpart.8 stable/8/sys/geom/part/g_part.c stable/8/sys/geom/part/g_part.h stable/8/sys/geom/part/g_part_gpt.c stable/8/sys/geom/part/g_part_if.m Directory Properties: stable/8/sbin/geom/ (props changed) stable/8/sbin/geom/class/part/ (props changed) stable/8/sbin/geom/class/sched/gsched.8 (props changed) stable/8/sbin/geom/class/stripe/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/8/sbin/geom/class/part/geom_part.c Mon Nov 8 09:50:47 2010 (r214974) +++ stable/8/sbin/geom/class/part/geom_part.c Mon Nov 8 10:08:30 2010 (r214975) @@ -68,7 +68,6 @@ static char ssize[32]; static const char const bootcode_param[] = "bootcode"; static const char const index_param[] = "index"; static const char const partcode_param[] = "partcode"; -static const char const force_param[] = "force"; static struct gclass *find_class(struct gmesh *, const char *); static struct ggeom * find_geom(struct gclass *, const char *); @@ -85,8 +84,7 @@ static void gpart_show_geom(struct ggeom static int gpart_show_hasopt(struct gctl_req *, const char *, const char *); static void gpart_write_partcode(struct ggeom *, int, void *, ssize_t); static void gpart_write_partcode_vtoc8(struct ggeom *, int, void *); -static void gpart_destroy(struct gctl_req *, unsigned int); -static void gpart_print_error(const char *); +static void gpart_print_error(const char *); struct g_command PUBSYM(class_commands)[] = { { "add", 0, gpart_issue, { @@ -121,8 +119,8 @@ struct g_command PUBSYM(class_commands)[ G_OPT_SENTINEL }, "geom", NULL }, - { "destroy", 0, gpart_destroy, { - { 'F', force_param, NULL, G_TYPE_BOOL }, + { "destroy", 0, gpart_issue, { + { 'F', "force", NULL, G_TYPE_BOOL }, { 'f', "flags", flags, G_TYPE_STRING }, G_OPT_SENTINEL }, "geom", NULL }, @@ -162,6 +160,11 @@ struct g_command PUBSYM(class_commands)[ G_OPT_SENTINEL }, "geom", NULL }, + { "recover", 0, gpart_issue, { + { 'f', "flags", flags, G_TYPE_STRING }, + G_OPT_SENTINEL }, + "geom", NULL + }, G_CMD_SENTINEL }; @@ -536,13 +539,17 @@ gpart_show_geom(struct ggeom *gp, const s = find_geomcfg(gp, "last"); last = (off_t)strtoimax(s, NULL, 0); wblocks = strlen(s); + s = find_geomcfg(gp, "state"); + if (s != NULL && *s != 'C') + s = NULL; wname = strlen(gp->lg_name); pp = LIST_FIRST(&gp->lg_consumer)->lg_provider; secsz = pp->lg_sectorsize; - printf("=>%*jd %*jd %*s %s (%s)\n", + printf("=>%*jd %*jd %*s %s (%s)%s\n", wblocks, (intmax_t)first, wblocks, (intmax_t)(last - first + 1), wname, gp->lg_name, - scheme, fmtsize(pp->lg_mediasize)); + scheme, fmtsize(pp->lg_mediasize), + s ? " [CORRUPT]": ""); while ((pp = find_provider(gp, first)) != NULL) { s = find_provcfg(pp, "start"); @@ -857,98 +864,24 @@ gpart_bootcode(struct gctl_req *req, uns } static void -gpart_destroy(struct gctl_req *req, unsigned int fl) -{ - struct gmesh mesh; - struct gclass *classp; - struct gctl_req *req2; - struct ggeom *gp; - struct gprovider *pp; - const char *s; - int error, val; - - if (gctl_has_param(req, force_param)) { - val = gctl_get_int(req, force_param); - error = gctl_delete_param(req, force_param); - if (error) - errc(EXIT_FAILURE, error, "internal error"); - if (val == 0) - goto done; - s = gctl_get_ascii(req, "class"); - if (s == NULL) - abort(); - error = geom_gettree(&mesh); - if (error != 0) - errc(EXIT_FAILURE, error, "Cannot get GEOM tree"); - classp = find_class(&mesh, s); - if (classp == NULL) { - geom_deletetree(&mesh); - errx(EXIT_FAILURE, "Class %s not found.", s); - } - s = gctl_get_ascii(req, "geom"); - if (s == NULL) - abort(); - gp = find_geom(classp, s); - if (gp == NULL) - errx(EXIT_FAILURE, "No such geom: %s.", s); - val = 0; - LIST_FOREACH(pp, &gp->lg_provider, lg_provider){ - s = find_provcfg(pp, "index"); - if (s == NULL) - errx(EXIT_FAILURE, "Index not found for %s.", - pp->lg_name); - req2 = gctl_get_handle(); - gctl_ro_param(req2, "class", -1, classp->lg_name); - gctl_ro_param(req2, "geom", -1, gp->lg_name); - gctl_ro_param(req2, "verb", -1, "delete"); - gctl_ro_param(req2, index_param, -1, s); - gctl_ro_param(req2, "flags", -1, "X"); - s = gctl_issue(req2); - if (s != NULL && s[0] != '\0') { - gpart_print_error(s); - gctl_free(req2); - if (val) { /* try to undo changes */ - req2 = gctl_get_handle(); - gctl_ro_param(req2, "verb", -1, - "undo"); - gctl_ro_param(req2, "class", -1, - classp->lg_name); - gctl_ro_param(req2, "geom", -1, - gp->lg_name); - gctl_issue(req2); - gctl_free(req2); - } - geom_deletetree(&mesh); - exit(EXIT_FAILURE); - } - gctl_free(req2); - val = 1; - } - geom_deletetree(&mesh); - } -done: - gpart_issue(req, fl); -} - -static void -gpart_print_error(const char *errstr) -{ - char *errmsg; - int error; - - error = strtol(errstr, &errmsg, 0); - if (errmsg != errstr) { - while (errmsg[0] == ' ') - errmsg++; - if (errmsg[0] != '\0') - warnc(error, "%s", errmsg); - else - warnc(error, NULL); - } else - warnx("%s", errmsg); -} - -static void +gpart_print_error(const char *errstr) +{ + char *errmsg; + int error; + + error = strtol(errstr, &errmsg, 0); + if (errmsg != errstr) { + while (errmsg[0] == ' ') + errmsg++; + if (errmsg[0] != '\0') + warnc(error, "%s", errmsg); + else + warnc(error, NULL); + } else + warnx("%s", errmsg); +} + +static void gpart_issue(struct gctl_req *req, unsigned int fl __unused) { char buf[4096]; Modified: stable/8/sbin/geom/class/part/gpart.8 ============================================================================== --- stable/8/sbin/geom/class/part/gpart.8 Mon Nov 8 09:50:47 2010 (r214974) +++ stable/8/sbin/geom/class/part/gpart.8 Mon Nov 8 10:08:30 2010 (r214975) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 28, 2010 +.Dd October 25, 2010 .Dt GPART 8 .Os .Sh NAME @@ -129,6 +129,11 @@ utility: .Op Fl t Ar type .Op Fl f Ar flags .Ar geom +.\" ==== RECOVER ==== +.Nm +.Cm recover +.Op Fl f Ar flags +.Ar geom .\" ==== RESIZE ==== .Nm .Cm resize @@ -353,6 +358,23 @@ See the section entitled below for a discussion about its use. .El +.\" ==== RECOVER ==== +.It Cm recover +Recover corrupt partition's scheme metadata on the geom +.Ar geom . +See the section entitled +.Sx "RECOVERING" +below for the additional information. +.Pp +Additional options include: +.Bl -tag -width 10n +.It Fl f Ar flags +Additional operational flags. +See the section entitled +.Sx "OPERATIONAL FLAGS" +below for a discussion +about its use. +.El .\" ==== RESIZE ==== .It Cm resize Resize a partition from geom @@ -629,6 +651,68 @@ the action or reverted with the .Cm undo action. +.Sh RECOVERING +The GEOM class PART supports recovering of partition tables only for GPT. +The GUID partition table has a primary and secondary (backup) copy of +metadata for redundance. They are stored in the begining and in the end +of device respectively. Therefore it is acceptable to have some corruptions +in the metadata that are not fatal to work with GPT. When kernel detects +corrupt metadata it marks this table as corrupt and reports about corruption. +Any changes in corrupt table are prohibited except +.Cm destroy +and +.Cm recover . +.Pp +In case when only first sector is corrupt kernel can not detect GPT even +if partition table is not corrupt. You can write protective MBR with +.Xr dd 1 +command to restore ability of GPT detection. The copy of protective MBR is +usually located in the +.Pa /boot/pmbr +file. +.Pp +In case when some of metadata is corrupt you will get to know about this +from kernel's messages like these: +.Bd -literal -offset indent +GEOM: provider: the primary GPT table is corrupt or invalid. +GEOM: provider: using the secondary instead -- recovery strongly advised. +.Ed +.Pp +or +.Bd -literal -offset indent +GEOM: provider: the secondary GPT table is corrupt or invalid. +GEOM: provider: using the primary only -- recovery suggested. +.Ed +.Pp +Also +.Cm gpart +commands like +.Cm show , +.Cm status +and +.Cm list +will report about corrupt table. +.Pp +In case when the size of device has changed (e.g. volume expansion) the +secondary GPT header will become located not in the last sector. This is +not a metadata corruption, but it is dangerous because any corruption of +the primary GPT will lead to lost of partition table. Kernel reports about +this problem with message: +.Bd -literal -offset indent +GEOM: provider: the secondary GPT header is not in the last LBA. +.Ed +.Pp +A corrupt table can be recovered with +.Cm gpart recover +command. This command does reconstruction of corrupt metadata using +known valid metadata. Also it can relocate secondary GPT to the end of +device. +.Pp +.Pa NOTE : +The GEOM class PART can detect the same partition table on different GEOM +providers and some of them will marked as corrupt. Be careful when choising +a provider for recovering. If you did incorrect choise you can destroy +metadata of another GEOM class, e.g. GEOM MIRROR or GEOM LABEL. .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. .Sh EXAMPLES @@ -687,6 +771,7 @@ After having created all required partit /sbin/gpart bootcode -p /boot/boot1 da0 .Ed .Sh SEE ALSO +.Xr dd 1 , .Xr geom 4 , .Xr geom 8 .Sh HISTORY Modified: stable/8/sys/geom/part/g_part.c ============================================================================== --- stable/8/sys/geom/part/g_part.c Mon Nov 8 09:50:47 2010 (r214974) +++ stable/8/sys/geom/part/g_part.c Mon Nov 8 10:08:30 2010 (r214975) @@ -855,7 +855,7 @@ g_part_ctl_destroy(struct gctl_req *req, struct g_consumer *cp; struct g_geom *gp; struct g_provider *pp; - struct g_part_entry *entry; + struct g_part_entry *entry, *tmp; struct g_part_table *null, *table; struct sbuf *sb; int error; @@ -865,13 +865,34 @@ g_part_ctl_destroy(struct gctl_req *req, g_topology_assert(); table = gp->softc; + /* Check for busy providers. */ LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) { if (entry->gpe_deleted || entry->gpe_internal) continue; + if (gpp->gpp_force) { + pp = entry->gpe_pp; + if (pp == NULL) + continue; + if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0) + continue; + } gctl_error(req, "%d", EBUSY); return (EBUSY); } + if (gpp->gpp_force) { + /* Destroy all providers. */ + LIST_FOREACH_SAFE(entry, &table->gpt_entry, gpe_entry, tmp) { + pp = entry->gpe_pp; + if (pp != NULL) { + pp->private = NULL; + g_wither_provider(pp, ENXIO); + } + LIST_REMOVE(entry, gpe_entry); + g_free(entry); + } + } + error = G_PART_DESTROY(table, gpp); if (error) { gctl_error(req, "%d", error); @@ -968,8 +989,39 @@ g_part_ctl_move(struct gctl_req *req, st static int g_part_ctl_recover(struct gctl_req *req, struct g_part_parms *gpp) { - gctl_error(req, "%d verb 'recover'", ENOSYS); - return (ENOSYS); + struct g_part_table *table; + struct g_geom *gp; + struct sbuf *sb; + int error, recovered; + + gp = gpp->gpp_geom; + G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); + g_topology_assert(); + table = gp->softc; + error = recovered = 0; + + if (table->gpt_corrupt) { + error = G_PART_RECOVER(table); + if (error) { + gctl_error(req, "%d recovering '%s' failed", + error, gp->name); + return (error); + } + recovered = 1; + } + /* Provide feedback if so requested. */ + if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { + sb = sbuf_new_auto(); + if (recovered) + sbuf_printf(sb, "%s recovered\n", gp->name); + else + sbuf_printf(sb, "%s recovering is not needed\n", + gp->name); + sbuf_finish(sb); + gctl_set_param(req, "output", sbuf_data(sb), sbuf_len(sb) + 1); + sbuf_delete(sb); + } + return (0); } static int @@ -1273,6 +1325,7 @@ g_part_ctlreq(struct gctl_req *req, stru } else if (!strcmp(verb, "destroy")) { ctlreq = G_PART_CTL_DESTROY; mparms |= G_PART_PARM_GEOM; + oparms |= G_PART_PARM_FORCE; } break; case 'm': @@ -1343,6 +1396,8 @@ g_part_ctlreq(struct gctl_req *req, stru case 'f': if (!strcmp(ap->name, "flags")) parm = G_PART_PARM_FLAGS; + else if (!strcmp(ap->name, "force")) + parm = G_PART_PARM_FORCE; break; case 'g': if (!strcmp(ap->name, "geom")) @@ -1412,6 +1467,9 @@ g_part_ctlreq(struct gctl_req *req, stru continue; error = g_part_parm_str(p, &gpp.gpp_flags); break; + case G_PART_PARM_FORCE: + error = g_part_parm_uint(p, &gpp.gpp_force); + break; case G_PART_PARM_GEOM: error = g_part_parm_geom(p, &gpp.gpp_geom); break; @@ -1465,6 +1523,13 @@ g_part_ctlreq(struct gctl_req *req, stru table = NULL; if (modifies && (gpp.gpp_parms & G_PART_PARM_GEOM)) { table = gpp.gpp_geom->softc; + if (table != NULL && table->gpt_corrupt && + ctlreq != G_PART_CTL_DESTROY && + ctlreq != G_PART_CTL_RECOVER) { + gctl_error(req, "%d table '%s' is corrupt", + EPERM, gpp.gpp_geom->name); + return; + } if (table != NULL && !table->gpt_opened) { error = g_access(LIST_FIRST(&gpp.gpp_geom->consumer), 1, 1, 1); @@ -1729,6 +1794,8 @@ g_part_dumpconf(struct sbuf *sb, const c table->gpt_sectors); sbuf_printf(sb, "%s%u\n", indent, table->gpt_heads); + sbuf_printf(sb, "%s%s\n", indent, + table->gpt_corrupt ? "CORRUPT": "OK"); G_PART_DUMPCONF(table, NULL, sb, indent); } } Modified: stable/8/sys/geom/part/g_part.h ============================================================================== --- stable/8/sys/geom/part/g_part.h Mon Nov 8 09:50:47 2010 (r214974) +++ stable/8/sys/geom/part/g_part.h Mon Nov 8 10:08:30 2010 (r214975) @@ -132,6 +132,7 @@ struct g_part_table { int gpt_modified:1; /* Table changes have been made. */ int gpt_opened:1; /* Permissions obtained. */ int gpt_fixgeom:1; /* Geometry is fixed. */ + int gpt_corrupt:1; /* Table is corrupt. */ }; struct g_part_entry *g_part_new_entry(struct g_part_table *, int, quad_t, @@ -169,6 +170,7 @@ enum g_part_ctl { #define G_PART_PARM_VERSION 0x0800 #define G_PART_PARM_BOOTCODE 0x1000 #define G_PART_PARM_ATTRIB 0x2000 +#define G_PART_PARM_FORCE 0x4000 struct g_part_parms { unsigned int gpp_parms; @@ -186,6 +188,7 @@ struct g_part_parms { const void *gpp_codeptr; unsigned int gpp_codesize; const char *gpp_attrib; + unsigned int gpp_force; }; void g_part_geometry_heads(off_t, u_int, off_t *, u_int *); Modified: stable/8/sys/geom/part/g_part_gpt.c ============================================================================== --- stable/8/sys/geom/part/g_part_gpt.c Mon Nov 8 09:50:47 2010 (r214974) +++ stable/8/sys/geom/part/g_part_gpt.c Mon Nov 8 10:08:30 2010 (r214975) @@ -94,7 +94,7 @@ static int g_part_gpt_destroy(struct g_p static void g_part_gpt_dumpconf(struct g_part_table *, struct g_part_entry *, struct sbuf *, const char *); static int g_part_gpt_dumpto(struct g_part_table *, struct g_part_entry *); -static int g_part_gpt_modify(struct g_part_table *, struct g_part_entry *, +static int g_part_gpt_modify(struct g_part_table *, struct g_part_entry *, struct g_part_parms *); static const char *g_part_gpt_name(struct g_part_table *, struct g_part_entry *, char *, size_t); @@ -107,6 +107,7 @@ static const char *g_part_gpt_type(struc static int g_part_gpt_write(struct g_part_table *, struct g_consumer *); static int g_part_gpt_resize(struct g_part_table *, struct g_part_entry *, struct g_part_parms *); +static int g_part_gpt_recover(struct g_part_table *); static kobj_method_t g_part_gpt_methods[] = { KOBJMETHOD(g_part_add, g_part_gpt_add), @@ -120,6 +121,7 @@ static kobj_method_t g_part_gpt_methods[ KOBJMETHOD(g_part_name, g_part_gpt_name), KOBJMETHOD(g_part_probe, g_part_gpt_probe), KOBJMETHOD(g_part_read, g_part_gpt_read), + KOBJMETHOD(g_part_recover, g_part_gpt_recover), KOBJMETHOD(g_part_setunset, g_part_gpt_setunset), KOBJMETHOD(g_part_type, g_part_gpt_type), KOBJMETHOD(g_part_write, g_part_gpt_write), @@ -170,7 +172,7 @@ static struct uuid gpt_uuid_unused = GPT static struct g_part_uuid_alias { struct uuid *uuid; - int alias; + int alias; } gpt_uuid_alias_match[] = { { &gpt_uuid_apple_boot, G_PART_ALIAS_APPLE_BOOT }, { &gpt_uuid_apple_hfs, G_PART_ALIAS_APPLE_HFS }, @@ -217,8 +219,16 @@ gpt_read_hdr(struct g_part_gpt_table *ta pp = cp->provider; last = (pp->mediasize / pp->sectorsize) - 1; - table->lba[elt] = (elt == GPT_ELT_PRIHDR) ? 1 : last; table->state[elt] = GPT_STATE_MISSING; + /* + * If the primary header is valid look for secondary + * header in AlternateLBA, otherwise in the last medium's LBA. + */ + if (elt == GPT_ELT_SECHDR) { + if (table->state[GPT_ELT_PRIHDR] != GPT_STATE_OK) + table->lba[elt] = last; + } else + table->lba[elt] = 1; buf = g_read_data(cp, table->lba[elt] * pp->sectorsize, pp->sectorsize, &error); if (buf == NULL) @@ -244,12 +254,15 @@ gpt_read_hdr(struct g_part_gpt_table *ta table->state[elt] = GPT_STATE_INVALID; hdr->hdr_revision = le32toh(buf->hdr_revision); - if (hdr->hdr_revision < 0x00010000) + if (hdr->hdr_revision < GPT_HDR_REVISION) goto fail; hdr->hdr_lba_self = le64toh(buf->hdr_lba_self); if (hdr->hdr_lba_self != table->lba[elt]) goto fail; hdr->hdr_lba_alt = le64toh(buf->hdr_lba_alt); + if (hdr->hdr_lba_alt == hdr->hdr_lba_self || + hdr->hdr_lba_alt > last) + goto fail; /* Check the managed area. */ hdr->hdr_lba_start = le64toh(buf->hdr_lba_start); @@ -283,6 +296,10 @@ gpt_read_hdr(struct g_part_gpt_table *ta le_uuid_dec(&buf->hdr_uuid, &hdr->hdr_uuid); hdr->hdr_crc_table = le32toh(buf->hdr_crc_table); + /* save LBA for secondary header */ + if (elt == GPT_ELT_PRIHDR) + table->lba[GPT_ELT_SECHDR] = hdr->hdr_lba_alt; + g_free(buf); return (hdr); @@ -490,18 +507,21 @@ static int g_part_gpt_destroy(struct g_part_table *basetable, struct g_part_parms *gpp) { struct g_part_gpt_table *table; + struct g_provider *pp; table = (struct g_part_gpt_table *)basetable; - if (table->hdr != NULL) - g_free(table->hdr); + pp = LIST_FIRST(&basetable->gpt_gp->consumer)->provider; + g_free(table->hdr); table->hdr = NULL; /* - * Wipe the first 2 sectors as well as the last to clear the - * partitioning. + * Wipe the first 2 sectors to clear the partitioning. Wipe the last + * sector only if it has valid secondary header. */ basetable->gpt_smhead |= 3; - basetable->gpt_smtail |= 1; + if (table->state[GPT_ELT_SECHDR] == GPT_STATE_OK && + table->lba[GPT_ELT_SECHDR] == pp->mediasize / pp->sectorsize - 1) + basetable->gpt_smtail |= 1; return (0); } @@ -665,10 +685,12 @@ g_part_gpt_read(struct g_part_table *bas struct g_part_gpt_table *table; struct g_part_gpt_entry *entry; u_char *buf; + uint64_t last; int error, index; table = (struct g_part_gpt_table *)basetable; pp = cp->provider; + last = (pp->mediasize / pp->sectorsize) - 1; /* Read the PMBR */ buf = g_read_data(cp, 0, pp->sectorsize, &error); @@ -732,6 +754,7 @@ g_part_gpt_read(struct g_part_table *bas printf("GEOM: %s: using the secondary instead -- recovery " "strongly advised.\n", pp->name); table->hdr = sechdr; + basetable->gpt_corrupt = 1; if (prihdr != NULL) g_free(prihdr); tbl = sectbl; @@ -743,6 +766,11 @@ g_part_gpt_read(struct g_part_table *bas "or invalid.\n", pp->name); printf("GEOM: %s: using the primary only -- recovery " "suggested.\n", pp->name); + basetable->gpt_corrupt = 1; + } else if (table->lba[GPT_ELT_SECHDR] != last) { + printf( "GEOM: %s: the secondary GPT header is not in " + "the last LBA.\n", pp->name); + basetable->gpt_corrupt = 1; } table->hdr = prihdr; if (sechdr != NULL) @@ -759,8 +787,9 @@ g_part_gpt_read(struct g_part_table *bas for (index = basetable->gpt_entries - 1; index >= 0; index--) { if (EQUUID(&tbl[index].ent_type, &gpt_uuid_unused)) continue; - entry = (struct g_part_gpt_entry *)g_part_new_entry(basetable, - index+1, tbl[index].ent_lba_start, tbl[index].ent_lba_end); + entry = (struct g_part_gpt_entry *)g_part_new_entry( + basetable, index + 1, tbl[index].ent_lba_start, + tbl[index].ent_lba_end); entry->ent = tbl[index]; } @@ -769,6 +798,38 @@ g_part_gpt_read(struct g_part_table *bas } static int +g_part_gpt_recover(struct g_part_table *basetable) +{ + struct g_part_gpt_table *table; + struct g_provider *pp; + uint64_t last; + size_t tblsz; + + table = (struct g_part_gpt_table *)basetable; + pp = LIST_FIRST(&basetable->gpt_gp->consumer)->provider; + last = pp->mediasize / pp->sectorsize - 1; + tblsz = (table->hdr->hdr_entries * table->hdr->hdr_entsz + + pp->sectorsize - 1) / pp->sectorsize; + + table->lba[GPT_ELT_PRIHDR] = 1; + table->lba[GPT_ELT_PRITBL] = 2; + table->lba[GPT_ELT_SECHDR] = last; + table->lba[GPT_ELT_SECTBL] = last - tblsz; + table->state[GPT_ELT_PRIHDR] = GPT_STATE_OK; + table->state[GPT_ELT_PRITBL] = GPT_STATE_OK; + table->state[GPT_ELT_SECHDR] = GPT_STATE_OK; + table->state[GPT_ELT_SECTBL] = GPT_STATE_OK; + table->hdr->hdr_lba_start = 2 + tblsz; + table->hdr->hdr_lba_end = last - tblsz - 1; + + basetable->gpt_first = table->hdr->hdr_lba_start; + basetable->gpt_last = table->hdr->hdr_lba_end; + basetable->gpt_corrupt = 0; + + return (0); +} + +static int g_part_gpt_setunset(struct g_part_table *table, struct g_part_entry *baseentry, const char *attrib, unsigned int set) { @@ -867,13 +928,13 @@ g_part_gpt_write(struct g_part_table *ba struct g_part_entry *baseentry; struct g_part_gpt_entry *entry; struct g_part_gpt_table *table; - size_t tlbsz; + size_t tblsz; uint32_t crc; int error, index; pp = cp->provider; table = (struct g_part_gpt_table *)basetable; - tlbsz = (table->hdr->hdr_entries * table->hdr->hdr_entsz + + tblsz = (table->hdr->hdr_entries * table->hdr->hdr_entsz + pp->sectorsize - 1) / pp->sectorsize; /* Write the PMBR */ @@ -885,7 +946,7 @@ g_part_gpt_write(struct g_part_table *ba return (error); /* Allocate space for the header and entries. */ - buf = g_malloc((tlbsz + 1) * pp->sectorsize, M_WAITOK | M_ZERO); + buf = g_malloc((tblsz + 1) * pp->sectorsize, M_WAITOK | M_ZERO); memcpy(buf, table->hdr->hdr_sig, sizeof(table->hdr->hdr_sig)); le32enc(buf + 8, table->hdr->hdr_revision); @@ -924,7 +985,7 @@ g_part_gpt_write(struct g_part_table *ba le32enc(buf + 16, crc); error = g_write_data(cp, table->lba[GPT_ELT_PRITBL] * pp->sectorsize, - buf + pp->sectorsize, tlbsz * pp->sectorsize); + buf + pp->sectorsize, tblsz * pp->sectorsize); if (error) goto out; error = g_write_data(cp, table->lba[GPT_ELT_PRIHDR] * pp->sectorsize, @@ -941,7 +1002,7 @@ g_part_gpt_write(struct g_part_table *ba le32enc(buf + 16, crc); error = g_write_data(cp, table->lba[GPT_ELT_SECTBL] * pp->sectorsize, - buf + pp->sectorsize, tlbsz * pp->sectorsize); + buf + pp->sectorsize, tblsz * pp->sectorsize); if (error) goto out; error = g_write_data(cp, table->lba[GPT_ELT_SECHDR] * pp->sectorsize, Modified: stable/8/sys/geom/part/g_part_if.m ============================================================================== --- stable/8/sys/geom/part/g_part_if.m Mon Nov 8 09:50:47 2010 (r214974) +++ stable/8/sys/geom/part/g_part_if.m Mon Nov 8 10:08:30 2010 (r214975) @@ -65,6 +65,12 @@ CODE { { return (ENOSYS); } + + static int + default_recover(struct g_part_table *t __unused) + { + return (ENOSYS); + } }; # add() - scheme specific processing for the add verb. @@ -163,6 +169,11 @@ METHOD int read { struct g_consumer *cp; }; +# recover() - scheme specific processing for the recover verb. +METHOD int recover { + struct g_part_table *table; +} DEFAULT default_recover; + # setunset() - set or unset partition entry attributes. METHOD int setunset { struct g_part_table *table; From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 10:18:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A727106566B; Mon, 8 Nov 2010 10:18: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 07D678FC12; Mon, 8 Nov 2010 10:18:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8AI1U4023808; Mon, 8 Nov 2010 10:18:01 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8AI1uT023806; Mon, 8 Nov 2010 10:18:01 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201011081018.oA8AI1uT023806@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 8 Nov 2010 10:18:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214976 - stable/8/sys/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 10:18:02 -0000 Author: kib Date: Mon Nov 8 10:18:01 2010 New Revision: 214976 URL: http://svn.freebsd.org/changeset/base/214976 Log: MFC r214851: Fix a bug in r214049. The nvp == vp case shall be handled specially only for !usevget case. If VFS_VGET is working, the vnode shared lock is obtained recursively and vput() shall be done, not vunref(). Modified: stable/8/sys/nfsserver/nfs_serv.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/nfsserver/nfs_serv.c ============================================================================== --- stable/8/sys/nfsserver/nfs_serv.c Mon Nov 8 10:08:30 2010 (r214975) +++ stable/8/sys/nfsserver/nfs_serv.c Mon Nov 8 10:18:01 2010 (r214976) @@ -3252,7 +3252,7 @@ again: nfhp->fh_fsid = nvp->v_mount->mnt_stat.f_fsid; if ((error1 = VOP_VPTOFH(nvp, &nfhp->fh_fid)) == 0) error1 = VOP_GETATTR(nvp, vap, cred); - if (vp == nvp) + if (!usevget && vp == nvp) vunref(nvp); else vput(nvp); From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 10:23:39 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3874106564A; Mon, 8 Nov 2010 10:23:39 +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 C09C18FC1D; Mon, 8 Nov 2010 10:23:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8ANdCd024104; Mon, 8 Nov 2010 10:23:39 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8ANdj9024099; Mon, 8 Nov 2010 10:23:39 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201011081023.oA8ANdj9024099@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 8 Nov 2010 10:23:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214977 - stable/8/sys/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 10:23:40 -0000 Author: kib Date: Mon Nov 8 10:23:39 2010 New Revision: 214977 URL: http://svn.freebsd.org/changeset/base/214977 Log: MFC r214026: Do not synchronously start the nfsiod threads at all. The r212506 fixed the issues with file descriptor locks, but the same problems are present for vnode lock/user map lock. Modified: stable/8/sys/nfsclient/nfs.h stable/8/sys/nfsclient/nfs_bio.c stable/8/sys/nfsclient/nfs_nfsiod.c stable/8/sys/nfsclient/nfsnode.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/nfsclient/nfs.h ============================================================================== --- stable/8/sys/nfsclient/nfs.h Mon Nov 8 10:18:01 2010 (r214976) +++ stable/8/sys/nfsclient/nfs.h Mon Nov 8 10:23:39 2010 (r214977) @@ -253,7 +253,7 @@ int nfs_writerpc(struct vnode *, struct int nfs_commit(struct vnode *vp, u_quad_t offset, int cnt, struct ucred *cred, struct thread *td); int nfs_readdirrpc(struct vnode *, struct uio *, struct ucred *); -int nfs_nfsiodnew(int); +void nfs_nfsiodnew(void); void nfs_nfsiodnew_tq(__unused void *, int); int nfs_asyncio(struct nfsmount *, struct buf *, struct ucred *, struct thread *); int nfs_doio(struct vnode *, struct buf *, struct ucred *, struct thread *); Modified: stable/8/sys/nfsclient/nfs_bio.c ============================================================================== --- stable/8/sys/nfsclient/nfs_bio.c Mon Nov 8 10:18:01 2010 (r214976) +++ stable/8/sys/nfsclient/nfs_bio.c Mon Nov 8 10:23:39 2010 (r214977) @@ -1379,13 +1379,9 @@ again: /* * Try to create one if none are free. */ - if (!gotiod) { - iod = nfs_nfsiodnew(1); - if (iod != -1) - gotiod = TRUE; - } - - if (gotiod) { + if (!gotiod) + nfs_nfsiodnew(); + else { /* * Found one, so wake it up and tell it which * mount to process. @@ -1405,7 +1401,7 @@ again: if (!gotiod) { if (nmp->nm_bufqiods > 0) { NFS_DPF(ASYNCIO, - ("nfs_asyncio: %d iods are already processing mount %p\n", + ("nfs_asyncio: %d iods are already processing mount %p\n", nmp->nm_bufqiods, nmp)); gotiod = TRUE; } @@ -1420,9 +1416,9 @@ again: * Ensure that the queue never grows too large. We still want * to asynchronize so we block rather then return EIO. */ - while (nmp->nm_bufqlen >= 2*nfs_numasync) { + while (nmp->nm_bufqlen >= 2 * nfs_numasync) { NFS_DPF(ASYNCIO, - ("nfs_asyncio: waiting for mount %p queue to drain\n", nmp)); + ("nfs_asyncio: waiting for mount %p queue to drain\n", nmp)); nmp->nm_bufqwant = TRUE; error = nfs_msleep(td, &nmp->nm_bufq, &nfs_iod_mtx, slpflag | PRIBIO, @@ -1430,7 +1426,7 @@ again: if (error) { error2 = nfs_sigintr(nmp, td); if (error2) { - mtx_unlock(&nfs_iod_mtx); + mtx_unlock(&nfs_iod_mtx); return (error2); } if (slpflag == NFS_PCATCH) { @@ -1442,17 +1438,13 @@ again: * We might have lost our iod while sleeping, * so check and loop if nescessary. */ - if (nmp->nm_bufqiods == 0) { - NFS_DPF(ASYNCIO, - ("nfs_asyncio: no iods after mount %p queue was drained, looping\n", nmp)); - goto again; - } + goto again; } /* We might have lost our nfsiod */ if (nmp->nm_bufqiods == 0) { NFS_DPF(ASYNCIO, - ("nfs_asyncio: no iods after mount %p queue was drained, looping\n", nmp)); +("nfs_asyncio: no iods after mount %p queue was drained, looping\n", nmp)); goto again; } Modified: stable/8/sys/nfsclient/nfs_nfsiod.c ============================================================================== --- stable/8/sys/nfsclient/nfs_nfsiod.c Mon Nov 8 10:18:01 2010 (r214976) +++ stable/8/sys/nfsclient/nfs_nfsiod.c Mon Nov 8 10:23:39 2010 (r214977) @@ -76,16 +76,6 @@ static MALLOC_DEFINE(M_NFSSVC, "nfsclien static void nfssvc_iod(void *); -struct nfsiod_str { - STAILQ_ENTRY(nfsiod_str) ni_links; - int *ni_inst; - int ni_iod; - int ni_error; - int ni_done; -}; -static STAILQ_HEAD(, nfsiod_str) nfsiodhead = - STAILQ_HEAD_INITIALIZER(nfsiodhead); - static int nfs_asyncdaemon[NFS_MAXASYNCDAEMON]; SYSCTL_DECL(_vfs_nfs); @@ -101,6 +91,8 @@ unsigned int nfs_iodmax = 20; /* Minimum number of nfsiod kthreads to keep as spares */ static unsigned int nfs_iodmin = 0; +static int nfs_nfsiodnew_sync(void); + static int sysctl_iodmin(SYSCTL_HANDLER_ARGS) { @@ -124,7 +116,7 @@ sysctl_iodmin(SYSCTL_HANDLER_ARGS) * than the new minimum, create some more. */ for (i = nfs_iodmin - nfs_numasync; i > 0; i--) - nfs_nfsiodnew(0); + nfs_nfsiodnew_sync(); out: mtx_unlock(&nfs_iod_mtx); return (0); @@ -170,68 +162,55 @@ SYSCTL_PROC(_vfs_nfs, OID_AUTO, iodmax, sizeof (nfs_iodmax), sysctl_iodmax, "IU", "Max number of nfsiod kthreads"); +static int +nfs_nfsiodnew_sync(void) +{ + int error, i; + + mtx_assert(&nfs_iod_mtx, MA_OWNED); + for (i = 0; i < nfs_iodmax; i++) { + if (nfs_asyncdaemon[i] == 0) { + nfs_asyncdaemon[i] = 1; + break; + } + } + if (i == nfs_iodmax) + return (0); + mtx_unlock(&nfs_iod_mtx); + error = kproc_create(nfssvc_iod, nfs_asyncdaemon + i, NULL, + RFHIGHPID, 0, "nfsiod %d", i); + mtx_lock(&nfs_iod_mtx); + if (error == 0) { + nfs_numasync++; + nfs_iodwant[i] = NFSIOD_AVAILABLE; + } else + nfs_asyncdaemon[i] = 0; + return (error); +} + void nfs_nfsiodnew_tq(__unused void *arg, int pending) { - struct nfsiod_str *nip; mtx_lock(&nfs_iod_mtx); - while ((nip = STAILQ_FIRST(&nfsiodhead)) != NULL) { - STAILQ_REMOVE_HEAD(&nfsiodhead, ni_links); - mtx_unlock(&nfs_iod_mtx); - nip->ni_error = kproc_create(nfssvc_iod, nip->ni_inst, NULL, - RFHIGHPID, 0, "nfsiod %d", nip->ni_iod); - nip->ni_done = 1; - mtx_lock(&nfs_iod_mtx); - wakeup(nip); + while (pending > 0) { + pending--; + nfs_nfsiodnew_sync(); } mtx_unlock(&nfs_iod_mtx); } -int -nfs_nfsiodnew(int set_iodwant) +void +nfs_nfsiodnew(void) { - int error, i; - int newiod; - struct nfsiod_str *nip; - if (nfs_numasync >= nfs_iodmax) - return (-1); - newiod = -1; - for (i = 0; i < nfs_iodmax; i++) - if (nfs_asyncdaemon[i] == 0) { - nfs_asyncdaemon[i]++; - newiod = i; - break; - } - if (newiod == -1) - return (-1); - if (set_iodwant > 0) - nfs_iodwant[i] = NFSIOD_CREATED_FOR_NFS_ASYNCIO; - mtx_unlock(&nfs_iod_mtx); - nip = malloc(sizeof(*nip), M_TEMP, M_WAITOK | M_ZERO); - nip->ni_inst = nfs_asyncdaemon + i; - nip->ni_iod = newiod; - mtx_lock(&nfs_iod_mtx); - STAILQ_INSERT_TAIL(&nfsiodhead, nip, ni_links); + mtx_assert(&nfs_iod_mtx, MA_OWNED); taskqueue_enqueue(taskqueue_thread, &nfs_nfsiodnew_task); - while (!nip->ni_done) - mtx_sleep(nip, &nfs_iod_mtx, 0, "niwt", 0); - error = nip->ni_error; - free(nip, M_TEMP); - if (error) { - if (set_iodwant > 0) - nfs_iodwant[i] = NFSIOD_NOT_AVAILABLE; - return (-1); - } - nfs_numasync++; - return (newiod); } static void nfsiod_setup(void *dummy) { - int i; int error; TUNABLE_INT_FETCH("vfs.nfs.iodmin", &nfs_iodmin); @@ -240,8 +219,8 @@ nfsiod_setup(void *dummy) if (nfs_iodmin > NFS_MAXASYNCDAEMON) nfs_iodmin = NFS_MAXASYNCDAEMON; - for (i = 0; i < nfs_iodmin; i++) { - error = nfs_nfsiodnew(0); + while (nfs_numasync < nfs_iodmin) { + error = nfs_nfsiodnew_sync(); if (error == -1) panic("nfsiod_setup: nfs_nfsiodnew failed"); } Modified: stable/8/sys/nfsclient/nfsnode.h ============================================================================== --- stable/8/sys/nfsclient/nfsnode.h Mon Nov 8 10:18:01 2010 (r214976) +++ stable/8/sys/nfsclient/nfsnode.h Mon Nov 8 10:23:39 2010 (r214977) @@ -175,16 +175,13 @@ struct nfsnode { #define NFS_TIMESPEC_COMPARE(T1, T2) (((T1)->tv_sec != (T2)->tv_sec) || ((T1)->tv_nsec != (T2)->tv_nsec)) /* - * NFS iod threads can be in one of these three states once spawned. + * NFS iod threads can be in one of these two states once spawned. * NFSIOD_NOT_AVAILABLE - Cannot be assigned an I/O operation at this time. * NFSIOD_AVAILABLE - Available to be assigned an I/O operation. - * NFSIOD_CREATED_FOR_NFS_ASYNCIO - Newly created for nfs_asyncio() and - * will be used by the thread that called nfs_asyncio(). */ enum nfsiod_state { NFSIOD_NOT_AVAILABLE = 0, NFSIOD_AVAILABLE = 1, - NFSIOD_CREATED_FOR_NFS_ASYNCIO = 2, }; /* From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 10:39:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1418F106566C; Mon, 8 Nov 2010 10:39:03 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 012278FC1C; Mon, 8 Nov 2010 10:39:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8Ad255026192; Mon, 8 Nov 2010 10:39:02 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8Ad2Jn026190; Mon, 8 Nov 2010 10:39:02 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201011081039.oA8Ad2Jn026190@svn.freebsd.org> From: Rui Paulo Date: Mon, 8 Nov 2010 10:39:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214978 - in stable/8/lib: librtld_db libusb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 10:39:03 -0000 Author: rpaulo Date: Mon Nov 8 10:39:02 2010 New Revision: 214978 URL: http://svn.freebsd.org/changeset/base/214978 Log: MFC r210678, r210769: librtld_db is an rtld debugging helper library used by userland DTrace. Added: - copied from r210678, head/lib/librtld_db/ Directory Properties: stable/8/lib/librtld_db/ (props changed) Modified: stable/8/lib/librtld_db/librtld_db.3 Directory Properties: stable/8/lib/ (props changed) stable/8/lib/bind/ (props changed) stable/8/lib/csu/ (props changed) stable/8/lib/libarchive/ (props changed) stable/8/lib/libbluetooth/ (props changed) stable/8/lib/libc_r/ (props changed) stable/8/lib/libcam/ (props changed) stable/8/lib/libcompat/ (props changed) stable/8/lib/libdevinfo/ (props changed) stable/8/lib/libdisk/ (props changed) stable/8/lib/libedit/ (props changed) stable/8/lib/libelf/ (props changed) stable/8/lib/libexpat/ (props changed) stable/8/lib/libfetch/ (props changed) stable/8/lib/libgeom/ (props changed) stable/8/lib/libgpib/ (props changed) stable/8/lib/libgssapi/ (props changed) stable/8/lib/libjail/ (props changed) stable/8/lib/libkse/ (props changed) stable/8/lib/libkvm/ (props changed) stable/8/lib/liblzma/ (props changed) stable/8/lib/libmagic/ (props changed) stable/8/lib/libmemstat/ (props changed) stable/8/lib/libpam/ (props changed) stable/8/lib/libpmc/ (props changed) stable/8/lib/libradius/ (props changed) stable/8/lib/librpcsec_gss/ (props changed) stable/8/lib/libsm/ (props changed) stable/8/lib/libstand/ (props changed) stable/8/lib/libtacplus/ (props changed) stable/8/lib/libthr/ (props changed) stable/8/lib/libthread_db/ (props changed) stable/8/lib/libufs/ (props changed) stable/8/lib/libugidfw/ (props changed) stable/8/lib/libusb/ (props changed) stable/8/lib/libusb/usb.h (props changed) stable/8/lib/libusbhid/ (props changed) stable/8/lib/libutil/ (props changed) stable/8/lib/libz/ (props changed) stable/8/lib/libz/contrib/ (props changed) stable/8/lib/msun/ (props changed) Modified: stable/8/lib/librtld_db/librtld_db.3 ============================================================================== --- head/lib/librtld_db/librtld_db.3 Sat Jul 31 14:26:10 2010 (r210678) +++ stable/8/lib/librtld_db/librtld_db.3 Mon Nov 8 10:39:02 2010 (r214978) @@ -44,7 +44,7 @@ .Fc .Ft char * .Fo rd_errstr -.Fa "rd_err_e rderr" +.Fa "rd_err_e rderr" .Fc .Ft rd_err_e .Fo rd_event_addr @@ -84,8 +84,8 @@ .Fc .Ft rd_err_e .Fo rd_plt_resolution -.Fa "rd_agent_t *rdap, uintptr_t pc, struct proc *proc -.Fa "uintptr_t plt_base, rd_plt_info_t *rpi" +.Fa "rd_agent_t *rdap, uintptr_t pc, struct proc *proc" +.Fa "uintptr_t plt_base, rd_plt_info_t *rpi" .Fc .Ft rd_err_e .Fo rd_reset @@ -101,7 +101,7 @@ This library must be used along with Most library functions take a .Ft rd_agent_t argument. -This argument is an opaque structure containing information associated with +This argument is an opaque structure containing information associated with the current status of the agent. .Pp Before you start using @@ -163,14 +163,6 @@ type error. The error codes are described in the header file for this library. You can get the error string using .Fn rd_errstr . -.Sh CAVEATS -The functions -.Fn rd_event_enable , -.Fn rd_log , -.Fn rd_objpad_enable -and -.Fn rd_plt_resolution -are not yet implemented. .Sh SEE ALSO .Xr ld 1 , .Xr ld-elf.so.1 1 , @@ -179,13 +171,21 @@ are not yet implemented. .Xr rtld 1 .Sh HISTORY The -.Nm librtld_db +.Nm librtld_db library first appeared in -.Fx 9.0 +.Fx 9.0 and was modeled after the same library present in the Solaris operating system. .Sh AUTHORS The .Nm librtld_db library and this manual page were written by -.An Rui Paulo Aq rpaulo@FreeBSD.org +.An Rui Paulo Aq rpaulo@FreeBSD.org under sponsorship from the FreeBSD Foundation. +.Sh CAVEATS +The functions +.Fn rd_event_enable , +.Fn rd_log , +.Fn rd_objpad_enable +and +.Fn rd_plt_resolution +are not yet implemented. From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 10:45:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81B31106564A; Mon, 8 Nov 2010 10:45:45 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A0338FC12; Mon, 8 Nov 2010 10:45:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8AjjHC026592; Mon, 8 Nov 2010 10:45:45 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8AjjgM026584; Mon, 8 Nov 2010 10:45:45 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201011081045.oA8AjjgM026584@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 8 Nov 2010 10:45:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214979 - in vendor-crypto/openssh/dist: . contrib contrib/aix contrib/caldera contrib/cygwin contrib/redhat contrib/suse openbsd-compat regress X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 10:45:45 -0000 Author: des Date: Mon Nov 8 10:45:44 2010 New Revision: 214979 URL: http://svn.freebsd.org/changeset/base/214979 Log: Vendor import of OpenSSH 5.6p1 Added: vendor-crypto/openssh/dist/openbsd-compat/strptime.c (contents, props changed) Modified: vendor-crypto/openssh/dist/ChangeLog vendor-crypto/openssh/dist/Makefile.in vendor-crypto/openssh/dist/PROTOCOL.certkeys vendor-crypto/openssh/dist/PROTOCOL.mux vendor-crypto/openssh/dist/README vendor-crypto/openssh/dist/auth-options.c vendor-crypto/openssh/dist/auth-options.h vendor-crypto/openssh/dist/auth-rsa.c vendor-crypto/openssh/dist/auth.c vendor-crypto/openssh/dist/auth.h vendor-crypto/openssh/dist/auth1.c vendor-crypto/openssh/dist/auth2-hostbased.c vendor-crypto/openssh/dist/auth2-none.c vendor-crypto/openssh/dist/auth2-pubkey.c vendor-crypto/openssh/dist/authfd.c vendor-crypto/openssh/dist/authfile.c vendor-crypto/openssh/dist/authfile.h vendor-crypto/openssh/dist/bufaux.c vendor-crypto/openssh/dist/channels.c vendor-crypto/openssh/dist/channels.h vendor-crypto/openssh/dist/clientloop.c vendor-crypto/openssh/dist/clientloop.h vendor-crypto/openssh/dist/config.h.in vendor-crypto/openssh/dist/configure vendor-crypto/openssh/dist/configure.ac vendor-crypto/openssh/dist/contrib/aix/buildbff.sh vendor-crypto/openssh/dist/contrib/caldera/openssh.spec vendor-crypto/openssh/dist/contrib/cygwin/README vendor-crypto/openssh/dist/contrib/redhat/openssh.spec vendor-crypto/openssh/dist/contrib/ssh-copy-id vendor-crypto/openssh/dist/contrib/ssh-copy-id.1 vendor-crypto/openssh/dist/contrib/suse/openssh.spec vendor-crypto/openssh/dist/jpake.c vendor-crypto/openssh/dist/key.c vendor-crypto/openssh/dist/key.h vendor-crypto/openssh/dist/loginrec.h vendor-crypto/openssh/dist/misc.c vendor-crypto/openssh/dist/misc.h vendor-crypto/openssh/dist/moduli.0 vendor-crypto/openssh/dist/monitor.c vendor-crypto/openssh/dist/mux.c vendor-crypto/openssh/dist/myproposal.h vendor-crypto/openssh/dist/openbsd-compat/Makefile.in vendor-crypto/openssh/dist/openbsd-compat/openbsd-compat.h vendor-crypto/openssh/dist/openbsd-compat/openssl-compat.h vendor-crypto/openssh/dist/openbsd-compat/port-tun.c vendor-crypto/openssh/dist/openbsd-compat/port-uw.c vendor-crypto/openssh/dist/packet.c vendor-crypto/openssh/dist/readconf.c vendor-crypto/openssh/dist/readconf.h vendor-crypto/openssh/dist/regress/Makefile vendor-crypto/openssh/dist/regress/README.regress vendor-crypto/openssh/dist/regress/cert-hostkey.sh vendor-crypto/openssh/dist/regress/cert-userkey.sh vendor-crypto/openssh/dist/regress/login-timeout.sh vendor-crypto/openssh/dist/regress/reconfigure.sh vendor-crypto/openssh/dist/regress/reexec.sh vendor-crypto/openssh/dist/regress/test-exec.sh vendor-crypto/openssh/dist/scp.0 vendor-crypto/openssh/dist/scp.c vendor-crypto/openssh/dist/servconf.c vendor-crypto/openssh/dist/servconf.h vendor-crypto/openssh/dist/session.c vendor-crypto/openssh/dist/sftp-client.c vendor-crypto/openssh/dist/sftp-server.0 vendor-crypto/openssh/dist/sftp.0 vendor-crypto/openssh/dist/sftp.c vendor-crypto/openssh/dist/ssh-add.0 vendor-crypto/openssh/dist/ssh-add.c vendor-crypto/openssh/dist/ssh-agent.0 vendor-crypto/openssh/dist/ssh-agent.c vendor-crypto/openssh/dist/ssh-dss.c vendor-crypto/openssh/dist/ssh-keygen.0 vendor-crypto/openssh/dist/ssh-keygen.1 vendor-crypto/openssh/dist/ssh-keygen.c vendor-crypto/openssh/dist/ssh-keyscan.0 vendor-crypto/openssh/dist/ssh-keyscan.c vendor-crypto/openssh/dist/ssh-keysign.0 vendor-crypto/openssh/dist/ssh-keysign.8 vendor-crypto/openssh/dist/ssh-keysign.c vendor-crypto/openssh/dist/ssh-pkcs11-helper.0 vendor-crypto/openssh/dist/ssh-pkcs11.c vendor-crypto/openssh/dist/ssh-rand-helper.0 vendor-crypto/openssh/dist/ssh-rsa.c vendor-crypto/openssh/dist/ssh.0 vendor-crypto/openssh/dist/ssh.1 vendor-crypto/openssh/dist/ssh.c vendor-crypto/openssh/dist/ssh.h vendor-crypto/openssh/dist/ssh_config.0 vendor-crypto/openssh/dist/ssh_config.5 vendor-crypto/openssh/dist/sshconnect.c vendor-crypto/openssh/dist/sshconnect2.c vendor-crypto/openssh/dist/sshd.0 vendor-crypto/openssh/dist/sshd.8 vendor-crypto/openssh/dist/sshd.c vendor-crypto/openssh/dist/sshd_config.0 vendor-crypto/openssh/dist/sshd_config.5 vendor-crypto/openssh/dist/version.h Modified: vendor-crypto/openssh/dist/ChangeLog ============================================================================== --- vendor-crypto/openssh/dist/ChangeLog Mon Nov 8 10:39:02 2010 (r214978) +++ vendor-crypto/openssh/dist/ChangeLog Mon Nov 8 10:45:44 2010 (r214979) @@ -1,3 +1,522 @@ +20100823 + - (djm) Release OpenSSH-5.6p1 + +20100816 + - (dtucker) [configure.ac openbsd-compat/Makefile.in + openbsd-compat/openbsd-compat.h openbsd-compat/strptime.c] Add strptime to + the compat library which helps on platforms like old IRIX. Based on work + by djm, tested by Tom Christensen. + - OpenBSD CVS Sync + - djm@cvs.openbsd.org 2010/08/12 21:49:44 + [ssh.c] + close any extra file descriptors inherited from parent at start and + reopen stdin/stdout to /dev/null when forking for ControlPersist. + + prevents tools that fork and run a captive ssh for communication from + failing to exit when the ssh completes while they wait for these fds to + close. The inherited fds may persist arbitrarily long if a background + mux master has been started by ControlPersist. cvs and scp were effected + by this. + + "please commit" markus@ + - (djm) [regress/README.regress] typo + +20100812 + - (tim) [regress/login-timeout.sh regress/reconfigure.sh regress/reexec.sh + regress/test-exec.sh] Under certain conditions when testing with sudo + tests would fail because the pidfile could not be read by a regular user. + "cat: cannot open ...../regress/pidfile: Permission denied (error 13)" + Make sure cat is run by $SUDO. no objection from me. djm@ + - (tim) [auth.c] add cast to quiet compiler. Change only affects SVR5 systems. + +20100809 + - (djm) bz#1561: don't bother setting IFF_UP on tun(4) device if it is + already set. Makes FreeBSD user openable tunnels useful; patch from + richard.burakowski+ossh AT mrburak.net, ok dtucker@ + - (dtucker) bug #1530: strip trailing ":" from hostname in ssh-copy-id. + based in part on a patch from Colin Watson, ok djm@ + +20100809 + - OpenBSD CVS Sync + - djm@cvs.openbsd.org 2010/08/08 16:26:42 + [version.h] + crank to 5.6 + - (djm) [README contrib/caldera/openssh.spec contrib/redhat/openssh.spec] + [contrib/suse/openssh.spec] Crank version numbers + +20100805 + - OpenBSD CVS Sync + - djm@cvs.openbsd.org 2010/08/04 05:37:01 + [ssh.1 ssh_config.5 sshd.8] + Remove mentions of weird "addr/port" alternate address format for IPv6 + addresses combinations. It hasn't worked for ages and we have supported + the more commen "[addr]:port" format for a long time. ok jmc@ markus@ + - djm@cvs.openbsd.org 2010/08/04 05:40:39 + [PROTOCOL.certkeys ssh-keygen.c] + tighten the rules for certificate encoding by requiring that options + appear in lexical order and make our ssh-keygen comply. ok markus@ + - djm@cvs.openbsd.org 2010/08/04 05:42:47 + [auth.c auth2-hostbased.c authfile.c authfile.h ssh-keysign.8] + [ssh-keysign.c ssh.c] + enable certificates for hostbased authentication, from Iain Morgan; + "looks ok" markus@ + - djm@cvs.openbsd.org 2010/08/04 05:49:22 + [authfile.c] + commited the wrong version of the hostbased certificate diff; this + version replaces some strlc{py,at} verbosity with xasprintf() at + the request of markus@ + - djm@cvs.openbsd.org 2010/08/04 06:07:11 + [ssh-keygen.1 ssh-keygen.c] + Support CA keys in PKCS#11 tokens; feedback and ok markus@ + - djm@cvs.openbsd.org 2010/08/04 06:08:40 + [ssh-keysign.c] + clean for -Wuninitialized (Id sync only; portable had this change) + - djm@cvs.openbsd.org 2010/08/05 13:08:42 + [channels.c] + Fix a trio of bugs in the local/remote window calculation for datagram + data channels (i.e. TunnelForward): + + Calculate local_consumed correctly in channel_handle_wfd() by measuring + the delta to buffer_len(c->output) from when we start to when we finish. + The proximal problem here is that the output_filter we use in portable + modified the length of the dequeued datagram (to futz with the headers + for !OpenBSD). + + In channel_output_poll(), don't enqueue datagrams that won't fit in the + peer's advertised packet size (highly unlikely to ever occur) or which + won't fit in the peer's remaining window (more likely). + + In channel_input_data(), account for the 4-byte string header in + datagram packets that we accept from the peer and enqueue in c->output. + + report, analysis and testing 2/3 cases from wierbows AT us.ibm.com; + "looks good" markus@ + +20100803 + - (dtucker) [monitor.c] Bug #1795: Initialize the values to be returned from + PAM to sane values in case the PAM method doesn't write to them. Spotted by + Bitman Zhou, ok djm@. + - OpenBSD CVS Sync + - djm@cvs.openbsd.org 2010/07/16 04:45:30 + [ssh-keygen.c] + avoid bogus compiler warning + - djm@cvs.openbsd.org 2010/07/16 14:07:35 + [ssh-rsa.c] + more timing paranoia - compare all parts of the expected decrypted + data before returning. AFAIK not exploitable in the SSH protocol. + "groovy" deraadt@ + - djm@cvs.openbsd.org 2010/07/19 03:16:33 + [sftp-client.c] + bz#1797: fix swapped args in upload_dir_internal(), breaking recursive + upload depth checks and causing verbose printing of transfers to always + be turned on; patch from imorgan AT nas.nasa.gov + - djm@cvs.openbsd.org 2010/07/19 09:15:12 + [clientloop.c readconf.c readconf.h ssh.c ssh_config.5] + add a "ControlPersist" option that automatically starts a background + ssh(1) multiplex master when connecting. This connection can stay alive + indefinitely, or can be set to automatically close after a user-specified + duration of inactivity. bz#1330 - patch by dwmw2 AT infradead.org, but + further hacked on by wmertens AT cisco.com, apb AT cequrux.com, + martin-mindrot-bugzilla AT earth.li and myself; "looks ok" markus@ + - djm@cvs.openbsd.org 2010/07/21 02:10:58 + [misc.c] + sync timingsafe_bcmp() with the one dempsky@ committed to sys/lib/libkern + - dtucker@cvs.openbsd.org 2010/07/23 08:49:25 + [ssh.1] + Ciphers is documented in ssh_config(5) these days + +20100819 + - (dtucker) [contrib/ssh-copy-ud.1] Bug #1786: update ssh-copy-id.1 with more + details about its behaviour WRT existing directories. Patch from + asguthrie at gmail com, ok djm. + +20100716 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2010/07/02 04:32:44 + [misc.c] + unbreak strdelim() skipping past quoted strings, e.g. + AllowUsers "blah blah" blah + was broken; report and fix in bz#1757 from bitman.zhou AT centrify.com + ok dtucker; + - djm@cvs.openbsd.org 2010/07/12 22:38:52 + [ssh.c] + Make ExitOnForwardFailure work with fork-after-authentication ("ssh -f") + for protocol 2. ok markus@ + - djm@cvs.openbsd.org 2010/07/12 22:41:13 + [ssh.c ssh_config.5] + expand %h to the hostname in ssh_config Hostname options. While this + sounds useless, it is actually handy for working with unqualified + hostnames: + + Host *.* + Hostname %h + Host * + Hostname %h.example.org + + "I like it" markus@ + - djm@cvs.openbsd.org 2010/07/13 11:52:06 + [auth-rsa.c channels.c jpake.c key.c misc.c misc.h monitor.c] + [packet.c ssh-rsa.c] + implement a timing_safe_cmp() function to compare memory without leaking + timing information by short-circuiting like memcmp() and use it for + some of the more sensitive comparisons (though nothing high-value was + readily attackable anyway); "looks ok" markus@ + - djm@cvs.openbsd.org 2010/07/13 23:13:16 + [auth-rsa.c channels.c jpake.c key.c misc.c misc.h monitor.c packet.c] + [ssh-rsa.c] + s/timing_safe_cmp/timingsafe_bcmp/g + - jmc@cvs.openbsd.org 2010/07/14 17:06:58 + [ssh.1] + finally ssh synopsis looks nice again! this commit just removes a ton of + hacks we had in place to make it work with old groff; + - schwarze@cvs.openbsd.org 2010/07/15 21:20:38 + [ssh-keygen.1] + repair incorrect block nesting, which screwed up indentation; + problem reported and fix OK by jmc@ + +20100714 + - (tim) [contrib/redhat/openssh.spec] Bug 1796: Test for skip_x11_askpass + (line 77) should have been for no_x11_askpass. + +20100702 + - (djm) OpenBSD CVS Sync + - jmc@cvs.openbsd.org 2010/06/26 00:57:07 + [ssh_config.5] + tweak previous; + - djm@cvs.openbsd.org 2010/06/26 23:04:04 + [ssh.c] + oops, forgot to #include ; spotted and patch from chl@ + - djm@cvs.openbsd.org 2010/06/29 23:15:30 + [ssh-keygen.1 ssh-keygen.c] + allow import (-i) and export (-e) of PEM and PKCS#8 encoded keys; + bz#1749; ok markus@ + - djm@cvs.openbsd.org 2010/06/29 23:16:46 + [auth2-pubkey.c sshd_config.5] + allow key options (command="..." and friends) in AuthorizedPrincipals; + ok markus@ + - jmc@cvs.openbsd.org 2010/06/30 07:24:25 + [ssh-keygen.1] + tweak previous; + - jmc@cvs.openbsd.org 2010/06/30 07:26:03 + [ssh-keygen.c] + sort usage(); + - jmc@cvs.openbsd.org 2010/06/30 07:28:34 + [sshd_config.5] + tweak previous; + - millert@cvs.openbsd.org 2010/07/01 13:06:59 + [scp.c] + Fix a longstanding problem where if you suspend scp at the + password/passphrase prompt the terminal mode is not restored. + OK djm@ + - phessler@cvs.openbsd.org 2010/06/27 19:19:56 + [regress/Makefile] + fix how we run the tests so we can successfully use SUDO='sudo -E' + in our env + - djm@cvs.openbsd.org 2010/06/29 23:59:54 + [cert-userkey.sh] + regress tests for key options in AuthorizedPrincipals + +20100627 + - (tim) [openbsd-compat/port-uw.c] Reorder includes. auth-options.h now needs + key.h. + +20100626 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2010/05/21 05:00:36 + [misc.c] + colon() returns char*, so s/return (0)/return NULL/ + - markus@cvs.openbsd.org 2010/06/08 21:32:19 + [ssh-pkcs11.c] + check length of value returned C_GetAttributValue for != 0 + from mdrtbugzilla@codefive.co.uk; bugzilla #1773; ok dtucker@ + - djm@cvs.openbsd.org 2010/06/17 07:07:30 + [mux.c] + Correct sizing of object to be allocated by calloc(), replacing + sizeof(state) with sizeof(*state). This worked by accident since + the struct contained a single int at present, but could have broken + in the future. patch from hyc AT symas.com + - djm@cvs.openbsd.org 2010/06/18 00:58:39 + [sftp.c] + unbreak ls in working directories that contains globbing characters in + their pathnames. bz#1655 reported by vgiffin AT apple.com + - djm@cvs.openbsd.org 2010/06/18 03:16:03 + [session.c] + Missing check for chroot_director == "none" (we already checked against + NULL); bz#1564 from Jan.Pechanec AT Sun.COM + - djm@cvs.openbsd.org 2010/06/18 04:43:08 + [sftp-client.c] + fix memory leak in do_realpath() error path; bz#1771, patch from + anicka AT suse.cz + - djm@cvs.openbsd.org 2010/06/22 04:22:59 + [servconf.c sshd_config.5] + expose some more sshd_config options inside Match blocks: + AuthorizedKeysFile AuthorizedPrincipalsFile + HostbasedUsesNameFromPacketOnly PermitTunnel + bz#1764; feedback from imorgan AT nas.nasa.gov; ok dtucker@ + - djm@cvs.openbsd.org 2010/06/22 04:32:06 + [ssh-keygen.c] + standardise error messages when attempting to open private key + files to include "progname: filename: error reason" + bz#1783; ok dtucker@ + - djm@cvs.openbsd.org 2010/06/22 04:49:47 + [auth.c] + queue auth debug messages for bad ownership or permissions on the user's + keyfiles. These messages will be sent after the user has successfully + authenticated (where our client will display them with LogLevel=debug). + bz#1554; ok dtucker@ + - djm@cvs.openbsd.org 2010/06/22 04:54:30 + [ssh-keyscan.c] + replace verbose and overflow-prone Linebuf code with read_keyfile_line() + based on patch from joachim AT joachimschipper.nl; bz#1565; ok dtucker@ + - djm@cvs.openbsd.org 2010/06/22 04:59:12 + [session.c] + include the user name on "subsystem request for ..." log messages; + bz#1571; ok dtucker@ + - djm@cvs.openbsd.org 2010/06/23 02:59:02 + [ssh-keygen.c] + fix printing of extensions in v01 certificates that I broke in r1.190 + - djm@cvs.openbsd.org 2010/06/25 07:14:46 + [channels.c mux.c readconf.c readconf.h ssh.h] + bz#1327: remove hardcoded limit of 100 permitopen clauses and port + forwards per direction; ok markus@ stevesk@ + - djm@cvs.openbsd.org 2010/06/25 07:20:04 + [channels.c session.c] + bz#1750: fix requirement for /dev/null inside ChrootDirectory for + internal-sftp accidentally introduced in r1.253 by removing the code + that opens and dup /dev/null to stderr and modifying the channels code + to read stderr but discard it instead; ok markus@ + - djm@cvs.openbsd.org 2010/06/25 08:46:17 + [auth1.c auth2-none.c] + skip the initial check for access with an empty password when + PermitEmptyPasswords=no; bz#1638; ok markus@ + - djm@cvs.openbsd.org 2010/06/25 23:10:30 + [ssh.c] + log the hostname and address that we connected to at LogLevel=verbose + after authentication is successful to mitigate "phishing" attacks by + servers with trusted keys that accept authentication silently and + automatically before presenting fake password/passphrase prompts; + "nice!" markus@ + - djm@cvs.openbsd.org 2010/06/25 23:10:30 + [ssh.c] + log the hostname and address that we connected to at LogLevel=verbose + after authentication is successful to mitigate "phishing" attacks by + servers with trusted keys that accept authentication silently and + automatically before presenting fake password/passphrase prompts; + "nice!" markus@ + +20100622 + - (djm) [loginrec.c] crank LINFO_NAMESIZE (username length) to 512 + bz#1579; ok dtucker + +20100618 + - (djm) [contrib/ssh-copy-id] Update key file explicitly under ~ + rather than assuming that $CWD == $HOME. bz#1500, patch from + timothy AT gelter.com + +20100617 + - (tim) [contrib/cygwin/README] Remove a reference to the obsolete + minires-devel package, and to add the reference to the libedit-devel + package since CYgwin now provides libedit. Patch from Corinna Vinschen. + +20100521 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2010/05/07 11:31:26 + [regress/Makefile regress/cert-userkey.sh] + regress tests for AuthorizedPrincipalsFile and "principals=" key option. + feedback and ok markus@ + - djm@cvs.openbsd.org 2010/05/11 02:58:04 + [auth-rsa.c] + don't accept certificates marked as "cert-authority" here; ok markus@ + - djm@cvs.openbsd.org 2010/05/14 00:47:22 + [ssh-add.c] + check that the certificate matches the corresponding private key before + grafting it on + - djm@cvs.openbsd.org 2010/05/14 23:29:23 + [channels.c channels.h mux.c ssh.c] + Pause the mux channel while waiting for reply from aynch callbacks. + Prevents misordering of replies if new requests arrive while waiting. + + Extend channel open confirm callback to allow signalling failure + conditions as well as success. Use this to 1) fix a memory leak, 2) + start using the above pause mechanism and 3) delay sending a success/ + failure message on mux slave session open until we receive a reply from + the server. + + motivated by and with feedback from markus@ + - markus@cvs.openbsd.org 2010/05/16 12:55:51 + [PROTOCOL.mux clientloop.h mux.c readconf.c readconf.h ssh.1 ssh.c] + mux support for remote forwarding with dynamic port allocation, + use with + LPORT=`ssh -S muxsocket -R0:localhost:25 -O forward somehost` + feedback and ok djm@ + - djm@cvs.openbsd.org 2010/05/20 11:25:26 + [auth2-pubkey.c] + fix logspam when key options (from="..." especially) deny non-matching + keys; reported by henning@ also bz#1765; ok markus@ dtucker@ + - djm@cvs.openbsd.org 2010/05/20 23:46:02 + [PROTOCOL.certkeys auth-options.c ssh-keygen.c] + Move the permit-* options to the non-critical "extensions" field for v01 + certificates. The logic is that if another implementation fails to + implement them then the connection just loses features rather than fails + outright. + + ok markus@ + +20100511 + - (dtucker) [Makefile.in] Bug #1770: Link libopenbsd-compat twice to solve + circular dependency problem on old or odd platforms. From Tom Lane, ok + djm@. + - (djm) [openbsd-compat/openssl-compat.h] Fix build breakage on older + libcrypto by defining OPENSSL_[DR]SA_MAX_MODULUS_BITS if they aren't + already. ok dtucker@ + +20100510 + - OpenBSD CVS Sync + - djm@cvs.openbsd.org 2010/04/23 01:47:41 + [ssh-keygen.c] + bz#1740: display a more helpful error message when $HOME is + inaccessible while trying to create .ssh directory. Based on patch + from jchadima AT redhat.com; ok dtucker@ + - djm@cvs.openbsd.org 2010/04/23 22:27:38 + [mux.c] + set "detach_close" flag when registering channel cleanup callbacks. + This causes the channel to close normally when its fds close and + hangs when terminating a mux slave using ~. bz#1758; ok markus@ + - djm@cvs.openbsd.org 2010/04/23 22:42:05 + [session.c] + set stderr to /dev/null for subsystems rather than just closing it. + avoids hangs if a subsystem or shell initialisation writes to stderr. + bz#1750; ok markus@ + - djm@cvs.openbsd.org 2010/04/23 22:48:31 + [ssh-keygen.c] + refuse to generate keys longer than OPENSSL_[RD]SA_MAX_MODULUS_BITS, + since we would refuse to use them anyway. bz#1516; ok dtucker@ + - djm@cvs.openbsd.org 2010/04/26 22:28:24 + [sshconnect2.c] + bz#1502: authctxt.success is declared as an int, but passed by + reference to function that accepts sig_atomic_t*. Convert it to + the latter; ok markus@ dtucker@ + - djm@cvs.openbsd.org 2010/05/01 02:50:50 + [PROTOCOL.certkeys] + typo; jmeltzer@ + - dtucker@cvs.openbsd.org 2010/05/05 04:22:09 + [sftp.c] + restore mput and mget which got lost in the tab-completion changes. + found by Kenneth Whitaker, ok djm@ + - djm@cvs.openbsd.org 2010/05/07 11:30:30 + [auth-options.c auth-options.h auth.c auth.h auth2-pubkey.c] + [key.c servconf.c servconf.h sshd.8 sshd_config.5] + add some optional indirection to matching of principal names listed + in certificates. Currently, a certificate must include the a user's name + to be accepted for authentication. This change adds the ability to + specify a list of certificate principal names that are acceptable. + + When authenticating using a CA trusted through ~/.ssh/authorized_keys, + this adds a new principals="name1[,name2,...]" key option. + + For CAs listed through sshd_config's TrustedCAKeys option, a new config + option "AuthorizedPrincipalsFile" specifies a per-user file containing + the list of acceptable names. + + If either option is absent, the current behaviour of requiring the + username to appear in principals continues to apply. + + These options are useful for role accounts, disjoint account namespaces + and "user@realm"-style naming policies in certificates. + + feedback and ok markus@ + - jmc@cvs.openbsd.org 2010/05/07 12:49:17 + [sshd_config.5] + tweak previous; + +20100423 + - (dtucker) [configure.ac] Bug #1756: Check for the existence of a lib64 dir + in the openssl install directory (some newer openssl versions do this on at + least some amd64 platforms). + +20100418 + - OpenBSD CVS Sync + - jmc@cvs.openbsd.org 2010/04/16 06:45:01 + [ssh_config.5] + tweak previous; ok djm + - jmc@cvs.openbsd.org 2010/04/16 06:47:04 + [ssh-keygen.1 ssh-keygen.c] + tweak previous; ok djm + - djm@cvs.openbsd.org 2010/04/16 21:14:27 + [sshconnect.c] + oops, %r => remote username, not %u + - djm@cvs.openbsd.org 2010/04/16 01:58:45 + [regress/cert-hostkey.sh regress/cert-userkey.sh] + regression tests for v01 certificate format + includes interop tests for v00 certs + - (dtucker) [contrib/aix/buildbff.sh] Fix creation of ssh_prng_cmds.default + file. + +20100416 + - (djm) Release openssh-5.5p1 + - OpenBSD CVS Sync + - djm@cvs.openbsd.org 2010/03/26 03:13:17 + [bufaux.c] + allow buffer_get_int_ret/buffer_get_int64_ret to take a NULL pointer + argument to allow skipping past values in a buffer + - jmc@cvs.openbsd.org 2010/03/26 06:54:36 + [ssh.1] + tweak previous; + - jmc@cvs.openbsd.org 2010/03/27 14:26:55 + [ssh_config.5] + tweak previous; ok dtucker + - djm@cvs.openbsd.org 2010/04/10 00:00:16 + [ssh.c] + bz#1746 - suppress spurious tty warning when using -O and stdin + is not a tty; ok dtucker@ markus@ + - djm@cvs.openbsd.org 2010/04/10 00:04:30 + [sshconnect.c] + fix terminology: we didn't find a certificate in known_hosts, we found + a CA key + - djm@cvs.openbsd.org 2010/04/10 02:08:44 + [clientloop.c] + bz#1698: kill channel when pty allocation requests fail. Fixed + stuck client if the server refuses pty allocation. + ok dtucker@ "think so" markus@ + - djm@cvs.openbsd.org 2010/04/10 02:10:56 + [sshconnect2.c] + show the key type that we are offering in debug(), helps distinguish + between certs and plain keys as the path to the private key is usually + the same. + - djm@cvs.openbsd.org 2010/04/10 05:48:16 + [mux.c] + fix NULL dereference; from matthew.haub AT alumni.adelaide.edu.au + - djm@cvs.openbsd.org 2010/04/14 22:27:42 + [ssh_config.5 sshconnect.c] + expand %r => remote username in ssh_config:ProxyCommand; + ok deraadt markus + - markus@cvs.openbsd.org 2010/04/15 20:32:55 + [ssh-pkcs11.c] + retry lookup for private key if there's no matching key with CKA_SIGN + attribute enabled; this fixes fixes MuscleCard support (bugzilla #1736) + ok djm@ + - djm@cvs.openbsd.org 2010/04/16 01:47:26 + [PROTOCOL.certkeys auth-options.c auth-options.h auth-rsa.c] + [auth2-pubkey.c authfd.c key.c key.h myproposal.h ssh-add.c] + [ssh-agent.c ssh-dss.c ssh-keygen.1 ssh-keygen.c ssh-rsa.c] + [sshconnect.c sshconnect2.c sshd.c] + revised certificate format ssh-{dss,rsa}-cert-v01@openssh.com with the + following changes: + + move the nonce field to the beginning of the certificate where it can + better protect against chosen-prefix attacks on the signature hash + + Rename "constraints" field to "critical options" + + Add a new non-critical "extensions" field + + Add a serial number + + The older format is still support for authentication and cert generation + (use "ssh-keygen -t v00 -s ca_key ..." to generate a v00 certificate) + + ok markus@ + 20100410 - (dtucker) [configure.ac] Put the check for the existence of getaddrinfo back so we disable the IPv6 tests if we don't have it. Modified: vendor-crypto/openssh/dist/Makefile.in ============================================================================== --- vendor-crypto/openssh/dist/Makefile.in Mon Nov 8 10:39:02 2010 (r214978) +++ vendor-crypto/openssh/dist/Makefile.in Mon Nov 8 10:45:44 2010 (r214979) @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.309 2010/03/13 21:41:34 djm Exp $ +# $Id: Makefile.in,v 1.310 2010/05/12 06:51:39 dtucker Exp $ # uncomment if you run a non bourne compatable shell. Ie. csh #SHELL = @SH@ @@ -160,7 +160,7 @@ ssh-keysign$(EXEEXT): $(LIBCOMPAT) libss $(LD) -o $@ ssh-keysign.o readconf.o roaming_dummy.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) ssh-pkcs11-helper$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-pkcs11-helper.o ssh-pkcs11.o - $(LD) -o $@ ssh-pkcs11-helper.o ssh-pkcs11.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS) + $(LD) -o $@ ssh-pkcs11-helper.o ssh-pkcs11.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o roaming_dummy.o $(LD) -o $@ ssh-keyscan.o roaming_dummy.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS) Modified: vendor-crypto/openssh/dist/PROTOCOL.certkeys ============================================================================== --- vendor-crypto/openssh/dist/PROTOCOL.certkeys Mon Nov 8 10:39:02 2010 (r214978) +++ vendor-crypto/openssh/dist/PROTOCOL.certkeys Mon Nov 8 10:45:44 2010 (r214979) @@ -16,7 +16,7 @@ These protocol extensions build on the s system already in SSH to allow certificate-based authentication. The certificates used are not traditional X.509 certificates, with numerous options and complex encoding rules, but something rather -more minimal: a key, some identity information and usage constraints +more minimal: a key, some identity information and usage options that have been signed with some other trusted key. A sshd server may be configured to allow authentication via certified @@ -27,7 +27,7 @@ of acceptance of certified host keys, by to specify CA keys in ~/.ssh/known_hosts. Certified keys are represented using two new key types: -ssh-rsa-cert-v00@openssh.com and ssh-dss-cert-v00@openssh.com that +ssh-rsa-cert-v01@openssh.com and ssh-dss-cert-v01@openssh.com that include certification information along with the public key that is used to sign challenges. ssh-keygen performs the CA signing operation. @@ -47,7 +47,7 @@ in RFC4252 section 7. New public key formats ---------------------- -The ssh-rsa-cert-v00@openssh.com and ssh-dss-cert-v00@openssh.com key +The ssh-rsa-cert-v01@openssh.com and ssh-dss-cert-v01@openssh.com key types take a similar high-level format (note: data types and encoding are as per RFC4251 section 5). The serialised wire encoding of these certificates is also used for storing them on disk. @@ -57,42 +57,55 @@ these certificates is also used for stor RSA certificate - string "ssh-rsa-cert-v00@openssh.com" + string "ssh-rsa-cert-v01@openssh.com" + string nonce mpint e mpint n + uint64 serial uint32 type string key id string valid principals uint64 valid after uint64 valid before - string constraints - string nonce + string critical options + string extensions string reserved string signature key string signature DSA certificate - string "ssh-dss-cert-v00@openssh.com" + string "ssh-dss-cert-v01@openssh.com" + string nonce mpint p mpint q mpint g mpint y + uint64 serial uint32 type string key id string valid principals uint64 valid after uint64 valid before - string constraints - string nonce + string critical options + string extensions string reserved string signature key string signature +The nonce field is a CA-provided random bitstring of arbitrary length +(but typically 16 or 32 bytes) included to make attacks that depend on +inducing collisions in the signature hash infeasible. + e and n are the RSA exponent and public modulus respectively. p, q, g, y are the DSA parameters as described in FIPS-186-2. +serial is an optional certificate serial number set by the CA to +provide an abbreviated way to refer to certificates from that CA. +If a CA does not wish to number its certificates it must set this +field to zero. + type specifies whether this certificate is for identification of a user or a host using a SSH_CERT_TYPE_... value. @@ -112,13 +125,15 @@ certificate. Each represents a time in s 00:00:00. A certificate is considered valid if: valid after <= current time < valid before -constraints is a set of zero or more key constraints encoded as below. +criticial options is a set of zero or more key options encoded as +below. All such options are "critical" in the sense that an implementation +must refuse to authorise a key that has an unrecognised option. + +extensions is a set of zero or more optional extensions. These extensions +are not critical, and an implementation that encounters one that it does +not recognise may safely ignore it. -The nonce field is a CA-provided random bitstring of arbitrary length -(but typically 16 or 32 bytes) included to make attacks that depend on -inducing collisions in the signature hash infeasible. - -The reserved field is current unused and is ignored in this version of +The reserved field is currently unused and is ignored in this version of the protocol. signature key contains the CA key used to sign the certificate. @@ -132,22 +147,25 @@ up to, and including the signature key. encoded according to the rules defined for the CA's public key algorithm (RFC4253 section 6.6 for ssh-rsa and ssh-dss). -Constraints ------------ +Critical options +---------------- -The constraints section of the certificate specifies zero or more -constraints on the certificates validity. The format of this field +The critical options section of the certificate specifies zero or more +options on the certificates validity. The format of this field is a sequence of zero or more tuples: string name string data -The name field identifies the constraint and the data field encodes -constraint-specific information (see below). All constraints are -"critical", if an implementation does not recognise a constraint +Options must be lexically ordered by "name" if they appear in the +sequence. + +The name field identifies the option and the data field encodes +option-specific information (see below). All options are +"critical", if an implementation does not recognise a option then the validating party should refuse to accept the certificate. -The supported constraints and the contents and structure of their +The supported options and the contents and structure of their data fields are: Name Format Description @@ -157,37 +175,51 @@ force-command string Sp ssh command-line) whenever this key is used for authentication. +source-address string Comma-separated list of source addresses + from which this certificate is accepted + for authentication. Addresses are + specified in CIDR format (nn.nn.nn.nn/nn + or hhhh::hhhh/nn). + If this option is not present then + certificates may be presented from any + source address. + +Extensions +---------- + +The extensions section of the certificate specifies zero or more +non-critical certificate extensions. The encoding and ordering of +extensions in this field is identical to that of the critical options. +If an implementation does not recognise an extension, then it should +ignore it. + +The supported extensions and the contents and structure of their data +fields are: + +Name Format Description +----------------------------------------------------------------------------- permit-X11-forwarding empty Flag indicating that X11 forwarding should be permitted. X11 forwarding will - be refused if this constraint is absent. + be refused if this option is absent. permit-agent-forwarding empty Flag indicating that agent forwarding should be allowed. Agent forwarding must not be permitted unless this - constraint is present. + option is present. permit-port-forwarding empty Flag indicating that port-forwarding - should be allowed. If this constraint is + should be allowed. If this option is not present then no port forwarding will be allowed. permit-pty empty Flag indicating that PTY allocation should be permitted. In the absence of - this constraint PTY allocation will be + this option PTY allocation will be disabled. permit-user-rc empty Flag indicating that execution of ~/.ssh/rc should be permitted. Execution of this script will not be permitted if - this constraint is not present. - -source-address string Comma-separated list of source addresses - from which this certificate is accepted - for authentication. Addresses are - specified in CIDR format (nn.nn.nn.nn/nn - or hhhh::hhhh/nn). - If this constraint is not present then - certificates may be presented from any - source address. + this option is not present. -$OpenBSD: PROTOCOL.certkeys,v 1.3 2010/03/03 22:50:40 djm Exp $ +$OpenBSD: PROTOCOL.certkeys,v 1.7 2010/08/04 05:40:39 djm Exp $ Modified: vendor-crypto/openssh/dist/PROTOCOL.mux ============================================================================== --- vendor-crypto/openssh/dist/PROTOCOL.mux Mon Nov 8 10:39:02 2010 (r214978) +++ vendor-crypto/openssh/dist/PROTOCOL.mux Mon Nov 8 10:45:44 2010 (r214979) @@ -109,8 +109,14 @@ A client may request the master to estab forwarding type may be MUX_FWD_LOCAL, MUX_FWD_REMOTE, MUX_FWD_DYNAMIC. -A server may reply with a MUX_S_OK, a MUX_S_PERMISSION_DENIED or a -MUX_S_FAILURE. +A server may reply with a MUX_S_OK, a MUX_S_REMOTE_PORT, a +MUX_S_PERMISSION_DENIED or a MUX_S_FAILURE. + +For dynamically allocated listen port the server replies with + + uint32 MUX_S_REMOTE_PORT + uint32 client request id + uint32 allocated remote listen port 5. Requesting closure of port forwards @@ -178,6 +184,7 @@ The MUX_S_PERMISSION_DENIED and MUX_S_FA #define MUX_S_EXIT_MESSAGE 0x80000004 #define MUX_S_ALIVE 0x80000005 #define MUX_S_SESSION_OPENED 0x80000006 +#define MUX_S_REMOTE_PORT 0x80000007 #define MUX_FWD_LOCAL 1 #define MUX_FWD_REMOTE 2 @@ -193,4 +200,4 @@ XXX server->client error/warning notific XXX port0 rfwd (need custom response message) XXX send signals via mux -$OpenBSD: PROTOCOL.mux,v 1.1 2010/01/26 01:28:35 djm Exp $ +$OpenBSD: PROTOCOL.mux,v 1.2 2010/05/16 12:55:51 markus Exp $ Modified: vendor-crypto/openssh/dist/README ============================================================================== --- vendor-crypto/openssh/dist/README Mon Nov 8 10:39:02 2010 (r214978) +++ vendor-crypto/openssh/dist/README Mon Nov 8 10:45:44 2010 (r214979) @@ -1,4 +1,4 @@ -See http://www.openssh.com/txt/release-5.5 for the release notes. +See http://www.openssh.com/txt/release-5.6 for the release notes. - A Japanese translation of this document and of the OpenSSH FAQ is - available at http://www.unixuser.org/~haruyama/security/openssh/index.html @@ -62,4 +62,4 @@ References - [6] http://www.openbsd.org/cgi-bin/man.cgi?query=style&sektion=9 [7] http://www.openssh.com/faq.html -$Id: README,v 1.73 2010/03/21 19:11:55 djm Exp $ +$Id: README,v 1.74 2010/08/08 16:32:06 djm Exp $ Modified: vendor-crypto/openssh/dist/auth-options.c ============================================================================== --- vendor-crypto/openssh/dist/auth-options.c Mon Nov 8 10:39:02 2010 (r214978) +++ vendor-crypto/openssh/dist/auth-options.c Mon Nov 8 10:45:44 2010 (r214979) @@ -1,4 +1,4 @@ -/* $OpenBSD: auth-options.c,v 1.49 2010/03/16 15:46:52 stevesk Exp $ */ +/* $OpenBSD: auth-options.c,v 1.52 2010/05/20 23:46:02 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -27,10 +27,10 @@ #include "canohost.h" #include "buffer.h" #include "channels.h" -#include "auth-options.h" #include "servconf.h" #include "misc.h" #include "key.h" +#include "auth-options.h" #include "hostfile.h" #include "auth.h" #ifdef GSSAPI @@ -55,6 +55,9 @@ struct envstring *custom_environment = N /* "tunnel=" option. */ int forced_tun_device = -1; +/* "principals=" option. */ +char *authorized_principals = NULL; + extern ServerOptions options; void @@ -76,6 +79,10 @@ auth_clear_options(void) xfree(forced_command); forced_command = NULL; } + if (authorized_principals) { + xfree(authorized_principals); + authorized_principals = NULL; + } forced_tun_device = -1; channel_clear_permitted_opens(); } @@ -141,6 +148,8 @@ auth_parse_options(struct passwd *pw, ch cp = "command=\""; if (strncasecmp(opts, cp, strlen(cp)) == 0) { opts += strlen(cp); + if (forced_command != NULL) + xfree(forced_command); forced_command = xmalloc(strlen(opts) + 1); i = 0; while (*opts) { @@ -167,6 +176,38 @@ auth_parse_options(struct passwd *pw, ch opts++; goto next_option; } + cp = "principals=\""; + if (strncasecmp(opts, cp, strlen(cp)) == 0) { + opts += strlen(cp); + if (authorized_principals != NULL) + xfree(authorized_principals); + authorized_principals = xmalloc(strlen(opts) + 1); + i = 0; + while (*opts) { + if (*opts == '"') + break; + if (*opts == '\\' && opts[1] == '"') { + opts += 2; + authorized_principals[i++] = '"'; + continue; + } + authorized_principals[i++] = *opts++; + } + if (!*opts) { + debug("%.100s, line %lu: missing end quote", + file, linenum); + auth_debug_add("%.100s, line %lu: missing end quote", + file, linenum); + xfree(authorized_principals); + authorized_principals = NULL; + goto bad_option; + } + authorized_principals[i] = '\0'; + auth_debug_add("principals: %.900s", + authorized_principals); + opts++; + goto next_option; + } cp = "environment=\""; if (options.permit_user_env && strncasecmp(opts, cp, strlen(cp)) == 0) { @@ -376,123 +417,147 @@ bad_option: return 0; } -/* - * Set options from certificate constraints. These supersede user key options - * so this must be called after auth_parse_options(). - */ -int -auth_cert_constraints(Buffer *c_orig, struct passwd *pw) +#define OPTIONS_CRITICAL 1 +#define OPTIONS_EXTENSIONS 2 +static int +parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw, + u_int which, int crit, + int *cert_no_port_forwarding_flag, + int *cert_no_agent_forwarding_flag, + int *cert_no_x11_forwarding_flag, + int *cert_no_pty_flag, + int *cert_no_user_rc, + char **cert_forced_command, + int *cert_source_address_done) { + char *command, *allowed; + const char *remote_ip; u_char *name = NULL, *data_blob = NULL; u_int nlen, dlen, clen; Buffer c, data; - int ret = -1; - - int cert_no_port_forwarding_flag = 1; - int cert_no_agent_forwarding_flag = 1; - int cert_no_x11_forwarding_flag = 1; - int cert_no_pty_flag = 1; - int cert_no_user_rc = 1; - char *cert_forced_command = NULL; - int cert_source_address_done = 0; + int ret = -1, found; buffer_init(&data); /* Make copy to avoid altering original */ buffer_init(&c); - buffer_append(&c, buffer_ptr(c_orig), buffer_len(c_orig)); + buffer_append(&c, optblob, optblob_len); while (buffer_len(&c) > 0) { if ((name = buffer_get_string_ret(&c, &nlen)) == NULL || (data_blob = buffer_get_string_ret(&c, &dlen)) == NULL) { - error("Certificate constraints corrupt"); + error("Certificate options corrupt"); goto out; } buffer_append(&data, data_blob, dlen); - debug3("found certificate constraint \"%.100s\" len %u", + debug3("found certificate option \"%.100s\" len %u", name, dlen); if (strlen(name) != nlen) { error("Certificate constraint name contains \\0"); goto out; } - if (strcmp(name, "permit-X11-forwarding") == 0) - cert_no_x11_forwarding_flag = 0; - else if (strcmp(name, "permit-agent-forwarding") == 0) - cert_no_agent_forwarding_flag = 0; - else if (strcmp(name, "permit-port-forwarding") == 0) - cert_no_port_forwarding_flag = 0; - else if (strcmp(name, "permit-pty") == 0) - cert_no_pty_flag = 0; - else if (strcmp(name, "permit-user-rc") == 0) - cert_no_user_rc = 0; - else if (strcmp(name, "force-command") == 0) { - char *command = buffer_get_string_ret(&data, &clen); - - if (command == NULL) { - error("Certificate constraint \"%s\" corrupt", - name); - goto out; - } - if (strlen(command) != clen) { - error("force-command constraint contains \\0"); - goto out; - } - if (cert_forced_command != NULL) { - error("Certificate has multiple " - "force-command constraints"); - xfree(command); - goto out; - } - cert_forced_command = command; - } else if (strcmp(name, "source-address") == 0) { - char *allowed = buffer_get_string_ret(&data, &clen); - const char *remote_ip = get_remote_ipaddr(); - - if (allowed == NULL) { - error("Certificate constraint \"%s\" corrupt", - name); - goto out; - } - if (strlen(allowed) != clen) { - error("source-address constraint contains \\0"); - goto out; - } - if (cert_source_address_done++) { - error("Certificate has multiple " - "source-address constraints"); - xfree(allowed); - goto out; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 10:46:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D899E1065673; Mon, 8 Nov 2010 10:46:51 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC8F78FC0A; Mon, 8 Nov 2010 10:46: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 oA8Akprd026730; Mon, 8 Nov 2010 10:46:51 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8AkpOB026729; Mon, 8 Nov 2010 10:46:51 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201011081046.oA8AkpOB026729@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 8 Nov 2010 10:46:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214980 - vendor-crypto/openssh/5.6p1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 10:46:51 -0000 Author: des Date: Mon Nov 8 10:46:51 2010 New Revision: 214980 URL: http://svn.freebsd.org/changeset/base/214980 Log: Tag OpenSSH 5.5p1 Added: vendor-crypto/openssh/5.6p1/ - copied from r214979, vendor-crypto/openssh/dist/ From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 11:22:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36538106564A; Mon, 8 Nov 2010 11:22:56 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A4608FC15; Mon, 8 Nov 2010 11:22:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8BMuou028125; Mon, 8 Nov 2010 11:22:56 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8BMte8028123; Mon, 8 Nov 2010 11:22:55 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201011081122.oA8BMte8028123@svn.freebsd.org> From: Rui Paulo Date: Mon, 8 Nov 2010 11:22:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214981 - in stable/8/lib: . libusb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 11:22:56 -0000 Author: rpaulo Date: Mon Nov 8 11:22:55 2010 New Revision: 214981 URL: http://svn.freebsd.org/changeset/base/214981 Log: MFC r210682, r210683, r210690: Build librtld_db. Simplify the Makefile. The i386 and amd64 sections are equal. libproc is going to be i386/amd64 only with the next update. Modified: stable/8/lib/Makefile Directory Properties: stable/8/lib/ (props changed) stable/8/lib/bind/ (props changed) stable/8/lib/csu/ (props changed) stable/8/lib/libarchive/ (props changed) stable/8/lib/libbluetooth/ (props changed) stable/8/lib/libc_r/ (props changed) stable/8/lib/libcam/ (props changed) stable/8/lib/libcompat/ (props changed) stable/8/lib/libdevinfo/ (props changed) stable/8/lib/libdisk/ (props changed) stable/8/lib/libedit/ (props changed) stable/8/lib/libelf/ (props changed) stable/8/lib/libexpat/ (props changed) stable/8/lib/libfetch/ (props changed) stable/8/lib/libgeom/ (props changed) stable/8/lib/libgpib/ (props changed) stable/8/lib/libgssapi/ (props changed) stable/8/lib/libjail/ (props changed) stable/8/lib/libkse/ (props changed) stable/8/lib/libkvm/ (props changed) stable/8/lib/liblzma/ (props changed) stable/8/lib/libmagic/ (props changed) stable/8/lib/libmemstat/ (props changed) stable/8/lib/libpam/ (props changed) stable/8/lib/libpmc/ (props changed) stable/8/lib/libradius/ (props changed) stable/8/lib/librpcsec_gss/ (props changed) stable/8/lib/librtld_db/ (props changed) stable/8/lib/libsm/ (props changed) stable/8/lib/libstand/ (props changed) stable/8/lib/libtacplus/ (props changed) stable/8/lib/libthr/ (props changed) stable/8/lib/libthread_db/ (props changed) stable/8/lib/libufs/ (props changed) stable/8/lib/libugidfw/ (props changed) stable/8/lib/libusb/ (props changed) stable/8/lib/libusb/usb.h (props changed) stable/8/lib/libusbhid/ (props changed) stable/8/lib/libutil/ (props changed) stable/8/lib/libz/ (props changed) stable/8/lib/libz/contrib/ (props changed) stable/8/lib/msun/ (props changed) Modified: stable/8/lib/Makefile ============================================================================== --- stable/8/lib/Makefile Mon Nov 8 10:46:51 2010 (r214980) +++ stable/8/lib/Makefile Mon Nov 8 11:22:55 2010 (r214981) @@ -86,8 +86,9 @@ SUBDIR= ${SUBDIR_ORDERED} \ libpam \ libpcap \ ${_libpmc} \ - libproc \ + ${_libproc} \ librt \ + ${_librtld_db} \ ${_libsdp} \ ${_libsm} \ ${_libsmb} \ @@ -159,26 +160,20 @@ _libnetgraph= libnetgraph _libypclnt= libypclnt .endif -.if ${MACHINE_ARCH} == "i386" +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" .if ${MK_NCP} != "no" _libncp= libncp .endif _libsmb= libsmb _libvgl= libvgl +_libproc= libproc +_librtld_db= librtld_db .endif .if ${MACHINE_ARCH} == "ia64" _libsmb= libsmb .endif -.if ${MACHINE_ARCH} == "amd64" -.if ${MK_NCP} != "no" -_libncp= libncp -.endif -_libsmb= libsmb -_libvgl= libvgl -.endif - .if ${MACHINE_ARCH} == "powerpc" _libsmb= libsmb .endif From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 12:04:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72DB51065672; Mon, 8 Nov 2010 12:04:41 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 612AB8FC0C; Mon, 8 Nov 2010 12:04: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 oA8C4fH5030469; Mon, 8 Nov 2010 12:04:41 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8C4fE5030467; Mon, 8 Nov 2010 12:04:41 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201011081204.oA8C4fE5030467@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 8 Nov 2010 12:04:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214982 - head/sys/compat/linprocfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 12:04:41 -0000 Author: des Date: Mon Nov 8 12:04:41 2010 New Revision: 214982 URL: http://svn.freebsd.org/changeset/base/214982 Log: Fix CPU ID in /proc/cpuinfo. PR: kern/56451 Submitted by: arundel@ MFC after: 3 weeks Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Mon Nov 8 11:22:55 2010 (r214981) +++ head/sys/compat/linprocfs/linprocfs.c Mon Nov 8 12:04:41 2010 (r214982) @@ -276,11 +276,11 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) sbuf_printf(sb, "processor\t: %d\n" "vendor_id\t: %.20s\n" - "cpu family\t: %d\n" - "model\t\t: %d\n" + "cpu family\t: %u\n" + "model\t\t: %u\n" "model name\t: %s\n" - "stepping\t: %d\n\n", - i, cpu_vendor, class, cpu, model, cpu_id & 0xf); + "stepping\t: %u\n\n", + i, cpu_vendor, CPUID_TO_FAMILY(cpu_id), CPUID_TO_MODEL(cpu_id), model, cpu_id & CPUID_STEPPING); /* XXX per-cpu vendor / class / model / id? */ } From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 12:54:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A05B2106564A; Mon, 8 Nov 2010 12:54:56 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 886418FC0A; Mon, 8 Nov 2010 12:54:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8CsuAo032384; Mon, 8 Nov 2010 12:54:56 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8Csu0M032339; Mon, 8 Nov 2010 12:54:56 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201011081254.oA8Csu0M032339@svn.freebsd.org> From: Rui Paulo Date: Mon, 8 Nov 2010 12:54:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214983 - in stable/8: cddl/contrib/dtracetoolkit cddl/contrib/opensolaris/cmd/dtrace cddl/contrib/opensolaris/cmd/dtrace/test/cmd/baddof cddl/contrib/opensolaris/cmd/dtrace/test/cmd/ch... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 12:54:56 -0000 Author: rpaulo Date: Mon Nov 8 12:54:55 2010 New Revision: 214983 URL: http://svn.freebsd.org/changeset/base/214983 Log: MFC r210688 r210689 r210694 r211184 r212831 r210682 r210683 r210690 r209539 r210199 r210237 r210692 r210695 r210767 r210775 r210776 r211545 r211554 r211562 r212092 r212358 r212414 r212462 r212495 r210693 r211547 r211550 r211554 r211561 r211577 r210691 r210697 r211563 r211564 r211841 r211842 r211562 r212649 r211187 r211555: Userland DTrace MFC. This only includes the userland side of userland DTrace. Added: stable/8/cddl/contrib/dtracetoolkit/ - copied from r214982, vendor/dtracetoolkit/dist/ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.stddevtoofew.d - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.stddevtoofew.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevnoarg.d - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevnoarg.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevtoomany.d - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevtoomany.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d.out - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d.out stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/cpc/ - copied from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/cpc/ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/ - copied from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/src/TestGetAggregate.java - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/src/TestGetAggregate.java stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/tst.GetAggregate.ksh - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/tst.GetAggregate.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh.out - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh.out stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badlib.exe - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badlib.exe stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_CREATEFAIL.many.exe - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_CREATEFAIL.many.exe stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_FUNC.badfunc.exe - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_FUNC.badfunc.exe stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_LIB.libdash.exe - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_LIB.libdash.exe stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.alldash.exe - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.alldash.exe stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.exe - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.exe stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.globdash.exe - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.globdash.exe stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_OFF.toobig.exe - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_OFF.toobig.exe stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.coverage.exe - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.coverage.exe stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.emptystack.exe - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.emptystack.exe stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.killonerror.ksh - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.killonerror.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/plockstat/tst.available.exe - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/plockstat/tst.available.exe stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/plockstat/tst.libmap.exe - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/plockstat/tst.libmap.exe stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.largeusersym.ksh - copied, changed from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.largeusersym.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/ - copied from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithStddev.d - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithStddev.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/Makefile - copied unchanged from r211545, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/Makefile stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/main.c - copied unchanged from r211545, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/main.c stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/prov.d - copied unchanged from r211545, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/prov.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/prov.h - copied unchanged from r211545, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/prov.h stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh - copied, changed from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh.out - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh.out stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/ - copied from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/i86xpv/ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/sparc/pid/err.D_PROC_ALIGN.misaligned.exe - copied unchanged from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/sparc/pid/err.D_PROC_ALIGN.misaligned.exe stable/8/cddl/contrib/opensolaris/cmd/plockstat/ - copied from r210237, head/cddl/contrib/opensolaris/cmd/plockstat/ stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh - copied unchanged from r210767, head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh - copied unchanged from r210767, head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh stable/8/cddl/contrib/opensolaris/lib/libdtrace/i386/ - copied from r210199, head/cddl/contrib/opensolaris/lib/libdtrace/i386/ stable/8/cddl/contrib/opensolaris/lib/libdtrace/sparc/ - copied from r210199, head/cddl/contrib/opensolaris/lib/libdtrace/sparc/ stable/8/cddl/lib/libdtrace/libproc_compat.h - copied unchanged from r211554, head/cddl/lib/libdtrace/libproc_compat.h stable/8/cddl/lib/libdtrace/regs_x86.d - copied unchanged from r211554, head/cddl/lib/libdtrace/regs_x86.d stable/8/cddl/usr.bin/ctfconvert/ctfconvert.1 - copied unchanged from r211187, head/cddl/usr.bin/ctfconvert/ctfconvert.1 stable/8/cddl/usr.bin/ctfdump/ctfdump.1 - copied unchanged from r211187, head/cddl/usr.bin/ctfdump/ctfdump.1 stable/8/cddl/usr.bin/ctfmerge/ctfmerge.1 - copied unchanged from r211187, head/cddl/usr.bin/ctfmerge/ctfmerge.1 stable/8/cddl/usr.sbin/dtruss/ - copied from r211563, head/cddl/usr.sbin/dtruss/ stable/8/cddl/usr.sbin/dtruss/dtruss.1 - copied unchanged from r211841, head/cddl/usr.sbin/dtruss/dtruss.1 stable/8/cddl/usr.sbin/plockstat/ - copied from r211562, head/cddl/usr.sbin/plockstat/ stable/8/cddl/usr.sbin/plockstat/plockstat.1 - copied unchanged from r212649, head/cddl/usr.sbin/plockstat/plockstat.1 stable/8/lib/libproc/proc_bkpt.c - copied, changed from r210688, head/lib/libproc/proc_bkpt.c stable/8/lib/libproc/proc_regs.c - copied unchanged from r210688, head/lib/libproc/proc_regs.c stable/8/lib/libproc/proc_rtld.c - copied, changed from r210688, head/lib/libproc/proc_rtld.c stable/8/lib/libproc/test/ - copied from r210688, head/lib/libproc/test/ Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/baddof/baddof.c stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/chkargs/chkargs.c stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dstyle.pl (contents, props changed) stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl (contents, props changed) stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs1.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d.out stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d.out stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d.out stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.subr.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/assocs/tst.orthogonality.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.AddSearchPath.d.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithModule.d.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationOut.d.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationWithO.d.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.PreprocessorStatement.d.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoofew.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoomany.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoofew.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoomany.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.index.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteicmp.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6remoteicmp.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/src/TestFunctionLookup.java stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/tst.FunctionLookup.ksh.out stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.schrock.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.fork.c stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.probemod.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.basics.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.basics.d.out stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printa/tst.walltimestamp.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printT.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printY.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d.out stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d.out stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exec.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.execfail.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.sigwait.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sysevent/tst.post_chan.c stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.eliminate.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.header.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.include.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.linkunpriv.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.onlyenabled.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.static.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.user.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/vars/tst.ucaller.ksh stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/i386/funcs/tst.badcopyin.d stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/sparc/usdt/tst.tailcall.ksh stable/8/cddl/contrib/opensolaris/cmd/plockstat/plockstat.c stable/8/cddl/contrib/opensolaris/common/avl/avl.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.h stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h stable/8/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c stable/8/cddl/contrib/opensolaris/lib/libgen/common/gmatch.c stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.h stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/st_parse.c stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/tdata.c stable/8/cddl/lib/Makefile stable/8/cddl/lib/drti/Makefile stable/8/cddl/lib/libdtrace/Makefile stable/8/cddl/usr.bin/ctfconvert/Makefile stable/8/cddl/usr.bin/ctfdump/Makefile stable/8/cddl/usr.bin/ctfmerge/Makefile stable/8/cddl/usr.sbin/Makefile stable/8/cddl/usr.sbin/dtrace/Makefile stable/8/cddl/usr.sbin/dtruss/Makefile stable/8/cddl/usr.sbin/lockstat/Makefile stable/8/cddl/usr.sbin/plockstat/Makefile stable/8/lib/libproc/Makefile stable/8/lib/libproc/_libproc.h stable/8/lib/libproc/libproc.h stable/8/lib/libproc/proc_create.c stable/8/lib/libproc/proc_sym.c stable/8/lib/libproc/proc_util.c stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/lib/ (props changed) stable/8/cddl/lib/libnvpair/ (props changed) stable/8/cddl/lib/libzpool/ (props changed) stable/8/cddl/usr.bin/ (props changed) stable/8/cddl/usr.sbin/ (props changed) stable/8/lib/libproc/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Mon Nov 8 12:54:55 2010 (r214983) @@ -773,19 +773,27 @@ compile_str(dtrace_cmd_t *dcp) static void prochandler(struct ps_prochandle *P, const char *msg, void *arg) { -fatal("DOODAD in function %s, file %s, line %d\n",__FUNCTION__,__FILE__,__LINE__); -#ifdef DOODAD +#if defined(sun) const psinfo_t *prp = Ppsinfo(P); int pid = Pstatus(P)->pr_pid; char name[SIG2STR_MAX]; +#else + int wstatus = proc_getwstat(P); + int pid = proc_getpid(P); +#endif if (msg != NULL) { notice("pid %d: %s\n", pid, msg); return; } +#if defined(sun) switch (Pstate(P)) { +#else + switch (proc_state(P)) { +#endif case PS_UNDEAD: +#if defined(sun) /* * Ideally we would like to always report pr_wstat here, but it * isn't possible given current /proc semantics. If we grabbed @@ -798,9 +806,20 @@ fatal("DOODAD in function %s, file %s, l notice("pid %d terminated by %s\n", pid, proc_signame(WTERMSIG(prp->pr_wstat), name, sizeof (name))); +#else + if (WIFSIGNALED(wstatus)) { + notice("pid %d terminated by %d\n", pid, + WTERMSIG(wstatus)); +#endif +#if defined(sun) } else if (prp != NULL && WEXITSTATUS(prp->pr_wstat) != 0) { notice("pid %d exited with status %d\n", pid, WEXITSTATUS(prp->pr_wstat)); +#else + } else if (WEXITSTATUS(wstatus) != 0) { + notice("pid %d exited with status %d\n", + pid, WEXITSTATUS(wstatus)); +#endif } else { notice("pid %d has exited\n", pid); } @@ -812,7 +831,6 @@ fatal("DOODAD in function %s, file %s, l g_pslive--; break; } -#endif } /*ARGSUSED*/ Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/baddof/baddof.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/baddof/baddof.c Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/baddof/baddof.c Mon Nov 8 12:54:55 2010 (r214983) @@ -20,12 +20,10 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -162,7 +160,7 @@ main(int argc, char **argv) FILE *fp; unsigned char *dof, *copy; - if (argc < 1) + if (argc < 2) fatal("expected D script as argument\n"); if ((fp = fopen(filename, "r")) == NULL) Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/chkargs/chkargs.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/chkargs/chkargs.c Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/chkargs/chkargs.c Mon Nov 8 12:54:55 2010 (r214983) @@ -20,12 +20,10 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -35,6 +33,7 @@ static int g_errs; static int g_fd; static int g_verbose; static int g_errexit; +static char *g_progname; static int probe(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp, void *data) @@ -91,9 +90,11 @@ main(int argc, char *argv[]) int err, c; char *p; + g_progname = argv[0]; + if ((dtp = dtrace_open(DTRACE_VERSION, 0, &err)) == NULL) { (void) fprintf(stderr, "%s: failed to open dtrace: %s\n", - argv[0], dtrace_errmsg(dtp, err)); + g_progname, dtrace_errmsg(dtp, err)); return (1); } @@ -111,7 +112,7 @@ main(int argc, char *argv[]) if (dtrace_setopt(dtp, optarg, p) != 0) { (void) fprintf(stderr, "%s: failed to set " - "option -x %s: %s\n", argv[0], optarg, + "option -x %s: %s\n", g_progname, optarg, dtrace_errmsg(dtp, dtrace_errno(dtp))); return (2); } @@ -119,7 +120,7 @@ main(int argc, char *argv[]) default: (void) fprintf(stderr, "Usage: %s [-ev] " - "[-x opt[=arg]] [probedesc]\n", argv[0]); + "[-x opt[=arg]] [probedesc]\n", g_progname); return (2); } } @@ -128,9 +129,9 @@ main(int argc, char *argv[]) argc -= optind; if (argc > 0) { - if (dtrace_str2desc(dtp, DTRACE_PROBESPEC_NAME, argv[1], &pd)) { + if (dtrace_str2desc(dtp, DTRACE_PROBESPEC_NAME, argv[0], &pd)) { (void) fprintf(stderr, "%s: invalid probe description " - "%s: %s\n", argv[0], argv[1], + "%s: %s\n", g_progname, argv[0], dtrace_errmsg(dtp, dtrace_errno(dtp))); return (2); } Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dstyle.pl ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dstyle.pl Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dstyle.pl Mon Nov 8 12:54:55 2010 (r214983) @@ -21,12 +21,11 @@ # # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#pragma ident "%Z%%M% %I% %E% SMI" -require 5.6.1; +require 5.8.4; $PNAME = $0; $PNAME =~ s:.*/::; Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl Mon Nov 8 12:54:55 2010 (r214983) @@ -24,9 +24,8 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -require 5.6.1; +require 5.8.4; use File::Find; use File::Basename; @@ -40,10 +39,11 @@ $OPTSTR = 'abd:fghi:jlnqsx:'; $USAGE = "Usage: $PNAME [-abfghjlnqs] [-d dir] [-i isa] " . "[-x opt[=arg]] [file | dir ...]\n"; ($MACH = `uname -p`) =~ s/\W*\n//; +($PLATFORM = `uname -i`) =~ s/\W*\n//; @dtrace_argv = (); -$ksh_path = '/bin/sh'; +$ksh_path = '/usr/local/bin/ksh'; @files = (); %exceptions = (); @@ -215,17 +215,17 @@ sub is_exception { } # -# Iterate over the set of test files specified on the command-line or by -# a find on "$defdir/common" and "$defdir/$MACH" and execute each one. -# If the test file is executable, we fork and exec it. If the test is a -# .ksh file, we run it with $ksh_path. Otherwise we run dtrace -s on it. -# If the file is named tst.* we assume it should return exit status 0. -# If the file is named err.* we assume it should return exit status 1. -# If the file is named err.D_[A-Z0-9]+[.*].d we use dtrace -xerrtags and -# examine stderr to ensure that a matching error tag was produced. -# If the file is named drp.[A-Z0-9]+[.*].d we use dtrace -xdroptags and -# examine stderr to ensure that a matching drop tag was produced. -# If any *.out or *.err files are found we perform output comparisons. +# Iterate over the set of test files specified on the command-line or by a find +# on "$defdir/common", "$defdir/$MACH" and "$defdir/$PLATFORM" and execute each +# one. If the test file is executable, we fork and exec it. If the test is a +# .ksh file, we run it with $ksh_path. Otherwise we run dtrace -s on it. If +# the file is named tst.* we assume it should return exit status 0. If the +# file is named err.* we assume it should return exit status 1. If the file is +# named err.D_[A-Z0-9]+[.*].d we use dtrace -xerrtags and examine stderr to +# ensure that a matching error tag was produced. If the file is named +# drp.[A-Z0-9]+[.*].d we use dtrace -xdroptags and examine stderr to ensure +# that a matching drop tag was produced. If any *.out or *.err files are found +# we perform output comparisons. # # run_tests takes two arguments: The first is the pathname of the dtrace # command to invoke when running the tests. The second is the pathname @@ -548,6 +548,7 @@ $bindir = -d $dt_bin ? $dt_bin : '.'; find(\&wanted, "$defdir/common") if (scalar(@ARGV) == 0); find(\&wanted, "$defdir/$MACH") if (scalar(@ARGV) == 0); +find(\&wanted, "$defdir/$PLATFORM") if (scalar(@ARGV) == 0); die $USAGE if (scalar(@files) == 0); $dtrace_path = '/usr/sbin/dtrace'; Copied: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.stddevtoofew.d (from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.stddevtoofew.d) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.stddevtoofew.d Mon Nov 8 12:54:55 2010 (r214983, copy of r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.stddevtoofew.d) @@ -0,0 +1,41 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * ASSERTION: + * stddev() should not accept a non-scalar value + * + * SECTION: Aggregations/Aggregations + * + */ + +#pragma D option quiet + +BEGIN +{ + @a[pid] = stddev(probefunc); +} + Copied: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevnoarg.d (from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevnoarg.d) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevnoarg.d Mon Nov 8 12:54:55 2010 (r214983, copy of r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevnoarg.d) @@ -0,0 +1,41 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * ASSERTION: + * stddev() should not accept a call with no arguments + * + * SECTION: Aggregations/Aggregations + * + */ + +#pragma D option quiet + +BEGIN +{ + @a[1] = stddev(); +} + Copied: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevtoomany.d (from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevtoomany.d) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevtoomany.d Mon Nov 8 12:54:55 2010 (r214983, copy of r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevtoomany.d) @@ -0,0 +1,41 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * ASSERTION: + * stddev() should not have more than one argument + * + * SECTION: Aggregations/Aggregations + * + */ + +#pragma D option quiet + +BEGIN +{ + @a[1] = stddev(1, 2); +} + Copied: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d (from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d Mon Nov 8 12:54:55 2010 (r214983, copy of r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d) @@ -0,0 +1,57 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * ASSERTION: + * Positive stddev() test + * + * SECTION: Aggregations/Aggregations + * + * NOTES: + * Verifies that printing a clear()'d aggregation with an stddev() + * aggregation function doesn't cause problems. + * + */ + +#pragma D option quiet + +tick-10ms +/i++ < 5/ +{ + @a = stddev(timestamp); +} + +tick-10ms +/i == 5/ +{ + exit(2); +} + +END +{ + clear(@a); + exit(0); +} Copied: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d.out (from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d.out Mon Nov 8 12:54:55 2010 (r214983, copy of r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d.out) @@ -0,0 +1,2 @@ + + 0 Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs1.d ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs1.d Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs1.d Mon Nov 8 12:54:55 2010 (r214983) @@ -20,15 +20,13 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * ASSERTION: - * Multiple aggregates can be used within the same D script. + * Multiple aggregates can be used within the same D script. * * SECTION: Aggregations/Aggregations * @@ -52,9 +50,11 @@ tick-10ms @c[pid] = avg(new_time); @d[pid] = sum(new_time); @e[pid] = quantize(new_time); - @f[timestamp] = max(new_time); - @g[timestamp] = quantize(new_time); - @h[timestamp] = lquantize(new_time, 0, 10000, 1000); + @f[pid] = stddev(new_time); + @g[timestamp] = max(new_time); + @h[timestamp] = quantize(new_time); + @i[timestamp] = lquantize(new_time, 0, 10000, 1000); + time_1 = time_2; i++; } Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d Mon Nov 8 12:54:55 2010 (r214983) @@ -20,18 +20,16 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * ASSERTION: - * Test multiple aggregations and the default output order + * Test multiple aggregations and the default output order * * SECTION: Aggregations/Aggregations; - * Aggregations/Output + * Aggregations/Output * */ @@ -51,6 +49,7 @@ tick-10ms @d = max(i); @e = quantize(i); @f = lquantize(i, 0, 1000, 100); + @g = stddev(i); i += 100; } Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d.out ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d.out Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d.out Mon Nov 8 12:54:55 2010 (r214983) @@ -34,3 +34,4 @@ 900 |@@@@ 1 >= 1000 | 0 + 287 Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d Mon Nov 8 12:54:55 2010 (r214983) @@ -20,19 +20,17 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * ASSERTION: - * Test multiple aggregations and overriding default order with - * printa() statements. + * Test multiple aggregations and overriding default order with + * printa() statements. * * SECTION: Aggregations/Aggregations; - * Aggregations/Output + * Aggregations/Output * * NOTES: This is a simple verifiable test. * @@ -55,6 +53,7 @@ tick-10ms @e = max(i); @f = quantize(i); @g = lquantize(i, 0, 1000, 100); + @h = stddev(i); i += 100; } @@ -62,6 +61,7 @@ tick-10ms tick-10ms /i == 1000/ { + printa("%@d\n", @h); printa("%@d\n", @g); printa("%@d\n", @f); printa("%@d\n", @e); Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d.out ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d.out Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d.out Mon Nov 8 12:54:55 2010 (r214983) @@ -1,3 +1,4 @@ +287 value ------------- Distribution ------------- count < 0 | 0 Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d Mon Nov 8 12:54:55 2010 (r214983) @@ -20,20 +20,19 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - - /* * ASSERTION: - * Positive stddev() test + * Positive stddev() test * * SECTION: Aggregations/Aggregations * * NOTES: This is a simple verifiable positive test of the stddev() function. + * printa() for one aggregation, default printing behavior for the other + * so that we exercise both code paths. */ #pragma D option quiet @@ -60,5 +59,6 @@ BEGIN @b = stddev(-5000000700); @b = stddev(-5000000800); @b = stddev(-5000000900); + printa("%@d\n", @a); exit(0); } Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d.out ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d.out Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.stddev.d.out Mon Nov 8 12:54:55 2010 (r214983) @@ -1,3 +1,3 @@ +287 287 - 287 Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.subr.d ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.subr.d Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.subr.d Mon Nov 8 12:54:55 2010 (r214983) @@ -26,7 +26,6 @@ #pragma ident "%Z%%M% %I% %E% SMI" -#include #define INTFUNC(x) \ BEGIN \ Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/assocs/tst.orthogonality.d ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/assocs/tst.orthogonality.d Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/assocs/tst.orthogonality.d Mon Nov 8 12:54:55 2010 (r214983) @@ -39,13 +39,13 @@ BEGIN } BEGIN -/b[curthread->t_did] == 0/ +/b[curthread->td_flags] == 0/ { exit(0); } BEGIN { - printf("value should be 0; value is %x!", b[curthread->t_did]); + printf("value should be 0; value is %x!", b[curthread->td_flags]); exit(1); } Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.AddSearchPath.d.ksh ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.AddSearchPath.d.ksh Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.AddSearchPath.d.ksh Mon Nov 8 12:54:55 2010 (r214983) @@ -78,5 +78,5 @@ if [ "$status" -ne 0 ]; then exit $status fi -/usr/bin/rm -f $tempfile +/bin/rm -f $tempfile exit 0 Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithModule.d.ksh ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithModule.d.ksh Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithModule.d.ksh Mon Nov 8 12:54:55 2010 (r214983) @@ -44,7 +44,7 @@ fi dtrace=$1 -$dtrace -qwm unix'{chill(15); printf("Done chilling"); exit(0);}' +$dtrace -qwm kernel'{chill(15); printf("Done chilling"); exit(0);}' status=$? if [ "$status" -ne 0 ]; then Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationOut.d.ksh ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationOut.d.ksh Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationOut.d.ksh Mon Nov 8 12:54:55 2010 (r214983) @@ -69,5 +69,5 @@ if [ ! -a "d.out" ]; then exit 1 fi -/usr/bin/rm -f "d.out" +/bin/rm -f "d.out" exit 0 Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationWithO.d.ksh ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationWithO.d.ksh Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationWithO.d.ksh Mon Nov 8 12:54:55 2010 (r214983) @@ -70,5 +70,5 @@ if [ ! -a "outputFile" ]; then exit 1 fi -/usr/bin/rm -f "outputFile" +/bin/rm -f "outputFile" exit 0 Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.PreprocessorStatement.d.ksh ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.PreprocessorStatement.d.ksh Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.PreprocessorStatement.d.ksh Mon Nov 8 12:54:55 2010 (r214983) @@ -43,7 +43,6 @@ script() { $dtrace -CH -s /dev/stdin < BEGIN { Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoofew.d ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoofew.d Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoofew.d Mon Nov 8 12:54:55 2010 (r214983) @@ -34,7 +34,7 @@ * */ -lockstat:genunix:mutex_enter:adaptive-acquire +lockstat:kernel:mtx_lock:adaptive-acquire { mutex_owned(); exit(1); Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoomany.d ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoomany.d Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoomany.d Mon Nov 8 12:54:55 2010 (r214983) @@ -34,7 +34,7 @@ * */ -lockstat:genunix:mutex_enter:adaptive-acquire +lockstat:kernel:mtx_lock:adaptive-acquire { mutex_owned((kmutex_t *)arg0, 99); exit(1); Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoofew.d ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoofew.d Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoofew.d Mon Nov 8 12:54:55 2010 (r214983) @@ -36,7 +36,7 @@ */ -lockstat:genunix:mutex_enter:adaptive-acquire +lockstat:kernel:mtx_lock:adaptive-acquire { mutex_type_adaptive(); exit(1); Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoomany.d ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoomany.d Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoomany.d Mon Nov 8 12:54:55 2010 (r214983) @@ -35,7 +35,7 @@ */ -lockstat:genunix:mutex_enter:adaptive-acquire +lockstat:kernel:mtx_lock:adaptive-acquire { mutex_type_adaptive((kmutex_t *)arg0, 99); exit(1); Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.index.d ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.index.d Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.index.d Mon Nov 8 12:54:55 2010 (r214983) @@ -80,7 +80,7 @@ BEGIN i++; end = j = k = 0; - printf("#!/usr/perl5/bin/perl\n\nBEGIN {\n"); + printf("#!/usr/bin/perl\n\nBEGIN {\n"); } tick-1ms Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl Mon Aug 2 13:40:53 2010 (r210767) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl Mon Nov 8 12:54:55 2010 (r214983) @@ -50,7 +50,7 @@ my $local = ""; my $remote = ""; my %Broadcast; my $up; -open IFCONFIG, '/usr/sbin/ifconfig -a |' or die "Couldn't run ifconfig: $!\n"; +open IFCONFIG, '/sbin/ifconfig -a |' or die "Couldn't run ifconfig: $!\n"; while () { next if /^lo/; @@ -73,7 +73,7 @@ die "Could not determine local IP addres # Find the first remote host that responds to an icmp echo, # which isn't a local address. # -open PING, "/usr/sbin/ping -ns $Broadcast{$local} 56 $MAXHOSTS |" or +open PING, "/sbin/ping -ns $Broadcast{$local} 56 $MAXHOSTS |" or die "Couldn't run ping: $!\n"; while () { if (/bytes from (.*): / and not defined $Broadcast{$1}) { Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl Mon Aug 2 13:40:53 2010 (r210767) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl Mon Nov 8 12:54:55 2010 (r214983) @@ -50,7 +50,7 @@ my $local = ""; my $remote = ""; my %Local; my $up; -open IFCONFIG, '/usr/sbin/ifconfig -a inet6 |' +open IFCONFIG, '/sbin/ifconfig -a inet6 |' or die "Couldn't run ifconfig: $!\n"; while () { next if /^lo/; @@ -74,7 +74,7 @@ exit 1 if $local eq ""; # Find the first remote host that responds to an icmp echo, # which isn't a local address. # -open PING, "/usr/sbin/ping -ns -A inet6 $MULTICAST 56 $MAXHOSTS |" or +open PING, "/sbin/ping -ns -A inet6 $MULTICAST 56 $MAXHOSTS |" or die "Couldn't run ping: $!\n"; while () { if (/bytes from (.*): / and not defined $Local{$1}) { Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh Mon Aug 2 13:40:53 2010 (r210767) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh Mon Nov 8 12:54:55 2010 (r214983) @@ -45,7 +45,7 @@ fi dtrace=$1 local=127.0.0.1 -$dtrace -c "/usr/sbin/ping $local 3" -qs /dev/stdin <ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[4]->ipv4_protocol == IPPROTO_ICMP/ Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh Mon Aug 2 13:40:53 2010 (r210767) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh Mon Nov 8 12:54:55 2010 (r214983) @@ -120,6 +120,6 @@ EODTRACE status=$? cd / -/usr/bin/rm -rf $DIR +/bin/rm -rf $DIR exit $status Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh Mon Aug 2 13:40:53 2010 (r210767) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh Mon Nov 8 12:54:55 2010 (r214983) @@ -57,7 +57,7 @@ fi dtrace=$1 local=127.0.0.1 -$dtrace -c "/usr/sbin/ping -U $local" -qs /dev/stdin <ip_saddr == "$source" && args[2]->ip_daddr == "$dest" && Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh Mon Aug 2 13:40:53 2010 (r210767) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh Mon Nov 8 12:54:55 2010 (r214983) @@ -123,6 +123,6 @@ EODTRACE status=$? cd / -/usr/bin/rm -rf $DIR +/bin/rm -rf $DIR exit $? Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh Mon Aug 2 13:40:53 2010 (r210767) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh Mon Nov 8 12:54:55 2010 (r214983) @@ -60,7 +60,7 @@ if (( $? != 0 )); then exit 4 fi -$dtrace -c "/usr/sbin/ping -U $dest" -qs /dev/stdin <ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/ Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6remoteicmp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6remoteicmp.ksh Mon Aug 2 13:40:53 2010 (r210767) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6remoteicmp.ksh Mon Nov 8 12:54:55 2010 (r214983) @@ -62,9 +62,9 @@ fi # # Shake loose any ICMPv6 Neighbor advertisement messages before tracing. # -/usr/sbin/ping $dest 3 > /dev/null 2>&1 +/sbin/ping $dest 3 > /dev/null 2>&1 -$dtrace -c "/usr/sbin/ping $dest 3" -qs /dev/stdin <ip_saddr == "$source" && args[2]->ip_daddr == "$dest" && Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh Mon Aug 2 13:40:53 2010 (r210767) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh Mon Nov 8 12:54:55 2010 (r214983) @@ -177,6 +177,6 @@ EODTRACE status=$? cd / -/usr/bin/rm -rf $DIR +/bin/rm -rf $DIR exit $status Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh Mon Aug 2 13:40:53 2010 (r210767) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh Mon Nov 8 12:54:55 2010 (r214983) @@ -167,6 +167,6 @@ EODTRACE status=$? cd / -/usr/bin/rm -rf $DIR +/bin/rm -rf $DIR exit $status Modified: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/src/TestFunctionLookup.java ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/src/TestFunctionLookup.java Mon Nov 8 12:04:41 2010 (r214982) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/src/TestFunctionLookup.java Mon Nov 8 12:54:55 2010 (r214983) @@ -20,10 +20,8 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. - * - * ident "%Z%%M% %I% %E% SMI" */ import org.opensolaris.os.dtrace.*; @@ -70,7 +68,7 @@ public class TestFunctionLookup { long addr = (Long)address; f = consumer.lookupKernelFunction(addr); } - if (f.equals("genunix`setrun")) { + if (f.equals("genunix`cv_wakeup")) { System.out.println(f); done = true; } Copied: stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/src/TestGetAggregate.java (from r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/src/TestGetAggregate.java) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/src/TestGetAggregate.java Mon Nov 8 12:54:55 2010 (r214983, copy of r210767, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/java_api/src/TestGetAggregate.java) @@ -0,0 +1,252 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +import org.opensolaris.os.dtrace.*; +import java.util.*; + +/** + * Assert getAggregate() can explicitly specify the anonymous aggregation. + */ +public class TestGetAggregate { + static final String programString = + "profile:::tick-50ms" + + "{" + + " @ = count();" + + " @a = count();" + + "}"; + + static final String ANONYMOUS_AGGREGATION = ""; + static final int TICK = 50; + static final int EXPECTED_TICKS = 3; + static final int INTERVALS = 4; + + static void + testIncluded(Consumer consumer, String ... aggregationNames) + throws DTraceException, InterruptedException + { + Aggregate aggregate; + Set included = new HashSet (); + int n = 1; + + for (String name : aggregationNames) { + included.add(name); + } + + // Wait up to a full second to obtain aggregate data. Without a + // time limit, we'll loop forever if no aggregation was + // successfully included. + do { + Thread.sleep(TICK); + aggregate = consumer.getAggregate(included, null); + } while (aggregate.asMap().isEmpty() && n++ < (1000 / TICK)); + + for (String name : included) { + if (aggregate.getAggregation(name) == null) { + throw new IllegalStateException("@" + name + + " was explicitly included but did not appear " + + "in the aggregate"); + } + } + for (Aggregation a : aggregate.getAggregations()) { + if (!included.contains(a.getName())) { + throw new IllegalStateException("@" + a.getName() + + " was not explicitly included but appeared " + + "in the aggregate anyway"); + } + } + + if (!consumer.isRunning()) { + throw new IllegalStateException("consumer exited"); + } + } + + static void + testCleared(Consumer consumer, String ... aggregationNames) + throws DTraceException, InterruptedException + { + Aggregate aggregate; + AggregationRecord rec; + long value; + Long firstValue; + int n = 1; + Map firstValues = new HashMap (); + Set cleared = new HashSet (); + + for (String name : aggregationNames) { + cleared.add(name); + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 13:31:44 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1617106564A; Mon, 8 Nov 2010 13:31:44 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BEE568FC12; Mon, 8 Nov 2010 13:31: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 oA8DViIe033725; Mon, 8 Nov 2010 13:31:44 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8DViNq033723; Mon, 8 Nov 2010 13:31:44 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201011081331.oA8DViNq033723@svn.freebsd.org> From: Rui Paulo Date: Mon, 8 Nov 2010 13:31:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214984 - stable/8/lib/libproc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 13:31:44 -0000 Author: rpaulo Date: Mon Nov 8 13:31:44 2010 New Revision: 214984 URL: http://svn.freebsd.org/changeset/base/214984 Log: Don't use basename_r(). Modified: stable/8/lib/libproc/proc_sym.c Modified: stable/8/lib/libproc/proc_sym.c ============================================================================== --- stable/8/lib/libproc/proc_sym.c Mon Nov 8 12:54:55 2010 (r214983) +++ stable/8/lib/libproc/proc_sym.c Mon Nov 8 13:31:44 2010 (r214984) @@ -109,7 +109,7 @@ proc_iter_objs(struct proc_handle *p, pr size_t i; rd_loadobj_t *rdl; prmap_t map; - char path[MAXPATHLEN]; + char *path; char last[MAXPATHLEN]; if (p->nobjs == 0) @@ -118,7 +118,7 @@ proc_iter_objs(struct proc_handle *p, pr for (i = 0; i < p->nobjs; i++) { rdl = &p->rdobjs[i]; proc_rdl2prmap(rdl, &map); - basename_r(rdl->rdl_path, path); + path = basename(rdl->rdl_path); /* * We shouldn't call the callback twice with the same object. * To do that we are assuming the fact that if there are @@ -331,7 +331,7 @@ proc_name2map(struct proc_handle *p, con size_t i; int cnt; prmap_t *map; - char tmppath[MAXPATHLEN]; + char *tmppath; struct kinfo_vmentry *kves, *kve; rd_loadobj_t *rdl; @@ -346,7 +346,7 @@ proc_name2map(struct proc_handle *p, con return (NULL); for (i = 0; i < (size_t)cnt; i++) { kve = kves + i; - basename_r(kve->kve_path, tmppath); + tmppath = basename(kve->kve_path); if (strcmp(tmppath, name) == 0) { map = proc_addr2map(p, kve->kve_start); free(kves); @@ -362,7 +362,7 @@ proc_name2map(struct proc_handle *p, con } for (i = 0; i < p->nobjs; i++) { rdl = &p->rdobjs[i]; - basename_r(rdl->rdl_path, tmppath); + tmppath = basename(rdl->rdl_path); if (strcmp(tmppath, name) == 0) { if ((map = malloc(sizeof(*map))) == NULL) return (NULL); From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 14:47:19 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3615B106564A; Mon, 8 Nov 2010 14:47:19 +0000 (UTC) (envelope-from ume@mahoroba.org) Received: from mail.mahoroba.org (ent.mahoroba.org [IPv6:2001:2f0:104:8010::1]) by mx1.freebsd.org (Postfix) with ESMTP id 9A2A18FC0C; Mon, 8 Nov 2010 14:47:18 +0000 (UTC) Received: from yuga.mahoroba.org (ume@yuga.mahoroba.org [IPv6:2001:2f0:104:8010:21b:d3ff:fe38:5381]) (user=ume mech=DIGEST-MD5 bits=0) by mail.mahoroba.org (8.14.4/8.14.4) with ESMTP/inet6 id oA8EkV7Y020666 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 8 Nov 2010 23:47:09 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Mon, 08 Nov 2010 23:46:31 +0900 Message-ID: From: Hajimu UMEMOTO To: Rui Paulo In-Reply-To: <201011081331.oA8DViNq033723@svn.freebsd.org> References: <201011081331.oA8DViNq033723@svn.freebsd.org> User-Agent: xcite1.60> Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.8 Emacs/23.2 (i386-portbld-freebsd8.1) MULE/6.0 (HANACHIRUSATO) X-Operating-System: FreeBSD 8.1-STABLE X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (mail.mahoroba.org [IPv6:2001:2f0:104:8010::1]); Mon, 08 Nov 2010 23:47:09 +0900 (JST) X-Virus-Scanned: clamav-milter 0.96.4 at asuka.mahoroba.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on asuka.mahoroba.org Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org Subject: Re: svn commit: r214984 - stable/8/lib/libproc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 14:47:19 -0000 Hi, >>>>> On Mon, 8 Nov 2010 13:31:44 +0000 (UTC) >>>>> Rui Paulo said: rpaulo> Author: rpaulo rpaulo> Date: Mon Nov 8 13:31:44 2010 rpaulo> New Revision: 214984 rpaulo> URL: http://svn.freebsd.org/changeset/base/214984 rpaulo> Log: rpaulo> Don't use basename_r(). rpaulo> Modified: rpaulo> stable/8/lib/libproc/proc_sym.c Shouldn't MFCing basename_r() be better rather than stopping use of it? Sincerely, -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/ From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 15:06:17 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B611010656CB; Mon, 8 Nov 2010 15:06:17 +0000 (UTC) (envelope-from rpaulo@freebsd.org) Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by mx1.freebsd.org (Postfix) with ESMTP id 853098FC26; Mon, 8 Nov 2010 15:06:17 +0000 (UTC) Received: from e.earth.lavabit.com (e.earth.lavabit.com [192.168.111.14]) by karen.lavabit.com (Postfix) with ESMTP id 84E9911B897; Mon, 8 Nov 2010 09:06:16 -0600 (CST) Received: from 192.168.1.70 (bl17-210-129.dsl.telepac.pt [188.82.210.129]) by lavabit.com with ESMTP id K3I515Q28UBF; Mon, 08 Nov 2010 09:06:16 -0600 References: <201011081331.oA8DViNq033723@svn.freebsd.org> In-Reply-To: Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii Message-Id: Content-Transfer-Encoding: quoted-printable From: Rui Paulo Date: Mon, 8 Nov 2010 15:06:12 +0000 To: Hajimu UMEMOTO X-Mailer: Apple Mail (2.1081) Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org Subject: Re: svn commit: r214984 - stable/8/lib/libproc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 15:06:17 -0000 On Nov 8, 2010, at 2:46 PM, Hajimu UMEMOTO wrote: > Hi, >=20 >>>>>> On Mon, 8 Nov 2010 13:31:44 +0000 (UTC) >>>>>> Rui Paulo said: >=20 > rpaulo> Author: rpaulo > rpaulo> Date: Mon Nov 8 13:31:44 2010 > rpaulo> New Revision: 214984 > rpaulo> URL: http://svn.freebsd.org/changeset/base/214984 >=20 > rpaulo> Log: > rpaulo> Don't use basename_r(). >=20 > rpaulo> Modified: > rpaulo> stable/8/lib/libproc/proc_sym.c >=20 > Shouldn't MFCing basename_r() be better rather than stopping use of > it? It's on my plans, but basename_r is not POSIX and there was a private = discussion about it a couple of weeks ago. The conclusion is that we = should adopt the Android semantics of basename_r(). Regards, -- Rui Paulo From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 15:14:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53758106566C; Mon, 8 Nov 2010 15:14:15 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 207D58FC0C; Mon, 8 Nov 2010 15:14: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 oA8FEFab037277; Mon, 8 Nov 2010 15:14:15 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8FEF5m037275; Mon, 8 Nov 2010 15:14:15 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201011081514.oA8FEF5m037275@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 8 Nov 2010 15:14:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214985 - head/sys/compat/linprocfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 15:14:15 -0000 Author: des Date: Mon Nov 8 15:14:14 2010 New Revision: 214985 URL: http://svn.freebsd.org/changeset/base/214985 Log: Break long line. Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Mon Nov 8 13:31:44 2010 (r214984) +++ head/sys/compat/linprocfs/linprocfs.c Mon Nov 8 15:14:14 2010 (r214985) @@ -280,7 +280,8 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) "model\t\t: %u\n" "model name\t: %s\n" "stepping\t: %u\n\n", - i, cpu_vendor, CPUID_TO_FAMILY(cpu_id), CPUID_TO_MODEL(cpu_id), model, cpu_id & CPUID_STEPPING); + i, cpu_vendor, CPUID_TO_FAMILY(cpu_id), + CPUID_TO_MODEL(cpu_id), model, cpu_id & CPUID_STEPPING); /* XXX per-cpu vendor / class / model / id? */ } From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 15:19:32 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23FF01065674; Mon, 8 Nov 2010 15:19:32 +0000 (UTC) (envelope-from ume@mahoroba.org) Received: from mail.mahoroba.org (ent.mahoroba.org [IPv6:2001:2f0:104:8010::1]) by mx1.freebsd.org (Postfix) with ESMTP id 75AE48FC20; Mon, 8 Nov 2010 15:19:31 +0000 (UTC) Received: from yuga.mahoroba.org (ume@yuga.mahoroba.org [IPv6:2001:2f0:104:8010:21b:d3ff:fe38:5381]) (user=ume mech=DIGEST-MD5 bits=0) by mail.mahoroba.org (8.14.4/8.14.4) with ESMTP/inet6 id oA8FJPbc059378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 9 Nov 2010 00:19:26 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Tue, 09 Nov 2010 00:19:25 +0900 Message-ID: From: Hajimu UMEMOTO To: Rui Paulo In-Reply-To: References: <201011081331.oA8DViNq033723@svn.freebsd.org> User-Agent: xcite1.60> Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.8 Emacs/23.2 (i386-portbld-freebsd8.1) MULE/6.0 (HANACHIRUSATO) X-Operating-System: FreeBSD 8.1-STABLE X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (mail.mahoroba.org [IPv6:2001:2f0:104:8010::1]); Tue, 09 Nov 2010 00:19:26 +0900 (JST) X-Virus-Scanned: clamav-milter 0.96.4 at asuka.mahoroba.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on asuka.mahoroba.org Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org Subject: Re: svn commit: r214984 - stable/8/lib/libproc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 15:19:32 -0000 Hi, >>>>> On Mon, 8 Nov 2010 15:06:12 +0000 >>>>> Rui Paulo said: rpaulo> It's on my plans, but basename_r is not POSIX and there was a private discussion about it a couple of weeks ago. The conclusion is that we should adopt the Android semantics of basename_r(). I found the thread, and understood it. However, I still wonderling if breaking thread-safeness in proc_sym.c is okay, though it may not be necessary. Sincerely, -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/ From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 15:22:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 008181065788; Mon, 8 Nov 2010 15:22:21 +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 D8DB88FC27; Mon, 8 Nov 2010 15:22:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8FMKhd037634; Mon, 8 Nov 2010 15:22:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8FMKSd037627; Mon, 8 Nov 2010 15:22:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201011081522.oA8FMKSd037627@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 8 Nov 2010 15:22:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214986 - stable/7/sys/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 15:22:21 -0000 Author: kib Date: Mon Nov 8 15:22:20 2010 New Revision: 214986 URL: http://svn.freebsd.org/changeset/base/214986 Log: MFC r203072 (by rmacklem, to be reverted by MFC of r214026): Fix a race that can occur when nfs nfsiod threads are being created. MFC r212506: Do not fork nfsiod directly from the vop methods. MFC r214026: Do not synchronously start the nfsiod threads at all. Tested by: jhb Modified: stable/7/sys/nfsclient/nfs.h stable/7/sys/nfsclient/nfs_bio.c stable/7/sys/nfsclient/nfs_nfsiod.c stable/7/sys/nfsclient/nfs_subs.c stable/7/sys/nfsclient/nfs_vnops.c stable/7/sys/nfsclient/nfsnode.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/nfsclient/nfs.h ============================================================================== --- stable/7/sys/nfsclient/nfs.h Mon Nov 8 15:14:14 2010 (r214985) +++ stable/7/sys/nfsclient/nfs.h Mon Nov 8 15:22:20 2010 (r214986) @@ -135,6 +135,7 @@ extern struct uma_zone *nfsmount_zone; extern struct callout nfs_callout; extern struct nfsstats nfsstats; extern struct mtx nfs_iod_mtx; +extern struct task nfs_nfsiodnew_task; extern int nfs_numasync; extern unsigned int nfs_iodmax; @@ -305,7 +306,8 @@ int nfs_writerpc(struct vnode *, struct int nfs_commit(struct vnode *vp, u_quad_t offset, int cnt, struct ucred *cred, struct thread *td); int nfs_readdirrpc(struct vnode *, struct uio *, struct ucred *); -int nfs_nfsiodnew(void); +void nfs_nfsiodnew(void); +void nfs_nfsiodnew_tq(__unused void *, int); int nfs_asyncio(struct nfsmount *, struct buf *, struct ucred *, struct thread *); int nfs_doio(struct vnode *, struct buf *, struct ucred *, struct thread *); void nfs_doio_directwrite (struct buf *); Modified: stable/7/sys/nfsclient/nfs_bio.c ============================================================================== --- stable/7/sys/nfsclient/nfs_bio.c Mon Nov 8 15:14:14 2010 (r214985) +++ stable/7/sys/nfsclient/nfs_bio.c Mon Nov 8 15:22:20 2010 (r214986) @@ -1375,7 +1375,7 @@ again: * Find a free iod to process this request. */ for (iod = 0; iod < nfs_numasync; iod++) - if (nfs_iodwant[iod]) { + if (nfs_iodwant[iod] == NFSIOD_AVAILABLE) { gotiod = TRUE; break; } @@ -1383,20 +1383,16 @@ again: /* * Try to create one if none are free. */ - if (!gotiod) { - iod = nfs_nfsiodnew(); - if (iod != -1) - gotiod = TRUE; - } - - if (gotiod) { + if (!gotiod) + nfs_nfsiodnew(); + else { /* * Found one, so wake it up and tell it which * mount to process. */ NFS_DPF(ASYNCIO, ("nfs_asyncio: waking iod %d for mount %p\n", iod, nmp)); - nfs_iodwant[iod] = NULL; + nfs_iodwant[iod] = NFSIOD_NOT_AVAILABLE; nfs_iodmount[iod] = nmp; nmp->nm_bufqiods++; wakeup(&nfs_iodwant[iod]); @@ -1409,7 +1405,7 @@ again: if (!gotiod) { if (nmp->nm_bufqiods > 0) { NFS_DPF(ASYNCIO, - ("nfs_asyncio: %d iods are already processing mount %p\n", + ("nfs_asyncio: %d iods are already processing mount %p\n", nmp->nm_bufqiods, nmp)); gotiod = TRUE; } @@ -1424,9 +1420,9 @@ again: * Ensure that the queue never grows too large. We still want * to asynchronize so we block rather then return EIO. */ - while (nmp->nm_bufqlen >= 2*nfs_numasync) { + while (nmp->nm_bufqlen >= 2 * nfs_numasync) { NFS_DPF(ASYNCIO, - ("nfs_asyncio: waiting for mount %p queue to drain\n", nmp)); + ("nfs_asyncio: waiting for mount %p queue to drain\n", nmp)); nmp->nm_bufqwant = TRUE; error = nfs_msleep(td, &nmp->nm_bufq, &nfs_iod_mtx, slpflag | PRIBIO, @@ -1434,7 +1430,7 @@ again: if (error) { error2 = nfs_sigintr(nmp, NULL, td); if (error2) { - mtx_unlock(&nfs_iod_mtx); + mtx_unlock(&nfs_iod_mtx); return (error2); } if (slpflag == PCATCH) { @@ -1446,17 +1442,13 @@ again: * We might have lost our iod while sleeping, * so check and loop if nescessary. */ - if (nmp->nm_bufqiods == 0) { - NFS_DPF(ASYNCIO, - ("nfs_asyncio: no iods after mount %p queue was drained, looping\n", nmp)); - goto again; - } + goto again; } /* We might have lost our nfsiod */ if (nmp->nm_bufqiods == 0) { NFS_DPF(ASYNCIO, - ("nfs_asyncio: no iods after mount %p queue was drained, looping\n", nmp)); +("nfs_asyncio: no iods after mount %p queue was drained, looping\n", nmp)); goto again; } Modified: stable/7/sys/nfsclient/nfs_nfsiod.c ============================================================================== --- stable/7/sys/nfsclient/nfs_nfsiod.c Mon Nov 8 15:14:14 2010 (r214985) +++ stable/7/sys/nfsclient/nfs_nfsiod.c Mon Nov 8 15:22:20 2010 (r214986) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -92,6 +93,8 @@ unsigned int nfs_iodmax = 20; /* Minimum number of nfsiod kthreads to keep as spares */ static unsigned int nfs_iodmin = 0; +static int nfs_nfsiodnew_sync(void); + static int sysctl_iodmin(SYSCTL_HANDLER_ARGS) { @@ -115,7 +118,7 @@ sysctl_iodmin(SYSCTL_HANDLER_ARGS) * than the new minimum, create some more. */ for (i = nfs_iodmin - nfs_numasync; i > 0; i--) - nfs_nfsiodnew(); + nfs_nfsiodnew_sync(); out: mtx_unlock(&nfs_iod_mtx); return (0); @@ -148,7 +151,7 @@ sysctl_iodmax(SYSCTL_HANDLER_ARGS) */ iod = nfs_numasync - 1; for (i = 0; i < nfs_numasync - nfs_iodmax; i++) { - if (nfs_iodwant[iod]) + if (nfs_iodwant[iod] == NFSIOD_AVAILABLE) wakeup(&nfs_iodwant[iod]); iod--; } @@ -159,37 +162,55 @@ out: SYSCTL_PROC(_vfs_nfs, OID_AUTO, iodmax, CTLTYPE_UINT | CTLFLAG_RW, 0, sizeof (nfs_iodmax), sysctl_iodmax, "IU", ""); -int -nfs_nfsiodnew(void) +static int +nfs_nfsiodnew_sync(void) { int error, i; - int newiod; - if (nfs_numasync >= nfs_iodmax) - return (-1); - newiod = -1; - for (i = 0; i < nfs_iodmax; i++) + mtx_assert(&nfs_iod_mtx, MA_OWNED); + for (i = 0; i < nfs_iodmax; i++) { if (nfs_asyncdaemon[i] == 0) { - nfs_asyncdaemon[i]++; - newiod = i; + nfs_asyncdaemon[i] = 1; break; } - if (newiod == -1) - return (-1); + } + if (i == nfs_iodmax) + return (0); mtx_unlock(&nfs_iod_mtx); - error = kthread_create(nfssvc_iod, nfs_asyncdaemon + i, NULL, RFHIGHPID, - 0, "nfsiod %d", newiod); + error = kthread_create(nfssvc_iod, nfs_asyncdaemon + i, NULL, + RFHIGHPID, 0, "nfsiod %d", i); + mtx_lock(&nfs_iod_mtx); + if (error == 0) { + nfs_numasync++; + nfs_iodwant[i] = NFSIOD_AVAILABLE; + } else + nfs_asyncdaemon[i] = 0; + return (error); +} + +void +nfs_nfsiodnew_tq(__unused void *arg, int pending) +{ + mtx_lock(&nfs_iod_mtx); - if (error) - return (-1); - nfs_numasync++; - return (newiod); + while (pending > 0) { + pending--; + nfs_nfsiodnew_sync(); + } + mtx_unlock(&nfs_iod_mtx); +} + +void +nfs_nfsiodnew(void) +{ + + mtx_assert(&nfs_iod_mtx, MA_OWNED); + taskqueue_enqueue(taskqueue_thread, &nfs_nfsiodnew_task); } static void nfsiod_setup(void *dummy) { - int i; int error; TUNABLE_INT_FETCH("vfs.nfs.iodmin", &nfs_iodmin); @@ -198,8 +219,8 @@ nfsiod_setup(void *dummy) if (nfs_iodmin > NFS_MAXASYNCDAEMON) nfs_iodmin = NFS_MAXASYNCDAEMON; - for (i = 0; i < nfs_iodmin; i++) { - error = nfs_nfsiodnew(); + while (nfs_numasync < nfs_iodmin) { + error = nfs_nfsiodnew_sync(); if (error == -1) panic("nfsiod_setup: nfs_nfsiodnew failed"); } @@ -235,7 +256,8 @@ nfssvc_iod(void *instance) goto finish; if (nmp) nmp->nm_bufqiods--; - nfs_iodwant[myiod] = curthread->td_proc; + if (nfs_iodwant[myiod] == NFSIOD_NOT_AVAILABLE) + nfs_iodwant[myiod] = NFSIOD_AVAILABLE; nfs_iodmount[myiod] = NULL; /* * Always keep at least nfs_iodmin kthreads. @@ -302,7 +324,7 @@ finish: nfs_asyncdaemon[myiod] = 0; if (nmp) nmp->nm_bufqiods--; - nfs_iodwant[myiod] = NULL; + nfs_iodwant[myiod] = NFSIOD_NOT_AVAILABLE; nfs_iodmount[myiod] = NULL; /* Someone may be waiting for the last nfsiod to terminate. */ if (--nfs_numasync == 0) Modified: stable/7/sys/nfsclient/nfs_subs.c ============================================================================== --- stable/7/sys/nfsclient/nfs_subs.c Mon Nov 8 15:14:14 2010 (r214985) +++ stable/7/sys/nfsclient/nfs_subs.c Mon Nov 8 15:22:20 2010 (r214986) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -103,6 +104,7 @@ struct nfs_reqq nfs_reqq; struct mtx nfs_reqq_mtx; struct nfs_bufq nfs_bufq; static struct mtx nfs_xid_mtx; +struct task nfs_nfsiodnew_task; /* * and the reverse mapping from generic to Version 2 procedure numbers @@ -422,7 +424,7 @@ nfs_init(struct vfsconf *vfsp) nfs_ticks = 1; /* Ensure async daemons disabled */ for (i = 0; i < NFS_MAXASYNCDAEMON; i++) { - nfs_iodwant[i] = NULL; + nfs_iodwant[i] = NFSIOD_NOT_AVAILABLE; nfs_iodmount[i] = NULL; } nfs_nhinit(); /* Init the nfsnode table */ @@ -435,6 +437,7 @@ nfs_init(struct vfsconf *vfsp) mtx_init(&nfs_reqq_mtx, "NFS reqq lock", NULL, MTX_DEF); mtx_init(&nfs_iod_mtx, "NFS iod lock", NULL, MTX_DEF); mtx_init(&nfs_xid_mtx, "NFS xid lock", NULL, MTX_DEF); + TASK_INIT(&nfs_nfsiodnew_task, 0, nfs_nfsiodnew_tq, NULL); nfs_pbuf_freecnt = nswbuf / 2 + 1; @@ -454,11 +457,15 @@ nfs_uninit(struct vfsconf *vfsp) /* * Tell all nfsiod processes to exit. Clear nfs_iodmax, and wakeup * any sleeping nfsiods so they check nfs_iodmax and exit. + * Drain nfsiodnew task before we wait for them to finish. */ mtx_lock(&nfs_iod_mtx); nfs_iodmax = 0; + mtx_unlock(&nfs_iod_mtx); + taskqueue_drain(taskqueue_thread, &nfs_nfsiodnew_task); + mtx_lock(&nfs_iod_mtx); for (i = 0; i < nfs_numasync; i++) - if (nfs_iodwant[i]) + if (nfs_iodwant[i] == NFSIOD_AVAILABLE) wakeup(&nfs_iodwant[i]); /* The last nfsiod to exit will wake us up when nfs_numasync hits 0 */ while (nfs_numasync) Modified: stable/7/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/7/sys/nfsclient/nfs_vnops.c Mon Nov 8 15:14:14 2010 (r214985) +++ stable/7/sys/nfsclient/nfs_vnops.c Mon Nov 8 15:22:20 2010 (r214986) @@ -195,7 +195,7 @@ static int nfs_renameit(struct vnode *sd * Global variables */ struct mtx nfs_iod_mtx; -struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON]; +enum nfsiod_state nfs_iodwant[NFS_MAXASYNCDAEMON]; struct nfsmount *nfs_iodmount[NFS_MAXASYNCDAEMON]; int nfs_numasync = 0; vop_advlock_t *nfs_advlock_p = nfs_dolock; Modified: stable/7/sys/nfsclient/nfsnode.h ============================================================================== --- stable/7/sys/nfsclient/nfsnode.h Mon Nov 8 15:14:14 2010 (r214985) +++ stable/7/sys/nfsclient/nfsnode.h Mon Nov 8 15:22:20 2010 (r214986) @@ -173,10 +173,20 @@ struct nfsnode { #define NFS_TIMESPEC_COMPARE(T1, T2) (((T1)->tv_sec != (T2)->tv_sec) || ((T1)->tv_nsec != (T2)->tv_nsec)) /* + * NFS iod threads can be in one of these two states once spawned. + * NFSIOD_NOT_AVAILABLE - Cannot be assigned an I/O operation at this time. + * NFSIOD_AVAILABLE - Available to be assigned an I/O operation. + */ +enum nfsiod_state { + NFSIOD_NOT_AVAILABLE = 0, + NFSIOD_AVAILABLE = 1, +}; + +/* * Queue head for nfsiod's */ extern TAILQ_HEAD(nfs_bufq, buf) nfs_bufq; -extern struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON]; +extern enum nfsiod_state nfs_iodwant[NFS_MAXASYNCDAEMON]; extern struct nfsmount *nfs_iodmount[NFS_MAXASYNCDAEMON]; #if defined(_KERNEL) From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 15:25:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD6EE106566B; Mon, 8 Nov 2010 15:25:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B01378FC1D; Mon, 8 Nov 2010 15:25:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8FPC4X037777; Mon, 8 Nov 2010 15:25:12 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8FPCqe037775; Mon, 8 Nov 2010 15:25:12 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011081525.oA8FPCqe037775@svn.freebsd.org> From: Alexander Motin Date: Mon, 8 Nov 2010 15:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214987 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 15:25:12 -0000 Author: mav Date: Mon Nov 8 15:25:12 2010 New Revision: 214987 URL: http://svn.freebsd.org/changeset/base/214987 Log: On APs startup skip hard-/statclock events, which time passed before CPU was lauched. Few seconds event burst, accumulated during long startup, reported to cause panic in SCHED_ULE priority calculation logic. Modified: head/sys/kern/kern_clocksource.c Modified: head/sys/kern/kern_clocksource.c ============================================================================== --- head/sys/kern/kern_clocksource.c Mon Nov 8 15:22:20 2010 (r214986) +++ head/sys/kern/kern_clocksource.c Mon Nov 8 15:25:12 2010 (r214987) @@ -208,12 +208,13 @@ handleevents(struct bintime *now, int fa bintime_add(&state->nexthard, &hardperiod); runs++; } - if (runs) { + if (runs && fake < 2) { hardclock_anycpu(runs, usermode); done = 1; } while (bintime_cmp(now, &state->nextstat, >=)) { - statclock(usermode); + if (fake < 2) + statclock(usermode); bintime_add(&state->nextstat, &statperiod); done = 1; } @@ -227,6 +228,10 @@ handleevents(struct bintime *now, int fa } else state->nextprof = state->nextstat; getnextcpuevent(&t, 0); + if (fake == 2) { + state->nextevent = t; + return (done); + } ET_HW_LOCK(state); if (!busy) { state->idle = 0; @@ -383,6 +388,11 @@ loadtimer(struct bintime *now, int start uint64_t tmp; int eq; + if (timer->et_flags & ET_FLAGS_PERCPU) { + state = DPCPU_PTR(timerstate); + next = &state->nexttick; + } else + next = &nexttick; if (periodic) { if (start) { /* @@ -391,20 +401,18 @@ loadtimer(struct bintime *now, int start */ tmp = ((uint64_t)now->sec << 36) + (now->frac >> 28); tmp = (tmp % (timerperiod.frac >> 28)) << 28; - tmp = timerperiod.frac - tmp; - new = timerperiod; - bintime_addx(&new, tmp); + new.sec = 0; + new.frac = timerperiod.frac - tmp; + if (new.frac < tmp) /* Left less then passed. */ + bintime_add(&new, &timerperiod); CTR5(KTR_SPARE2, "load p at %d: now %d.%08x first in %d.%08x", curcpu, now->sec, (unsigned int)(now->frac >> 32), new.sec, (unsigned int)(new.frac >> 32)); + *next = new; + bintime_add(next, now); et_start(timer, &new, &timerperiod); } } else { - if (timer->et_flags & ET_FLAGS_PERCPU) { - state = DPCPU_PTR(timerstate); - next = &state->nexttick; - } else - next = &nexttick; getnextevent(&new); eq = bintime_cmp(&new, next, ==); CTR5(KTR_SPARE2, "load at %d: next %d.%08x%08x eq %d", @@ -669,13 +677,19 @@ cpu_initclocks_ap(void) struct bintime now; struct pcpu_state *state; - if (timer->et_flags & ET_FLAGS_PERCPU) { - state = DPCPU_PTR(timerstate); - binuptime(&now); - ET_HW_LOCK(state); + state = DPCPU_PTR(timerstate); + binuptime(&now); + ET_HW_LOCK(state); + if ((timer->et_flags & ET_FLAGS_PERCPU) == 0 && periodic) { + state->now = nexttick; + bintime_sub(&state->now, &timerperiod); + } else + state->now = now; + hardclock_sync(curcpu); + handleevents(&state->now, 2); + if (timer->et_flags & ET_FLAGS_PERCPU) loadtimer(&now, 1); - ET_HW_UNLOCK(state); - } + ET_HW_UNLOCK(state); } /* From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 15:36:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF9F8106564A; Mon, 8 Nov 2010 15:36:15 +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 AD06C8FC0A; Mon, 8 Nov 2010 15: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 oA8FaFKW038226; Mon, 8 Nov 2010 15:36:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8FaF7j038222; Mon, 8 Nov 2010 15:36:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011081536.oA8FaF7j038222@svn.freebsd.org> From: Alexander Motin Date: Mon, 8 Nov 2010 15:36:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214988 - in head/sys/dev: ahci ata siis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 15:36:15 -0000 Author: mav Date: Mon Nov 8 15:36:15 2010 New Revision: 214988 URL: http://svn.freebsd.org/changeset/base/214988 Log: Teach ahci(4), siis(4) and ATA_CAM ata(4) wrapper report to CAM residual I/O length on underruns, that often happens for some SCSI commands. Modified: head/sys/dev/ahci/ahci.c head/sys/dev/ata/ata-all.c head/sys/dev/siis/siis.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Mon Nov 8 15:25:12 2010 (r214987) +++ head/sys/dev/ahci/ahci.c Mon Nov 8 15:36:15 2010 (r214988) @@ -1625,12 +1625,13 @@ ahci_execute_transaction(struct ahci_slo /* Setup the command list entry */ clp = (struct ahci_cmd_list *) (ch->dma.work + AHCI_CL_OFFSET + (AHCI_CL_SIZE * slot->slot)); - clp->prd_length = slot->dma.nsegs; - clp->cmd_flags = (ccb->ccb_h.flags & CAM_DIR_OUT ? AHCI_CMD_WRITE : 0) | - (ccb->ccb_h.func_code == XPT_SCSI_IO ? - (AHCI_CMD_ATAPI | AHCI_CMD_PREFETCH) : 0) | - (fis_size / sizeof(u_int32_t)) | - (port << 12); + clp->cmd_flags = htole16( + (ccb->ccb_h.flags & CAM_DIR_OUT ? AHCI_CMD_WRITE : 0) | + (ccb->ccb_h.func_code == XPT_SCSI_IO ? + (AHCI_CMD_ATAPI | AHCI_CMD_PREFETCH) : 0) | + (fis_size / sizeof(u_int32_t)) | + (port << 12)); + clp->prd_length = htole16(slot->dma.nsegs); /* Special handling for Soft Reset command. */ if ((ccb->ccb_h.func_code == XPT_ATA_IO) && (ccb->ataio.cmd.flags & CAM_ATAIO_CONTROL)) { @@ -1650,7 +1651,7 @@ ahci_execute_transaction(struct ahci_slo clp->cmd_table_phys = htole64(ch->dma.work_bus + AHCI_CT_OFFSET + (AHCI_CT_SIZE * slot->slot)); bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); bus_dmamap_sync(ch->dma.rfis_tag, ch->dma.rfis_map, BUS_DMASYNC_PREREAD); /* Set ACTIVE bit for NCQ commands. */ @@ -1855,10 +1856,13 @@ ahci_end_transaction(struct ahci_slot *s device_t dev = slot->dev; struct ahci_channel *ch = device_get_softc(dev); union ccb *ccb = slot->ccb; + struct ahci_cmd_list *clp; int lastto; bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, - BUS_DMASYNC_POSTWRITE); + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + clp = (struct ahci_cmd_list *) + (ch->dma.work + AHCI_CL_OFFSET + (AHCI_CL_SIZE * slot->slot)); /* Read result registers to the result struct * May be incorrect if several commands finished same time, * so read only when sure or have to. @@ -1893,6 +1897,16 @@ ahci_end_transaction(struct ahci_slot *s res->sector_count_exp = fis[13]; } else bzero(res, sizeof(*res)); + if ((ccb->ataio.cmd.flags & CAM_ATAIO_FPDMA) == 0 && + (ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { + ccb->ataio.resid = + ccb->ataio.dxfer_len - le32toh(clp->bytecount); + } + } else { + if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { + ccb->csio.resid = + ccb->csio.dxfer_len - le32toh(clp->bytecount); + } } if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { bus_dmamap_sync(ch->dma.data_tag, slot->dma.data_map, Modified: head/sys/dev/ata/ata-all.c ============================================================================== --- head/sys/dev/ata/ata-all.c Mon Nov 8 15:25:12 2010 (r214987) +++ head/sys/dev/ata/ata-all.c Mon Nov 8 15:36:15 2010 (r214988) @@ -1517,6 +1517,15 @@ ata_cam_end_transaction(device_t dev, st res->sector_count = request->u.ata.count; res->sector_count_exp = request->u.ata.count >> 8; } + if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { + if (ccb->ccb_h.func_code == XPT_ATA_IO) { + ccb->ataio.resid = + ccb->ataio.dxfer_len - request->donecount; + } else { + ccb->csio.resid = + ccb->csio.dxfer_len - request->donecount; + } + } ata_free_request(request); xpt_done(ccb); /* Do error recovery if needed. */ Modified: head/sys/dev/siis/siis.c ============================================================================== --- head/sys/dev/siis/siis.c Mon Nov 8 15:25:12 2010 (r214987) +++ head/sys/dev/siis/siis.c Mon Nov 8 15:36:15 2010 (r214988) @@ -1208,6 +1208,17 @@ siis_end_transaction(struct siis_slot *s res->sector_count_exp = ATA_INB(ch->r_mem, offs + 13); } else bzero(res, sizeof(*res)); + if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN && + ch->numrslots == 1) { + ccb->ataio.resid = ccb->ataio.dxfer_len - + ATA_INL(ch->r_mem, SIIS_P_LRAM_SLOT(slot->slot) + 4); + } + } else { + if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN && + ch->numrslots == 1) { + ccb->csio.resid = ccb->csio.dxfer_len - + ATA_INL(ch->r_mem, SIIS_P_LRAM_SLOT(slot->slot) + 4); + } } if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { bus_dmamap_sync(ch->dma.data_tag, slot->dma.data_map, From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 15:37:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63E96106566C; Mon, 8 Nov 2010 15:37:15 +0000 (UTC) (envelope-from rpaulo@freebsd.org) Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by mx1.freebsd.org (Postfix) with ESMTP id 308908FC1D; Mon, 8 Nov 2010 15:37:14 +0000 (UTC) Received: from e.earth.lavabit.com (e.earth.lavabit.com [192.168.111.14]) by karen.lavabit.com (Postfix) with ESMTP id 816C511B850; Mon, 8 Nov 2010 09:37:14 -0600 (CST) Received: from 192.168.1.70 (bl17-210-129.dsl.telepac.pt [188.82.210.129]) by lavabit.com with ESMTP id YNFCF895O5B0; Mon, 08 Nov 2010 09:37:14 -0600 References: <201011081331.oA8DViNq033723@svn.freebsd.org> In-Reply-To: Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii Message-Id: Content-Transfer-Encoding: quoted-printable From: Rui Paulo Date: Mon, 8 Nov 2010 15:37:10 +0000 To: Hajimu UMEMOTO X-Mailer: Apple Mail (2.1081) Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org Subject: Re: svn commit: r214984 - stable/8/lib/libproc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 15:37:15 -0000 On Nov 8, 2010, at 3:19 PM, Hajimu UMEMOTO wrote: > Hi, >=20 >>>>>> On Mon, 8 Nov 2010 15:06:12 +0000 >>>>>> Rui Paulo said: >=20 > rpaulo> It's on my plans, but basename_r is not POSIX and there was a = private discussion about it a couple of weeks ago. The conclusion is = that we should adopt the Android semantics of basename_r(). >=20 > I found the thread, and understood it. However, I still wonderling if > breaking thread-safeness in proc_sym.c is okay, though it may not be > necessary. We can live with it for now while I work on a new basename_r(). Regards, -- Rui Paulo From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 15:59:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D709E1065672; Mon, 8 Nov 2010 15:59:41 +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 C55B28FC16; Mon, 8 Nov 2010 15:59: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 oA8FxfYb039175; Mon, 8 Nov 2010 15:59:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8FxfQs039172; Mon, 8 Nov 2010 15:59:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011081559.oA8FxfQs039172@svn.freebsd.org> From: Alexander Motin Date: Mon, 8 Nov 2010 15:59:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214989 - head/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 15:59:41 -0000 Author: mav Date: Mon Nov 8 15:59:41 2010 New Revision: 214989 URL: http://svn.freebsd.org/changeset/base/214989 Log: When requesting sense data for SIM not doing it automatically (such as ATAPI or USB), request only as much data as requested by consumer. On the way back -- report how much sense data we have actually received. Modified: head/sys/cam/cam_periph.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Mon Nov 8 15:36:15 2010 (r214988) +++ head/sys/cam/cam_periph.c Mon Nov 8 15:59:41 2010 (r214989) @@ -1055,6 +1055,7 @@ camperiphsensedone(struct cam_periph *pe saved_ccb->ccb_h.status |= CAM_AUTOSENSE_FAIL; } + saved_ccb->csio.sense_resid = done_ccb->csio.resid; bcopy(saved_ccb, done_ccb, sizeof(union ccb)); xpt_free_ccb(saved_ccb); break; @@ -1211,7 +1212,7 @@ camperiphdone(struct cam_periph *periph, scsi_request_sense(&done_ccb->csio, /*retries*/1, camperiphsensedone, &save_ccb->csio.sense_data, - sizeof(save_ccb->csio.sense_data), + save_ccb->csio.sense_len, CAM_TAG_ACTION_NONE, /*sense_len*/SSD_FULL_SIZE, /*timeout*/5000); @@ -1602,7 +1603,7 @@ camperiphscsisenseerror(union ccb *ccb, scsi_request_sense(&ccb->csio, /*retries*/1, camperiphsensedone, &orig_ccb->csio.sense_data, - sizeof(orig_ccb->csio.sense_data), + orig_ccb->csio.sense_len, CAM_TAG_ACTION_NONE, /*sense_len*/SSD_FULL_SIZE, /*timeout*/5000); From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 16:10:44 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE2E31065675; Mon, 8 Nov 2010 16:10:44 +0000 (UTC) (envelope-from ume@mahoroba.org) Received: from mail.mahoroba.org (ent.mahoroba.org [IPv6:2001:2f0:104:8010::1]) by mx1.freebsd.org (Postfix) with ESMTP id 3976F8FC24; Mon, 8 Nov 2010 16:10:44 +0000 (UTC) Received: from yuga.mahoroba.org (ume@yuga.mahoroba.org [IPv6:2001:2f0:104:8010:21b:d3ff:fe38:5381]) (user=ume mech=DIGEST-MD5 bits=0) by mail.mahoroba.org (8.14.4/8.14.4) with ESMTP/inet6 id oA8GAcsu003396 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 9 Nov 2010 01:10:38 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Tue, 09 Nov 2010 01:10:37 +0900 Message-ID: From: Hajimu UMEMOTO To: Rui Paulo In-Reply-To: References: <201011081331.oA8DViNq033723@svn.freebsd.org> User-Agent: xcite1.60> Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.8 Emacs/23.2 (i386-portbld-freebsd8.1) MULE/6.0 (HANACHIRUSATO) X-Operating-System: FreeBSD 8.1-STABLE X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (mail.mahoroba.org [IPv6:2001:2f0:104:8010::1]); Tue, 09 Nov 2010 01:10:38 +0900 (JST) X-Virus-Scanned: clamav-milter 0.96.4 at asuka.mahoroba.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on asuka.mahoroba.org Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org Subject: Re: svn commit: r214984 - stable/8/lib/libproc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 16:10:45 -0000 Hi, >>>>> On Mon, 8 Nov 2010 15:37:10 +0000 >>>>> Rui Paulo said: rpaulo> We can live with it for now while I work on a new basename_r(). Okay, thanks. Sincerely, -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/ From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 19:00:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A8F6106564A; Mon, 8 Nov 2010 19:00:22 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7877A8FC16; Mon, 8 Nov 2010 19:00:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8J0MOY046769; Mon, 8 Nov 2010 19:00:22 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8J0MRe046767; Mon, 8 Nov 2010 19:00:22 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201011081900.oA8J0MRe046767@svn.freebsd.org> From: "David E. O'Brien" Date: Mon, 8 Nov 2010 19:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214990 - head/usr.bin/yacc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 19:00:22 -0000 Author: obrien Date: Mon Nov 8 19:00:22 2010 New Revision: 214990 URL: http://svn.freebsd.org/changeset/base/214990 Log: Back out r214961 for skeleton.c -- it broke the groff build. Modified: head/usr.bin/yacc/skeleton.c Modified: head/usr.bin/yacc/skeleton.c ============================================================================== --- head/usr.bin/yacc/skeleton.c Mon Nov 8 15:59:41 2010 (r214989) +++ head/usr.bin/yacc/skeleton.c Mon Nov 8 19:00:22 2010 (r214990) @@ -157,14 +157,14 @@ const char *body[] = " else if ((newsize *= 2) > YYMAXDEPTH)", " newsize = YYMAXDEPTH;", " i = yyssp - yyss;", - " newss = yyss ? realloc(yyss, newsize * sizeof *newss) :", - " malloc(newsize * sizeof *newss);", + " newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :", + " (short *)malloc(newsize * sizeof *newss);", " if (newss == NULL)", " return -1;", " yyss = newss;", " yyssp = newss + i;", - " newvs = yyvs ? realloc(yyvs, newsize * sizeof *newvs) :", - " malloc(newsize * sizeof *newvs);", + " newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :", + " (YYSTYPE *)malloc(newsize * sizeof *newvs);", " if (newvs == NULL)", " return -1;", " yyvs = newvs;", From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 19:12:20 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49A99106566B; Mon, 8 Nov 2010 19:12:20 +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 35E3A8FC12; Mon, 8 Nov 2010 19:12:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8JCKlQ047409; Mon, 8 Nov 2010 19:12:20 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8JCKIt047407; Mon, 8 Nov 2010 19:12:20 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201011081912.oA8JCKIt047407@svn.freebsd.org> From: Alexander Motin Date: Mon, 8 Nov 2010 19:12:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214991 - stable/8/sbin/camcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 19:12:20 -0000 Author: mav Date: Mon Nov 8 19:12:19 2010 New Revision: 214991 URL: http://svn.freebsd.org/changeset/base/214991 Log: MFC r214321: Do some whitespace and `identify` output cleanup. Modified: stable/8/sbin/camcontrol/camcontrol.c Directory Properties: stable/8/sbin/camcontrol/ (props changed) Modified: stable/8/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.c Mon Nov 8 19:00:22 2010 (r214990) +++ stable/8/sbin/camcontrol/camcontrol.c Mon Nov 8 19:12:19 2010 (r214991) @@ -116,7 +116,7 @@ typedef enum { } cam_argmask; struct camcontrol_opts { - const char *optname; + const char *optname; cam_cmdmask cmdnum; cam_argmask argnum; const char *subopt; @@ -204,7 +204,7 @@ static int readdefects(struct cam_device char *combinedopt, int retry_count, int timeout); static void modepage(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout); -static int scsicmd(struct cam_device *device, int argc, char **argv, +static int scsicmd(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout); static int tagcontrol(struct cam_device *device, int argc, char **argv, char *combinedopt); @@ -234,7 +234,7 @@ static int atapm(struct cam_device *devi #endif camcontrol_optret -getoption(char *arg, cam_cmdmask *cmdnum, cam_argmask *argnum, +getoption(char *arg, cam_cmdmask *cmdnum, cam_argmask *argnum, const char **subopt) { struct camcontrol_opts *opts; @@ -622,7 +622,7 @@ scsistart(struct cam_device *device, int else fprintf(stdout, "Error received from stop unit command\n"); - + if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); @@ -688,7 +688,7 @@ scsiinquiry(struct cam_device *device, i union ccb *ccb; struct scsi_inquiry_data *inq_buf; int error = 0; - + ccb = cam_getccb(device); if (ccb == NULL) { @@ -721,13 +721,13 @@ scsiinquiry(struct cam_device *device, i * scsi_inquiry() will convert an inq_len (which is passed in as * a u_int32_t, but the field in the CDB is only 1 byte) of 256 * to 0. Evidently, very few devices meet the spec in that - * regard. Some devices, like many Seagate disks, take the 0 as + * regard. Some devices, like many Seagate disks, take the 0 as * 0, and don't return any data. One Pioneer DVD-R drive * returns more data than the command asked for. * * So, since there are numerous devices that just don't work * right with the full inquiry size, we don't send the full size. - * + * * - The second reason not to use the full inquiry data length is * that we don't need it here. The only reason we issue a * standard inquiry is to get the vendor name, device name, @@ -1181,7 +1181,7 @@ atacapprint(struct ata_params *parm) } printf("\nFeature " - "Support Enable Value Vendor\n"); + "Support Enabled Value Vendor\n"); printf("read ahead %s %s\n", parm->support.command1 & ATA_SUPPORT_LOOKAHEAD ? "yes" : "no", parm->enabled.command1 & ATA_SUPPORT_LOOKAHEAD ? "yes" : "no"); @@ -1201,16 +1201,13 @@ atacapprint(struct ata_params *parm) ATA_QUEUE_LEN(parm->queue) + 1); } else printf("\n"); - if (parm->satacapabilities && parm->satacapabilities != 0xffff) { - printf("Native Command Queuing (NCQ) %s ", - parm->satacapabilities & ATA_SUPPORT_NCQ ? - "yes" : "no"); - if (parm->satacapabilities & ATA_SUPPORT_NCQ) { - printf(" %d tags\n", - ATA_QUEUE_LEN(parm->queue) + 1); - } else - printf("\n"); - } + printf("Native Command Queuing (NCQ) "); + if (parm->satacapabilities != 0xffff && + (parm->satacapabilities & ATA_SUPPORT_NCQ)) { + printf("yes %d tags\n", + ATA_QUEUE_LEN(parm->queue) + 1); + } else + printf("no\n"); printf("SMART %s %s\n", parm->support.command1 & ATA_SUPPORT_SMART ? "yes" : "no", parm->enabled.command1 & ATA_SUPPORT_SMART ? "yes" : "no"); @@ -1223,28 +1220,39 @@ atacapprint(struct ata_params *parm) printf("power management %s %s\n", parm->support.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no", parm->enabled.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no"); - printf("advanced power management %s %s %d/0x%02X\n", + printf("advanced power management %s %s", parm->support.command2 & ATA_SUPPORT_APM ? "yes" : "no", - parm->enabled.command2 & ATA_SUPPORT_APM ? "yes" : "no", - parm->apm_value, parm->apm_value); - printf("automatic acoustic management %s %s " - "%d/0x%02X %d/0x%02X\n", + parm->enabled.command2 & ATA_SUPPORT_APM ? "yes" : "no"); + if (parm->support.command2 & ATA_SUPPORT_APM) { + printf(" %d/0x%02X\n", + parm->apm_value, parm->apm_value); + } else + printf("\n"); + printf("automatic acoustic management %s %s", parm->support.command2 & ATA_SUPPORT_AUTOACOUSTIC ? "yes" :"no", - parm->enabled.command2 & ATA_SUPPORT_AUTOACOUSTIC ? "yes" :"no", - ATA_ACOUSTIC_CURRENT(parm->acoustic), - ATA_ACOUSTIC_CURRENT(parm->acoustic), - ATA_ACOUSTIC_VENDOR(parm->acoustic), - ATA_ACOUSTIC_VENDOR(parm->acoustic)); + parm->enabled.command2 & ATA_SUPPORT_AUTOACOUSTIC ? "yes" :"no"); + if (parm->support.command2 & ATA_SUPPORT_AUTOACOUSTIC) { + printf(" %d/0x%02X %d/0x%02X\n", + ATA_ACOUSTIC_CURRENT(parm->acoustic), + ATA_ACOUSTIC_CURRENT(parm->acoustic), + ATA_ACOUSTIC_VENDOR(parm->acoustic), + ATA_ACOUSTIC_VENDOR(parm->acoustic)); + } else + printf("\n"); printf("media status notification %s %s\n", parm->support.command2 & ATA_SUPPORT_NOTIFY ? "yes" : "no", parm->enabled.command2 & ATA_SUPPORT_NOTIFY ? "yes" : "no"); printf("power-up in Standby %s %s\n", parm->support.command2 & ATA_SUPPORT_STANDBY ? "yes" : "no", parm->enabled.command2 & ATA_SUPPORT_STANDBY ? "yes" : "no"); - printf("write-read-verify %s %s %d/0x%x\n", + printf("write-read-verify %s %s", parm->support2 & ATA_SUPPORT_WRITEREADVERIFY ? "yes" : "no", - parm->enabled2 & ATA_SUPPORT_WRITEREADVERIFY ? "yes" : "no", - parm->wrv_mode, parm->wrv_mode); + parm->enabled2 & ATA_SUPPORT_WRITEREADVERIFY ? "yes" : "no"); + if (parm->support2 & ATA_SUPPORT_WRITEREADVERIFY) { + printf(" %d/0x%x\n", + parm->wrv_mode, parm->wrv_mode); + } else + printf("\n"); printf("unload %s %s\n", parm->support.extension & ATA_SUPPORT_UNLOAD ? "yes" : "no", parm->enabled.extension & ATA_SUPPORT_UNLOAD ? "yes" : "no"); @@ -1255,7 +1263,6 @@ atacapprint(struct ata_params *parm) parm->support_dsm & ATA_SUPPORT_DSM_TRIM ? "yes" : "no"); } - static int ataidentify(struct cam_device *device, int retry_count, int timeout) { @@ -1902,7 +1909,7 @@ readdefects(struct cam_device *device, i /* * XXX KDM I should probably clean up the printout format for the - * disk defects. + * disk defects. */ switch (returned_format & SRDDH10_DLIST_FORMAT_MASK){ case SRDDH10_PHYSICAL_SECTOR_FORMAT: @@ -2011,7 +2018,7 @@ void reassignblocks(struct cam_device *device, u_int32_t *blocks, int num_blocks) { union ccb *ccb; - + ccb = cam_getccb(device); cam_freeccb(ccb); @@ -2114,7 +2121,7 @@ mode_select(struct cam_device *device, i err(1, "error sending mode select command"); else errx(1, "error sending mode select command"); - + } cam_freeccb(ccb); @@ -2294,7 +2301,7 @@ scsicmd(struct cam_device *device, int a if (arglist & CAM_ARG_CMD_IN) { warnx("command must either be " "read or write, not both"); - error = 1; + error = 1; goto scsicmd_bailout; } arglist |= CAM_ARG_CMD_OUT; @@ -2611,7 +2618,7 @@ camdebug(int argc, char **argv, char *co warnx("bus:target, or bus:target:lun to debug"); } } - + if (error == 0) { ccb.ccb_h.func_code = XPT_DEBUG; @@ -2874,7 +2881,7 @@ cts_print(struct cam_device *device, str } /* - * Get a path inquiry CCB for the specified device. + * Get a path inquiry CCB for the specified device. */ static int get_cpi(struct cam_device *device, struct ccb_pathinq *cpi) @@ -2913,7 +2920,7 @@ get_cpi_bailout: } /* - * Get a get device CCB for the specified device. + * Get a get device CCB for the specified device. */ static int get_cgd(struct cam_device *device, struct ccb_getdev *cgd) @@ -3754,9 +3761,9 @@ doreport: fprintf(stdout, "\rFormatting: %ju.%02u %% " "(%d/%d) done", - (uintmax_t)(percentage / + (uintmax_t)(percentage / (0x10000 * 100)), - (unsigned)((percentage / + (unsigned)((percentage / 0x10000) % 100), val, 0x10000); fflush(stdout); @@ -3946,7 +3953,7 @@ retry: case RPL_LUNDATA_ATYP_PERIPH: if ((lundata->luns[i].lundata[j] & RPL_LUNDATA_PERIPH_BUS_MASK) != 0) - fprintf(stdout, "%d:", + fprintf(stdout, "%d:", lundata->luns[i].lundata[j] & RPL_LUNDATA_PERIPH_BUS_MASK); else if ((j == 0) @@ -3984,7 +3991,7 @@ retry: field_len_code = (lundata->luns[i].lundata[j] & RPL_LUNDATA_EXT_LEN_MASK) >> 4; field_len = field_len_code * 2; - + if ((eam_code == RPL_LUNDATA_EXT_EAM_WK) && (field_len_code == 0x00)) { fprintf(stdout, "%d", @@ -4342,7 +4349,7 @@ bailout: #endif /* MINIMALISTIC */ -void +void usage(int verbose) { fprintf(verbose ? stdout : stderr, @@ -4484,7 +4491,7 @@ usage(int verbose) #endif /* MINIMALISTIC */ } -int +int main(int argc, char **argv) { int c; @@ -4534,7 +4541,7 @@ main(int argc, char **argv) * this. getopt is kinda braindead, so you end up having to run * through the options twice, and give each invocation of getopt * the option string for the other invocation. - * + * * You would think that you could just have two groups of options. * The first group would get parsed by the first invocation of * getopt, and the second group would get parsed by the second @@ -4543,13 +4550,13 @@ main(int argc, char **argv) * to the argument _after_ the first argument in the second group. * So when the second invocation of getopt comes around, it doesn't * recognize the first argument it gets and then bails out. - * + * * A nice alternative would be to have a flag for getopt that says * "just keep parsing arguments even when you encounter an unknown * argument", but there isn't one. So there's no real clean way to * easily parse two sets of arguments without having one invocation * of getopt know about the other. - * + * * Without this hack, the first invocation of getopt would work as * long as the generic arguments are first, but the second invocation * (in the subfunction) would fail in one of two ways. In the case @@ -4563,14 +4570,14 @@ main(int argc, char **argv) * whether optind had been incremented one option too far. The * mechanics of that, however, are more daunting than just giving * both invocations all of the expect options for either invocation. - * + * * Needless to say, I wouldn't mind if someone invented a better * (non-GPL!) command line parsing interface than getopt. I * wouldn't mind if someone added more knobs to getopt to make it * work better. Who knows, I may talk myself into doing it someday, * if the standards weenies let me. As it is, it just leads to * hackery like this and causes people to avoid it in some cases. - * + * * KDM, September 8th, 1998 */ if (subopt != NULL) From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 19:15:32 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D045106566B; Mon, 8 Nov 2010 19:15:32 +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 20D278FC14; Mon, 8 Nov 2010 19:15:32 +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 oA8JFWaj047579; Mon, 8 Nov 2010 19:15:32 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8JFWPj047577; Mon, 8 Nov 2010 19:15:32 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011081915.oA8JFWPj047577@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Nov 2010 19:15:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214992 - head/sys/dev/re X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 19:15:32 -0000 Author: yongari Date: Mon Nov 8 19:15:31 2010 New Revision: 214992 URL: http://svn.freebsd.org/changeset/base/214992 Log: Reduce spin wait time consumed in GMII register access routine. There were a couple of attempts in the past to reduce it since it took more than 1ms. Because mii_tick() periodically polls link status, waiting more than 1ms for each GMII register access was overkill. Unfortunately all previous attempts were failed with various ways on different controllers. This time, add additional 20us dealy at the end of GMII register access which seems to requirement of all RealTek controllers to issue next GMII register access request. This is the same way what Linux does. Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Mon Nov 8 19:12:19 2010 (r214991) +++ head/sys/dev/re/if_re.c Mon Nov 8 19:15:31 2010 (r214992) @@ -423,13 +423,12 @@ re_gmii_readreg(device_t dev, int phy, i } CSR_WRITE_4(sc, RL_PHYAR, reg << 16); - DELAY(1000); for (i = 0; i < RL_PHY_TIMEOUT; i++) { rval = CSR_READ_4(sc, RL_PHYAR); if (rval & RL_PHYAR_BUSY) break; - DELAY(100); + DELAY(25); } if (i == RL_PHY_TIMEOUT) { @@ -437,6 +436,11 @@ re_gmii_readreg(device_t dev, int phy, i return (0); } + /* + * Controller requires a 20us delay to process next MDIO request. + */ + DELAY(20); + return (rval & RL_PHYAR_PHYDATA); } @@ -451,13 +455,12 @@ re_gmii_writereg(device_t dev, int phy, CSR_WRITE_4(sc, RL_PHYAR, (reg << 16) | (data & RL_PHYAR_PHYDATA) | RL_PHYAR_BUSY); - DELAY(1000); for (i = 0; i < RL_PHY_TIMEOUT; i++) { rval = CSR_READ_4(sc, RL_PHYAR); if (!(rval & RL_PHYAR_BUSY)) break; - DELAY(100); + DELAY(25); } if (i == RL_PHY_TIMEOUT) { @@ -465,6 +468,11 @@ re_gmii_writereg(device_t dev, int phy, return (0); } + /* + * Controller requires a 20us delay to process next MDIO request. + */ + DELAY(20); + return (0); } From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 19:22:37 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 726BB1065670; Mon, 8 Nov 2010 19:22:37 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45B448FC08; Mon, 8 Nov 2010 19:22: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 oA8JMbCJ047924; Mon, 8 Nov 2010 19:22:37 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8JMbiF047921; Mon, 8 Nov 2010 19:22:37 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011081922.oA8JMbiF047921@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Nov 2010 19:22:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214993 - stable/8/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 19:22:37 -0000 Author: yongari Date: Mon Nov 8 19:22:36 2010 New Revision: 214993 URL: http://svn.freebsd.org/changeset/base/214993 Log: MFC r214427: Add BCM5717C 10/100/1000TX PHY id. Modified: stable/8/sys/dev/mii/brgphy.c stable/8/sys/dev/mii/miidevs Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/mii/brgphy.c ============================================================================== --- stable/8/sys/dev/mii/brgphy.c Mon Nov 8 19:15:31 2010 (r214992) +++ stable/8/sys/dev/mii/brgphy.c Mon Nov 8 19:22:36 2010 (r214993) @@ -141,6 +141,7 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709C), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5761), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709S), + MII_PHY_DESC(xxBROADCOM_ALT2, BCM5717C), MII_PHY_DESC(BROADCOM2, BCM5906), MII_PHY_END }; @@ -253,6 +254,9 @@ brgphy_attach(device_t dev) break; } break; + case MII_OUI_xxBROADCOM_ALT2: + /* No special handling yet. */ + break; default: device_printf(dev, "Unrecognized OUI for PHY!\n"); } @@ -1011,6 +1015,7 @@ brgphy_reset(struct mii_softc *sc) } break; case MII_OUI_xxBROADCOM_ALT1: + case MII_OUI_xxBROADCOM_ALT2: break; } Modified: stable/8/sys/dev/mii/miidevs ============================================================================== --- stable/8/sys/dev/mii/miidevs Mon Nov 8 19:15:31 2010 (r214992) +++ stable/8/sys/dev/mii/miidevs Mon Nov 8 19:22:36 2010 (r214993) @@ -81,6 +81,7 @@ oui xxINTEL 0x00f800 Intel oui xxALTIMA 0x000895 Altima Communications oui xxBROADCOM 0x000818 Broadcom Corporation oui xxBROADCOM_ALT1 0x0050ef Broadcom Corporation +oui xxBROADCOM_ALT2 0x00d897 Broadcom Corporation oui xxICS 0x00057d Integrated Circuit Systems oui xxSEEQ 0x0005be Seeq oui xxSIS 0x000760 Silicon Integrated Systems @@ -153,6 +154,7 @@ model xxBROADCOM_ALT1 BCM5784 0x003a BCM model xxBROADCOM_ALT1 BCM5709C 0x003c BCM5709C 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5761 0x003d BCM5761 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5709S 0x003f BCM5709S 1000/2500baseSX PHY +model xxBROADCOM_ALT2 BCM5717C 0x0020 BCM5717C 10/100/1000baseTX PHY model BROADCOM2 BCM5906 0x0004 BCM5906 10/100baseTX PHY /* Cicada Semiconductor PHYs (now owned by Vitesse?) */ From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 19:25:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFFEC1065670; Mon, 8 Nov 2010 19:25:47 +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 B38B08FC14; Mon, 8 Nov 2010 19:25:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8JPlq2048103; Mon, 8 Nov 2010 19:25:47 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8JPluj048100; Mon, 8 Nov 2010 19:25:47 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011081925.oA8JPluj048100@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Nov 2010 19:25:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214994 - stable/7/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 19:25:48 -0000 Author: yongari Date: Mon Nov 8 19:25:47 2010 New Revision: 214994 URL: http://svn.freebsd.org/changeset/base/214994 Log: MFC r214427: Add BCM5717C 10/100/1000TX PHY id. Modified: stable/7/sys/dev/mii/brgphy.c stable/7/sys/dev/mii/miidevs 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/mii/brgphy.c ============================================================================== --- stable/7/sys/dev/mii/brgphy.c Mon Nov 8 19:22:36 2010 (r214993) +++ stable/7/sys/dev/mii/brgphy.c Mon Nov 8 19:25:47 2010 (r214994) @@ -141,6 +141,7 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709C), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5761), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709S), + MII_PHY_DESC(xxBROADCOM_ALT2, BCM5717C), MII_PHY_DESC(BROADCOM2, BCM5906), MII_PHY_END }; @@ -253,6 +254,9 @@ brgphy_attach(device_t dev) break; } break; + case MII_OUI_xxBROADCOM_ALT2: + /* No special handling yet. */ + break; default: device_printf(dev, "Unrecognized OUI for PHY!\n"); } @@ -999,6 +1003,7 @@ brgphy_reset(struct mii_softc *sc) } break; case MII_OUI_xxBROADCOM_ALT1: + case MII_OUI_xxBROADCOM_ALT2: break; } Modified: stable/7/sys/dev/mii/miidevs ============================================================================== --- stable/7/sys/dev/mii/miidevs Mon Nov 8 19:22:36 2010 (r214993) +++ stable/7/sys/dev/mii/miidevs Mon Nov 8 19:25:47 2010 (r214994) @@ -79,6 +79,7 @@ oui xxINTEL 0x00f800 Intel oui xxALTIMA 0x000895 Altima Communications oui xxBROADCOM 0x000818 Broadcom Corporation oui xxBROADCOM_ALT1 0x0050ef Broadcom Corporation +oui xxBROADCOM_ALT2 0x00d897 Broadcom Corporation oui xxICS 0x00057d Integrated Circuit Systems oui xxSEEQ 0x0005be Seeq oui xxSIS 0x000760 Silicon Integrated Systems @@ -148,6 +149,7 @@ model xxBROADCOM_ALT1 BCM5784 0x003a BCM model xxBROADCOM_ALT1 BCM5709C 0x003c BCM5709C 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5761 0x003d BCM5761 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5709S 0x003f BCM5709S 1000/2500baseSX PHY +model xxBROADCOM_ALT2 BCM5717C 0x0020 BCM5717C 10/100/1000baseTX PHY model BROADCOM2 BCM5906 0x0004 BCM5906 10/100baseTX PHY /* Cicada Semiconductor PHYs (now owned by Vitesse?) */ From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 19:31:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE7D1106566B; Mon, 8 Nov 2010 19:31: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 CBF9F8FC16; Mon, 8 Nov 2010 19:31: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 oA8JVfaD048405; Mon, 8 Nov 2010 19:31:41 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8JVfkN048403; Mon, 8 Nov 2010 19:31:41 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011081931.oA8JVfkN048403@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Nov 2010 19:31:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214995 - stable/8/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 19:31:42 -0000 Author: yongari Date: Mon Nov 8 19:31:41 2010 New Revision: 214995 URL: http://svn.freebsd.org/changeset/base/214995 Log: MFC r213486: Remove bge_tx_buf_ratio, unused member of softc. Modified: stable/8/sys/dev/bge/if_bgereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Mon Nov 8 19:25:47 2010 (r214994) +++ stable/8/sys/dev/bge/if_bgereg.h Mon Nov 8 19:31:41 2010 (r214995) @@ -2759,7 +2759,6 @@ struct bge_softc { uint32_t bge_tx_prodidx; uint32_t bge_rx_max_coal_bds; uint32_t bge_tx_max_coal_bds; - uint32_t bge_tx_buf_ratio; uint32_t bge_mi_mode; int bge_if_flags; int bge_txcnt; From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 19:33:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F24FA1065670; Mon, 8 Nov 2010 19:33:13 +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 DFC468FC16; Mon, 8 Nov 2010 19:33: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 oA8JXDDU048538; Mon, 8 Nov 2010 19:33:13 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8JXDQT048536; Mon, 8 Nov 2010 19:33:13 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011081933.oA8JXDQT048536@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Nov 2010 19:33: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: r214996 - stable/7/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 19:33:14 -0000 Author: yongari Date: Mon Nov 8 19:33:13 2010 New Revision: 214996 URL: http://svn.freebsd.org/changeset/base/214996 Log: MFC r213486: Remove bge_tx_buf_ratio, unused member of softc. Modified: stable/7/sys/dev/bge/if_bgereg.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/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Mon Nov 8 19:31:41 2010 (r214995) +++ stable/7/sys/dev/bge/if_bgereg.h Mon Nov 8 19:33:13 2010 (r214996) @@ -2759,7 +2759,6 @@ struct bge_softc { uint32_t bge_tx_prodidx; uint32_t bge_rx_max_coal_bds; uint32_t bge_tx_max_coal_bds; - uint32_t bge_tx_buf_ratio; uint32_t bge_mi_mode; int bge_if_flags; int bge_txcnt; From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 19:36:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1B461065670; Mon, 8 Nov 2010 19:36:00 +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 AE0938FC12; Mon, 8 Nov 2010 19:36:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8Ja0l6048707; Mon, 8 Nov 2010 19:36:00 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8Ja0kP048704; Mon, 8 Nov 2010 19:36:00 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011081936.oA8Ja0kP048704@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Nov 2010 19:36:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214997 - stable/8/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 19:36:00 -0000 Author: yongari Date: Mon Nov 8 19:36:00 2010 New Revision: 214997 URL: http://svn.freebsd.org/changeset/base/214997 Log: MFC r214428: Add initial BCM5718 family support. The BCM5718 family includes the dual port BCM5717 and BCM5718 devices which are intended for mainstream workstation and entry-level server designs and represents the twelfth generation of NetXtreme Ethernet controllers. This family is the successor to the BCM5714/BCM5715 family and supports IPv4/IPv6 checksum offloading, TSO, VLAN hardware tagging, jumbo frames, MSI/MSIX, IOV, RSS and TSS. This change set supports all hardware features except IOV and RSS/TSS. Unlike its predecessors, only extended RX buffer descriptors can be posted to the jumbo producer ring. Single RX buffer descriptors for jumbo frame are not supported. RSS requires a more substantial set of changes and will apply to a larger set of NetXtreme devices so RSS/TSS multi-queue support will be implemented in a future releases. Special thanks to Broadcom who kindly sent a sample board to me and to davidch who gave provided the initial support code. Submitted by: davidch (initial version) HW donated by: Broadcom Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Mon Nov 8 19:33:13 2010 (r214996) +++ stable/8/sys/dev/bge/if_bge.c Mon Nov 8 19:36:00 2010 (r214997) @@ -169,6 +169,8 @@ static const struct bge_type { { BCOM_VENDORID, BCOM_DEVICEID_BCM5714S }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5715 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5715S }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5717 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5718 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5720 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5721 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5722 }, @@ -289,6 +291,8 @@ static const struct bge_revision { { BGE_CHIPID_BCM5715_A0, "BCM5715 A0" }, { BGE_CHIPID_BCM5715_A1, "BCM5715 A1" }, { BGE_CHIPID_BCM5715_A3, "BCM5715 A3" }, + { BGE_CHIPID_BCM5717_A0, "BCM5717 A0" }, + { BGE_CHIPID_BCM5717_B0, "BCM5717 B0" }, { BGE_CHIPID_BCM5755_A0, "BCM5755 A0" }, { BGE_CHIPID_BCM5755_A1, "BCM5755 A1" }, { BGE_CHIPID_BCM5755_A2, "BCM5755 A2" }, @@ -332,6 +336,7 @@ static const struct bge_revision bge_maj { BGE_ASICREV_BCM5787, "unknown BCM5754/5787" }, { BGE_ASICREV_BCM5906, "unknown BCM5906" }, { BGE_ASICREV_BCM57780, "unknown BCM57780" }, + { BGE_ASICREV_BCM5717, "unknown BCM5717" }, { 0, NULL } }; @@ -342,6 +347,7 @@ static const struct bge_revision bge_maj #define BGE_IS_5714_FAMILY(sc) ((sc)->bge_flags & BGE_FLAG_5714_FAMILY) #define BGE_IS_575X_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_575X_PLUS) #define BGE_IS_5755_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_5755_PLUS) +#define BGE_IS_5717_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_5717_PLUS) const struct bge_revision * bge_lookup_rev(uint32_t); const struct bge_vendor * bge_lookup_vendor(uint16_t); @@ -367,6 +373,7 @@ static int bge_get_eaddr_eeprom(struct b static int bge_get_eaddr(struct bge_softc *, uint8_t[]); static void bge_txeof(struct bge_softc *, uint16_t); +static void bge_rxcsum(struct bge_softc *, struct bge_rx_bd *, struct mbuf *); static int bge_rxeof(struct bge_softc *, uint16_t, int); static void bge_asf_driver_up (struct bge_softc *); @@ -376,7 +383,7 @@ static void bge_stats_update(struct bge_ static void bge_stats_update_regs(struct bge_softc *); static struct mbuf *bge_check_short_dma(struct mbuf *); static struct mbuf *bge_setup_tso(struct bge_softc *, struct mbuf *, - uint16_t *); + uint16_t *, uint16_t *); static int bge_encap(struct bge_softc *, struct mbuf **, uint32_t *); static void bge_intr(void *); @@ -1349,12 +1356,15 @@ bge_stop_fw(struct bge_softc *sc) static int bge_chipinit(struct bge_softc *sc) { - uint32_t dma_rw_ctl; + uint32_t dma_rw_ctl, misc_ctl; uint16_t val; int i; /* Set endianness before we access any non-PCI registers. */ - pci_write_config(sc->bge_dev, BGE_PCI_MISC_CTL, BGE_INIT, 4); + misc_ctl = BGE_INIT; + if (sc->bge_flags & BGE_FLAG_TAGGED_STATUS) + misc_ctl |= BGE_PCIMISCCTL_TAGGED_STATUS; + pci_write_config(sc->bge_dev, BGE_PCI_MISC_CTL, misc_ctl, 4); /* Clear the MAC control register */ CSR_WRITE_4(sc, BGE_MAC_MODE, 0); @@ -1446,6 +1456,8 @@ bge_chipinit(struct bge_softc *sc) if (sc->bge_asicrev == BGE_ASICREV_BCM5703 || sc->bge_asicrev == BGE_ASICREV_BCM5704) dma_rw_ctl &= ~BGE_PCIDMARWCTL_MINDMA; + if (BGE_IS_5717_PLUS(sc)) + dma_rw_ctl &= ~BGE_PCIDMARWCTL_DIS_CACHE_ALIGNMENT; pci_write_config(sc->bge_dev, BGE_PCI_DMA_RW_CTL, dma_rw_ctl, 4); /* @@ -1529,7 +1541,16 @@ bge_blockinit(struct bge_softc *sc) } /* Configure mbuf pool watermarks */ - if (!BGE_IS_5705_PLUS(sc)) { + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0); + if (sc->bge_ifp->if_mtu > ETHERMTU) { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x7e); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0xea); + } else { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x2a); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0xa0); + } + } else if (!BGE_IS_5705_PLUS(sc)) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x50); CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x20); CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60); @@ -1621,7 +1642,16 @@ bge_blockinit(struct bge_softc *sc) BGE_ADDR_HI(sc->bge_ldata.bge_rx_std_ring_paddr); bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag, sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREREAD); - if (BGE_IS_5705_PLUS(sc)) { + if (BGE_IS_5717_PLUS(sc)) { + /* + * Bits 31-16: Programmable ring size (2048, 1024, 512, .., 32) + * Bits 15-2 : Maximum RX frame size + * Bit 1 : 1 = Ring Disabled, 0 = Ring ENabled + * Bit 0 : Reserved + */ + rcb->bge_maxlen_flags = + BGE_RCB_MAXLEN_FLAGS(512, BGE_MAX_FRAMELEN << 2); + } else if (BGE_IS_5705_PLUS(sc)) { /* * Bits 31-16: Programmable ring size (512, 256, 128, 64, 32) * Bits 15-2 : Reserved (should be 0) @@ -1640,7 +1670,10 @@ bge_blockinit(struct bge_softc *sc) rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0); } - rcb->bge_nicaddr = BGE_STD_RX_RINGS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + rcb->bge_nicaddr = BGE_STD_RX_RINGS_5717; + else + rcb->bge_nicaddr = BGE_STD_RX_RINGS; /* Write the standard receive producer ring control block. */ CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_HI, rcb->bge_hostaddr.bge_addr_hi); CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_LO, rcb->bge_hostaddr.bge_addr_lo); @@ -1669,7 +1702,10 @@ bge_blockinit(struct bge_softc *sc) BUS_DMASYNC_PREREAD); rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_USE_EXT_RX_BD | BGE_RCB_FLAG_RING_DISABLED); - rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS_5717; + else + rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS; CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_HADDR_HI, rcb->bge_hostaddr.bge_addr_hi); CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_HADDR_LO, @@ -1726,6 +1762,10 @@ bge_blockinit(struct bge_softc *sc) if (BGE_IS_JUMBO_CAPABLE(sc)) CSR_WRITE_4(sc, BGE_RBDI_JUMBO_REPL_THRESH, BGE_JUMBO_RX_RING_CNT/8); + if (BGE_IS_5717_PLUS(sc)) { + CSR_WRITE_4(sc, BGE_STD_REPLENISH_LWM, 32); + CSR_WRITE_4(sc, BGE_JMB_REPLENISH_LWM, 16); + } /* * Disable all send rings by setting the 'ring disabled' bit @@ -1750,8 +1790,11 @@ bge_blockinit(struct bge_softc *sc) BGE_HOSTADDR(taddr, sc->bge_ldata.bge_tx_ring_paddr); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, taddr.bge_addr_hi); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo); - RCB_WRITE_4(sc, vrcb, bge_nicaddr, - BGE_NIC_TXRING_ADDR(0, BGE_TX_RING_CNT)); + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + RCB_WRITE_4(sc, vrcb, bge_nicaddr, BGE_SEND_RING_5717); + else + RCB_WRITE_4(sc, vrcb, bge_nicaddr, + BGE_NIC_TXRING_ADDR(0, BGE_TX_RING_CNT)); RCB_WRITE_4(sc, vrcb, bge_maxlen_flags, BGE_RCB_MAXLEN_FLAGS(BGE_TX_RING_CNT, 0)); @@ -1760,7 +1803,10 @@ bge_blockinit(struct bge_softc *sc) * 'ring diabled' bit in the flags field of all the receive * return ring control blocks, located in NIC memory. */ - if (!BGE_IS_5705_PLUS(sc)) + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) { + /* Should be 17, use 16 until we get an SRAM map. */ + limit = 16; + } else if (!BGE_IS_5705_PLUS(sc)) limit = BGE_RX_RINGS_MAX; else if (sc->bge_asicrev == BGE_ASICREV_BCM5755) limit = 4; @@ -1936,6 +1982,10 @@ bge_blockinit(struct bge_softc *sc) /* Turn on read DMA state machine */ val = BGE_RDMAMODE_ENABLE | BGE_RDMAMODE_ALL_ATTNS; + + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + val |= BGE_RDMAMODE_MULT_DMA_RD_DIS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || sc->bge_asicrev == BGE_ASICREV_BCM57780) @@ -1944,16 +1994,18 @@ bge_blockinit(struct bge_softc *sc) BGE_RDMAMODE_MBUF_SBD_CRPT_ATTN; if (sc->bge_flags & BGE_FLAG_PCIE) val |= BGE_RDMAMODE_FIFO_LONG_BURST; - if (sc->bge_flags & BGE_FLAG_TSO) { + if (sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) { val |= BGE_RDMAMODE_TSO4_ENABLE; - if (sc->bge_asicrev == BGE_ASICREV_BCM5785 || + if (sc->bge_flags & BGE_FLAG_TSO3 || + sc->bge_asicrev == BGE_ASICREV_BCM5785 || sc->bge_asicrev == BGE_ASICREV_BCM57780) val |= BGE_RDMAMODE_TSO6_ENABLE; } if (sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || - sc->bge_asicrev == BGE_ASICREV_BCM57780) { + sc->bge_asicrev == BGE_ASICREV_BCM57780 || + BGE_IS_5717_PLUS(sc)) { /* * Enable fix for read DMA FIFO overruns. * The fix is to limit the number of RX BDs @@ -1989,8 +2041,9 @@ bge_blockinit(struct bge_softc *sc) CSR_WRITE_4(sc, BGE_SDC_MODE, val); /* Turn on send data initiator state machine */ - if (sc->bge_flags & BGE_FLAG_TSO) - CSR_WRITE_4(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE | 0x08); + if (sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) + CSR_WRITE_4(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE | + BGE_SDIMODE_HW_LSO_PRE_DMA); else CSR_WRITE_4(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE); @@ -2104,9 +2157,22 @@ bge_probe(device_t dev) id = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) >> BGE_PCIMISCCTL_ASICREV_SHIFT; - if (BGE_ASICREV(id) == BGE_ASICREV_USE_PRODID_REG) - id = pci_read_config(dev, - BGE_PCI_PRODID_ASICREV, 4); + if (BGE_ASICREV(id) == BGE_ASICREV_USE_PRODID_REG) { + /* + * Find the ASCI revision. Different chips + * use different registers. + */ + switch (pci_get_device(dev)) { + case BCOM_DEVICEID_BCM5717: + case BCOM_DEVICEID_BCM5718: + id = pci_read_config(dev, + BGE_PCI_GEN2_PRODID_ASICREV, 4); + break; + default: + id = pci_read_config(dev, + BGE_PCI_PRODID_ASICREV, 4); + } + } br = bge_lookup_rev(id); v = bge_lookup_vendor(vid); { @@ -2423,7 +2489,7 @@ bge_dma_alloc(struct bge_softc *sc) return (ENOMEM); } /* Create tag for Tx mbufs. */ - if (sc->bge_flags & BGE_FLAG_TSO) { + if (sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) { txsegsz = BGE_TSOSEG_SZ; txmaxsegsz = 65535 + sizeof(struct ether_vlan_header); } else { @@ -2539,6 +2605,10 @@ bge_can_use_msi(struct bge_softc *sc) { int can_use_msi = 0; + /* Disable MSI for polling(4). */ +#ifdef DEVICE_POLLING + return (0); +#endif switch (sc->bge_asicrev) { case BGE_ASICREV_BCM5714_A0: case BGE_ASICREV_BCM5714: @@ -2568,7 +2638,7 @@ bge_attach(device_t dev) struct bge_softc *sc; uint32_t hwcfg = 0, misccfg; u_char eaddr[ETHER_ADDR_LEN]; - int error, msicount, phy_addr, reg, rid, trys; + int error, f, msicount, phy_addr, reg, rid, trys; sc = device_get_softc(dev); sc->bge_dev = dev; @@ -2594,14 +2664,55 @@ bge_attach(device_t dev) sc->bge_chipid = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) >> BGE_PCIMISCCTL_ASICREV_SHIFT; - if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_USE_PRODID_REG) - sc->bge_chipid = pci_read_config(dev, BGE_PCI_PRODID_ASICREV, - 4); + if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_USE_PRODID_REG) { + /* + * Find the ASCI revision. Different chips use different + * registers. + */ + switch (pci_get_device(dev)) { + case BCOM_DEVICEID_BCM5717: + case BCOM_DEVICEID_BCM5718: + sc->bge_chipid = pci_read_config(dev, + BGE_PCI_GEN2_PRODID_ASICREV, 4); + break; + default: + sc->bge_chipid = pci_read_config(dev, + BGE_PCI_PRODID_ASICREV, 4); + } + } sc->bge_asicrev = BGE_ASICREV(sc->bge_chipid); sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid); /* Set default PHY address. */ phy_addr = 1; + /* + * PHY address mapping for various devices. + * + * | F0 Cu | F0 Sr | F1 Cu | F1 Sr | + * ---------+-------+-------+-------+-------+ + * BCM57XX | 1 | X | X | X | + * BCM5704 | 1 | X | 1 | X | + * BCM5717 | 1 | 8 | 2 | 9 | + * + * Other addresses may respond but they are not + * IEEE compliant PHYs and should be ignored. + */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) { + f = pci_get_function(dev); + if (sc->bge_chipid == BGE_CHIPID_BCM5717_A0) { + if (CSR_READ_4(sc, BGE_SGDIG_STS) & + BGE_SGDIGSTS_IS_SERDES) + phy_addr = f + 8; + else + phy_addr = f + 1; + } else if (sc->bge_chipid == BGE_CHIPID_BCM5717_B0) { + if (CSR_READ_4(sc, BGE_CPMU_PHY_STRAP) & + BGE_CPMU_PHY_STRAP_IS_SERDES) + phy_addr = f + 8; + else + phy_addr = f + 1; + } + } /* * Don't enable Ethernet@WireSpeed for the 5700, 5906, or the @@ -2610,7 +2721,8 @@ bge_attach(device_t dev) if (sc->bge_asicrev != BGE_ASICREV_BCM5700 && sc->bge_asicrev != BGE_ASICREV_BCM5906 && sc->bge_chipid != BGE_CHIPID_BCM5705_A0 && - sc->bge_chipid != BGE_CHIPID_BCM5705_A1) + sc->bge_chipid != BGE_CHIPID_BCM5705_A1 && + !BGE_IS_5717_PLUS(sc)) sc->bge_phy_flags |= BGE_PHY_WIRESPEED; if (bge_has_eaddr(sc)) @@ -2618,6 +2730,11 @@ bge_attach(device_t dev) /* Save chipset family. */ switch (sc->bge_asicrev) { + case BGE_ASICREV_BCM5717: + sc->bge_flags |= BGE_FLAG_5717_PLUS | BGE_FLAG_5755_PLUS | + BGE_FLAG_575X_PLUS | BGE_FLAG_5705_PLUS | BGE_FLAG_JUMBO | + BGE_FLAG_SHORT_DMA_BUG | BGE_FLAG_JUMBO_FRAME; + break; case BGE_ASICREV_BCM5755: case BGE_ASICREV_BCM5761: case BGE_ASICREV_BCM5784: @@ -2663,6 +2780,7 @@ bge_attach(device_t dev) sc->bge_phy_flags |= BGE_PHY_NO_3LED; if ((BGE_IS_5705_PLUS(sc)) && sc->bge_asicrev != BGE_ASICREV_BCM5906 && + sc->bge_asicrev != BGE_ASICREV_BCM5717 && sc->bge_asicrev != BGE_ASICREV_BCM5785 && sc->bge_asicrev != BGE_ASICREV_BCM57780) { if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || @@ -2679,7 +2797,8 @@ bge_attach(device_t dev) } /* Identify the chips that use an CPMU. */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5784 || + if (BGE_IS_5717_PLUS(sc) || + sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || sc->bge_asicrev == BGE_ASICREV_BCM57780) @@ -2722,7 +2841,10 @@ bge_attach(device_t dev) * the TSO to the controllers that are not affected TSO issues * (e.g. 5755 or higher). */ - if (BGE_IS_5755_PLUS(sc)) { + if (BGE_IS_5717_PLUS(sc)) { + /* BCM5717 requires different TSO configuration. */ + sc->bge_flags |= BGE_FLAG_TSO3; + } else if (BGE_IS_5755_PLUS(sc)) { /* * BCM5754 and BCM5787 shares the same ASIC id so * explicit device id check is required. @@ -2785,6 +2907,16 @@ bge_attach(device_t dev) } } + /* + * All controllers except BCM5700 supports tagged status but + * we use tagged status only for MSI case on BCM5717. Otherwise + * MSI on BCM5717 does not work. + */ +#ifndef DEVICE_POLLING + if (sc->bge_flags & BGE_FLAG_MSI && BGE_IS_5717_PLUS(sc)) + sc->bge_flags |= BGE_FLAG_TAGGED_STATUS; +#endif + sc->bge_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); @@ -2848,7 +2980,9 @@ bge_attach(device_t dev) } /* 5705 limits RX return ring to 512 entries. */ - if (BGE_IS_5705_PLUS(sc)) + if (BGE_IS_5717_PLUS(sc)) + sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT; + else if (BGE_IS_5705_PLUS(sc)) sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT_5705; else sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT; @@ -2893,7 +3027,7 @@ bge_attach(device_t dev) ifp->if_hwassist = sc->bge_csum_features; ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; - if ((sc->bge_flags & BGE_FLAG_TSO) != 0) { + if ((sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) != 0) { ifp->if_hwassist |= CSUM_TSO; ifp->if_capabilities |= IFCAP_TSO4 | IFCAP_VLAN_HWTSO; } @@ -3340,6 +3474,7 @@ bge_reset(struct bge_softc *sc) /* XXX: Broadcom Linux driver. */ if (sc->bge_flags & BGE_FLAG_PCIE && + sc->bge_asicrev != BGE_ASICREV_BCM5717 && sc->bge_chipid != BGE_CHIPID_BCM5750_A0 && sc->bge_asicrev != BGE_ASICREV_BCM5785) { /* Enable Data FIFO protection. */ @@ -3480,20 +3615,8 @@ bge_rxeof(struct bge_softc *sc, uint16_t m->m_pkthdr.len = m->m_len = cur_rx->bge_len - ETHER_CRC_LEN; m->m_pkthdr.rcvif = ifp; - if (ifp->if_capenable & IFCAP_RXCSUM) { - if (cur_rx->bge_flags & BGE_RXBDFLAG_IP_CSUM) { - m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; - if ((cur_rx->bge_ip_csum ^ 0xFFFF) == 0) - m->m_pkthdr.csum_flags |= CSUM_IP_VALID; - } - if (cur_rx->bge_flags & BGE_RXBDFLAG_TCP_UDP_CSUM && - m->m_pkthdr.len >= ETHER_MIN_NOPAD) { - m->m_pkthdr.csum_data = - cur_rx->bge_tcp_udp_csum; - m->m_pkthdr.csum_flags |= - CSUM_DATA_VALID | CSUM_PSEUDO_HDR; - } - } + if (ifp->if_capenable & IFCAP_RXCSUM) + bge_rxcsum(sc, cur_rx, m); /* * If we received a packet with a vlan tag, @@ -3552,6 +3675,41 @@ bge_rxeof(struct bge_softc *sc, uint16_t } static void +bge_rxcsum(struct bge_softc *sc, struct bge_rx_bd *cur_rx, struct mbuf *m) +{ + + if (BGE_IS_5717_PLUS(sc)) { + if ((cur_rx->bge_flags & BGE_RXBDFLAG_IPV6) == 0) { + if (cur_rx->bge_flags & BGE_RXBDFLAG_IP_CSUM) { + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if ((cur_rx->bge_error_flag & + BGE_RXERRFLAG_IP_CSUM_NOK) == 0) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + } + if (cur_rx->bge_flags & BGE_RXBDFLAG_TCP_UDP_CSUM) { + m->m_pkthdr.csum_data = + cur_rx->bge_tcp_udp_csum; + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | + CSUM_PSEUDO_HDR; + } + } + } else { + if (cur_rx->bge_flags & BGE_RXBDFLAG_IP_CSUM) { + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if ((cur_rx->bge_ip_csum ^ 0xFFFF) == 0) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + } + if (cur_rx->bge_flags & BGE_RXBDFLAG_TCP_UDP_CSUM && + m->m_pkthdr.len >= ETHER_MIN_NOPAD) { + m->m_pkthdr.csum_data = + cur_rx->bge_tcp_udp_csum; + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | + CSUM_PSEUDO_HDR; + } + } +} + +static void bge_txeof(struct bge_softc *sc, uint16_t tx_cons) { struct bge_tx_bd *cur_tx; @@ -3668,7 +3826,7 @@ bge_intr_task(void *arg, int pending) { struct bge_softc *sc; struct ifnet *ifp; - uint32_t status; + uint32_t status, status_tag; uint16_t rx_prod, tx_cons; sc = (struct bge_softc *)arg; @@ -3689,16 +3847,19 @@ bge_intr_task(void *arg, int pending) rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx; tx_cons = sc->bge_ldata.bge_status_block->bge_idx[0].bge_tx_cons_idx; status = sc->bge_ldata.bge_status_block->bge_status; + status_tag = sc->bge_ldata.bge_status_block->bge_status_tag << 24; sc->bge_ldata.bge_status_block->bge_status = 0; bus_dmamap_sync(sc->bge_cdata.bge_status_tag, sc->bge_cdata.bge_status_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + if ((sc->bge_flags & BGE_FLAG_TAGGED_STATUS) == 0) + status_tag = 0; if ((status & BGE_STATFLAG_LINKSTATE_CHANGED) != 0) bge_link_upd(sc); /* Let controller work. */ - bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); + bge_writembx(sc, BGE_MBX_IRQ0_LO, status_tag); if (ifp->if_drv_flags & IFF_DRV_RUNNING && sc->bge_rx_saved_considx != rx_prod) { @@ -4104,7 +4265,8 @@ bge_check_short_dma(struct mbuf *m) } static struct mbuf * -bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss) +bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss, + uint16_t *flags) { struct ip *ip; struct tcphdr *tcp; @@ -4147,14 +4309,30 @@ bge_setup_tso(struct bge_softc *sc, stru * Broadcom controllers uses different descriptor format for * TSO depending on ASIC revision. Due to TSO-capable firmware * license issue and lower performance of firmware based TSO - * we only support hardware based TSO which is applicable for - * BCM5755 or newer controllers. Hardware based TSO uses 11 - * bits to store MSS and upper 5 bits are used to store IP/TCP - * header length(including IP/TCP options). The header length - * is expressed as 32 bits unit. + * we only support hardware based TSO. */ + /* Calculate header length, incl. TCP/IP options, in 32 bit units. */ hlen = ((ip->ip_hl << 2) + (tcp->th_off << 2)) >> 2; - *mss |= (hlen << 11); + if (sc->bge_flags & BGE_FLAG_TSO3) { + /* + * For BCM5717 and newer controllers, hardware based TSO + * uses the 14 lower bits of the bge_mss field to store the + * MSS and the upper 2 bits to store the lowest 2 bits of + * the IP/TCP header length. The upper 6 bits of the header + * length are stored in the bge_flags[14:10,4] field. Jumbo + * frames are supported. + */ + *mss |= ((hlen & 0x3) << 14); + *flags |= ((hlen & 0xF8) << 7) | ((hlen & 0x4) << 2); + } else { + /* + * For BCM5755 and newer controllers, hardware based TSO uses + * the lower 11 bits to store the MSS and the upper 5 bits to + * store the IP/TCP header length. Jumbo frames are not + * supported. + */ + *mss |= (hlen << 11); + } return (m); } @@ -4184,7 +4362,7 @@ bge_encap(struct bge_softc *sc, struct m m = *m_head; } if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { - *m_head = m = bge_setup_tso(sc, m, &mss); + *m_head = m = bge_setup_tso(sc, m, &mss, &csum_flags); if (*m_head == NULL) return (ENOBUFS); csum_flags |= BGE_TXBDFLAG_CPU_PRE_DMA | @@ -4207,21 +4385,26 @@ bge_encap(struct bge_softc *sc, struct m csum_flags |= BGE_TXBDFLAG_IP_FRAG; } - if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0 && - sc->bge_forced_collapse > 0 && - (sc->bge_flags & BGE_FLAG_PCIE) != 0 && m->m_next != NULL) { - /* - * Forcedly collapse mbuf chains to overcome hardware - * limitation which only support a single outstanding - * DMA read operation. - */ - if (sc->bge_forced_collapse == 1) - m = m_defrag(m, M_DONTWAIT); - else - m = m_collapse(m, M_DONTWAIT, sc->bge_forced_collapse); - if (m == NULL) - m = *m_head; - *m_head = m; + if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0) { + if (sc->bge_flags & BGE_FLAG_JUMBO_FRAME && + m->m_pkthdr.len > ETHER_MAX_LEN) + csum_flags |= BGE_TXBDFLAG_JUMBO_FRAME; + if (sc->bge_forced_collapse > 0 && + (sc->bge_flags & BGE_FLAG_PCIE) != 0 && m->m_next != NULL) { + /* + * Forcedly collapse mbuf chains to overcome hardware + * limitation which only support a single outstanding + * DMA read operation. + */ + if (sc->bge_forced_collapse == 1) + m = m_defrag(m, M_DONTWAIT); + else + m = m_collapse(m, M_DONTWAIT, + sc->bge_forced_collapse); + if (m == NULL) + m = *m_head; + *m_head = m; + } } map = sc->bge_cdata.bge_tx_dmamap[idx]; Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Mon Nov 8 19:33:13 2010 (r214996) +++ stable/8/sys/dev/bge/if_bgereg.h Mon Nov 8 19:36:00 2010 (r214997) @@ -82,6 +82,7 @@ #define BGE_UNMAPPED_END 0x00001FFF #define BGE_DMA_DESCRIPTORS 0x00002000 #define BGE_DMA_DESCRIPTORS_END 0x00003FFF +#define BGE_SEND_RING_5717 0x00004000 #define BGE_SEND_RING_1_TO_4 0x00004000 #define BGE_SEND_RING_1_TO_4_END 0x00005FFF @@ -100,6 +101,8 @@ #define BGE_BUFFPOOL_2_END 0x00017FFF #define BGE_BUFFPOOL_3 0x00018000 /* or expansion ROM */ #define BGE_BUFFPOOL_3_END 0x0001FFFF +#define BGE_STD_RX_RINGS_5717 0x00040000 +#define BGE_JUMBO_RX_RINGS_5717 0x00044400 /* Mappings for external SSRAM configurations */ #define BGE_SEND_RING_5_TO_6 0x00006000 @@ -219,6 +222,7 @@ #define BGE_PCI_ISR_MBX_HI 0xB0 #define BGE_PCI_ISR_MBX_LO 0xB4 #define BGE_PCI_PRODID_ASICREV 0xBC +#define BGE_PCI_GEN2_PRODID_ASICREV 0xF4 /* PCI Misc. Host control register */ #define BGE_PCIMISCCTL_CLEAR_INTA 0x00000001 @@ -229,6 +233,7 @@ #define BGE_PCIMISCCTL_CLOCKCTL_RW 0x00000020 #define BGE_PCIMISCCTL_REG_WORDSWAP 0x00000040 #define BGE_PCIMISCCTL_INDIRECT_ACCESS 0x00000080 +#define BGE_PCIMISCCTL_TAGGED_STATUS 0x00000200 #define BGE_PCIMISCCTL_ASICREV 0xFFFF0000 #define BGE_PCIMISCCTL_ASICREV_SHIFT 16 @@ -311,6 +316,8 @@ #define BGE_CHIPID_BCM5906_A2 0xc002 #define BGE_CHIPID_BCM57780_A0 0x57780000 #define BGE_CHIPID_BCM57780_A1 0x57780001 +#define BGE_CHIPID_BCM5717_A0 0x05717000 +#define BGE_CHIPID_BCM5717_B0 0x05717100 /* shorthand one */ #define BGE_ASICREV(x) ((x) >> 12) @@ -331,6 +338,7 @@ /* Should consult BGE_PCI_PRODID_ASICREV for ChipID */ #define BGE_ASICREV_USE_PRODID_REG 0x0f /* BGE_PCI_PRODID_ASICREV ASIC rev. identifiers. */ +#define BGE_ASICREV_BCM5717 0x5717 #define BGE_ASICREV_BCM5761 0x5761 #define BGE_ASICREV_BCM5784 0x5784 #define BGE_ASICREV_BCM5785 0x5785 @@ -348,11 +356,14 @@ #define BGE_CHIPREV_5750_AX 0x40 #define BGE_CHIPREV_5750_BX 0x41 /* BGE_PCI_PRODID_ASICREV chip rev. identifiers. */ +#define BGE_CHIPREV_5717_AX 0x57170 +#define BGE_CHIPREV_5717_BX 0x57171 #define BGE_CHIPREV_5761_AX 0x57611 #define BGE_CHIPREV_5784_AX 0x57841 /* PCI DMA Read/Write Control register */ #define BGE_PCIDMARWCTL_MINDMA 0x000000FF +#define BGE_PCIDMARWCTL_DIS_CACHE_ALIGNMENT 0x00000001 #define BGE_PCIDMARWCTL_RDADRR_BNDRY 0x00000700 #define BGE_PCIDMARWCTL_WRADDR_BNDRY 0x00003800 #define BGE_PCIDMARWCTL_ONEDMA_ATONCE 0x0000C000 @@ -566,6 +577,7 @@ #define BGE_TX_RINGS_MAX 4 #define BGE_TX_RINGS_EXTSSRAM_MAX 16 #define BGE_RX_RINGS_MAX 16 +#define BGE_RX_RINGS_MAX_5717 17 /* Ethernet MAC control registers */ #define BGE_MAC_MODE 0x0400 @@ -843,9 +855,10 @@ #define BGE_SGDIGCFG_AUTO 0x80000000 /* SGDIG status (not documented) */ +#define BGE_SGDIGSTS_DONE 0x00000002 +#define BGE_SGDIGSTS_IS_SERDES 0x00000100 #define BGE_SGDIGSTS_PAUSE_CAP 0x00080000 #define BGE_SGDIGSTS_ASYM_PAUSE 0x00100000 -#define BGE_SGDIGSTS_DONE 0x00000002 /* MI communication register */ @@ -911,6 +924,7 @@ #define BGE_SDIMODE_RESET 0x00000001 #define BGE_SDIMODE_ENABLE 0x00000002 #define BGE_SDIMODE_STATS_OFLOW_ATTN 0x00000004 +#define BGE_SDIMODE_HW_LSO_PRE_DMA 0x00000008 /* Send Data Initiator stats register */ #define BGE_SDISTAT_STATS_OFLOW_ATTN 0x00000004 @@ -1188,6 +1202,9 @@ #define BGE_RBDI_STD_REPL_THRESH 0x2C18 #define BGE_RBDI_JUMBO_REPL_THRESH 0x2C1C +#define BGE_STD_REPLENISH_LWM 0x2D00 +#define BGE_JMB_REPLENISH_LWM 0x2D04 + /* Receive BD Initiator Mode register */ #define BGE_RBDIMODE_RESET 0x00000001 #define BGE_RBDIMODE_ENABLE 0x00000002 @@ -1501,6 +1518,7 @@ #define BGE_RDMAMODE_MBUF_SBD_CRPT_ATTN 0x00002000 #define BGE_RDMAMODE_FIFO_SIZE_128 0x00020000 #define BGE_RDMAMODE_FIFO_LONG_BURST 0x00030000 +#define BGE_RDMAMODE_MULT_DMA_RD_DIS 0x01000000 #define BGE_RDMAMODE_TSO4_ENABLE 0x08000000 #define BGE_RDMAMODE_TSO6_ENABLE 0x10000000 @@ -2068,15 +2086,27 @@ struct bge_tx_bd { #define BGE_TXBDFLAG_IP_CSUM 0x0002 #define BGE_TXBDFLAG_END 0x0004 #define BGE_TXBDFLAG_IP_FRAG 0x0008 +#define BGE_TXBDFLAG_JUMBO_FRAME 0x0008 /* 5717 */ #define BGE_TXBDFLAG_IP_FRAG_END 0x0010 +#define BGE_TXBDFLAG_HDRLEN_BIT2 0x0010 /* 5717 */ +#define BGE_TXBDFLAG_SNAP 0x0020 /* 5717 */ #define BGE_TXBDFLAG_VLAN_TAG 0x0040 #define BGE_TXBDFLAG_COAL_NOW 0x0080 #define BGE_TXBDFLAG_CPU_PRE_DMA 0x0100 #define BGE_TXBDFLAG_CPU_POST_DMA 0x0200 +#define BGE_TXBDFLAG_HDRLEN_BIT3 0x0400 /* 5717 */ +#define BGE_TXBDFLAG_HDRLEN_BIT4 0x0800 /* 5717 */ #define BGE_TXBDFLAG_INSERT_SRC_ADDR 0x1000 +#define BGE_TXBDFLAG_HDRLEN_BIT5 0x1000 /* 5717 */ +#define BGE_TXBDFLAG_HDRLEN_BIT6 0x2000 /* 5717 */ +#define BGE_TXBDFLAG_HDRLEN_BIT7 0x4000 /* 5717 */ #define BGE_TXBDFLAG_CHOOSE_SRC_ADDR 0x6000 #define BGE_TXBDFLAG_NO_CRC 0x8000 +#define BGE_TXBDFLAG_MSS_SIZE_MASK 0x3FFF /* 5717 */ +/* Bits [1:0] of the MSS header length. */ +#define BGE_TXBDFLAG_MSS_HDRLEN_MASK 0xC000 /* 5717 */ + #define BGE_NIC_TXRING_ADDR(ringno, size) \ BGE_SEND_RING_1_TO_4 + \ ((ringno * sizeof(struct bge_tx_bd) * size) / 4) @@ -2153,6 +2183,7 @@ struct bge_extrx_bd { #define BGE_RXBDFLAG_IP_CSUM 0x1000 #define BGE_RXBDFLAG_TCP_UDP_CSUM 0x2000 #define BGE_RXBDFLAG_TCP_UDP_IS_TCP 0x4000 +#define BGE_RXBDFLAG_IPV6 0x8000 #define BGE_RXERRFLAG_BAD_CRC 0x0001 #define BGE_RXERRFLAG_COLL_DETECT 0x0002 @@ -2162,6 +2193,7 @@ struct bge_extrx_bd { #define BGE_RXERRFLAG_RUNT 0x0020 #define BGE_RXERRFLAG_TRUNC_NO_RSRCS 0x0040 #define BGE_RXERRFLAG_GIANT 0x0080 +#define BGE_RXERRFLAG_IP_CSUM_NOK 0x1000 /* 5717 */ struct bge_sts_idx { #if BYTE_ORDER == LITTLE_ENDIAN @@ -2175,7 +2207,7 @@ struct bge_sts_idx { struct bge_status_block { uint32_t bge_status; - uint32_t bge_rsvd0; + uint32_t bge_status_tag; #if BYTE_ORDER == LITTLE_ENDIAN uint16_t bge_rx_jumbo_cons_idx; uint16_t bge_rx_std_cons_idx; @@ -2221,6 +2253,8 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5714S 0x1669 #define BCOM_DEVICEID_BCM5715 0x1678 #define BCOM_DEVICEID_BCM5715S 0x1679 +#define BCOM_DEVICEID_BCM5717 0x1655 +#define BCOM_DEVICEID_BCM5718 0x1656 #define BCOM_DEVICEID_BCM5720 0x1658 #define BCOM_DEVICEID_BCM5721 0x1659 #define BCOM_DEVICEID_BCM5722 0x165A @@ -2717,16 +2751,20 @@ struct bge_softc { #define BGE_FLAG_EADDR 0x00000008 #define BGE_FLAG_MII_SERDES 0x00000010 #define BGE_FLAG_CPMU_PRESENT 0x00000020 +#define BGE_FLAG_TAGGED_STATUS 0x00000040 #define BGE_FLAG_MSI 0x00000100 #define BGE_FLAG_PCIX 0x00000200 #define BGE_FLAG_PCIE 0x00000400 #define BGE_FLAG_TSO 0x00000800 +#define BGE_FLAG_TSO3 0x00001000 +#define BGE_FLAG_JUMBO_FRAME 0x00002000 #define BGE_FLAG_5700_FAMILY 0x00010000 #define BGE_FLAG_5705_PLUS 0x00020000 #define BGE_FLAG_5714_FAMILY 0x00040000 #define BGE_FLAG_575X_PLUS 0x00080000 #define BGE_FLAG_5755_PLUS 0x00100000 #define BGE_FLAG_5788 0x00200000 +#define BGE_FLAG_5717_PLUS 0x00400000 #define BGE_FLAG_40BIT_BUG 0x01000000 #define BGE_FLAG_4G_BNDRY_BUG 0x02000000 #define BGE_FLAG_RX_ALIGNBUG 0x04000000 From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 19:52:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08C34106566B; Mon, 8 Nov 2010 19:52:15 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB1808FC26; Mon, 8 Nov 2010 19:52: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 oA8JqEnC049441; Mon, 8 Nov 2010 19:52:14 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8JqE1n049439; Mon, 8 Nov 2010 19:52:14 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201011081952.oA8JqE1n049439@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 8 Nov 2010 19:52:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214998 - head/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 19:52:15 -0000 Author: jkim Date: Mon Nov 8 19:52:14 2010 New Revision: 214998 URL: http://svn.freebsd.org/changeset/base/214998 Log: Consistently use padding `_' in the comment. Modified: head/sys/dev/acpica/acpi.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Mon Nov 8 19:36:00 2010 (r214997) +++ head/sys/dev/acpica/acpi.c Mon Nov 8 19:52:14 2010 (r214998) @@ -1693,7 +1693,7 @@ acpi_probe_child(ACPI_HANDLE handle, UIN /* * Since we scan from \, be sure to skip system scope objects. * \_SB_ and \_TZ_ are defined in ACPICA as devices to work around - * BIOS bugs. For example, \_SB_ is to allow \_SB._INI to be run + * BIOS bugs. For example, \_SB_ is to allow \_SB_._INI to be run * during the intialization and \_TZ_ is to support Notify() on it. */ if (strcmp(handle_str, "\\_SB_") == 0 || From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 19:53:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3E1C1065670; Mon, 8 Nov 2010 19:53:16 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B18DA8FC28; Mon, 8 Nov 2010 19:53: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 oA8JrGgL049519; Mon, 8 Nov 2010 19:53:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8JrG7L049517; Mon, 8 Nov 2010 19:53:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201011081953.oA8JrG7L049517@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 8 Nov 2010 19:53:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214999 - head/sys/dev/iicbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 19:53:16 -0000 Author: nwhitehorn Date: Mon Nov 8 19:53:16 2010 New Revision: 214999 URL: http://svn.freebsd.org/changeset/base/214999 Log: Provide support for IIC_M_NOSTOP/IIC_M_NOSTART for bit-banging and otherwise low-level controllers. Reviewed by: thompsa Modified: head/sys/dev/iicbus/iiconf.c Modified: head/sys/dev/iicbus/iiconf.c ============================================================================== --- head/sys/dev/iicbus/iiconf.c Mon Nov 8 19:52:14 2010 (r214998) +++ head/sys/dev/iicbus/iiconf.c Mon Nov 8 19:53:16 2010 (r214999) @@ -363,7 +363,7 @@ iicbus_transfer(device_t bus, struct iic int iicbus_transfer_gen(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) { - int i, error, lenread, lenwrote, nkid; + int i, error, lenread, lenwrote, nkid, rpstart, addr; device_t *children, bus; if ((error = device_get_children(dev, &children, &nkid)) != 0) @@ -373,14 +373,38 @@ iicbus_transfer_gen(device_t dev, struct return (EIO); } bus = children[0]; + rpstart = 0; free(children, M_TEMP); for (i = 0, error = 0; i < nmsgs && error == 0; i++) { + addr = msgs[i].slave; if (msgs[i].flags & IIC_M_RD) - error = iicbus_block_read(bus, msgs[i].slave, - msgs[i].buf, msgs[i].len, &lenread); + addr |= LSB; else - error = iicbus_block_write(bus, msgs[i].slave, - msgs[i].buf, msgs[i].len, &lenwrote); + addr &= ~LSB; + + if (!(msgs[i].flags & IIC_M_NOSTART)) { + if (rpstart) + error = iicbus_repeated_start(bus, addr, 0); + else + error = iicbus_start(bus, addr, 0); + } + + if (error) + break; + + if (msgs[i].flags & IIC_M_RD) + error = iicbus_read(bus, msgs[i].buf, msgs[i].len, + &lenread, IIC_LAST_READ, 0); + else + error = iicbus_write(bus, msgs[i].buf, msgs[i].len, + &lenwrote, 0); + + if (!(msgs[i].flags & IIC_M_NOSTOP)) { + rpstart = 0; + iicbus_stop(bus); + } else { + rpstart = 1; /* Next message gets repeated start */ + } } return (error); } From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 19:54:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 461AD1065673; Mon, 8 Nov 2010 19:54:45 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3234A8FC23; Mon, 8 Nov 2010 19:54:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8JsjrV049637; Mon, 8 Nov 2010 19:54:45 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8JsjHu049634; Mon, 8 Nov 2010 19:54:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011081954.oA8JsjHu049634@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Nov 2010 19:54:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215000 - stable/7/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 19:54:45 -0000 Author: yongari Date: Mon Nov 8 19:54:44 2010 New Revision: 215000 URL: http://svn.freebsd.org/changeset/base/215000 Log: MFC r214428: Add initial BCM5718 family support. The BCM5718 family includes the dual port BCM5717 and BCM5718 devices which are intended for mainstream workstation and entry-level server designs and represents the twelfth generation of NetXtreme Ethernet controllers. This family is the successor to the BCM5714/BCM5715 family and supports IPv4/IPv6 checksum offloading, TSO, VLAN hardware tagging, jumbo frames, MSI/MSIX, IOV, RSS and TSS. This change set supports all hardware features except IOV and RSS/TSS. Unlike its predecessors, only extended RX buffer descriptors can be posted to the jumbo producer ring. Single RX buffer descriptors for jumbo frame are not supported. RSS requires a more substantial set of changes and will apply to a larger set of NetXtreme devices so RSS/TSS multi-queue support will be implemented in a future releases. Special thanks to Broadcom who kindly sent a sample board to me and to davidch who gave provided the initial support code. Submitted by: davidch (initial version) HW donated by: Broadcom Modified: stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.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/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Mon Nov 8 19:53:16 2010 (r214999) +++ stable/7/sys/dev/bge/if_bge.c Mon Nov 8 19:54:44 2010 (r215000) @@ -169,6 +169,8 @@ static const struct bge_type { { BCOM_VENDORID, BCOM_DEVICEID_BCM5714S }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5715 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5715S }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5717 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5718 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5720 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5721 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5722 }, @@ -289,6 +291,8 @@ static const struct bge_revision { { BGE_CHIPID_BCM5715_A0, "BCM5715 A0" }, { BGE_CHIPID_BCM5715_A1, "BCM5715 A1" }, { BGE_CHIPID_BCM5715_A3, "BCM5715 A3" }, + { BGE_CHIPID_BCM5717_A0, "BCM5717 A0" }, + { BGE_CHIPID_BCM5717_B0, "BCM5717 B0" }, { BGE_CHIPID_BCM5755_A0, "BCM5755 A0" }, { BGE_CHIPID_BCM5755_A1, "BCM5755 A1" }, { BGE_CHIPID_BCM5755_A2, "BCM5755 A2" }, @@ -332,6 +336,7 @@ static const struct bge_revision bge_maj { BGE_ASICREV_BCM5787, "unknown BCM5754/5787" }, { BGE_ASICREV_BCM5906, "unknown BCM5906" }, { BGE_ASICREV_BCM57780, "unknown BCM57780" }, + { BGE_ASICREV_BCM5717, "unknown BCM5717" }, { 0, NULL } }; @@ -342,6 +347,7 @@ static const struct bge_revision bge_maj #define BGE_IS_5714_FAMILY(sc) ((sc)->bge_flags & BGE_FLAG_5714_FAMILY) #define BGE_IS_575X_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_575X_PLUS) #define BGE_IS_5755_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_5755_PLUS) +#define BGE_IS_5717_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_5717_PLUS) const struct bge_revision * bge_lookup_rev(uint32_t); const struct bge_vendor * bge_lookup_vendor(uint16_t); @@ -367,6 +373,7 @@ static int bge_get_eaddr_eeprom(struct b static int bge_get_eaddr(struct bge_softc *, uint8_t[]); static void bge_txeof(struct bge_softc *, uint16_t); +static void bge_rxcsum(struct bge_softc *, struct bge_rx_bd *, struct mbuf *); static void bge_rxeof(struct bge_softc *, uint16_t, int); static void bge_asf_driver_up (struct bge_softc *); @@ -376,7 +383,7 @@ static void bge_stats_update(struct bge_ static void bge_stats_update_regs(struct bge_softc *); static struct mbuf *bge_check_short_dma(struct mbuf *); static struct mbuf *bge_setup_tso(struct bge_softc *, struct mbuf *, - uint16_t *); + uint16_t *, uint16_t *); static int bge_encap(struct bge_softc *, struct mbuf **, uint32_t *); static void bge_intr(void *); @@ -1349,12 +1356,15 @@ bge_stop_fw(struct bge_softc *sc) static int bge_chipinit(struct bge_softc *sc) { - uint32_t dma_rw_ctl; + uint32_t dma_rw_ctl, misc_ctl; uint16_t val; int i; /* Set endianness before we access any non-PCI registers. */ - pci_write_config(sc->bge_dev, BGE_PCI_MISC_CTL, BGE_INIT, 4); + misc_ctl = BGE_INIT; + if (sc->bge_flags & BGE_FLAG_TAGGED_STATUS) + misc_ctl |= BGE_PCIMISCCTL_TAGGED_STATUS; + pci_write_config(sc->bge_dev, BGE_PCI_MISC_CTL, misc_ctl, 4); /* Clear the MAC control register */ CSR_WRITE_4(sc, BGE_MAC_MODE, 0); @@ -1446,6 +1456,8 @@ bge_chipinit(struct bge_softc *sc) if (sc->bge_asicrev == BGE_ASICREV_BCM5703 || sc->bge_asicrev == BGE_ASICREV_BCM5704) dma_rw_ctl &= ~BGE_PCIDMARWCTL_MINDMA; + if (BGE_IS_5717_PLUS(sc)) + dma_rw_ctl &= ~BGE_PCIDMARWCTL_DIS_CACHE_ALIGNMENT; pci_write_config(sc->bge_dev, BGE_PCI_DMA_RW_CTL, dma_rw_ctl, 4); /* @@ -1529,7 +1541,16 @@ bge_blockinit(struct bge_softc *sc) } /* Configure mbuf pool watermarks */ - if (!BGE_IS_5705_PLUS(sc)) { + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0); + if (sc->bge_ifp->if_mtu > ETHERMTU) { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x7e); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0xea); + } else { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x2a); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0xa0); + } + } else if (!BGE_IS_5705_PLUS(sc)) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x50); CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x20); CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60); @@ -1621,7 +1642,16 @@ bge_blockinit(struct bge_softc *sc) BGE_ADDR_HI(sc->bge_ldata.bge_rx_std_ring_paddr); bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag, sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREREAD); - if (BGE_IS_5705_PLUS(sc)) { + if (BGE_IS_5717_PLUS(sc)) { + /* + * Bits 31-16: Programmable ring size (2048, 1024, 512, .., 32) + * Bits 15-2 : Maximum RX frame size + * Bit 1 : 1 = Ring Disabled, 0 = Ring ENabled + * Bit 0 : Reserved + */ + rcb->bge_maxlen_flags = + BGE_RCB_MAXLEN_FLAGS(512, BGE_MAX_FRAMELEN << 2); + } else if (BGE_IS_5705_PLUS(sc)) { /* * Bits 31-16: Programmable ring size (512, 256, 128, 64, 32) * Bits 15-2 : Reserved (should be 0) @@ -1640,7 +1670,10 @@ bge_blockinit(struct bge_softc *sc) rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0); } - rcb->bge_nicaddr = BGE_STD_RX_RINGS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + rcb->bge_nicaddr = BGE_STD_RX_RINGS_5717; + else + rcb->bge_nicaddr = BGE_STD_RX_RINGS; /* Write the standard receive producer ring control block. */ CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_HI, rcb->bge_hostaddr.bge_addr_hi); CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_LO, rcb->bge_hostaddr.bge_addr_lo); @@ -1669,7 +1702,10 @@ bge_blockinit(struct bge_softc *sc) BUS_DMASYNC_PREREAD); rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_USE_EXT_RX_BD | BGE_RCB_FLAG_RING_DISABLED); - rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS_5717; + else + rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS; CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_HADDR_HI, rcb->bge_hostaddr.bge_addr_hi); CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_HADDR_LO, @@ -1726,6 +1762,10 @@ bge_blockinit(struct bge_softc *sc) if (BGE_IS_JUMBO_CAPABLE(sc)) CSR_WRITE_4(sc, BGE_RBDI_JUMBO_REPL_THRESH, BGE_JUMBO_RX_RING_CNT/8); + if (BGE_IS_5717_PLUS(sc)) { + CSR_WRITE_4(sc, BGE_STD_REPLENISH_LWM, 32); + CSR_WRITE_4(sc, BGE_JMB_REPLENISH_LWM, 16); + } /* * Disable all send rings by setting the 'ring disabled' bit @@ -1750,8 +1790,11 @@ bge_blockinit(struct bge_softc *sc) BGE_HOSTADDR(taddr, sc->bge_ldata.bge_tx_ring_paddr); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, taddr.bge_addr_hi); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo); - RCB_WRITE_4(sc, vrcb, bge_nicaddr, - BGE_NIC_TXRING_ADDR(0, BGE_TX_RING_CNT)); + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + RCB_WRITE_4(sc, vrcb, bge_nicaddr, BGE_SEND_RING_5717); + else + RCB_WRITE_4(sc, vrcb, bge_nicaddr, + BGE_NIC_TXRING_ADDR(0, BGE_TX_RING_CNT)); RCB_WRITE_4(sc, vrcb, bge_maxlen_flags, BGE_RCB_MAXLEN_FLAGS(BGE_TX_RING_CNT, 0)); @@ -1760,7 +1803,10 @@ bge_blockinit(struct bge_softc *sc) * 'ring diabled' bit in the flags field of all the receive * return ring control blocks, located in NIC memory. */ - if (!BGE_IS_5705_PLUS(sc)) + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) { + /* Should be 17, use 16 until we get an SRAM map. */ + limit = 16; + } else if (!BGE_IS_5705_PLUS(sc)) limit = BGE_RX_RINGS_MAX; else if (sc->bge_asicrev == BGE_ASICREV_BCM5755) limit = 4; @@ -1936,6 +1982,10 @@ bge_blockinit(struct bge_softc *sc) /* Turn on read DMA state machine */ val = BGE_RDMAMODE_ENABLE | BGE_RDMAMODE_ALL_ATTNS; + + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + val |= BGE_RDMAMODE_MULT_DMA_RD_DIS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || sc->bge_asicrev == BGE_ASICREV_BCM57780) @@ -1944,16 +1994,18 @@ bge_blockinit(struct bge_softc *sc) BGE_RDMAMODE_MBUF_SBD_CRPT_ATTN; if (sc->bge_flags & BGE_FLAG_PCIE) val |= BGE_RDMAMODE_FIFO_LONG_BURST; - if (sc->bge_flags & BGE_FLAG_TSO) { + if (sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) { val |= BGE_RDMAMODE_TSO4_ENABLE; - if (sc->bge_asicrev == BGE_ASICREV_BCM5785 || + if (sc->bge_flags & BGE_FLAG_TSO3 || + sc->bge_asicrev == BGE_ASICREV_BCM5785 || sc->bge_asicrev == BGE_ASICREV_BCM57780) val |= BGE_RDMAMODE_TSO6_ENABLE; } if (sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || - sc->bge_asicrev == BGE_ASICREV_BCM57780) { + sc->bge_asicrev == BGE_ASICREV_BCM57780 || + BGE_IS_5717_PLUS(sc)) { /* * Enable fix for read DMA FIFO overruns. * The fix is to limit the number of RX BDs @@ -1989,8 +2041,9 @@ bge_blockinit(struct bge_softc *sc) CSR_WRITE_4(sc, BGE_SDC_MODE, val); /* Turn on send data initiator state machine */ - if (sc->bge_flags & BGE_FLAG_TSO) - CSR_WRITE_4(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE | 0x08); + if (sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) + CSR_WRITE_4(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE | + BGE_SDIMODE_HW_LSO_PRE_DMA); else CSR_WRITE_4(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE); @@ -2104,9 +2157,22 @@ bge_probe(device_t dev) id = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) >> BGE_PCIMISCCTL_ASICREV_SHIFT; - if (BGE_ASICREV(id) == BGE_ASICREV_USE_PRODID_REG) - id = pci_read_config(dev, - BGE_PCI_PRODID_ASICREV, 4); + if (BGE_ASICREV(id) == BGE_ASICREV_USE_PRODID_REG) { + /* + * Find the ASCI revision. Different chips + * use different registers. + */ + switch (pci_get_device(dev)) { + case BCOM_DEVICEID_BCM5717: + case BCOM_DEVICEID_BCM5718: + id = pci_read_config(dev, + BGE_PCI_GEN2_PRODID_ASICREV, 4); + break; + default: + id = pci_read_config(dev, + BGE_PCI_PRODID_ASICREV, 4); + } + } br = bge_lookup_rev(id); v = bge_lookup_vendor(vid); { @@ -2423,7 +2489,7 @@ bge_dma_alloc(struct bge_softc *sc) return (ENOMEM); } /* Create tag for Tx mbufs. */ - if (sc->bge_flags & BGE_FLAG_TSO) { + if (sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) { txsegsz = BGE_TSOSEG_SZ; txmaxsegsz = 65535 + sizeof(struct ether_vlan_header); } else { @@ -2539,6 +2605,10 @@ bge_can_use_msi(struct bge_softc *sc) { int can_use_msi = 0; + /* Disable MSI for polling(4). */ +#ifdef DEVICE_POLLING + return (0); +#endif switch (sc->bge_asicrev) { case BGE_ASICREV_BCM5714_A0: case BGE_ASICREV_BCM5714: @@ -2568,7 +2638,7 @@ bge_attach(device_t dev) struct bge_softc *sc; uint32_t hwcfg = 0, misccfg; u_char eaddr[ETHER_ADDR_LEN]; - int error, msicount, phy_addr, reg, rid, trys; + int error, f, msicount, phy_addr, reg, rid, trys; sc = device_get_softc(dev); sc->bge_dev = dev; @@ -2594,14 +2664,55 @@ bge_attach(device_t dev) sc->bge_chipid = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) >> BGE_PCIMISCCTL_ASICREV_SHIFT; - if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_USE_PRODID_REG) - sc->bge_chipid = pci_read_config(dev, BGE_PCI_PRODID_ASICREV, - 4); + if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_USE_PRODID_REG) { + /* + * Find the ASCI revision. Different chips use different + * registers. + */ + switch (pci_get_device(dev)) { + case BCOM_DEVICEID_BCM5717: + case BCOM_DEVICEID_BCM5718: + sc->bge_chipid = pci_read_config(dev, + BGE_PCI_GEN2_PRODID_ASICREV, 4); + break; + default: + sc->bge_chipid = pci_read_config(dev, + BGE_PCI_PRODID_ASICREV, 4); + } + } sc->bge_asicrev = BGE_ASICREV(sc->bge_chipid); sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid); /* Set default PHY address. */ phy_addr = 1; + /* + * PHY address mapping for various devices. + * + * | F0 Cu | F0 Sr | F1 Cu | F1 Sr | + * ---------+-------+-------+-------+-------+ + * BCM57XX | 1 | X | X | X | + * BCM5704 | 1 | X | 1 | X | + * BCM5717 | 1 | 8 | 2 | 9 | + * + * Other addresses may respond but they are not + * IEEE compliant PHYs and should be ignored. + */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) { + f = pci_get_function(dev); + if (sc->bge_chipid == BGE_CHIPID_BCM5717_A0) { + if (CSR_READ_4(sc, BGE_SGDIG_STS) & + BGE_SGDIGSTS_IS_SERDES) + phy_addr = f + 8; + else + phy_addr = f + 1; + } else if (sc->bge_chipid == BGE_CHIPID_BCM5717_B0) { + if (CSR_READ_4(sc, BGE_CPMU_PHY_STRAP) & + BGE_CPMU_PHY_STRAP_IS_SERDES) + phy_addr = f + 8; + else + phy_addr = f + 1; + } + } /* * Don't enable Ethernet@WireSpeed for the 5700, 5906, or the @@ -2610,7 +2721,8 @@ bge_attach(device_t dev) if (sc->bge_asicrev != BGE_ASICREV_BCM5700 && sc->bge_asicrev != BGE_ASICREV_BCM5906 && sc->bge_chipid != BGE_CHIPID_BCM5705_A0 && - sc->bge_chipid != BGE_CHIPID_BCM5705_A1) + sc->bge_chipid != BGE_CHIPID_BCM5705_A1 && + !BGE_IS_5717_PLUS(sc)) sc->bge_phy_flags |= BGE_PHY_WIRESPEED; if (bge_has_eaddr(sc)) @@ -2618,6 +2730,11 @@ bge_attach(device_t dev) /* Save chipset family. */ switch (sc->bge_asicrev) { + case BGE_ASICREV_BCM5717: + sc->bge_flags |= BGE_FLAG_5717_PLUS | BGE_FLAG_5755_PLUS | + BGE_FLAG_575X_PLUS | BGE_FLAG_5705_PLUS | BGE_FLAG_JUMBO | + BGE_FLAG_SHORT_DMA_BUG | BGE_FLAG_JUMBO_FRAME; + break; case BGE_ASICREV_BCM5755: case BGE_ASICREV_BCM5761: case BGE_ASICREV_BCM5784: @@ -2663,6 +2780,7 @@ bge_attach(device_t dev) sc->bge_phy_flags |= BGE_PHY_NO_3LED; if ((BGE_IS_5705_PLUS(sc)) && sc->bge_asicrev != BGE_ASICREV_BCM5906 && + sc->bge_asicrev != BGE_ASICREV_BCM5717 && sc->bge_asicrev != BGE_ASICREV_BCM5785 && sc->bge_asicrev != BGE_ASICREV_BCM57780) { if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || @@ -2679,7 +2797,8 @@ bge_attach(device_t dev) } /* Identify the chips that use an CPMU. */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5784 || + if (BGE_IS_5717_PLUS(sc) || + sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || sc->bge_asicrev == BGE_ASICREV_BCM57780) @@ -2722,7 +2841,10 @@ bge_attach(device_t dev) * the TSO to the controllers that are not affected TSO issues * (e.g. 5755 or higher). */ - if (BGE_IS_5755_PLUS(sc)) { + if (BGE_IS_5717_PLUS(sc)) { + /* BCM5717 requires different TSO configuration. */ + sc->bge_flags |= BGE_FLAG_TSO3; + } else if (BGE_IS_5755_PLUS(sc)) { /* * BCM5754 and BCM5787 shares the same ASIC id so * explicit device id check is required. @@ -2785,6 +2907,16 @@ bge_attach(device_t dev) } } + /* + * All controllers except BCM5700 supports tagged status but + * we use tagged status only for MSI case on BCM5717. Otherwise + * MSI on BCM5717 does not work. + */ +#ifndef DEVICE_POLLING + if (sc->bge_flags & BGE_FLAG_MSI && BGE_IS_5717_PLUS(sc)) + sc->bge_flags |= BGE_FLAG_TAGGED_STATUS; +#endif + sc->bge_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); @@ -2848,7 +2980,9 @@ bge_attach(device_t dev) } /* 5705 limits RX return ring to 512 entries. */ - if (BGE_IS_5705_PLUS(sc)) + if (BGE_IS_5717_PLUS(sc)) + sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT; + else if (BGE_IS_5705_PLUS(sc)) sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT_5705; else sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT; @@ -2893,7 +3027,7 @@ bge_attach(device_t dev) ifp->if_hwassist = sc->bge_csum_features; ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; - if ((sc->bge_flags & BGE_FLAG_TSO) != 0) { + if ((sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) != 0) { ifp->if_hwassist |= CSUM_TSO; ifp->if_capabilities |= IFCAP_TSO4 | IFCAP_VLAN_HWTSO; } @@ -3340,6 +3474,7 @@ bge_reset(struct bge_softc *sc) /* XXX: Broadcom Linux driver. */ if (sc->bge_flags & BGE_FLAG_PCIE && + sc->bge_asicrev != BGE_ASICREV_BCM5717 && sc->bge_chipid != BGE_CHIPID_BCM5750_A0 && sc->bge_asicrev != BGE_ASICREV_BCM5785) { /* Enable Data FIFO protection. */ @@ -3480,20 +3615,8 @@ bge_rxeof(struct bge_softc *sc, uint16_t m->m_pkthdr.len = m->m_len = cur_rx->bge_len - ETHER_CRC_LEN; m->m_pkthdr.rcvif = ifp; - if (ifp->if_capenable & IFCAP_RXCSUM) { - if (cur_rx->bge_flags & BGE_RXBDFLAG_IP_CSUM) { - m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; - if ((cur_rx->bge_ip_csum ^ 0xFFFF) == 0) - m->m_pkthdr.csum_flags |= CSUM_IP_VALID; - } - if (cur_rx->bge_flags & BGE_RXBDFLAG_TCP_UDP_CSUM && - m->m_pkthdr.len >= ETHER_MIN_NOPAD) { - m->m_pkthdr.csum_data = - cur_rx->bge_tcp_udp_csum; - m->m_pkthdr.csum_flags |= - CSUM_DATA_VALID | CSUM_PSEUDO_HDR; - } - } + if (ifp->if_capenable & IFCAP_RXCSUM) + bge_rxcsum(sc, cur_rx, m); /* * If we received a packet with a vlan tag, @@ -3550,6 +3673,41 @@ bge_rxeof(struct bge_softc *sc, uint16_t } static void +bge_rxcsum(struct bge_softc *sc, struct bge_rx_bd *cur_rx, struct mbuf *m) +{ + + if (BGE_IS_5717_PLUS(sc)) { + if ((cur_rx->bge_flags & BGE_RXBDFLAG_IPV6) == 0) { + if (cur_rx->bge_flags & BGE_RXBDFLAG_IP_CSUM) { + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if ((cur_rx->bge_error_flag & + BGE_RXERRFLAG_IP_CSUM_NOK) == 0) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + } + if (cur_rx->bge_flags & BGE_RXBDFLAG_TCP_UDP_CSUM) { + m->m_pkthdr.csum_data = + cur_rx->bge_tcp_udp_csum; + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | + CSUM_PSEUDO_HDR; + } + } + } else { + if (cur_rx->bge_flags & BGE_RXBDFLAG_IP_CSUM) { + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if ((cur_rx->bge_ip_csum ^ 0xFFFF) == 0) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + } + if (cur_rx->bge_flags & BGE_RXBDFLAG_TCP_UDP_CSUM && + m->m_pkthdr.len >= ETHER_MIN_NOPAD) { + m->m_pkthdr.csum_data = + cur_rx->bge_tcp_udp_csum; + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | + CSUM_PSEUDO_HDR; + } + } +} + +static void bge_txeof(struct bge_softc *sc, uint16_t tx_cons) { struct bge_tx_bd *cur_tx; @@ -3664,7 +3822,7 @@ bge_intr_task(void *arg, int pending) { struct bge_softc *sc; struct ifnet *ifp; - uint32_t status; + uint32_t status, status_tag; uint16_t rx_prod, tx_cons; sc = (struct bge_softc *)arg; @@ -3685,16 +3843,19 @@ bge_intr_task(void *arg, int pending) rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx; tx_cons = sc->bge_ldata.bge_status_block->bge_idx[0].bge_tx_cons_idx; status = sc->bge_ldata.bge_status_block->bge_status; + status_tag = sc->bge_ldata.bge_status_block->bge_status_tag << 24; sc->bge_ldata.bge_status_block->bge_status = 0; bus_dmamap_sync(sc->bge_cdata.bge_status_tag, sc->bge_cdata.bge_status_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + if ((sc->bge_flags & BGE_FLAG_TAGGED_STATUS) == 0) + status_tag = 0; if ((status & BGE_STATFLAG_LINKSTATE_CHANGED) != 0) bge_link_upd(sc); /* Let controller work. */ - bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); + bge_writembx(sc, BGE_MBX_IRQ0_LO, status_tag); if (ifp->if_drv_flags & IFF_DRV_RUNNING && sc->bge_rx_saved_considx != rx_prod) { @@ -4100,7 +4261,8 @@ bge_check_short_dma(struct mbuf *m) } static struct mbuf * -bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss) +bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss, + uint16_t *flags) { struct ip *ip; struct tcphdr *tcp; @@ -4143,14 +4305,30 @@ bge_setup_tso(struct bge_softc *sc, stru * Broadcom controllers uses different descriptor format for * TSO depending on ASIC revision. Due to TSO-capable firmware * license issue and lower performance of firmware based TSO - * we only support hardware based TSO which is applicable for - * BCM5755 or newer controllers. Hardware based TSO uses 11 - * bits to store MSS and upper 5 bits are used to store IP/TCP - * header length(including IP/TCP options). The header length - * is expressed as 32 bits unit. + * we only support hardware based TSO. */ + /* Calculate header length, incl. TCP/IP options, in 32 bit units. */ hlen = ((ip->ip_hl << 2) + (tcp->th_off << 2)) >> 2; - *mss |= (hlen << 11); + if (sc->bge_flags & BGE_FLAG_TSO3) { + /* + * For BCM5717 and newer controllers, hardware based TSO + * uses the 14 lower bits of the bge_mss field to store the + * MSS and the upper 2 bits to store the lowest 2 bits of + * the IP/TCP header length. The upper 6 bits of the header + * length are stored in the bge_flags[14:10,4] field. Jumbo + * frames are supported. + */ + *mss |= ((hlen & 0x3) << 14); + *flags |= ((hlen & 0xF8) << 7) | ((hlen & 0x4) << 2); + } else { + /* + * For BCM5755 and newer controllers, hardware based TSO uses + * the lower 11 bits to store the MSS and the upper 5 bits to + * store the IP/TCP header length. Jumbo frames are not + * supported. + */ + *mss |= (hlen << 11); + } return (m); } @@ -4180,7 +4358,7 @@ bge_encap(struct bge_softc *sc, struct m m = *m_head; } if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { - *m_head = m = bge_setup_tso(sc, m, &mss); + *m_head = m = bge_setup_tso(sc, m, &mss, &csum_flags); if (*m_head == NULL) return (ENOBUFS); csum_flags |= BGE_TXBDFLAG_CPU_PRE_DMA | @@ -4203,21 +4381,26 @@ bge_encap(struct bge_softc *sc, struct m csum_flags |= BGE_TXBDFLAG_IP_FRAG; } - if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0 && - sc->bge_forced_collapse > 0 && - (sc->bge_flags & BGE_FLAG_PCIE) != 0 && m->m_next != NULL) { - /* - * Forcedly collapse mbuf chains to overcome hardware - * limitation which only support a single outstanding - * DMA read operation. - */ - if (sc->bge_forced_collapse == 1) - m = m_defrag(m, M_DONTWAIT); - else - m = m_collapse(m, M_DONTWAIT, sc->bge_forced_collapse); - if (m == NULL) - m = *m_head; - *m_head = m; + if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0) { + if (sc->bge_flags & BGE_FLAG_JUMBO_FRAME && + m->m_pkthdr.len > ETHER_MAX_LEN) + csum_flags |= BGE_TXBDFLAG_JUMBO_FRAME; + if (sc->bge_forced_collapse > 0 && + (sc->bge_flags & BGE_FLAG_PCIE) != 0 && m->m_next != NULL) { + /* + * Forcedly collapse mbuf chains to overcome hardware + * limitation which only support a single outstanding + * DMA read operation. + */ + if (sc->bge_forced_collapse == 1) + m = m_defrag(m, M_DONTWAIT); + else + m = m_collapse(m, M_DONTWAIT, + sc->bge_forced_collapse); + if (m == NULL) + m = *m_head; + *m_head = m; + } } map = sc->bge_cdata.bge_tx_dmamap[idx]; Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Mon Nov 8 19:53:16 2010 (r214999) +++ stable/7/sys/dev/bge/if_bgereg.h Mon Nov 8 19:54:44 2010 (r215000) @@ -82,6 +82,7 @@ #define BGE_UNMAPPED_END 0x00001FFF #define BGE_DMA_DESCRIPTORS 0x00002000 #define BGE_DMA_DESCRIPTORS_END 0x00003FFF +#define BGE_SEND_RING_5717 0x00004000 #define BGE_SEND_RING_1_TO_4 0x00004000 #define BGE_SEND_RING_1_TO_4_END 0x00005FFF @@ -100,6 +101,8 @@ #define BGE_BUFFPOOL_2_END 0x00017FFF #define BGE_BUFFPOOL_3 0x00018000 /* or expansion ROM */ #define BGE_BUFFPOOL_3_END 0x0001FFFF +#define BGE_STD_RX_RINGS_5717 0x00040000 +#define BGE_JUMBO_RX_RINGS_5717 0x00044400 /* Mappings for external SSRAM configurations */ #define BGE_SEND_RING_5_TO_6 0x00006000 @@ -219,6 +222,7 @@ #define BGE_PCI_ISR_MBX_HI 0xB0 #define BGE_PCI_ISR_MBX_LO 0xB4 #define BGE_PCI_PRODID_ASICREV 0xBC +#define BGE_PCI_GEN2_PRODID_ASICREV 0xF4 /* PCI Misc. Host control register */ #define BGE_PCIMISCCTL_CLEAR_INTA 0x00000001 @@ -229,6 +233,7 @@ #define BGE_PCIMISCCTL_CLOCKCTL_RW 0x00000020 #define BGE_PCIMISCCTL_REG_WORDSWAP 0x00000040 #define BGE_PCIMISCCTL_INDIRECT_ACCESS 0x00000080 +#define BGE_PCIMISCCTL_TAGGED_STATUS 0x00000200 #define BGE_PCIMISCCTL_ASICREV 0xFFFF0000 #define BGE_PCIMISCCTL_ASICREV_SHIFT 16 @@ -311,6 +316,8 @@ #define BGE_CHIPID_BCM5906_A2 0xc002 #define BGE_CHIPID_BCM57780_A0 0x57780000 #define BGE_CHIPID_BCM57780_A1 0x57780001 +#define BGE_CHIPID_BCM5717_A0 0x05717000 +#define BGE_CHIPID_BCM5717_B0 0x05717100 /* shorthand one */ #define BGE_ASICREV(x) ((x) >> 12) @@ -331,6 +338,7 @@ /* Should consult BGE_PCI_PRODID_ASICREV for ChipID */ #define BGE_ASICREV_USE_PRODID_REG 0x0f /* BGE_PCI_PRODID_ASICREV ASIC rev. identifiers. */ +#define BGE_ASICREV_BCM5717 0x5717 #define BGE_ASICREV_BCM5761 0x5761 #define BGE_ASICREV_BCM5784 0x5784 #define BGE_ASICREV_BCM5785 0x5785 @@ -348,11 +356,14 @@ #define BGE_CHIPREV_5750_AX 0x40 #define BGE_CHIPREV_5750_BX 0x41 /* BGE_PCI_PRODID_ASICREV chip rev. identifiers. */ +#define BGE_CHIPREV_5717_AX 0x57170 +#define BGE_CHIPREV_5717_BX 0x57171 #define BGE_CHIPREV_5761_AX 0x57611 #define BGE_CHIPREV_5784_AX 0x57841 /* PCI DMA Read/Write Control register */ #define BGE_PCIDMARWCTL_MINDMA 0x000000FF +#define BGE_PCIDMARWCTL_DIS_CACHE_ALIGNMENT 0x00000001 #define BGE_PCIDMARWCTL_RDADRR_BNDRY 0x00000700 #define BGE_PCIDMARWCTL_WRADDR_BNDRY 0x00003800 #define BGE_PCIDMARWCTL_ONEDMA_ATONCE 0x0000C000 @@ -566,6 +577,7 @@ #define BGE_TX_RINGS_MAX 4 #define BGE_TX_RINGS_EXTSSRAM_MAX 16 #define BGE_RX_RINGS_MAX 16 +#define BGE_RX_RINGS_MAX_5717 17 /* Ethernet MAC control registers */ #define BGE_MAC_MODE 0x0400 @@ -843,9 +855,10 @@ #define BGE_SGDIGCFG_AUTO 0x80000000 /* SGDIG status (not documented) */ +#define BGE_SGDIGSTS_DONE 0x00000002 +#define BGE_SGDIGSTS_IS_SERDES 0x00000100 #define BGE_SGDIGSTS_PAUSE_CAP 0x00080000 #define BGE_SGDIGSTS_ASYM_PAUSE 0x00100000 -#define BGE_SGDIGSTS_DONE 0x00000002 /* MI communication register */ @@ -911,6 +924,7 @@ #define BGE_SDIMODE_RESET 0x00000001 #define BGE_SDIMODE_ENABLE 0x00000002 #define BGE_SDIMODE_STATS_OFLOW_ATTN 0x00000004 +#define BGE_SDIMODE_HW_LSO_PRE_DMA 0x00000008 /* Send Data Initiator stats register */ #define BGE_SDISTAT_STATS_OFLOW_ATTN 0x00000004 @@ -1188,6 +1202,9 @@ #define BGE_RBDI_STD_REPL_THRESH 0x2C18 #define BGE_RBDI_JUMBO_REPL_THRESH 0x2C1C +#define BGE_STD_REPLENISH_LWM 0x2D00 +#define BGE_JMB_REPLENISH_LWM 0x2D04 + /* Receive BD Initiator Mode register */ #define BGE_RBDIMODE_RESET 0x00000001 #define BGE_RBDIMODE_ENABLE 0x00000002 @@ -1501,6 +1518,7 @@ #define BGE_RDMAMODE_MBUF_SBD_CRPT_ATTN 0x00002000 #define BGE_RDMAMODE_FIFO_SIZE_128 0x00020000 #define BGE_RDMAMODE_FIFO_LONG_BURST 0x00030000 +#define BGE_RDMAMODE_MULT_DMA_RD_DIS 0x01000000 #define BGE_RDMAMODE_TSO4_ENABLE 0x08000000 #define BGE_RDMAMODE_TSO6_ENABLE 0x10000000 @@ -2068,15 +2086,27 @@ struct bge_tx_bd { #define BGE_TXBDFLAG_IP_CSUM 0x0002 #define BGE_TXBDFLAG_END 0x0004 #define BGE_TXBDFLAG_IP_FRAG 0x0008 +#define BGE_TXBDFLAG_JUMBO_FRAME 0x0008 /* 5717 */ #define BGE_TXBDFLAG_IP_FRAG_END 0x0010 +#define BGE_TXBDFLAG_HDRLEN_BIT2 0x0010 /* 5717 */ +#define BGE_TXBDFLAG_SNAP 0x0020 /* 5717 */ #define BGE_TXBDFLAG_VLAN_TAG 0x0040 #define BGE_TXBDFLAG_COAL_NOW 0x0080 #define BGE_TXBDFLAG_CPU_PRE_DMA 0x0100 #define BGE_TXBDFLAG_CPU_POST_DMA 0x0200 +#define BGE_TXBDFLAG_HDRLEN_BIT3 0x0400 /* 5717 */ +#define BGE_TXBDFLAG_HDRLEN_BIT4 0x0800 /* 5717 */ #define BGE_TXBDFLAG_INSERT_SRC_ADDR 0x1000 +#define BGE_TXBDFLAG_HDRLEN_BIT5 0x1000 /* 5717 */ +#define BGE_TXBDFLAG_HDRLEN_BIT6 0x2000 /* 5717 */ +#define BGE_TXBDFLAG_HDRLEN_BIT7 0x4000 /* 5717 */ #define BGE_TXBDFLAG_CHOOSE_SRC_ADDR 0x6000 #define BGE_TXBDFLAG_NO_CRC 0x8000 +#define BGE_TXBDFLAG_MSS_SIZE_MASK 0x3FFF /* 5717 */ +/* Bits [1:0] of the MSS header length. */ +#define BGE_TXBDFLAG_MSS_HDRLEN_MASK 0xC000 /* 5717 */ + #define BGE_NIC_TXRING_ADDR(ringno, size) \ BGE_SEND_RING_1_TO_4 + \ ((ringno * sizeof(struct bge_tx_bd) * size) / 4) @@ -2153,6 +2183,7 @@ struct bge_extrx_bd { #define BGE_RXBDFLAG_IP_CSUM 0x1000 #define BGE_RXBDFLAG_TCP_UDP_CSUM 0x2000 #define BGE_RXBDFLAG_TCP_UDP_IS_TCP 0x4000 +#define BGE_RXBDFLAG_IPV6 0x8000 #define BGE_RXERRFLAG_BAD_CRC 0x0001 #define BGE_RXERRFLAG_COLL_DETECT 0x0002 @@ -2162,6 +2193,7 @@ struct bge_extrx_bd { #define BGE_RXERRFLAG_RUNT 0x0020 #define BGE_RXERRFLAG_TRUNC_NO_RSRCS 0x0040 #define BGE_RXERRFLAG_GIANT 0x0080 +#define BGE_RXERRFLAG_IP_CSUM_NOK 0x1000 /* 5717 */ struct bge_sts_idx { #if BYTE_ORDER == LITTLE_ENDIAN @@ -2175,7 +2207,7 @@ struct bge_sts_idx { struct bge_status_block { uint32_t bge_status; - uint32_t bge_rsvd0; + uint32_t bge_status_tag; #if BYTE_ORDER == LITTLE_ENDIAN uint16_t bge_rx_jumbo_cons_idx; uint16_t bge_rx_std_cons_idx; @@ -2221,6 +2253,8 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5714S 0x1669 #define BCOM_DEVICEID_BCM5715 0x1678 #define BCOM_DEVICEID_BCM5715S 0x1679 +#define BCOM_DEVICEID_BCM5717 0x1655 +#define BCOM_DEVICEID_BCM5718 0x1656 #define BCOM_DEVICEID_BCM5720 0x1658 #define BCOM_DEVICEID_BCM5721 0x1659 #define BCOM_DEVICEID_BCM5722 0x165A @@ -2717,16 +2751,20 @@ struct bge_softc { #define BGE_FLAG_EADDR 0x00000008 #define BGE_FLAG_MII_SERDES 0x00000010 #define BGE_FLAG_CPMU_PRESENT 0x00000020 +#define BGE_FLAG_TAGGED_STATUS 0x00000040 #define BGE_FLAG_MSI 0x00000100 #define BGE_FLAG_PCIX 0x00000200 #define BGE_FLAG_PCIE 0x00000400 #define BGE_FLAG_TSO 0x00000800 +#define BGE_FLAG_TSO3 0x00001000 +#define BGE_FLAG_JUMBO_FRAME 0x00002000 #define BGE_FLAG_5700_FAMILY 0x00010000 #define BGE_FLAG_5705_PLUS 0x00020000 #define BGE_FLAG_5714_FAMILY 0x00040000 #define BGE_FLAG_575X_PLUS 0x00080000 #define BGE_FLAG_5755_PLUS 0x00100000 #define BGE_FLAG_5788 0x00200000 +#define BGE_FLAG_5717_PLUS 0x00400000 #define BGE_FLAG_40BIT_BUG 0x01000000 #define BGE_FLAG_4G_BNDRY_BUG 0x02000000 #define BGE_FLAG_RX_ALIGNBUG 0x04000000 From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 20:03:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38A501065674; Mon, 8 Nov 2010 20:03:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2702A8FC14; Mon, 8 Nov 2010 20:03:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8K3qYv050205; Mon, 8 Nov 2010 20:03:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8K3qE9050203; Mon, 8 Nov 2010 20:03:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011082003.oA8K3qE9050203@svn.freebsd.org> From: John Baldwin Date: Mon, 8 Nov 2010 20:03:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215001 - head/sys/x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:03:52 -0000 Author: jhb Date: Mon Nov 8 20:03:51 2010 New Revision: 215001 URL: http://svn.freebsd.org/changeset/base/215001 Log: Only dump the values of the PMC and CMCI local vector table entries on a local APIC if those LVT entries are valid. This quiets spurious illegal register local APIC errors during boot on a CPU that doesn't support those vectors. MFC after: 1 week Modified: head/sys/x86/x86/local_apic.c Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Mon Nov 8 19:54:44 2010 (r215000) +++ head/sys/x86/x86/local_apic.c Mon Nov 8 20:03:51 2010 (r215001) @@ -324,16 +324,21 @@ lapic_create(u_int apic_id, int boot_cpu void lapic_dump(const char* str) { + uint32_t maxlvt; + maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT; printf("cpu%d %s:\n", PCPU_GET(cpuid), str); printf(" ID: 0x%08x VER: 0x%08x LDR: 0x%08x DFR: 0x%08x\n", lapic->id, lapic->version, lapic->ldr, lapic->dfr); printf(" lint0: 0x%08x lint1: 0x%08x TPR: 0x%08x SVR: 0x%08x\n", lapic->lvt_lint0, lapic->lvt_lint1, lapic->tpr, lapic->svr); - printf(" timer: 0x%08x therm: 0x%08x err: 0x%08x pmc: 0x%08x\n", - lapic->lvt_timer, lapic->lvt_thermal, lapic->lvt_error, - lapic->lvt_pcint); - printf(" cmci: 0x%08x\n", lapic->lvt_cmci); + printf(" timer: 0x%08x therm: 0x%08x err: 0x%08x", + lapic->lvt_timer, lapic->lvt_thermal, lapic->lvt_error); + if (maxlvt >= LVT_PMC) + printf(" pmc: 0x%08x", lapic->lvt_pcint); + printf("\n"); + if (maxlvt >= LVT_CMCI) + printf(" cmci: 0x%08x\n", lapic->lvt_cmci); } void From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 20:05:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FB9F106564A; Mon, 8 Nov 2010 20:05:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 534448FC33; Mon, 8 Nov 2010 20:05:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8K5MvX050320; Mon, 8 Nov 2010 20:05:22 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8K5MxV050316; Mon, 8 Nov 2010 20:05:22 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011082005.oA8K5MxV050316@svn.freebsd.org> From: John Baldwin Date: Mon, 8 Nov 2010 20:05:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215002 - in head/sys: amd64/acpica amd64/amd64 i386/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:05:22 -0000 Author: jhb Date: Mon Nov 8 20:05:22 2010 New Revision: 215002 URL: http://svn.freebsd.org/changeset/base/215002 Log: A few small style and whitespace fixes. Modified: head/sys/amd64/acpica/madt.c head/sys/amd64/amd64/mp_machdep.c head/sys/i386/acpica/madt.c Modified: head/sys/amd64/acpica/madt.c ============================================================================== --- head/sys/amd64/acpica/madt.c Mon Nov 8 20:03:51 2010 (r215001) +++ head/sys/amd64/acpica/madt.c Mon Nov 8 20:05:22 2010 (r215002) @@ -203,8 +203,7 @@ madt_register(void *dummy __unused) apic_register_enumerator(&madt_enumerator); } -SYSINIT(madt_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, - madt_register, NULL); +SYSINIT(madt_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, madt_register, NULL); /* * Call the handler routine for each entry in the MADT table. Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Mon Nov 8 20:03:51 2010 (r215001) +++ head/sys/amd64/amd64/mp_machdep.c Mon Nov 8 20:05:22 2010 (r215002) @@ -422,7 +422,7 @@ cpu_add(u_int apic_id, char boot_cpu) } if (mp_ncpus < MAXCPU) { mp_ncpus++; - mp_maxid = mp_ncpus -1; + mp_maxid = mp_ncpus - 1; } if (bootverbose) printf("SMP: Added CPU %d (%s)\n", apic_id, boot_cpu ? "BSP" : @@ -445,7 +445,7 @@ cpu_mp_setmaxid(void) else KASSERT(mp_maxid >= mp_ncpus - 1, ("%s: counters out of sync: max %d, count %d", __func__, - mp_maxid, mp_ncpus)); + mp_maxid, mp_ncpus)); } int Modified: head/sys/i386/acpica/madt.c ============================================================================== --- head/sys/i386/acpica/madt.c Mon Nov 8 20:03:51 2010 (r215001) +++ head/sys/i386/acpica/madt.c Mon Nov 8 20:05:22 2010 (r215002) @@ -95,7 +95,6 @@ static struct apic_enumerator madt_enume madt_setup_io }; - /* * Look for an ACPI Multiple APIC Description Table ("APIC") */ From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 20:11:43 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B2A81065675; Mon, 8 Nov 2010 20:11:43 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85]) by mx1.freebsd.org (Postfix) with ESMTP id 07C028FC2E; Mon, 8 Nov 2010 20:11:43 +0000 (UTC) Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1]) by dragon.nuxi.org (8.14.4/8.14.4) with ESMTP id oA8KBgaD090910; Mon, 8 Nov 2010 12:11:42 -0800 (PST) (envelope-from obrien@dragon.nuxi.org) Received: (from obrien@localhost) by dragon.nuxi.org (8.14.4/8.14.4/Submit) id oA8KBgo6090909; Mon, 8 Nov 2010 12:11:42 -0800 (PST) (envelope-from obrien) Date: Mon, 8 Nov 2010 12:11:42 -0800 From: "David O'Brien" To: Juli Mallett Message-ID: <20101108201142.GB90846@dragon.NUXI.org> References: <201011072322.oA7NMhb0092364@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=unknown-8bit Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: FreeBSD 9.0-CURRENT X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? User-Agent: Mutt/1.5.16 (2007-06-09) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r214961 - head/usr.bin/yacc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@FreeBSD.org List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:11:43 -0000 On Sun, Nov 07, 2010 at 05:54:20PM -0800, Juli Mallett wrote: > On Sun, Nov 7, 2010 at 15:22, David E. O'Brien wrote: > > Author: obrien > > Date: Sun Nov  7 23:22:42 2010 > > New Revision: 214961 > > URL: http://svn.freebsd.org/changeset/base/214961 > > > > Log: > >  Directly use memory allocation functions and remove needless casts in > >  their usage.  Also use associated modern types instead of k&r ones. > > You do know that changing skeleton.c affects the generated files, > right? Yes Juli, I know how byacc works. > I'm wondering if whatever sed script you're > judiciously-applying knows that. C++ does not do implicit conversions > from "void *" so you need the casts on the mallocs there. The changes I made were tested on building several other applications. > With a C++ compiler: But as you indirectly point out -- they were all C applications. -- -- David (obrien@FreeBSD.org) From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 20:14:39 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 524F3106564A; Mon, 8 Nov 2010 20:14:39 +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 3F0CE8FC15; Mon, 8 Nov 2010 20:14:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8KEdOE050871; Mon, 8 Nov 2010 20:14:39 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8KEdcB050869; Mon, 8 Nov 2010 20:14:39 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011082014.oA8KEdcB050869@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Nov 2010 20:14:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215003 - stable/8/sys/dev/alc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:14:39 -0000 Author: yongari Date: Mon Nov 8 20:14:38 2010 New Revision: 215003 URL: http://svn.freebsd.org/changeset/base/215003 Log: MFC r214542: Don't bother to enable ASPM L1 to save more power. Even though I am not able to trigger the issue with sample boards, some users seems to suffer from freeze/lockup when system is booted without UTP cable plugged in. I'm not sure whether this is BIOS issue or controller bug. This change fixes AR8132 lockup issue seen on EEE PC. Reported by: kmoore Tested by: kmoore Modified: stable/8/sys/dev/alc/if_alc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/alc/if_alc.c ============================================================================== --- stable/8/sys/dev/alc/if_alc.c Mon Nov 8 20:05:22 2010 (r215002) +++ stable/8/sys/dev/alc/if_alc.c Mon Nov 8 20:14:38 2010 (r215003) @@ -331,8 +331,8 @@ alc_miibus_statchg(device_t dev) reg = CSR_READ_4(sc, ALC_MAC_CFG); reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); + alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); } - alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); } static void From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 20:16:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDA18106566C; Mon, 8 Nov 2010 20:16:42 +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 DB6A78FC22; Mon, 8 Nov 2010 20:16:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8KGgsI051027; Mon, 8 Nov 2010 20:16:42 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8KGgGG051025; Mon, 8 Nov 2010 20:16:42 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011082016.oA8KGgGG051025@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Nov 2010 20:16:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215004 - stable/7/sys/dev/alc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:16:43 -0000 Author: yongari Date: Mon Nov 8 20:16:42 2010 New Revision: 215004 URL: http://svn.freebsd.org/changeset/base/215004 Log: MFC r214542: Don't bother to enable ASPM L1 to save more power. Even though I am not able to trigger the issue with sample boards, some users seems to suffer from freeze/lockup when system is booted without UTP cable plugged in. I'm not sure whether this is BIOS issue or controller bug. This change fixes AR8132 lockup issue seen on EEE PC. Reported by: kmoore Tested by: kmoore Modified: stable/7/sys/dev/alc/if_alc.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/alc/if_alc.c ============================================================================== --- stable/7/sys/dev/alc/if_alc.c Mon Nov 8 20:14:38 2010 (r215003) +++ stable/7/sys/dev/alc/if_alc.c Mon Nov 8 20:16:42 2010 (r215004) @@ -331,8 +331,8 @@ alc_miibus_statchg(device_t dev) reg = CSR_READ_4(sc, ALC_MAC_CFG); reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); + alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); } - alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); } static void From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 20:21:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D7F1106566B; Mon, 8 Nov 2010 20:21:25 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A60B8FC29; Mon, 8 Nov 2010 20:21: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 oA8KLP7I051364; Mon, 8 Nov 2010 20:21:25 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8KLPRt051362; Mon, 8 Nov 2010 20:21:25 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201011082021.oA8KLPRt051362@svn.freebsd.org> From: Ulrich Spoerlein Date: Mon, 8 Nov 2010 20:21:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215005 - in stable: 7/share/misc 8/share/misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:21:25 -0000 Author: uqs Date: Mon Nov 8 20:21:24 2010 New Revision: 215005 URL: http://svn.freebsd.org/changeset/base/215005 Log: MFC r173289,174783,175454,191681,191698,191834,195044,197304,198210,199858-199859,201348,205578,208327,208336,210871,214628: Sync bsd-family-tree with head. Modified: stable/8/share/misc/bsd-family-tree Directory Properties: stable/8/share/misc/ (props changed) Changes in other areas also in this revision: Modified: stable/7/share/misc/bsd-family-tree Directory Properties: stable/7/share/misc/ (props changed) Modified: stable/8/share/misc/bsd-family-tree ============================================================================== --- stable/8/share/misc/bsd-family-tree Mon Nov 8 20:16:42 2010 (r215004) +++ stable/8/share/misc/bsd-family-tree Mon Nov 8 20:21:24 2010 (r215005) @@ -151,7 +151,7 @@ FreeBSD 4.0 | | | | | NetBSD 1. | FreeBSD 4.5 | | | | | | | | \ | | | | BSD/OS 4.3 | FreeBSD 4.6 \ | | | OpenBSD 3.1 | - | | \ | | NetBSD 1.5.3 | | + | | \ | | NetBSD 1.5.3 | | | FreeBSD 4.6.2 Mac OS X | | | | | 10.2 | | | | FreeBSD 4.7 | | | | @@ -228,10 +228,22 @@ FreeBSD 5.2 | | | FreeBSD 7.1 | | | | | | | | | DragonFly 2.2.0 | FreeBSD 7.2 | NetBSD 5.0 OpenBSD 4.5 | - | | | | | | + | \ | | | | + | | | | | DragonFly 2.4.0 + | | | | OpenBSD 4.6 | + | | | | | | + *--FreeBSD | | | | | + | 8.0 | | | | | + | | FreeBSD | | | | + | | 7.3 | | | DragonFly 2.6.0 + | | | | OpenBSD 4.7 | + | FreeBSD | | | | + | 8.1 | | | | + | | | | | DragonFly 2.8.0 + | | | | OpenBSD 4.8 | | V | | | | | | | | | -FreeBSD 8 -current | NetBSD -current OpenBSD -current | +FreeBSD 9 -current | NetBSD -current OpenBSD -current | | | | | | v v v v v @@ -502,6 +514,15 @@ DragonFly 2.2.0 2009-02-17 [DFB] NetBSD 5.0 2009-04-29 [NBD] OpenBSD 4.5 2009-05-01 [OBD] FreeBSD 7.2 2009-05-04 [FBD] +DragonFly 2.4.0 2009-09-16 [DFB] +OpenBSD 4.6 2009-10-18 [OBD] +FreeBSD 8.0 2009-11-26 [FBD] +FreeBSD 7.3 2010-03-23 [FBD] +DragonFly 2.6.0 2010-03-28 [DFB] +OpenBSD 4.7 2010-05-19 [OBD] +FreeBSD 8.1 2010-07-24 [FBD] +DragonFly 2.8.0 2010-10-30 [DFB] +OpenBSD 4.8 2010-11-01 [OBD] Bibliography ------------------------ @@ -534,7 +555,7 @@ Andreas Klemm, Lars Köller. If you're go Die freien BSD-Varianten von Unix. c't April 1997, page 368ff. BSD Release Announcements collection. -URL: http://www.de.FreeBSD.org/de/ftp/releases/ +URL: http://www.FreeBSD.org/releases/ BSD Hypertext Man Pages URL: http://www.FreeBSD.org/cgi/man.cgi From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 20:21:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E1141065670; Mon, 8 Nov 2010 20:21:25 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5AD1C8FC3D; Mon, 8 Nov 2010 20:21: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 oA8KLPsI051370; Mon, 8 Nov 2010 20:21:25 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8KLPZv051368; Mon, 8 Nov 2010 20:21:25 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201011082021.oA8KLPZv051368@svn.freebsd.org> From: Ulrich Spoerlein Date: Mon, 8 Nov 2010 20:21: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: r215005 - in stable: 7/share/misc 8/share/misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:21:25 -0000 Author: uqs Date: Mon Nov 8 20:21:24 2010 New Revision: 215005 URL: http://svn.freebsd.org/changeset/base/215005 Log: MFC r173289,174783,175454,191681,191698,191834,195044,197304,198210,199858-199859,201348,205578,208327,208336,210871,214628: Sync bsd-family-tree with head. Modified: stable/7/share/misc/bsd-family-tree Directory Properties: stable/7/share/misc/ (props changed) Changes in other areas also in this revision: Modified: stable/8/share/misc/bsd-family-tree Directory Properties: stable/8/share/misc/ (props changed) Modified: stable/7/share/misc/bsd-family-tree ============================================================================== --- stable/7/share/misc/bsd-family-tree Mon Nov 8 20:16:42 2010 (r215004) +++ stable/7/share/misc/bsd-family-tree Mon Nov 8 20:21:24 2010 (r215005) @@ -25,7 +25,7 @@ Seventh Edition (V7) | \/ | 3BSD | | | - 4.0BSD 2.7.9BSD + 4.0BSD 2.79BSD | | 4.1BSD --------------> 2.8BSD | | @@ -151,7 +151,7 @@ FreeBSD 4.0 | | | | | NetBSD 1. | FreeBSD 4.5 | | | | | | | | \ | | | | BSD/OS 4.3 | FreeBSD 4.6 \ | | | OpenBSD 3.1 | - | | \ | | NetBSD 1.5.3 | | + | | \ | | NetBSD 1.5.3 | | | FreeBSD 4.6.2 Mac OS X | | | | | 10.2 | | | | FreeBSD 4.7 | | | | @@ -228,10 +228,22 @@ FreeBSD 5.2 | | | FreeBSD 7.1 | | | | | | | | | DragonFly 2.2.0 | FreeBSD 7.2 | NetBSD 5.0 OpenBSD 4.5 | - | | | | | | + | \ | | | | + | | | | | DragonFly 2.4.0 + | | | | OpenBSD 4.6 | + | | | | | | + *--FreeBSD | | | | | + | 8.0 | | | | | + | | FreeBSD | | | | + | | 7.3 | | | DragonFly 2.6.0 + | | | | OpenBSD 4.7 | + | FreeBSD | | | | + | 8.1 | | | | + | | | | | DragonFly 2.8.0 + | | | | OpenBSD 4.8 | | V | | | | | | | | | -FreeBSD 8 -current | NetBSD -current OpenBSD -current | +FreeBSD 9 -current | NetBSD -current OpenBSD -current | | | | | | v v v v v @@ -260,6 +272,7 @@ was the announcement in Usenet or if it [OBD] OpenBSD Project, The. [QCU] Salus, Peter H. A quarter century of UNIX. [SMS] Steven M. Schultz. 2.11BSD, UNIX for the PDP-11. +[TUHS] The Unix Historical Society. http://minnie.tuhs.org/Unix_History/. [USE] Usenet announcement. [WRS] Wind River Systems, Inc. [dmr] Dennis Ritchie, via E-Mail @@ -297,15 +310,15 @@ Tenth Edition 1989-10-xx [QCU] PDP-11, Pascal, ex(1) 30 free copies of 1BSD sent out 35 tapes sold for 50 USD [QCU] -2BSD mid 1978 [QCU] +2BSD mid 1978 [QCU] 1979-05-10 [TUHS] 75 2BSD tapes shipped -2.7.9BSD ?? [SMS] +2.79BSD 1980-04-xx [TUHS] 2.8BSD 1981-07-xx [KSJ] 2.8.1BSD 1982-01-xx [QCU] set of performance improvements 2.9BSD 1983-07-xx [KSJ] -2.9.1BSD 1983-11-xx +2.9.1BSD 1983-11-xx [TUHS] 2.9BSD-Seismo 1985-08-xx [SMS] 2.10BSD 1987-04-xx [KKK] 2.10.1BSD 1989-01-xx [SMS] @@ -313,7 +326,7 @@ Tenth Edition 1989-10-xx [QCU] 2.11BSD rev #430 1999-12-13 [SMS] 32V 1978-1[01]-xx [QCU] -3BSD late 1979 [QCU] +3BSD late 1979 [QCU] March 1980 [TUHS] virtual memory, page replacement, demand paging 4.0BSD 1980-10-xx @@ -501,6 +514,15 @@ DragonFly 2.2.0 2009-02-17 [DFB] NetBSD 5.0 2009-04-29 [NBD] OpenBSD 4.5 2009-05-01 [OBD] FreeBSD 7.2 2009-05-04 [FBD] +DragonFly 2.4.0 2009-09-16 [DFB] +OpenBSD 4.6 2009-10-18 [OBD] +FreeBSD 8.0 2009-11-26 [FBD] +FreeBSD 7.3 2010-03-23 [FBD] +DragonFly 2.6.0 2010-03-28 [DFB] +OpenBSD 4.7 2010-05-19 [OBD] +FreeBSD 8.1 2010-07-24 [FBD] +DragonFly 2.8.0 2010-10-30 [DFB] +OpenBSD 4.8 2010-11-01 [OBD] Bibliography ------------------------ @@ -533,7 +555,7 @@ Andreas Klemm, Lars Köller. If you're go Die freien BSD-Varianten von Unix. c't April 1997, page 368ff. BSD Release Announcements collection. -URL: http://www.de.FreeBSD.org/de/ftp/releases/ +URL: http://www.FreeBSD.org/releases/ BSD Hypertext Man Pages URL: http://www.FreeBSD.org/cgi/man.cgi From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 20:25:20 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27F50106564A; Mon, 8 Nov 2010 20:25:20 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C0458FC0C; Mon, 8 Nov 2010 20:25:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8KPJ6v051624; Mon, 8 Nov 2010 20:25:19 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8KPJrh051621; Mon, 8 Nov 2010 20:25:19 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201011082025.oA8KPJrh051621@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 8 Nov 2010 20:25:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215006 - in stable/8: share/man/man4 sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:25:20 -0000 Author: jkim Date: Mon Nov 8 20:25:19 2010 New Revision: 215006 URL: http://svn.freebsd.org/changeset/base/215006 Log: MFC: r213755 Use AcpiReset() from ACPICA instead of rolling our own, which is actually incomplete. If FADT says the register is available, enable the capability by default. Remove the previous default value from acpi(4). Modified: stable/8/share/man/man4/acpi.4 stable/8/sys/dev/acpica/acpi.c Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/share/man/man4/acpi.4 ============================================================================== --- stable/8/share/man/man4/acpi.4 Mon Nov 8 20:21:24 2010 (r215005) +++ stable/8/share/man/man4/acpi.4 Mon Nov 8 20:25:19 2010 (r215006) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 2, 2010 +.Dd October 12, 2010 .Dt ACPI 4 .Os .Sh NAME @@ -112,7 +112,6 @@ exiting to legacy mode first. Default is 0, leave ACPI enabled. .It Va hw.acpi.handle_reboot Use the ACPI Reset Register capability to reboot the system. -Default is 0, use legacy reboot support. Some newer systems require use of this register, while some only work with legacy rebooting support. .It Va hw.acpi.lid_switch_state Modified: stable/8/sys/dev/acpica/acpi.c ============================================================================== --- stable/8/sys/dev/acpica/acpi.c Mon Nov 8 20:21:24 2010 (r215005) +++ stable/8/sys/dev/acpica/acpi.c Mon Nov 8 20:25:19 2010 (r215006) @@ -590,6 +590,10 @@ acpi_attach(device_t dev) freeenv(env); } + /* Only enable reboot by default if the FADT says it is available. */ + if (AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER) + sc->acpi_handle_reboot = 1; + /* Only enable S4BIOS by default if the FACS says it is available. */ if (AcpiGbl_FACS->Flags & ACPI_FACS_S4_BIOS_PRESENT) sc->acpi_s4bios = 1; @@ -1828,19 +1832,15 @@ acpi_shutdown_final(void *arg, int howto DELAY(1000000); device_printf(sc->acpi_dev, "power-off failed - timeout\n"); } - } else if ((howto & RB_HALT) == 0 && - (AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER) && - sc->acpi_handle_reboot) { + } else if ((howto & RB_HALT) == 0 && sc->acpi_handle_reboot) { /* Reboot using the reset register. */ - status = AcpiWrite( - AcpiGbl_FADT.ResetValue, &AcpiGbl_FADT.ResetRegister); - if (ACPI_FAILURE(status)) - device_printf(sc->acpi_dev, "reset failed - %s\n", - AcpiFormatException(status)); - else { + status = AcpiReset(); + if (ACPI_SUCCESS(status)) { DELAY(1000000); device_printf(sc->acpi_dev, "reset failed - timeout\n"); - } + } else if (status != AE_NOT_EXIST) + device_printf(sc->acpi_dev, "reset failed - %s\n", + AcpiFormatException(status)); } else if (sc->acpi_do_disable && panicstr == NULL) { /* * Only disable ACPI if the user requested. On some systems, writing From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 20:31:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 141A3106566B; Mon, 8 Nov 2010 20:31:00 +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 BF02B8FC1C; Mon, 8 Nov 2010 20:30:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8KUxuX051941; Mon, 8 Nov 2010 20:30:59 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8KUx1P051939; Mon, 8 Nov 2010 20:30:59 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011082030.oA8KUx1P051939@svn.freebsd.org> From: John Baldwin Date: Mon, 8 Nov 2010 20:30:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215007 - head/sys/modules/acpi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:31:00 -0000 Author: jhb Date: Mon Nov 8 20:30:59 2010 New Revision: 215007 URL: http://svn.freebsd.org/changeset/base/215007 Log: Disconnect acpi.ko from the build on i386. ACPI is now only supported when compiled into the kernel, not as a loadable module. Modified: head/sys/modules/acpi/Makefile Modified: head/sys/modules/acpi/Makefile ============================================================================== --- head/sys/modules/acpi/Makefile Mon Nov 8 20:25:19 2010 (r215006) +++ head/sys/modules/acpi/Makefile Mon Nov 8 20:30:59 2010 (r215007) @@ -1,10 +1,6 @@ # $FreeBSD$ -.if ${MACHINE} == "i386" -SUBDIR= acpi -.endif - -SUBDIR+= acpi_asus acpi_fujitsu acpi_hp acpi_ibm \ +SUBDIR= acpi_asus acpi_fujitsu acpi_hp acpi_ibm \ acpi_panasonic acpi_sony acpi_toshiba acpi_video \ acpi_dock acpi_wmi aibs From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 20:32:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38AC9106564A; Mon, 8 Nov 2010 20:32:36 +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 0CFC58FC26; Mon, 8 Nov 2010 20:32: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 oA8KWZjF052052; Mon, 8 Nov 2010 20:32:35 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8KWZou052050; Mon, 8 Nov 2010 20:32:35 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011082032.oA8KWZou052050@svn.freebsd.org> From: John Baldwin Date: Mon, 8 Nov 2010 20:32:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215008 - head/sys/i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:32:36 -0000 Author: jhb Date: Mon Nov 8 20:32:35 2010 New Revision: 215008 URL: http://svn.freebsd.org/changeset/base/215008 Log: Remove stub symbols for APIC-related functions when 'device apic' is not included in a kernel config. These stubs had existed previously so that acpi.ko could always include the MADT parsing code and still link with a kernel that did not include 'device apic'. Modified: head/sys/i386/i386/machdep.c Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Mon Nov 8 20:30:59 2010 (r215007) +++ head/sys/i386/i386/machdep.c Mon Nov 8 20:32:35 2010 (r215008) @@ -40,7 +40,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_apic.h" #include "opt_atalk.h" #include "opt_compat.h" #include "opt_cpu.h" @@ -3614,102 +3613,6 @@ user_dbreg_trap(void) return 0; } -#ifndef DEV_APIC -#include - -/* - * Provide stub functions so that the MADT APIC enumerator in the acpi - * kernel module will link against a kernel without 'device apic'. - * - * XXX - This is a gross hack. - */ -void -apic_register_enumerator(struct apic_enumerator *enumerator) -{ -} - -void * -ioapic_create(vm_paddr_t addr, int32_t apic_id, int intbase) -{ - return (NULL); -} - -int -ioapic_disable_pin(void *cookie, u_int pin) -{ - return (ENXIO); -} - -int -ioapic_get_vector(void *cookie, u_int pin) -{ - return (-1); -} - -void -ioapic_register(void *cookie) -{ -} - -int -ioapic_remap_vector(void *cookie, u_int pin, int vector) -{ - return (ENXIO); -} - -int -ioapic_set_extint(void *cookie, u_int pin) -{ - return (ENXIO); -} - -int -ioapic_set_nmi(void *cookie, u_int pin) -{ - return (ENXIO); -} - -int -ioapic_set_polarity(void *cookie, u_int pin, enum intr_polarity pol) -{ - return (ENXIO); -} - -int -ioapic_set_triggermode(void *cookie, u_int pin, enum intr_trigger trigger) -{ - return (ENXIO); -} - -void -lapic_create(u_int apic_id, int boot_cpu) -{ -} - -void -lapic_init(vm_paddr_t addr) -{ -} - -int -lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode) -{ - return (ENXIO); -} - -int -lapic_set_lvt_polarity(u_int apic_id, u_int lvt, enum intr_polarity pol) -{ - return (ENXIO); -} - -int -lapic_set_lvt_triggermode(u_int apic_id, u_int lvt, enum intr_trigger trigger) -{ - return (ENXIO); -} -#endif - #ifdef KDB /* From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 20:35:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 267241065674; Mon, 8 Nov 2010 20:35:10 +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 13F5B8FC2C; Mon, 8 Nov 2010 20:35: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 oA8KZ9A2052222; Mon, 8 Nov 2010 20:35:09 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8KZ9c6052216; Mon, 8 Nov 2010 20:35:09 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011082035.oA8KZ9c6052216@svn.freebsd.org> From: John Baldwin Date: Mon, 8 Nov 2010 20:35:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215009 - in head/sys: i386/acpica i386/i386 i386/xen x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:35:10 -0000 Author: jhb Date: Mon Nov 8 20:35:09 2010 New Revision: 215009 URL: http://svn.freebsd.org/changeset/base/215009 Log: Sync the APIC startup sequence with amd64: - Register APIC enumerators at SI_SUB_TUNABLES - 1 instead of SI_SUB_CPU - 1. - Probe CPUs at SI_SUB_TUNABLES - 1. This allows i386 to set a truly accurate mp_maxid value rather than always setting it to MAXCPU - 1. Modified: head/sys/i386/acpica/madt.c head/sys/i386/i386/mp_machdep.c head/sys/i386/xen/mptable.c head/sys/x86/x86/local_apic.c head/sys/x86/x86/mptable.c Modified: head/sys/i386/acpica/madt.c ============================================================================== --- head/sys/i386/acpica/madt.c Mon Nov 8 20:32:35 2010 (r215008) +++ head/sys/i386/acpica/madt.c Mon Nov 8 20:35:09 2010 (r215009) @@ -203,7 +203,7 @@ madt_register(void *dummy __unused) apic_register_enumerator(&madt_enumerator); } -SYSINIT(madt_register, SI_SUB_CPU - 1, SI_ORDER_SECOND, madt_register, NULL); +SYSINIT(madt_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, madt_register, NULL); /* * Call the handler routine for each entry in the MADT table. Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Mon Nov 8 20:32:35 2010 (r215008) +++ head/sys/i386/i386/mp_machdep.c Mon Nov 8 20:35:09 2010 (r215009) @@ -465,8 +465,10 @@ cpu_add(u_int apic_id, char boot_cpu) boot_cpu_id = apic_id; cpu_info[apic_id].cpu_bsp = 1; } - if (mp_ncpus < MAXCPU) + if (mp_ncpus < MAXCPU) { mp_ncpus++; + mp_maxid = mp_ncpus - 1; + } if (bootverbose) printf("SMP: Added CPU %d (%s)\n", apic_id, boot_cpu ? "BSP" : "AP"); @@ -476,7 +478,19 @@ void cpu_mp_setmaxid(void) { - mp_maxid = MAXCPU - 1; + /* + * mp_maxid should be already set by calls to cpu_add(). + * Just sanity check its value here. + */ + if (mp_ncpus == 0) + KASSERT(mp_maxid == 0, + ("%s: mp_ncpus is zero, but mp_maxid is not", __func__)); + else if (mp_ncpus == 1) + mp_maxid = 0; + else + KASSERT(mp_maxid >= mp_ncpus - 1, + ("%s: counters out of sync: max %d, count %d", __func__, + mp_maxid, mp_ncpus)); } int @@ -504,6 +518,7 @@ cpu_mp_probe(void) * One CPU was found, so this must be a UP system with * an I/O APIC. */ + mp_maxid = 0; return (0); } Modified: head/sys/i386/xen/mptable.c ============================================================================== --- head/sys/i386/xen/mptable.c Mon Nov 8 20:32:35 2010 (r215008) +++ head/sys/i386/xen/mptable.c Mon Nov 8 20:35:09 2010 (r215009) @@ -109,7 +109,7 @@ mptable_register(void *dummy __unused) apic_register_enumerator(&mptable_enumerator); } -SYSINIT(mptable_register, SI_SUB_CPU - 1, SI_ORDER_FIRST, mptable_register, +SYSINIT(mptable_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, mptable_register, NULL); Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Mon Nov 8 20:32:35 2010 (r215008) +++ head/sys/x86/x86/local_apic.c Mon Nov 8 20:35:09 2010 (r215009) @@ -1285,7 +1285,7 @@ apic_init(void *dummy __unused) if (resource_disabled("apic", 0)) return; - /* First, probe all the enumerators to find the best match. */ + /* Probe all the enumerators to find the best match. */ best_enum = NULL; best = 0; SLIST_FOREACH(enumerator, &enumerators, apic_next) { @@ -1321,13 +1321,12 @@ apic_init(void *dummy __unused) } #endif - /* Second, probe the CPU's in the system. */ + /* Probe the CPU's in the system. */ retval = best_enum->apic_probe_cpus(); if (retval != 0) printf("%s: Failed to probe CPUs: returned %d\n", best_enum->apic_name, retval); -#ifdef __amd64__ } SYSINIT(apic_init, SI_SUB_TUNABLES - 1, SI_ORDER_SECOND, apic_init, NULL); @@ -1342,19 +1341,14 @@ apic_setup_local(void *dummy __unused) if (best_enum == NULL) return; -#endif - /* Third, initialize the local APIC. */ + + /* Initialize the local APIC. */ retval = best_enum->apic_setup_local(); if (retval != 0) printf("%s: Failed to setup the local APIC: returned %d\n", best_enum->apic_name, retval); } -#ifdef __amd64__ -SYSINIT(apic_setup_local, SI_SUB_CPU, SI_ORDER_SECOND, apic_setup_local, - NULL); -#else -SYSINIT(apic_init, SI_SUB_CPU, SI_ORDER_SECOND, apic_init, NULL); -#endif +SYSINIT(apic_setup_local, SI_SUB_CPU, SI_ORDER_SECOND, apic_setup_local, NULL); /* * Setup the I/O APICs. Modified: head/sys/x86/x86/mptable.c ============================================================================== --- head/sys/x86/x86/mptable.c Mon Nov 8 20:32:35 2010 (r215008) +++ head/sys/x86/x86/mptable.c Mon Nov 8 20:35:09 2010 (r215009) @@ -389,7 +389,7 @@ mptable_register(void *dummy __unused) apic_register_enumerator(&mptable_enumerator); } -SYSINIT(mptable_register, SI_SUB_CPU - 1, SI_ORDER_FIRST, mptable_register, +SYSINIT(mptable_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, mptable_register, NULL); /* From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 20:44:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 047C2106566B; Mon, 8 Nov 2010 20:44:12 +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 E74D28FC0A; Mon, 8 Nov 2010 20:44: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 oA8KiBa5052642; Mon, 8 Nov 2010 20:44:11 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8KiBEX052640; Mon, 8 Nov 2010 20:44:11 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011082044.oA8KiBEX052640@svn.freebsd.org> From: John Baldwin Date: Mon, 8 Nov 2010 20:44:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215010 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:44:12 -0000 Author: jhb Date: Mon Nov 8 20:44:11 2010 New Revision: 215010 URL: http://svn.freebsd.org/changeset/base/215010 Log: Don't mention 'device acpi' or loading ACPI as a kernel module since the latter is not supported. This is also more consistent with manpages for other vendor-specific drivers such as acpi_ibm(4) and acpi_sony(4). Modified: head/share/man/man4/aibs.4 Modified: head/share/man/man4/aibs.4 ============================================================================== --- head/share/man/man4/aibs.4 Mon Nov 8 20:35:09 2010 (r215009) +++ head/share/man/man4/aibs.4 Mon Nov 8 20:44:11 2010 (r215010) @@ -24,18 +24,16 @@ .Nd "ASUSTeK AI Booster ACPI ATK0110 voltage, temperature and fan sensor" .Sh SYNOPSIS To compile this driver into the kernel, -place the following lines in your +place the following line in your kernel configuration file: .Bd -ragged -offset indent -.Cd "device acpi" .Cd "device aibs" .Ed .Pp Alternatively, to load the driver as a -module at boot time, place the following lines in +module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -acpi_load="YES" aibs_load="YES" .Ed .Sh DESCRIPTION From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 20:56:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C00B9106566B; Mon, 8 Nov 2010 20:56:31 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ADCD68FC12; Mon, 8 Nov 2010 20:56:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8KuVM3053229; Mon, 8 Nov 2010 20:56:31 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8KuVoJ053224; Mon, 8 Nov 2010 20:56:31 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201011082056.oA8KuVoJ053224@svn.freebsd.org> From: Matthew D Fleming Date: Mon, 8 Nov 2010 20:56:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215011 - in head: share/man/man9 sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:56:31 -0000 Author: mdf Date: Mon Nov 8 20:56:31 2010 New Revision: 215011 URL: http://svn.freebsd.org/changeset/base/215011 Log: Add a taskqueue_cancel(9) to cancel a pending task without waiting for it to run as taskqueue_drain(9) does. Requested by: hselasky Original code: jeff Reviewed by: jhb MFC after: 2 weeks Modified: head/share/man/man9/Makefile head/share/man/man9/taskqueue.9 head/sys/kern/subr_taskqueue.c head/sys/sys/taskqueue.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Mon Nov 8 20:44:11 2010 (r215010) +++ head/share/man/man9/Makefile Mon Nov 8 20:56:31 2010 (r215011) @@ -1212,6 +1212,7 @@ MLINKS+=sysctl_ctx_init.9 sysctl_ctx_ent sysctl_ctx_init.9 sysctl_ctx_entry_find.9 \ sysctl_ctx_init.9 sysctl_ctx_free.9 MLINKS+=taskqueue.9 TASK_INIT.9 \ + taskqueue.9 taskqueue_cancel.9 \ taskqueue.9 taskqueue_create.9 \ taskqueue.9 taskqueue_create_fast.9 \ taskqueue.9 TASKQUEUE_DECLARE.9 \ Modified: head/share/man/man9/taskqueue.9 ============================================================================== --- head/share/man/man9/taskqueue.9 Mon Nov 8 20:44:11 2010 (r215010) +++ head/share/man/man9/taskqueue.9 Mon Nov 8 20:56:31 2010 (r215011) @@ -63,6 +63,8 @@ struct task { .Fn taskqueue_enqueue "struct taskqueue *queue" "struct task *task" .Ft int .Fn taskqueue_enqueue_fast "struct taskqueue *queue" "struct task *task" +.Ft int +.Fn taskqueue_cancel "struct taskqueue *queue" "struct task *task" "u_int *pendp" .Ft void .Fn taskqueue_drain "struct taskqueue *queue" "struct task *task" .Ft int @@ -162,6 +164,31 @@ is called on the task pointer passed to .Fn taskqueue_enqueue . .Pp The +.Fn taskqueue_cancel +function is used to cancel a task. +The +.Va ta_pending +count is cleared, and the old value returned in the reference +parameter +.Fa pendp , +if it is non- Dv NULL . +If the task is currently running, +.Dv EBUSY +is returned, otherwise 0. +To implement a blocking +.Fn taskqueue_cancel +that waits for a running task to finish, it could look like: +.Bd -literal -offset indent +while (taskqueue_cancel(tq, task, NULL) != 0) + taskqueue_drain(tq, task); +.Ed +.Pp +Note that, as with +.Fn taskqueue_drain , +the caller is responsible for ensuring that the task is not re-enqueued +after being canceled. +.Pp +The .Fn taskqueue_drain function is used to wait for the task to finish. There is no guarantee that the task will not be Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Mon Nov 8 20:44:11 2010 (r215010) +++ head/sys/kern/subr_taskqueue.c Mon Nov 8 20:56:31 2010 (r215011) @@ -275,6 +275,24 @@ task_is_running(struct taskqueue *queue, return (0); } +int +taskqueue_cancel(struct taskqueue *queue, struct task *task, u_int *pendp) +{ + u_int pending; + int error; + + TQ_LOCK(queue); + if ((pending = task->ta_pending) > 0) + STAILQ_REMOVE(&queue->tq_queue, task, task, ta_link); + task->ta_pending = 0; + error = task_is_running(queue, task) ? EBUSY : 0; + TQ_UNLOCK(queue); + + if (pendp != NULL) + *pendp = pending; + return (error); +} + void taskqueue_drain(struct taskqueue *queue, struct task *task) { Modified: head/sys/sys/taskqueue.h ============================================================================== --- head/sys/sys/taskqueue.h Mon Nov 8 20:44:11 2010 (r215010) +++ head/sys/sys/taskqueue.h Mon Nov 8 20:56:31 2010 (r215011) @@ -54,6 +54,8 @@ struct taskqueue *taskqueue_create(const int taskqueue_start_threads(struct taskqueue **tqp, int count, int pri, const char *name, ...) __printflike(4, 5); int taskqueue_enqueue(struct taskqueue *queue, struct task *task); +int taskqueue_cancel(struct taskqueue *queue, struct task *task, + u_int *pendp); void taskqueue_drain(struct taskqueue *queue, struct task *task); void taskqueue_free(struct taskqueue *queue); void taskqueue_run(struct taskqueue *queue); From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 20:57:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F23541065698; Mon, 8 Nov 2010 20:57:02 +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 DEC368FC13; Mon, 8 Nov 2010 20:57:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8Kv2R7053298; Mon, 8 Nov 2010 20:57:02 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8Kv2PO053293; Mon, 8 Nov 2010 20:57:02 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011082057.oA8Kv2PO053293@svn.freebsd.org> From: John Baldwin Date: Mon, 8 Nov 2010 20:57:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215012 - in head/sys: amd64/acpica conf i386/acpica modules/acpi/acpi x86/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:57:03 -0000 Author: jhb Date: Mon Nov 8 20:57:02 2010 New Revision: 215012 URL: http://svn.freebsd.org/changeset/base/215012 Log: Move the MADT parser for amd64 and i386 to sys/x86/acpica now that it is identical on both platforms. Added: head/sys/x86/acpica/madt.c - copied unchanged from r215009, head/sys/i386/acpica/madt.c Deleted: head/sys/amd64/acpica/madt.c head/sys/i386/acpica/madt.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/acpi/acpi/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Mon Nov 8 20:56:31 2010 (r215011) +++ head/sys/conf/files.amd64 Mon Nov 8 20:57:02 2010 (r215012) @@ -92,7 +92,6 @@ acpi_wakedata.h optional acpi \ clean "acpi_wakedata.h" # amd64/acpica/acpi_wakeup.c optional acpi -amd64/acpica/madt.c optional acpi amd64/amd64/amd64_mem.c optional mem #amd64/amd64/apic_vector.S standard amd64/amd64/atomic.c standard @@ -301,6 +300,7 @@ contrib/x86emu/x86emu.c optional x86bio # # x86 shared code between IA32, AMD64 and PC98 architectures # +x86/acpica/madt.c optional acpi x86/acpica/srat.c optional acpi x86/bios/smbios.c optional smbios x86/bios/vpd.c optional vpd Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Mon Nov 8 20:56:31 2010 (r215011) +++ head/sys/conf/files.i386 Mon Nov 8 20:57:02 2010 (r215012) @@ -247,7 +247,6 @@ acpi_wakecode.h optional acpi \ no-obj no-implicit-rule before-depend \ clean "acpi_wakecode.h acpi_wakecode.o acpi_wakecode.bin" # -i386/acpica/madt.c optional acpi apic i386/bios/apm.c optional apm i386/bios/mca_machdep.c optional mca i386/bios/smapi.c optional smapi @@ -374,6 +373,7 @@ compat/x86bios/x86bios.c optional x86bio # # x86 shared code between IA32, AMD64 and PC98 architectures # +x86/acpica/madt.c optional acpi apic x86/acpica/srat.c optional acpi x86/bios/smbios.c optional smbios x86/bios/vpd.c optional vpd Modified: head/sys/modules/acpi/acpi/Makefile ============================================================================== --- head/sys/modules/acpi/acpi/Makefile Mon Nov 8 20:56:31 2010 (r215011) +++ head/sys/modules/acpi/acpi/Makefile Mon Nov 8 20:57:02 2010 (r215012) @@ -22,7 +22,8 @@ ${.CURDIR}/../../../pci \ ${.CURDIR}/../../../dev/acpica \ ${.CURDIR}/../../../dev/acpica/Osd \ - ${.CURDIR}/../../../${MACHINE_CPUARCH}/acpica + ${.CURDIR}/../../../${MACHINE_CPUARCH}/acpica \ + ${.CURDIR}/../../../x86/acpica KMOD= acpi Copied: head/sys/x86/acpica/madt.c (from r215009, head/sys/i386/acpica/madt.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/x86/acpica/madt.c Mon Nov 8 20:57:02 2010 (r215012, copy of r215009, head/sys/i386/acpica/madt.c) @@ -0,0 +1,572 @@ +/*- + * Copyright (c) 2003 John Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +/* These two arrays are indexed by APIC IDs. */ +struct ioapic_info { + void *io_apic; + UINT32 io_vector; +} ioapics[MAX_APIC_ID + 1]; + +struct lapic_info { + u_int la_enabled:1; + u_int la_acpi_id:8; +} lapics[MAX_APIC_ID + 1]; + +static int madt_found_sci_override; +static ACPI_TABLE_MADT *madt; +static vm_paddr_t madt_physaddr; +static vm_offset_t madt_length; + +MALLOC_DEFINE(M_MADT, "madt_table", "ACPI MADT Table Items"); + +static enum intr_polarity interrupt_polarity(UINT16 IntiFlags, UINT8 Source); +static enum intr_trigger interrupt_trigger(UINT16 IntiFlags, UINT8 Source); +static int madt_find_cpu(u_int acpi_id, u_int *apic_id); +static int madt_find_interrupt(int intr, void **apic, u_int *pin); +static void madt_parse_apics(ACPI_SUBTABLE_HEADER *entry, void *arg); +static void madt_parse_interrupt_override( + ACPI_MADT_INTERRUPT_OVERRIDE *intr); +static void madt_parse_ints(ACPI_SUBTABLE_HEADER *entry, + void *arg __unused); +static void madt_parse_local_nmi(ACPI_MADT_LOCAL_APIC_NMI *nmi); +static void madt_parse_nmi(ACPI_MADT_NMI_SOURCE *nmi); +static int madt_probe(void); +static int madt_probe_cpus(void); +static void madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry, + void *arg __unused); +static void madt_register(void *dummy); +static int madt_setup_local(void); +static int madt_setup_io(void); +static void madt_walk_table(acpi_subtable_handler *handler, void *arg); + +static struct apic_enumerator madt_enumerator = { + "MADT", + madt_probe, + madt_probe_cpus, + madt_setup_local, + madt_setup_io +}; + +/* + * Look for an ACPI Multiple APIC Description Table ("APIC") + */ +static int +madt_probe(void) +{ + + madt_physaddr = acpi_find_table(ACPI_SIG_MADT); + if (madt_physaddr == 0) + return (ENXIO); + return (0); +} + +/* + * Run through the MP table enumerating CPUs. + */ +static int +madt_probe_cpus(void) +{ + + madt = acpi_map_table(madt_physaddr, ACPI_SIG_MADT); + madt_length = madt->Header.Length; + KASSERT(madt != NULL, ("Unable to re-map MADT")); + madt_walk_table(madt_probe_cpus_handler, NULL); + acpi_unmap_table(madt); + madt = NULL; + return (0); +} + +/* + * Initialize the local APIC on the BSP. + */ +static int +madt_setup_local(void) +{ + + madt = pmap_mapbios(madt_physaddr, madt_length); + lapic_init(madt->Address); + printf("ACPI APIC Table: <%.*s %.*s>\n", + (int)sizeof(madt->Header.OemId), madt->Header.OemId, + (int)sizeof(madt->Header.OemTableId), madt->Header.OemTableId); + + /* + * We ignore 64-bit local APIC override entries. Should we + * perhaps emit a warning here if we find one? + */ + return (0); +} + +/* + * Enumerate I/O APICs and setup interrupt sources. + */ +static int +madt_setup_io(void) +{ + void *ioapic; + u_int pin; + int i; + + /* Try to initialize ACPI so that we can access the FADT. */ + i = acpi_Startup(); + if (ACPI_FAILURE(i)) { + printf("MADT: ACPI Startup failed with %s\n", + AcpiFormatException(i)); + printf("Try disabling either ACPI or apic support.\n"); + panic("Using MADT but ACPI doesn't work"); + } + + /* First, we run through adding I/O APIC's. */ + madt_walk_table(madt_parse_apics, NULL); + + /* Second, we run through the table tweaking interrupt sources. */ + madt_walk_table(madt_parse_ints, NULL); + + /* + * If there was not an explicit override entry for the SCI, + * force it to use level trigger and active-low polarity. + */ + if (!madt_found_sci_override) { + if (madt_find_interrupt(AcpiGbl_FADT.SciInterrupt, &ioapic, + &pin) != 0) + printf("MADT: Could not find APIC for SCI IRQ %u\n", + AcpiGbl_FADT.SciInterrupt); + else { + printf( + "MADT: Forcing active-low polarity and level trigger for SCI\n"); + ioapic_set_polarity(ioapic, pin, INTR_POLARITY_LOW); + ioapic_set_triggermode(ioapic, pin, INTR_TRIGGER_LEVEL); + } + } + + /* Third, we register all the I/O APIC's. */ + for (i = 0; i <= MAX_APIC_ID; i++) + if (ioapics[i].io_apic != NULL) + ioapic_register(ioapics[i].io_apic); + + /* Finally, we throw the switch to enable the I/O APIC's. */ + acpi_SetDefaultIntrModel(ACPI_INTR_APIC); + + return (0); +} + +static void +madt_register(void *dummy __unused) +{ + + apic_register_enumerator(&madt_enumerator); +} +SYSINIT(madt_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, madt_register, NULL); + +/* + * Call the handler routine for each entry in the MADT table. + */ +static void +madt_walk_table(acpi_subtable_handler *handler, void *arg) +{ + + acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length, + handler, arg); +} + +static void +madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) +{ + ACPI_MADT_LOCAL_APIC *proc; + struct lapic_info *la; + + switch (entry->Type) { + case ACPI_MADT_TYPE_LOCAL_APIC: + /* + * The MADT does not include a BSP flag, so we have to + * let the MP code figure out which CPU is the BSP on + * its own. + */ + proc = (ACPI_MADT_LOCAL_APIC *)entry; + if (bootverbose) + printf("MADT: Found CPU APIC ID %u ACPI ID %u: %s\n", + proc->Id, proc->ProcessorId, + (proc->LapicFlags & ACPI_MADT_ENABLED) ? + "enabled" : "disabled"); + if (!(proc->LapicFlags & ACPI_MADT_ENABLED)) + break; + if (proc->Id > MAX_APIC_ID) + panic("%s: CPU ID %u too high", __func__, proc->Id); + la = &lapics[proc->Id]; + KASSERT(la->la_enabled == 0, + ("Duplicate local APIC ID %u", proc->Id)); + la->la_enabled = 1; + la->la_acpi_id = proc->ProcessorId; + lapic_create(proc->Id, 0); + break; + } +} + + +/* + * Add an I/O APIC from an entry in the table. + */ +static void +madt_parse_apics(ACPI_SUBTABLE_HEADER *entry, void *arg __unused) +{ + ACPI_MADT_IO_APIC *apic; + + switch (entry->Type) { + case ACPI_MADT_TYPE_IO_APIC: + apic = (ACPI_MADT_IO_APIC *)entry; + if (bootverbose) + printf( + "MADT: Found IO APIC ID %u, Interrupt %u at %p\n", + apic->Id, apic->GlobalIrqBase, + (void *)(uintptr_t)apic->Address); + if (apic->Id > MAX_APIC_ID) + panic("%s: I/O APIC ID %u too high", __func__, + apic->Id); + if (ioapics[apic->Id].io_apic != NULL) + panic("%s: Double APIC ID %u", __func__, apic->Id); + if (apic->GlobalIrqBase >= FIRST_MSI_INT) { + printf("MADT: Ignoring bogus I/O APIC ID %u", apic->Id); + break; + } + ioapics[apic->Id].io_apic = ioapic_create(apic->Address, + apic->Id, apic->GlobalIrqBase); + ioapics[apic->Id].io_vector = apic->GlobalIrqBase; + break; + default: + break; + } +} + +/* + * Determine properties of an interrupt source. Note that for ACPI these + * functions are only used for ISA interrupts, so we assume ISA bus values + * (Active Hi, Edge Triggered) for conforming values except for the ACPI + * SCI for which we use Active Lo, Level Triggered. + */ +static enum intr_polarity +interrupt_polarity(UINT16 IntiFlags, UINT8 Source) +{ + + switch (IntiFlags & ACPI_MADT_POLARITY_MASK) { + case ACPI_MADT_POLARITY_CONFORMS: + if (Source == AcpiGbl_FADT.SciInterrupt) + return (INTR_POLARITY_LOW); + else + return (INTR_POLARITY_HIGH); + case ACPI_MADT_POLARITY_ACTIVE_HIGH: + return (INTR_POLARITY_HIGH); + case ACPI_MADT_POLARITY_ACTIVE_LOW: + return (INTR_POLARITY_LOW); + default: + panic("Bogus Interrupt Polarity"); + } +} + +static enum intr_trigger +interrupt_trigger(UINT16 IntiFlags, UINT8 Source) +{ + + switch (IntiFlags & ACPI_MADT_TRIGGER_MASK) { + case ACPI_MADT_TRIGGER_CONFORMS: + if (Source == AcpiGbl_FADT.SciInterrupt) + return (INTR_TRIGGER_LEVEL); + else + return (INTR_TRIGGER_EDGE); + case ACPI_MADT_TRIGGER_EDGE: + return (INTR_TRIGGER_EDGE); + case ACPI_MADT_TRIGGER_LEVEL: + return (INTR_TRIGGER_LEVEL); + default: + panic("Bogus Interrupt Trigger Mode"); + } +} + +/* + * Find the local APIC ID associated with a given ACPI Processor ID. + */ +static int +madt_find_cpu(u_int acpi_id, u_int *apic_id) +{ + int i; + + for (i = 0; i <= MAX_APIC_ID; i++) { + if (!lapics[i].la_enabled) + continue; + if (lapics[i].la_acpi_id != acpi_id) + continue; + *apic_id = i; + return (0); + } + return (ENOENT); +} + +/* + * Find the IO APIC and pin on that APIC associated with a given global + * interrupt. + */ +static int +madt_find_interrupt(int intr, void **apic, u_int *pin) +{ + int i, best; + + best = -1; + for (i = 0; i <= MAX_APIC_ID; i++) { + if (ioapics[i].io_apic == NULL || + ioapics[i].io_vector > intr) + continue; + if (best == -1 || + ioapics[best].io_vector < ioapics[i].io_vector) + best = i; + } + if (best == -1) + return (ENOENT); + *apic = ioapics[best].io_apic; + *pin = intr - ioapics[best].io_vector; + if (*pin > 32) + printf("WARNING: Found intpin of %u for vector %d\n", *pin, + intr); + return (0); +} + +/* + * Parse an interrupt source override for an ISA interrupt. + */ +static void +madt_parse_interrupt_override(ACPI_MADT_INTERRUPT_OVERRIDE *intr) +{ + void *new_ioapic, *old_ioapic; + u_int new_pin, old_pin; + enum intr_trigger trig; + enum intr_polarity pol; + char buf[64]; + + if (acpi_quirks & ACPI_Q_MADT_IRQ0 && intr->SourceIrq == 0 && + intr->GlobalIrq == 2) { + if (bootverbose) + printf("MADT: Skipping timer override\n"); + return; + } + if (bootverbose) + printf("MADT: Interrupt override: source %u, irq %u\n", + intr->SourceIrq, intr->GlobalIrq); + KASSERT(intr->Bus == 0, ("bus for interrupt overrides must be zero")); + if (madt_find_interrupt(intr->GlobalIrq, &new_ioapic, &new_pin) != 0) { + printf("MADT: Could not find APIC for vector %u (IRQ %u)\n", + intr->GlobalIrq, intr->SourceIrq); + return; + } + + /* + * Lookup the appropriate trigger and polarity modes for this + * entry. + */ + trig = interrupt_trigger(intr->IntiFlags, intr->SourceIrq); + pol = interrupt_polarity(intr->IntiFlags, intr->SourceIrq); + + /* + * If the SCI is identity mapped but has edge trigger and + * active-hi polarity or the force_sci_lo tunable is set, + * force it to use level/lo. + */ + if (intr->SourceIrq == AcpiGbl_FADT.SciInterrupt) { + madt_found_sci_override = 1; + if (getenv_string("hw.acpi.sci.trigger", buf, sizeof(buf))) { + if (tolower(buf[0]) == 'e') + trig = INTR_TRIGGER_EDGE; + else if (tolower(buf[0]) == 'l') + trig = INTR_TRIGGER_LEVEL; + else + panic( + "Invalid trigger %s: must be 'edge' or 'level'", + buf); + printf("MADT: Forcing SCI to %s trigger\n", + trig == INTR_TRIGGER_EDGE ? "edge" : "level"); + } + if (getenv_string("hw.acpi.sci.polarity", buf, sizeof(buf))) { + if (tolower(buf[0]) == 'h') + pol = INTR_POLARITY_HIGH; + else if (tolower(buf[0]) == 'l') + pol = INTR_POLARITY_LOW; + else + panic( + "Invalid polarity %s: must be 'high' or 'low'", + buf); + printf("MADT: Forcing SCI to active %s polarity\n", + pol == INTR_POLARITY_HIGH ? "high" : "low"); + } + } + + /* Remap the IRQ if it is mapped to a different interrupt vector. */ + if (intr->SourceIrq != intr->GlobalIrq) { + /* + * If the SCI is remapped to a non-ISA global interrupt, + * then override the vector we use to setup and allocate + * the interrupt. + */ + if (intr->GlobalIrq > 15 && + intr->SourceIrq == AcpiGbl_FADT.SciInterrupt) + acpi_OverrideInterruptLevel(intr->GlobalIrq); + else + ioapic_remap_vector(new_ioapic, new_pin, + intr->SourceIrq); + if (madt_find_interrupt(intr->SourceIrq, &old_ioapic, + &old_pin) != 0) + printf("MADT: Could not find APIC for source IRQ %u\n", + intr->SourceIrq); + else if (ioapic_get_vector(old_ioapic, old_pin) == + intr->SourceIrq) + ioapic_disable_pin(old_ioapic, old_pin); + } + + /* Program the polarity and trigger mode. */ + ioapic_set_triggermode(new_ioapic, new_pin, trig); + ioapic_set_polarity(new_ioapic, new_pin, pol); +} + +/* + * Parse an entry for an NMI routed to an IO APIC. + */ +static void +madt_parse_nmi(ACPI_MADT_NMI_SOURCE *nmi) +{ + void *ioapic; + u_int pin; + + if (madt_find_interrupt(nmi->GlobalIrq, &ioapic, &pin) != 0) { + printf("MADT: Could not find APIC for vector %u\n", + nmi->GlobalIrq); + return; + } + + ioapic_set_nmi(ioapic, pin); + if (!(nmi->IntiFlags & ACPI_MADT_TRIGGER_CONFORMS)) + ioapic_set_triggermode(ioapic, pin, + interrupt_trigger(nmi->IntiFlags, 0)); + if (!(nmi->IntiFlags & ACPI_MADT_TRIGGER_CONFORMS)) + ioapic_set_polarity(ioapic, pin, + interrupt_polarity(nmi->IntiFlags, 0)); +} + +/* + * Parse an entry for an NMI routed to a local APIC LVT pin. + */ +static void +madt_parse_local_nmi(ACPI_MADT_LOCAL_APIC_NMI *nmi) +{ + u_int apic_id, pin; + + if (nmi->ProcessorId == 0xff) + apic_id = APIC_ID_ALL; + else if (madt_find_cpu(nmi->ProcessorId, &apic_id) != 0) { + if (bootverbose) + printf("MADT: Ignoring local NMI routed to " + "ACPI CPU %u\n", nmi->ProcessorId); + return; + } + if (nmi->Lint == 0) + pin = LVT_LINT0; + else + pin = LVT_LINT1; + lapic_set_lvt_mode(apic_id, pin, APIC_LVT_DM_NMI); + if (!(nmi->IntiFlags & ACPI_MADT_TRIGGER_CONFORMS)) + lapic_set_lvt_triggermode(apic_id, pin, + interrupt_trigger(nmi->IntiFlags, 0)); + if (!(nmi->IntiFlags & ACPI_MADT_POLARITY_CONFORMS)) + lapic_set_lvt_polarity(apic_id, pin, + interrupt_polarity(nmi->IntiFlags, 0)); +} + +/* + * Parse interrupt entries. + */ +static void +madt_parse_ints(ACPI_SUBTABLE_HEADER *entry, void *arg __unused) +{ + + switch (entry->Type) { + case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE: + madt_parse_interrupt_override( + (ACPI_MADT_INTERRUPT_OVERRIDE *)entry); + break; + case ACPI_MADT_TYPE_NMI_SOURCE: + madt_parse_nmi((ACPI_MADT_NMI_SOURCE *)entry); + break; + case ACPI_MADT_TYPE_LOCAL_APIC_NMI: + madt_parse_local_nmi((ACPI_MADT_LOCAL_APIC_NMI *)entry); + break; + } +} + +/* + * Setup per-CPU ACPI IDs. + */ +static void +madt_set_ids(void *dummy) +{ + struct lapic_info *la; + struct pcpu *pc; + u_int i; + + if (madt == NULL) + return; + CPU_FOREACH(i) { + pc = pcpu_find(i); + KASSERT(pc != NULL, ("no pcpu data for CPU %u", i)); + la = &lapics[pc->pc_apic_id]; + if (!la->la_enabled) + panic("APIC: CPU with APIC ID %u is not enabled", + pc->pc_apic_id); + pc->pc_acpi_id = la->la_acpi_id; + if (bootverbose) + printf("APIC: CPU %u has ACPI ID %u\n", i, + la->la_acpi_id); + } +} +SYSINIT(madt_set_ids, SI_SUB_CPU, SI_ORDER_ANY, madt_set_ids, NULL); From owner-svn-src-all@FreeBSD.ORG Mon Nov 8 20:57:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44B4710656A5; Mon, 8 Nov 2010 20:57:09 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 324BD8FC12; Mon, 8 Nov 2010 20:57: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 oA8Kv9Wl053341; Mon, 8 Nov 2010 20:57:09 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8Kv9Sr053339; Mon, 8 Nov 2010 20:57:09 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201011082057.oA8Kv9Sr053339@svn.freebsd.org> From: Matthew D Fleming Date: Mon, 8 Nov 2010 20:57:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215013 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:57:09 -0000 Author: mdf Date: Mon Nov 8 20:57:08 2010 New Revision: 215013 URL: http://svn.freebsd.org/changeset/base/215013 Log: Whitespace and other aspects of style(9). No functional changes. MFC after: 3 days Modified: head/sys/kern/link_elf.c Modified: head/sys/kern/link_elf.c ============================================================================== --- head/sys/kern/link_elf.c Mon Nov 8 20:57:02 2010 (r215012) +++ head/sys/kern/link_elf.c Mon Nov 8 20:57:08 2010 (r215013) @@ -74,52 +74,52 @@ __FBSDID("$FreeBSD$"); #define MAXSEGS 4 typedef struct elf_file { - struct linker_file lf; /* Common fields */ - int preloaded; /* Was file pre-loaded */ - caddr_t address; /* Relocation address */ + struct linker_file lf; /* Common fields */ + int preloaded; /* Was file pre-loaded */ + caddr_t address; /* Relocation address */ #ifdef SPARSE_MAPPING - vm_object_t object; /* VM object to hold file pages */ + vm_object_t object; /* VM object to hold file pages */ #endif - Elf_Dyn* dynamic; /* Symbol table etc. */ - Elf_Hashelt nbuckets; /* DT_HASH info */ - Elf_Hashelt nchains; - const Elf_Hashelt* buckets; - const Elf_Hashelt* chains; - caddr_t hash; - caddr_t strtab; /* DT_STRTAB */ - int strsz; /* DT_STRSZ */ - const Elf_Sym* symtab; /* DT_SYMTAB */ - Elf_Addr* got; /* DT_PLTGOT */ - const Elf_Rel* pltrel; /* DT_JMPREL */ - int pltrelsize; /* DT_PLTRELSZ */ - const Elf_Rela* pltrela; /* DT_JMPREL */ - int pltrelasize; /* DT_PLTRELSZ */ - const Elf_Rel* rel; /* DT_REL */ - int relsize; /* DT_RELSZ */ - const Elf_Rela* rela; /* DT_RELA */ - int relasize; /* DT_RELASZ */ - caddr_t modptr; - const Elf_Sym* ddbsymtab; /* The symbol table we are using */ - long ddbsymcnt; /* Number of symbols */ - caddr_t ddbstrtab; /* String table */ - long ddbstrcnt; /* number of bytes in string table */ - caddr_t symbase; /* malloc'ed symbold base */ - caddr_t strbase; /* malloc'ed string base */ - caddr_t ctftab; /* CTF table */ - long ctfcnt; /* number of bytes in CTF table */ - caddr_t ctfoff; /* CTF offset table */ - caddr_t typoff; /* Type offset table */ - long typlen; /* Number of type entries. */ - Elf_Addr pcpu_start; /* Pre-relocation pcpu set start. */ - Elf_Addr pcpu_stop; /* Pre-relocation pcpu set stop. */ - Elf_Addr pcpu_base; /* Relocated pcpu set address. */ + Elf_Dyn *dynamic; /* Symbol table etc. */ + Elf_Hashelt nbuckets; /* DT_HASH info */ + Elf_Hashelt nchains; + const Elf_Hashelt *buckets; + const Elf_Hashelt *chains; + caddr_t hash; + caddr_t strtab; /* DT_STRTAB */ + int strsz; /* DT_STRSZ */ + const Elf_Sym *symtab; /* DT_SYMTAB */ + Elf_Addr *got; /* DT_PLTGOT */ + const Elf_Rel *pltrel; /* DT_JMPREL */ + int pltrelsize; /* DT_PLTRELSZ */ + const Elf_Rela *pltrela; /* DT_JMPREL */ + int pltrelasize; /* DT_PLTRELSZ */ + const Elf_Rel *rel; /* DT_REL */ + int relsize; /* DT_RELSZ */ + const Elf_Rela *rela; /* DT_RELA */ + int relasize; /* DT_RELASZ */ + caddr_t modptr; + const Elf_Sym *ddbsymtab; /* The symbol table we are using */ + long ddbsymcnt; /* Number of symbols */ + caddr_t ddbstrtab; /* String table */ + long ddbstrcnt; /* number of bytes in string table */ + caddr_t symbase; /* malloc'ed symbold base */ + caddr_t strbase; /* malloc'ed string base */ + caddr_t ctftab; /* CTF table */ + long ctfcnt; /* number of bytes in CTF table */ + caddr_t ctfoff; /* CTF offset table */ + caddr_t typoff; /* Type offset table */ + long typlen; /* Number of type entries. */ + Elf_Addr pcpu_start; /* Pre-relocation pcpu set start. */ + Elf_Addr pcpu_stop; /* Pre-relocation pcpu set stop. */ + Elf_Addr pcpu_base; /* Relocated pcpu set address. */ #ifdef VIMAGE - Elf_Addr vnet_start; /* Pre-relocation vnet set start. */ - Elf_Addr vnet_stop; /* Pre-relocation vnet set stop. */ - Elf_Addr vnet_base; /* Relocated vnet set address. */ + Elf_Addr vnet_start; /* Pre-relocation vnet set start. */ + Elf_Addr vnet_stop; /* Pre-relocation vnet set stop. */ + Elf_Addr vnet_base; /* Relocated vnet set address. */ #endif #ifdef GDB - struct link_map gdb; /* hooks for gdb */ + struct link_map gdb; /* hooks for gdb */ #endif } *elf_file_t; @@ -127,70 +127,71 @@ typedef struct elf_file { static int link_elf_link_common_finish(linker_file_t); static int link_elf_link_preload(linker_class_t cls, - const char*, linker_file_t*); + const char *, linker_file_t *); static int link_elf_link_preload_finish(linker_file_t); -static int link_elf_load_file(linker_class_t, const char*, linker_file_t*); -static int link_elf_lookup_symbol(linker_file_t, const char*, - c_linker_sym_t*); -static int link_elf_symbol_values(linker_file_t, c_linker_sym_t, linker_symval_t*); -static int link_elf_search_symbol(linker_file_t, caddr_t value, - c_linker_sym_t* sym, long* diffp); +static int link_elf_load_file(linker_class_t, const char *, + linker_file_t *); +static int link_elf_lookup_symbol(linker_file_t, const char *, + c_linker_sym_t *); +static int link_elf_symbol_values(linker_file_t, c_linker_sym_t, + linker_symval_t *); +static int link_elf_search_symbol(linker_file_t, caddr_t, + c_linker_sym_t *, long *); static void link_elf_unload_file(linker_file_t); static void link_elf_unload_preload(linker_file_t); static int link_elf_lookup_set(linker_file_t, const char *, - void ***, void ***, int *); + void ***, void ***, int *); static int link_elf_each_function_name(linker_file_t, - int (*)(const char *, void *), - void *); + int (*)(const char *, void *), void *); static int link_elf_each_function_nameval(linker_file_t, - linker_function_nameval_callback_t, - void *); + linker_function_nameval_callback_t, void *); static void link_elf_reloc_local(linker_file_t); static long link_elf_symtab_get(linker_file_t, const Elf_Sym **); static long link_elf_strtab_get(linker_file_t, caddr_t *); -static Elf_Addr elf_lookup(linker_file_t lf, Elf_Size symidx, int deps); +static Elf_Addr elf_lookup(linker_file_t, Elf_Size, int); static kobj_method_t link_elf_methods[] = { - KOBJMETHOD(linker_lookup_symbol, link_elf_lookup_symbol), - KOBJMETHOD(linker_symbol_values, link_elf_symbol_values), - KOBJMETHOD(linker_search_symbol, link_elf_search_symbol), - KOBJMETHOD(linker_unload, link_elf_unload_file), - KOBJMETHOD(linker_load_file, link_elf_load_file), - KOBJMETHOD(linker_link_preload, link_elf_link_preload), - KOBJMETHOD(linker_link_preload_finish, link_elf_link_preload_finish), - KOBJMETHOD(linker_lookup_set, link_elf_lookup_set), - KOBJMETHOD(linker_each_function_name, link_elf_each_function_name), - KOBJMETHOD(linker_each_function_nameval, link_elf_each_function_nameval), - KOBJMETHOD(linker_ctf_get, link_elf_ctf_get), - KOBJMETHOD(linker_symtab_get, link_elf_symtab_get), - KOBJMETHOD(linker_strtab_get, link_elf_strtab_get), - { 0, 0 } + KOBJMETHOD(linker_lookup_symbol, link_elf_lookup_symbol), + KOBJMETHOD(linker_symbol_values, link_elf_symbol_values), + KOBJMETHOD(linker_search_symbol, link_elf_search_symbol), + KOBJMETHOD(linker_unload, link_elf_unload_file), + KOBJMETHOD(linker_load_file, link_elf_load_file), + KOBJMETHOD(linker_link_preload, link_elf_link_preload), + KOBJMETHOD(linker_link_preload_finish, link_elf_link_preload_finish), + KOBJMETHOD(linker_lookup_set, link_elf_lookup_set), + KOBJMETHOD(linker_each_function_name, link_elf_each_function_name), + KOBJMETHOD(linker_each_function_nameval, link_elf_each_function_nameval), + KOBJMETHOD(linker_ctf_get, link_elf_ctf_get), + KOBJMETHOD(linker_symtab_get, link_elf_symtab_get), + KOBJMETHOD(linker_strtab_get, link_elf_strtab_get), + { 0, 0 } }; static struct linker_class link_elf_class = { #if ELF_TARG_CLASS == ELFCLASS32 - "elf32", + "elf32", #else - "elf64", + "elf64", #endif - link_elf_methods, sizeof(struct elf_file) + link_elf_methods, sizeof(struct elf_file) }; -static int parse_dynamic(elf_file_t ef); -static int relocate_file(elf_file_t ef); -static int link_elf_preload_parse_symbols(elf_file_t ef); +static int parse_dynamic(elf_file_t); +static int relocate_file(elf_file_t); +static int link_elf_preload_parse_symbols(elf_file_t); #ifdef GDB -static void r_debug_state(struct r_debug *dummy_one, - struct link_map *dummy_two); +static void r_debug_state(struct r_debug *, struct link_map *); /* * A list of loaded modules for GDB to use for loading symbols. */ struct r_debug r_debug; -#define GDB_STATE(s) r_debug.r_state = s; r_debug_state(NULL, NULL); +#define GDB_STATE(s) do { \ + r_debug.r_state = s; r_debug_state(NULL, NULL); \ +} while (0) /* * Function for the debugger to set a breakpoint on to gain control. @@ -204,35 +205,37 @@ r_debug_state(struct r_debug *dummy_one static void link_elf_add_gdb(struct link_map *l) { - struct link_map *prev; + struct link_map *prev; - l->l_next = NULL; + l->l_next = NULL; - if (r_debug.r_map == NULL) { - /* Add first. */ - l->l_prev = NULL; - r_debug.r_map = l; - } else { - /* Append to list. */ - for (prev = r_debug.r_map; prev->l_next != NULL; prev = prev->l_next) - ; - l->l_prev = prev; - prev->l_next = l; - } + if (r_debug.r_map == NULL) { + /* Add first. */ + l->l_prev = NULL; + r_debug.r_map = l; + } else { + /* Append to list. */ + for (prev = r_debug.r_map; + prev->l_next != NULL; + prev = prev->l_next) + ; + l->l_prev = prev; + prev->l_next = l; + } } static void link_elf_delete_gdb(struct link_map *l) { - if (l->l_prev == NULL) { - /* Remove first. */ - if ((r_debug.r_map = l->l_next) != NULL) - l->l_next->l_prev = NULL; - } else { - /* Remove any but first. */ - if ((l->l_prev->l_next = l->l_next) != NULL) - l->l_next->l_prev = l->l_prev; - } + if (l->l_prev == NULL) { + /* Remove first. */ + if ((r_debug.r_map = l->l_next) != NULL) + l->l_next->l_prev = NULL; + } else { + /* Remove any but first. */ + if ((l->l_prev->l_next = l->l_next) != NULL) + l->l_next->l_prev = l->l_prev; + } } #endif /* GDB */ @@ -262,85 +265,86 @@ static int link_elf_link_common_finish(linker_file_t lf) { #ifdef GDB - elf_file_t ef = (elf_file_t)lf; - char *newfilename; + elf_file_t ef = (elf_file_t)lf; + char *newfilename; #endif - int error; + int error; - /* Notify MD code that a module is being loaded. */ - error = elf_cpu_load_file(lf); - if (error) - return (error); + /* Notify MD code that a module is being loaded. */ + error = elf_cpu_load_file(lf); + if (error != 0) + return (error); #ifdef GDB - GDB_STATE(RT_ADD); - ef->gdb.l_addr = lf->address; - newfilename = malloc(strlen(lf->filename) + 1, M_LINKER, M_WAITOK); - strcpy(newfilename, lf->filename); - ef->gdb.l_name = newfilename; - ef->gdb.l_ld = ef->dynamic; - link_elf_add_gdb(&ef->gdb); - GDB_STATE(RT_CONSISTENT); + GDB_STATE(RT_ADD); + ef->gdb.l_addr = lf->address; + newfilename = malloc(strlen(lf->filename) + 1, M_LINKER, M_WAITOK); + strcpy(newfilename, lf->filename); + ef->gdb.l_name = newfilename; + ef->gdb.l_ld = ef->dynamic; + link_elf_add_gdb(&ef->gdb); + GDB_STATE(RT_CONSISTENT); #endif - return (0); + return (0); } static void link_elf_init(void* arg) { - Elf_Dyn *dp; - caddr_t modptr, baseptr, sizeptr; - elf_file_t ef; - char *modname; - - linker_add_class(&link_elf_class); - - dp = (Elf_Dyn*) &_DYNAMIC; - modname = NULL; - modptr = preload_search_by_type("elf" __XSTRING(__ELF_WORD_SIZE) " kernel"); - if (modptr == NULL) - modptr = preload_search_by_type("elf kernel"); - if (modptr) - modname = (char *)preload_search_info(modptr, MODINFO_NAME); - if (modname == NULL) - modname = "kernel"; - linker_kernel_file = linker_make_file(modname, &link_elf_class); - if (linker_kernel_file == NULL) - panic("link_elf_init: Can't create linker structures for kernel"); - - ef = (elf_file_t) linker_kernel_file; - ef->preloaded = 1; - ef->address = 0; + Elf_Dyn *dp; + caddr_t modptr, baseptr, sizeptr; + elf_file_t ef; + char *modname; + + linker_add_class(&link_elf_class); + + dp = (Elf_Dyn *)&_DYNAMIC; + modname = NULL; + modptr = preload_search_by_type("elf" __XSTRING(__ELF_WORD_SIZE) " kernel"); + if (modptr == NULL) + modptr = preload_search_by_type("elf kernel"); + if (modptr != NULL) + modname = (char *)preload_search_info(modptr, MODINFO_NAME); + if (modname == NULL) + modname = "kernel"; + linker_kernel_file = linker_make_file(modname, &link_elf_class); + if (linker_kernel_file == NULL) + panic("%s: Can't create linker structures for kernel", + __func__); + + ef = (elf_file_t) linker_kernel_file; + ef->preloaded = 1; + ef->address = 0; #ifdef SPARSE_MAPPING - ef->object = 0; + ef->object = 0; #endif - ef->dynamic = dp; - - if (dp) - parse_dynamic(ef); - linker_kernel_file->address = (caddr_t) KERNBASE; - linker_kernel_file->size = -(intptr_t)linker_kernel_file->address; + ef->dynamic = dp; - if (modptr) { - ef->modptr = modptr; - baseptr = preload_search_info(modptr, MODINFO_ADDR); - if (baseptr) - linker_kernel_file->address = *(caddr_t *)baseptr; - sizeptr = preload_search_info(modptr, MODINFO_SIZE); - if (sizeptr) - linker_kernel_file->size = *(size_t *)sizeptr; - } - (void)link_elf_preload_parse_symbols(ef); + if (dp != NULL) + parse_dynamic(ef); + linker_kernel_file->address = (caddr_t) KERNBASE; + linker_kernel_file->size = -(intptr_t)linker_kernel_file->address; + + if (modptr != NULL) { + ef->modptr = modptr; + baseptr = preload_search_info(modptr, MODINFO_ADDR); + if (baseptr != NULL) + linker_kernel_file->address = *(caddr_t *)baseptr; + sizeptr = preload_search_info(modptr, MODINFO_SIZE); + if (sizeptr != NULL) + linker_kernel_file->size = *(size_t *)sizeptr; + } + (void)link_elf_preload_parse_symbols(ef); #ifdef GDB - r_debug.r_map = NULL; - r_debug.r_brk = r_debug_state; - r_debug.r_state = RT_CONSISTENT; + r_debug.r_map = NULL; + r_debug.r_brk = r_debug_state; + r_debug.r_state = RT_CONSISTENT; #endif - (void)link_elf_link_common_finish(linker_kernel_file); - linker_kernel_file->flags |= LINKER_FILE_LINKED; + (void)link_elf_link_common_finish(linker_kernel_file); + linker_kernel_file->flags |= LINKER_FILE_LINKED; } SYSINIT(link_elf, SI_SUB_KLD, SI_ORDER_THIRD, link_elf_init, 0); @@ -348,795 +352,807 @@ SYSINIT(link_elf, SI_SUB_KLD, SI_ORDER_T static int link_elf_preload_parse_symbols(elf_file_t ef) { - caddr_t pointer; - caddr_t ssym, esym, base; - caddr_t strtab; - int strcnt; - Elf_Sym* symtab; - int symcnt; - - if (ef->modptr == NULL) - return 0; - pointer = preload_search_info(ef->modptr, MODINFO_METADATA|MODINFOMD_SSYM); - if (pointer == NULL) - return 0; - ssym = *(caddr_t *)pointer; - pointer = preload_search_info(ef->modptr, MODINFO_METADATA|MODINFOMD_ESYM); - if (pointer == NULL) - return 0; - esym = *(caddr_t *)pointer; - - base = ssym; - - symcnt = *(long *)base; - base += sizeof(long); - symtab = (Elf_Sym *)base; - base += roundup(symcnt, sizeof(long)); - - if (base > esym || base < ssym) { - printf("Symbols are corrupt!\n"); - return EINVAL; - } + caddr_t pointer; + caddr_t ssym, esym, base; + caddr_t strtab; + int strcnt; + Elf_Sym *symtab; + int symcnt; - strcnt = *(long *)base; - base += sizeof(long); - strtab = base; - base += roundup(strcnt, sizeof(long)); - - if (base > esym || base < ssym) { - printf("Symbols are corrupt!\n"); - return EINVAL; - } + if (ef->modptr == NULL) + return (0); + pointer = preload_search_info(ef->modptr, + MODINFO_METADATA | MODINFOMD_SSYM); + if (pointer == NULL) + return (0); + ssym = *(caddr_t *)pointer; + pointer = preload_search_info(ef->modptr, + MODINFO_METADATA | MODINFOMD_ESYM); + if (pointer == NULL) + return (0); + esym = *(caddr_t *)pointer; + + base = ssym; + + symcnt = *(long *)base; + base += sizeof(long); + symtab = (Elf_Sym *)base; + base += roundup(symcnt, sizeof(long)); + + if (base > esym || base < ssym) { + printf("Symbols are corrupt!\n"); + return (EINVAL); + } - ef->ddbsymtab = symtab; - ef->ddbsymcnt = symcnt / sizeof(Elf_Sym); - ef->ddbstrtab = strtab; - ef->ddbstrcnt = strcnt; + strcnt = *(long *)base; + base += sizeof(long); + strtab = base; + base += roundup(strcnt, sizeof(long)); - return 0; + if (base > esym || base < ssym) { + printf("Symbols are corrupt!\n"); + return (EINVAL); + } + + ef->ddbsymtab = symtab; + ef->ddbsymcnt = symcnt / sizeof(Elf_Sym); + ef->ddbstrtab = strtab; + ef->ddbstrcnt = strcnt; + + return (0); } static int parse_dynamic(elf_file_t ef) { - Elf_Dyn *dp; - int plttype = DT_REL; + Elf_Dyn *dp; + int plttype = DT_REL; - for (dp = ef->dynamic; dp->d_tag != DT_NULL; dp++) { - switch (dp->d_tag) { - case DT_HASH: - { - /* From src/libexec/rtld-elf/rtld.c */ - const Elf_Hashelt *hashtab = (const Elf_Hashelt *) - (ef->address + dp->d_un.d_ptr); - ef->nbuckets = hashtab[0]; - ef->nchains = hashtab[1]; - ef->buckets = hashtab + 2; - ef->chains = ef->buckets + ef->nbuckets; - break; - } - case DT_STRTAB: - ef->strtab = (caddr_t) (ef->address + dp->d_un.d_ptr); - break; - case DT_STRSZ: - ef->strsz = dp->d_un.d_val; - break; - case DT_SYMTAB: - ef->symtab = (Elf_Sym*) (ef->address + dp->d_un.d_ptr); - break; - case DT_SYMENT: - if (dp->d_un.d_val != sizeof(Elf_Sym)) - return ENOEXEC; - break; - case DT_PLTGOT: - ef->got = (Elf_Addr *) (ef->address + dp->d_un.d_ptr); - break; - case DT_REL: - ef->rel = (const Elf_Rel *) (ef->address + dp->d_un.d_ptr); - break; - case DT_RELSZ: - ef->relsize = dp->d_un.d_val; - break; - case DT_RELENT: - if (dp->d_un.d_val != sizeof(Elf_Rel)) - return ENOEXEC; - break; - case DT_JMPREL: - ef->pltrel = (const Elf_Rel *) (ef->address + dp->d_un.d_ptr); - break; - case DT_PLTRELSZ: - ef->pltrelsize = dp->d_un.d_val; - break; - case DT_RELA: - ef->rela = (const Elf_Rela *) (ef->address + dp->d_un.d_ptr); - break; - case DT_RELASZ: - ef->relasize = dp->d_un.d_val; - break; - case DT_RELAENT: - if (dp->d_un.d_val != sizeof(Elf_Rela)) - return ENOEXEC; - break; - case DT_PLTREL: - plttype = dp->d_un.d_val; - if (plttype != DT_REL && plttype != DT_RELA) - return ENOEXEC; - break; + for (dp = ef->dynamic; dp->d_tag != DT_NULL; dp++) { + switch (dp->d_tag) { + case DT_HASH: + { + /* From src/libexec/rtld-elf/rtld.c */ + const Elf_Hashelt *hashtab = (const Elf_Hashelt *) + (ef->address + dp->d_un.d_ptr); + ef->nbuckets = hashtab[0]; + ef->nchains = hashtab[1]; + ef->buckets = hashtab + 2; + ef->chains = ef->buckets + ef->nbuckets; + break; + } + case DT_STRTAB: + ef->strtab = (caddr_t) (ef->address + dp->d_un.d_ptr); + break; + case DT_STRSZ: + ef->strsz = dp->d_un.d_val; + break; + case DT_SYMTAB: + ef->symtab = (Elf_Sym*) (ef->address + dp->d_un.d_ptr); + break; + case DT_SYMENT: + if (dp->d_un.d_val != sizeof(Elf_Sym)) + return (ENOEXEC); + break; + case DT_PLTGOT: + ef->got = (Elf_Addr *) (ef->address + dp->d_un.d_ptr); + break; + case DT_REL: + ef->rel = (const Elf_Rel *) (ef->address + dp->d_un.d_ptr); + break; + case DT_RELSZ: + ef->relsize = dp->d_un.d_val; + break; + case DT_RELENT: + if (dp->d_un.d_val != sizeof(Elf_Rel)) + return (ENOEXEC); + break; + case DT_JMPREL: + ef->pltrel = (const Elf_Rel *) (ef->address + dp->d_un.d_ptr); + break; + case DT_PLTRELSZ: + ef->pltrelsize = dp->d_un.d_val; + break; + case DT_RELA: + ef->rela = (const Elf_Rela *) (ef->address + dp->d_un.d_ptr); + break; + case DT_RELASZ: + ef->relasize = dp->d_un.d_val; + break; + case DT_RELAENT: + if (dp->d_un.d_val != sizeof(Elf_Rela)) + return (ENOEXEC); + break; + case DT_PLTREL: + plttype = dp->d_un.d_val; + if (plttype != DT_REL && plttype != DT_RELA) + return (ENOEXEC); + break; #ifdef GDB - case DT_DEBUG: - dp->d_un.d_ptr = (Elf_Addr) &r_debug; - break; + case DT_DEBUG: + dp->d_un.d_ptr = (Elf_Addr)&r_debug; + break; #endif + } } - } - if (plttype == DT_RELA) { - ef->pltrela = (const Elf_Rela *) ef->pltrel; - ef->pltrel = NULL; - ef->pltrelasize = ef->pltrelsize; - ef->pltrelsize = 0; - } + if (plttype == DT_RELA) { +