From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:24:47 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FE0A1065670; Sun, 29 Jan 2012 00:24:47 +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 1828E8FC18; Sun, 29 Jan 2012 00:24:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0OkW2006632; Sun, 29 Jan 2012 00:24:46 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0OkEv006628; Sun, 29 Jan 2012 00:24:46 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290024.q0T0OkEv006628@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:24:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230690 - in stable/9/sys/sparc64: include sparc64 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:24:47 -0000 Author: marius Date: Sun Jan 29 00:24:46 2012 New Revision: 230690 URL: http://svn.freebsd.org/changeset/base/230690 Log: MFC: r226054 - Use atomic operations rather than sched_lock for safely assigning pm_active and pc_pmap for SMP. This is key to allowing adding support for SCHED_ULE. Thanks go to Peter Jeremy for additional testing. - Add support for SCHED_ULE to cpu_switch(). Modified: stable/9/sys/sparc64/include/asmacros.h stable/9/sys/sparc64/sparc64/pmap.c stable/9/sys/sparc64/sparc64/swtch.S Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/sparc64/include/asmacros.h ============================================================================== --- stable/9/sys/sparc64/include/asmacros.h Sun Jan 29 00:19:19 2012 (r230689) +++ stable/9/sys/sparc64/include/asmacros.h Sun Jan 29 00:24:46 2012 (r230690) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2001 Jake Burkholder. + * Copyright (c) 2011 Marius Strobl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -98,9 +99,67 @@ 9: andn r2, bits, r3 ; \ casxa [r1] ASI_N, r2, r3 ; \ cmp r2, r3 ; \ + bne,pn %xcc, 9b ; \ + mov r3, r2 + +/* + * Atomically load an integer from memory. + */ +#define ATOMIC_LOAD_INT(r1, val) \ + clr val ; \ + casa [r1] ASI_N, %g0, val + +/* + * Atomically load a long from memory. + */ +#define ATOMIC_LOAD_LONG(r1, val) \ + clr val ; \ + casxa [r1] ASI_N, %g0, val + +/* + * Atomically set a number of bits of an integer in memory. + */ +#define ATOMIC_SET_INT(r1, r2, r3, bits) \ + lduw [r1], r2 ; \ +9: or r2, bits, r3 ; \ + casa [r1] ASI_N, r2, r3 ; \ + cmp r2, r3 ; \ + bne,pn %icc, 9b ; \ + mov r3, r2 + +/* + * Atomically set a number of bits of a long in memory. + */ +#define ATOMIC_SET_LONG(r1, r2, r3, bits) \ + ldx [r1], r2 ; \ +9: or r2, bits, r3 ; \ + casxa [r1] ASI_N, r2, r3 ; \ + cmp r2, r3 ; \ + bne,pn %xcc, 9b ; \ + mov r3, r2 + +/* + * Atomically store an integer in memory. + */ +#define ATOMIC_STORE_INT(r1, r2, r3, val) \ + lduw [r1], r2 ; \ +9: mov val, r3 ; \ + casa [r1] ASI_N, r2, r3 ; \ + cmp r2, r3 ; \ bne,pn %icc, 9b ; \ mov r3, r2 +/* + * Atomically store a long in memory. + */ +#define ATOMIC_STORE_LONG(r1, r2, r3, val) \ + ldx [r1], r2 ; \ +9: mov val, r3 ; \ + casxa [r1] ASI_N, r2, r3 ; \ + cmp r2, r3 ; \ + bne,pn %xcc, 9b ; \ + mov r3, r2 + #define PCPU(member) PCPU_REG + PC_ ## member #define PCPU_ADDR(member, reg) \ add PCPU_REG, PC_ ## member, reg Modified: stable/9/sys/sparc64/sparc64/pmap.c ============================================================================== --- stable/9/sys/sparc64/sparc64/pmap.c Sun Jan 29 00:19:19 2012 (r230689) +++ stable/9/sys/sparc64/sparc64/pmap.c Sun Jan 29 00:24:46 2012 (r230690) @@ -100,13 +100,6 @@ __FBSDID("$FreeBSD$"); #include #include -/* XXX */ -#include "opt_sched.h" -#ifndef SCHED_4BSD -#error "sparc64 only works with SCHED_4BSD which uses a global scheduler lock." -#endif -extern struct mtx sched_lock; - /* * Virtual address of message buffer */ @@ -1232,11 +1225,9 @@ pmap_pinit(pmap_t pm) if (pm->pm_tsb_obj == NULL) pm->pm_tsb_obj = vm_object_allocate(OBJT_PHYS, TSB_PAGES); - mtx_lock_spin(&sched_lock); for (i = 0; i < MAXCPU; i++) pm->pm_context[i] = -1; CPU_ZERO(&pm->pm_active); - mtx_unlock_spin(&sched_lock); VM_OBJECT_LOCK(pm->pm_tsb_obj); for (i = 0; i < TSB_PAGES; i++) { @@ -1263,7 +1254,9 @@ pmap_release(pmap_t pm) { vm_object_t obj; vm_page_t m; +#ifdef SMP struct pcpu *pc; +#endif CTR2(KTR_PMAP, "pmap_release: ctx=%#x tsb=%p", pm->pm_context[curcpu], pm->pm_tsb); @@ -1283,11 +1276,18 @@ pmap_release(pmap_t pm) * - A process that referenced this pmap ran on a CPU, but we switched * to a kernel thread, leaving the pmap pointer unchanged. */ - mtx_lock_spin(&sched_lock); +#ifdef SMP + sched_pin(); STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) - if (pc->pc_pmap == pm) - pc->pc_pmap = NULL; - mtx_unlock_spin(&sched_lock); + atomic_cmpset_rel_ptr((uintptr_t *)&pc->pc_pmap, + (uintptr_t)pm, (uintptr_t)NULL); + sched_unpin(); +#else + critical_enter(); + if (PCPU_GET(pmap) == pm) + PCPU_SET(pmap, NULL); + critical_exit(); +#endif pmap_qremove((vm_offset_t)pm->pm_tsb, TSB_PAGES); obj = pm->pm_tsb_obj; @@ -2232,11 +2232,14 @@ pmap_activate(struct thread *td) } PCPU_SET(tlb_ctx, context + 1); - mtx_lock_spin(&sched_lock); pm->pm_context[curcpu] = context; +#ifdef SMP + CPU_SET_ATOMIC(PCPU_GET(cpuid), &pm->pm_active); + atomic_store_ptr((uintptr_t *)PCPU_PTR(pmap), (uintptr_t)pm); +#else CPU_SET(PCPU_GET(cpuid), &pm->pm_active); PCPU_SET(pmap, pm); - mtx_unlock_spin(&sched_lock); +#endif stxa(AA_DMMU_TSB, ASI_DMMU, pm->pm_tsb); stxa(AA_IMMU_TSB, ASI_IMMU, pm->pm_tsb); Modified: stable/9/sys/sparc64/sparc64/swtch.S ============================================================================== --- stable/9/sys/sparc64/sparc64/swtch.S Sun Jan 29 00:19:19 2012 (r230689) +++ stable/9/sys/sparc64/sparc64/swtch.S Sun Jan 29 00:24:46 2012 (r230690) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2001 Jake Burkholder. + * Copyright (c) 2011 Marius Strobl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include "assym.s" +#include "opt_sched.h" .register %g2, #ignore .register %g3, #ignore @@ -66,7 +68,7 @@ ENTRY(cpu_switch) nop call savefpctx add PCB_REG, PCB_KFP, %o0 - ba,a %xcc, 2f + ba,a,pt %xcc, 2f nop /* @@ -148,7 +150,7 @@ ENTRY(cpu_switch) * If they are the same we are done. */ cmp %l2, %l1 - be,a,pn %xcc, 7f + be,a,pn %xcc, 8f nop /* @@ -157,7 +159,7 @@ ENTRY(cpu_switch) */ SET(vmspace0, %i4, %i3) cmp %i5, %i3 - be,a,pn %xcc, 7f + be,a,pn %xcc, 8f nop /* @@ -180,9 +182,15 @@ ENTRY(cpu_switch) sub %l3, %l5, %l5 mov 1, %l6 sllx %l6, %l5, %l5 +#ifdef SMP + add %l2, %l4, %l4 + membar #LoadStore | #StoreStore + ATOMIC_CLEAR_LONG(%l4, %l6, %l7, %l5) +#else ldx [%l2 + %l4], %l6 andn %l6, %l5, %l6 stx %l6, [%l2 + %l4] +#endif /* * Take away its context number. @@ -194,14 +202,20 @@ ENTRY(cpu_switch) 3: cmp %i2, %g0 be,pn %xcc, 4f - lduw [PCPU(TLB_CTX_MAX)], %i4 - stx %i2, [%i0 + TD_LOCK] + add %i0, TD_LOCK, %l4 +#if defined(SCHED_ULE) && defined(SMP) + membar #LoadStore | #StoreStore + ATOMIC_STORE_LONG(%l4, %l6, %l7, %i2) +#else + stx %i2, [%l4] +#endif /* * Find a new TLB context. If we've run out we have to flush all * user mappings from the TLB and reset the context numbers. */ 4: lduw [PCPU(TLB_CTX)], %i3 + lduw [PCPU(TLB_CTX_MAX)], %i4 cmp %i3, %i4 bne,a,pt %xcc, 5f nop @@ -237,14 +251,24 @@ ENTRY(cpu_switch) sub %l3, %l5, %l5 mov 1, %l6 sllx %l6, %l5, %l5 +#ifdef SMP + add %l1, %l4, %l4 + ATOMIC_SET_LONG(%l4, %l6, %l7, %l5) +#else ldx [%l1 + %l4], %l6 or %l6, %l5, %l6 stx %l6, [%l1 + %l4] +#endif /* * Make note of the change in pmap. */ +#ifdef SMP + PCPU_ADDR(PMAP, %l4) + ATOMIC_STORE_LONG(%l4, %l5, %l6, %l1) +#else stx %l1, [PCPU(PMAP)] +#endif /* * Fiddle the hardware bits. Set the TSB registers and install the @@ -264,19 +288,35 @@ ENTRY(cpu_switch) stxa %i3, [%i5] ASI_DMMU flush %i4 +6: +#if defined(SCHED_ULE) && defined(SMP) + SET(blocked_lock, %l2, %l1) + add %i1, TD_LOCK, %l2 +7: + ATOMIC_LOAD_LONG(%l2, %l3) + cmp %l1, %l3 + be,a,pn %xcc, 7b + nop +#endif + /* * Done, return and load the new process's window from the stack. */ - -6: ret + ret restore -7: cmp %i2, %g0 - be,a,pn %xcc, 6b +8: cmp %i2, %g0 + be,pn %xcc, 6b + add %i0, TD_LOCK, %l4 +#if defined(SCHED_ULE) && defined(SMP) + membar #LoadStore | #StoreStore + ATOMIC_STORE_LONG(%l4, %l6, %l7, %i2) + ba,pt %xcc, 6b nop - stx %i2, [%i0 + TD_LOCK] - ret - restore +#else + ba,pt %xcc, 6b + stx %i2, [%l4] +#endif END(cpu_switch) ENTRY(savectx) From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:32:38 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0439D106566C; Sun, 29 Jan 2012 00:32:38 +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 D81FD8FC15; Sun, 29 Jan 2012 00:32:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0Wb0t006922; Sun, 29 Jan 2012 00:32:37 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0WbJB006920; Sun, 29 Jan 2012 00:32:37 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290032.q0T0WbJB006920@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:32:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230691 - stable/9/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:32:38 -0000 Author: marius Date: Sun Jan 29 00:32:37 2012 New Revision: 230691 URL: http://svn.freebsd.org/changeset/base/230691 Log: MFC: r226057 - Currently, sched_balance_pair() may cause a CPU to send an IPI_PREEMPT to itself, which sparc64 hardware doesn't support. One way to solve this would be to directly call sched_preempt() instead of issuing a self-IPI. However, quoting jhb@: "On the other hand, you can probably just skip the IPI entirely if we are going to send it to the current CPU. Presumably, once this routine finishes, the current CPU will exit softlock (or will do so "soon") and will then pick the next thread to run based on the adjustments made in this routine, so there's no need to IPI the CPU running this routine anyway. I think this is the better solution. Right now what is probably happening on other platforms is as soon as this routine finishes the CPU processes its self-IPI and causes mi_switch() which will just switch back to the softclock thread it is already running." - With r226054 (MFC'ed to stable/9 in r230690) and the the above change in place, sparc64 now no longer is incompatible with ULE and vice versa. However, powerpc/E500 still is. Submitted by: jhb Reviewed by: jeff Modified: stable/9/sys/kern/sched_ule.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/kern/sched_ule.c ============================================================================== --- stable/9/sys/kern/sched_ule.c Sun Jan 29 00:24:46 2012 (r230690) +++ stable/9/sys/kern/sched_ule.c Sun Jan 29 00:32:37 2012 (r230691) @@ -76,7 +76,7 @@ dtrace_vtime_switch_func_t dtrace_vtime_ #include #include -#if defined(__sparc64__) +#if defined(__powerpc__) && defined(E500) #error "This architecture is not currently compatible with ULE" #endif @@ -839,6 +839,7 @@ sched_balance_pair(struct tdq *high, str int low_load; int moved; int move; + int cpu; int diff; int i; @@ -860,10 +861,14 @@ sched_balance_pair(struct tdq *high, str for (i = 0; i < move; i++) moved += tdq_move(high, low); /* - * IPI the target cpu to force it to reschedule with the new - * workload. + * In case the target isn't the current cpu IPI it to force a + * reschedule with the new workload. */ - ipi_cpu(TDQ_ID(low), IPI_PREEMPT); + cpu = TDQ_ID(low); + sched_pin(); + if (cpu != PCPU_GET(cpuid)) + ipi_cpu(cpu, IPI_PREEMPT); + sched_unpin(); } tdq_unlock_pair(high, low); return (moved); From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:34:20 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04FC01065672; Sun, 29 Jan 2012 00:34:20 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8E8C8FC13; Sun, 29 Jan 2012 00:34:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0YJ96007037; Sun, 29 Jan 2012 00:34:19 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0YJ9a007033; Sun, 29 Jan 2012 00:34:19 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290034.q0T0YJ9a007033@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:34: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: r230692 - in stable/8/sys/dev: isp mps mpt X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:34:20 -0000 Author: marius Date: Sun Jan 29 00:34:19 2012 New Revision: 230692 URL: http://svn.freebsd.org/changeset/base/230692 Log: MFC: r226118 Sync with ahc(4)/ahd(4)/sym(4) etc: Zero any sense not transferred by the device as the SCSI specification mandates that any untransferred data should be assumed to be zero. Reviewed by: ken Modified: stable/8/sys/dev/isp/isp_freebsd.h stable/8/sys/dev/mps/mps_sas.c stable/8/sys/dev/mpt/mpt_cam.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) Modified: stable/8/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/8/sys/dev/isp/isp_freebsd.h Sun Jan 29 00:32:37 2012 (r230691) +++ stable/8/sys/dev/isp/isp_freebsd.h Sun Jan 29 00:34:19 2012 (r230692) @@ -473,6 +473,7 @@ default: \ #define XS_SAVE_SENSE(xs, sense_ptr, sense_len) \ (xs)->ccb_h.status |= CAM_AUTOSNS_VALID; \ + memset(&(xs)->sense_data, 0, sizeof(&(xs)->sense_data)); \ memcpy(&(xs)->sense_data, sense_ptr, imin(XS_SNSLEN(xs), sense_len)) #define XS_SENSE_VALID(xs) (((xs)->ccb_h.status & CAM_AUTOSNS_VALID) != 0) Modified: stable/8/sys/dev/mps/mps_sas.c ============================================================================== --- stable/8/sys/dev/mps/mps_sas.c Sun Jan 29 00:32:37 2012 (r230691) +++ stable/8/sys/dev/mps/mps_sas.c Sun Jan 29 00:34:19 2012 (r230692) @@ -1670,6 +1670,7 @@ mpssas_scsiio_complete(struct mps_softc sizeof(struct scsi_sense_data)); if (sense_len < rep->SenseCount) ccb->csio.sense_resid = rep->SenseCount - sense_len; + bzero(&ccb->csio.sense_data, sizeof(&ccb->csio.sense_data)); bcopy(cm->cm_sense, &ccb->csio.sense_data, sense_len); ccb->ccb_h.status |= CAM_AUTOSNS_VALID; } Modified: stable/8/sys/dev/mpt/mpt_cam.c ============================================================================== --- stable/8/sys/dev/mpt/mpt_cam.c Sun Jan 29 00:32:37 2012 (r230691) +++ stable/8/sys/dev/mpt/mpt_cam.c Sun Jan 29 00:34:19 2012 (r230692) @@ -3170,6 +3170,7 @@ mpt_scsi_reply_frame_handler(struct mpt_ ccb->ccb_h.status |= CAM_AUTOSNS_VALID; ccb->csio.sense_resid = ccb->csio.sense_len - le32toh(scsi_io_reply->SenseCount); + bzero(&ccb->csio.sense_data, sizeof(&ccb->csio.sense_data)); bcopy(req->sense_vbuf, &ccb->csio.sense_data, min(ccb->csio.sense_len, le32toh(scsi_io_reply->SenseCount))); From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:35:23 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 849F8106564A; Sun, 29 Jan 2012 00:35:23 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5361D8FC14; Sun, 29 Jan 2012 00:35:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0ZMwT007201; Sun, 29 Jan 2012 00:35:22 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0ZMFQ007199; Sun, 29 Jan 2012 00:35:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290035.q0T0ZMFQ007199@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:35:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230693 - stable/8/sys/dev/vr X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:35:23 -0000 Author: marius Date: Sun Jan 29 00:35:22 2012 New Revision: 230693 URL: http://svn.freebsd.org/changeset/base/230693 Log: MFC: r226171 Sprinkle const. Modified: stable/8/sys/dev/vr/if_vr.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) Modified: stable/8/sys/dev/vr/if_vr.c ============================================================================== --- stable/8/sys/dev/vr/if_vr.c Sun Jan 29 00:34:19 2012 (r230692) +++ stable/8/sys/dev/vr/if_vr.c Sun Jan 29 00:35:22 2012 (r230693) @@ -114,12 +114,12 @@ MODULE_DEPEND(vr, miibus, 1, 1, 1); #define VR_Q_CSUM (1<<1) #define VR_Q_CAM (1<<2) -static struct vr_type { +static const struct vr_type { u_int16_t vr_vid; u_int16_t vr_did; int vr_quirks; - char *vr_name; -} vr_devs[] = { + const char *vr_name; +} const vr_devs[] = { { VIA_VENDORID, VIA_DEVICEID_RHINE, VR_Q_NEEDALIGN, "VIA VT3043 Rhine I 10/100BaseTX" }, @@ -195,11 +195,11 @@ static void vr_setwol(struct vr_softc *) static void vr_clrwol(struct vr_softc *); static int vr_sysctl_stats(SYSCTL_HANDLER_ARGS); -static struct vr_tx_threshold_table { +static const struct vr_tx_threshold_table { int tx_cfg; int bcr_cfg; int value; -} vr_tx_threshold_tables[] = { +} const vr_tx_threshold_tables[] = { { VR_TXTHRESH_64BYTES, VR_BCR1_TXTHRESH64BYTES, 64 }, { VR_TXTHRESH_128BYTES, VR_BCR1_TXTHRESH128BYTES, 128 }, { VR_TXTHRESH_256BYTES, VR_BCR1_TXTHRESH256BYTES, 256 }, @@ -557,10 +557,10 @@ vr_reset(const struct vr_softc *sc) * Probe for a VIA Rhine chip. Check the PCI vendor and device * IDs against our list and return a match or NULL */ -static struct vr_type * +static const struct vr_type * vr_match(device_t dev) { - struct vr_type *t = vr_devs; + const struct vr_type *t = vr_devs; for (t = vr_devs; t->vr_name != NULL; t++) if ((pci_get_vendor(dev) == t->vr_vid) && @@ -576,7 +576,7 @@ vr_match(device_t dev) static int vr_probe(device_t dev) { - struct vr_type *t; + const struct vr_type *t; t = vr_match(dev); if (t != NULL) { @@ -595,7 +595,7 @@ vr_attach(device_t dev) { struct vr_softc *sc; struct ifnet *ifp; - struct vr_type *t; + const struct vr_type *t; uint8_t eaddr[ETHER_ADDR_LEN]; int error, rid; int i, phy, pmc; From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:35:23 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B42C21065670; Sun, 29 Jan 2012 00:35:23 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83D1B8FC1D; Sun, 29 Jan 2012 00:35:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0ZNdU007215; Sun, 29 Jan 2012 00:35:23 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0ZN9E007213; Sun, 29 Jan 2012 00:35:23 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290035.q0T0ZN9E007213@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:35:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230694 - stable/9/sys/dev/vr X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:35:23 -0000 Author: marius Date: Sun Jan 29 00:35:22 2012 New Revision: 230694 URL: http://svn.freebsd.org/changeset/base/230694 Log: MFC: r226171 Sprinkle const. Modified: stable/9/sys/dev/vr/if_vr.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/vr/if_vr.c ============================================================================== --- stable/9/sys/dev/vr/if_vr.c Sun Jan 29 00:35:22 2012 (r230693) +++ stable/9/sys/dev/vr/if_vr.c Sun Jan 29 00:35:22 2012 (r230694) @@ -114,12 +114,12 @@ MODULE_DEPEND(vr, miibus, 1, 1, 1); #define VR_Q_CSUM (1<<1) #define VR_Q_CAM (1<<2) -static struct vr_type { +static const struct vr_type { u_int16_t vr_vid; u_int16_t vr_did; int vr_quirks; - char *vr_name; -} vr_devs[] = { + const char *vr_name; +} const vr_devs[] = { { VIA_VENDORID, VIA_DEVICEID_RHINE, VR_Q_NEEDALIGN, "VIA VT3043 Rhine I 10/100BaseTX" }, @@ -195,11 +195,11 @@ static void vr_setwol(struct vr_softc *) static void vr_clrwol(struct vr_softc *); static int vr_sysctl_stats(SYSCTL_HANDLER_ARGS); -static struct vr_tx_threshold_table { +static const struct vr_tx_threshold_table { int tx_cfg; int bcr_cfg; int value; -} vr_tx_threshold_tables[] = { +} const vr_tx_threshold_tables[] = { { VR_TXTHRESH_64BYTES, VR_BCR1_TXTHRESH64BYTES, 64 }, { VR_TXTHRESH_128BYTES, VR_BCR1_TXTHRESH128BYTES, 128 }, { VR_TXTHRESH_256BYTES, VR_BCR1_TXTHRESH256BYTES, 256 }, @@ -553,10 +553,10 @@ vr_reset(const struct vr_softc *sc) * Probe for a VIA Rhine chip. Check the PCI vendor and device * IDs against our list and return a match or NULL */ -static struct vr_type * +static const struct vr_type * vr_match(device_t dev) { - struct vr_type *t = vr_devs; + const struct vr_type *t = vr_devs; for (t = vr_devs; t->vr_name != NULL; t++) if ((pci_get_vendor(dev) == t->vr_vid) && @@ -572,7 +572,7 @@ vr_match(device_t dev) static int vr_probe(device_t dev) { - struct vr_type *t; + const struct vr_type *t; t = vr_match(dev); if (t != NULL) { @@ -591,7 +591,7 @@ vr_attach(device_t dev) { struct vr_softc *sc; struct ifnet *ifp; - struct vr_type *t; + const struct vr_type *t; uint8_t eaddr[ETHER_ADDR_LEN]; int error, rid; int i, phy, pmc; From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:40:39 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D312C106566C; Sun, 29 Jan 2012 00:40:39 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC6778FC08; Sun, 29 Jan 2012 00:40:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0edU6007454; Sun, 29 Jan 2012 00:40:39 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0edhw007452; Sun, 29 Jan 2012 00:40:39 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290040.q0T0edhw007452@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:40:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230695 - stable/9/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:40:39 -0000 Author: marius Date: Sun Jan 29 00:40:39 2012 New Revision: 230695 URL: http://svn.freebsd.org/changeset/base/230695 Log: MFC: r226175 In device_get_children() avoid malloc(0) in order to increase portability to other operating systems. PR: 154287 Modified: stable/9/sys/kern/subr_bus.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/kern/subr_bus.c ============================================================================== --- stable/9/sys/kern/subr_bus.c Sun Jan 29 00:35:22 2012 (r230694) +++ stable/9/sys/kern/subr_bus.c Sun Jan 29 00:40:39 2012 (r230695) @@ -2173,6 +2173,11 @@ device_get_children(device_t dev, device TAILQ_FOREACH(child, &dev->children, link) { count++; } + if (count == 0) { + *devlistp = NULL; + *devcountp = 0; + return (0); + } list = malloc(count * sizeof(device_t), M_TEMP, M_NOWAIT|M_ZERO); if (!list) From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:41:09 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15A26106566C; Sun, 29 Jan 2012 00:41:09 +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 F37758FC20; Sun, 29 Jan 2012 00:41:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0f8fQ007506; Sun, 29 Jan 2012 00:41:08 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0f8iF007504; Sun, 29 Jan 2012 00:41:08 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290041.q0T0f8iF007504@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:41:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230696 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:41:09 -0000 Author: marius Date: Sun Jan 29 00:41:08 2012 New Revision: 230696 URL: http://svn.freebsd.org/changeset/base/230696 Log: MFC: r226175 In device_get_children() avoid malloc(0) in order to increase portability to other operating systems. PR: 154287 Modified: stable/8/sys/kern/subr_bus.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) Modified: stable/8/sys/kern/subr_bus.c ============================================================================== --- stable/8/sys/kern/subr_bus.c Sun Jan 29 00:40:39 2012 (r230695) +++ stable/8/sys/kern/subr_bus.c Sun Jan 29 00:41:08 2012 (r230696) @@ -2176,6 +2176,11 @@ device_get_children(device_t dev, device TAILQ_FOREACH(child, &dev->children, link) { count++; } + if (count == 0) { + *devlistp = NULL; + *devcountp = 0; + return (0); + } list = malloc(count * sizeof(device_t), M_TEMP, M_NOWAIT|M_ZERO); if (!list) From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:42:54 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEEA31065675; Sun, 29 Jan 2012 00:42: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 8E4468FC0C; Sun, 29 Jan 2012 00:42:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0gs3n007639; Sun, 29 Jan 2012 00:42:54 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0gsbJ007636; Sun, 29 Jan 2012 00:42:54 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290042.q0T0gsbJ007636@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:42:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230697 - stable/9/sys/dev/lge X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:42:54 -0000 Author: marius Date: Sun Jan 29 00:42:54 2012 New Revision: 230697 URL: http://svn.freebsd.org/changeset/base/230697 Log: MFC: r226270 - Remove unused remnants of MII bitbang'ing. - Sprinkle const. Modified: stable/9/sys/dev/lge/if_lge.c stable/9/sys/dev/lge/if_lgereg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/lge/if_lge.c ============================================================================== --- stable/9/sys/dev/lge/if_lge.c Sun Jan 29 00:41:08 2012 (r230696) +++ stable/9/sys/dev/lge/if_lge.c Sun Jan 29 00:42:54 2012 (r230697) @@ -110,7 +110,7 @@ __FBSDID("$FreeBSD$"); /* * Various supported device vendors/types and their names. */ -static struct lge_type lge_devs[] = { +static const struct lge_type const lge_devs[] = { { LGE_VENDORID, LGE_DEVICEID, "Level 1 Gigabit Ethernet" }, { 0, 0, NULL } }; @@ -438,7 +438,7 @@ static int lge_probe(dev) device_t dev; { - struct lge_type *t; + const struct lge_type *t; t = lge_devs; Modified: stable/9/sys/dev/lge/if_lgereg.h ============================================================================== --- stable/9/sys/dev/lge/if_lgereg.h Sun Jan 29 00:41:08 2012 (r230696) +++ stable/9/sys/dev/lge/if_lgereg.h Sun Jan 29 00:42:54 2012 (r230697) @@ -475,26 +475,9 @@ struct lge_list_data { struct lge_type { u_int16_t lge_vid; u_int16_t lge_did; - char *lge_name; + const char *lge_name; }; -struct lge_mii_frame { - u_int8_t mii_stdelim; - u_int8_t mii_opcode; - u_int8_t mii_phyaddr; - u_int8_t mii_regaddr; - u_int8_t mii_turnaround; - u_int16_t mii_data; -}; - -/* - * MII constants - */ -#define LGE_MII_STARTDELIM 0x01 -#define LGE_MII_READOP 0x02 -#define LGE_MII_WRITEOP 0x01 -#define LGE_MII_TURNAROUND 0x02 - #define LGE_JUMBO_FRAMELEN 9018 #define LGE_JUMBO_MTU (LGE_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN) #define LGE_JSLOTS 384 From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:42:55 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 809331065673; Sun, 29 Jan 2012 00:42:55 +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 5078E8FC14; Sun, 29 Jan 2012 00:42:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0gtWn007655; Sun, 29 Jan 2012 00:42:55 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0gtDu007652; Sun, 29 Jan 2012 00:42:55 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290042.q0T0gtDu007652@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:42: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: r230698 - stable/8/sys/dev/lge X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:42:55 -0000 Author: marius Date: Sun Jan 29 00:42:54 2012 New Revision: 230698 URL: http://svn.freebsd.org/changeset/base/230698 Log: MFC: r226270 - Remove unused remnants of MII bitbang'ing. - Sprinkle const. Modified: stable/8/sys/dev/lge/if_lge.c stable/8/sys/dev/lge/if_lgereg.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) Modified: stable/8/sys/dev/lge/if_lge.c ============================================================================== --- stable/8/sys/dev/lge/if_lge.c Sun Jan 29 00:42:54 2012 (r230697) +++ stable/8/sys/dev/lge/if_lge.c Sun Jan 29 00:42:54 2012 (r230698) @@ -110,7 +110,7 @@ __FBSDID("$FreeBSD$"); /* * Various supported device vendors/types and their names. */ -static struct lge_type lge_devs[] = { +static const struct lge_type const lge_devs[] = { { LGE_VENDORID, LGE_DEVICEID, "Level 1 Gigabit Ethernet" }, { 0, 0, NULL } }; @@ -442,7 +442,7 @@ static int lge_probe(dev) device_t dev; { - struct lge_type *t; + const struct lge_type *t; t = lge_devs; Modified: stable/8/sys/dev/lge/if_lgereg.h ============================================================================== --- stable/8/sys/dev/lge/if_lgereg.h Sun Jan 29 00:42:54 2012 (r230697) +++ stable/8/sys/dev/lge/if_lgereg.h Sun Jan 29 00:42:54 2012 (r230698) @@ -475,26 +475,9 @@ struct lge_list_data { struct lge_type { u_int16_t lge_vid; u_int16_t lge_did; - char *lge_name; + const char *lge_name; }; -struct lge_mii_frame { - u_int8_t mii_stdelim; - u_int8_t mii_opcode; - u_int8_t mii_phyaddr; - u_int8_t mii_regaddr; - u_int8_t mii_turnaround; - u_int16_t mii_data; -}; - -/* - * MII constants - */ -#define LGE_MII_STARTDELIM 0x01 -#define LGE_MII_READOP 0x02 -#define LGE_MII_WRITEOP 0x01 -#define LGE_MII_TURNAROUND 0x02 - #define LGE_JUMBO_FRAMELEN 9018 #define LGE_JUMBO_MTU (LGE_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN) #define LGE_JSLOTS 384 From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:45:52 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6BF81065674; Sun, 29 Jan 2012 00:45:52 +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 908628FC0A; Sun, 29 Jan 2012 00:45:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0jqm5007824; Sun, 29 Jan 2012 00:45:52 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0jqDF007822; Sun, 29 Jan 2012 00:45:52 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290045.q0T0jqDF007822@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:45:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230699 - stable/9/sys/sparc64/sbus X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:45:52 -0000 Author: marius Date: Sun Jan 29 00:45:52 2012 New Revision: 230699 URL: http://svn.freebsd.org/changeset/base/230699 Log: MFC: r226948 Remove unnecessary DMA constraints. Modified: stable/9/sys/sparc64/sbus/dma_sbus.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/sparc64/sbus/dma_sbus.c ============================================================================== --- stable/9/sys/sparc64/sbus/dma_sbus.c Sun Jan 29 00:42:54 2012 (r230698) +++ stable/9/sys/sparc64/sbus/dma_sbus.c Sun Jan 29 00:45:52 2012 (r230699) @@ -233,9 +233,9 @@ dma_attach(device_t dev) BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ - 0, /* nsegments */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ + BUS_SPACE_MAXSIZE, /* maxsize */ + BUS_SPACE_UNRESTRICTED, /* nsegments */ + BUS_SPACE_MAXSIZE, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* no locking */ &lsc->sc_parent_dmat); From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:45:55 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63C51106566C; Sun, 29 Jan 2012 00:45:55 +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 4E61E8FC08; Sun, 29 Jan 2012 00:45:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0jtRx007858; Sun, 29 Jan 2012 00:45:55 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0jtkh007856; Sun, 29 Jan 2012 00:45:55 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290045.q0T0jtkh007856@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:45:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230700 - stable/8/sys/sparc64/sbus X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:45:55 -0000 Author: marius Date: Sun Jan 29 00:45:54 2012 New Revision: 230700 URL: http://svn.freebsd.org/changeset/base/230700 Log: MFC: r226948 Remove unnecessary DMA constraints. Modified: stable/8/sys/sparc64/sbus/dma_sbus.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) Modified: stable/8/sys/sparc64/sbus/dma_sbus.c ============================================================================== --- stable/8/sys/sparc64/sbus/dma_sbus.c Sun Jan 29 00:45:52 2012 (r230699) +++ stable/8/sys/sparc64/sbus/dma_sbus.c Sun Jan 29 00:45:54 2012 (r230700) @@ -233,9 +233,9 @@ dma_attach(device_t dev) BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ - 0, /* nsegments */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ + BUS_SPACE_MAXSIZE, /* maxsize */ + BUS_SPACE_UNRESTRICTED, /* nsegments */ + BUS_SPACE_MAXSIZE, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* no locking */ &lsc->sc_parent_dmat); From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:47:12 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2689D1065690; Sun, 29 Jan 2012 00:47:12 +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 10C748FC1F; Sun, 29 Jan 2012 00:47:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0lB9W007962; Sun, 29 Jan 2012 00:47:11 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0lBKZ007960; Sun, 29 Jan 2012 00:47:11 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290047.q0T0lBKZ007960@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:47:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230701 - stable/9/sys/dev/esp X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:47:12 -0000 Author: marius Date: Sun Jan 29 00:47:11 2012 New Revision: 230701 URL: http://svn.freebsd.org/changeset/base/230701 Log: MFC: r226950 Add multiple inclusion protection. Modified: stable/9/sys/dev/esp/ncr53c9xreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/esp/ncr53c9xreg.h ============================================================================== --- stable/9/sys/dev/esp/ncr53c9xreg.h Sun Jan 29 00:45:54 2012 (r230700) +++ stable/9/sys/dev/esp/ncr53c9xreg.h Sun Jan 29 00:47:11 2012 (r230701) @@ -31,6 +31,9 @@ /* $FreeBSD$ */ +#ifndef _NCR53C9XREG_H_ +#define _NCR53C9XREG_H_ + /* * Register addresses, relative to some base address */ @@ -288,3 +291,4 @@ #define NCRFAS_STAT2_OSHUTTLE 0x40 /* next byte from FIFO is MSB */ #define NCRFAS_STAT2_EMPTY 0x80 /* FIFO is empty */ +#endif /* _NCR53C9XREG_H_ */ From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:47:14 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEA8D106567C; Sun, 29 Jan 2012 00:47:14 +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 A87278FC13; Sun, 29 Jan 2012 00:47:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0lEEf007996; Sun, 29 Jan 2012 00:47:14 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0lEd1007994; Sun, 29 Jan 2012 00:47:14 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290047.q0T0lEd1007994@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:47:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230702 - stable/8/sys/dev/esp X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:47:14 -0000 Author: marius Date: Sun Jan 29 00:47:14 2012 New Revision: 230702 URL: http://svn.freebsd.org/changeset/base/230702 Log: MFC: r226950 Add multiple inclusion protection. Modified: stable/8/sys/dev/esp/ncr53c9xreg.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) Modified: stable/8/sys/dev/esp/ncr53c9xreg.h ============================================================================== --- stable/8/sys/dev/esp/ncr53c9xreg.h Sun Jan 29 00:47:11 2012 (r230701) +++ stable/8/sys/dev/esp/ncr53c9xreg.h Sun Jan 29 00:47:14 2012 (r230702) @@ -31,6 +31,9 @@ /* $FreeBSD$ */ +#ifndef _NCR53C9XREG_H_ +#define _NCR53C9XREG_H_ + /* * Register addresses, relative to some base address */ @@ -288,3 +291,4 @@ #define NCRFAS_STAT2_OSHUTTLE 0x40 /* next byte from FIFO is MSB */ #define NCRFAS_STAT2_EMPTY 0x80 /* FIFO is empty */ +#endif /* _NCR53C9XREG_H_ */ From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:49:13 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37076106566C; Sun, 29 Jan 2012 00:49: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 06F278FC13; Sun, 29 Jan 2012 00:49:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0nCWI008123; Sun, 29 Jan 2012 00:49:12 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0nCwk008121; Sun, 29 Jan 2012 00:49:12 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290049.q0T0nCwk008121@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:49:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230703 - stable/9/sys/dev/re X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:49:13 -0000 Author: marius Date: Sun Jan 29 00:49:12 2012 New Revision: 230703 URL: http://svn.freebsd.org/changeset/base/230703 Log: MFC: r227043 Sprinkle some const. Modified: stable/9/sys/dev/re/if_re.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/re/if_re.c ============================================================================== --- stable/9/sys/dev/re/if_re.c Sun Jan 29 00:47:14 2012 (r230702) +++ stable/9/sys/dev/re/if_re.c Sun Jan 29 00:49:12 2012 (r230703) @@ -171,7 +171,7 @@ TUNABLE_INT("hw.re.prefer_iomap", &prefe /* * Various supported device vendors/types and their names. */ -static struct rl_type re_devs[] = { +static const struct rl_type const re_devs[] = { { DLINK_VENDORID, DLINK_DEVICEID_528T, 0, "D-Link DGE-528(T) Gigabit Ethernet Adapter" }, { DLINK_VENDORID, DLINK_DEVICEID_530T_REVC, 0, @@ -194,8 +194,8 @@ static struct rl_type re_devs[] = { "US Robotics 997902 (RTL8169S) Gigabit Ethernet" } }; -static struct rl_hwrev re_hwrevs[] = { - { RL_HWREV_8139, RL_8139, "", RL_MTU }, +static const struct rl_hwrev const re_hwrevs[] = { + { RL_HWREV_8139, RL_8139, "", RL_MTU }, { RL_HWREV_8139A, RL_8139, "A", RL_MTU }, { RL_HWREV_8139AG, RL_8139, "A-G", RL_MTU }, { RL_HWREV_8139B, RL_8139, "B", RL_MTU }, @@ -869,7 +869,7 @@ re_diag(struct rl_softc *sc) device_printf(sc->rl_dev, "expected TX data: %6D/%6D/0x%x\n", dst, ":", src, ":", ETHERTYPE_IP); device_printf(sc->rl_dev, "received RX data: %6D/%6D/0x%x\n", - eh->ether_dhost, ":", eh->ether_shost, ":", + eh->ether_dhost, ":", eh->ether_shost, ":", ntohs(eh->ether_type)); device_printf(sc->rl_dev, "You may have a defective 32-bit " "NIC plugged into a 64-bit PCI slot.\n"); @@ -904,7 +904,7 @@ done: static int re_probe(device_t dev) { - struct rl_type *t; + const struct rl_type *t; uint16_t devid, vendor; uint16_t revid, sdevid; int i; @@ -1184,7 +1184,7 @@ re_attach(device_t dev) u_int16_t as[ETHER_ADDR_LEN / 2]; struct rl_softc *sc; struct ifnet *ifp; - struct rl_hwrev *hw_rev; + const struct rl_hwrev *hw_rev; u_int32_t cap, ctl; int hwrev; u_int16_t devid, re_did = 0; From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:49:15 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23A531065670; Sun, 29 Jan 2012 00:49:15 +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 0DF688FC08; Sun, 29 Jan 2012 00:49:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0nEXX008153; Sun, 29 Jan 2012 00:49:14 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0nEBB008151; Sun, 29 Jan 2012 00:49:14 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290049.q0T0nEBB008151@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:49:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230704 - stable/8/sys/dev/re X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:49:15 -0000 Author: marius Date: Sun Jan 29 00:49:14 2012 New Revision: 230704 URL: http://svn.freebsd.org/changeset/base/230704 Log: MFC: r227043 Sprinkle some const. Modified: stable/8/sys/dev/re/if_re.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) Modified: stable/8/sys/dev/re/if_re.c ============================================================================== --- stable/8/sys/dev/re/if_re.c Sun Jan 29 00:49:12 2012 (r230703) +++ stable/8/sys/dev/re/if_re.c Sun Jan 29 00:49:14 2012 (r230704) @@ -171,7 +171,7 @@ TUNABLE_INT("hw.re.prefer_iomap", &prefe /* * Various supported device vendors/types and their names. */ -static struct rl_type re_devs[] = { +static const struct rl_type const re_devs[] = { { DLINK_VENDORID, DLINK_DEVICEID_528T, 0, "D-Link DGE-528(T) Gigabit Ethernet Adapter" }, { DLINK_VENDORID, DLINK_DEVICEID_530T_REVC, 0, @@ -194,8 +194,8 @@ static struct rl_type re_devs[] = { "US Robotics 997902 (RTL8169S) Gigabit Ethernet" } }; -static struct rl_hwrev re_hwrevs[] = { - { RL_HWREV_8139, RL_8139, "", RL_MTU }, +static const struct rl_hwrev const re_hwrevs[] = { + { RL_HWREV_8139, RL_8139, "", RL_MTU }, { RL_HWREV_8139A, RL_8139, "A", RL_MTU }, { RL_HWREV_8139AG, RL_8139, "A-G", RL_MTU }, { RL_HWREV_8139B, RL_8139, "B", RL_MTU }, @@ -873,7 +873,7 @@ re_diag(struct rl_softc *sc) device_printf(sc->rl_dev, "expected TX data: %6D/%6D/0x%x\n", dst, ":", src, ":", ETHERTYPE_IP); device_printf(sc->rl_dev, "received RX data: %6D/%6D/0x%x\n", - eh->ether_dhost, ":", eh->ether_shost, ":", + eh->ether_dhost, ":", eh->ether_shost, ":", ntohs(eh->ether_type)); device_printf(sc->rl_dev, "You may have a defective 32-bit " "NIC plugged into a 64-bit PCI slot.\n"); @@ -908,7 +908,7 @@ done: static int re_probe(device_t dev) { - struct rl_type *t; + const struct rl_type *t; uint16_t devid, vendor; uint16_t revid, sdevid; int i; @@ -1188,7 +1188,7 @@ re_attach(device_t dev) u_int16_t as[ETHER_ADDR_LEN / 2]; struct rl_softc *sc; struct ifnet *ifp; - struct rl_hwrev *hw_rev; + const struct rl_hwrev *hw_rev; u_int32_t cap, ctl; int hwrev; u_int16_t devid, re_did = 0; From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:50:42 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06A9710656D7; Sun, 29 Jan 2012 00:50: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 CA8FF8FC20; Sun, 29 Jan 2012 00:50:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0of1H008268; Sun, 29 Jan 2012 00:50:41 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0offU008266; Sun, 29 Jan 2012 00:50:41 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290050.q0T0offU008266@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:50:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230705 - stable/9/sys/dev/dc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:50:42 -0000 Author: marius Date: Sun Jan 29 00:50:41 2012 New Revision: 230705 URL: http://svn.freebsd.org/changeset/base/230705 Log: MFC: r227685 - There's no need to ignore the return value of mii_attach(9) when attaching dcphy(4) (CID 9283). - In dc_detach(), check whether ifp is NULL as dc_attach() may call the former without ifp being allocated (CID 4288). Found with: Coverity Prevent(tm) Modified: stable/9/sys/dev/dc/if_dc.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/dc/if_dc.c ============================================================================== --- stable/9/sys/dev/dc/if_dc.c Sun Jan 29 00:49:14 2012 (r230704) +++ stable/9/sys/dev/dc/if_dc.c Sun Jan 29 00:50:41 2012 (r230705) @@ -2452,9 +2452,6 @@ dc_attach(device_t dev) if (sc->dc_pmode != DC_PMODE_SIA) sc->dc_pmode = DC_PMODE_SYM; sc->dc_flags |= DC_21143_NWAY; - 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 @@ -2465,7 +2462,9 @@ dc_attach(device_t dev) if (!(pci_get_subvendor(dev) == 0x1033 && pci_get_subdevice(dev) == 0x8028)) sc->dc_flags |= DC_TULIP_LEDS; - error = 0; + error = mii_attach(dev, &sc->dc_miibus, ifp, dc_ifmedia_upd, + dc_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, 0); } if (error) { @@ -2534,7 +2533,7 @@ dc_detach(device_t dev) ifp = sc->dc_ifp; #ifdef DEVICE_POLLING - if (ifp->if_capenable & IFCAP_POLLING) + if (ifp != NULL && ifp->if_capenable & IFCAP_POLLING) ether_poll_deregister(ifp); #endif @@ -2558,7 +2557,7 @@ dc_detach(device_t dev) if (sc->dc_res) bus_release_resource(dev, DC_RES, DC_RID, sc->dc_res); - if (ifp) + if (ifp != NULL) if_free(ifp); dc_dma_free(sc); @@ -2608,7 +2607,6 @@ dc_list_tx_init(struct dc_softc *sc) return (0); } - /* * Initialize the RX descriptors and allocate mbufs for them. Note that * we arrange the descriptors in a closed ring, so that the last descriptor From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:50:51 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FBE510656DA; Sun, 29 Jan 2012 00:50:51 +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 007538FC13; Sun, 29 Jan 2012 00:50:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0ooTd008308; Sun, 29 Jan 2012 00:50:50 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0oos0008306; Sun, 29 Jan 2012 00:50:50 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290050.q0T0oos0008306@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:50:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230706 - stable/8/sys/dev/dc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:50:51 -0000 Author: marius Date: Sun Jan 29 00:50:50 2012 New Revision: 230706 URL: http://svn.freebsd.org/changeset/base/230706 Log: MFC: r227685 - There's no need to ignore the return value of mii_attach(9) when attaching dcphy(4) (CID 9283). - In dc_detach(), check whether ifp is NULL as dc_attach() may call the former without ifp being allocated (CID 4288). Found with: Coverity Prevent(tm) Modified: stable/8/sys/dev/dc/if_dc.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) Modified: stable/8/sys/dev/dc/if_dc.c ============================================================================== --- stable/8/sys/dev/dc/if_dc.c Sun Jan 29 00:50:41 2012 (r230705) +++ stable/8/sys/dev/dc/if_dc.c Sun Jan 29 00:50:50 2012 (r230706) @@ -2456,9 +2456,6 @@ dc_attach(device_t dev) if (sc->dc_pmode != DC_PMODE_SIA) sc->dc_pmode = DC_PMODE_SYM; sc->dc_flags |= DC_21143_NWAY; - 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 @@ -2469,7 +2466,9 @@ dc_attach(device_t dev) if (!(pci_get_subvendor(dev) == 0x1033 && pci_get_subdevice(dev) == 0x8028)) sc->dc_flags |= DC_TULIP_LEDS; - error = 0; + error = mii_attach(dev, &sc->dc_miibus, ifp, dc_ifmedia_upd, + dc_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, 0); } if (error) { @@ -2538,7 +2537,7 @@ dc_detach(device_t dev) ifp = sc->dc_ifp; #ifdef DEVICE_POLLING - if (ifp->if_capenable & IFCAP_POLLING) + if (ifp != NULL && ifp->if_capenable & IFCAP_POLLING) ether_poll_deregister(ifp); #endif @@ -2562,7 +2561,7 @@ dc_detach(device_t dev) if (sc->dc_res) bus_release_resource(dev, DC_RES, DC_RID, sc->dc_res); - if (ifp) + if (ifp != NULL) if_free(ifp); dc_dma_free(sc); @@ -2612,7 +2611,6 @@ dc_list_tx_init(struct dc_softc *sc) return (0); } - /* * Initialize the RX descriptors and allocate mbufs for them. Note that * we arrange the descriptors in a closed ring, so that the last descriptor From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:52:05 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DF5C106566C; Sun, 29 Jan 2012 00:52:05 +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 3D9158FC0C; Sun, 29 Jan 2012 00:52:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0q5ae008414; Sun, 29 Jan 2012 00:52:05 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0q5Qo008411; Sun, 29 Jan 2012 00:52:05 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290052.q0T0q5Qo008411@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:52:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230707 - stable/9/sys/dev/dc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:52:05 -0000 Author: marius Date: Sun Jan 29 00:52:04 2012 New Revision: 230707 URL: http://svn.freebsd.org/changeset/base/230707 Log: MFC: r227686 There's no need to read DC_10BTSTAT twice in dcphy_status(). Modified: stable/9/sys/dev/dc/dcphy.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/dc/dcphy.c ============================================================================== --- stable/9/sys/dev/dc/dcphy.c Sun Jan 29 00:50:50 2012 (r230706) +++ stable/9/sys/dev/dc/dcphy.c Sun Jan 29 00:52:04 2012 (r230707) @@ -294,7 +294,7 @@ static void dcphy_status(struct mii_softc *sc) { struct mii_data *mii = sc->mii_pdata; - int reg, anlpar, tstat = 0; + int anlpar, tstat; struct dc_softc *dc_sc; dc_sc = mii->mii_ifp->if_softc; @@ -305,13 +305,12 @@ dcphy_status(struct mii_softc *sc) if ((mii->mii_ifp->if_flags & IFF_UP) == 0) return; - reg = CSR_READ_4(dc_sc, DC_10BTSTAT); - if (!(reg & DC_TSTAT_LS10) || !(reg & DC_TSTAT_LS100)) + tstat = CSR_READ_4(dc_sc, DC_10BTSTAT); + if (!(tstat & DC_TSTAT_LS10) || !(tstat & DC_TSTAT_LS100)) mii->mii_media_status |= IFM_ACTIVE; if (CSR_READ_4(dc_sc, DC_10BTCTRL) & DC_TCTL_AUTONEGENBL) { /* Erg, still trying, I guess... */ - tstat = CSR_READ_4(dc_sc, DC_10BTSTAT); if ((tstat & DC_TSTAT_ANEGSTAT) != DC_ASTAT_AUTONEGCMP) { if ((DC_IS_MACRONIX(dc_sc) || DC_IS_PNICII(dc_sc)) && (tstat & DC_TSTAT_ANEGSTAT) == DC_ASTAT_DISABLE) @@ -351,9 +350,9 @@ dcphy_status(struct mii_softc *sc) * and hope that the user is clever enough to manually * change the media settings if we're wrong. */ - if (!(reg & DC_TSTAT_LS100)) + if (!(tstat & DC_TSTAT_LS100)) mii->mii_media_active |= IFM_100_TX | IFM_HDX; - else if (!(reg & DC_TSTAT_LS10)) + else if (!(tstat & DC_TSTAT_LS10)) mii->mii_media_active |= IFM_10_T | IFM_HDX; else mii->mii_media_active |= IFM_NONE; From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 00:52:08 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A181C1065670; Sun, 29 Jan 2012 00:52:08 +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 70ABB8FC12; Sun, 29 Jan 2012 00:52:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T0q8U7008450; Sun, 29 Jan 2012 00:52:08 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T0q8UC008448; Sun, 29 Jan 2012 00:52:08 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290052.q0T0q8UC008448@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 00:52:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230708 - stable/8/sys/dev/dc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 00:52:08 -0000 Author: marius Date: Sun Jan 29 00:52:07 2012 New Revision: 230708 URL: http://svn.freebsd.org/changeset/base/230708 Log: MFC: r227686 There's no need to read DC_10BTSTAT twice in dcphy_status(). Modified: stable/8/sys/dev/dc/dcphy.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) Modified: stable/8/sys/dev/dc/dcphy.c ============================================================================== --- stable/8/sys/dev/dc/dcphy.c Sun Jan 29 00:52:04 2012 (r230707) +++ stable/8/sys/dev/dc/dcphy.c Sun Jan 29 00:52:07 2012 (r230708) @@ -303,7 +303,7 @@ static void dcphy_status(struct mii_softc *sc) { struct mii_data *mii = sc->mii_pdata; - int reg, anlpar, tstat = 0; + int anlpar, tstat; struct dc_softc *dc_sc; dc_sc = mii->mii_ifp->if_softc; @@ -314,13 +314,12 @@ dcphy_status(struct mii_softc *sc) if ((mii->mii_ifp->if_flags & IFF_UP) == 0) return; - reg = CSR_READ_4(dc_sc, DC_10BTSTAT); - if (!(reg & DC_TSTAT_LS10) || !(reg & DC_TSTAT_LS100)) + tstat = CSR_READ_4(dc_sc, DC_10BTSTAT); + if (!(tstat & DC_TSTAT_LS10) || !(tstat & DC_TSTAT_LS100)) mii->mii_media_status |= IFM_ACTIVE; if (CSR_READ_4(dc_sc, DC_10BTCTRL) & DC_TCTL_AUTONEGENBL) { /* Erg, still trying, I guess... */ - tstat = CSR_READ_4(dc_sc, DC_10BTSTAT); if ((tstat & DC_TSTAT_ANEGSTAT) != DC_ASTAT_AUTONEGCMP) { if ((DC_IS_MACRONIX(dc_sc) || DC_IS_PNICII(dc_sc)) && (tstat & DC_TSTAT_ANEGSTAT) == DC_ASTAT_DISABLE) @@ -360,9 +359,9 @@ dcphy_status(struct mii_softc *sc) * and hope that the user is clever enough to manually * change the media settings if we're wrong. */ - if (!(reg & DC_TSTAT_LS100)) + if (!(tstat & DC_TSTAT_LS100)) mii->mii_media_active |= IFM_100_TX | IFM_HDX; - else if (!(reg & DC_TSTAT_LS10)) + else if (!(tstat & DC_TSTAT_LS10)) mii->mii_media_active |= IFM_10_T | IFM_HDX; else mii->mii_media_active |= IFM_NONE; From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 01:00:13 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4F091065670; Sun, 29 Jan 2012 01:00:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90F0F8FC18; Sun, 29 Jan 2012 01:00:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T10B2B008799; Sun, 29 Jan 2012 01:00:11 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T10BR7008797; Sun, 29 Jan 2012 01:00:11 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290100.q0T10BR7008797@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 01:00:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230709 - stable/9/sys/dev/mii X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 01:00:13 -0000 Author: marius Date: Sun Jan 29 01:00:11 2012 New Revision: 230709 URL: http://svn.freebsd.org/changeset/base/230709 Log: MFC: r227687, r228290 - Add a hint.miibus.X.phymask hint, allowing do individually exclude PHY addresses from being probed and attaching something including ukphy(4) to it. This is mainly necessarily for PHY switches that create duplicate or fake PHYs on the bus that can corrupt the PHY state when accessed or simply cause problems when ukphy(4) isolates the additional instances. - Change miibus(4) to be a hinted bus, allowing to add child devices via hints and to set their attach arguments (including for automatically probed PHYs). This is mainly needed for PHY switches that violate IEEE 802.3 and don't even implement the basic register set so we can't probe them automatically. However, the ability to alter the attach arguments for automatically probed PHYs is also useful as for example it allows to test (or tell a user to test) new variant of a PHY with a specific driver by letting an existing driver attach to it via manipulating the IDs without the need to touch the source code or to limit a Gigabit Ethernet PHY to only announce up to Fast Ethernet in order to save energy by limiting the capability mask. Generally, a driver has to be hinted via hint.phydrv.X.at="miibusY" and hint.phydrv.X.phyno="Z" (which already is sufficient to add phydrvX at miibusY at PHY address Z). Then optionally the following attach arguments additionally can be configured: hint.phydrv.X.id1 hint.phydrv.X.id2 hint.phydrv.X.capmask - Some minor cleanup. Reviewed by: adrian, ray Modified: stable/9/sys/dev/mii/mii.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/mii/mii.c ============================================================================== --- stable/9/sys/dev/mii/mii.c Sun Jan 29 00:52:07 2012 (r230708) +++ stable/9/sys/dev/mii/mii.c Sun Jan 29 01:00:11 2012 (r230709) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -57,18 +56,17 @@ MODULE_VERSION(miibus, 1); #include "miibus_if.h" -static int miibus_print_child(device_t dev, device_t child); -static int miibus_read_ivar(device_t dev, device_t child, int which, - uintptr_t *result); -static int miibus_child_location_str(device_t bus, device_t child, char *buf, - size_t buflen); -static int miibus_child_pnpinfo_str(device_t bus, device_t child, char *buf, - size_t buflen); -static int miibus_readreg(device_t, int, int); -static int miibus_writereg(device_t, int, int, int); -static void miibus_statchg(device_t); -static void miibus_linkchg(device_t); -static void miibus_mediainit(device_t); +static bus_child_location_str_t miibus_child_location_str; +static bus_child_pnpinfo_str_t miibus_child_pnpinfo_str; +static bus_hinted_child_t miibus_hinted_child; +static bus_print_child_t miibus_print_child; +static bus_read_ivar_t miibus_read_ivar; +static miibus_readreg_t miibus_readreg; +static miibus_statchg_t miibus_statchg; +static miibus_writereg_t miibus_writereg; +static miibus_linkchg_t miibus_linkchg; +static miibus_mediainit_t miibus_mediainit; + static unsigned char mii_bitreverse(unsigned char x); static device_method_t miibus_methods[] = { @@ -83,6 +81,7 @@ static device_method_t miibus_methods[] DEVMETHOD(bus_read_ivar, miibus_read_ivar), DEVMETHOD(bus_child_pnpinfo_str, miibus_child_pnpinfo_str), DEVMETHOD(bus_child_location_str, miibus_child_location_str), + DEVMETHOD(bus_hinted_child, miibus_hinted_child), /* MII interface */ DEVMETHOD(miibus_readreg, miibus_readreg), @@ -106,7 +105,8 @@ struct miibus_ivars { struct ifnet *ifp; ifm_change_cb_t ifmedia_upd; ifm_stat_cb_t ifmedia_sts; - int mii_flags; + u_int mii_flags; + u_int mii_offset; }; int @@ -128,7 +128,6 @@ miibus_attach(device_t dev) int i, nchildren; mii = device_get_softc(dev); - nchildren = 0; if (device_get_children(dev, &children, &nchildren) == 0) { for (i = 0; i < nchildren; i++) { ma = device_get_ivars(children[i]); @@ -200,7 +199,7 @@ miibus_read_ivar(device_t dev, device_t } static int -miibus_child_pnpinfo_str(device_t bus __unused, device_t child, char *buf, +miibus_child_pnpinfo_str(device_t dev __unused, device_t child, char *buf, size_t buflen) { struct mii_attach_args *ma; @@ -213,7 +212,7 @@ miibus_child_pnpinfo_str(device_t bus __ } static int -miibus_child_location_str(device_t bus __unused, device_t child, char *buf, +miibus_child_location_str(device_t dev __unused, device_t child, char *buf, size_t buflen) { struct mii_attach_args *ma; @@ -223,6 +222,60 @@ miibus_child_location_str(device_t bus _ return (0); } +static void +miibus_hinted_child(device_t dev, const char *name, int unit) +{ + struct miibus_ivars *ivars; + struct mii_attach_args *args, *ma; + device_t *children, phy; + int i, nchildren; + u_int val; + + if (resource_int_value(name, unit, "phyno", &val) != 0) + return; + if (device_get_children(dev, &children, &nchildren) != 0) + return; + ma = NULL; + for (i = 0; i < nchildren; i++) { + args = device_get_ivars(children[i]); + if (args->mii_phyno == val) { + ma = args; + break; + } + } + free(children, M_TEMP); + + /* + * Don't add a PHY that was automatically identified by having media + * in its BMSR twice, only allow to alter its attach arguments. + */ + if (ma == NULL) { + ma = malloc(sizeof(struct mii_attach_args), M_DEVBUF, + M_NOWAIT); + if (ma == NULL) + return; + phy = device_add_child(dev, name, unit); + if (phy == NULL) { + free(ma, M_DEVBUF); + return; + } + ivars = device_get_ivars(dev); + ma->mii_phyno = val; + ma->mii_offset = ivars->mii_offset++; + ma->mii_id1 = 0; + ma->mii_id2 = 0; + ma->mii_capmask = BMSR_DEFCAPMASK; + device_set_ivars(phy, ma); + } + + if (resource_int_value(name, unit, "id1", &val) == 0) + ma->mii_id1 = val; + if (resource_int_value(name, unit, "id2", &val) == 0) + ma->mii_id2 = val; + if (resource_int_value(name, unit, "capmask", &val) == 0) + ma->mii_capmask = val; +} + static int miibus_readreg(device_t dev, int phy, int reg) { @@ -306,9 +359,10 @@ mii_attach(device_t dev, device_t *miibu int phyloc, int offloc, int flags) { struct miibus_ivars *ivars; - struct mii_attach_args ma, *args; + struct mii_attach_args *args, ma; device_t *children, phy; - int bmsr, first, i, nchildren, offset, phymax, phymin, rv; + int bmsr, first, i, nchildren, phymax, phymin, rv; + uint32_t phymask; if (phyloc != MII_PHY_ANY && offloc != MII_OFFSET_ANY) { printf("%s: phyloc and offloc specified\n", __func__); @@ -365,27 +419,30 @@ mii_attach(device_t dev, device_t *miibu ma.mii_capmask = capmask; - phy = NULL; - offset = 0; + if (resource_int_value(device_get_name(*miibus), + device_get_unit(*miibus), "phymask", &phymask) != 0) + phymask = 0xffffffff; + + if (device_get_children(*miibus, &children, &nchildren) != 0) { + children = NULL; + nchildren = 0; + } + ivars->mii_offset = 0; for (ma.mii_phyno = phymin; ma.mii_phyno <= phymax; ma.mii_phyno++) { /* * Make sure we haven't already configured a PHY at this * address. This allows mii_attach() to be called * multiple times. */ - if (device_get_children(*miibus, &children, &nchildren) == 0) { - for (i = 0; i < nchildren; i++) { - args = device_get_ivars(children[i]); - if (args->mii_phyno == ma.mii_phyno) { - /* - * Yes, there is already something - * configured at this address. - */ - free(children, M_TEMP); - goto skip; - } + for (i = 0; i < nchildren; i++) { + args = device_get_ivars(children[i]); + if (args->mii_phyno == ma.mii_phyno) { + /* + * Yes, there is already something + * configured at this address. + */ + goto skip; } - free(children, M_TEMP); } /* @@ -404,18 +461,24 @@ mii_attach(device_t dev, device_t *miibu * There is a PHY at this address. If we were given an * `offset' locator, skip this PHY if it doesn't match. */ - if (offloc != MII_OFFSET_ANY && offloc != offset) + if (offloc != MII_OFFSET_ANY && offloc != ivars->mii_offset) goto skip; /* - * Extract the IDs. Braindead PHYs will be handled by + * Skip this PHY if it's not included in the phymask hint. + */ + if ((phymask & (1 << ma.mii_phyno)) == 0) + goto skip; + + /* + * Extract the IDs. Braindead PHYs will be handled by * the `ukphy' driver, as we have no ID information to * match on. */ ma.mii_id1 = MIIBUS_READREG(dev, ma.mii_phyno, MII_PHYIDR1); ma.mii_id2 = MIIBUS_READREG(dev, ma.mii_phyno, MII_PHYIDR2); - ma.mii_offset = offset; + ma.mii_offset = ivars->mii_offset; args = malloc(sizeof(struct mii_attach_args), M_DEVBUF, M_NOWAIT); if (args == NULL) @@ -428,11 +491,20 @@ mii_attach(device_t dev, device_t *miibu } device_set_ivars(phy, args); skip: - offset++; + ivars->mii_offset++; } + free(children, M_TEMP); if (first != 0) { - if (phy == NULL) { + rv = device_set_driver(*miibus, &miibus_driver); + if (rv != 0) + goto fail; + bus_enumerate_hinted_children(*miibus); + rv = device_get_children(*miibus, &children, &nchildren); + if (rv != 0) + goto fail; + free(children, M_TEMP); + if (nchildren == 0) { rv = ENXIO; goto fail; } @@ -551,7 +623,7 @@ mii_down(struct mii_data *mii) static unsigned char mii_bitreverse(unsigned char x) { - unsigned const char const nibbletab[16] = { + static unsigned const char const nibbletab[16] = { 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15 }; From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 01:00:17 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2475B1065672; Sun, 29 Jan 2012 01:00:17 +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 E281F8FC1D; Sun, 29 Jan 2012 01:00:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T10Grc008839; Sun, 29 Jan 2012 01:00:16 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T10GhE008837; Sun, 29 Jan 2012 01:00:16 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290100.q0T10GhE008837@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 01:00:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230710 - stable/8/sys/dev/mii X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 01:00:17 -0000 Author: marius Date: Sun Jan 29 01:00:16 2012 New Revision: 230710 URL: http://svn.freebsd.org/changeset/base/230710 Log: MFC: r227687, r228290 (partial) - Add a hint.miibus.X.phymask hint, allowing do individually exclude PHY addresses from being probed and attaching something including ukphy(4) to it. This is mainly necessarily for PHY switches that create duplicate or fake PHYs on the bus that can corrupt the PHY state when accessed or simply cause problems when ukphy(4) isolates the additional instances. - Change miibus(4) to be a hinted bus, allowing to add child devices via hints and to set their attach arguments (including for automatically probed PHYs). This is mainly needed for PHY switches that violate IEEE 802.3 and don't even implement the basic register set so we can't probe them automatically. However, the ability to alter the attach arguments for automatically probed PHYs is also useful as for example it allows to test (or tell a user to test) new variant of a PHY with a specific driver by letting an existing driver attach to it via manipulating the IDs without the need to touch the source code or to limit a Gigabit Ethernet PHY to only announce up to Fast Ethernet in order to save energy by limiting the capability mask. Generally, a driver has to be hinted via hint.phydrv.X.at="miibusY" and hint.phydrv.X.phyno="Z" (which already is sufficient to add phydrvX at miibusY at PHY address Z). Then optionally the following attach arguments additionally can be configured: hint.phydrv.X.id1 hint.phydrv.X.id2 hint.phydrv.X.capmask - Some minor cleanup. Reviewed by: adrian, ray Modified: stable/8/sys/dev/mii/mii.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) Modified: stable/8/sys/dev/mii/mii.c ============================================================================== --- stable/8/sys/dev/mii/mii.c Sun Jan 29 01:00:11 2012 (r230709) +++ stable/8/sys/dev/mii/mii.c Sun Jan 29 01:00:16 2012 (r230710) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -57,18 +56,17 @@ MODULE_VERSION(miibus, 1); #include "miibus_if.h" -static int miibus_print_child(device_t dev, device_t child); -static int miibus_read_ivar(device_t dev, device_t child, int which, - uintptr_t *result); -static int miibus_child_location_str(device_t bus, device_t child, char *buf, - size_t buflen); -static int miibus_child_pnpinfo_str(device_t bus, device_t child, char *buf, - size_t buflen); -static int miibus_readreg(device_t, int, int); -static int miibus_writereg(device_t, int, int, int); -static void miibus_statchg(device_t); -static void miibus_linkchg(device_t); -static void miibus_mediainit(device_t); +static bus_child_location_str_t miibus_child_location_str; +static bus_child_pnpinfo_str_t miibus_child_pnpinfo_str; +static bus_hinted_child_t miibus_hinted_child; +static bus_print_child_t miibus_print_child; +static bus_read_ivar_t miibus_read_ivar; +static miibus_readreg_t miibus_readreg; +static miibus_statchg_t miibus_statchg; +static miibus_writereg_t miibus_writereg; +static miibus_linkchg_t miibus_linkchg; +static miibus_mediainit_t miibus_mediainit; + static device_method_t miibus_methods[] = { /* device interface */ @@ -83,6 +81,7 @@ static device_method_t miibus_methods[] DEVMETHOD(bus_driver_added, bus_generic_driver_added), DEVMETHOD(bus_child_pnpinfo_str, miibus_child_pnpinfo_str), DEVMETHOD(bus_child_location_str, miibus_child_location_str), + DEVMETHOD(bus_hinted_child, miibus_hinted_child), /* MII interface */ DEVMETHOD(miibus_readreg, miibus_readreg), @@ -106,7 +105,8 @@ struct miibus_ivars { struct ifnet *ifp; ifm_change_cb_t ifmedia_upd; ifm_stat_cb_t ifmedia_sts; - int mii_flags; + u_int mii_flags; + u_int mii_offset; }; int @@ -128,7 +128,6 @@ miibus_attach(device_t dev) int i, nchildren; mii = device_get_softc(dev); - nchildren = 0; if (device_get_children(dev, &children, &nchildren) == 0) { for (i = 0; i < nchildren; i++) { ma = device_get_ivars(children[i]); @@ -200,7 +199,7 @@ miibus_read_ivar(device_t dev, device_t } static int -miibus_child_pnpinfo_str(device_t bus __unused, device_t child, char *buf, +miibus_child_pnpinfo_str(device_t dev __unused, device_t child, char *buf, size_t buflen) { struct mii_attach_args *ma; @@ -213,7 +212,7 @@ miibus_child_pnpinfo_str(device_t bus __ } static int -miibus_child_location_str(device_t bus __unused, device_t child, char *buf, +miibus_child_location_str(device_t dev __unused, device_t child, char *buf, size_t buflen) { struct mii_attach_args *ma; @@ -223,6 +222,60 @@ miibus_child_location_str(device_t bus _ return (0); } +static void +miibus_hinted_child(device_t dev, const char *name, int unit) +{ + struct miibus_ivars *ivars; + struct mii_attach_args *args, *ma; + device_t *children, phy; + int i, nchildren; + u_int val; + + if (resource_int_value(name, unit, "phyno", &val) != 0) + return; + if (device_get_children(dev, &children, &nchildren) != 0) + return; + ma = NULL; + for (i = 0; i < nchildren; i++) { + args = device_get_ivars(children[i]); + if (args->mii_phyno == val) { + ma = args; + break; + } + } + free(children, M_TEMP); + + /* + * Don't add a PHY that was automatically identified by having media + * in its BMSR twice, only allow to alter its attach arguments. + */ + if (ma == NULL) { + ma = malloc(sizeof(struct mii_attach_args), M_DEVBUF, + M_NOWAIT); + if (ma == NULL) + return; + phy = device_add_child(dev, name, unit); + if (phy == NULL) { + free(ma, M_DEVBUF); + return; + } + ivars = device_get_ivars(dev); + ma->mii_phyno = val; + ma->mii_offset = ivars->mii_offset++; + ma->mii_id1 = 0; + ma->mii_id2 = 0; + ma->mii_capmask = BMSR_DEFCAPMASK; + device_set_ivars(phy, ma); + } + + if (resource_int_value(name, unit, "id1", &val) == 0) + ma->mii_id1 = val; + if (resource_int_value(name, unit, "id2", &val) == 0) + ma->mii_id2 = val; + if (resource_int_value(name, unit, "capmask", &val) == 0) + ma->mii_capmask = val; +} + static int miibus_readreg(device_t dev, int phy, int reg) { @@ -317,9 +370,10 @@ mii_attach(device_t dev, device_t *miibu int phyloc, int offloc, int flags) { struct miibus_ivars *ivars; - struct mii_attach_args ma, *args; + struct mii_attach_args *args, ma; device_t *children, phy; - int bmsr, first, i, nchildren, offset, phymax, phymin, rv; + int bmsr, first, i, nchildren, phymax, phymin, rv; + uint32_t phymask; if (phyloc != MII_PHY_ANY && offloc != MII_OFFSET_ANY) { printf("%s: phyloc and offloc specified\n", __func__); @@ -376,27 +430,30 @@ mii_attach(device_t dev, device_t *miibu ma.mii_capmask = capmask; - phy = NULL; - offset = 0; + if (resource_int_value(device_get_name(*miibus), + device_get_unit(*miibus), "phymask", &phymask) != 0) + phymask = 0xffffffff; + + if (device_get_children(*miibus, &children, &nchildren) != 0) { + children = NULL; + nchildren = 0; + } + ivars->mii_offset = 0; for (ma.mii_phyno = phymin; ma.mii_phyno <= phymax; ma.mii_phyno++) { /* * Make sure we haven't already configured a PHY at this * address. This allows mii_attach() to be called * multiple times. */ - if (device_get_children(*miibus, &children, &nchildren) == 0) { - for (i = 0; i < nchildren; i++) { - args = device_get_ivars(children[i]); - if (args->mii_phyno == ma.mii_phyno) { - /* - * Yes, there is already something - * configured at this address. - */ - free(children, M_TEMP); - goto skip; - } + for (i = 0; i < nchildren; i++) { + args = device_get_ivars(children[i]); + if (args->mii_phyno == ma.mii_phyno) { + /* + * Yes, there is already something + * configured at this address. + */ + goto skip; } - free(children, M_TEMP); } /* @@ -415,11 +472,17 @@ mii_attach(device_t dev, device_t *miibu * There is a PHY at this address. If we were given an * `offset' locator, skip this PHY if it doesn't match. */ - if (offloc != MII_OFFSET_ANY && offloc != offset) + if (offloc != MII_OFFSET_ANY && offloc != ivars->mii_offset) goto skip; /* - * Extract the IDs. Braindead PHYs will be handled by + * Skip this PHY if it's not included in the phymask hint. + */ + if ((phymask & (1 << ma.mii_phyno)) == 0) + goto skip; + + /* + * Extract the IDs. Braindead PHYs will be handled by * the `ukphy' driver, as we have no ID information to * match on. */ @@ -438,11 +501,20 @@ mii_attach(device_t dev, device_t *miibu } device_set_ivars(phy, args); skip: - offset++; + ivars->mii_offset++; } + free(children, M_TEMP); if (first != 0) { - if (phy == NULL) { + rv = device_set_driver(*miibus, &miibus_driver); + if (rv != 0) + goto fail; + bus_enumerate_hinted_children(*miibus); + rv = device_get_children(*miibus, &children, &nchildren); + if (rv != 0) + goto fail; + free(children, M_TEMP); + if (nchildren == 0) { rv = ENXIO; goto fail; } From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 01:01:33 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0D33106566B; Sun, 29 Jan 2012 01:01:33 +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 A090B8FC0C; Sun, 29 Jan 2012 01:01:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T11X9o008944; Sun, 29 Jan 2012 01:01:33 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T11W1U008941; Sun, 29 Jan 2012 01:01:32 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290101.q0T11W1U008941@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 01:01:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230711 - stable/9/sys/dev/mii X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 01:01:33 -0000 Author: marius Date: Sun Jan 29 01:01:32 2012 New Revision: 230711 URL: http://svn.freebsd.org/changeset/base/230711 Log: MFC: r227688 There's no need export the device interface methods of miibus(4). Modified: stable/9/sys/dev/mii/mii.c stable/9/sys/dev/mii/miivar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/mii/mii.c ============================================================================== --- stable/9/sys/dev/mii/mii.c Sun Jan 29 01:00:16 2012 (r230710) +++ stable/9/sys/dev/mii/mii.c Sun Jan 29 01:01:32 2012 (r230711) @@ -56,10 +56,13 @@ MODULE_VERSION(miibus, 1); #include "miibus_if.h" +static device_attach_t miibus_attach; static bus_child_location_str_t miibus_child_location_str; static bus_child_pnpinfo_str_t miibus_child_pnpinfo_str; +static device_detach_t miibus_detach; static bus_hinted_child_t miibus_hinted_child; static bus_print_child_t miibus_print_child; +static device_probe_t miibus_probe; static bus_read_ivar_t miibus_read_ivar; static miibus_readreg_t miibus_readreg; static miibus_statchg_t miibus_statchg; @@ -109,7 +112,7 @@ struct miibus_ivars { u_int mii_offset; }; -int +static int miibus_probe(device_t dev) { @@ -118,7 +121,7 @@ miibus_probe(device_t dev) return (BUS_PROBE_SPECIFIC); } -int +static int miibus_attach(device_t dev) { struct miibus_ivars *ivars; @@ -150,7 +153,7 @@ miibus_attach(device_t dev) return (bus_generic_attach(dev)); } -int +static int miibus_detach(device_t dev) { struct mii_data *mii; Modified: stable/9/sys/dev/mii/miivar.h ============================================================================== --- stable/9/sys/dev/mii/miivar.h Sun Jan 29 01:00:16 2012 (r230710) +++ stable/9/sys/dev/mii/miivar.h Sun Jan 29 01:01:32 2012 (r230711) @@ -246,10 +246,6 @@ MIIBUS_ACCESSOR(flags, FLAGS, u_int) extern devclass_t miibus_devclass; extern driver_t miibus_driver; -int miibus_probe(device_t); -int miibus_attach(device_t); -int miibus_detach(device_t); - int mii_attach(device_t, device_t *, struct ifnet *, ifm_change_cb_t, ifm_stat_cb_t, int, int, int, int); void mii_down(struct mii_data *); From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 01:01:35 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4C161065672; Sun, 29 Jan 2012 01:01:35 +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 B4A388FC13; Sun, 29 Jan 2012 01:01:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T11ZVl008978; Sun, 29 Jan 2012 01:01:35 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T11ZEN008975; Sun, 29 Jan 2012 01:01:35 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290101.q0T11ZEN008975@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 01:01:35 +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: r230712 - stable/8/sys/dev/mii X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 01:01:36 -0000 Author: marius Date: Sun Jan 29 01:01:35 2012 New Revision: 230712 URL: http://svn.freebsd.org/changeset/base/230712 Log: MFC: r227688 There's no need export the device interface methods of miibus(4). Modified: stable/8/sys/dev/mii/mii.c stable/8/sys/dev/mii/miivar.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) Modified: stable/8/sys/dev/mii/mii.c ============================================================================== --- stable/8/sys/dev/mii/mii.c Sun Jan 29 01:01:32 2012 (r230711) +++ stable/8/sys/dev/mii/mii.c Sun Jan 29 01:01:35 2012 (r230712) @@ -56,10 +56,13 @@ MODULE_VERSION(miibus, 1); #include "miibus_if.h" +static device_attach_t miibus_attach; static bus_child_location_str_t miibus_child_location_str; static bus_child_pnpinfo_str_t miibus_child_pnpinfo_str; +static device_detach_t miibus_detach; static bus_hinted_child_t miibus_hinted_child; static bus_print_child_t miibus_print_child; +static device_probe_t miibus_probe; static bus_read_ivar_t miibus_read_ivar; static miibus_readreg_t miibus_readreg; static miibus_statchg_t miibus_statchg; @@ -109,7 +112,7 @@ struct miibus_ivars { u_int mii_offset; }; -int +static int miibus_probe(device_t dev) { @@ -118,7 +121,7 @@ miibus_probe(device_t dev) return (BUS_PROBE_SPECIFIC); } -int +static int miibus_attach(device_t dev) { struct miibus_ivars *ivars; @@ -150,7 +153,7 @@ miibus_attach(device_t dev) return (bus_generic_attach(dev)); } -int +static int miibus_detach(device_t dev) { struct mii_data *mii; Modified: stable/8/sys/dev/mii/miivar.h ============================================================================== --- stable/8/sys/dev/mii/miivar.h Sun Jan 29 01:01:32 2012 (r230711) +++ stable/8/sys/dev/mii/miivar.h Sun Jan 29 01:01:35 2012 (r230712) @@ -225,10 +225,6 @@ MIIBUS_ACCESSOR(flags, FLAGS, u_int) extern devclass_t miibus_devclass; extern driver_t miibus_driver; -int miibus_probe(device_t); -int miibus_attach(device_t); -int miibus_detach(device_t); - int mii_attach(device_t, device_t *, struct ifnet *, ifm_change_cb_t, ifm_stat_cb_t, int, int, int, int); int mii_anar(int); From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 01:22:50 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FD2A106566C; Sun, 29 Jan 2012 01:22:50 +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 E9C138FC18; Sun, 29 Jan 2012 01:22:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T1MnLH009763; Sun, 29 Jan 2012 01:22:49 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T1MmB3009708; Sun, 29 Jan 2012 01:22:48 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290122.q0T1MmB3009708@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 01:22: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: r230714 - in stable/8/sys: amd64/amd64 amd64/pci arm/mv arm/xscale/i80321 arm/xscale/i8134x arm/xscale/ixp425 dev/aac dev/acpi_support dev/acpica dev/amr dev/arcmsr dev/bce dev/bfe dev/... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 01:22:50 -0000 Author: marius Date: Sun Jan 29 01:22:48 2012 New Revision: 230714 URL: http://svn.freebsd.org/changeset/base/230714 Log: MFC: r227843 (partial) - There's no need to overwrite the default device method with the default one. Interestingly, these are actually the default for quite some time (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9) since r52045) but even recently added device drivers do this unnecessarily. Discussed with: jhb, marcel - While at it, use DEVMETHOD_END. Discussed with: jhb - Also while at it, use __FBSDID. Modified: stable/8/sys/amd64/amd64/legacy.c stable/8/sys/amd64/pci/pci_bus.c stable/8/sys/arm/mv/mv_pci.c stable/8/sys/arm/xscale/i80321/i80321_pci.c stable/8/sys/arm/xscale/i8134x/i81342_pci.c stable/8/sys/arm/xscale/ixp425/ixp425_pci.c stable/8/sys/dev/aac/aac_pci.c stable/8/sys/dev/acpi_support/acpi_wmi.c stable/8/sys/dev/acpica/acpi_cpu.c stable/8/sys/dev/acpica/acpi_isab.c stable/8/sys/dev/acpica/acpi_pcib_acpi.c stable/8/sys/dev/amr/amr_pci.c stable/8/sys/dev/arcmsr/arcmsr.c stable/8/sys/dev/bce/if_bce.c stable/8/sys/dev/bfe/if_bfe.c stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bm/if_bm.c stable/8/sys/dev/cas/if_cas.c stable/8/sys/dev/cxgb/cxgb_main.c stable/8/sys/dev/cxgbe/t4_main.c stable/8/sys/dev/dc/if_dc.c stable/8/sys/dev/eisa/eisaconf.c stable/8/sys/dev/et/if_et.c stable/8/sys/dev/fb/fb.c stable/8/sys/dev/firewire/firewire.c stable/8/sys/dev/firewire/fwohci_pci.c stable/8/sys/dev/gem/if_gem_pci.c stable/8/sys/dev/gem/if_gem_sbus.c stable/8/sys/dev/hifn/hifn7751.c stable/8/sys/dev/hme/if_hme_pci.c stable/8/sys/dev/hme/if_hme_sbus.c stable/8/sys/dev/ichsmb/ichsmb_pci.c stable/8/sys/dev/ida/ida_pci.c stable/8/sys/dev/if_ndis/if_ndis_usb.c stable/8/sys/dev/iicbus/iicbus.c stable/8/sys/dev/iicbus/iicsmb.c stable/8/sys/dev/lge/if_lge.c stable/8/sys/dev/mca/mca_bus.c stable/8/sys/dev/mfi/mfi_pci.c stable/8/sys/dev/mii/mii.c stable/8/sys/dev/mlx/mlx_pci.c stable/8/sys/dev/mps/mps_pci.c stable/8/sys/dev/msk/if_msk.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/pccbb/pccbb_isa.c stable/8/sys/dev/pccbb/pccbb_pci.c stable/8/sys/dev/pci/eisa_pci.c stable/8/sys/dev/pci/isa_pci.c stable/8/sys/dev/pci/pci_pci.c stable/8/sys/dev/pcn/if_pcn.c stable/8/sys/dev/ppbus/lpbb.c stable/8/sys/dev/puc/puc_pccard.c stable/8/sys/dev/puc/puc_pci.c stable/8/sys/dev/re/if_re.c stable/8/sys/dev/safe/safe.c stable/8/sys/dev/scc/scc_bfe_ebus.c stable/8/sys/dev/scc/scc_bfe_macio.c stable/8/sys/dev/scc/scc_bfe_quicc.c stable/8/sys/dev/scc/scc_bfe_sbus.c stable/8/sys/dev/sec/sec.c stable/8/sys/dev/sf/if_sf.c stable/8/sys/dev/sge/if_sge.c stable/8/sys/dev/siba/siba_pcib.c stable/8/sys/dev/sis/if_sis.c stable/8/sys/dev/sk/if_sk.c stable/8/sys/dev/smbus/smbus.c stable/8/sys/dev/sound/isa/gusc.c stable/8/sys/dev/sound/isa/sbc.c stable/8/sys/dev/sound/pci/csa.c stable/8/sys/dev/sound/pci/fm801.c stable/8/sys/dev/sound/usb/uaudio.c stable/8/sys/dev/spibus/spibus.c stable/8/sys/dev/ste/if_ste.c stable/8/sys/dev/tl/if_tl.c stable/8/sys/dev/twa/tw_osl_freebsd.c stable/8/sys/dev/twe/twe_freebsd.c stable/8/sys/dev/tws/tws.c stable/8/sys/dev/ubsec/ubsec.c stable/8/sys/dev/usb/controller/at91dci_atmelarm.c stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c stable/8/sys/dev/usb/controller/ehci_ixp4xx.c stable/8/sys/dev/usb/controller/musb_otg_atmelarm.c stable/8/sys/dev/usb/controller/ohci_atmelarm.c stable/8/sys/dev/usb/controller/uss820dci_atmelarm.c stable/8/sys/dev/usb/controller/xhci_pci.c stable/8/sys/dev/usb/net/if_aue.c stable/8/sys/dev/usb/net/if_axe.c stable/8/sys/dev/usb/net/if_rue.c stable/8/sys/dev/usb/net/if_udav.c stable/8/sys/dev/vge/if_vge.c stable/8/sys/dev/vr/if_vr.c stable/8/sys/dev/wb/if_wb.c stable/8/sys/dev/xen/pcifront/pcifront.c stable/8/sys/dev/xl/if_xl.c stable/8/sys/i386/i386/legacy.c stable/8/sys/i386/pci/pci_bus.c stable/8/sys/isa/vga_isa.c stable/8/sys/mips/adm5120/admpci.c stable/8/sys/mips/atheros/apb.c stable/8/sys/mips/atheros/ar71xx_ehci.c stable/8/sys/mips/atheros/ar71xx_ohci.c stable/8/sys/mips/atheros/ar71xx_pci.c stable/8/sys/mips/atheros/if_arge.c stable/8/sys/mips/cavium/octopci.c stable/8/sys/mips/cavium/usb/octusb_octeon.c stable/8/sys/mips/idt/idtpci.c stable/8/sys/mips/idt/if_kr.c stable/8/sys/mips/malta/gt.c stable/8/sys/mips/malta/gt_pci.c stable/8/sys/mips/rmi/dev/nlge/if_nlge.c stable/8/sys/mips/rmi/dev/sec/rmisec.c stable/8/sys/mips/rmi/xlr_pci.c stable/8/sys/mips/rmi/xls_ehci.c stable/8/sys/pci/if_rl.c stable/8/sys/pci/intpm.c stable/8/sys/pci/viapm.c stable/8/sys/powerpc/aim/nexus.c stable/8/sys/powerpc/mpc85xx/nexus.c stable/8/sys/powerpc/ofw/ofw_cpu.c stable/8/sys/powerpc/ofw/ofw_pcib_pci.c stable/8/sys/powerpc/powermac/cpcht.c stable/8/sys/powerpc/powermac/cuda.c stable/8/sys/powerpc/powermac/grackle.c stable/8/sys/powerpc/powermac/pmu.c stable/8/sys/powerpc/powermac/uninorthpci.c stable/8/sys/sparc64/pci/fire.c stable/8/sys/sparc64/pci/psycho.c stable/8/sys/sparc64/pci/sbbc.c stable/8/sys/sparc64/pci/schizo.c stable/8/sys/x86/pci/qpi.c stable/8/sys/x86/x86/mptable_pci.c stable/8/sys/xen/xenstore/xenstore.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) Modified: stable/8/sys/amd64/amd64/legacy.c ============================================================================== --- stable/8/sys/amd64/amd64/legacy.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/amd64/amd64/legacy.c Sun Jan 29 01:22:48 2012 (r230714) @@ -236,19 +236,17 @@ static device_method_t cpu_methods[] = { /* Bus interface */ DEVMETHOD(bus_add_child, cpu_add_child), DEVMETHOD(bus_read_ivar, cpu_read_ivar), - DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_get_resource_list, cpu_get_rlist), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), DEVMETHOD(bus_alloc_resource, bus_generic_rl_alloc_resource), DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - { 0, 0 } + DEVMETHOD_END }; static driver_t cpu_driver = { Modified: stable/8/sys/amd64/pci/pci_bus.c ============================================================================== --- stable/8/sys/amd64/pci/pci_bus.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/amd64/pci/pci_bus.c Sun Jan 29 01:22:48 2012 (r230714) @@ -345,7 +345,6 @@ static device_method_t legacy_pcib_metho DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, legacy_pcib_read_ivar), DEVMETHOD(bus_write_ivar, legacy_pcib_write_ivar), DEVMETHOD(bus_alloc_resource, legacy_pcib_alloc_resource), @@ -367,7 +366,7 @@ static device_method_t legacy_pcib_metho DEVMETHOD(pcib_release_msix, pcib_release_msix), DEVMETHOD(pcib_map_msi, legacy_pcib_map_msi), - { 0, 0 } + DEVMETHOD_END }; static devclass_t hostb_devclass; Modified: stable/8/sys/arm/mv/mv_pci.c ============================================================================== --- stable/8/sys/arm/mv/mv_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/arm/mv/mv_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -151,7 +151,6 @@ static device_method_t pcib_mbus_methods DEVMETHOD(device_attach, pcib_mbus_attach), /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, pcib_mbus_read_ivar), DEVMETHOD(bus_write_ivar, pcib_mbus_write_ivar), DEVMETHOD(bus_alloc_resource, pcib_mbus_alloc_resource), @@ -167,7 +166,7 @@ static device_method_t pcib_mbus_methods DEVMETHOD(pcib_write_config, pcib_mbus_write_config), DEVMETHOD(pcib_route_interrupt, pcib_route_interrupt), - { 0, 0 } + DEVMETHOD_END }; static driver_t pcib_mbus_driver = { Modified: stable/8/sys/arm/xscale/i80321/i80321_pci.c ============================================================================== --- stable/8/sys/arm/xscale/i80321/i80321_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/arm/xscale/i80321/i80321_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -373,7 +373,6 @@ static device_method_t i80321_pci_method DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, i80321_read_ivar), DEVMETHOD(bus_write_ivar, i80321_write_ivar), DEVMETHOD(bus_alloc_resource, i80321_pci_alloc_resource), @@ -389,7 +388,7 @@ static device_method_t i80321_pci_method DEVMETHOD(pcib_write_config, i80321_pci_write_config), DEVMETHOD(pcib_route_interrupt, machdep_pci_route_interrupt), - {0, 0} + DEVMETHOD_END }; static driver_t i80321_pci_driver = { Modified: stable/8/sys/arm/xscale/i8134x/i81342_pci.c ============================================================================== --- stable/8/sys/arm/xscale/i8134x/i81342_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/arm/xscale/i8134x/i81342_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -516,7 +516,6 @@ static device_method_t i81342_pci_method DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, i81342_read_ivar), DEVMETHOD(bus_write_ivar, i81342_write_ivar), DEVMETHOD(bus_alloc_resource, i81342_pci_alloc_resource), @@ -532,7 +531,7 @@ static device_method_t i81342_pci_method DEVMETHOD(pcib_write_config, i81342_pci_write_config), DEVMETHOD(pcib_route_interrupt, i81342_pci_route_interrupt), - {0, 0} + DEVMETHOD_END }; static driver_t i81342_pci_driver = { Modified: stable/8/sys/arm/xscale/ixp425/ixp425_pci.c ============================================================================== --- stable/8/sys/arm/xscale/ixp425/ixp425_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/arm/xscale/ixp425/ixp425_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -445,7 +445,6 @@ static device_method_t ixppcib_methods[] DEVMETHOD(device_attach, ixppcib_attach), /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, ixppcib_read_ivar), DEVMETHOD(bus_write_ivar, ixppcib_write_ivar), DEVMETHOD(bus_setup_intr, ixppcib_setup_intr), @@ -462,7 +461,7 @@ static device_method_t ixppcib_methods[] DEVMETHOD(pcib_write_config, ixppcib_write_config), DEVMETHOD(pcib_route_interrupt, ixppcib_route_interrupt), - {0, 0}, + DEVMETHOD_END }; static driver_t ixppcib_driver = { Modified: stable/8/sys/dev/aac/aac_pci.c ============================================================================== --- stable/8/sys/dev/aac/aac_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/aac/aac_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -68,9 +68,7 @@ static device_method_t aac_methods[] = { DEVMETHOD(device_suspend, aac_suspend), DEVMETHOD(device_resume, aac_resume), - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - { 0, 0 } + DEVMETHOD_END }; static driver_t aac_pci_driver = { Modified: stable/8/sys/dev/acpi_support/acpi_wmi.c ============================================================================== --- stable/8/sys/dev/acpi_support/acpi_wmi.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/acpi_support/acpi_wmi.c Sun Jan 29 01:22:48 2012 (r230714) @@ -175,7 +175,6 @@ static device_method_t acpi_wmi_methods[ /* bus interface */ DEVMETHOD(bus_add_child, bus_generic_add_child), - DEVMETHOD(bus_print_child, bus_generic_print_child), /* acpi_wmi interface */ DEVMETHOD(acpi_wmi_provides_guid_string, @@ -189,7 +188,7 @@ static device_method_t acpi_wmi_methods[ DEVMETHOD(acpi_wmi_get_block, acpi_wmi_get_block_method), DEVMETHOD(acpi_wmi_set_block, acpi_wmi_set_block_method), - {0, 0} + DEVMETHOD_END }; static driver_t acpi_wmi_driver = { Modified: stable/8/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_cpu.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/acpica/acpi_cpu.c Sun Jan 29 01:22:48 2012 (r230714) @@ -184,13 +184,12 @@ static device_method_t acpi_cpu_methods[ DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), DEVMETHOD(bus_alloc_resource, bus_generic_rl_alloc_resource), DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - {0, 0} + DEVMETHOD_END }; static driver_t acpi_cpu_driver = { Modified: stable/8/sys/dev/acpica/acpi_isab.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_isab.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/acpica/acpi_isab.c Sun Jan 29 01:22:48 2012 (r230714) @@ -68,7 +68,6 @@ static device_method_t acpi_isab_methods DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, acpi_isab_read_ivar), DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), @@ -77,7 +76,7 @@ static device_method_t acpi_isab_methods DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - {0, 0} + DEVMETHOD_END }; static driver_t acpi_isab_driver = { Modified: stable/8/sys/dev/acpica/acpi_pcib_acpi.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_pcib_acpi.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/acpica/acpi_pcib_acpi.c Sun Jan 29 01:22:48 2012 (r230714) @@ -97,7 +97,6 @@ static device_method_t acpi_pcib_acpi_me DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, acpi_pcib_read_ivar), DEVMETHOD(bus_write_ivar, acpi_pcib_write_ivar), DEVMETHOD(bus_alloc_resource, acpi_pcib_acpi_alloc_resource), @@ -119,7 +118,7 @@ static device_method_t acpi_pcib_acpi_me DEVMETHOD(pcib_release_msix, pcib_release_msix), DEVMETHOD(pcib_map_msi, acpi_pcib_map_msi), - {0, 0} + DEVMETHOD_END }; static devclass_t pcib_devclass; Modified: stable/8/sys/dev/amr/amr_pci.c ============================================================================== --- stable/8/sys/dev/amr/amr_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/amr/amr_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -106,9 +106,7 @@ static device_method_t amr_methods[] = { DEVMETHOD(device_suspend, amr_pci_suspend), DEVMETHOD(device_resume, amr_pci_resume), - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - { 0, 0 } + DEVMETHOD_END }; static driver_t amr_pci_driver = { Modified: stable/8/sys/dev/arcmsr/arcmsr.c ============================================================================== --- stable/8/sys/dev/arcmsr/arcmsr.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/arcmsr/arcmsr.c Sun Jan 29 01:22:48 2012 (r230714) @@ -70,8 +70,11 @@ ** 1.20.00.21 03/03/2011 Ching Huang if a command timeout, then wait its ccb back before free it ** 1.20.00.22 07/04/2011 Ching Huang Fixed multiple MTX panic ****************************************************************************************** -* $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); + #if 0 #define ARCMSR_DEBUG1 1 #endif @@ -223,9 +226,8 @@ static device_method_t arcmsr_methods[]= DEVMETHOD(device_shutdown, arcmsr_shutdown), DEVMETHOD(device_suspend, arcmsr_suspend), DEVMETHOD(device_resume, arcmsr_resume), - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - { 0, 0 } + + DEVMETHOD_END }; static driver_t arcmsr_driver={ Modified: stable/8/sys/dev/bce/if_bce.c ============================================================================== --- stable/8/sys/dev/bce/if_bce.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/bce/if_bce.c Sun Jan 29 01:22:48 2012 (r230714) @@ -455,10 +455,6 @@ static device_method_t bce_methods[] = { /* DEVMETHOD(device_resume, bce_resume), */ /* DEVMETHOD(device_quiesce, bce_quiesce), */ - /* Bus interface (bus_if.h) */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface (miibus_if.h) */ DEVMETHOD(miibus_readreg, bce_miibus_read_reg), DEVMETHOD(miibus_writereg, bce_miibus_write_reg), @@ -467,7 +463,7 @@ static device_method_t bce_methods[] = { /* DEVMETHOD(miibus_linkchg, bce_miibus_linkchg), */ /* DEVMETHOD(miibus_mediainit, bce_miibus_mediainit), */ - { 0, 0 } + DEVMETHOD_END }; static driver_t bce_driver = { Modified: stable/8/sys/dev/bfe/if_bfe.c ============================================================================== --- stable/8/sys/dev/bfe/if_bfe.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/bfe/if_bfe.c Sun Jan 29 01:22:48 2012 (r230714) @@ -137,16 +137,12 @@ static device_method_t bfe_methods[] = { DEVMETHOD(device_suspend, bfe_suspend), DEVMETHOD(device_resume, bfe_resume), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, bfe_miibus_readreg), DEVMETHOD(miibus_writereg, bfe_miibus_writereg), DEVMETHOD(miibus_statchg, bfe_miibus_statchg), - { 0, 0 } + DEVMETHOD_END }; static driver_t bfe_driver = { Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/bge/if_bge.c Sun Jan 29 01:22:48 2012 (r230714) @@ -493,16 +493,12 @@ static device_method_t bge_methods[] = { DEVMETHOD(device_suspend, bge_suspend), DEVMETHOD(device_resume, bge_resume), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, bge_miibus_readreg), DEVMETHOD(miibus_writereg, bge_miibus_writereg), DEVMETHOD(miibus_statchg, bge_miibus_statchg), - { 0, 0 } + DEVMETHOD_END }; static driver_t bge_driver = { Modified: stable/8/sys/dev/bm/if_bm.c ============================================================================== --- stable/8/sys/dev/bm/if_bm.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/bm/if_bm.c Sun Jan 29 01:22:48 2012 (r230714) @@ -135,15 +135,12 @@ static device_method_t bm_methods[] = { DEVMETHOD(device_detach, bm_detach), DEVMETHOD(device_shutdown, bm_shutdown), - /* bus interface, for miibus */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, bm_miibus_readreg), DEVMETHOD(miibus_writereg, bm_miibus_writereg), DEVMETHOD(miibus_statchg, bm_miibus_statchg), - { 0, 0 } + + DEVMETHOD_END }; static driver_t bm_macio_driver = { Modified: stable/8/sys/dev/cas/if_cas.c ============================================================================== --- stable/8/sys/dev/cas/if_cas.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/cas/if_cas.c Sun Jan 29 01:22:48 2012 (r230714) @@ -2606,16 +2606,12 @@ static device_method_t cas_pci_methods[] /* Use the suspend handler here, it is all that is required. */ DEVMETHOD(device_shutdown, cas_pci_suspend), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, cas_mii_readreg), DEVMETHOD(miibus_writereg, cas_mii_writereg), DEVMETHOD(miibus_statchg, cas_mii_statchg), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t cas_pci_driver = { Modified: stable/8/sys/dev/cxgb/cxgb_main.c ============================================================================== --- stable/8/sys/dev/cxgb/cxgb_main.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/cxgb/cxgb_main.c Sun Jan 29 01:22:48 2012 (r230714) @@ -129,11 +129,7 @@ static device_method_t cxgb_controller_m DEVMETHOD(device_attach, cxgb_controller_attach), DEVMETHOD(device_detach, cxgb_controller_detach), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - - { 0, 0 } + DEVMETHOD_END }; static driver_t cxgb_controller_driver = { Modified: stable/8/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_main.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/cxgbe/t4_main.c Sun Jan 29 01:22:48 2012 (r230714) @@ -73,11 +73,7 @@ static device_method_t t4_methods[] = { DEVMETHOD(device_attach, t4_attach), DEVMETHOD(device_detach, t4_detach), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - - { 0, 0 } + DEVMETHOD_END }; static driver_t t4_driver = { "t4nex", Modified: stable/8/sys/dev/dc/if_dc.c ============================================================================== --- stable/8/sys/dev/dc/if_dc.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/dc/if_dc.c Sun Jan 29 01:22:48 2012 (r230714) @@ -337,17 +337,13 @@ static device_method_t dc_methods[] = { DEVMETHOD(device_resume, dc_resume), DEVMETHOD(device_shutdown, dc_shutdown), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, dc_miibus_readreg), DEVMETHOD(miibus_writereg, dc_miibus_writereg), DEVMETHOD(miibus_statchg, dc_miibus_statchg), DEVMETHOD(miibus_mediainit, dc_miibus_mediainit), - { 0, 0 } + DEVMETHOD_END }; static driver_t dc_driver = { Modified: stable/8/sys/dev/eisa/eisaconf.c ============================================================================== --- stable/8/sys/dev/eisa/eisaconf.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/eisa/eisaconf.c Sun Jan 29 01:22:48 2012 (r230714) @@ -557,7 +557,6 @@ static device_method_t eisa_methods[] = DEVMETHOD(bus_probe_nomatch, eisa_probe_nomatch), DEVMETHOD(bus_read_ivar, eisa_read_ivar), DEVMETHOD(bus_write_ivar, eisa_write_ivar), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), DEVMETHOD(bus_alloc_resource, eisa_alloc_resource), DEVMETHOD(bus_release_resource, eisa_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), @@ -570,7 +569,7 @@ static device_method_t eisa_methods[] = DEVMETHOD(eisa_add_iospace, eisa_add_iospace_m), DEVMETHOD(eisa_add_mspace, eisa_add_mspace_m), - { 0, 0 } + DEVMETHOD_END }; static driver_t eisa_driver = { Modified: stable/8/sys/dev/et/if_et.c ============================================================================== --- stable/8/sys/dev/et/if_et.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/et/if_et.c Sun Jan 29 01:22:48 2012 (r230714) @@ -169,14 +169,11 @@ static device_method_t et_methods[] = { DEVMETHOD(device_suspend, et_suspend), DEVMETHOD(device_resume, et_resume), - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - DEVMETHOD(miibus_readreg, et_miibus_readreg), DEVMETHOD(miibus_writereg, et_miibus_writereg), DEVMETHOD(miibus_statchg, et_miibus_statchg), - { 0, 0 } + DEVMETHOD_END }; static driver_t et_driver = { Modified: stable/8/sys/dev/fb/fb.c ============================================================================== --- stable/8/sys/dev/fb/fb.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/fb/fb.c Sun Jan 29 01:22:48 2012 (r230714) @@ -315,8 +315,7 @@ static device_method_t fb_methods[] = { DEVMETHOD(device_probe, fbprobe), DEVMETHOD(device_attach, fbattach), - DEVMETHOD(bus_print_child, bus_generic_print_child), - { 0, 0 } + DEVMETHOD_END }; static driver_t fb_driver = { Modified: stable/8/sys/dev/firewire/firewire.c ============================================================================== --- stable/8/sys/dev/firewire/firewire.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/firewire/firewire.c Sun Jan 29 01:22:48 2012 (r230714) @@ -30,11 +30,11 @@ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - * */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include @@ -128,9 +128,8 @@ static device_method_t firewire_methods[ /* Bus interface */ DEVMETHOD(bus_add_child, firewire_add_child), - DEVMETHOD(bus_print_child, bus_generic_print_child), - { 0, 0 } + DEVMETHOD_END }; char *linkspeed[] = { "S100", "S200", "S400", "S800", Modified: stable/8/sys/dev/firewire/fwohci_pci.c ============================================================================== --- stable/8/sys/dev/firewire/fwohci_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/firewire/fwohci_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -30,10 +30,11 @@ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #define BOUNCE_BUFFER_TEST 0 #include @@ -536,9 +537,8 @@ static device_method_t fwohci_methods[] /* Bus interface */ DEVMETHOD(bus_add_child, fwohci_pci_add_child), - DEVMETHOD(bus_print_child, bus_generic_print_child), - { 0, 0 } + DEVMETHOD_END }; static driver_t fwohci_driver = { Modified: stable/8/sys/dev/gem/if_gem_pci.c ============================================================================== --- stable/8/sys/dev/gem/if_gem_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/gem/if_gem_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -82,16 +82,12 @@ static device_method_t gem_pci_methods[] /* Use the suspend handler here, it is all that is required. */ DEVMETHOD(device_shutdown, gem_pci_suspend), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, gem_mii_readreg), DEVMETHOD(miibus_writereg, gem_mii_writereg), DEVMETHOD(miibus_statchg, gem_mii_statchg), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t gem_pci_driver = { Modified: stable/8/sys/dev/gem/if_gem_sbus.c ============================================================================== --- stable/8/sys/dev/gem/if_gem_sbus.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/gem/if_gem_sbus.c Sun Jan 29 01:22:48 2012 (r230714) @@ -78,16 +78,12 @@ static device_method_t gem_sbus_methods[ /* Use the suspend handler here, it is all that is required. */ DEVMETHOD(device_shutdown, gem_sbus_suspend), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, gem_mii_readreg), DEVMETHOD(miibus_writereg, gem_mii_writereg), DEVMETHOD(miibus_statchg, gem_mii_statchg), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t gem_sbus_driver = { Modified: stable/8/sys/dev/hifn/hifn7751.c ============================================================================== --- stable/8/sys/dev/hifn/hifn7751.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/hifn/hifn7751.c Sun Jan 29 01:22:48 2012 (r230714) @@ -113,16 +113,12 @@ static device_method_t hifn_methods[] = DEVMETHOD(device_resume, hifn_resume), DEVMETHOD(device_shutdown, hifn_shutdown), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* crypto device methods */ DEVMETHOD(cryptodev_newsession, hifn_newsession), DEVMETHOD(cryptodev_freesession,hifn_freesession), DEVMETHOD(cryptodev_process, hifn_process), - { 0, 0 } + DEVMETHOD_END }; static driver_t hifn_driver = { "hifn", Modified: stable/8/sys/dev/hme/if_hme_pci.c ============================================================================== --- stable/8/sys/dev/hme/if_hme_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/hme/if_hme_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -93,16 +93,12 @@ static device_method_t hme_pci_methods[] /* Can just use the suspend method here. */ DEVMETHOD(device_shutdown, hme_pci_suspend), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, hme_mii_readreg), DEVMETHOD(miibus_writereg, hme_mii_writereg), DEVMETHOD(miibus_statchg, hme_mii_statchg), - { 0, 0 } + DEVMETHOD_END }; static driver_t hme_pci_driver = { Modified: stable/8/sys/dev/hme/if_hme_sbus.c ============================================================================== --- stable/8/sys/dev/hme/if_hme_sbus.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/hme/if_hme_sbus.c Sun Jan 29 01:22:48 2012 (r230714) @@ -95,16 +95,12 @@ static device_method_t hme_sbus_methods[ /* Can just use the suspend method here. */ DEVMETHOD(device_shutdown, hme_sbus_suspend), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, hme_mii_readreg), DEVMETHOD(miibus_writereg, hme_mii_writereg), DEVMETHOD(miibus_statchg, hme_mii_statchg), - { 0, 0 } + DEVMETHOD_END }; static driver_t hme_sbus_driver = { Modified: stable/8/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- stable/8/sys/dev/ichsmb/ichsmb_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/ichsmb/ichsmb_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -103,9 +103,6 @@ static device_method_t ichsmb_pci_method DEVMETHOD(device_attach, ichsmb_pci_attach), DEVMETHOD(device_detach, ichsmb_detach), - /* Bus methods */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - /* SMBus methods */ DEVMETHOD(smbus_callback, ichsmb_callback), DEVMETHOD(smbus_quick, ichsmb_quick), @@ -118,7 +115,8 @@ static device_method_t ichsmb_pci_method DEVMETHOD(smbus_pcall, ichsmb_pcall), DEVMETHOD(smbus_bwrite, ichsmb_bwrite), DEVMETHOD(smbus_bread, ichsmb_bread), - { 0, 0 } + + DEVMETHOD_END }; static driver_t ichsmb_pci_driver = { Modified: stable/8/sys/dev/ida/ida_pci.c ============================================================================== --- stable/8/sys/dev/ida/ida_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/ida/ida_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -188,9 +188,7 @@ static device_method_t ida_pci_methods[] DEVMETHOD(device_attach, ida_pci_attach), DEVMETHOD(device_detach, ida_detach), - DEVMETHOD(bus_print_child, bus_generic_print_child), - - { 0, 0 } + DEVMETHOD_END }; static driver_t ida_pci_driver = { Modified: stable/8/sys/dev/if_ndis/if_ndis_usb.c ============================================================================== --- stable/8/sys/dev/if_ndis/if_ndis_usb.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/if_ndis/if_ndis_usb.c Sun Jan 29 01:22:48 2012 (r230714) @@ -91,11 +91,9 @@ static device_method_t ndis_methods[] = DEVMETHOD(device_shutdown, ndis_shutdown), /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), DEVMETHOD(bus_get_resource_list, ndis_get_resource_list), - { 0, 0 } + DEVMETHOD_END }; static driver_t ndis_driver = { Modified: stable/8/sys/dev/iicbus/iicbus.c ============================================================================== --- stable/8/sys/dev/iicbus/iicbus.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/iicbus/iicbus.c Sun Jan 29 01:22:48 2012 (r230714) @@ -245,7 +245,6 @@ static device_method_t iicbus_methods[] /* bus interface */ DEVMETHOD(bus_add_child, iicbus_add_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), DEVMETHOD(bus_print_child, iicbus_print_child), DEVMETHOD(bus_probe_nomatch, iicbus_probe_nomatch), DEVMETHOD(bus_read_ivar, iicbus_read_ivar), @@ -256,7 +255,7 @@ static device_method_t iicbus_methods[] /* iicbus interface */ DEVMETHOD(iicbus_transfer, iicbus_transfer), - { 0, 0 } + DEVMETHOD_END }; driver_t iicbus_driver = { Modified: stable/8/sys/dev/iicbus/iicsmb.c ============================================================================== --- stable/8/sys/dev/iicbus/iicsmb.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/iicbus/iicsmb.c Sun Jan 29 01:22:48 2012 (r230714) @@ -22,11 +22,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ - * */ +#include +__FBSDID("$FreeBSD$"); + /* * I2C to SMB bridge * @@ -106,10 +106,6 @@ static device_method_t iicsmb_methods[] DEVMETHOD(device_attach, iicsmb_attach), DEVMETHOD(device_detach, iicsmb_detach), - /* bus interface */ - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - DEVMETHOD(bus_print_child, bus_generic_print_child), - /* iicbus interface */ DEVMETHOD(iicbus_intr, iicsmb_intr), @@ -125,8 +121,8 @@ static device_method_t iicsmb_methods[] DEVMETHOD(smbus_pcall, iicsmb_pcall), DEVMETHOD(smbus_bwrite, iicsmb_bwrite), DEVMETHOD(smbus_bread, iicsmb_bread), - - { 0, 0 } + + DEVMETHOD_END }; static driver_t iicsmb_driver = { Modified: stable/8/sys/dev/lge/if_lge.c ============================================================================== --- stable/8/sys/dev/lge/if_lge.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/lge/if_lge.c Sun Jan 29 01:22:48 2012 (r230714) @@ -170,16 +170,12 @@ static device_method_t lge_methods[] = { DEVMETHOD(device_detach, lge_detach), DEVMETHOD(device_shutdown, lge_shutdown), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, lge_miibus_readreg), DEVMETHOD(miibus_writereg, lge_miibus_writereg), DEVMETHOD(miibus_statchg, lge_miibus_statchg), - { 0, 0 } + DEVMETHOD_END }; static driver_t lge_driver = { Modified: stable/8/sys/dev/mca/mca_bus.c ============================================================================== --- stable/8/sys/dev/mca/mca_bus.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/mca/mca_bus.c Sun Jan 29 01:22:48 2012 (r230714) @@ -507,7 +507,6 @@ static device_method_t mca_methods[] = { DEVMETHOD(bus_probe_nomatch, mca_probe_nomatch), DEVMETHOD(bus_read_ivar, mca_read_ivar), DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), @@ -520,7 +519,7 @@ static device_method_t mca_methods[] = { DEVMETHOD(bus_activate_resource,bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - { 0, 0 } + DEVMETHOD_END }; static driver_t mca_driver = { Modified: stable/8/sys/dev/mfi/mfi_pci.c ============================================================================== --- stable/8/sys/dev/mfi/mfi_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/mfi/mfi_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -93,9 +93,8 @@ static device_method_t mfi_methods[] = { DEVMETHOD(device_detach, mfi_pci_detach), DEVMETHOD(device_suspend, mfi_pci_suspend), DEVMETHOD(device_resume, mfi_pci_resume), - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - { 0, 0 } + + DEVMETHOD_END }; static driver_t mfi_pci_driver = { Modified: stable/8/sys/dev/mii/mii.c ============================================================================== --- stable/8/sys/dev/mii/mii.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/mii/mii.c Sun Jan 29 01:22:48 2012 (r230714) @@ -81,7 +81,6 @@ static device_method_t miibus_methods[] /* bus interface */ DEVMETHOD(bus_print_child, miibus_print_child), DEVMETHOD(bus_read_ivar, miibus_read_ivar), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), DEVMETHOD(bus_child_pnpinfo_str, miibus_child_pnpinfo_str), DEVMETHOD(bus_child_location_str, miibus_child_location_str), DEVMETHOD(bus_hinted_child, miibus_hinted_child), @@ -93,7 +92,7 @@ static device_method_t miibus_methods[] DEVMETHOD(miibus_linkchg, miibus_linkchg), DEVMETHOD(miibus_mediainit, miibus_mediainit), - { 0, 0 } + DEVMETHOD_END }; devclass_t miibus_devclass; Modified: stable/8/sys/dev/mlx/mlx_pci.c ============================================================================== --- stable/8/sys/dev/mlx/mlx_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/mlx/mlx_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -61,9 +61,7 @@ static device_method_t mlx_methods[] = { DEVMETHOD(device_suspend, mlx_suspend), DEVMETHOD(device_resume, mlx_resume), - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - { 0, 0 } + DEVMETHOD_END }; static driver_t mlx_pci_driver = { Modified: stable/8/sys/dev/mps/mps_pci.c ============================================================================== --- stable/8/sys/dev/mps/mps_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/mps/mps_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -78,9 +78,8 @@ static device_method_t mps_methods[] = { DEVMETHOD(device_detach, mps_pci_detach), DEVMETHOD(device_suspend, mps_pci_suspend), DEVMETHOD(device_resume, mps_pci_resume), - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - { 0, 0 } + + DEVMETHOD_END }; static driver_t mps_pci_driver = { Modified: stable/8/sys/dev/msk/if_msk.c ============================================================================== --- stable/8/sys/dev/msk/if_msk.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/msk/if_msk.c Sun Jan 29 01:22:48 2012 (r230714) @@ -334,11 +334,7 @@ static device_method_t mskc_methods[] = DEVMETHOD(device_resume, mskc_resume), DEVMETHOD(device_shutdown, mskc_shutdown), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - - { NULL, NULL } + DEVMETHOD_END }; static driver_t mskc_driver = { @@ -356,16 +352,12 @@ static device_method_t msk_methods[] = { DEVMETHOD(device_detach, msk_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, msk_miibus_readreg), DEVMETHOD(miibus_writereg, msk_miibus_writereg), DEVMETHOD(miibus_statchg, msk_miibus_statchg), - { NULL, NULL } + DEVMETHOD_END }; static driver_t msk_driver = { Modified: stable/8/sys/dev/nfe/if_nfe.c ============================================================================== --- stable/8/sys/dev/nfe/if_nfe.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/nfe/if_nfe.c Sun Jan 29 01:22:48 2012 (r230714) @@ -165,16 +165,12 @@ static device_method_t nfe_methods[] = { DEVMETHOD(device_resume, nfe_resume), DEVMETHOD(device_shutdown, nfe_shutdown), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, nfe_miibus_readreg), DEVMETHOD(miibus_writereg, nfe_miibus_writereg), DEVMETHOD(miibus_statchg, nfe_miibus_statchg), - { NULL, NULL } + DEVMETHOD_END }; static driver_t nfe_driver = { Modified: stable/8/sys/dev/nge/if_nge.c ============================================================================== --- stable/8/sys/dev/nge/if_nge.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/nge/if_nge.c Sun Jan 29 01:22:48 2012 (r230714) @@ -223,16 +223,12 @@ static device_method_t nge_methods[] = { DEVMETHOD(device_suspend, nge_suspend), DEVMETHOD(device_resume, nge_resume), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, nge_miibus_readreg), DEVMETHOD(miibus_writereg, nge_miibus_writereg), DEVMETHOD(miibus_statchg, nge_miibus_statchg), - { NULL, NULL } + DEVMETHOD_END }; static driver_t nge_driver = { Modified: stable/8/sys/dev/nve/if_nve.c ============================================================================== --- stable/8/sys/dev/nve/if_nve.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/nve/if_nve.c Sun Jan 29 01:22:48 2012 (r230714) @@ -184,15 +184,11 @@ static device_method_t nve_methods[] = { DEVMETHOD(device_detach, nve_detach), DEVMETHOD(device_shutdown, nve_shutdown), - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, nve_miibus_readreg), DEVMETHOD(miibus_writereg, nve_miibus_writereg), - {0, 0} + DEVMETHOD_END }; static driver_t nve_driver = { Modified: stable/8/sys/dev/pccbb/pccbb_isa.c ============================================================================== --- stable/8/sys/dev/pccbb/pccbb_isa.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/pccbb/pccbb_isa.c Sun Jan 29 01:22:48 2012 (r230714) @@ -211,7 +211,6 @@ static device_method_t cbb_methods[] = { DEVMETHOD(device_resume, cbb_resume), /* bus methods */ - DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, cbb_read_ivar), DEVMETHOD(bus_write_ivar, cbb_write_ivar), DEVMETHOD(bus_alloc_resource, cbb_alloc_resource), @@ -232,7 +231,7 @@ static device_method_t cbb_methods[] = { DEVMETHOD(power_enable_socket, cbb_power_enable_socket), DEVMETHOD(power_disable_socket, cbb_power_disable_socket), - {0,0} + DEVMETHOD_END }; static driver_t cbb_isa_driver = { Modified: stable/8/sys/dev/pccbb/pccbb_pci.c ============================================================================== --- stable/8/sys/dev/pccbb/pccbb_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/pccbb/pccbb_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -816,7 +816,6 @@ static device_method_t cbb_methods[] = { DEVMETHOD(device_resume, cbb_resume), /* bus methods */ - DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, cbb_read_ivar), DEVMETHOD(bus_write_ivar, cbb_write_ivar), DEVMETHOD(bus_alloc_resource, cbb_alloc_resource), @@ -843,7 +842,7 @@ static device_method_t cbb_methods[] = { DEVMETHOD(pcib_write_config, cbb_write_config), DEVMETHOD(pcib_route_interrupt, cbb_route_interrupt), - {0,0} + DEVMETHOD_END }; static driver_t cbb_driver = { Modified: stable/8/sys/dev/pci/eisa_pci.c ============================================================================== --- stable/8/sys/dev/pci/eisa_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/pci/eisa_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -55,7 +55,6 @@ static device_method_t eisab_methods[] = DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), @@ -63,7 +62,7 @@ static device_method_t eisab_methods[] = DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - { 0, 0 } + DEVMETHOD_END }; static driver_t eisab_driver = { Modified: stable/8/sys/dev/pci/isa_pci.c ============================================================================== --- stable/8/sys/dev/pci/isa_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/pci/isa_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -57,8 +57,6 @@ static device_method_t isab_methods[] = DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ - DEVMETHOD(bus_add_child, bus_generic_add_child), - DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), @@ -66,7 +64,7 @@ static device_method_t isab_methods[] = DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - { 0, 0 } + DEVMETHOD_END }; static driver_t isab_driver = { Modified: stable/8/sys/dev/pci/pci_pci.c ============================================================================== --- stable/8/sys/dev/pci/pci_pci.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/pci/pci_pci.c Sun Jan 29 01:22:48 2012 (r230714) @@ -66,7 +66,6 @@ static device_method_t pcib_methods[] = DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, pcib_read_ivar), DEVMETHOD(bus_write_ivar, pcib_write_ivar), DEVMETHOD(bus_alloc_resource, pcib_alloc_resource), @@ -93,7 +92,7 @@ static device_method_t pcib_methods[] = DEVMETHOD(pcib_release_msix, pcib_release_msix), DEVMETHOD(pcib_map_msi, pcib_map_msi), - { 0, 0 } + DEVMETHOD_END }; static devclass_t pcib_devclass; Modified: stable/8/sys/dev/pcn/if_pcn.c ============================================================================== --- stable/8/sys/dev/pcn/if_pcn.c Sun Jan 29 01:01:41 2012 (r230713) +++ stable/8/sys/dev/pcn/if_pcn.c Sun Jan 29 01:22:48 2012 (r230714) @@ -173,16 +173,12 @@ static device_method_t pcn_methods[] = { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 01:27:40 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36EBA106566B; Sun, 29 Jan 2012 01:27:40 +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 1B5158FC12; Sun, 29 Jan 2012 01:27:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T1ReLI009980; Sun, 29 Jan 2012 01:27:40 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T1Rd5p009952; Sun, 29 Jan 2012 01:27:39 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290127.q0T1Rd5p009952@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 01:27: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: r230715 - in stable/8/sys: dev/bwn dev/esp dev/mii dev/ofw dev/siba dev/stge dev/vte sparc64/central sparc64/ebus sparc64/fhc sparc64/pci sparc64/sbus sparc64/sparc64 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 01:27:40 -0000 Author: marius Date: Sun Jan 29 01:27:39 2012 New Revision: 230715 URL: http://svn.freebsd.org/changeset/base/230715 Log: MFC: r226173, r227848 s,KOBJMETHOD_END,DEVMETHOD_END,g in order to fully hide the explicit mention of kobj(9) from device drivers. Modified: stable/8/sys/dev/bwn/if_bwn.c stable/8/sys/dev/esp/esp_pci.c stable/8/sys/dev/esp/esp_sbus.c stable/8/sys/dev/mii/rdcphy.c stable/8/sys/dev/ofw/ofw_iicbus.c stable/8/sys/dev/siba/siba.c stable/8/sys/dev/siba/siba_bwn.c stable/8/sys/dev/siba/siba_cc.c stable/8/sys/dev/stge/if_stge.c stable/8/sys/dev/vte/if_vte.c stable/8/sys/sparc64/central/central.c stable/8/sys/sparc64/ebus/ebus.c stable/8/sys/sparc64/ebus/epic.c stable/8/sys/sparc64/fhc/fhc.c stable/8/sys/sparc64/pci/apb.c stable/8/sys/sparc64/pci/ofw_pcib.c stable/8/sys/sparc64/pci/ofw_pcibus.c stable/8/sys/sparc64/sbus/dma_sbus.c stable/8/sys/sparc64/sbus/sbus.c stable/8/sys/sparc64/sparc64/eeprom.c stable/8/sys/sparc64/sparc64/jbusppm.c stable/8/sys/sparc64/sparc64/nexus.c stable/8/sys/sparc64/sparc64/rtc.c stable/8/sys/sparc64/sparc64/sc_machdep.c stable/8/sys/sparc64/sparc64/schppm.c stable/8/sys/sparc64/sparc64/ssm.c stable/8/sys/sparc64/sparc64/upa.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) Modified: stable/8/sys/dev/bwn/if_bwn.c ============================================================================== --- stable/8/sys/dev/bwn/if_bwn.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/dev/bwn/if_bwn.c Sun Jan 29 01:27:39 2012 (r230715) @@ -14225,7 +14225,7 @@ static device_method_t bwn_methods[] = { DEVMETHOD(device_detach, bwn_detach), DEVMETHOD(device_suspend, bwn_suspend), DEVMETHOD(device_resume, bwn_resume), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t bwn_driver = { "bwn", Modified: stable/8/sys/dev/esp/esp_pci.c ============================================================================== --- stable/8/sys/dev/esp/esp_pci.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/dev/esp/esp_pci.c Sun Jan 29 01:27:39 2012 (r230715) @@ -146,7 +146,7 @@ static device_method_t esp_pci_methods[] DEVMETHOD(device_suspend, esp_pci_suspend), DEVMETHOD(device_resume, esp_pci_resume), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t esp_pci_driver = { Modified: stable/8/sys/dev/esp/esp_sbus.c ============================================================================== --- stable/8/sys/dev/esp/esp_sbus.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/dev/esp/esp_sbus.c Sun Jan 29 01:27:39 2012 (r230715) @@ -117,7 +117,7 @@ static device_method_t esp_dma_methods[] DEVMETHOD(device_suspend, esp_suspend), DEVMETHOD(device_resume, esp_resume), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t esp_dma_driver = { @@ -136,7 +136,7 @@ static device_method_t esp_sbus_methods[ DEVMETHOD(device_suspend, esp_suspend), DEVMETHOD(device_resume, esp_resume), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t esp_sbus_driver = { Modified: stable/8/sys/dev/mii/rdcphy.c ============================================================================== --- stable/8/sys/dev/mii/rdcphy.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/dev/mii/rdcphy.c Sun Jan 29 01:27:39 2012 (r230715) @@ -66,7 +66,7 @@ static device_method_t rdcphy_methods[] DEVMETHOD(device_attach, rdcphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - KOBJMETHOD_END + DEVMETHOD_END }; static devclass_t rdcphy_devclass; Modified: stable/8/sys/dev/ofw/ofw_iicbus.c ============================================================================== --- stable/8/sys/dev/ofw/ofw_iicbus.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/dev/ofw/ofw_iicbus.c Sun Jan 29 01:27:39 2012 (r230715) @@ -68,7 +68,7 @@ static device_method_t ofw_iicbus_method DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - KOBJMETHOD_END + DEVMETHOD_END }; struct ofw_iicbus_devinfo { Modified: stable/8/sys/dev/siba/siba.c ============================================================================== --- stable/8/sys/dev/siba/siba.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/dev/siba/siba.c Sun Jan 29 01:27:39 2012 (r230715) @@ -632,7 +632,7 @@ static device_method_t siba_methods[] = DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_write_ivar, siba_write_ivar), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t siba_driver = { Modified: stable/8/sys/dev/siba/siba_bwn.c ============================================================================== --- stable/8/sys/dev/siba/siba_bwn.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/dev/siba/siba_bwn.c Sun Jan 29 01:27:39 2012 (r230715) @@ -410,7 +410,7 @@ static device_method_t siba_bwn_methods[ DEVMETHOD(pci_release_msi, siba_bwn_release_msi), DEVMETHOD(pci_msi_count, siba_bwn_msi_count), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t siba_bwn_driver = { "siba_bwn", Modified: stable/8/sys/dev/siba/siba_cc.c ============================================================================== --- stable/8/sys/dev/siba/siba_cc.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/dev/siba/siba_cc.c Sun Jan 29 01:27:39 2012 (r230715) @@ -141,7 +141,7 @@ static device_method_t siba_cc_methods[] DEVMETHOD(device_attach, siba_cc_attach), DEVMETHOD(device_probe, siba_cc_probe), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t siba_cc_driver = { Modified: stable/8/sys/dev/stge/if_stge.c ============================================================================== --- stable/8/sys/dev/stge/if_stge.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/dev/stge/if_stge.c Sun Jan 29 01:27:39 2012 (r230715) @@ -221,8 +221,7 @@ static device_method_t stge_methods[] = DEVMETHOD(miibus_writereg, stge_miibus_writereg), DEVMETHOD(miibus_statchg, stge_miibus_statchg), - { 0, 0 } - + DEVMETHOD_END }; static driver_t stge_driver = { Modified: stable/8/sys/dev/vte/if_vte.c ============================================================================== --- stable/8/sys/dev/vte/if_vte.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/dev/vte/if_vte.c Sun Jan 29 01:27:39 2012 (r230715) @@ -151,7 +151,7 @@ static device_method_t vte_methods[] = { DEVMETHOD(miibus_writereg, vte_miibus_writereg), DEVMETHOD(miibus_statchg, vte_miibus_statchg), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t vte_driver = { Modified: stable/8/sys/sparc64/central/central.c ============================================================================== --- stable/8/sys/sparc64/central/central.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/central/central.c Sun Jan 29 01:27:39 2012 (r230715) @@ -96,7 +96,7 @@ static device_method_t central_methods[] DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t central_driver = { Modified: stable/8/sys/sparc64/ebus/ebus.c ============================================================================== --- stable/8/sys/sparc64/ebus/ebus.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/ebus/ebus.c Sun Jan 29 01:27:39 2012 (r230715) @@ -181,7 +181,7 @@ static device_method_t ebus_nexus_method DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t ebus_nexus_driver = { @@ -228,7 +228,7 @@ static device_method_t ebus_pci_methods[ DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t ebus_pci_driver = { Modified: stable/8/sys/sparc64/ebus/epic.c ============================================================================== --- stable/8/sys/sparc64/ebus/epic.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/ebus/epic.c Sun Jan 29 01:27:39 2012 (r230715) @@ -125,7 +125,7 @@ static device_method_t epic_methods[] = DEVMETHOD(device_attach, epic_attach), DEVMETHOD(device_detach, epic_detach), - KOBJMETHOD_END + DEVMETHOD_END }; static devclass_t epic_devclass; Modified: stable/8/sys/sparc64/fhc/fhc.c ============================================================================== --- stable/8/sys/sparc64/fhc/fhc.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/fhc/fhc.c Sun Jan 29 01:27:39 2012 (r230715) @@ -110,7 +110,7 @@ static device_method_t fhc_methods[] = { DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t fhc_driver = { Modified: stable/8/sys/sparc64/pci/apb.c ============================================================================== --- stable/8/sys/sparc64/pci/apb.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/pci/apb.c Sun Jan 29 01:27:39 2012 (r230715) @@ -96,7 +96,7 @@ static device_method_t apb_methods[] = { /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, ofw_pcib_gen_get_node), - KOBJMETHOD_END + DEVMETHOD_END }; static devclass_t pcib_devclass; Modified: stable/8/sys/sparc64/pci/ofw_pcib.c ============================================================================== --- stable/8/sys/sparc64/pci/ofw_pcib.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/pci/ofw_pcib.c Sun Jan 29 01:27:39 2012 (r230715) @@ -74,7 +74,7 @@ static device_method_t ofw_pcib_methods[ /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, ofw_pcib_gen_get_node), - KOBJMETHOD_END + DEVMETHOD_END }; static devclass_t pcib_devclass; Modified: stable/8/sys/sparc64/pci/ofw_pcibus.c ============================================================================== --- stable/8/sys/sparc64/pci/ofw_pcibus.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/pci/ofw_pcibus.c Sun Jan 29 01:27:39 2012 (r230715) @@ -90,7 +90,7 @@ static device_method_t ofw_pcibus_method DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - KOBJMETHOD_END + DEVMETHOD_END }; struct ofw_pcibus_devinfo { Modified: stable/8/sys/sparc64/sbus/dma_sbus.c ============================================================================== --- stable/8/sys/sparc64/sbus/dma_sbus.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/sbus/dma_sbus.c Sun Jan 29 01:27:39 2012 (r230715) @@ -134,7 +134,7 @@ static device_method_t dma_methods[] = { DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t dma_driver = { Modified: stable/8/sys/sparc64/sbus/sbus.c ============================================================================== --- stable/8/sys/sparc64/sbus/sbus.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/sbus/sbus.c Sun Jan 29 01:27:39 2012 (r230715) @@ -188,7 +188,7 @@ static device_method_t sbus_methods[] = DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t sbus_driver = { Modified: stable/8/sys/sparc64/sparc64/eeprom.c ============================================================================== --- stable/8/sys/sparc64/sparc64/eeprom.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/sparc64/eeprom.c Sun Jan 29 01:27:39 2012 (r230715) @@ -91,7 +91,7 @@ static device_method_t eeprom_methods[] DEVMETHOD(clock_gettime, mk48txx_gettime), DEVMETHOD(clock_settime, mk48txx_settime), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t eeprom_driver = { Modified: stable/8/sys/sparc64/sparc64/jbusppm.c ============================================================================== --- stable/8/sys/sparc64/sparc64/jbusppm.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/sparc64/jbusppm.c Sun Jan 29 01:27:39 2012 (r230715) @@ -82,7 +82,7 @@ static device_method_t jbusppm_methods[] DEVMETHOD(device_probe, jbusppm_probe), DEVMETHOD(device_attach, jbusppm_attach), - KOBJMETHOD_END + DEVMETHOD_END }; static devclass_t jbusppm_devclass; Modified: stable/8/sys/sparc64/sparc64/nexus.c ============================================================================== --- stable/8/sys/sparc64/sparc64/nexus.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/sparc64/nexus.c Sun Jan 29 01:27:39 2012 (r230715) @@ -144,7 +144,7 @@ static device_method_t nexus_methods[] = DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - KOBJMETHOD_END + DEVMETHOD_END }; static devclass_t nexus_devclass; Modified: stable/8/sys/sparc64/sparc64/rtc.c ============================================================================== --- stable/8/sys/sparc64/sparc64/rtc.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/sparc64/rtc.c Sun Jan 29 01:27:39 2012 (r230715) @@ -90,7 +90,7 @@ static device_method_t rtc_ebus_methods[ DEVMETHOD(clock_gettime, mc146818_gettime), DEVMETHOD(clock_settime, mc146818_settime), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t rtc_ebus_driver = { @@ -111,7 +111,7 @@ static device_method_t rtc_isa_methods[] DEVMETHOD(clock_gettime, mc146818_gettime), DEVMETHOD(clock_settime, mc146818_settime), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t rtc_isa_driver = { Modified: stable/8/sys/sparc64/sparc64/sc_machdep.c ============================================================================== --- stable/8/sys/sparc64/sparc64/sc_machdep.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/sparc64/sc_machdep.c Sun Jan 29 01:27:39 2012 (r230715) @@ -57,7 +57,7 @@ static device_method_t sc_methods[] = { DEVMETHOD(device_probe, sc_probe), DEVMETHOD(device_attach, sc_attach), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t sc_driver = { Modified: stable/8/sys/sparc64/sparc64/schppm.c ============================================================================== --- stable/8/sys/sparc64/sparc64/schppm.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/sparc64/schppm.c Sun Jan 29 01:27:39 2012 (r230715) @@ -73,7 +73,7 @@ static device_method_t schppm_methods[] DEVMETHOD(device_probe, schppm_probe), DEVMETHOD(device_attach, schppm_attach), - KOBJMETHOD_END + DEVMETHOD_END }; static devclass_t schppm_devclass; Modified: stable/8/sys/sparc64/sparc64/ssm.c ============================================================================== --- stable/8/sys/sparc64/sparc64/ssm.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/sparc64/ssm.c Sun Jan 29 01:27:39 2012 (r230715) @@ -52,7 +52,7 @@ static device_method_t ssm_methods[] = { /* ofw_bus interface */ - KOBJMETHOD_END + DEVMETHOD_END }; static devclass_t ssm_devclass; Modified: stable/8/sys/sparc64/sparc64/upa.c ============================================================================== --- stable/8/sys/sparc64/sparc64/upa.c Sun Jan 29 01:22:48 2012 (r230714) +++ stable/8/sys/sparc64/sparc64/upa.c Sun Jan 29 01:27:39 2012 (r230715) @@ -147,7 +147,7 @@ static device_method_t upa_methods[] = { DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - KOBJMETHOD_END + DEVMETHOD_END }; static devclass_t upa_devclass; From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 01:29:31 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBCF2106564A; Sun, 29 Jan 2012 01:29: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 A5F7A8FC1B; Sun, 29 Jan 2012 01:29:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T1TVEa010083; Sun, 29 Jan 2012 01:29:31 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T1TVoj010081; Sun, 29 Jan 2012 01:29:31 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290129.q0T1TVoj010081@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 01:29:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230716 - stable/9/sys/dev/mii X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 01:29:31 -0000 Author: marius Date: Sun Jan 29 01:29:31 2012 New Revision: 230716 URL: http://svn.freebsd.org/changeset/base/230716 Log: MFC: r227906 Sync with NetBSD rev. 1.104 Obtained from: NetBSD Modified: stable/9/sys/dev/mii/miidevs Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/mii/miidevs ============================================================================== --- stable/9/sys/dev/mii/miidevs Sun Jan 29 01:27:39 2012 (r230715) +++ stable/9/sys/dev/mii/miidevs Sun Jan 29 01:29:31 2012 (r230716) @@ -1,5 +1,5 @@ $FreeBSD$ -/*$NetBSD: miidevs,v 1.99 2011/01/26 18:39:04 bouyer Exp $*/ +/*$NetBSD: miidevs,v 1.104 2011/11/12 11:10:49 sekiya Exp $*/ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -146,6 +146,7 @@ model xxBROADCOM BCM5214 0x0028 BCM5214 model xxBROADCOM BCM5221 0x001e BCM5221 10/100 media interface model xxBROADCOM BCM5222 0x0032 BCM5222 Dual 10/100 media interface model xxBROADCOM BCM4401 0x0036 BCM4401 10/100 media interface +model xxBROADCOM BCM5365 0x0037 BCM5365 10/100 5-port PHY switch model BROADCOM BCM5400 0x0004 BCM5400 1000BASE-T media interface model BROADCOM BCM5401 0x0005 BCM5401 1000BASE-T media interface model BROADCOM BCM5411 0x0007 BCM5411 1000BASE-T media interface @@ -164,12 +165,14 @@ model BROADCOM BCM54K2 0x002e BCM54K2 1 model BROADCOM BCM5714 0x0034 BCM5714 1000BASE-T media interface model BROADCOM BCM5780 0x0035 BCM5780 1000BASE-T media interface model BROADCOM BCM5708C 0x0036 BCM5708C 1000BASE-T media interface +model BROADCOM2 BCM5325 0x0003 BCM5325 10/100 5-port PHY switch model BROADCOM2 BCM5906 0x0004 BCM5906 10/100baseTX media interface model BROADCOM2 BCM5481 0x000a BCM5481 1000BASE-T media interface model BROADCOM2 BCM5482 0x000b BCM5482 1000BASE-T media interface model BROADCOM2 BCM5755 0x000c BCM5755 1000BASE-T media interface model BROADCOM2 BCM5754 0x000e BCM5754/5787 1000BASE-T media interface model BROADCOM2 BCM5708S 0x0015 BCM5708S 1000/2500baseSX PHY +model BROADCOM2 BCM5785 0x0016 BCM5785 1000BASE-T media interface model BROADCOM2 BCM5709CAX 0x002c BCM5709CAX 10/100/1000baseT PHY model BROADCOM2 BCM5722 0x002d BCM5722 1000BASE-T media interface model BROADCOM2 BCM5784 0x003a BCM5784 10/100/1000baseT PHY @@ -218,6 +221,10 @@ model yyINTEL I82562ET 0x0033 i82562ET model yyINTEL I82553 0x0035 i82553 10/100 media interface model yyINTEL I82566 0x0039 i82566 10/100/1000 media interface model INTEL I82577 0x0005 i82577 10/100/1000 media interface +model INTEL I82579 0x0009 i82579 10/100/1000 media interface +model xxMARVELL I82563 0x000a i82563 10/100/1000 media interface + +model yyINTEL IGP01E1000 0x0038 Intel IGP01E1000 Gigabit PHY /* Jato Technologies PHYs */ model xxJATO BASEX 0x0000 Jato 1000baseX media interface @@ -246,18 +253,24 @@ model xxMARVELL E3082 0x0008 Marvell 88 model xxMARVELL E1112 0x0009 Marvell 88E1112 Gigabit PHY model xxMARVELL E1149 0x000b Marvell 88E1149 Gigabit PHY model xxMARVELL E1111 0x000c Marvell 88E1111 Gigabit PHY +model xxMARVELL E1145 0x000d Marvell 88E1145 Quad Gigabit PHY model xxMARVELL E1116 0x0021 Marvell 88E1116 Gigabit PHY model xxMARVELL E1116R 0x0024 Marvell 88E1116R Gigabit PHY model xxMARVELL E1118 0x0022 Marvell 88E1118 Gigabit PHY model xxMARVELL E1149R 0x0025 Marvell 88E1149R Quad Gigabit PHY model xxMARVELL E3016 0x0026 Marvell 88E3016 10/100 Fast Ethernet PHY model xxMARVELL PHYG65G 0x0027 Marvell PHYG65G Gigabit PHY +model xxMARVELL E1116R_29 0x0029 Marvell 88E1116R Gigabit PHY model MARVELL E1000 0x0005 Marvell 88E1000 Gigabit PHY model MARVELL E1011 0x0002 Marvell 88E1011 Gigabit PHY model MARVELL E1000_3 0x0003 Marvell 88E1000 Gigabit PHY model MARVELL E1000_5 0x0005 Marvell 88E1000 Gigabit PHY model MARVELL E1111 0x000c Marvell 88E1111 Gigabit PHY +/* Myson Technology PHYs */ +model xxMYSON MTD972 0x0000 MTD972 10/100 media interface +model MYSON MTD803 0x0000 MTD803 3-in-1 media interface + /* National Semiconductor PHYs */ model xxNATSEMI DP83840 0x0000 DP83840 10/100 media interface model xxNATSEMI DP83843 0x0001 DP83843 10/100 media interface From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 01:32:25 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BF9A106566C; Sun, 29 Jan 2012 01:32: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 55EDB8FC16; Sun, 29 Jan 2012 01:32:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T1WPEW010248; Sun, 29 Jan 2012 01:32:25 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T1WPi4010246; Sun, 29 Jan 2012 01:32:25 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290132.q0T1WPi4010246@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 01:32:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230717 - stable/9/sys/dev/mii X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 01:32:25 -0000 Author: marius Date: Sun Jan 29 01:32:24 2012 New Revision: 230717 URL: http://svn.freebsd.org/changeset/base/230717 Log: MFC: r227907, r22791 (for diff reduction) Add BCM5785 but wrap it in #ifdef notyet for now. According to yongari@ there are issues probably needing workarounds in bge(4) when brgphy(4) handles this PHY. Letting ukphy(4) handle it instead results in a working configuration, although likely with performance penalties. Modified: stable/9/sys/dev/mii/brgphy.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/mii/brgphy.c ============================================================================== --- stable/9/sys/dev/mii/brgphy.c Sun Jan 29 01:29:31 2012 (r230716) +++ stable/9/sys/dev/mii/brgphy.c Sun Jan 29 01:32:24 2012 (r230717) @@ -139,6 +139,9 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(BROADCOM2, BCM5754), MII_PHY_DESC(BROADCOM2, BCM5761), MII_PHY_DESC(BROADCOM2, BCM5784), +#ifdef notyet /* better handled by ukphy(4) until WARs are implemented */ + MII_PHY_DESC(BROADCOM2, BCM5785), +#endif MII_PHY_DESC(BROADCOM3, BCM5717C), MII_PHY_DESC(BROADCOM3, BCM5719C), MII_PHY_DESC(BROADCOM3, BCM5720C), From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 01:35:16 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 099FC1065670; Sun, 29 Jan 2012 01:35:16 +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 E53AD8FC08; Sun, 29 Jan 2012 01:35:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T1ZFFF010415; Sun, 29 Jan 2012 01:35:15 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T1ZFWQ010382; Sun, 29 Jan 2012 01:35:15 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290135.q0T1ZFWQ010382@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 01:35:15 +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: r230718 - in stable/8/sys/dev: dc mii X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 01:35:16 -0000 Author: marius Date: Sun Jan 29 01:35:14 2012 New Revision: 230718 URL: http://svn.freebsd.org/changeset/base/230718 Log: MFC: r227908 Use DEVMETHOD_END. Modified: stable/8/sys/dev/dc/dcphy.c stable/8/sys/dev/dc/pnphy.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/ip1000phy.c stable/8/sys/dev/mii/jmphy.c stable/8/sys/dev/mii/lxtphy.c 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 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) Modified: stable/8/sys/dev/dc/dcphy.c ============================================================================== --- stable/8/sys/dev/dc/dcphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/dc/dcphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -96,7 +96,7 @@ static device_method_t dcphy_methods[] = DEVMETHOD(device_attach, dcphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t dcphy_devclass; Modified: stable/8/sys/dev/dc/pnphy.c ============================================================================== --- stable/8/sys/dev/dc/pnphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/dc/pnphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -75,7 +75,7 @@ static device_method_t pnphy_methods[] = DEVMETHOD(device_attach, pnphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t pnphy_devclass; Modified: stable/8/sys/dev/mii/acphy.c ============================================================================== --- stable/8/sys/dev/mii/acphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/acphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -87,7 +87,7 @@ static device_method_t acphy_methods[] = DEVMETHOD(device_attach, acphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t acphy_devclass; Modified: stable/8/sys/dev/mii/amphy.c ============================================================================== --- stable/8/sys/dev/mii/amphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/amphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -66,7 +66,7 @@ static device_method_t amphy_methods[] = DEVMETHOD(device_attach, amphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t amphy_devclass; Modified: stable/8/sys/dev/mii/atphy.c ============================================================================== --- stable/8/sys/dev/mii/atphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/atphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -66,7 +66,7 @@ static device_method_t atphy_methods[] = DEVMETHOD(device_attach, atphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { NULL, NULL } + DEVMETHOD_END }; static devclass_t atphy_devclass; Modified: stable/8/sys/dev/mii/axphy.c ============================================================================== --- stable/8/sys/dev/mii/axphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/axphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -56,7 +56,7 @@ static device_method_t axphy_methods[] = DEVMETHOD(device_attach, axphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t axphy_devclass; Modified: stable/8/sys/dev/mii/bmtphy.c ============================================================================== --- stable/8/sys/dev/mii/bmtphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/bmtphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -96,8 +96,7 @@ static device_method_t bmtphy_methods[] DEVMETHOD(device_attach, bmtphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - - { 0, 0 } + DEVMETHOD_END }; static devclass_t bmtphy_devclass; Modified: stable/8/sys/dev/mii/brgphy.c ============================================================================== --- stable/8/sys/dev/mii/brgphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/brgphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -85,7 +85,7 @@ static device_method_t brgphy_methods[] DEVMETHOD(device_attach, brgphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t brgphy_devclass; Modified: stable/8/sys/dev/mii/ciphy.c ============================================================================== --- stable/8/sys/dev/mii/ciphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/ciphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -67,7 +67,7 @@ static device_method_t ciphy_methods[] = DEVMETHOD(device_attach, ciphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ciphy_devclass; Modified: stable/8/sys/dev/mii/e1000phy.c ============================================================================== --- stable/8/sys/dev/mii/e1000phy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/e1000phy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -76,7 +76,7 @@ static device_method_t e1000phy_methods[ DEVMETHOD(device_attach, e1000phy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t e1000phy_devclass; Modified: stable/8/sys/dev/mii/exphy.c ============================================================================== --- stable/8/sys/dev/mii/exphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/exphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -86,7 +86,7 @@ static device_method_t exphy_methods[] = DEVMETHOD(device_attach, exphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t exphy_devclass; Modified: stable/8/sys/dev/mii/gentbi.c ============================================================================== --- stable/8/sys/dev/mii/gentbi.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/gentbi.c Sun Jan 29 01:35:14 2012 (r230718) @@ -95,7 +95,7 @@ static device_method_t gentbi_methods[] DEVMETHOD(device_attach, gentbi_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - {0, 0} + DEVMETHOD_END }; static devclass_t gentbi_devclass; Modified: stable/8/sys/dev/mii/icsphy.c ============================================================================== --- stable/8/sys/dev/mii/icsphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/icsphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -94,7 +94,7 @@ static device_method_t icsphy_methods[] DEVMETHOD(device_attach, icsphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t icsphy_devclass; Modified: stable/8/sys/dev/mii/ip1000phy.c ============================================================================== --- stable/8/sys/dev/mii/ip1000phy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/ip1000phy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -69,7 +69,7 @@ static device_method_t ip1000phy_methods DEVMETHOD(device_attach, ip1000phy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ip1000phy_devclass; Modified: stable/8/sys/dev/mii/jmphy.c ============================================================================== --- stable/8/sys/dev/mii/jmphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/jmphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -69,7 +69,7 @@ static device_method_t jmphy_methods[] = DEVMETHOD(device_attach, jmphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { NULL, NULL } + DEVMETHOD_END }; static devclass_t jmphy_devclass; Modified: stable/8/sys/dev/mii/lxtphy.c ============================================================================== --- stable/8/sys/dev/mii/lxtphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/lxtphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -91,7 +91,7 @@ static device_method_t lxtphy_methods[] DEVMETHOD(device_attach, lxtphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t lxtphy_devclass; Modified: stable/8/sys/dev/mii/mlphy.c ============================================================================== --- stable/8/sys/dev/mii/mlphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/mlphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -84,7 +84,7 @@ static device_method_t mlphy_methods[] = DEVMETHOD(device_attach, mlphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t mlphy_devclass; Modified: stable/8/sys/dev/mii/nsgphy.c ============================================================================== --- stable/8/sys/dev/mii/nsgphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/nsgphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -83,7 +83,7 @@ static device_method_t nsgphy_methods[] DEVMETHOD(device_attach, nsgphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t nsgphy_devclass; Modified: stable/8/sys/dev/mii/nsphy.c ============================================================================== --- stable/8/sys/dev/mii/nsphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/nsphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -90,7 +90,7 @@ static device_method_t nsphy_methods[] = DEVMETHOD(device_attach, nsphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t nsphy_devclass; Modified: stable/8/sys/dev/mii/nsphyter.c ============================================================================== --- stable/8/sys/dev/mii/nsphyter.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/nsphyter.c Sun Jan 29 01:35:14 2012 (r230718) @@ -93,7 +93,7 @@ static device_method_t nsphyter_methods[ DEVMETHOD(device_attach, nsphyter_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t nsphyter_devclass; Modified: stable/8/sys/dev/mii/pnaphy.c ============================================================================== --- stable/8/sys/dev/mii/pnaphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/pnaphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -69,7 +69,7 @@ static device_method_t pnaphy_methods[] DEVMETHOD(device_attach, pnaphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t pnaphy_devclass; Modified: stable/8/sys/dev/mii/qsphy.c ============================================================================== --- stable/8/sys/dev/mii/qsphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/qsphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -91,7 +91,7 @@ static device_method_t qsphy_methods[] = DEVMETHOD(device_attach, qsphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t qsphy_devclass; Modified: stable/8/sys/dev/mii/rgephy.c ============================================================================== --- stable/8/sys/dev/mii/rgephy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/rgephy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -74,7 +74,7 @@ static device_method_t rgephy_methods[] DEVMETHOD(device_attach, rgephy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t rgephy_devclass; Modified: stable/8/sys/dev/mii/rlphy.c ============================================================================== --- stable/8/sys/dev/mii/rlphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/rlphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -71,7 +71,7 @@ static device_method_t rlphy_methods[] = DEVMETHOD(device_attach, rlphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t rlphy_devclass; Modified: stable/8/sys/dev/mii/rlswitch.c ============================================================================== --- stable/8/sys/dev/mii/rlswitch.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/rlswitch.c Sun Jan 29 01:35:14 2012 (r230718) @@ -70,7 +70,7 @@ static device_method_t rlswitch_methods[ DEVMETHOD(device_attach, rlswitch_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t rlswitch_devclass; Modified: stable/8/sys/dev/mii/ruephy.c ============================================================================== --- stable/8/sys/dev/mii/ruephy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/ruephy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -62,7 +62,7 @@ static device_method_t ruephy_methods[] DEVMETHOD(device_attach, ruephy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ruephy_devclass; Modified: stable/8/sys/dev/mii/smcphy.c ============================================================================== --- stable/8/sys/dev/mii/smcphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/smcphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -62,8 +62,7 @@ static device_method_t smcphy_methods[] DEVMETHOD(device_attach, smcphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - - { 0, 0 } + DEVMETHOD_END }; static devclass_t smcphy_devclass; @@ -224,8 +223,7 @@ smcphy_auto(struct mii_softc *sc, int me { uint16_t anar; - anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) | - ANAR_CSMA; + anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) | ANAR_CSMA; if ((media & IFM_FLOW) != 0 || (sc->mii_flags & MIIF_FORCEPAUSE) != 0) anar |= ANAR_FC; PHY_WRITE(sc, MII_ANAR, anar); Modified: stable/8/sys/dev/mii/tdkphy.c ============================================================================== --- stable/8/sys/dev/mii/tdkphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/tdkphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -71,7 +71,7 @@ static device_method_t tdkphy_methods[] DEVMETHOD(device_attach, tdkphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t tdkphy_devclass; Modified: stable/8/sys/dev/mii/tlphy.c ============================================================================== --- stable/8/sys/dev/mii/tlphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/tlphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -97,7 +97,7 @@ static device_method_t tlphy_methods[] = DEVMETHOD(device_attach, tlphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t tlphy_devclass; Modified: stable/8/sys/dev/mii/truephy.c ============================================================================== --- stable/8/sys/dev/mii/truephy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/truephy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -72,7 +72,7 @@ static device_method_t truephy_methods[] DEVMETHOD(device_attach, truephy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static const struct mii_phydesc truephys[] = { Modified: stable/8/sys/dev/mii/ukphy.c ============================================================================== --- stable/8/sys/dev/mii/ukphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/ukphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = DEVMETHOD(device_attach, ukphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ukphy_devclass; Modified: stable/8/sys/dev/mii/xmphy.c ============================================================================== --- stable/8/sys/dev/mii/xmphy.c Sun Jan 29 01:32:24 2012 (r230717) +++ stable/8/sys/dev/mii/xmphy.c Sun Jan 29 01:35:14 2012 (r230718) @@ -66,7 +66,7 @@ static device_method_t xmphy_methods[] = DEVMETHOD(device_attach, xmphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t xmphy_devclass; From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 01:40:38 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70624106564A; Sun, 29 Jan 2012 01:40:38 +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 58EE48FC15; Sun, 29 Jan 2012 01:40:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T1ecXW010636; Sun, 29 Jan 2012 01:40:38 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T1ecsY010631; Sun, 29 Jan 2012 01:40:38 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290140.q0T1ecsY010631@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 01:40:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230719 - in stable/9/sys/dev: arcmsr hptiop hptmv hptrr X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 01:40:38 -0000 Author: marius Date: Sun Jan 29 01:40:37 2012 New Revision: 230719 URL: http://svn.freebsd.org/changeset/base/230719 Log: MFC: r227912 - Just use cam_calc_geometry(9) on newer version of FreeBSD rather than duplicating it. - In hptmv(4) and hptrr(4) use __FBSDID and DEVMETHOD_END. Modified: stable/9/sys/dev/arcmsr/arcmsr.c stable/9/sys/dev/hptiop/hptiop.c stable/9/sys/dev/hptmv/entry.c stable/9/sys/dev/hptrr/hptrr_osm_bsd.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/arcmsr/arcmsr.c ============================================================================== --- stable/9/sys/dev/arcmsr/arcmsr.c Sun Jan 29 01:35:14 2012 (r230718) +++ stable/9/sys/dev/arcmsr/arcmsr.c Sun Jan 29 01:40:37 2012 (r230719) @@ -2714,16 +2714,20 @@ static void arcmsr_action(struct cam_sim xpt_done(pccb); break; } - case XPT_CALC_GEOMETRY: { - struct ccb_calc_geometry *ccg; - u_int32_t size_mb; - u_int32_t secs_per_cylinder; - + case XPT_CALC_GEOMETRY: if(pccb->ccb_h.target_id == 16) { pccb->ccb_h.status |= CAM_FUNC_NOTAVAIL; xpt_done(pccb); break; } +#if __FreeBSD_version >= 500000 + cam_calc_geometry(&pccb->ccg, 1); +#else + { + struct ccb_calc_geometry *ccg; + u_int32_t size_mb; + u_int32_t secs_per_cylinder; + ccg= &pccb->ccg; if (ccg->block_size == 0) { pccb->ccb_h.status = CAM_REQ_INVALID; @@ -2746,9 +2750,10 @@ static void arcmsr_action(struct cam_sim secs_per_cylinder=ccg->heads * ccg->secs_per_track; ccg->cylinders=ccg->volume_size / secs_per_cylinder; pccb->ccb_h.status |= CAM_REQ_CMP; + } +#endif xpt_done(pccb); break; - } default: pccb->ccb_h.status |= CAM_REQ_INVALID; xpt_done(pccb); Modified: stable/9/sys/dev/hptiop/hptiop.c ============================================================================== --- stable/9/sys/dev/hptiop/hptiop.c Sun Jan 29 01:35:14 2012 (r230718) +++ stable/9/sys/dev/hptiop/hptiop.c Sun Jan 29 01:40:37 2012 (r230719) @@ -1813,11 +1813,15 @@ scsi_done: break; case XPT_CALC_GEOMETRY: +#if __FreeBSD_version >= 500000 + cam_calc_geometry(&ccb->ccg, 1); +#else ccb->ccg.heads = 255; ccb->ccg.secs_per_track = 63; ccb->ccg.cylinders = ccb->ccg.volume_size / (ccb->ccg.heads * ccb->ccg.secs_per_track); ccb->ccb_h.status = CAM_REQ_CMP; +#endif break; case XPT_PATH_INQ: Modified: stable/9/sys/dev/hptmv/entry.c ============================================================================== --- stable/9/sys/dev/hptmv/entry.c Sun Jan 29 01:35:14 2012 (r230718) +++ stable/9/sys/dev/hptmv/entry.c Sun Jan 29 01:40:37 2012 (r230719) @@ -22,9 +22,10 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include @@ -94,7 +95,7 @@ static device_method_t driver_methods[] DEVMETHOD(device_detach, hpt_detach), DEVMETHOD(device_shutdown, hpt_shutdown), - { 0, 0 } + DEVMETHOD_END }; static driver_t hpt_pci_driver = { @@ -2371,7 +2372,10 @@ hpt_action(struct cam_sim *sim, union cc break; case XPT_CALC_GEOMETRY: - { +#if __FreeBSD_version >= 500000 + cam_calc_geometry(&ccb->ccg, 1); +#else + { struct ccb_calc_geometry *ccg; u_int32_t size_mb; u_int32_t secs_per_cylinder; @@ -2389,9 +2393,10 @@ hpt_action(struct cam_sim *sim, union cc secs_per_cylinder = ccg->heads * ccg->secs_per_track; ccg->cylinders = ccg->volume_size / secs_per_cylinder; ccb->ccb_h.status = CAM_REQ_CMP; + } +#endif xpt_done(ccb); break; - } case XPT_PATH_INQ: /* Path routing inquiry */ { Modified: stable/9/sys/dev/hptrr/hptrr_osm_bsd.c ============================================================================== --- stable/9/sys/dev/hptrr/hptrr_osm_bsd.c Sun Jan 29 01:35:14 2012 (r230718) +++ stable/9/sys/dev/hptrr/hptrr_osm_bsd.c Sun Jan 29 01:40:37 2012 (r230719) @@ -22,9 +22,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); + #include /* $Id: osm_bsd.c,v 1.27 2007/11/22 07:35:49 gmm Exp $ * @@ -795,10 +797,14 @@ static void hpt_action(struct cam_sim *s break; case XPT_CALC_GEOMETRY: +#if __FreeBSD_version >= 500000 + cam_calc_geometry(&ccb->ccg, 1); +#else ccb->ccg.heads = 255; ccb->ccg.secs_per_track = 63; ccb->ccg.cylinders = ccb->ccg.volume_size / (ccb->ccg.heads * ccb->ccg.secs_per_track); ccb->ccb_h.status = CAM_REQ_CMP; +#endif break; case XPT_PATH_INQ: @@ -1250,7 +1256,7 @@ static device_method_t driver_methods[] DEVMETHOD(device_attach, hpt_attach), DEVMETHOD(device_detach, hpt_detach), DEVMETHOD(device_shutdown, hpt_shutdown), - { 0, 0 } + DEVMETHOD_END }; static driver_t hpt_pci_driver = { From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 01:40:40 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67B7D1065673; Sun, 29 Jan 2012 01:40:40 +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 513948FC17; Sun, 29 Jan 2012 01:40:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T1eeEO010670; Sun, 29 Jan 2012 01:40:40 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T1eesj010665; Sun, 29 Jan 2012 01:40:40 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201290140.q0T1eesj010665@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 01:40:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230720 - in stable/8/sys/dev: arcmsr hptiop hptmv hptrr X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 01:40:40 -0000 Author: marius Date: Sun Jan 29 01:40:39 2012 New Revision: 230720 URL: http://svn.freebsd.org/changeset/base/230720 Log: MFC: r227912 - Just use cam_calc_geometry(9) on newer version of FreeBSD rather than duplicating it. - In hptmv(4) and hptrr(4) use __FBSDID and DEVMETHOD_END. Modified: stable/8/sys/dev/arcmsr/arcmsr.c stable/8/sys/dev/hptiop/hptiop.c stable/8/sys/dev/hptmv/entry.c stable/8/sys/dev/hptrr/hptrr_osm_bsd.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) Modified: stable/8/sys/dev/arcmsr/arcmsr.c ============================================================================== --- stable/8/sys/dev/arcmsr/arcmsr.c Sun Jan 29 01:40:37 2012 (r230719) +++ stable/8/sys/dev/arcmsr/arcmsr.c Sun Jan 29 01:40:39 2012 (r230720) @@ -2714,16 +2714,20 @@ static void arcmsr_action(struct cam_sim xpt_done(pccb); break; } - case XPT_CALC_GEOMETRY: { - struct ccb_calc_geometry *ccg; - u_int32_t size_mb; - u_int32_t secs_per_cylinder; - + case XPT_CALC_GEOMETRY: if(pccb->ccb_h.target_id == 16) { pccb->ccb_h.status |= CAM_FUNC_NOTAVAIL; xpt_done(pccb); break; } +#if __FreeBSD_version >= 500000 + cam_calc_geometry(&pccb->ccg, 1); +#else + { + struct ccb_calc_geometry *ccg; + u_int32_t size_mb; + u_int32_t secs_per_cylinder; + ccg= &pccb->ccg; if (ccg->block_size == 0) { pccb->ccb_h.status = CAM_REQ_INVALID; @@ -2746,9 +2750,10 @@ static void arcmsr_action(struct cam_sim secs_per_cylinder=ccg->heads * ccg->secs_per_track; ccg->cylinders=ccg->volume_size / secs_per_cylinder; pccb->ccb_h.status |= CAM_REQ_CMP; + } +#endif xpt_done(pccb); break; - } default: pccb->ccb_h.status |= CAM_REQ_INVALID; xpt_done(pccb); Modified: stable/8/sys/dev/hptiop/hptiop.c ============================================================================== --- stable/8/sys/dev/hptiop/hptiop.c Sun Jan 29 01:40:37 2012 (r230719) +++ stable/8/sys/dev/hptiop/hptiop.c Sun Jan 29 01:40:39 2012 (r230720) @@ -1813,11 +1813,15 @@ scsi_done: break; case XPT_CALC_GEOMETRY: +#if __FreeBSD_version >= 500000 + cam_calc_geometry(&ccb->ccg, 1); +#else ccb->ccg.heads = 255; ccb->ccg.secs_per_track = 63; ccb->ccg.cylinders = ccb->ccg.volume_size / (ccb->ccg.heads * ccb->ccg.secs_per_track); ccb->ccb_h.status = CAM_REQ_CMP; +#endif break; case XPT_PATH_INQ: Modified: stable/8/sys/dev/hptmv/entry.c ============================================================================== --- stable/8/sys/dev/hptmv/entry.c Sun Jan 29 01:40:37 2012 (r230719) +++ stable/8/sys/dev/hptmv/entry.c Sun Jan 29 01:40:39 2012 (r230720) @@ -22,9 +22,10 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); #include #include @@ -94,7 +95,7 @@ static device_method_t driver_methods[] DEVMETHOD(device_detach, hpt_detach), DEVMETHOD(device_shutdown, hpt_shutdown), - { 0, 0 } + DEVMETHOD_END }; static driver_t hpt_pci_driver = { @@ -2371,7 +2372,10 @@ hpt_action(struct cam_sim *sim, union cc break; case XPT_CALC_GEOMETRY: - { +#if __FreeBSD_version >= 500000 + cam_calc_geometry(&ccb->ccg, 1); +#else + { struct ccb_calc_geometry *ccg; u_int32_t size_mb; u_int32_t secs_per_cylinder; @@ -2389,9 +2393,10 @@ hpt_action(struct cam_sim *sim, union cc secs_per_cylinder = ccg->heads * ccg->secs_per_track; ccg->cylinders = ccg->volume_size / secs_per_cylinder; ccb->ccb_h.status = CAM_REQ_CMP; + } +#endif xpt_done(ccb); break; - } case XPT_PATH_INQ: /* Path routing inquiry */ { Modified: stable/8/sys/dev/hptrr/hptrr_osm_bsd.c ============================================================================== --- stable/8/sys/dev/hptrr/hptrr_osm_bsd.c Sun Jan 29 01:40:37 2012 (r230719) +++ stable/8/sys/dev/hptrr/hptrr_osm_bsd.c Sun Jan 29 01:40:39 2012 (r230720) @@ -22,9 +22,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ + +#include +__FBSDID("$FreeBSD$"); + #include /* $Id: osm_bsd.c,v 1.27 2007/11/22 07:35:49 gmm Exp $ * @@ -795,10 +797,14 @@ static void hpt_action(struct cam_sim *s break; case XPT_CALC_GEOMETRY: +#if __FreeBSD_version >= 500000 + cam_calc_geometry(&ccb->ccg, 1); +#else ccb->ccg.heads = 255; ccb->ccg.secs_per_track = 63; ccb->ccg.cylinders = ccb->ccg.volume_size / (ccb->ccg.heads * ccb->ccg.secs_per_track); ccb->ccb_h.status = CAM_REQ_CMP; +#endif break; case XPT_PATH_INQ: @@ -1250,7 +1256,7 @@ static device_method_t driver_methods[] DEVMETHOD(device_attach, hpt_attach), DEVMETHOD(device_detach, hpt_detach), DEVMETHOD(device_shutdown, hpt_shutdown), - { 0, 0 } + DEVMETHOD_END }; static driver_t hpt_pci_driver = { From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 04:42:20 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88991106564A; Sun, 29 Jan 2012 04:42:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7573A8FC08; Sun, 29 Jan 2012 04:42:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T4gKjg038081; Sun, 29 Jan 2012 04:42:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T4gKIt038079; Sun, 29 Jan 2012 04:42:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201290442.q0T4gKIt038079@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 29 Jan 2012 04:42:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230723 - stable/9/lib/libc/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 04:42:20 -0000 Author: kib Date: Sun Jan 29 04:42:19 2012 New Revision: 230723 URL: http://svn.freebsd.org/changeset/base/230723 Log: MFC r230460: Clarify the implementation-defined behaviour in case of close(2) returning error. Modified: stable/9/lib/libc/sys/close.2 Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/sys/close.2 ============================================================================== --- stable/9/lib/libc/sys/close.2 Sun Jan 29 02:13:01 2012 (r230722) +++ stable/9/lib/libc/sys/close.2 Sun Jan 29 04:42:19 2012 (r230723) @@ -28,7 +28,7 @@ .\" @(#)close.2 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd December 4, 2006 +.Dd January 22, 2012 .Dt CLOSE 2 .Os .Sh NAME @@ -118,6 +118,10 @@ The underlying object did not fit, cache The underlying object was a stream socket that was shut down by the peer before all pending data was delivered. .El +.Pp +In case of any error except +.Er EBADF , +the supplied file descriptor is deallocated and therefore is no longer valid. .Sh SEE ALSO .Xr accept 2 , .Xr closefrom 2 , From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 04:44:53 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69FAD106564A; Sun, 29 Jan 2012 04:44:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58B168FC15; Sun, 29 Jan 2012 04:44:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T4irdS038968; Sun, 29 Jan 2012 04:44:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T4irn5038966; Sun, 29 Jan 2012 04:44:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201290444.q0T4irn5038966@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 29 Jan 2012 04:44:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230724 - stable/8/lib/libc/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 04:44:53 -0000 Author: kib Date: Sun Jan 29 04:44:52 2012 New Revision: 230724 URL: http://svn.freebsd.org/changeset/base/230724 Log: MFC r230460: Clarify the implementation-defined behaviour in case of close(2) returning error. Modified: stable/8/lib/libc/sys/close.2 Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/sys/close.2 ============================================================================== --- stable/8/lib/libc/sys/close.2 Sun Jan 29 04:42:19 2012 (r230723) +++ stable/8/lib/libc/sys/close.2 Sun Jan 29 04:44:52 2012 (r230724) @@ -28,7 +28,7 @@ .\" @(#)close.2 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd December 4, 2006 +.Dd January 22, 2012 .Dt CLOSE 2 .Os .Sh NAME @@ -118,6 +118,10 @@ The underlying object did not fit, cache The underlying object was a stream socket that was shut down by the peer before all pending data was delivered. .El +.Pp +In case of any error except +.Er EBADF , +the supplied file descriptor is deallocated and therefore is no longer valid. .Sh SEE ALSO .Xr accept 2 , .Xr closefrom 2 , From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 08:03:45 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BED6C106564A; Sun, 29 Jan 2012 08:03:45 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A882C8FC14; Sun, 29 Jan 2012 08:03:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0T83jwv091223; Sun, 29 Jan 2012 08:03:45 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0T83jnM091202; Sun, 29 Jan 2012 08:03:45 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201201290803.q0T83jnM091202@svn.freebsd.org> From: Kirk McKusick Date: Sun, 29 Jan 2012 08:03:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230725 - in stable/9/sys: compat/freebsd32 fs/cd9660 fs/fdescfs fs/hpfs fs/msdosfs fs/nfsclient fs/ntfs fs/nwfs fs/portalfs fs/pseudofs fs/smbfs gnu/fs/reiserfs kern nfsclient sys ufs/ffs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 08:03:45 -0000 Author: mckusick Date: Sun Jan 29 08:03:45 2012 New Revision: 230725 URL: http://svn.freebsd.org/changeset/base/230725 Log: MFC r230249: Make sure all intermediate variables holding mount flags (mnt_flag) and that all internal kernel calls passing mount flags are declared as uint64_t so that flags in the top 32-bits are not lost. MFC r230250: There are several bugs/hangs when trying to take a snapshot on a UFS/FFS filesystem running with journaled soft updates. Until these problems have been tracked down, return ENOTSUPP when an attempt is made to take a snapshot on a filesystem running with journaled soft updates. Modified: stable/9/sys/compat/freebsd32/freebsd32_misc.c stable/9/sys/fs/cd9660/cd9660_vfsops.c stable/9/sys/fs/fdescfs/fdesc_vfsops.c stable/9/sys/fs/hpfs/hpfs_vfsops.c stable/9/sys/fs/msdosfs/msdosfs_vfsops.c stable/9/sys/fs/nfsclient/nfs_clvfsops.c stable/9/sys/fs/ntfs/ntfs_vfsops.c stable/9/sys/fs/nwfs/nwfs_vfsops.c stable/9/sys/fs/portalfs/portal_vfsops.c stable/9/sys/fs/pseudofs/pseudofs.c stable/9/sys/fs/pseudofs/pseudofs.h stable/9/sys/fs/smbfs/smbfs_vfsops.c stable/9/sys/gnu/fs/reiserfs/reiserfs_vfsops.c stable/9/sys/kern/vfs_mount.c stable/9/sys/kern/vfs_subr.c stable/9/sys/nfsclient/nfs_vfsops.c stable/9/sys/sys/mount.h stable/9/sys/ufs/ffs/ffs_snapshot.c stable/9/sys/ufs/ffs/ffs_vfsops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_misc.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/compat/freebsd32/freebsd32_misc.c Sun Jan 29 08:03:45 2012 (r230725) @@ -2465,9 +2465,17 @@ freebsd32_nmount(struct thread *td, } */ *uap) { struct uio *auio; + uint64_t flags; int error; - AUDIT_ARG_FFLAGS(uap->flags); + /* + * Mount flags are now 64-bits. On 32-bit archtectures only + * 32-bits are passed in, but from here on everything handles + * 64-bit flags correctly. + */ + flags = uap->flags; + + AUDIT_ARG_FFLAGS(flags); /* * Filter out MNT_ROOTFS. We do not want clients of nmount() in @@ -2476,7 +2484,7 @@ freebsd32_nmount(struct thread *td, * MNT_ROOTFS should only be set by the kernel when mounting its * root file system. */ - uap->flags &= ~MNT_ROOTFS; + flags &= ~MNT_ROOTFS; /* * check that we have an even number of iovec's @@ -2488,7 +2496,7 @@ freebsd32_nmount(struct thread *td, error = freebsd32_copyinuio(uap->iovp, uap->iovcnt, &auio); if (error) return (error); - error = vfs_donmount(td, uap->flags, auio); + error = vfs_donmount(td, flags, auio); free(auio, M_IOV); return error; Modified: stable/9/sys/fs/cd9660/cd9660_vfsops.c ============================================================================== --- stable/9/sys/fs/cd9660/cd9660_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/cd9660/cd9660_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -95,7 +95,7 @@ static int iso_mountfs(struct vnode *dev */ static int -cd9660_cmount(struct mntarg *ma, void *data, int flags) +cd9660_cmount(struct mntarg *ma, void *data, uint64_t flags) { struct iso_args args; struct export_args exp; Modified: stable/9/sys/fs/fdescfs/fdesc_vfsops.c ============================================================================== --- stable/9/sys/fs/fdescfs/fdesc_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/fdescfs/fdesc_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -65,7 +65,7 @@ static vfs_root_t fdesc_root; * Compatibility shim for old mount(2) system call. */ int -fdesc_cmount(struct mntarg *ma, void *data, int flags) +fdesc_cmount(struct mntarg *ma, void *data, uint64_t flags) { return kernel_mount(ma, flags); } Modified: stable/9/sys/fs/hpfs/hpfs_vfsops.c ============================================================================== --- stable/9/sys/fs/hpfs/hpfs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/hpfs/hpfs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -73,7 +73,7 @@ static int hpfs_cmount ( struct mntarg *ma, void *data, - int flags) + uint64_t flags) { struct hpfs_args args; struct export_args exp; Modified: stable/9/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/msdosfs/msdosfs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -197,7 +197,7 @@ update_mp(struct mount *mp, struct threa } static int -msdosfs_cmount(struct mntarg *ma, void *data, int flags) +msdosfs_cmount(struct mntarg *ma, void *data, uint64_t flags) { struct msdosfs_args args; struct export_args exp; Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/nfsclient/nfs_clvfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -1131,7 +1131,7 @@ out: */ /* ARGSUSED */ static int -nfs_cmount(struct mntarg *ma, void *data, int flags) +nfs_cmount(struct mntarg *ma, void *data, uint64_t flags) { int error; struct nfs_args args; Modified: stable/9/sys/fs/ntfs/ntfs_vfsops.c ============================================================================== --- stable/9/sys/fs/ntfs/ntfs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/ntfs/ntfs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -117,7 +117,7 @@ static int ntfs_cmount ( struct mntarg *ma, void *data, - int flags) + uint64_t flags) { struct ntfs_args args; struct export_args exp; Modified: stable/9/sys/fs/nwfs/nwfs_vfsops.c ============================================================================== --- stable/9/sys/fs/nwfs/nwfs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/nwfs/nwfs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -123,7 +123,7 @@ nwfs_initnls(struct nwmount *nmp) { return 0; } -static int nwfs_cmount(struct mntarg *ma, void *data, int flags) +static int nwfs_cmount(struct mntarg *ma, void *data, uint64_t flags) { struct nwfs_args args; /* will hold data from mount request */ int error; Modified: stable/9/sys/fs/portalfs/portal_vfsops.c ============================================================================== --- stable/9/sys/fs/portalfs/portal_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/portalfs/portal_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -69,7 +69,7 @@ static const char *portal_opts[] = { }; static int -portal_cmount(struct mntarg *ma, void *data, int flags) +portal_cmount(struct mntarg *ma, void *data, uint64_t flags) { struct portal_args args; int error; Modified: stable/9/sys/fs/pseudofs/pseudofs.c ============================================================================== --- stable/9/sys/fs/pseudofs/pseudofs.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/pseudofs/pseudofs.c Sun Jan 29 08:03:45 2012 (r230725) @@ -330,7 +330,7 @@ pfs_mount(struct pfs_info *pi, struct mo * Compatibility shim for old mount(2) system call */ int -pfs_cmount(struct mntarg *ma, void *data, int flags) +pfs_cmount(struct mntarg *ma, void *data, uint64_t flags) { int error; Modified: stable/9/sys/fs/pseudofs/pseudofs.h ============================================================================== --- stable/9/sys/fs/pseudofs/pseudofs.h Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/pseudofs/pseudofs.h Sun Jan 29 08:03:45 2012 (r230725) @@ -242,7 +242,7 @@ struct pfs_node { * VFS interface */ int pfs_mount (struct pfs_info *pi, struct mount *mp); -int pfs_cmount (struct mntarg *ma, void *data, int flags); +int pfs_cmount (struct mntarg *ma, void *data, uint64_t flags); int pfs_unmount (struct mount *mp, int mntflags); int pfs_root (struct mount *mp, int flags, struct vnode **vpp); Modified: stable/9/sys/fs/smbfs/smbfs_vfsops.c ============================================================================== --- stable/9/sys/fs/smbfs/smbfs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/fs/smbfs/smbfs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -98,7 +98,7 @@ MODULE_DEPEND(smbfs, libmchain, 1, 1, 1) int smbfs_pbuf_freecnt = -1; /* start out unlimited */ static int -smbfs_cmount(struct mntarg *ma, void * data, int flags) +smbfs_cmount(struct mntarg *ma, void * data, uint64_t flags) { struct smbfs_args args; int error; Modified: stable/9/sys/gnu/fs/reiserfs/reiserfs_vfsops.c ============================================================================== --- stable/9/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -49,7 +49,7 @@ MALLOC_DEFINE(M_REISERFSNODE, "reiserfs_ * -------------------------------------------------------------------*/ static int -reiserfs_cmount(struct mntarg *ma, void *data, int flags) +reiserfs_cmount(struct mntarg *ma, void *data, uint64_t flags) { struct reiserfs_args args; struct export_args exp; Modified: stable/9/sys/kern/vfs_mount.c ============================================================================== --- stable/9/sys/kern/vfs_mount.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/kern/vfs_mount.c Sun Jan 29 08:03:45 2012 (r230725) @@ -70,8 +70,8 @@ __FBSDID("$FreeBSD$"); #define VFS_MOUNTARG_SIZE_MAX (1024 * 64) -static int vfs_domount(struct thread *td, const char *fstype, - char *fspath, int fsflags, struct vfsoptlist **optlist); +static int vfs_domount(struct thread *td, const char *fstype, char *fspath, + uint64_t fsflags, struct vfsoptlist **optlist); static void free_mntarg(struct mntarg *ma); static int usermount = 0; @@ -376,10 +376,18 @@ sys_nmount(td, uap) struct uio *auio; int error; u_int iovcnt; + uint64_t flags; - AUDIT_ARG_FFLAGS(uap->flags); + /* + * Mount flags are now 64-bits. On 32-bit archtectures only + * 32-bits are passed in, but from here on everything handles + * 64-bit flags correctly. + */ + flags = uap->flags; + + AUDIT_ARG_FFLAGS(flags); CTR4(KTR_VFS, "%s: iovp %p with iovcnt %d and flags %d", __func__, - uap->iovp, uap->iovcnt, uap->flags); + uap->iovp, uap->iovcnt, flags); /* * Filter out MNT_ROOTFS. We do not want clients of nmount() in @@ -388,7 +396,7 @@ sys_nmount(td, uap) * MNT_ROOTFS should only be set by the kernel when mounting its * root file system. */ - uap->flags &= ~MNT_ROOTFS; + flags &= ~MNT_ROOTFS; iovcnt = uap->iovcnt; /* @@ -407,7 +415,7 @@ sys_nmount(td, uap) __func__, error); return (error); } - error = vfs_donmount(td, uap->flags, auio); + error = vfs_donmount(td, flags, auio); free(auio, M_IOV); return (error); @@ -518,7 +526,7 @@ vfs_mount_destroy(struct mount *mp) } int -vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions) +vfs_donmount(struct thread *td, uint64_t fsflags, struct uio *fsoptions) { struct vfsoptlist *optlist; struct vfsopt *opt, *tmp_opt; @@ -694,9 +702,17 @@ sys_mount(td, uap) char *fstype; struct vfsconf *vfsp = NULL; struct mntarg *ma = NULL; + uint64_t flags; int error; - AUDIT_ARG_FFLAGS(uap->flags); + /* + * Mount flags are now 64-bits. On 32-bit archtectures only + * 32-bits are passed in, but from here on everything handles + * 64-bit flags correctly. + */ + flags = uap->flags; + + AUDIT_ARG_FFLAGS(flags); /* * Filter out MNT_ROOTFS. We do not want clients of mount() in @@ -705,7 +721,7 @@ sys_mount(td, uap) * MNT_ROOTFS should only be set by the kernel when mounting its * root file system. */ - uap->flags &= ~MNT_ROOTFS; + flags &= ~MNT_ROOTFS; fstype = malloc(MFSNAMELEN, M_TEMP, M_WAITOK); error = copyinstr(uap->type, fstype, MFSNAMELEN, NULL); @@ -729,11 +745,11 @@ sys_mount(td, uap) ma = mount_argsu(ma, "fstype", uap->type, MNAMELEN); ma = mount_argsu(ma, "fspath", uap->path, MNAMELEN); - ma = mount_argb(ma, uap->flags & MNT_RDONLY, "noro"); - ma = mount_argb(ma, !(uap->flags & MNT_NOSUID), "nosuid"); - ma = mount_argb(ma, !(uap->flags & MNT_NOEXEC), "noexec"); + ma = mount_argb(ma, flags & MNT_RDONLY, "noro"); + ma = mount_argb(ma, !(flags & MNT_NOSUID), "nosuid"); + ma = mount_argb(ma, !(flags & MNT_NOEXEC), "noexec"); - error = vfsp->vfc_vfsops->vfs_cmount(ma, uap->data, uap->flags); + error = vfsp->vfc_vfsops->vfs_cmount(ma, uap->data, flags); mtx_unlock(&Giant); return (error); } @@ -747,7 +763,7 @@ vfs_domount_first( struct vfsconf *vfsp, /* File system type. */ char *fspath, /* Mount path. */ struct vnode *vp, /* Vnode to be covered. */ - int fsflags, /* Flags common to all filesystems. */ + uint64_t fsflags, /* Flags common to all filesystems. */ struct vfsoptlist **optlist /* Options local to the filesystem. */ ) { @@ -856,14 +872,15 @@ static int vfs_domount_update( struct thread *td, /* Calling thread. */ struct vnode *vp, /* Mount point vnode. */ - int fsflags, /* Flags common to all filesystems. */ + uint64_t fsflags, /* Flags common to all filesystems. */ struct vfsoptlist **optlist /* Options local to the filesystem. */ ) { struct oexport_args oexport; struct export_args export; struct mount *mp; - int error, export_error, flag; + int error, export_error; + uint64_t flag; mtx_assert(&Giant, MA_OWNED); ASSERT_VOP_ELOCKED(vp, __func__); @@ -1000,7 +1017,7 @@ vfs_domount( struct thread *td, /* Calling thread. */ const char *fstype, /* Filesystem type. */ char *fspath, /* Mount path. */ - int fsflags, /* Flags common to all filesystems. */ + uint64_t fsflags, /* Flags common to all filesystems. */ struct vfsoptlist **optlist /* Options local to the filesystem. */ ) { @@ -1182,7 +1199,7 @@ dounmount(mp, flags, td) { struct vnode *coveredvp, *fsrootvp; int error; - int async_flag; + uint64_t async_flag; int mnt_gen_r; mtx_assert(&Giant, MA_OWNED); @@ -1891,7 +1908,7 @@ free_mntarg(struct mntarg *ma) * Mount a filesystem */ int -kernel_mount(struct mntarg *ma, int flags) +kernel_mount(struct mntarg *ma, uint64_t flags) { struct uio auio; int error; Modified: stable/9/sys/kern/vfs_subr.c ============================================================================== --- stable/9/sys/kern/vfs_subr.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/kern/vfs_subr.c Sun Jan 29 08:03:45 2012 (r230725) @@ -2836,6 +2836,7 @@ DB_SHOW_COMMAND(mount, db_show_mount) struct statfs *sp; struct vnode *vp; char buf[512]; + uint64_t mflags; u_int flags; if (!have_addr) { @@ -2857,13 +2858,13 @@ DB_SHOW_COMMAND(mount, db_show_mount) mp->mnt_stat.f_mntonname, mp->mnt_stat.f_fstypename); buf[0] = '\0'; - flags = mp->mnt_flag; + mflags = mp->mnt_flag; #define MNT_FLAG(flag) do { \ - if (flags & (flag)) { \ + if (mflags & (flag)) { \ if (buf[0] != '\0') \ strlcat(buf, ", ", sizeof(buf)); \ strlcat(buf, (#flag) + 4, sizeof(buf)); \ - flags &= ~(flag); \ + mflags &= ~(flag); \ } \ } while (0) MNT_FLAG(MNT_RDONLY); @@ -2901,11 +2902,11 @@ DB_SHOW_COMMAND(mount, db_show_mount) MNT_FLAG(MNT_SNAPSHOT); MNT_FLAG(MNT_BYFSID); #undef MNT_FLAG - if (flags != 0) { + if (mflags != 0) { if (buf[0] != '\0') strlcat(buf, ", ", sizeof(buf)); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "0x%08x", flags); + "0x%016jx", mflags); } db_printf(" mnt_flag = %s\n", buf); Modified: stable/9/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/9/sys/nfsclient/nfs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/nfsclient/nfs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -1187,7 +1187,7 @@ out: */ /* ARGSUSED */ static int -nfs_cmount(struct mntarg *ma, void *data, int flags) +nfs_cmount(struct mntarg *ma, void *data, uint64_t flags) { int error; struct nfs_args args; Modified: stable/9/sys/sys/mount.h ============================================================================== --- stable/9/sys/sys/mount.h Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/sys/mount.h Sun Jan 29 08:03:45 2012 (r230725) @@ -557,7 +557,7 @@ struct nameidata; struct sysctl_req; struct mntarg; -typedef int vfs_cmount_t(struct mntarg *ma, void *data, int flags); +typedef int vfs_cmount_t(struct mntarg *ma, void *data, uint64_t flags); typedef int vfs_unmount_t(struct mount *mp, int mntflags); typedef int vfs_root_t(struct mount *mp, int flags, struct vnode **vpp); typedef int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid, void *arg); @@ -700,7 +700,7 @@ extern char *mountrootfsname; int dounmount(struct mount *, int, struct thread *); -int kernel_mount(struct mntarg *ma, int flags); +int kernel_mount(struct mntarg *ma, uint64_t flags); int kernel_vmount(int flags, ...); struct mntarg *mount_arg(struct mntarg *ma, const char *name, const void *val, int len); struct mntarg *mount_argb(struct mntarg *ma, int flag, const char *name); @@ -737,7 +737,8 @@ int vfs_export /* process mount expor (struct mount *, struct export_args *); void vfs_allocate_syncvnode(struct mount *); void vfs_deallocate_syncvnode(struct mount *); -int vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions); +int vfs_donmount(struct thread *td, uint64_t fsflags, + struct uio *fsoptions); void vfs_getnewfsid(struct mount *); struct cdev *vfs_getrootfsid(struct mount *); struct mount *vfs_getvfs(fsid_t *); /* return vfs given fsid */ Modified: stable/9/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_snapshot.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/ufs/ffs/ffs_snapshot.c Sun Jan 29 08:03:45 2012 (r230725) @@ -225,10 +225,18 @@ ffs_snapshot(mp, snapfile) ump = VFSTOUFS(mp); fs = ump->um_fs; sn = NULL; + /* + * At the moment, journaled soft updates cannot support + * taking snapshots. + */ + if (MOUNTEDSUJ(mp)) { + vfs_mount_error(mp, "%s: Snapshots are not yet supported when " + "running with journaled soft updates", fs->fs_fsmnt); + return (EOPNOTSUPP); + } MNT_ILOCK(mp); flag = mp->mnt_flag; MNT_IUNLOCK(mp); - /* * Need to serialize access to snapshot code per filesystem. */ Modified: stable/9/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_vfsops.c Sun Jan 29 04:44:52 2012 (r230724) +++ stable/9/sys/ufs/ffs/ffs_vfsops.c Sun Jan 29 08:03:45 2012 (r230725) @@ -144,7 +144,7 @@ ffs_mount(struct mount *mp) struct fs *fs; pid_t fsckpid = 0; int error, flags; - u_int mntorflags; + uint64_t mntorflags; accmode_t accmode; struct nameidata ndp; char *fspec; @@ -564,7 +564,7 @@ ffs_mount(struct mount *mp) */ static int -ffs_cmount(struct mntarg *ma, void *data, int flags) +ffs_cmount(struct mntarg *ma, void *data, uint64_t flags) { struct ufs_args args; struct export_args exp; From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 10:55:20 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37BFA1065670; Sun, 29 Jan 2012 10:55:20 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B9698FC0A; Sun, 29 Jan 2012 10:55:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TAtJ3N031537; Sun, 29 Jan 2012 10:55:19 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TAtJTl031536; Sun, 29 Jan 2012 10:55:19 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201201291055.q0TAtJTl031536@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sun, 29 Jan 2012 10:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230728 - stable/9/sbin/dhclient X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 10:55:20 -0000 Author: dumbbell Date: Sun Jan 29 10:55:19 2012 New Revision: 230728 URL: http://svn.freebsd.org/changeset/base/230728 Log: MFC r229002: Set svn:executable on dhclient-script Sponsored by: Yakaz (http://www.yakaz.com) Modified: Directory Properties: stable/9/sbin/dhclient/ (props changed) stable/9/sbin/dhclient/dhclient-script (props changed) From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 11:00:01 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE6A11065670; Sun, 29 Jan 2012 11:00:00 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B69728FC08; Sun, 29 Jan 2012 11:00:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TB007g031727; Sun, 29 Jan 2012 11:00:00 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TB00rn031725; Sun, 29 Jan 2012 11:00:00 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201201291100.q0TB00rn031725@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sun, 29 Jan 2012 11:00: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: r230729 - stable/8/sbin/dhclient X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 11:00:01 -0000 Author: dumbbell Date: Sun Jan 29 11:00:00 2012 New Revision: 230729 URL: http://svn.freebsd.org/changeset/base/230729 Log: MFC r229002: Set svn:executable on dhclient-script Sponsored by: Yakaz (http://www.yakaz.com) Modified: Directory Properties: stable/8/sbin/dhclient/ (props changed) stable/8/sbin/dhclient/dhclient-script (props changed) From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 12:25:22 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4404A106566B; Sun, 29 Jan 2012 12:25:22 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 168B68FC12; Sun, 29 Jan 2012 12:25:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TCPLXR034702; Sun, 29 Jan 2012 12:25:21 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TCPLeI034700; Sun, 29 Jan 2012 12:25:21 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201291225.q0TCPLeI034700@svn.freebsd.org> From: Martin Matuska Date: Sun, 29 Jan 2012 12:25:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230730 - stable/9/cddl/contrib/opensolaris/cmd/zfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 12:25:22 -0000 Author: mm Date: Sun Jan 29 12:25:21 2012 New Revision: 230730 URL: http://svn.freebsd.org/changeset/base/230730 Log: MFC r230449: Merge illumos revisions 13540, 13562: illumos rev 13540 [1]: Removal of pyzfs broke delegation for volumes illumos rev 13562 [2]: zfs allow arguments not parsed correctly after pyzfs removal References: https://www.illumos.org/issues/1726 [1] https://www.illumos.org/issues/1977 [2] Obtained from: illumos (issues #1726, #1977) Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Jan 29 11:00:00 2012 (r230729) +++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Jan 29 12:25:21 2012 (r230730) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright 2012 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek . * All rights reserved. @@ -4489,7 +4489,7 @@ parse_allow_args(int argc, char **argv, argc--; argv++; opts->dataset = munge_args(argc, argv, un, 2, &opts->perms); - } else if (argc == 1) { + } else if (argc == 1 && !un) { opts->prt_perms = B_TRUE; opts->dataset = argv[argc-1]; } else { @@ -4976,9 +4976,9 @@ zfs_do_allow_unallow_impl(int argc, char parse_allow_args(argc, argv, un, &opts); /* try to open the dataset */ - if ((zhp = zfs_open(g_zfs, opts.dataset, ZFS_TYPE_FILESYSTEM)) - == NULL) { - (void) fprintf(stderr, "Failed to open Dataset *%s*\n", + if ((zhp = zfs_open(g_zfs, opts.dataset, ZFS_TYPE_FILESYSTEM | + ZFS_TYPE_VOLUME)) == NULL) { + (void) fprintf(stderr, "Failed to open dataset: %s\n", opts.dataset); return (-1); } @@ -4988,7 +4988,7 @@ zfs_do_allow_unallow_impl(int argc, char fs_perm_set_init(&fs_perm_set); if (parse_fs_perm_set(&fs_perm_set, perm_nvl) != 0) { - (void) fprintf(stderr, "Failed to parse fsacl permissionsn"); + (void) fprintf(stderr, "Failed to parse fsacl permissions\n"); goto cleanup1; } From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 12:26:10 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3BAE10656FB; Sun, 29 Jan 2012 12:26:09 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C775A8FC1C; Sun, 29 Jan 2012 12:26:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TCQ9LX034764; Sun, 29 Jan 2012 12:26:09 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TCQ9Ue034762; Sun, 29 Jan 2012 12:26:09 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201291226.q0TCQ9Ue034762@svn.freebsd.org> From: Martin Matuska Date: Sun, 29 Jan 2012 12:26:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230731 - stable/8/cddl/contrib/opensolaris/cmd/zfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 12:26:10 -0000 Author: mm Date: Sun Jan 29 12:26:09 2012 New Revision: 230731 URL: http://svn.freebsd.org/changeset/base/230731 Log: MFC r230449: Merge illumos revisions 13540, 13562: illumos rev 13540 [1]: Removal of pyzfs broke delegation for volumes illumos rev 13562 [2]: zfs allow arguments not parsed correctly after pyzfs removal References: https://www.illumos.org/issues/1726 [1] https://www.illumos.org/issues/1977 [2] Obtained from: illumos (issues #1726, #1977) Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Jan 29 12:25:21 2012 (r230730) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Jan 29 12:26:09 2012 (r230731) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright 2012 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek . * All rights reserved. @@ -4489,7 +4489,7 @@ parse_allow_args(int argc, char **argv, argc--; argv++; opts->dataset = munge_args(argc, argv, un, 2, &opts->perms); - } else if (argc == 1) { + } else if (argc == 1 && !un) { opts->prt_perms = B_TRUE; opts->dataset = argv[argc-1]; } else { @@ -4976,9 +4976,9 @@ zfs_do_allow_unallow_impl(int argc, char parse_allow_args(argc, argv, un, &opts); /* try to open the dataset */ - if ((zhp = zfs_open(g_zfs, opts.dataset, ZFS_TYPE_FILESYSTEM)) - == NULL) { - (void) fprintf(stderr, "Failed to open Dataset *%s*\n", + if ((zhp = zfs_open(g_zfs, opts.dataset, ZFS_TYPE_FILESYSTEM | + ZFS_TYPE_VOLUME)) == NULL) { + (void) fprintf(stderr, "Failed to open dataset: %s\n", opts.dataset); return (-1); } @@ -4988,7 +4988,7 @@ zfs_do_allow_unallow_impl(int argc, char fs_perm_set_init(&fs_perm_set); if (parse_fs_perm_set(&fs_perm_set, perm_nvl) != 0) { - (void) fprintf(stderr, "Failed to parse fsacl permissionsn"); + (void) fprintf(stderr, "Failed to parse fsacl permissions\n"); goto cleanup1; } From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 12:49:43 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B21C106566B; Sun, 29 Jan 2012 12:49:43 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 594F78FC0A; Sun, 29 Jan 2012 12:49:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TCnhfF035549; Sun, 29 Jan 2012 12:49:43 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TCnhCh035547; Sun, 29 Jan 2012 12:49:43 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291249.q0TCnhCh035547@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 12:49: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: r230732 - stable/8/sys/mips/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 12:49:43 -0000 Author: marius Date: Sun Jan 29 12:49:43 2012 New Revision: 230732 URL: http://svn.freebsd.org/changeset/base/230732 Log: MFC: r228005 Change another instance of amd(4) to esp(4) missed in r227006 (MFC'ed to stable/8 in r227306). Submitted by: Garrett Cooper Modified: stable/8/sys/mips/conf/OCTEON1 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) Modified: stable/8/sys/mips/conf/OCTEON1 ============================================================================== --- stable/8/sys/mips/conf/OCTEON1 Sun Jan 29 12:26:09 2012 (r230731) +++ stable/8/sys/mips/conf/OCTEON1 Sun Jan 29 12:49:43 2012 (r230732) @@ -117,7 +117,7 @@ options AHC_REG_PRETTY_PRINT # Print re device ahd # AHA39320/29320 and onboard AIC79xx devices options AHD_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~215k to driver. -device amd # AMD 53C974 (Tekram DC-390(T)) +device esp # AMD Am53C974 (Tekram DC-390(T)) device hptiop # Highpoint RocketRaid 3xxx series device isp # Qlogic family #device ispfw # Firmware for QLogic HBAs- normally a module From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 12:50:43 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB6201065670; Sun, 29 Jan 2012 12:50:43 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9E568FC1F; Sun, 29 Jan 2012 12:50:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TCohYj035627; Sun, 29 Jan 2012 12:50:43 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TCohYl035625; Sun, 29 Jan 2012 12:50:43 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291250.q0TCohYl035625@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 12:50:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230733 - stable/9/sys/mips/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 12:50:44 -0000 Author: marius Date: Sun Jan 29 12:50:43 2012 New Revision: 230733 URL: http://svn.freebsd.org/changeset/base/230733 Log: MFC: r228005 Change another instance of amd(4) to esp(4) missed in r227006 (MFC'ed to stable/9 in r227305). Submitted by: Garrett Cooper Modified: stable/9/sys/mips/conf/OCTEON1 Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/mips/conf/OCTEON1 ============================================================================== --- stable/9/sys/mips/conf/OCTEON1 Sun Jan 29 12:49:43 2012 (r230732) +++ stable/9/sys/mips/conf/OCTEON1 Sun Jan 29 12:50:43 2012 (r230733) @@ -114,7 +114,7 @@ options AHC_REG_PRETTY_PRINT # Print re device ahd # AHA39320/29320 and onboard AIC79xx devices options AHD_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~215k to driver. -device amd # AMD 53C974 (Tekram DC-390(T)) +device esp # AMD Am53C974 (Tekram DC-390(T)) device hptiop # Highpoint RocketRaid 3xxx series device isp # Qlogic family #device ispfw # Firmware for QLogic HBAs- normally a module From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 12:52:34 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1F15106566C; Sun, 29 Jan 2012 12:52:34 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75CCA8FC14; Sun, 29 Jan 2012 12:52:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TCqYpD035754; Sun, 29 Jan 2012 12:52:34 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TCqYlR035752; Sun, 29 Jan 2012 12:52:34 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291252.q0TCqYlR035752@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 12:52:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230734 - stable/9/sys/sparc64/sparc64 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 12:52:34 -0000 Author: marius Date: Sun Jan 29 12:52:34 2012 New Revision: 230734 URL: http://svn.freebsd.org/changeset/base/230734 Log: MFC: r228024 Update comment. Modified: stable/9/sys/sparc64/sparc64/ata_machdep.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/sparc64/sparc64/ata_machdep.c ============================================================================== --- stable/9/sys/sparc64/sparc64/ata_machdep.c Sun Jan 29 12:50:43 2012 (r230733) +++ stable/9/sys/sparc64/sparc64/ata_machdep.c Sun Jan 29 12:52:34 2012 (r230734) @@ -36,14 +36,13 @@ sparc64_ata_disk_firmware_geom_adjust(st { /* - * The Sun disk label only uses 16-bit fields for cylinders, - * heads and sectors so the geometry of large IDE disks has - * to be adjusted. If the disk is > 32GB at 16 heads and 63 - * sectors, the sectors have to be adjusted to 255. If the - * the disk is even > 128GB, additionally adjust the heads - * to 255. - * XXX the OpenSolaris dad(7D) driver limits the mediasize - * to 128GB. + * The VTOC8 disk label only uses 16-bit fields for cylinders, heads + * and sectors so the geometry of large disks has to be adjusted. + * If the disk is > 32GB at 16 heads and 63 sectors, adjust to 255 + * sectors (this matches what the OpenSolaris dad(7D) driver does). + * If the the disk is even > 128GB, additionally adjust the heads to + * 255. This allows disks up to the 2TB limit of the extended VTOC8. + * XXX the OpenSolaris dad(7D) driver limits the mediasize to 128GB. */ if (disk->d_mediasize > (off_t)65535 * 16 * 63 * disk->d_sectorsize) disk->d_fwsectors = 255; From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 12:52:36 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 976911065674; Sun, 29 Jan 2012 12:52:36 +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 816998FC17; Sun, 29 Jan 2012 12:52:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TCqa3m035785; Sun, 29 Jan 2012 12:52:36 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TCqa9f035783; Sun, 29 Jan 2012 12:52:36 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291252.q0TCqa9f035783@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 12:52:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230735 - stable/8/sys/sparc64/sparc64 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 12:52:36 -0000 Author: marius Date: Sun Jan 29 12:52:36 2012 New Revision: 230735 URL: http://svn.freebsd.org/changeset/base/230735 Log: MFC: r228024 Update comment. Modified: stable/8/sys/sparc64/sparc64/ata_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) Modified: stable/8/sys/sparc64/sparc64/ata_machdep.c ============================================================================== --- stable/8/sys/sparc64/sparc64/ata_machdep.c Sun Jan 29 12:52:34 2012 (r230734) +++ stable/8/sys/sparc64/sparc64/ata_machdep.c Sun Jan 29 12:52:36 2012 (r230735) @@ -36,14 +36,13 @@ sparc64_ata_disk_firmware_geom_adjust(st { /* - * The Sun disk label only uses 16-bit fields for cylinders, - * heads and sectors so the geometry of large IDE disks has - * to be adjusted. If the disk is > 32GB at 16 heads and 63 - * sectors, the sectors have to be adjusted to 255. If the - * the disk is even > 128GB, additionally adjust the heads - * to 255. - * XXX the OpenSolaris dad(7D) driver limits the mediasize - * to 128GB. + * The VTOC8 disk label only uses 16-bit fields for cylinders, heads + * and sectors so the geometry of large disks has to be adjusted. + * If the disk is > 32GB at 16 heads and 63 sectors, adjust to 255 + * sectors (this matches what the OpenSolaris dad(7D) driver does). + * If the the disk is even > 128GB, additionally adjust the heads to + * 255. This allows disks up to the 2TB limit of the extended VTOC8. + * XXX the OpenSolaris dad(7D) driver limits the mediasize to 128GB. */ if (disk->d_mediasize > (off_t)65535 * 16 * 63 * disk->d_sectorsize) disk->d_fwsectors = 255; From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 12:54:31 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83162106566C; Sun, 29 Jan 2012 12:54: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 671DA8FC0A; Sun, 29 Jan 2012 12:54:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TCsV4q035909; Sun, 29 Jan 2012 12:54:31 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TCsVAg035905; Sun, 29 Jan 2012 12:54:31 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291254.q0TCsVAg035905@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 12:54:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230736 - in stable/9/sys: cam pc98/include pc98/pc98 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 12:54:31 -0000 Author: marius Date: Sun Jan 29 12:54:31 2012 New Revision: 230736 URL: http://svn.freebsd.org/changeset/base/230736 Log: MFC: r228027 Move the scsi_da_bios_params() prototype from pc98_machdep.h to md_var.h where the prototype for pc98_ata_disk_firmware_geom_adjust() also lives in order to avoid an #ifdef'ed include in cam(4). Modified: stable/9/sys/cam/cam_xpt.c stable/9/sys/pc98/include/md_var.h stable/9/sys/pc98/pc98/pc98_machdep.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Sun Jan 29 12:52:36 2012 (r230735) +++ stable/9/sys/cam/cam_xpt.c Sun Jan 29 12:54:31 2012 (r230736) @@ -48,10 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef PC98 -#include /* geometry translation */ -#endif - #include #include #include Modified: stable/9/sys/pc98/include/md_var.h ============================================================================== --- stable/9/sys/pc98/include/md_var.h Sun Jan 29 12:52:36 2012 (r230735) +++ stable/9/sys/pc98/include/md_var.h Sun Jan 29 12:54:31 2012 (r230736) @@ -39,10 +39,10 @@ extern int need_pre_dma_flush; extern int need_post_dma_flush; /* - * The ad driver maps the IDE disk's actual geometry to the firmware's - * notion of geometry. However, PC98 machines need to do something - * different sometimes, so override the hook so we can do so. + * The geometry of disks might need adjustment on PC98 machines. */ +struct ccb_calc_geometry; +int scsi_da_bios_params(struct ccb_calc_geometry *); struct disk; void pc98_ata_disk_firmware_geom_adjust(struct disk *); #define ata_disk_firmware_geom_adjust(disk) \ Modified: stable/9/sys/pc98/pc98/pc98_machdep.h ============================================================================== --- stable/9/sys/pc98/pc98/pc98_machdep.h Sun Jan 29 12:52:36 2012 (r230735) +++ stable/9/sys/pc98/pc98/pc98_machdep.h Sun Jan 29 12:54:31 2012 (r230736) @@ -33,9 +33,6 @@ void pc98_init_dmac(void); unsigned int pc98_getmemsize(unsigned *, unsigned *); -struct ccb_calc_geometry; -int scsi_da_bios_params(struct ccb_calc_geometry *); - #define PC98_VECTOR_SIZE (0x400) #define PC98_SYSTEM_PARAMETER_SIZE (0x240) #define PC98_SAVE_AREA (0xa1000) From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 12:54:43 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64D9B1065757; Sun, 29 Jan 2012 12:54:37 +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 034188FC0C; Sun, 29 Jan 2012 12:54:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TCsadG035948; Sun, 29 Jan 2012 12:54:36 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TCsa3P035944; Sun, 29 Jan 2012 12:54:36 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291254.q0TCsa3P035944@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 12:54:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230737 - in stable/8/sys: cam pc98/include pc98/pc98 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 12:54:43 -0000 Author: marius Date: Sun Jan 29 12:54:36 2012 New Revision: 230737 URL: http://svn.freebsd.org/changeset/base/230737 Log: MFC: r228027 Move the scsi_da_bios_params() prototype from pc98_machdep.h to md_var.h where the prototype for pc98_ata_disk_firmware_geom_adjust() also lives in order to avoid an #ifdef'ed include in cam(4). Modified: stable/8/sys/cam/cam_xpt.c stable/8/sys/pc98/include/md_var.h stable/8/sys/pc98/pc98/pc98_machdep.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) Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Sun Jan 29 12:54:31 2012 (r230736) +++ stable/8/sys/cam/cam_xpt.c Sun Jan 29 12:54:36 2012 (r230737) @@ -49,10 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef PC98 -#include /* geometry translation */ -#endif - #include #include #include Modified: stable/8/sys/pc98/include/md_var.h ============================================================================== --- stable/8/sys/pc98/include/md_var.h Sun Jan 29 12:54:31 2012 (r230736) +++ stable/8/sys/pc98/include/md_var.h Sun Jan 29 12:54:36 2012 (r230737) @@ -39,10 +39,10 @@ extern int need_pre_dma_flush; extern int need_post_dma_flush; /* - * The ad driver maps the IDE disk's actual geometry to the firmware's - * notion of geometry. However, PC98 machines need to do something - * different sometimes, so override the hook so we can do so. + * The geometry of disks might need adjustment on PC98 machines. */ +struct ccb_calc_geometry; +int scsi_da_bios_params(struct ccb_calc_geometry *); struct disk; void pc98_ata_disk_firmware_geom_adjust(struct disk *); #define ata_disk_firmware_geom_adjust(disk) \ Modified: stable/8/sys/pc98/pc98/pc98_machdep.h ============================================================================== --- stable/8/sys/pc98/pc98/pc98_machdep.h Sun Jan 29 12:54:31 2012 (r230736) +++ stable/8/sys/pc98/pc98/pc98_machdep.h Sun Jan 29 12:54:36 2012 (r230737) @@ -33,9 +33,6 @@ void pc98_init_dmac(void); unsigned int pc98_getmemsize(unsigned *, unsigned *); -struct ccb_calc_geometry; -int scsi_da_bios_params(struct ccb_calc_geometry *); - #define PC98_VECTOR_SIZE (0x400) #define PC98_SYSTEM_PARAMETER_SIZE (0x240) #define PC98_SAVE_AREA (0xa1000) From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 12:56:18 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3B0E106567B; Sun, 29 Jan 2012 12:56:18 +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 B75008FC08; Sun, 29 Jan 2012 12:56:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TCuIvQ036078; Sun, 29 Jan 2012 12:56:18 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TCuIOb036076; Sun, 29 Jan 2012 12:56:18 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291256.q0TCuIOb036076@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 12:56:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230738 - stable/9/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 12:56:19 -0000 Author: marius Date: Sun Jan 29 12:56:18 2012 New Revision: 230738 URL: http://svn.freebsd.org/changeset/base/230738 Log: MFC: r228209 - In device_probe_child(9) check the return value of device_set_driver(9) when actually setting a driver as especially ENOMEM is fatal in these cases. - Annotate other calls to device_set_devclass(9) and device_set_driver(9) without the return value being checked and that are okay to fail. Reviewed by: yongari (slightly earlier version) Modified: stable/9/sys/kern/subr_bus.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/kern/subr_bus.c ============================================================================== --- stable/9/sys/kern/subr_bus.c Sun Jan 29 12:54:36 2012 (r230737) +++ stable/9/sys/kern/subr_bus.c Sun Jan 29 12:56:18 2012 (r230738) @@ -1129,7 +1129,7 @@ devclass_driver_deleted(devclass_t buscl dev->parent->devclass == busclass) { if ((error = device_detach(dev)) != 0) return (error); - device_set_driver(dev, NULL); + (void)device_set_driver(dev, NULL); BUS_PROBE_NOMATCH(dev->parent, dev); devnomatch(dev); dev->flags |= DF_DONENOMATCH; @@ -2007,19 +2007,22 @@ device_probe_child(device_t dev, device_ for (dl = first_matching_driver(dc, child); dl; dl = next_matching_driver(dc, child, dl)) { - /* If this driver's pass is too high, then ignore it. */ if (dl->pass > bus_current_pass) continue; PDEBUG(("Trying %s", DRIVERNAME(dl->driver))); - device_set_driver(child, dl->driver); + result = device_set_driver(child, dl->driver); + if (result == ENOMEM) + return (result); + else if (result != 0) + continue; if (!hasclass) { if (device_set_devclass(child, dl->driver->name)) { printf("driver bug: Unable to set devclass (devname: %s)\n", (child ? device_get_name(child) : "no device")); - device_set_driver(child, NULL); + (void)device_set_driver(child, NULL); continue; } } @@ -2033,7 +2036,7 @@ device_probe_child(device_t dev, device_ /* Reset flags and devclass before the next probe. */ child->devflags = 0; if (!hasclass) - device_set_devclass(child, NULL); + (void)device_set_devclass(child, NULL); /* * If the driver returns SUCCESS, there can be @@ -2050,7 +2053,7 @@ device_probe_child(device_t dev, device_ * certainly doesn't match. */ if (result > 0) { - device_set_driver(child, NULL); + (void)device_set_driver(child, NULL); continue; } @@ -2113,7 +2116,9 @@ device_probe_child(device_t dev, device_ if (result != 0) return (result); } - device_set_driver(child, best->driver); + result = device_set_driver(child, best->driver); + if (result != 0) + return (result); resource_int_value(best->driver->name, child->unit, "flags", &child->devflags); @@ -2722,8 +2727,8 @@ device_attach(device_t dev) dev->driver->name, dev->unit, error); /* Unset the class; set in device_probe_child */ if (dev->devclass == NULL) - device_set_devclass(dev, NULL); - device_set_driver(dev, NULL); + (void)device_set_devclass(dev, NULL); + (void)device_set_driver(dev, NULL); device_sysctl_fini(dev); dev->state = DS_NOTPRESENT; return (error); @@ -2776,7 +2781,7 @@ device_detach(device_t dev) devclass_delete_device(dev->devclass, dev); dev->state = DS_NOTPRESENT; - device_set_driver(dev, NULL); + (void)device_set_driver(dev, NULL); device_set_desc(dev, NULL); device_sysctl_fini(dev); @@ -4613,7 +4618,6 @@ print_driver(driver_t *driver, int inden print_driver_short(driver, indent); } - static void print_driver_list(driver_list_t drivers, int indent) { From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 12:56:21 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70DB11065676; Sun, 29 Jan 2012 12:56:21 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 549758FC18; Sun, 29 Jan 2012 12:56:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TCuL0Y036112; Sun, 29 Jan 2012 12:56:21 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TCuLL6036110; Sun, 29 Jan 2012 12:56:21 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291256.q0TCuLL6036110@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 12:56:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230739 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 12:56:21 -0000 Author: marius Date: Sun Jan 29 12:56:21 2012 New Revision: 230739 URL: http://svn.freebsd.org/changeset/base/230739 Log: MFC: r228209 - In device_probe_child(9) check the return value of device_set_driver(9) when actually setting a driver as especially ENOMEM is fatal in these cases. - Annotate other calls to device_set_devclass(9) and device_set_driver(9) without the return value being checked and that are okay to fail. Reviewed by: yongari (slightly earlier version) Modified: stable/8/sys/kern/subr_bus.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) Modified: stable/8/sys/kern/subr_bus.c ============================================================================== --- stable/8/sys/kern/subr_bus.c Sun Jan 29 12:56:18 2012 (r230738) +++ stable/8/sys/kern/subr_bus.c Sun Jan 29 12:56:21 2012 (r230739) @@ -1165,7 +1165,7 @@ devclass_driver_deleted(devclass_t buscl dev->parent->devclass == busclass) { if ((error = device_detach(dev)) != 0) return (error); - device_set_driver(dev, NULL); + (void)device_set_driver(dev, NULL); BUS_PROBE_NOMATCH(dev->parent, dev); devnomatch(dev); dev->flags |= DF_DONENOMATCH; @@ -2010,19 +2010,22 @@ device_probe_child(device_t dev, device_ for (dl = first_matching_driver(dc, child); dl; dl = next_matching_driver(dc, child, dl)) { - /* If this driver's pass is too high, then ignore it. */ if (dl->pass > bus_current_pass) continue; PDEBUG(("Trying %s", DRIVERNAME(dl->driver))); - device_set_driver(child, dl->driver); + result = device_set_driver(child, dl->driver); + if (result == ENOMEM) + return (result); + else if (result != 0) + continue; if (!hasclass) { if (device_set_devclass(child, dl->driver->name)) { printf("driver bug: Unable to set devclass (devname: %s)\n", (child ? device_get_name(child) : "no device")); - device_set_driver(child, NULL); + (void)device_set_driver(child, NULL); continue; } } @@ -2036,7 +2039,7 @@ device_probe_child(device_t dev, device_ /* Reset flags and devclass before the next probe. */ child->devflags = 0; if (!hasclass) - device_set_devclass(child, NULL); + (void)device_set_devclass(child, NULL); /* * If the driver returns SUCCESS, there can be @@ -2053,7 +2056,7 @@ device_probe_child(device_t dev, device_ * certainly doesn't match. */ if (result > 0) { - device_set_driver(child, NULL); + (void)device_set_driver(child, NULL); continue; } @@ -2116,7 +2119,9 @@ device_probe_child(device_t dev, device_ if (result != 0) return (result); } - device_set_driver(child, best->driver); + result = device_set_driver(child, best->driver); + if (result != 0) + return (result); resource_int_value(best->driver->name, child->unit, "flags", &child->devflags); @@ -2725,8 +2730,8 @@ device_attach(device_t dev) dev->driver->name, dev->unit, error); /* Unset the class; set in device_probe_child */ if (dev->devclass == NULL) - device_set_devclass(dev, NULL); - device_set_driver(dev, NULL); + (void)device_set_devclass(dev, NULL); + (void)device_set_driver(dev, NULL); device_sysctl_fini(dev); dev->state = DS_NOTPRESENT; return (error); @@ -2779,7 +2784,7 @@ device_detach(device_t dev) devclass_delete_device(dev->devclass, dev); dev->state = DS_NOTPRESENT; - device_set_driver(dev, NULL); + (void)device_set_driver(dev, NULL); device_set_desc(dev, NULL); device_sysctl_fini(dev); @@ -4441,7 +4446,6 @@ print_driver(driver_t *driver, int inden print_driver_short(driver, indent); } - static void print_driver_list(driver_list_t drivers, int indent) { From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 12:58:07 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C45E1065675; Sun, 29 Jan 2012 12:58: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 BD0C68FC1F; Sun, 29 Jan 2012 12:58:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TCw6ut036229; Sun, 29 Jan 2012 12:58:06 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TCw616036227; Sun, 29 Jan 2012 12:58:06 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291258.q0TCw616036227@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 12:58:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230740 - stable/9/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 12:58:07 -0000 Author: marius Date: Sun Jan 29 12:58:06 2012 New Revision: 230740 URL: http://svn.freebsd.org/changeset/base/230740 Log: MFC: r228211 It doesn't make much sense to check whether child is NULL after already having dereferenced it. We either should generally check the device_t's supplied to bus functions before using them (which we seem to virtually never do) or just assume that they are not NULL. While at it make this code fit 78 columns. Found with: Coverity Prevent(tm) CID: 4230 Modified: stable/9/sys/kern/subr_bus.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/kern/subr_bus.c ============================================================================== --- stable/9/sys/kern/subr_bus.c Sun Jan 29 12:56:21 2012 (r230739) +++ stable/9/sys/kern/subr_bus.c Sun Jan 29 12:58:06 2012 (r230740) @@ -2018,10 +2018,11 @@ device_probe_child(device_t dev, device_ else if (result != 0) continue; if (!hasclass) { - if (device_set_devclass(child, dl->driver->name)) { - printf("driver bug: Unable to set devclass (devname: %s)\n", - (child ? device_get_name(child) : - "no device")); + if (device_set_devclass(child, + dl->driver->name) != 0) { + printf("driver bug: Unable to set " + "devclass (devname: %s)\n", + device_get_name(child)); (void)device_set_driver(child, NULL); continue; } From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 12:58:07 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEF25106567B; Sun, 29 Jan 2012 12:58: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 AAADB8FC26; Sun, 29 Jan 2012 12:58:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TCw7wq036259; Sun, 29 Jan 2012 12:58:07 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TCw7rH036257; Sun, 29 Jan 2012 12:58:07 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291258.q0TCw7rH036257@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 12:58: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: r230741 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 12:58:08 -0000 Author: marius Date: Sun Jan 29 12:58:07 2012 New Revision: 230741 URL: http://svn.freebsd.org/changeset/base/230741 Log: MFC: r228211 It doesn't make much sense to check whether child is NULL after already having dereferenced it. We either should generally check the device_t's supplied to bus functions before using them (which we seem to virtually never do) or just assume that they are not NULL. While at it make this code fit 78 columns. Found with: Coverity Prevent(tm) CID: 4230 Modified: stable/8/sys/kern/subr_bus.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) Modified: stable/8/sys/kern/subr_bus.c ============================================================================== --- stable/8/sys/kern/subr_bus.c Sun Jan 29 12:58:06 2012 (r230740) +++ stable/8/sys/kern/subr_bus.c Sun Jan 29 12:58:07 2012 (r230741) @@ -2021,10 +2021,11 @@ device_probe_child(device_t dev, device_ else if (result != 0) continue; if (!hasclass) { - if (device_set_devclass(child, dl->driver->name)) { - printf("driver bug: Unable to set devclass (devname: %s)\n", - (child ? device_get_name(child) : - "no device")); + if (device_set_devclass(child, + dl->driver->name) != 0) { + printf("driver bug: Unable to set " + "devclass (devname: %s)\n", + device_get_name(child)); (void)device_set_driver(child, NULL); continue; } From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 14:55:21 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CC7A106566B; Sun, 29 Jan 2012 14:55:21 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1129B8FC16; Sun, 29 Jan 2012 14:55:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TEtK46040399; Sun, 29 Jan 2012 14:55:20 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TEtKXJ040393; Sun, 29 Jan 2012 14:55:20 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291455.q0TEtKXJ040393@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 14:55:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230743 - in stable/9/usr.bin: . csup X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 14:55:21 -0000 Author: marius Date: Sun Jan 29 14:55:20 2012 New Revision: 230743 URL: http://svn.freebsd.org/changeset/base/230743 Log: MFC: r228857 On FreeBSD just use the MD5 implementation of libmd rather than that of libcrypto so we don't need to relinquish csup when world is built without OpenSSL. Modified: stable/9/usr.bin/Makefile stable/9/usr.bin/csup/Makefile stable/9/usr.bin/csup/auth.c stable/9/usr.bin/csup/misc.c stable/9/usr.bin/csup/misc.h Directory Properties: stable/9/usr.bin/ (props changed) stable/9/usr.bin/ar/ (props changed) stable/9/usr.bin/calendar/ (props changed) stable/9/usr.bin/clang/ (props changed) stable/9/usr.bin/compress/ (props changed) stable/9/usr.bin/cpio/ (props changed) stable/9/usr.bin/csup/ (props changed) stable/9/usr.bin/du/ (props changed) stable/9/usr.bin/fetch/ (props changed) stable/9/usr.bin/gprof/ (props changed) stable/9/usr.bin/grep/ (props changed) stable/9/usr.bin/hexdump/ (props changed) stable/9/usr.bin/indent/ (props changed) stable/9/usr.bin/mail/ (props changed) stable/9/usr.bin/make/ (props changed) stable/9/usr.bin/mkesdb/ (props changed) stable/9/usr.bin/mt/ (props changed) stable/9/usr.bin/ncplist/ (props changed) stable/9/usr.bin/netstat/ (props changed) stable/9/usr.bin/procstat/ (props changed) stable/9/usr.bin/rctl/ (props changed) stable/9/usr.bin/rwho/ (props changed) stable/9/usr.bin/script/ (props changed) stable/9/usr.bin/sed/ (props changed) stable/9/usr.bin/tar/ (props changed) stable/9/usr.bin/truss/ (props changed) stable/9/usr.bin/usbhidaction/ (props changed) stable/9/usr.bin/usbhidctl/ (props changed) stable/9/usr.bin/vacation/ (props changed) stable/9/usr.bin/vmstat/ (props changed) stable/9/usr.bin/xlint/ (props changed) Modified: stable/9/usr.bin/Makefile ============================================================================== --- stable/9/usr.bin/Makefile Sun Jan 29 14:52:42 2012 (r230742) +++ stable/9/usr.bin/Makefile Sun Jan 29 14:55:20 2012 (r230743) @@ -250,10 +250,11 @@ SUBDIR+= bc SUBDIR+= chkey SUBDIR+= dc SUBDIR+= newkey +.endif + .if ${MK_LIBTHR} != "no" SUBDIR+= csup .endif -.endif .if ${MK_LOCATE} != "no" SUBDIR+= locate Modified: stable/9/usr.bin/csup/Makefile ============================================================================== --- stable/9/usr.bin/csup/Makefile Sun Jan 29 14:52:42 2012 (r230742) +++ stable/9/usr.bin/csup/Makefile Sun Jan 29 14:55:20 2012 (r230743) @@ -33,8 +33,8 @@ CFLAGS+= -I. -I${.CURDIR} CFLAGS+= -DHAVE_FFLAGS -DNDEBUG WARNS?= 1 -DPADD= ${LIBCRYPTO} ${LIBZ} ${LIBPTHREAD} -LDADD= -lcrypto -lz -lpthread +DPADD= ${LIBMD} ${LIBZ} ${LIBPTHREAD} +LDADD= -lmd -lz -lpthread SCRIPTS= cpasswd.sh MAN= csup.1 cpasswd.1 Modified: stable/9/usr.bin/csup/auth.c ============================================================================== --- stable/9/usr.bin/csup/auth.c Sun Jan 29 14:52:42 2012 (r230742) +++ stable/9/usr.bin/csup/auth.c Sun Jan 29 14:55:20 2012 (r230743) @@ -35,7 +35,6 @@ #include #include -#include #include #include #include Modified: stable/9/usr.bin/csup/misc.c ============================================================================== --- stable/9/usr.bin/csup/misc.c Sun Jan 29 14:52:42 2012 (r230742) +++ stable/9/usr.bin/csup/misc.c Sun Jan 29 14:55:20 2012 (r230743) @@ -28,7 +28,6 @@ #include #include -#include #include #include Modified: stable/9/usr.bin/csup/misc.h ============================================================================== --- stable/9/usr.bin/csup/misc.h Sun Jan 29 14:52:42 2012 (r230742) +++ stable/9/usr.bin/csup/misc.h Sun Jan 29 14:55:20 2012 (r230743) @@ -28,10 +28,18 @@ #ifndef _MISC_H_ #define _MISC_H_ -#include - #include +#ifdef __FreeBSD__ +#include +#define MD5_DIGEST_LENGTH 16 +#define MD5_Init MD5Init +#define MD5_Final MD5Final +#define MD5_Update MD5Update +#else +#include +#endif + /* If we're not compiling in a C99 environment, define the C99 types. */ #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 14:55:38 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF7D7106566C; Sun, 29 Jan 2012 14:55:38 +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 BA5498FC17; Sun, 29 Jan 2012 14:55:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TEtcxL040452; Sun, 29 Jan 2012 14:55:38 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TEtcdu040440; Sun, 29 Jan 2012 14:55:38 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291455.q0TEtcdu040440@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 14:55:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230744 - in stable/8/usr.bin: . chpass csup X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 14:55:38 -0000 Author: marius Date: Sun Jan 29 14:55:38 2012 New Revision: 230744 URL: http://svn.freebsd.org/changeset/base/230744 Log: o MFC: r204556, r204628 Move csup away from contrib/ and into usr.bin/. Software is no longer contributed, and main development is happening in the FreeBSD repo. o MFC: r204558 Unmark authentication support as a TODO item. o MFC: r204629 Remove unused include path. o MFC: r204639 Include CURDIR in case the makefile is not run from the same directory. o MFC: r204664 Fix spelling. o MFC: r206621 Add and expand $FreeBSD$ keyword to allow committing to this file. o MFC: r206622 (partial) mdoc: order prologue macros consistently by Dd/Dt/Os Although groff_mdoc(7) gives another impression, this is the ordering most widely used and also required by mdocml/mandoc. o MFC: r208291 (partial) mdoc: consistently spell our email addresses o MFC: r210874 Don't point users at the old csup homepage. o MFC: r213300 If an RCS file is truncated, rcsfile_getdelta() will return NULL. Instead of faulting, check for NULL. However, returning an error would cause csup to just abort the entire update. Instead, break out of the loop and return ok. The attempts to update the file will trigger a MD5 failure which will cause csup to download the entire file as a fixup. o MFC: r213573 (partial) mdoc: drop redundant .Pp and .LP calls They have no effect when coming in pairs, or before .Bl/.Bd o MFC: r216370 (partial) Remove the advertising clause from UCB copyrighted files in usr.bin. This is in accordance with the information provided at ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change Also add $FreeBSD$ to a few files to keep svn happy. o MFC: r216542 Signal that data should not be modified. o MFC: r217858 Remove dead code. o MFC: r225535 Fix csup to allow case insensitive server names in the auth file, just as advertised in the manpage. PR: 158652 o MFC: r225536 Fix typos in error messages. o MFC: r225979 Update the comment to reflect what is actually going on. o MFC: r225980 Handle the situation where fixups_close() has been called but more fixups are still available on the queue. o MFC: r228625 In usr.bin/csup/auth.c, use the correct number of bytes for zeroing the shared secret, and use long long format to snprintf a time_t. o MFC: r228626 In usr.bin/csup/proto.c, use the correct printf length modifier to print an off_t. o MFC: r228667 In usr.bin/csup/auth.c, cast time_t to intmax_t instead, and use the corresponding printf length modifier. o MFC: r228857 On FreeBSD just use the MD5 implementation of libmd rather than that of libcrypto so we don't need to relinquish csup when world is built without OpenSSL. Added: stable/8/usr.bin/csup/README - copied unchanged from r204556, head/usr.bin/csup/README stable/8/usr.bin/csup/TODO - copied, changed from r204556, head/usr.bin/csup/TODO stable/8/usr.bin/csup/attrstack.c - copied unchanged from r204556, head/usr.bin/csup/attrstack.c stable/8/usr.bin/csup/attrstack.h - copied unchanged from r204556, head/usr.bin/csup/attrstack.h stable/8/usr.bin/csup/auth.c - copied, changed from r204556, head/usr.bin/csup/auth.c stable/8/usr.bin/csup/auth.h - copied unchanged from r204556, head/usr.bin/csup/auth.h stable/8/usr.bin/csup/config.c - copied unchanged from r204556, head/usr.bin/csup/config.c stable/8/usr.bin/csup/config.h - copied unchanged from r204556, head/usr.bin/csup/config.h stable/8/usr.bin/csup/cpasswd.1 (contents, props changed) - copied, changed from r204556, head/usr.bin/csup/cpasswd.1 stable/8/usr.bin/csup/cpasswd.sh - copied unchanged from r204556, head/usr.bin/csup/cpasswd.sh stable/8/usr.bin/csup/csup.1 - copied, changed from r204556, head/usr.bin/csup/csup.1 stable/8/usr.bin/csup/detailer.c - copied unchanged from r204556, head/usr.bin/csup/detailer.c stable/8/usr.bin/csup/detailer.h - copied unchanged from r204556, head/usr.bin/csup/detailer.h stable/8/usr.bin/csup/diff.c - copied unchanged from r204556, head/usr.bin/csup/diff.c stable/8/usr.bin/csup/diff.h - copied unchanged from r204556, head/usr.bin/csup/diff.h stable/8/usr.bin/csup/fattr.c - copied unchanged from r204556, head/usr.bin/csup/fattr.c stable/8/usr.bin/csup/fattr.h - copied unchanged from r204556, head/usr.bin/csup/fattr.h stable/8/usr.bin/csup/fattr_bsd.h - copied unchanged from r204556, head/usr.bin/csup/fattr_bsd.h stable/8/usr.bin/csup/fattr_posix.h - copied unchanged from r204556, head/usr.bin/csup/fattr_posix.h stable/8/usr.bin/csup/fixups.c - copied, changed from r204556, head/usr.bin/csup/fixups.c stable/8/usr.bin/csup/fixups.h - copied unchanged from r204556, head/usr.bin/csup/fixups.h stable/8/usr.bin/csup/fnmatch.c - copied, changed from r204556, head/usr.bin/csup/fnmatch.c stable/8/usr.bin/csup/fnmatch.h - copied, changed from r204556, head/usr.bin/csup/fnmatch.h stable/8/usr.bin/csup/globtree.c - copied unchanged from r204556, head/usr.bin/csup/globtree.c stable/8/usr.bin/csup/globtree.h - copied unchanged from r204556, head/usr.bin/csup/globtree.h stable/8/usr.bin/csup/idcache.c - copied unchanged from r204556, head/usr.bin/csup/idcache.c stable/8/usr.bin/csup/idcache.h - copied unchanged from r204556, head/usr.bin/csup/idcache.h stable/8/usr.bin/csup/keyword.c - copied unchanged from r204556, head/usr.bin/csup/keyword.c stable/8/usr.bin/csup/keyword.h - copied unchanged from r204556, head/usr.bin/csup/keyword.h stable/8/usr.bin/csup/lex.rcs.c - copied unchanged from r204556, head/usr.bin/csup/lex.rcs.c stable/8/usr.bin/csup/lister.c - copied unchanged from r204556, head/usr.bin/csup/lister.c stable/8/usr.bin/csup/lister.h - copied unchanged from r204556, head/usr.bin/csup/lister.h stable/8/usr.bin/csup/main.c - copied, changed from r204556, head/usr.bin/csup/main.c stable/8/usr.bin/csup/main.h - copied unchanged from r204556, head/usr.bin/csup/main.h stable/8/usr.bin/csup/misc.c - copied, changed from r204556, head/usr.bin/csup/misc.c stable/8/usr.bin/csup/misc.h - copied, changed from r204556, head/usr.bin/csup/misc.h stable/8/usr.bin/csup/mux.c - copied unchanged from r204556, head/usr.bin/csup/mux.c stable/8/usr.bin/csup/mux.h - copied unchanged from r204556, head/usr.bin/csup/mux.h stable/8/usr.bin/csup/parse.y - copied unchanged from r204556, head/usr.bin/csup/parse.y stable/8/usr.bin/csup/pathcomp.c - copied unchanged from r204556, head/usr.bin/csup/pathcomp.c stable/8/usr.bin/csup/pathcomp.h - copied unchanged from r204556, head/usr.bin/csup/pathcomp.h stable/8/usr.bin/csup/proto.c - copied, changed from r204556, head/usr.bin/csup/proto.c stable/8/usr.bin/csup/proto.h - copied unchanged from r204556, head/usr.bin/csup/proto.h stable/8/usr.bin/csup/queue.h - copied unchanged from r204556, head/usr.bin/csup/queue.h stable/8/usr.bin/csup/rcsfile.c - copied, changed from r204556, head/usr.bin/csup/rcsfile.c stable/8/usr.bin/csup/rcsfile.h - copied, changed from r204556, head/usr.bin/csup/rcsfile.h stable/8/usr.bin/csup/rcsparse.c - copied, changed from r204556, head/usr.bin/csup/rcsparse.c stable/8/usr.bin/csup/rcsparse.h - copied unchanged from r204556, head/usr.bin/csup/rcsparse.h stable/8/usr.bin/csup/rcstokenizer.h - copied unchanged from r204556, head/usr.bin/csup/rcstokenizer.h stable/8/usr.bin/csup/rcstokenizer.l - copied unchanged from r204556, head/usr.bin/csup/rcstokenizer.l stable/8/usr.bin/csup/rsyncfile.c - copied unchanged from r204556, head/usr.bin/csup/rsyncfile.c stable/8/usr.bin/csup/rsyncfile.h - copied unchanged from r204556, head/usr.bin/csup/rsyncfile.h stable/8/usr.bin/csup/status.c - copied unchanged from r204556, head/usr.bin/csup/status.c stable/8/usr.bin/csup/status.h - copied unchanged from r204556, head/usr.bin/csup/status.h stable/8/usr.bin/csup/stream.c - copied unchanged from r204556, head/usr.bin/csup/stream.c stable/8/usr.bin/csup/stream.h - copied unchanged from r204556, head/usr.bin/csup/stream.h stable/8/usr.bin/csup/threads.c - copied unchanged from r204556, head/usr.bin/csup/threads.c stable/8/usr.bin/csup/threads.h - copied unchanged from r204556, head/usr.bin/csup/threads.h stable/8/usr.bin/csup/token.h - copied unchanged from r204556, head/usr.bin/csup/token.h stable/8/usr.bin/csup/token.l - copied unchanged from r204556, head/usr.bin/csup/token.l stable/8/usr.bin/csup/updater.c - copied, changed from r204556, head/usr.bin/csup/updater.c stable/8/usr.bin/csup/updater.h - copied unchanged from r204556, head/usr.bin/csup/updater.h Modified: stable/8/usr.bin/Makefile stable/8/usr.bin/csup/Makefile Directory Properties: stable/8/usr.bin/ (props changed) stable/8/usr.bin/apply/ (props changed) stable/8/usr.bin/ar/ (props changed) stable/8/usr.bin/awk/ (props changed) stable/8/usr.bin/biff/ (props changed) stable/8/usr.bin/c89/ (props changed) stable/8/usr.bin/c99/ (props changed) stable/8/usr.bin/calendar/ (props changed) stable/8/usr.bin/catman/ (props changed) stable/8/usr.bin/checknr/ (props changed) stable/8/usr.bin/chpass/Makefile (props changed) stable/8/usr.bin/column/ (props changed) stable/8/usr.bin/comm/ (props changed) stable/8/usr.bin/compress/ (props changed) stable/8/usr.bin/cpio/ (props changed) stable/8/usr.bin/cpuset/ (props changed) stable/8/usr.bin/csup/ (props changed) stable/8/usr.bin/du/ (props changed) stable/8/usr.bin/ee/ (props changed) stable/8/usr.bin/enigma/ (props changed) stable/8/usr.bin/fetch/ (props changed) stable/8/usr.bin/find/ (props changed) stable/8/usr.bin/finger/ (props changed) stable/8/usr.bin/fold/ (props changed) stable/8/usr.bin/fstat/ (props changed) stable/8/usr.bin/gcore/ (props changed) stable/8/usr.bin/getopt/ (props changed) stable/8/usr.bin/gzip/ (props changed) stable/8/usr.bin/hexdump/ (props changed) stable/8/usr.bin/indent/ (props changed) stable/8/usr.bin/ipcs/ (props changed) stable/8/usr.bin/jot/ (props changed) stable/8/usr.bin/kdump/ (props changed) stable/8/usr.bin/killall/ (props changed) stable/8/usr.bin/ktrace/ (props changed) stable/8/usr.bin/lastcomm/ (props changed) stable/8/usr.bin/ldd/ (props changed) stable/8/usr.bin/less/ (props changed) stable/8/usr.bin/lex/ (props changed) stable/8/usr.bin/limits/ (props changed) stable/8/usr.bin/locale/ (props changed) stable/8/usr.bin/locate/ (props changed) stable/8/usr.bin/lock/ (props changed) stable/8/usr.bin/lockf/ (props changed) stable/8/usr.bin/logger/ (props changed) stable/8/usr.bin/look/ (props changed) stable/8/usr.bin/m4/ (props changed) stable/8/usr.bin/mail/ (props changed) stable/8/usr.bin/make/ (props changed) stable/8/usr.bin/makewhatis/ (props changed) stable/8/usr.bin/minigzip/ (props changed) stable/8/usr.bin/ncal/ (props changed) stable/8/usr.bin/netstat/ (props changed) stable/8/usr.bin/nfsstat/ (props changed) stable/8/usr.bin/pathchk/ (props changed) stable/8/usr.bin/perror/ (props changed) stable/8/usr.bin/printf/ (props changed) stable/8/usr.bin/procstat/ (props changed) stable/8/usr.bin/rlogin/ (props changed) stable/8/usr.bin/rpcgen/ (props changed) stable/8/usr.bin/rpcinfo/ (props changed) stable/8/usr.bin/rs/ (props changed) stable/8/usr.bin/ruptime/ (props changed) stable/8/usr.bin/script/ (props changed) stable/8/usr.bin/sed/ (props changed) stable/8/usr.bin/showmount/ (props changed) stable/8/usr.bin/sockstat/ (props changed) stable/8/usr.bin/split/ (props changed) stable/8/usr.bin/stat/ (props changed) stable/8/usr.bin/su/ (props changed) stable/8/usr.bin/systat/ (props changed) stable/8/usr.bin/tail/ (props changed) stable/8/usr.bin/tar/ (props changed) stable/8/usr.bin/tftp/ (props changed) stable/8/usr.bin/tip/ (props changed) stable/8/usr.bin/top/ (props changed) stable/8/usr.bin/touch/ (props changed) stable/8/usr.bin/tr/ (props changed) stable/8/usr.bin/truss/ (props changed) stable/8/usr.bin/uname/ (props changed) stable/8/usr.bin/unifdef/ (props changed) stable/8/usr.bin/uniq/ (props changed) stable/8/usr.bin/unzip/ (props changed) stable/8/usr.bin/usbhidaction/ (props changed) stable/8/usr.bin/usbhidctl/ (props changed) stable/8/usr.bin/uudecode/ (props changed) stable/8/usr.bin/vmstat/ (props changed) stable/8/usr.bin/w/ (props changed) stable/8/usr.bin/wall/ (props changed) stable/8/usr.bin/whois/ (props changed) stable/8/usr.bin/xargs/ (props changed) stable/8/usr.bin/xinstall/ (props changed) stable/8/usr.bin/xlint/ (props changed) stable/8/usr.bin/xz/ (props changed) stable/8/usr.bin/yacc/ (props changed) Modified: stable/8/usr.bin/Makefile ============================================================================== --- stable/8/usr.bin/Makefile Sun Jan 29 14:55:20 2012 (r230743) +++ stable/8/usr.bin/Makefile Sun Jan 29 14:55:38 2012 (r230744) @@ -281,10 +281,11 @@ _hesinfo= hesinfo .if ${MK_OPENSSL} != "no" _chkey= chkey _newkey= newkey +.endif + .if ${MK_LIBTHR} != "no" _csup= csup .endif -.endif .if ${MK_LOCATE} != "no" _locate= locate Modified: stable/8/usr.bin/csup/Makefile ============================================================================== --- stable/8/usr.bin/csup/Makefile Sun Jan 29 14:55:20 2012 (r230743) +++ stable/8/usr.bin/csup/Makefile Sun Jan 29 14:55:38 2012 (r230744) @@ -1,9 +1,8 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../contrib/csup - PROG= csup SRCS= attrstack.c \ + auth.c \ config.c \ detailer.c \ diff.c \ @@ -30,11 +29,14 @@ SRCS= attrstack.c \ token.l \ updater.c -CFLAGS+= -I. -I${.CURDIR}/../../contrib/csup +CFLAGS+= -I. -I${.CURDIR} CFLAGS+= -DHAVE_FFLAGS -DNDEBUG WARNS?= 1 -DPADD= ${LIBCRYPTO} ${LIBZ} ${LIBPTHREAD} -LDADD= -lcrypto -lz -lpthread +DPADD= ${LIBMD} ${LIBZ} ${LIBPTHREAD} +LDADD= -lmd -lz -lpthread + +SCRIPTS= cpasswd.sh +MAN= csup.1 cpasswd.1 .include Copied: stable/8/usr.bin/csup/README (from r204556, head/usr.bin/csup/README) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/usr.bin/csup/README Sun Jan 29 14:55:38 2012 (r230744, copy of r204556, head/usr.bin/csup/README) @@ -0,0 +1,39 @@ +$FreeBSD$ + +Authors +------- + +CVSup was originally written in Modula-3 by + John Polstra . + +Csup is a rewrite of CVSup in C. It has been mostly written by + Maxime Henrion . + +A few contributors have helped him in his task and they are listed here in +alphabetical order : + + Olivier Houchard + Ulf Lilleengen + Christoph Mathys (Google SoC Project) + Etienne Vidal + + +Building & Installing +--------------------- + +Csup should build and run fine under any *BSD OS (that includes FreeBSD, +NetBSD, OpenBSD and DragonFlyBSD), as well as Linux and Darwin. If you +have a problem building from source, drop me a mail! + +There is one Makefile specifically tailored for *BSD systems named +Makefile and another one that is gmake-specific for Darwin and Linux +users named GNUmakefile. You don't really need to worry about that +since whatever your "make" command is, it should pick up the correct +Makefile. + +As usual, to build the source code, just run "make". Once this is done, +just run "make install" to install the binary and manual page. + +Be warned however that if the packaging system of your OS knows about +csup, it is certainly better to install it from there rather than by +hand, so that it can then be properly deinstalled. Copied and modified: stable/8/usr.bin/csup/TODO (from r204556, head/usr.bin/csup/TODO) ============================================================================== --- head/usr.bin/csup/TODO Tue Mar 2 07:26:07 2010 (r204556, copy source) +++ stable/8/usr.bin/csup/TODO Sun Jan 29 14:55:38 2012 (r230744) @@ -18,9 +18,8 @@ BUGS: MISSING FEATURES: - Add support for shell commands sent by the server. -- Add missing support for various CVSup options : -D, -a (requires - authentication support), -e and -E (requires shell commands support) - and the destDir parameter. +- Add missing support for various CVSup options : -D, -e and -E (requires + shell commands support) and the destDir parameter. - For now, this code should build fine on FreeBSD, NetBSD, OpenBSD, Linux and Darwin. Solaris support would also be nice at some point. - Implement some new useful options : the ability to generate CVS Copied: stable/8/usr.bin/csup/attrstack.c (from r204556, head/usr.bin/csup/attrstack.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/usr.bin/csup/attrstack.c Sun Jan 29 14:55:38 2012 (r230744, copy of r204556, head/usr.bin/csup/attrstack.c) @@ -0,0 +1,90 @@ +/*- + * Copyright (c) 2006, Maxime Henrion + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + */ + +#include +#include + +#include "attrstack.h" +#include "fattr.h" +#include "misc.h" + +#define ATTRSTACK_DEFSIZE 16 /* Initial size of the stack. */ + +struct attrstack { + struct fattr **stack; + size_t cur; + size_t size; +}; + +struct attrstack * +attrstack_new(void) +{ + struct attrstack *as; + + as = xmalloc(sizeof(struct attrstack)); + as->stack = xmalloc(sizeof(struct fattr *) * ATTRSTACK_DEFSIZE); + as->size = ATTRSTACK_DEFSIZE; + as->cur = 0; + return (as); +} + +struct fattr * +attrstack_pop(struct attrstack *as) +{ + + assert(as->cur > 0); + return (as->stack[--as->cur]); +} + +void +attrstack_push(struct attrstack *as, struct fattr *fa) +{ + + if (as->cur >= as->size) { + as->size *= 2; + as->stack = xrealloc(as->stack, + sizeof(struct fattr *) * as->size); + } + as->stack[as->cur++] = fa; +} + +size_t +attrstack_size(struct attrstack *as) +{ + + return (as->cur); +} + +void +attrstack_free(struct attrstack *as) +{ + + assert(as->cur == 0); + free(as->stack); + free(as); +} Copied: stable/8/usr.bin/csup/attrstack.h (from r204556, head/usr.bin/csup/attrstack.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/usr.bin/csup/attrstack.h Sun Jan 29 14:55:38 2012 (r230744, copy of r204556, head/usr.bin/csup/attrstack.h) @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2006, Maxime Henrion + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + */ +#ifndef _ATTRSTACK_H_ +#define _ATTRSTACK_H_ + +struct fattr; +struct attrstack; + +struct attrstack *attrstack_new(void); +void attrstack_push(struct attrstack *, struct fattr *); +struct fattr *attrstack_pop(struct attrstack *); +size_t attrstack_size(struct attrstack *); +void attrstack_free(struct attrstack *); + +#endif /* !_ATTRSTACK_H_ */ Copied and modified: stable/8/usr.bin/csup/auth.c (from r204556, head/usr.bin/csup/auth.c) ============================================================================== --- head/usr.bin/csup/auth.c Tue Mar 2 07:26:07 2010 (r204556, copy source) +++ stable/8/usr.bin/csup/auth.c Sun Jan 29 14:55:38 2012 (r230744) @@ -35,7 +35,6 @@ #include #include -#include #include #include #include @@ -147,7 +146,7 @@ auth_domd5auth(struct config *config) lprintf(-1, "Server failed to authenticate itself to client\n"); return (STATUS_FAILURE); } - lprintf(2, "MD5 authentication successfull\n"); + lprintf(2, "MD5 authentication successful\n"); return (STATUS_SUCCESS); } if (strcmp(cmd, "!") == 0) { @@ -188,22 +187,22 @@ auth_lookuprecord(char *server, struct s error = auth_parsetoken(&line, auth->server, sizeof(auth->server)); if (error != STATUS_SUCCESS) { - lprintf(-1, "%s:%d Missng client name\n", authfile, linenum); + lprintf(-1, "%s:%d Missing client name\n", authfile, linenum); goto close; } /* Skip the rest of this line, it isn't what we are looking for. */ - if (strcmp(auth->server, server) != 0) + if (strcasecmp(auth->server, server) != 0) continue; error = auth_parsetoken(&line, auth->client, sizeof(auth->client)); if (error != STATUS_SUCCESS) { - lprintf(-1, "%s:%d Missng password\n", authfile, linenum); + lprintf(-1, "%s:%d Missing password\n", authfile, linenum); goto close; } error = auth_parsetoken(&line, auth->password, sizeof(auth->password)); if (error != STATUS_SUCCESS) { - lprintf(-1, "%s:%d Missng comment\n", authfile, linenum); + lprintf(-1, "%s:%d Missing comment\n", authfile, linenum); goto close; } stream_close(s); @@ -254,7 +253,7 @@ auth_makesecret(struct srvrecord *auth, MD5_Update(&md5, ":", 1); MD5_Update(&md5, auth->password, strlen(auth->password)); MD5_Final(md5sum, &md5); - memset(secret, 0, sizeof(secret)); + memset(secret, 0, MD5_CHARS_MAX); strcpy(secret, md5salt); auth_readablesum(md5sum, secret + strlen(md5salt)); } @@ -302,8 +301,9 @@ auth_makechallenge(struct config *config } gettimeofday(&tv, NULL); MD5_Init(&md5); - snprintf(buf, sizeof(buf), "%s:%ld:%ld:%ld:%d:%d", - inet_ntoa(laddr.sin_addr), tv.tv_sec, tv.tv_usec, random(), pid, ppid); + snprintf(buf, sizeof(buf), "%s:%jd:%ld:%ld:%d:%d", + inet_ntoa(laddr.sin_addr), (intmax_t)tv.tv_sec, tv.tv_usec, + random(), pid, ppid); MD5_Update(&md5, buf, strlen(buf)); MD5_Final(md5sum, &md5); auth_readablesum(md5sum, challenge); Copied: stable/8/usr.bin/csup/auth.h (from r204556, head/usr.bin/csup/auth.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/usr.bin/csup/auth.h Sun Jan 29 14:55:38 2012 (r230744, copy of r204556, head/usr.bin/csup/auth.h) @@ -0,0 +1,38 @@ +/*- + * Copyright (c) 2003-2007, Petar Zhivkov Petrov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +#ifndef _AUTH_H_ +#define _AUTH_H_ + +#define AUTHFILE ".csup/auth" /* user home relative */ + +struct config; + +int auth_login(struct config *); + +#endif /* !_AUTH_H_ */ + Copied: stable/8/usr.bin/csup/config.c (from r204556, head/usr.bin/csup/config.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/usr.bin/csup/config.c Sun Jan 29 14:55:38 2012 (r230744, copy of r204556, head/usr.bin/csup/config.c) @@ -0,0 +1,579 @@ +/*- + * Copyright (c) 2003-2006, Maxime Henrion + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "config.h" +#include "globtree.h" +#include "keyword.h" +#include "misc.h" +#include "parse.h" +#include "stream.h" +#include "token.h" + +static int config_parse_refusefiles(struct coll *); +static int config_parse_refusefile(struct coll *, char *); + +extern FILE *yyin; + +/* These are globals because I can't think of a better way with yacc. */ +static STAILQ_HEAD(, coll) colls; +static struct coll *cur_coll; +static struct coll *defaults; +static struct coll *ovcoll; +static int ovmask; +static const char *cfgfile; + +/* + * Extract all the configuration information from the config + * file and some command line parameters. + */ +struct config * +config_init(const char *file, struct coll *override, int overridemask) +{ + struct config *config; + struct coll *coll; + size_t slen; + char *prefix; + int error; + mode_t mask; + + config = xmalloc(sizeof(struct config)); + memset(config, 0, sizeof(struct config)); + STAILQ_INIT(&colls); + + defaults = coll_new(NULL); + /* Set the default umask. */ + mask = umask(0); + umask(mask); + defaults->co_umask = mask; + ovcoll = override; + ovmask = overridemask; + + /* Extract a list of collections from the configuration file. */ + cur_coll = coll_new(defaults); + yyin = fopen(file, "r"); + if (yyin == NULL) { + lprintf(-1, "Cannot open \"%s\": %s\n", file, strerror(errno)); + goto bad; + } + cfgfile = file; + error = yyparse(); + fclose(yyin); + if (error) + goto bad; + + memcpy(&config->colls, &colls, sizeof(colls)); + if (STAILQ_EMPTY(&config->colls)) { + lprintf(-1, "Empty supfile\n"); + goto bad; + } + + /* Fixup the list of collections. */ + STAILQ_FOREACH(coll, &config->colls, co_next) { + if (coll->co_base == NULL) + coll->co_base = xstrdup("/usr/local/etc/cvsup"); + if (coll->co_colldir == NULL) + coll->co_colldir = "sup"; + if (coll->co_prefix == NULL) { + coll->co_prefix = xstrdup(coll->co_base); + /* + * If prefix is not an absolute pathname, it is + * interpreted relative to base. + */ + } else if (coll->co_prefix[0] != '/') { + slen = strlen(coll->co_base); + if (slen > 0 && coll->co_base[slen - 1] != '/') + xasprintf(&prefix, "%s/%s", coll->co_base, + coll->co_prefix); + else + xasprintf(&prefix, "%s%s", coll->co_base, + coll->co_prefix); + free(coll->co_prefix); + coll->co_prefix = prefix; + } + coll->co_prefixlen = strlen(coll->co_prefix); + /* Determine whether to checksum RCS files or not. */ + if (coll->co_options & CO_EXACTRCS) + coll->co_options |= CO_CHECKRCS; + else + coll->co_options &= ~CO_CHECKRCS; + /* In recent versions, we always try to set the file modes. */ + coll->co_options |= CO_SETMODE; + coll->co_options |= CO_NORSYNC; + error = config_parse_refusefiles(coll); + if (error) + goto bad; + } + + coll_free(cur_coll); + coll_free(defaults); + config->host = STAILQ_FIRST(&config->colls)->co_host; + return (config); +bad: + coll_free(cur_coll); + coll_free(defaults); + config_free(config); + return (NULL); +} + +int +config_checkcolls(struct config *config) +{ + char linkname[4]; + struct stat sb; + struct coll *coll; + int error, numvalid, ret; + + numvalid = 0; + STAILQ_FOREACH(coll, &config->colls, co_next) { + error = stat(coll->co_prefix, &sb); + if (error || !S_ISDIR(sb.st_mode)) { + /* Skip this collection, and warn about it unless its + prefix is a symbolic link pointing to "SKIP". */ + coll->co_options |= CO_SKIP; + ret = readlink(coll->co_prefix, linkname, + sizeof(linkname)); + if (ret != 4 || memcmp(linkname, "SKIP", 4) != 0) { + lprintf(-1,"Nonexistent prefix \"%s\" for " + "%s/%s\n", coll->co_prefix, coll->co_name, + coll->co_release); + } + continue; + } + numvalid++; + } + return (numvalid); +} + +static int +config_parse_refusefiles(struct coll *coll) +{ + char *collstem, *suffix, *supdir, *path; + int error; + + if (coll->co_colldir[0] == '/') + supdir = xstrdup(coll->co_colldir); + else + xasprintf(&supdir, "%s/%s", coll->co_base, coll->co_colldir); + + /* First, the global refuse file that applies to all collections. */ + xasprintf(&path, "%s/refuse", supdir); + error = config_parse_refusefile(coll, path); + free(path); + if (error) { + free(supdir); + return (error); + } + + /* Next the per-collection refuse files that applies to all release/tag + combinations. */ + xasprintf(&collstem, "%s/%s/refuse", supdir, coll->co_name); + free(supdir); + error = config_parse_refusefile(coll, collstem); + if (error) { + free(collstem); + return (error); + } + + /* Finally, the per-release and per-tag refuse file. */ + suffix = coll_statussuffix(coll); + if (suffix != NULL) { + xasprintf(&path, "%s%s", collstem, suffix); + free(suffix); + error = config_parse_refusefile(coll, path); + free(path); + } + free(collstem); + return (error); +} + +/* + * Parses a "refuse" file, and records the relevant information in + * coll->co_refusals. If the file does not exist, it is silently + * ignored. + */ +static int +config_parse_refusefile(struct coll *coll, char *path) +{ + struct stream *rd; + char *cp, *line, *pat; + + rd = stream_open_file(path, O_RDONLY); + if (rd == NULL) + return (0); + while ((line = stream_getln(rd, NULL)) != NULL) { + pat = line; + for (;;) { + /* Trim leading whitespace. */ + pat += strspn(pat, " \t"); + if (pat[0] == '\0') + break; + cp = strpbrk(pat, " \t"); + if (cp != NULL) + *cp = '\0'; + pattlist_add(coll->co_refusals, pat); + if (cp == NULL) + break; + pat = cp + 1; + } + } + if (!stream_eof(rd)) { + stream_close(rd); + lprintf(-1, "Read failure from \"%s\": %s\n", path, + strerror(errno)); + return (-1); + } + stream_close(rd); + return (0); +} + +void +config_free(struct config *config) +{ + struct coll *coll; + + while (!STAILQ_EMPTY(&config->colls)) { + coll = STAILQ_FIRST(&config->colls); + STAILQ_REMOVE_HEAD(&config->colls, co_next); + coll_free(coll); + } + if (config->server != NULL) + stream_close(config->server); + if (config->laddr != NULL) + free(config->laddr); + free(config); +} + +/* Create a new collection, inheriting options from the default collection. */ +struct coll * +coll_new(struct coll *def) +{ + struct coll *new; + + new = xmalloc(sizeof(struct coll)); + memset(new, 0, sizeof(struct coll)); + if (def != NULL) { + new->co_options = def->co_options; + new->co_umask = def->co_umask; + if (def->co_host != NULL) + new->co_host = xstrdup(def->co_host); + if (def->co_base != NULL) + new->co_base = xstrdup(def->co_base); + if (def->co_date != NULL) + new->co_date = xstrdup(def->co_date); + if (def->co_prefix != NULL) + new->co_prefix = xstrdup(def->co_prefix); + if (def->co_release != NULL) + new->co_release = xstrdup(def->co_release); + if (def->co_tag != NULL) + new->co_tag = xstrdup(def->co_tag); + if (def->co_listsuffix != NULL) + new->co_listsuffix = xstrdup(def->co_listsuffix); + } else { + new->co_tag = xstrdup("."); + new->co_date = xstrdup("."); + } + new->co_keyword = keyword_new(); + new->co_accepts = pattlist_new(); + new->co_refusals = pattlist_new(); + new->co_attrignore = FA_DEV | FA_INODE; + return (new); +} + +void +coll_override(struct coll *coll, struct coll *from, int mask) +{ + size_t i; + int newoptions, oldoptions; + + newoptions = from->co_options & mask; + oldoptions = coll->co_options & (CO_MASK & ~mask); + + if (from->co_release != NULL) { + if (coll->co_release != NULL) + free(coll->co_release); + coll->co_release = xstrdup(from->co_release); + } + if (from->co_host != NULL) { + if (coll->co_host != NULL) + free(coll->co_host); + coll->co_host = xstrdup(from->co_host); + } + if (from->co_base != NULL) { + if (coll->co_base != NULL) + free(coll->co_base); + coll->co_base = xstrdup(from->co_base); + } + if (from->co_colldir != NULL) + coll->co_colldir = from->co_colldir; + if (from->co_prefix != NULL) { + if (coll->co_prefix != NULL) + free(coll->co_prefix); + coll->co_prefix = xstrdup(from->co_prefix); + } + if (newoptions & CO_CHECKOUTMODE) { + if (from->co_tag != NULL) { + if (coll->co_tag != NULL) + free(coll->co_tag); + coll->co_tag = xstrdup(from->co_tag); + } + if (from->co_date != NULL) { + if (coll->co_date != NULL) + free(coll->co_date); + coll->co_date = xstrdup(from->co_date); + } + } + if (from->co_listsuffix != NULL) { + if (coll->co_listsuffix != NULL) + free(coll->co_listsuffix); + coll->co_listsuffix = xstrdup(from->co_listsuffix); + } + for (i = 0; i < pattlist_size(from->co_accepts); i++) { + pattlist_add(coll->co_accepts, + pattlist_get(from->co_accepts, i)); + } + for (i = 0; i < pattlist_size(from->co_refusals); i++) { + pattlist_add(coll->co_refusals, + pattlist_get(from->co_refusals, i)); + } + coll->co_options = oldoptions | newoptions; +} + +char * +coll_statussuffix(struct coll *coll) +{ + const char *tag; + char *suffix; + + if (coll->co_listsuffix != NULL) { + xasprintf(&suffix, ".%s", coll->co_listsuffix); + } else if (coll->co_options & CO_USERELSUFFIX) { + if (coll->co_tag == NULL) + tag = "."; + else + tag = coll->co_tag; + if (coll->co_release != NULL) { + if (coll->co_options & CO_CHECKOUTMODE) { + xasprintf(&suffix, ".%s:%s", + coll->co_release, tag); + } else { + xasprintf(&suffix, ".%s", coll->co_release); + } + } else if (coll->co_options & CO_CHECKOUTMODE) { + xasprintf(&suffix, ":%s", tag); + } + } else + suffix = NULL; + return (suffix); +} + +char * +coll_statuspath(struct coll *coll) +{ + char *path, *suffix; + + suffix = coll_statussuffix(coll); + if (suffix != NULL) { + if (coll->co_colldir[0] == '/') + xasprintf(&path, "%s/%s/checkouts%s", coll->co_colldir, + coll->co_name, suffix); + else + xasprintf(&path, "%s/%s/%s/checkouts%s", coll->co_base, + coll->co_colldir, coll->co_name, suffix); + } else { + if (coll->co_colldir[0] == '/') + xasprintf(&path, "%s/%s/checkouts", coll->co_colldir, + coll->co_name); + else + xasprintf(&path, "%s/%s/%s/checkouts", coll->co_base, + coll->co_colldir, coll->co_name); + } + free(suffix); + return (path); +} + +void +coll_add(char *name) +{ + struct coll *coll; + + cur_coll->co_name = name; + coll_override(cur_coll, ovcoll, ovmask); + if (cur_coll->co_release == NULL) { + lprintf(-1, "Release not specified for collection " + "\"%s\"\n", cur_coll->co_name); + exit(1); + } + if (cur_coll->co_host == NULL) { + lprintf(-1, "Host not specified for collection " + "\"%s\"\n", cur_coll->co_name); + exit(1); + } + if (!STAILQ_EMPTY(&colls)) { + coll = STAILQ_LAST(&colls, coll, co_next); + if (strcmp(coll->co_host, cur_coll->co_host) != 0) { + lprintf(-1, "All \"host\" fields in the supfile " + "must be the same\n"); + exit(1); + } + } + STAILQ_INSERT_TAIL(&colls, cur_coll, co_next); + cur_coll = coll_new(defaults); +} + +void +coll_free(struct coll *coll) +{ + + if (coll == NULL) + return; + if (coll->co_host != NULL) + free(coll->co_host); + if (coll->co_base != NULL) + free(coll->co_base); + if (coll->co_date != NULL) + free(coll->co_date); + if (coll->co_prefix != NULL) + free(coll->co_prefix); + if (coll->co_release != NULL) + free(coll->co_release); + if (coll->co_tag != NULL) + free(coll->co_tag); + if (coll->co_cvsroot != NULL) + free(coll->co_cvsroot); + if (coll->co_name != NULL) + free(coll->co_name); + if (coll->co_listsuffix != NULL) + free(coll->co_listsuffix); + keyword_free(coll->co_keyword); + if (coll->co_dirfilter != NULL) + globtree_free(coll->co_dirfilter); + if (coll->co_dirfilter != NULL) + globtree_free(coll->co_filefilter); + if (coll->co_norsync != NULL) + globtree_free(coll->co_norsync); + if (coll->co_accepts != NULL) + pattlist_free(coll->co_accepts); + if (coll->co_refusals != NULL) + pattlist_free(coll->co_refusals); + free(coll); +} + +void +coll_setopt(int opt, char *value) +{ + struct coll *coll; + int error, mask; + + coll = cur_coll; + switch (opt) { + case PT_HOST: + if (coll->co_host != NULL) + free(coll->co_host); + coll->co_host = value; + break; + case PT_BASE: + if (coll->co_base != NULL) + free(coll->co_base); + coll->co_base = value; + break; + case PT_DATE: + if (coll->co_date != NULL) + free(coll->co_date); + coll->co_date = value; + coll->co_options |= CO_CHECKOUTMODE; + break; + case PT_PREFIX: + if (coll->co_prefix != NULL) + free(coll->co_prefix); + coll->co_prefix = value; + break; + case PT_RELEASE: + if (coll->co_release != NULL) + free(coll->co_release); + coll->co_release = value; + break; + case PT_TAG: + if (coll->co_tag != NULL) + free(coll->co_tag); + coll->co_tag = value; + coll->co_options |= CO_CHECKOUTMODE; + break; + case PT_LIST: + if (strchr(value, '/') != NULL) { + lprintf(-1, "Parse error in \"%s\": \"list\" suffix " + "must not contain slashes\n", cfgfile); + exit(1); + } + if (coll->co_listsuffix != NULL) + free(coll->co_listsuffix); + coll->co_listsuffix = value; + break; + case PT_UMASK: + error = asciitoint(value, &mask, 8); + free(value); + if (error) { + lprintf(-1, "Parse error in \"%s\": Invalid " + "umask value\n", cfgfile); + exit(1); + } + coll->co_umask = mask; + break; + case PT_USE_REL_SUFFIX: + coll->co_options |= CO_USERELSUFFIX; + break; + case PT_DELETE: + coll->co_options |= CO_DELETE | CO_EXACTRCS; + break; + case PT_COMPRESS: + coll->co_options |= CO_COMPRESS; + break; + case PT_NORSYNC: + coll->co_options |= CO_NORSYNC; + break; + } +} + +/* Set "coll" as being the default collection. */ +void +coll_setdef(void) +{ + + coll_free(defaults); + defaults = cur_coll; + cur_coll = coll_new(defaults); +} Copied: stable/8/usr.bin/csup/config.h (from r204556, head/usr.bin/csup/config.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/usr.bin/csup/config.h Sun Jan 29 14:55:38 2012 (r230744, copy of r204556, head/usr.bin/csup/config.h) @@ -0,0 +1,127 @@ +/*- + * Copyright (c) 2003-2006, Maxime Henrion + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +#ifndef _CONFIG_H_ +#define _CONFIG_H_ + +#include +#include + +#include + +#include "fattr.h" +#include "queue.h" +#include "misc.h" + +/* + * Collection options. + */ +#define CO_BACKUP 0x00000001 +#define CO_DELETE 0x00000002 +#define CO_KEEP 0x00000004 +#define CO_OLD 0x00000008 +#define CO_UNLINKBUSY 0x00000010 +#define CO_NOUPDATE 0x00000020 +#define CO_COMPRESS 0x00000040 +#define CO_USERELSUFFIX 0x00000080 +#define CO_EXACTRCS 0x00000100 +#define CO_CHECKRCS 0x00000200 +#define CO_SKIP 0x00000400 +#define CO_CHECKOUTMODE 0x00000800 +#define CO_NORSYNC 0x00001000 +#define CO_KEEPBADFILES 0x00002000 +#define CO_EXECUTE 0x00004000 +#define CO_SETOWNER 0x00008000 +#define CO_SETMODE 0x00010000 +#define CO_SETFLAGS 0x00020000 +#define CO_NORCS 0x00040000 +#define CO_STRICTCHECKRCS 0x00080000 +#define CO_TRUSTSTATUSFILE 0x00100000 +#define CO_DODELETESONLY 0x00200000 +#define CO_DETAILALLRCSFILES 0x00400000 + +#define CO_MASK 0x007fffff + +/* Options that the server is allowed to set. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 14:58:54 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B6E31065674; Sun, 29 Jan 2012 14:58: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 6ECAD8FC16; Sun, 29 Jan 2012 14:58:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TEwsMF040592; Sun, 29 Jan 2012 14:58:54 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TEwsse040591; Sun, 29 Jan 2012 14:58:54 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291458.q0TEwsse040591@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 14:58: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: r230745 - in stable/8/contrib: bsnmp/snmpd csup top xz X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 14:58:54 -0000 Author: marius Date: Sun Jan 29 14:58:54 2012 New Revision: 230745 URL: http://svn.freebsd.org/changeset/base/230745 Log: MFC: r204556 Move csup away from contrib/ and into usr.bin/. Software is no longer contributed, and main development is happening in the FreeBSD repo. Deleted: stable/8/contrib/csup/ Modified: Directory Properties: stable/8/contrib/ (props changed) stable/8/contrib/bind9/ (props changed) stable/8/contrib/binutils/ (props changed) stable/8/contrib/bsnmp/ (props changed) stable/8/contrib/bsnmp/snmpd/bsnmpd.1 (props changed) stable/8/contrib/bzip2/ (props changed) stable/8/contrib/com_err/ (props changed) stable/8/contrib/ee/ (props changed) stable/8/contrib/expat/ (props changed) stable/8/contrib/file/ (props changed) stable/8/contrib/gcc/ (props changed) stable/8/contrib/gdb/ (props changed) stable/8/contrib/gdtoa/ (props changed) stable/8/contrib/gperf/ (props changed) stable/8/contrib/ipfilter/ (props changed) stable/8/contrib/libarchive/ (props changed) stable/8/contrib/libarchive/cpio/ (props changed) stable/8/contrib/libarchive/libarchive/ (props changed) stable/8/contrib/libarchive/libarchive_fe/ (props changed) stable/8/contrib/libarchive/tar/ (props changed) stable/8/contrib/libpcap/ (props changed) stable/8/contrib/libstdc++/ (props changed) stable/8/contrib/lukemftp/ (props changed) stable/8/contrib/ncurses/ (props changed) stable/8/contrib/ntp/ (props changed) stable/8/contrib/nvi/ (props changed) stable/8/contrib/openbsm/ (props changed) stable/8/contrib/openpam/ (props changed) stable/8/contrib/pf/ (props changed) stable/8/contrib/sendmail/ (props changed) stable/8/contrib/tcp_wrappers/ (props changed) stable/8/contrib/tcpdump/ (props changed) stable/8/contrib/tcsh/ (props changed) stable/8/contrib/telnet/ (props changed) stable/8/contrib/top/ (props changed) stable/8/contrib/top/install-sh (props changed) stable/8/contrib/traceroute/ (props changed) stable/8/contrib/wpa/ (props changed) stable/8/contrib/xz/ (props changed) stable/8/contrib/xz/AUTHORS (props changed) stable/8/contrib/xz/COPYING (props changed) stable/8/contrib/xz/ChangeLog (props changed) stable/8/contrib/xz/FREEBSD-Xlist (props changed) stable/8/contrib/xz/FREEBSD-upgrade (props changed) stable/8/contrib/xz/README (props changed) stable/8/contrib/xz/THANKS (props changed) stable/8/contrib/xz/TODO (props changed) stable/8/contrib/xz/po/ (props changed) stable/8/contrib/xz/src/ (props changed) From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 15:00:31 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F0B01065676; Sun, 29 Jan 2012 15:00: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 6D5748FC14; Sun, 29 Jan 2012 15:00:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TF0VJL040706; Sun, 29 Jan 2012 15:00:31 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TF0VEa040703; Sun, 29 Jan 2012 15:00:31 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291500.q0TF0VEa040703@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 15:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230746 - stable/9/sys/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 15:00:31 -0000 Author: marius Date: Sun Jan 29 15:00:31 2012 New Revision: 230746 URL: http://svn.freebsd.org/changeset/base/230746 Log: MFC: r228858 Update a comment to reflect reality and explain why we're using the medany code model. Modified: stable/9/sys/conf/kern.mk Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/conf/kern.mk ============================================================================== --- stable/9/sys/conf/kern.mk Sun Jan 29 14:58:54 2012 (r230745) +++ stable/9/sys/conf/kern.mk Sun Jan 29 15:00:31 2012 (r230746) @@ -72,7 +72,8 @@ INLINE_LIMIT?= 15000 .endif # -# For sparc64 we want medlow code model, and we tell gcc to use floating +# For sparc64 we want the medany code model so modules may be located +# anywhere in the 64-bit address space. We also tell GCC to use floating # point emulation. This avoids using floating point registers for integer # operations which it has a tendency to do. # From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 15:00:32 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 532B4106566B; Sun, 29 Jan 2012 15:00:32 +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 412508FC12; Sun, 29 Jan 2012 15:00:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TF0WIj040736; Sun, 29 Jan 2012 15:00:32 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TF0WCo040734; Sun, 29 Jan 2012 15:00:32 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291500.q0TF0WCo040734@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 15:00:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230747 - stable/8/sys/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 15:00:32 -0000 Author: marius Date: Sun Jan 29 15:00:31 2012 New Revision: 230747 URL: http://svn.freebsd.org/changeset/base/230747 Log: MFC: r204556 Update a comment to reflect reality and explain why we're using the medany code model. Modified: stable/8/sys/conf/kern.mk 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) Modified: stable/8/sys/conf/kern.mk ============================================================================== --- stable/8/sys/conf/kern.mk Sun Jan 29 15:00:31 2012 (r230746) +++ stable/8/sys/conf/kern.mk Sun Jan 29 15:00:31 2012 (r230747) @@ -54,7 +54,8 @@ INLINE_LIMIT?= 15000 .endif # -# For sparc64 we want medlow code model, and we tell gcc to use floating +# For sparc64 we want the medany code model so modules may be located +# anywhere in the 64-bit address space. We also tell GCC to use floating # point emulation. This avoids using floating point registers for integer # operations which it has a tendency to do. # From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 18:54:26 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 269D6106564A; Sun, 29 Jan 2012 18:54:26 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0CED38FC15; Sun, 29 Jan 2012 18:54:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TIsPVr048308; Sun, 29 Jan 2012 18:54:26 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TIsPjS048299; Sun, 29 Jan 2012 18:54:25 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201201291854.q0TIsPjS048299@svn.freebsd.org> From: Justin Hibbits Date: Sun, 29 Jan 2012 18:54:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230751 - in stable/9: etc/devd share/man/man4/man4.powerpc sys/conf sys/dev/adb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 18:54:26 -0000 Author: jhibbits Date: Sun Jan 29 18:54:25 2012 New Revision: 230751 URL: http://svn.freebsd.org/changeset/base/230751 Log: MFC r226449: Add support for special keys (volume/brightness/eject) on Apple laptops with ADB keyboards. Approved by: nwhitehorn (mentor) Added: stable/9/etc/devd/apple.conf - copied unchanged from r226449, head/etc/devd/apple.conf stable/9/share/man/man4/man4.powerpc/abtn.4 - copied unchanged from r226449, head/share/man/man4/man4.powerpc/abtn.4 stable/9/sys/dev/adb/adb_buttons.c - copied unchanged from r226449, head/sys/dev/adb/adb_buttons.c Modified: stable/9/etc/devd/Makefile stable/9/share/man/man4/man4.powerpc/Makefile stable/9/share/man/man4/man4.powerpc/akbd.4 stable/9/sys/conf/files.powerpc stable/9/sys/dev/adb/adb_kbd.c Directory Properties: stable/9/etc/ (props changed) stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/etc/devd/Makefile ============================================================================== --- stable/9/etc/devd/Makefile Sun Jan 29 16:44:21 2012 (r230750) +++ stable/9/etc/devd/Makefile Sun Jan 29 18:54:25 2012 (r230751) @@ -1,6 +1,14 @@ # $FreeBSD$ -FILES= asus.conf uath.conf usb.conf +FILES= uath.conf usb.conf + +.if ${MACHINE} == "powerpc" +FILES+= apple.conf +.endif + +.if ${MACHINE} == "amd64" || ${MACHINE} == "i386" +FILES+= asus.conf +.endif NO_OBJ= FILESDIR= /etc/devd Copied: stable/9/etc/devd/apple.conf (from r226449, head/etc/devd/apple.conf) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/etc/devd/apple.conf Sun Jan 29 18:54:25 2012 (r230751, copy of r226449, head/etc/devd/apple.conf) @@ -0,0 +1,46 @@ +# $FreeBSD$ +# +# PowerPC Apple specific devd events + +# Keyboard power key +notify 0 { + match "system" "PMU"; + match "subsystem" "Button"; + match "notify" "0x0"; + action "shutdown -p now"; +}; + + +# The next blocks enable volume hotkeys that can be found on Apple laptops +notify 0 { + match "system" "PMU"; + match "subsystem" "keys"; + match "type" "mute"; + action "mixer 0"; +}; + +notify 0 { + match "system" "PMU"; + match "subsystem" "keys"; + match "type" "volume"; + match "notify" "down"; + action "mixer vol -10"; +}; + +notify 0 { + match "system" "PMU"; + match "subsystem" "keys"; + match "type" "volume"; + match "notify" "up"; + action "mixer vol +10"; +}; + +# Eject key +notify 0 { + match "system" "PMU"; + match "subsystem" "keys"; + match "type" "eject"; + action "camcontrol eject cd0"; +}; + + Modified: stable/9/share/man/man4/man4.powerpc/Makefile ============================================================================== --- stable/9/share/man/man4/man4.powerpc/Makefile Sun Jan 29 16:44:21 2012 (r230750) +++ stable/9/share/man/man4/man4.powerpc/Makefile Sun Jan 29 18:54:25 2012 (r230751) @@ -2,6 +2,7 @@ MAN= adb.4 \ akbd.4 \ + abtn.4 \ ams.4 \ bm.4 \ cuda.4 \ Copied: stable/9/share/man/man4/man4.powerpc/abtn.4 (from r226449, head/share/man/man4/man4.powerpc/abtn.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/share/man/man4/man4.powerpc/abtn.4 Sun Jan 29 18:54:25 2012 (r230751, copy of r226449, head/share/man/man4/man4.powerpc/abtn.4) @@ -0,0 +1,115 @@ +.\"- +.\" Copyright (c) 2011 Justin Hibbits +.\" Copyright (c) 2009 Nathan Whitehorn +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 16, 2011 +.Dt ABTN 4 +.Os +.Sh NAME +.Nm abtn +.Nd ADB Keyboard Special Keys Driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device adb" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the extended Fn keys on Apple notebooks with an ADB +interface. +.Sh HARDWARE +The +.Nm +driver supports extended keyboard keys (special F-keys) on the following devices: +.Pp +.Bl -bullet -compact +.It +Apple iBook Keyboard +.It +Apple PowerBook Keyboard +.El +.Sh EVENTS +The +.Nm +driver sends events to +.Xr devd 8 +for the following events under the +.Cd PMU +system, and +.Cd keys +subsystem: +.Pp +.Bl -bullet -compact +.It +.Cd brightness +- Generates +.Cd up +and +.Cd down +notify types matching the pressed key. +.It +.Cd mute +.It +.Cd volume +- Generates +.Cd up +and +.Cd down +notify types matching the pressed key. +.It +.Cd eject +.El +.Pp +Examples are included in /etc/devd/apple.conf. +.Sh SEE ALSO +.Xr adb 4 , +.Xr akbd 4 , +.Xr cuda 4 , +.Xr pmu 4, +.Xr devd 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Nx 5.0 +and was ported to +.Fx 10.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Tsubai Masanari +for +.Nx +and ported to +.Fx +by +.An Justin Hibbits . Modified: stable/9/share/man/man4/man4.powerpc/akbd.4 ============================================================================== --- stable/9/share/man/man4/man4.powerpc/akbd.4 Sun Jan 29 16:44:21 2012 (r230750) +++ stable/9/share/man/man4/man4.powerpc/akbd.4 Sun Jan 29 18:54:25 2012 (r230751) @@ -58,7 +58,36 @@ Apple iBook Keyboard .It Apple PowerBook Keyboard .El +.Sh EVENTS +The +.Nm +driver sends events to +.Xr devd 8 +for the following events under the +.Cd PMU +system: +.Pp +.Bl -bullet -compact +.It +Power button - +.Cd "Button" +subsystem, +.Cd "pressed" +type. +.El +.Sh SYSCTL VARIABLES +The +.Nm +driver supports the following sysctl variable for configuring the Fn keys: +.Bl -tag -width indent +.It Va dev.akbd.%d.fn_keys_function_as_primary +Set the Fn keys to be their F-key type as default. A value of 0 causes the +F-keys keys to work as special keys by default ( +.Xr abtn 4 ) +and a value of 1 sets them to behave as F-keys by default. +.El .Sh SEE ALSO +.Xr abtn 4 , .Xr adb 4 , .Xr cuda 4 , .Xr pmu 4 Modified: stable/9/sys/conf/files.powerpc ============================================================================== --- stable/9/sys/conf/files.powerpc Sun Jan 29 16:44:21 2012 (r230750) +++ stable/9/sys/conf/files.powerpc Sun Jan 29 18:54:25 2012 (r230751) @@ -22,6 +22,7 @@ dev/adb/adb_kbd.c optional adb dev/adb/adb_mouse.c optional adb dev/adb/adb_hb_if.m optional adb dev/adb/adb_if.m optional adb +dev/adb/adb_buttons.c optional adb dev/agp/agp_apple.c optional agp powermac dev/cfi/cfi_bus_fdt.c optional cfi fdt dev/fb/fb.c optional sc Copied: stable/9/sys/dev/adb/adb_buttons.c (from r226449, head/sys/dev/adb/adb_buttons.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/adb/adb_buttons.c Sun Jan 29 18:54:25 2012 (r230751, copy of r226449, head/sys/dev/adb/adb_buttons.c) @@ -0,0 +1,165 @@ +/*- + * Copyright (c) 2011, Justin Hibbits. + * Copyright (c) 2002, Miodrag Vallat. + * Copyright (C) 1999 Tsubai Masanari. 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. 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 ``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. + * + * OpenBSD: abtn.c,v 1.12 2009/01/10 18:00:59 robert Exp + * NetBSD: abtn.c,v 1.1 1999/07/12 17:48:26 tsubai Exp + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#define ABTN_HANDLER_ID 31 + +struct abtn_softc { + device_t sc_dev; + + int handler_id; +}; + +static int abtn_probe(device_t dev); +static int abtn_attach(device_t dev); +static u_int abtn_receive_packet(device_t dev, u_char status, + u_char command, u_char reg, int len, u_char *data); + +static device_method_t abtn_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, abtn_probe), + DEVMETHOD(device_attach, abtn_attach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* ADB interface */ + DEVMETHOD(adb_receive_packet, abtn_receive_packet), + + { 0, 0 } +}; + +static driver_t abtn_driver = { + "abtn", + abtn_methods, + sizeof(struct abtn_softc), +}; + +static devclass_t abtn_devclass; + +DRIVER_MODULE(abtn, adb, abtn_driver, abtn_devclass, 0, 0); + +static int +abtn_probe(device_t dev) +{ + uint8_t type; + + type = adb_get_device_type(dev); + + if (type != ADB_DEVICE_MISC) + return (ENXIO); + + device_set_desc(dev, "ADB Brightness/Volume/Eject Buttons"); + return (0); +} + +static int +abtn_attach(device_t dev) +{ + struct abtn_softc *sc; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + + sc->handler_id = adb_get_device_handler(dev); + + return 0; +} + +static u_int +abtn_receive_packet(device_t dev, u_char status, + u_char command, u_char reg, int len, u_char *data) +{ + u_int cmd; + + cmd = data[0]; + + switch (cmd) { + case 0x0a: /* decrease brightness */ + if (devctl_process_running()) + devctl_notify("PMU", "keys", "brightness", + "notify=down"); + break; + + case 0x09: /* increase brightness */ + if (devctl_process_running()) + devctl_notify("PMU", "keys", "brightness", "notify=up"); + break; + + case 0x08: /* mute */ + case 0x01: /* mute, AV hardware */ + if (devctl_process_running()) + devctl_notify("PMU", "keys", "mute", NULL); + break; + case 0x07: /* decrease volume */ + case 0x02: /* decrease volume, AV hardware */ + if (devctl_process_running()) + devctl_notify("PMU", "keys", "volume", "notify=down"); + break; + case 0x06: /* increase volume */ + case 0x03: /* increase volume, AV hardware */ + if (devctl_process_running()) + devctl_notify("PMU", "keys", "volume", "notify=up"); + break; + case 0x0c: /* mirror display key */ + /* Need callback to do something with this */ + break; + case 0x0b: /* eject tray */ + if (devctl_process_running()) + devctl_notify("PMU", "keys", "eject", NULL); + case 0x7f: /* numlock */ + /* Need callback to do something with this */ + break; + + default: +#ifdef DEBUG + if ((cmd & ~0x7f) == 0) + device_printf(dev, "unknown ADB button 0x%x\n", cmd); +#endif + break; + } + return 0; +} + Modified: stable/9/sys/dev/adb/adb_kbd.c ============================================================================== --- stable/9/sys/dev/adb/adb_kbd.c Sun Jan 29 16:44:21 2012 (r230750) +++ stable/9/sys/dev/adb/adb_kbd.c Sun Jan 29 18:54:25 2012 (r230751) @@ -35,12 +35,15 @@ #include #include #include +#include #include #include "opt_kbd.h" #include #include +#include +#include #include #include @@ -55,6 +58,7 @@ static int adb_kbd_probe(device_t dev); static int adb_kbd_attach(device_t dev); static int adb_kbd_detach(device_t dev); static void akbd_repeat(void *xsc); +static int adb_fn_keys(SYSCTL_HANDLER_ARGS); static u_int adb_kbd_receive_packet(device_t dev, u_char status, u_char command, u_char reg, int len, u_char *data); @@ -282,6 +286,8 @@ adb_kbd_attach(device_t dev) { struct adb_kbd_softc *sc; keyboard_switch_t *sw; + uint32_t fkeys; + phandle_t handle; sw = kbd_get_switch(KBD_DRIVER_NAME); if (sw == NULL) { @@ -333,6 +339,40 @@ adb_kbd_attach(device_t dev) adb_set_autopoll(dev,1); + handle = OF_finddevice("mac-io/via-pmu/adb/keyboard"); + if (handle != -1 && OF_getprop(handle, "AAPL,has-embedded-fn-keys", + &fkeys, sizeof(fkeys)) != -1) { + static const char *key_names[] = {"F1", "F2", "F3", "F4", "F5", + "F6", "F7", "F8", "F9", "F10", "F11", "F12"}; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; + int i; + + if (bootverbose) + device_printf(dev, "Keyboard has embedded Fn keys\n"); + + for (i = 0; i < 12; i++) { + uint32_t keyval; + char buf[3]; + if (OF_getprop(handle, key_names[i], &keyval, + sizeof(keyval)) < 0) + continue; + buf[0] = 1; + buf[1] = i+1; + buf[2] = keyval; + adb_write_register(dev, 0, 3, buf); + } + adb_write_register(dev, 1, 2, &(uint16_t){0}); + + ctx = device_get_sysctl_ctx(dev); + tree = device_get_sysctl_tree(dev); + + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "fn_keys_function_as_primary", CTLTYPE_INT | CTLFLAG_RW, sc, + 0, adb_fn_keys, "I", + "Set the Fn keys to be their F-key type as default"); + } + return (0); } @@ -383,6 +423,13 @@ adb_kbd_receive_packet(device_t dev, u_c return (0); mtx_lock(&sc->sc_mutex); + /* 0x7f is always the power button */ + if (data[0] == 0x7f && devctl_process_running()) { + devctl_notify("PMU", "Button", "pressed", NULL); + return (0); + } else if (data[0] == 0xff) { + return (0); /* Ignore power button release. */ + } if ((data[0] & 0x7f) == 57 && sc->buffers < 7) { /* Fake the down/up cycle for caps lock */ sc->buffer[sc->buffers++] = data[0] & 0x7f; @@ -390,7 +437,6 @@ adb_kbd_receive_packet(device_t dev, u_c } else { sc->buffer[sc->buffers++] = data[0]; } - if (sc->buffer[sc->buffers-1] < 0xff) sc->last_press = sc->buffer[sc->buffers-1]; @@ -814,5 +860,29 @@ akbd_modevent(module_t mod, int type, vo return (0); } +static int +adb_fn_keys(SYSCTL_HANDLER_ARGS) +{ + struct adb_kbd_softc *sc = arg1; + int error; + uint16_t is_fn_enabled; + unsigned int is_fn_enabled_sysctl; + + adb_read_register(sc->sc_dev, 1, &is_fn_enabled); + is_fn_enabled &= 1; + is_fn_enabled_sysctl = is_fn_enabled; + error = sysctl_handle_int(oidp, &is_fn_enabled_sysctl, 0, req); + + if (error || !req->newptr) + return (error); + + is_fn_enabled = is_fn_enabled_sysctl; + if (is_fn_enabled != 1 && is_fn_enabled != 0) + return (EINVAL); + + adb_write_register(sc->sc_dev, 1, 2, &is_fn_enabled); + return (0); +} + DEV_MODULE(akbd, akbd_modevent, NULL); From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 21:08:25 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54F791065686; Sun, 29 Jan 2012 21:08:25 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B5778FC08; Sun, 29 Jan 2012 21:08:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TL8PBL052695; Sun, 29 Jan 2012 21:08:25 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TL8O61052689; Sun, 29 Jan 2012 21:08:24 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201292108.q0TL8O61052689@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 29 Jan 2012 21:08:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230754 - in stable/9/sys: compat/linprocfs fs/procfs kern sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 21:08:25 -0000 Author: trociny Date: Sun Jan 29 21:08:24 2012 New Revision: 230754 URL: http://svn.freebsd.org/changeset/base/230754 Log: MFC r227833, r227834, r227836, r227874, r227955, r228029, r228030, r228046, r228264, r228288, r228302, r228648, r228666, r230145, r230470, r230550: New kern.proc sysctls. r227833, r227874: Add new sysctls, KERN_PROC_ENV and KERN_PROC_AUXV, to return environment strings and ELF auxiliary vectors from a process stack. Make sysctl_kern_proc_args to read not cached arguments from the process stack. Export proc_getargv() and proc_getenvv() so they can be reused by procfs and linprocfs. Suggested by: kib Reviewed by: kib Discussed with: kib, rwatson, jilles Tested by: pho MFC r227834: In procfs_doproccmdline() if arguments are not cashed read them from the process stack. Suggested by: kib Reviewed by: kib Tested by: pho MFC r227836: Retire linprocfs_doargv(). Instead use new functions, proc_getargv() and proc_getenvv(), which were implemented using linprocfs_doargv() as a reference. Suggested by: kib Reviewed by: kib Approved by: des (linprocfs maintainer) r227955: Add sysctl to get process resource limits. Reviewed by: kib r228029: In sysctl_kern_proc_auxv the process was released too early: we still need to hold it when checking process sv_flags. r228030, r228046: Add sysctl to retrieve ps_strings structure location of another process. Suggested by: kib Reviewed by: kib r228264: In sysctl_kern_proc_ps_strings() there is no much sense in checking for P_WEXIT and P_SYSTEM flags. Reviewed by: kib r228288, r228302: Protect kern.proc.auxv and kern.proc.ps_strings sysctls with p_candebug(). Citing jilles: If we are ever going to do ASLR, the AUXV information tells an attacker where the stack, executable and RTLD are located, which defeats much of the point of randomizing the addresses in the first place. Given that the AUXV information seems to be used by debuggers only anyway, I think it would be good to move it to p_candebug() now. The full virtual memory maps (KERN_PROC_VMMAP, procstat -v) are already under p_candebug(). Suggested by: jilles Discussed with: rwatson r228648: On start most of sysctl_kern_proc functions use the same pattern: locate a process calling pfind() and do some additional checks like p_candebug(). To reduce this code duplication a new function pget() is introduced and used. As the function may be useful not only in kern_proc.c it is in the kernel name space. Suggested by: kib Reviewed by: kib r228666: Fix style and white spaces. MFC r230145: Abrogate nchr argument in proc_getargv() and proc_getenvv(): we always want to read strings completely to know the actual size. As a side effect it fixes the issue with kern.proc.args and kern.proc.env sysctls, which didn't return the size of available data when calling sysctl(3) with the NULL argument for oldp. Note, in get_ps_strings(), which does actual work for proc_getargv() and proc_getenvv(), we still have a safety limit on the size of data read in case of a corrupted procces stack. Suggested by: kib r230470: Change kern.proc.rlimit sysctl to: - retrive only one, specified limit for a process, not the whole array, as it was previously (the sysctl has been added recently and has not been backported to stable yet, so this change is ok); - allow to set a resource limit for another process. Submitted by: Andrey Zonov Discussed with: kib Reviewed by: kib r230550: Fix CTL flags in the declarations of KERN_PROC_ENV, AUXV and PS_STRINGS sysctls: they are read only. Modified: stable/9/sys/compat/linprocfs/linprocfs.c stable/9/sys/fs/procfs/procfs_status.c stable/9/sys/kern/kern_proc.c stable/9/sys/kern/kern_resource.c stable/9/sys/sys/proc.h stable/9/sys/sys/resourcevar.h stable/9/sys/sys/sysctl.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/9/sys/compat/linprocfs/linprocfs.c Sun Jan 29 20:39:42 2012 (r230753) +++ stable/9/sys/compat/linprocfs/linprocfs.c Sun Jan 29 21:08:24 2012 (r230754) @@ -919,150 +919,6 @@ linprocfs_doprocroot(PFS_FILL_ARGS) return (0); } -#define MAX_ARGV_STR 512 /* Max number of argv-like strings */ -#define UIO_CHUNK_SZ 256 /* Max chunk size (bytes) for uiomove */ - -static int -linprocfs_doargv(struct thread *td, struct proc *p, struct sbuf *sb, - void (*resolver)(const struct ps_strings, u_long *, int *)) -{ - struct iovec iov; - struct uio tmp_uio; - struct ps_strings pss; - int ret, i, n_elements, elm_len; - u_long addr, pbegin; - char **env_vector, *envp; - char env_string[UIO_CHUNK_SZ]; -#ifdef COMPAT_FREEBSD32 - struct freebsd32_ps_strings pss32; - uint32_t *env_vector32; -#endif - -#define UIO_HELPER(uio, iov, base, len, cnt, offset, sz, flg, rw, td) \ -do { \ - iov.iov_base = (caddr_t)(base); \ - iov.iov_len = (len); \ - uio.uio_iov = &(iov); \ - uio.uio_iovcnt = (cnt); \ - uio.uio_offset = (off_t)(offset); \ - uio.uio_resid = (sz); \ - uio.uio_segflg = (flg); \ - uio.uio_rw = (rw); \ - uio.uio_td = (td); \ -} while (0) - - env_vector = malloc(sizeof(char *) * MAX_ARGV_STR, M_TEMP, M_WAITOK); - -#ifdef COMPAT_FREEBSD32 - env_vector32 = NULL; - if (SV_PROC_FLAG(p, SV_ILP32) != 0) { - env_vector32 = malloc(sizeof(*env_vector32) * MAX_ARGV_STR, - M_TEMP, M_WAITOK); - elm_len = sizeof(int32_t); - envp = (char *)env_vector32; - - UIO_HELPER(tmp_uio, iov, &pss32, sizeof(pss32), 1, - (off_t)(p->p_sysent->sv_psstrings), - sizeof(pss32), UIO_SYSSPACE, UIO_READ, td); - ret = proc_rwmem(p, &tmp_uio); - if (ret != 0) - goto done; - pss.ps_argvstr = PTRIN(pss32.ps_argvstr); - pss.ps_nargvstr = pss32.ps_nargvstr; - pss.ps_envstr = PTRIN(pss32.ps_envstr); - pss.ps_nenvstr = pss32.ps_nenvstr; - } else { -#endif - elm_len = sizeof(char *); - envp = (char *)env_vector; - - UIO_HELPER(tmp_uio, iov, &pss, sizeof(pss), 1, - (off_t)(p->p_sysent->sv_psstrings), - sizeof(pss), UIO_SYSSPACE, UIO_READ, td); - ret = proc_rwmem(p, &tmp_uio); - if (ret != 0) - goto done; -#ifdef COMPAT_FREEBSD32 - } -#endif - - /* Get the array address and the number of elements */ - resolver(pss, &addr, &n_elements); - - /* Consistent with lib/libkvm/kvm_proc.c */ - if (n_elements > MAX_ARGV_STR) { - ret = E2BIG; - goto done; - } - - UIO_HELPER(tmp_uio, iov, envp, n_elements * elm_len, 1, - (vm_offset_t)(addr), iov.iov_len, UIO_SYSSPACE, UIO_READ, td); - ret = proc_rwmem(p, &tmp_uio); - if (ret != 0) - goto done; -#ifdef COMPAT_FREEBSD32 - if (env_vector32 != NULL) { - for (i = 0; i < n_elements; i++) - env_vector[i] = PTRIN(env_vector32[i]); - } -#endif - - /* Now we can iterate through the list of strings */ - for (i = 0; i < n_elements; i++) { - pbegin = (vm_offset_t)env_vector[i]; - for (;;) { - UIO_HELPER(tmp_uio, iov, env_string, sizeof(env_string), - 1, pbegin, iov.iov_len, UIO_SYSSPACE, UIO_READ, td); - ret = proc_rwmem(p, &tmp_uio); - if (ret != 0) - goto done; - - if (!strvalid(env_string, UIO_CHUNK_SZ)) { - /* - * We didn't find the end of the string. - * Add the string to the buffer and move - * the pointer. But do not allow strings - * of unlimited length. - */ - sbuf_bcat(sb, env_string, UIO_CHUNK_SZ); - if (sbuf_len(sb) >= ARG_MAX) { - ret = E2BIG; - goto done; - } - pbegin += UIO_CHUNK_SZ; - } else { - sbuf_cat(sb, env_string); - break; - } - } - sbuf_bcat(sb, "", 1); - } -#undef UIO_HELPER - -done: - free(env_vector, M_TEMP); -#ifdef COMPAT_FREEBSD32 - free(env_vector32, M_TEMP); -#endif - return (ret); -} - -static void -ps_string_argv(const struct ps_strings ps, u_long *addr, int *n) -{ - - *addr = (u_long) ps.ps_argvstr; - *n = ps.ps_nargvstr; -} - -static void -ps_string_env(const struct ps_strings ps, u_long *addr, int *n) -{ - - *addr = (u_long) ps.ps_envstr; - *n = ps.ps_nenvstr; -} - /* * Filler function for proc/pid/cmdline */ @@ -1090,9 +946,15 @@ linprocfs_doproccmdline(PFS_FILL_ARGS) PROC_UNLOCK(p); return (0); } + + if ((p->p_flag & P_SYSTEM) != 0) { + PROC_UNLOCK(p); + return (0); + } + PROC_UNLOCK(p); - ret = linprocfs_doargv(td, p, sb, ps_string_argv); + ret = proc_getargv(td, p, sb); return (ret); } @@ -1118,9 +980,15 @@ linprocfs_doprocenviron(PFS_FILL_ARGS) PROC_UNLOCK(p); return (0); } + + if ((p->p_flag & P_SYSTEM) != 0) { + PROC_UNLOCK(p); + return (0); + } + PROC_UNLOCK(p); - ret = linprocfs_doargv(td, p, sb, ps_string_env); + ret = proc_getenvv(td, p, sb); return (ret); } Modified: stable/9/sys/fs/procfs/procfs_status.c ============================================================================== --- stable/9/sys/fs/procfs/procfs_status.c Sun Jan 29 20:39:42 2012 (r230753) +++ stable/9/sys/fs/procfs/procfs_status.c Sun Jan 29 21:08:24 2012 (r230754) @@ -170,15 +170,10 @@ procfs_doprocstatus(PFS_FILL_ARGS) int procfs_doproccmdline(PFS_FILL_ARGS) { - struct ps_strings pstr; - char **ps_argvstr; - int error, i; /* * If we are using the ps/cmdline caching, use that. Otherwise - * revert back to the old way which only implements full cmdline - * for the current process and just p->p_comm for all other - * processes. + * read argv from the process space. * Note that if the argv is no longer available, we deliberately * don't fall back on p->p_comm or return an error: the authentic * Linux behaviour is to return zero-length in this case. @@ -190,30 +185,13 @@ procfs_doproccmdline(PFS_FILL_ARGS) PROC_UNLOCK(p); return (0); } - PROC_UNLOCK(p); - if (p != td->td_proc) { - sbuf_printf(sb, "%.*s", MAXCOMLEN, p->p_comm); - } else { - error = copyin((void *)p->p_sysent->sv_psstrings, &pstr, - sizeof(pstr)); - if (error) - return (error); - if (pstr.ps_nargvstr > ARG_MAX) - return (E2BIG); - ps_argvstr = malloc(pstr.ps_nargvstr * sizeof(char *), - M_TEMP, M_WAITOK); - error = copyin((void *)pstr.ps_argvstr, ps_argvstr, - pstr.ps_nargvstr * sizeof(char *)); - if (error) { - free(ps_argvstr, M_TEMP); - return (error); - } - for (i = 0; i < pstr.ps_nargvstr; i++) { - sbuf_copyin(sb, ps_argvstr[i], 0); - sbuf_printf(sb, "%c", '\0'); - } - free(ps_argvstr, M_TEMP); + + if ((p->p_flag & P_SYSTEM) != 0) { + PROC_UNLOCK(p); + return (0); } - return (0); + PROC_UNLOCK(p); + + return (proc_getargv(td, p, sb)); } Modified: stable/9/sys/kern/kern_proc.c ============================================================================== --- stable/9/sys/kern/kern_proc.c Sun Jan 29 20:39:42 2012 (r230753) +++ stable/9/sys/kern/kern_proc.c Sun Jan 29 21:08:24 2012 (r230754) @@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -50,7 +52,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include @@ -326,6 +330,55 @@ pgfind(pgid) } /* + * Locate process and do additional manipulations, depending on flags. + */ +int +pget(pid_t pid, int flags, struct proc **pp) +{ + struct proc *p; + int error; + + p = pfind(pid); + if (p == NULL) + return (ESRCH); + if ((flags & PGET_CANSEE) != 0) { + error = p_cansee(curthread, p); + if (error != 0) + goto errout; + } + if ((flags & PGET_CANDEBUG) != 0) { + error = p_candebug(curthread, p); + if (error != 0) + goto errout; + } + if ((flags & PGET_ISCURRENT) != 0 && curproc != p) { + error = EPERM; + goto errout; + } + if ((flags & PGET_NOTWEXIT) != 0 && (p->p_flag & P_WEXIT) != 0) { + error = ESRCH; + goto errout; + } + if ((flags & PGET_NOTINEXEC) != 0 && (p->p_flag & P_INEXEC) != 0) { + /* + * XXXRW: Not clear ESRCH is the right error during proc + * execve(). + */ + error = ESRCH; + goto errout; + } + if ((flags & PGET_HOLD) != 0) { + _PHOLD(p); + PROC_UNLOCK(p); + } + *pp = p; + return (0); +errout: + PROC_UNLOCK(p); + return (error); +} + +/* * Create a new process group. * pgid must be equal to the pid of p. * Begin a new session if required. @@ -1153,7 +1206,7 @@ sysctl_out_proc(struct proc *p, struct s static int sysctl_kern_proc(SYSCTL_HANDLER_ARGS) { - int *name = (int*) arg1; + int *name = (int *)arg1; u_int namelen = arg2; struct proc *p; int flags, doingzomb, oid_number; @@ -1168,18 +1221,14 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) oid_number &= ~KERN_PROC_INC_THREAD; } if (oid_number == KERN_PROC_PID) { - if (namelen != 1) + if (namelen != 1) return (EINVAL); error = sysctl_wire_old_buffer(req, 0); if (error) - return (error); - p = pfind((pid_t)name[0]); - if (!p) - return (ESRCH); - if ((error = p_cansee(curthread, p))) { - PROC_UNLOCK(p); return (error); - } + error = pget((pid_t)name[0], PGET_CANSEE, &p); + if (error != 0) + return (error); error = sysctl_out_proc(p, req, flags); return (error); } @@ -1198,7 +1247,7 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) return (EINVAL); break; } - + if (!req->oldptr) { /* overestimate by 5 procs */ error = SYSCTL_OUT(req, 0, sizeof (struct kinfo_proc) * 5); @@ -1278,7 +1327,7 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) /* XXX proctree_lock */ SESS_LOCK(p->p_session); if (p->p_session->s_ttyp == NULL || - tty_udev(p->p_session->s_ttyp) != + tty_udev(p->p_session->s_ttyp) != (dev_t)name[0]) { SESS_UNLOCK(p->p_session); PROC_UNLOCK(p); @@ -1358,6 +1407,290 @@ pargs_drop(struct pargs *pa) pargs_free(pa); } +static int +proc_read_mem(struct thread *td, struct proc *p, vm_offset_t offset, void* buf, + size_t len) +{ + struct iovec iov; + struct uio uio; + + iov.iov_base = (caddr_t)buf; + iov.iov_len = len; + uio.uio_iov = &iov; + uio.uio_iovcnt = 1; + uio.uio_offset = offset; + uio.uio_resid = (ssize_t)len; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_rw = UIO_READ; + uio.uio_td = td; + + return (proc_rwmem(p, &uio)); +} + +static int +proc_read_string(struct thread *td, struct proc *p, const char *sptr, char *buf, + size_t len) +{ + size_t i; + int error; + + error = proc_read_mem(td, p, (vm_offset_t)sptr, buf, len); + /* + * Reading the chunk may validly return EFAULT if the string is shorter + * than the chunk and is aligned at the end of the page, assuming the + * next page is not mapped. So if EFAULT is returned do a fallback to + * one byte read loop. + */ + if (error == EFAULT) { + for (i = 0; i < len; i++, buf++, sptr++) { + error = proc_read_mem(td, p, (vm_offset_t)sptr, buf, 1); + if (error != 0) + return (error); + if (*buf == '\0') + break; + } + error = 0; + } + return (error); +} + +#define PROC_AUXV_MAX 256 /* Safety limit on auxv size. */ + +enum proc_vector_type { + PROC_ARG, + PROC_ENV, + PROC_AUX, +}; + +#ifdef COMPAT_FREEBSD32 +static int +get_proc_vector32(struct thread *td, struct proc *p, char ***proc_vectorp, + size_t *vsizep, enum proc_vector_type type) +{ + struct freebsd32_ps_strings pss; + Elf32_Auxinfo aux; + vm_offset_t vptr, ptr; + uint32_t *proc_vector32; + char **proc_vector; + size_t vsize, size; + int i, error; + + error = proc_read_mem(td, p, (vm_offset_t)(p->p_sysent->sv_psstrings), + &pss, sizeof(pss)); + if (error != 0) + return (error); + switch (type) { + case PROC_ARG: + vptr = (vm_offset_t)PTRIN(pss.ps_argvstr); + vsize = pss.ps_nargvstr; + if (vsize > ARG_MAX) + return (ENOEXEC); + size = vsize * sizeof(int32_t); + break; + case PROC_ENV: + vptr = (vm_offset_t)PTRIN(pss.ps_envstr); + vsize = pss.ps_nenvstr; + if (vsize > ARG_MAX) + return (ENOEXEC); + size = vsize * sizeof(int32_t); + break; + case PROC_AUX: + vptr = (vm_offset_t)PTRIN(pss.ps_envstr) + + (pss.ps_nenvstr + 1) * sizeof(int32_t); + if (vptr % 4 != 0) + return (ENOEXEC); + for (ptr = vptr, i = 0; i < PROC_AUXV_MAX; i++) { + error = proc_read_mem(td, p, ptr, &aux, sizeof(aux)); + if (error != 0) + return (error); + if (aux.a_type == AT_NULL) + break; + ptr += sizeof(aux); + } + if (aux.a_type != AT_NULL) + return (ENOEXEC); + vsize = i + 1; + size = vsize * sizeof(aux); + break; + default: + KASSERT(0, ("Wrong proc vector type: %d", type)); + return (EINVAL); + } + proc_vector32 = malloc(size, M_TEMP, M_WAITOK); + error = proc_read_mem(td, p, vptr, proc_vector32, size); + if (error != 0) + goto done; + if (type == PROC_AUX) { + *proc_vectorp = (char **)proc_vector32; + *vsizep = vsize; + return (0); + } + proc_vector = malloc(vsize * sizeof(char *), M_TEMP, M_WAITOK); + for (i = 0; i < (int)vsize; i++) + proc_vector[i] = PTRIN(proc_vector32[i]); + *proc_vectorp = proc_vector; + *vsizep = vsize; +done: + free(proc_vector32, M_TEMP); + return (error); +} +#endif + +static int +get_proc_vector(struct thread *td, struct proc *p, char ***proc_vectorp, + size_t *vsizep, enum proc_vector_type type) +{ + struct ps_strings pss; + Elf_Auxinfo aux; + vm_offset_t vptr, ptr; + char **proc_vector; + size_t vsize, size; + int error, i; + +#ifdef COMPAT_FREEBSD32 + if (SV_PROC_FLAG(p, SV_ILP32) != 0) + return (get_proc_vector32(td, p, proc_vectorp, vsizep, type)); +#endif + error = proc_read_mem(td, p, (vm_offset_t)(p->p_sysent->sv_psstrings), + &pss, sizeof(pss)); + if (error != 0) + return (error); + switch (type) { + case PROC_ARG: + vptr = (vm_offset_t)pss.ps_argvstr; + vsize = pss.ps_nargvstr; + if (vsize > ARG_MAX) + return (ENOEXEC); + size = vsize * sizeof(char *); + break; + case PROC_ENV: + vptr = (vm_offset_t)pss.ps_envstr; + vsize = pss.ps_nenvstr; + if (vsize > ARG_MAX) + return (ENOEXEC); + size = vsize * sizeof(char *); + break; + case PROC_AUX: + /* + * The aux array is just above env array on the stack. Check + * that the address is naturally aligned. + */ + vptr = (vm_offset_t)pss.ps_envstr + (pss.ps_nenvstr + 1) + * sizeof(char *); +#if __ELF_WORD_SIZE == 64 + if (vptr % sizeof(uint64_t) != 0) +#else + if (vptr % sizeof(uint32_t) != 0) +#endif + return (ENOEXEC); + /* + * We count the array size reading the aux vectors from the + * stack until AT_NULL vector is returned. So (to keep the code + * simple) we read the process stack twice: the first time here + * to find the size and the second time when copying the vectors + * to the allocated proc_vector. + */ + for (ptr = vptr, i = 0; i < PROC_AUXV_MAX; i++) { + error = proc_read_mem(td, p, ptr, &aux, sizeof(aux)); + if (error != 0) + return (error); + if (aux.a_type == AT_NULL) + break; + ptr += sizeof(aux); + } + /* + * If the PROC_AUXV_MAX entries are iterated over, and we have + * not reached AT_NULL, it is most likely we are reading wrong + * data: either the process doesn't have auxv array or data has + * been modified. Return the error in this case. + */ + if (aux.a_type != AT_NULL) + return (ENOEXEC); + vsize = i + 1; + size = vsize * sizeof(aux); + break; + default: + KASSERT(0, ("Wrong proc vector type: %d", type)); + return (EINVAL); /* In case we are built without INVARIANTS. */ + } + proc_vector = malloc(size, M_TEMP, M_WAITOK); + if (proc_vector == NULL) + return (ENOMEM); + error = proc_read_mem(td, p, vptr, proc_vector, size); + if (error != 0) { + free(proc_vector, M_TEMP); + return (error); + } + *proc_vectorp = proc_vector; + *vsizep = vsize; + + return (0); +} + +#define GET_PS_STRINGS_CHUNK_SZ 256 /* Chunk size (bytes) for ps_strings operations. */ + +static int +get_ps_strings(struct thread *td, struct proc *p, struct sbuf *sb, + enum proc_vector_type type) +{ + size_t done, len, nchr, vsize; + int error, i; + char **proc_vector, *sptr; + char pss_string[GET_PS_STRINGS_CHUNK_SZ]; + + PROC_ASSERT_HELD(p); + + /* + * We are not going to read more than 2 * (PATH_MAX + ARG_MAX) bytes. + */ + nchr = 2 * (PATH_MAX + ARG_MAX); + + error = get_proc_vector(td, p, &proc_vector, &vsize, type); + if (error != 0) + return (error); + for (done = 0, i = 0; i < (int)vsize && done < nchr; i++) { + /* + * The program may have scribbled into its argv array, e.g. to + * remove some arguments. If that has happened, break out + * before trying to read from NULL. + */ + if (proc_vector[i] == NULL) + break; + for (sptr = proc_vector[i]; ; sptr += GET_PS_STRINGS_CHUNK_SZ) { + error = proc_read_string(td, p, sptr, pss_string, + sizeof(pss_string)); + if (error != 0) + goto done; + len = strnlen(pss_string, GET_PS_STRINGS_CHUNK_SZ); + if (done + len >= nchr) + len = nchr - done - 1; + sbuf_bcat(sb, pss_string, len); + if (len != GET_PS_STRINGS_CHUNK_SZ) + break; + done += GET_PS_STRINGS_CHUNK_SZ; + } + sbuf_bcat(sb, "", 1); + done += len + 1; + } +done: + free(proc_vector, M_TEMP); + return (error); +} + +int +proc_getargv(struct thread *td, struct proc *p, struct sbuf *sb) +{ + + return (get_ps_strings(curthread, p, sb, PROC_ARG)); +} + +int +proc_getenvv(struct thread *td, struct proc *p, struct sbuf *sb) +{ + + return (get_ps_strings(curthread, p, sb, PROC_ENV)); +} + /* * This sysctl allows a process to retrieve the argument list or process * title for another process without groping around in the address space @@ -1367,35 +1700,42 @@ pargs_drop(struct pargs *pa) static int sysctl_kern_proc_args(SYSCTL_HANDLER_ARGS) { - int *name = (int*) arg1; + int *name = (int *)arg1; u_int namelen = arg2; struct pargs *newpa, *pa; struct proc *p; - int error = 0; + struct sbuf sb; + int flags, error = 0, error2; - if (namelen != 1) + if (namelen != 1) return (EINVAL); - p = pfind((pid_t)name[0]); - if (!p) - return (ESRCH); - - if ((error = p_cansee(curthread, p)) != 0) { - PROC_UNLOCK(p); + flags = PGET_CANSEE; + if (req->newptr != NULL) + flags |= PGET_ISCURRENT; + error = pget((pid_t)name[0], flags, &p); + if (error) return (error); - } - - if (req->newptr && curproc != p) { - PROC_UNLOCK(p); - return (EPERM); - } pa = p->p_args; - pargs_hold(pa); - PROC_UNLOCK(p); - if (pa != NULL) + if (pa != NULL) { + pargs_hold(pa); + PROC_UNLOCK(p); error = SYSCTL_OUT(req, pa->ar_args, pa->ar_length); - pargs_drop(pa); + pargs_drop(pa); + } else if ((p->p_flag & (P_WEXIT | P_SYSTEM)) == 0) { + _PHOLD(p); + PROC_UNLOCK(p); + sbuf_new_for_sysctl(&sb, NULL, GET_PS_STRINGS_CHUNK_SZ, req); + error = proc_getargv(curthread, p, &sb); + error2 = sbuf_finish(&sb); + PRELE(p); + sbuf_delete(&sb); + if (error == 0 && error2 != 0) + error = error2; + } else { + PROC_UNLOCK(p); + } if (error != 0 || req->newptr == NULL) return (error); @@ -1416,6 +1756,78 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARG } /* + * This sysctl allows a process to retrieve environment of another process. + */ +static int +sysctl_kern_proc_env(SYSCTL_HANDLER_ARGS) +{ + int *name = (int *)arg1; + u_int namelen = arg2; + struct proc *p; + struct sbuf sb; + int error, error2; + + if (namelen != 1) + return (EINVAL); + + error = pget((pid_t)name[0], PGET_WANTREAD, &p); + if (error != 0) + return (error); + if ((p->p_flag & P_SYSTEM) != 0) { + PRELE(p); + return (0); + } + + sbuf_new_for_sysctl(&sb, NULL, GET_PS_STRINGS_CHUNK_SZ, req); + error = proc_getenvv(curthread, p, &sb); + error2 = sbuf_finish(&sb); + PRELE(p); + sbuf_delete(&sb); + return (error != 0 ? error : error2); +} + +/* + * This sysctl allows a process to retrieve ELF auxiliary vector of + * another process. + */ +static int +sysctl_kern_proc_auxv(SYSCTL_HANDLER_ARGS) +{ + int *name = (int *)arg1; + u_int namelen = arg2; + struct proc *p; + size_t vsize, size; + char **auxv; + int error; + + if (namelen != 1) + return (EINVAL); + + error = pget((pid_t)name[0], PGET_WANTREAD, &p); + if (error != 0) + return (error); + if ((p->p_flag & P_SYSTEM) != 0) { + PRELE(p); + return (0); + } + error = get_proc_vector(curthread, p, &auxv, &vsize, PROC_AUX); + if (error == 0) { +#ifdef COMPAT_FREEBSD32 + if (SV_PROC_FLAG(p, SV_ILP32) != 0) + size = vsize * sizeof(Elf32_Auxinfo); + else +#endif + size = vsize * sizeof(Elf_Auxinfo); + PRELE(p); + error = SYSCTL_OUT(req, auxv, size); + free(auxv, M_TEMP); + } else { + PRELE(p); + } + return (error); +} + +/* * This sysctl allows a process to retrieve the path of the executable for * itself or another process. */ @@ -1434,13 +1846,9 @@ sysctl_kern_proc_pathname(SYSCTL_HANDLER if (*pidp == -1) { /* -1 means this process */ p = req->td->td_proc; } else { - p = pfind(*pidp); - if (p == NULL) - return (ESRCH); - if ((error = p_cansee(curthread, p)) != 0) { - PROC_UNLOCK(p); + error = pget(*pidp, PGET_CANSEE, &p); + if (error != 0) return (error); - } } vp = p->p_textvp; @@ -1473,16 +1881,13 @@ sysctl_kern_proc_sv_name(SYSCTL_HANDLER_ int error; namelen = arg2; - if (namelen != 1) + if (namelen != 1) return (EINVAL); name = (int *)arg1; - if ((p = pfind((pid_t)name[0])) == NULL) - return (ESRCH); - if ((error = p_cansee(curthread, p))) { - PROC_UNLOCK(p); + error = pget((pid_t)name[0], PGET_CANSEE, &p); + if (error != 0) return (error); - } sv_name = p->p_sysent->sv_name; PROC_UNLOCK(p); return (sysctl_handle_string(oidp, sv_name, 0, req)); @@ -1509,18 +1914,9 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A struct vmspace *vm; name = (int *)arg1; - if ((p = pfind((pid_t)name[0])) == NULL) - return (ESRCH); - if (p->p_flag & P_WEXIT) { - PROC_UNLOCK(p); - return (ESRCH); - } - if ((error = p_candebug(curthread, p))) { - PROC_UNLOCK(p); + error = pget((pid_t)name[0], PGET_WANTREAD, &p); + if (error != 0) return (error); - } - _PHOLD(p); - PROC_UNLOCK(p); vm = vmspace_acquire_ref(p); if (vm == NULL) { PRELE(p); @@ -1687,18 +2083,9 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR vm_map_t map; name = (int *)arg1; - if ((p = pfind((pid_t)name[0])) == NULL) - return (ESRCH); - if (p->p_flag & P_WEXIT) { - PROC_UNLOCK(p); - return (ESRCH); - } - if ((error = p_candebug(curthread, p))) { - PROC_UNLOCK(p); + error = pget((pid_t)name[0], PGET_WANTREAD, &p); + if (error != 0) return (error); - } - _PHOLD(p); - PROC_UNLOCK(p); vm = vmspace_acquire_ref(p); if (vm == NULL) { PRELE(p); @@ -1872,19 +2259,9 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_A struct proc *p; name = (int *)arg1; - if ((p = pfind((pid_t)name[0])) == NULL) - return (ESRCH); - /* XXXRW: Not clear ESRCH is the right error during proc execve(). */ - if (p->p_flag & P_WEXIT || p->p_flag & P_INEXEC) { - PROC_UNLOCK(p); - return (ESRCH); - } - if ((error = p_candebug(curthread, p))) { - PROC_UNLOCK(p); + error = pget((pid_t)name[0], PGET_NOTINEXEC | PGET_WANTREAD, &p); + if (error != 0) return (error); - } - _PHOLD(p); - PROC_UNLOCK(p); kkstp = malloc(sizeof(*kkstp), M_TEMP, M_WAITOK); st = stack_create(); @@ -1979,13 +2356,9 @@ sysctl_kern_proc_groups(SYSCTL_HANDLER_A if (*pidp == -1) { /* -1 means this process */ p = req->td->td_proc; } else { - p = pfind(*pidp); - if (p == NULL) - return (ESRCH); - if ((error = p_cansee(curthread, p)) != 0) { - PROC_UNLOCK(p); + error = pget(*pidp, PGET_CANSEE, &p); + if (error != 0) return (error); - } } cred = crhold(p->p_ucred); @@ -1998,6 +2371,106 @@ sysctl_kern_proc_groups(SYSCTL_HANDLER_A return (error); } +/* + * This sysctl allows a process to retrieve or/and set the resource limit for + * another process. + */ +static int +sysctl_kern_proc_rlimit(SYSCTL_HANDLER_ARGS) +{ + int *name = (int *)arg1; + u_int namelen = arg2; + struct rlimit rlim; + struct proc *p; + u_int which; + int flags, error; + + if (namelen != 2) + return (EINVAL); + + which = (u_int)name[1]; + if (which >= RLIM_NLIMITS) + return (EINVAL); + + if (req->newptr != NULL && req->newlen != sizeof(rlim)) + return (EINVAL); + + flags = PGET_HOLD | PGET_NOTWEXIT; + if (req->newptr != NULL) + flags |= PGET_CANDEBUG; + else + flags |= PGET_CANSEE; + error = pget((pid_t)name[0], flags, &p); + if (error != 0) + return (error); + + /* + * Retrieve limit. + */ + if (req->oldptr != NULL) { + PROC_LOCK(p); + lim_rlimit(p, which, &rlim); + PROC_UNLOCK(p); + } + error = SYSCTL_OUT(req, &rlim, sizeof(rlim)); + if (error != 0) + goto errout; + + /* + * Set limit. + */ + if (req->newptr != NULL) { + error = SYSCTL_IN(req, &rlim, sizeof(rlim)); + if (error == 0) + error = kern_proc_setrlimit(curthread, p, which, &rlim); + } + +errout: + PRELE(p); + return (error); +} + +/* + * This sysctl allows a process to retrieve ps_strings structure location of + * another process. + */ +static int +sysctl_kern_proc_ps_strings(SYSCTL_HANDLER_ARGS) +{ + int *name = (int *)arg1; + u_int namelen = arg2; + struct proc *p; + vm_offset_t ps_strings; + int error; +#ifdef COMPAT_FREEBSD32 + uint32_t ps_strings32; +#endif + + if (namelen != 1) + return (EINVAL); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 21:13:36 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5DBC106566B; Sun, 29 Jan 2012 21:13:36 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F93C8FC0C; Sun, 29 Jan 2012 21:13:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TLDaeh052924; Sun, 29 Jan 2012 21:13:36 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TLDaZf052922; Sun, 29 Jan 2012 21:13:36 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201292113.q0TLDaZf052922@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 29 Jan 2012 21:13:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230755 - stable/9/sys/compat/linprocfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 21:13:36 -0000 Author: trociny Date: Sun Jan 29 21:13:36 2012 New Revision: 230755 URL: http://svn.freebsd.org/changeset/base/230755 Log: MFC r228268: Protect process environment variables with p_candebug(). Discussed with: jilles, kib, rwatson Modified: stable/9/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/9/sys/compat/linprocfs/linprocfs.c Sun Jan 29 21:08:24 2012 (r230754) +++ stable/9/sys/compat/linprocfs/linprocfs.c Sun Jan 29 21:13:36 2012 (r230755) @@ -967,7 +967,7 @@ linprocfs_doprocenviron(PFS_FILL_ARGS) int ret; PROC_LOCK(p); - if ((ret = p_cansee(td, p)) != 0) { + if ((ret = p_candebug(td, p)) != 0) { PROC_UNLOCK(p); return (ret); } From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 21:58:18 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C57A8106564A; Sun, 29 Jan 2012 21:58:18 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF91D8FC14; Sun, 29 Jan 2012 21:58:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TLwI9V054499; Sun, 29 Jan 2012 21:58:18 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TLwIVB054497; Sun, 29 Jan 2012 21:58:18 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201292158.q0TLwIVB054497@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 29 Jan 2012 21:58:18 +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: r230757 - stable/8/sys/compat/linprocfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 21:58:18 -0000 Author: trociny Date: Sun Jan 29 21:58:18 2012 New Revision: 230757 URL: http://svn.freebsd.org/changeset/base/230757 Log: MFC r228268: Protect process environment variables with p_candebug(). Discussed with: jilles, kib, rwatson Modified: stable/8/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/8/sys/compat/linprocfs/linprocfs.c Sun Jan 29 21:44:25 2012 (r230756) +++ stable/8/sys/compat/linprocfs/linprocfs.c Sun Jan 29 21:58:18 2012 (r230757) @@ -1102,7 +1102,7 @@ linprocfs_doprocenviron(PFS_FILL_ARGS) int ret; PROC_LOCK(p); - if ((ret = p_cansee(td, p)) != 0) { + if ((ret = p_candebug(td, p)) != 0) { PROC_UNLOCK(p); return (ret); } From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 23:04:30 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DE4E1065670; Sun, 29 Jan 2012 23:04:30 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB3A58FC18; Sun, 29 Jan 2012 23:04:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TN4THD056801; Sun, 29 Jan 2012 23:04:29 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TN4TBG056799; Sun, 29 Jan 2012 23:04:29 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201201292304.q0TN4TBG056799@svn.freebsd.org> From: Kirk McKusick Date: Sun, 29 Jan 2012 23:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230760 - stable/9/sys/ufs/ffs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 23:04:30 -0000 Author: mckusick Date: Sun Jan 29 23:04:29 2012 New Revision: 230760 URL: http://svn.freebsd.org/changeset/base/230760 Log: MFC r230101: Convert FFS mount error messages from kernel printf's to using the vfs_mount_error error message facility provided by the nmount interface. Clean up formatting of mount warnings which still need to use kernel printf's since they do not return errors. Requested by: Craig Rodrigues Modified: stable/9/sys/ufs/ffs/ffs_vfsops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_vfsops.c Sun Jan 29 22:20:28 2012 (r230759) +++ stable/9/sys/ufs/ffs/ffs_vfsops.c Sun Jan 29 23:04:29 2012 (r230760) @@ -196,11 +196,13 @@ ffs_mount(struct mount *mp) if (mp->mnt_flag & MNT_UPDATE) { if (VFSTOUFS(mp)->um_fs->fs_ronly == 0 && vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) == 0) { - printf("Checker enable: Must be read-only\n"); + vfs_mount_error(mp, + "Checker enable: Must be read-only"); return (EINVAL); } } else if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) == 0) { - printf("Checker enable: Must be read-only\n"); + vfs_mount_error(mp, + "Checker enable: Must be read-only"); return (EINVAL); } /* Set to -1 if we are done */ @@ -210,8 +212,9 @@ ffs_mount(struct mount *mp) if (vfs_getopt(mp->mnt_optnew, "nfsv4acls", NULL, NULL) == 0) { if (mntorflags & MNT_ACLS) { - printf("WARNING: \"acls\" and \"nfsv4acls\" " - "options are mutually exclusive\n"); + vfs_mount_error(mp, + "\"acls\" and \"nfsv4acls\" options " + "are mutually exclusive"); return (EINVAL); } mntorflags |= MNT_NFS4ACLS; @@ -292,8 +295,8 @@ ffs_mount(struct mount *mp) } if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { - printf("%s: %s: blocks %jd files %d\n", - fs->fs_fsmnt, "update error", + printf("WARNING: %s Update error: blocks %jd " + "files %d\n", fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, fs->fs_pendinginodes); fs->fs_pendingblocks = 0; @@ -336,7 +339,8 @@ ffs_mount(struct mount *mp) * If we are running a checker, do not allow upgrade. */ if (ump->um_fsckpid > 0) { - printf("Active checker, cannot rw upgrade\n"); + vfs_mount_error(mp, + "Active checker, cannot upgrade to write"); return (EINVAL); } /* @@ -360,15 +364,16 @@ ffs_mount(struct mount *mp) ((fs->fs_flags & (FS_SUJ | FS_NEEDSFSCK)) == 0 && (fs->fs_flags & FS_DOSOFTDEP))) { - printf("WARNING: %s was not %s\n", - fs->fs_fsmnt, "properly dismounted"); + printf("WARNING: %s was not properly " + "dismounted\n", fs->fs_fsmnt); } else { - printf( -"WARNING: R/W mount of %s denied. Filesystem is not clean - run fsck\n", - fs->fs_fsmnt); - if (fs->fs_flags & FS_SUJ) - printf( -"WARNING: Forced mount will invalidate journal contents\n"); + vfs_mount_error(mp, + "R/W mount of %s denied. %s.%s", + fs->fs_fsmnt, + "Filesystem is not clean - run fsck", + (fs->fs_flags & FS_SUJ) == 0 ? "" : + " Forced mount will invalidate" + " journal contents"); return (EPERM); } } @@ -439,7 +444,8 @@ ffs_mount(struct mount *mp) */ if (fsckpid > 0) { if (ump->um_fsckpid != 0) { - printf("Active checker already running on %s\n", + vfs_mount_error(mp, + "Active checker already running on %s", fs->fs_fsmnt); return (EINVAL); } @@ -454,7 +460,8 @@ ffs_mount(struct mount *mp) g_topology_unlock(); PICKUP_GIANT(); if (error) { - printf("Checker activation failed on %s\n", + vfs_mount_error(mp, + "Checker activation failed on %s", fs->fs_fsmnt); return (error); } @@ -543,8 +550,8 @@ ffs_mount(struct mount *mp) g_topology_unlock(); PICKUP_GIANT(); if (error) { - printf("Checker activation failed on %s\n", - fs->fs_fsmnt); + printf("WARNING: %s: Checker activation " + "failed\n", fs->fs_fsmnt); } else { ump->um_fsckpid = fsckpid; if (fs->fs_snapinum[0] != 0) @@ -655,8 +662,8 @@ ffs_reload(struct mount *mp, struct thre ffs_oldfscompat_read(fs, VFSTOUFS(mp), sblockloc); UFS_LOCK(ump); if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { - printf("%s: reload pending error: blocks %jd files %d\n", - fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, + printf("WARNING: %s: reload pending error: blocks %jd " + "files %d\n", fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, fs->fs_pendinginodes); fs->fs_pendingblocks = 0; fs->fs_pendinginodes = 0; @@ -822,27 +829,25 @@ ffs_mountfs(devvp, mp, td) printf("WARNING: %s was not properly dismounted\n", fs->fs_fsmnt); } else { - printf( -"WARNING: R/W mount of %s denied. Filesystem is not clean - run fsck\n", - fs->fs_fsmnt); - if (fs->fs_flags & FS_SUJ) - printf( -"WARNING: Forced mount will invalidate journal contents\n"); + vfs_mount_error(mp, "R/W mount of %s denied. %s%s", + fs->fs_fsmnt, "Filesystem is not clean - run fsck.", + (fs->fs_flags & FS_SUJ) == 0 ? "" : + " Forced mount will invalidate journal contents"); error = EPERM; goto out; } if ((fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) && (mp->mnt_flag & MNT_FORCE)) { - printf("%s: lost blocks %jd files %d\n", fs->fs_fsmnt, - (intmax_t)fs->fs_pendingblocks, + printf("WARNING: %s: lost blocks %jd files %d\n", + fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, fs->fs_pendinginodes); fs->fs_pendingblocks = 0; fs->fs_pendinginodes = 0; } } if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { - printf("%s: mount pending error: blocks %jd files %d\n", - fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, + printf("WARNING: %s: mount pending error: blocks %jd " + "files %d\n", fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, fs->fs_pendinginodes); fs->fs_pendingblocks = 0; fs->fs_pendinginodes = 0; @@ -862,16 +867,15 @@ ffs_mountfs(devvp, mp, td) mp->mnt_flag |= MNT_GJOURNAL; MNT_IUNLOCK(mp); } else { - printf( -"WARNING: %s: GJOURNAL flag on fs but no gjournal provider below\n", + printf("WARNING: %s: GJOURNAL flag on fs " + "but no gjournal provider below\n", mp->mnt_stat.f_mntonname); free(mp->mnt_gjprovider, M_UFSMNT); mp->mnt_gjprovider = NULL; } #else - printf( -"WARNING: %s: GJOURNAL flag on fs but no UFS_GJOURNAL support\n", - mp->mnt_stat.f_mntonname); + printf("WARNING: %s: GJOURNAL flag on fs but no " + "UFS_GJOURNAL support\n", mp->mnt_stat.f_mntonname); #endif } else { mp->mnt_gjprovider = NULL; @@ -955,9 +959,8 @@ ffs_mountfs(devvp, mp, td) mp->mnt_flag |= MNT_MULTILABEL; MNT_IUNLOCK(mp); #else - printf( -"WARNING: %s: multilabel flag on fs but no MAC support\n", - mp->mnt_stat.f_mntonname); + printf("WARNING: %s: multilabel flag on fs but " + "no MAC support\n", mp->mnt_stat.f_mntonname); #endif } if ((fs->fs_flags & FS_ACLS) != 0) { @@ -965,8 +968,9 @@ ffs_mountfs(devvp, mp, td) MNT_ILOCK(mp); if (mp->mnt_flag & MNT_NFS4ACLS) - printf("WARNING: ACLs flag on fs conflicts with " - "\"nfsv4acls\" mount option; option ignored\n"); + printf("WARNING: %s: ACLs flag on fs conflicts with " + "\"nfsv4acls\" mount option; option ignored\n", + mp->mnt_stat.f_mntonname); mp->mnt_flag &= ~MNT_NFS4ACLS; mp->mnt_flag |= MNT_ACLS; @@ -981,16 +985,16 @@ ffs_mountfs(devvp, mp, td) MNT_ILOCK(mp); if (mp->mnt_flag & MNT_ACLS) - printf("WARNING: NFSv4 ACLs flag on fs conflicts with " - "\"acls\" mount option; option ignored\n"); + printf("WARNING: %s: NFSv4 ACLs flag on fs conflicts " + "with \"acls\" mount option; option ignored\n", + mp->mnt_stat.f_mntonname); mp->mnt_flag &= ~MNT_ACLS; mp->mnt_flag |= MNT_NFS4ACLS; MNT_IUNLOCK(mp); #else - printf( -"WARNING: %s: NFSv4 ACLs flag on fs but no ACLs support\n", - mp->mnt_stat.f_mntonname); + printf("WARNING: %s: NFSv4 ACLs flag on fs but no " + "ACLs support\n", mp->mnt_stat.f_mntonname); #endif } if ((fs->fs_flags & FS_TRIM) != 0) { @@ -998,12 +1002,12 @@ ffs_mountfs(devvp, mp, td) if (g_io_getattr("GEOM::candelete", cp, &size, &ump->um_candelete) == 0) { if (!ump->um_candelete) - printf( -"WARNING: %s: TRIM flag on fs but disk does not support TRIM\n", + printf("WARNING: %s: TRIM flag on fs but disk " + "does not support TRIM\n", mp->mnt_stat.f_mntonname); } else { - printf( -"WARNING: %s: TRIM flag on fs but cannot get whether disk supports TRIM\n", + printf("WARNING: %s: TRIM flag on fs but disk does " + "not confirm that it supports TRIM\n", mp->mnt_stat.f_mntonname); ump->um_candelete = 0; } @@ -1210,15 +1214,16 @@ ffs_unmount(mp, mntflags) flags = 0; td = curthread; fs = ump->um_fs; + susp = 0; if (mntflags & MNT_FORCE) { flags |= FORCECLOSE; susp = fs->fs_ronly != 0; - } else - susp = 0; + } #ifdef UFS_EXTATTR if ((error = ufs_extattr_stop(mp, td))) { if (error != EOPNOTSUPP) - printf("ffs_unmount: ufs_extattr_stop returned %d\n", + printf("WARNING: unmount %s: ufs_extattr_stop " + "returned errno %d\n", mp->mnt_stat.f_mntonname, error); e_restart = 0; } else { @@ -1256,8 +1261,8 @@ ffs_unmount(mp, mntflags) UFS_LOCK(ump); if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { - printf("%s: unmount pending error: blocks %jd files %d\n", - fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, + printf("WARNING: unmount %s: pending error: blocks %jd " + "files %d\n", fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, fs->fs_pendinginodes); fs->fs_pendingblocks = 0; fs->fs_pendinginodes = 0; @@ -1433,10 +1438,9 @@ ffs_sync(mp, waitfor) td = curthread; fs = ump->um_fs; - if (fs->fs_fmod != 0 && fs->fs_ronly != 0 && ump->um_fsckpid == 0) { - printf("fs = %s\n", fs->fs_fsmnt); - panic("ffs_sync: rofs mod"); - } + if (fs->fs_fmod != 0 && fs->fs_ronly != 0 && ump->um_fsckpid == 0) + panic("%s: ffs_sync: modification on read-only filesystem", + fs->fs_fsmnt); /* * Write back each (modified) inode. */ @@ -1844,13 +1848,13 @@ ffs_sbupdate(ump, waitfor, suspended) bp = sbbp; if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_sblockloc != SBLOCK_UFS1 && (fs->fs_flags & FS_FLAGS_UPDATED) == 0) { - printf("%s: correcting fs_sblockloc from %jd to %d\n", + printf("WARNING: %s: correcting fs_sblockloc from %jd to %d\n", fs->fs_fsmnt, fs->fs_sblockloc, SBLOCK_UFS1); fs->fs_sblockloc = SBLOCK_UFS1; } if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_sblockloc != SBLOCK_UFS2 && (fs->fs_flags & FS_FLAGS_UPDATED) == 0) { - printf("%s: correcting fs_sblockloc from %jd to %d\n", + printf("WARNING: %s: correcting fs_sblockloc from %jd to %d\n", fs->fs_fsmnt, fs->fs_sblockloc, SBLOCK_UFS2); fs->fs_sblockloc = SBLOCK_UFS2; } From owner-svn-src-stable@FreeBSD.ORG Mon Jan 30 05:45:12 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B5BF106566B; Mon, 30 Jan 2012 05:45:12 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 53D878FC15; Mon, 30 Jan 2012 05:45:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0U5jC7g069666; Mon, 30 Jan 2012 05:45:12 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0U5jCbV069664; Mon, 30 Jan 2012 05:45:12 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201201300545.q0U5jCbV069664@svn.freebsd.org> From: Kirk McKusick Date: Mon, 30 Jan 2012 05:45:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230762 - stable/8/sys/ufs/ffs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2012 05:45:12 -0000 Author: mckusick Date: Mon Jan 30 05:45:11 2012 New Revision: 230762 URL: http://svn.freebsd.org/changeset/base/230762 Log: MFC r230101: Convert FFS mount error messages from kernel printf's to using the vfs_mount_error error message facility provided by the nmount interface. Clean up formatting of mount warnings which still need to use kernel printf's since they do not return errors. Requested by: Craig Rodrigues Modified: stable/8/sys/ufs/ffs/ffs_vfsops.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) Modified: stable/8/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/8/sys/ufs/ffs/ffs_vfsops.c Mon Jan 30 00:27:02 2012 (r230761) +++ stable/8/sys/ufs/ffs/ffs_vfsops.c Mon Jan 30 05:45:11 2012 (r230762) @@ -188,8 +188,9 @@ ffs_mount(struct mount *mp) if (vfs_getopt(mp->mnt_optnew, "nfsv4acls", NULL, NULL) == 0) { if (mntorflags & MNT_ACLS) { - printf("WARNING: \"acls\" and \"nfsv4acls\" " - "options are mutually exclusive\n"); + vfs_mount_error(mp, + "\"acls\" and \"nfsv4acls\" options " + "are mutually exclusive"); return (EINVAL); } mntorflags |= MNT_NFS4ACLS; @@ -256,8 +257,8 @@ ffs_mount(struct mount *mp) } if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { - printf("%s: %s: blocks %jd files %d\n", - fs->fs_fsmnt, "update error", + printf("WARNING: %s Update error: blocks %jd " + "files %d\n", fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, fs->fs_pendinginodes); fs->fs_pendingblocks = 0; @@ -311,12 +312,13 @@ ffs_mount(struct mount *mp) if ((mp->mnt_flag & MNT_FORCE) || ((fs->fs_flags & FS_NEEDSFSCK) == 0 && (fs->fs_flags & FS_DOSOFTDEP))) { - printf("WARNING: %s was not %s\n", - fs->fs_fsmnt, "properly dismounted"); + printf("WARNING: %s was not properly " + "dismounted\n", fs->fs_fsmnt); } else { - printf( -"WARNING: R/W mount of %s denied. Filesystem is not clean - run fsck\n", - fs->fs_fsmnt); + vfs_mount_error(mp, + "R/W mount of %s denied. %s.", + fs->fs_fsmnt, + "Filesystem is not clean - run fsck"); return (EPERM); } } @@ -548,8 +550,8 @@ ffs_reload(struct mount *mp, struct thre ffs_oldfscompat_read(fs, VFSTOUFS(mp), sblockloc); UFS_LOCK(ump); if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { - printf("%s: reload pending error: blocks %jd files %d\n", - fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, + printf("WARNING: %s: reload pending error: blocks %jd " + "files %d\n", fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, fs->fs_pendinginodes); fs->fs_pendingblocks = 0; fs->fs_pendinginodes = 0; @@ -723,24 +725,23 @@ ffs_mountfs(devvp, mp, td) "WARNING: %s was not properly dismounted\n", fs->fs_fsmnt); } else { - printf( -"WARNING: R/W mount of %s denied. Filesystem is not clean - run fsck\n", - fs->fs_fsmnt); + vfs_mount_error(mp, "R/W mount of %s denied. %s.", + fs->fs_fsmnt, "Filesystem is not clean - run fsck"); error = EPERM; goto out; } if ((fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) && (mp->mnt_flag & MNT_FORCE)) { - printf("%s: lost blocks %jd files %d\n", fs->fs_fsmnt, - (intmax_t)fs->fs_pendingblocks, + printf("WARNING: %s: lost blocks %jd files %d\n", + fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, fs->fs_pendinginodes); fs->fs_pendingblocks = 0; fs->fs_pendinginodes = 0; } } if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { - printf("%s: mount pending error: blocks %jd files %d\n", - fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, + printf("WARNING: %s: mount pending error: blocks %jd " + "files %d\n", fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, fs->fs_pendinginodes); fs->fs_pendingblocks = 0; fs->fs_pendinginodes = 0; @@ -760,16 +761,15 @@ ffs_mountfs(devvp, mp, td) mp->mnt_flag |= MNT_GJOURNAL; MNT_IUNLOCK(mp); } else { - printf( -"WARNING: %s: GJOURNAL flag on fs but no gjournal provider below\n", + printf("WARNING: %s: GJOURNAL flag on fs " + "but no gjournal provider below\n", mp->mnt_stat.f_mntonname); free(mp->mnt_gjprovider, M_UFSMNT); mp->mnt_gjprovider = NULL; } #else - printf( -"WARNING: %s: GJOURNAL flag on fs but no UFS_GJOURNAL support\n", - mp->mnt_stat.f_mntonname); + printf("WARNING: %s: GJOURNAL flag on fs but no " + "UFS_GJOURNAL support\n", mp->mnt_stat.f_mntonname); #endif } else { mp->mnt_gjprovider = NULL; @@ -853,9 +853,8 @@ ffs_mountfs(devvp, mp, td) mp->mnt_flag |= MNT_MULTILABEL; MNT_IUNLOCK(mp); #else - printf( -"WARNING: %s: multilabel flag on fs but no MAC support\n", - mp->mnt_stat.f_mntonname); + printf("WARNING: %s: multilabel flag on fs but " + "no MAC support\n", mp->mnt_stat.f_mntonname); #endif } if ((fs->fs_flags & FS_ACLS) != 0) { @@ -863,8 +862,9 @@ ffs_mountfs(devvp, mp, td) MNT_ILOCK(mp); if (mp->mnt_flag & MNT_NFS4ACLS) - printf("WARNING: ACLs flag on fs conflicts with " - "\"nfsv4acls\" mount option; option ignored\n"); + printf("WARNING: %s: ACLs flag on fs conflicts with " + "\"nfsv4acls\" mount option; option ignored\n", + mp->mnt_stat.f_mntonname); mp->mnt_flag &= ~MNT_NFS4ACLS; mp->mnt_flag |= MNT_ACLS; @@ -880,16 +880,16 @@ ffs_mountfs(devvp, mp, td) MNT_ILOCK(mp); if (mp->mnt_flag & MNT_ACLS) - printf("WARNING: NFSv4 ACLs flag on fs conflicts with " - "\"acls\" mount option; option ignored\n"); + printf("WARNING: %s: NFSv4 ACLs flag on fs conflicts " + "with \"acls\" mount option; option ignored\n", + mp->mnt_stat.f_mntonname); mp->mnt_flag &= ~MNT_ACLS; mp->mnt_flag |= MNT_NFS4ACLS; MNT_IUNLOCK(mp); #else - printf( -"WARNING: %s: NFSv4 ACLs flag on fs but no ACLs support\n", - mp->mnt_stat.f_mntonname); + printf("WARNING: %s: NFSv4 ACLs flag on fs but no " + "ACLs support\n", mp->mnt_stat.f_mntonname); #endif } if ((fs->fs_flags & FS_TRIM) != 0) { @@ -897,12 +897,12 @@ ffs_mountfs(devvp, mp, td) if (g_io_getattr("GEOM::candelete", cp, &size, &ump->um_candelete) == 0) { if (!ump->um_candelete) - printf( -"WARNING: %s: TRIM flag on fs but disk does not support TRIM\n", + printf("WARNING: %s: TRIM flag on fs but disk " + "does not support TRIM\n", mp->mnt_stat.f_mntonname); } else { - printf( -"WARNING: %s: TRIM flag on fs but cannot get whether disk supports TRIM\n", + printf("WARNING: %s: TRIM flag on fs but disk does " + "not confirm that it supports TRIM\n", mp->mnt_stat.f_mntonname); ump->um_candelete = 0; } @@ -1107,15 +1107,16 @@ ffs_unmount(mp, mntflags) flags = 0; td = curthread; fs = ump->um_fs; + susp = 0; if (mntflags & MNT_FORCE) { flags |= FORCECLOSE; susp = fs->fs_ronly != 0; - } else - susp = 0; + } #ifdef UFS_EXTATTR if ((error = ufs_extattr_stop(mp, td))) { if (error != EOPNOTSUPP) - printf("ffs_unmount: ufs_extattr_stop returned %d\n", + printf("WARNING: unmount %s: ufs_extattr_stop " + "returned errno %d\n", mp->mnt_stat.f_mntonname, error); e_restart = 0; } else { @@ -1153,8 +1154,8 @@ ffs_unmount(mp, mntflags) UFS_LOCK(ump); if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { - printf("%s: unmount pending error: blocks %jd files %d\n", - fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, + printf("WARNING: unmount %s: pending error: blocks %jd " + "files %d\n", fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks, fs->fs_pendinginodes); fs->fs_pendingblocks = 0; fs->fs_pendinginodes = 0; @@ -1322,10 +1323,9 @@ ffs_sync(mp, waitfor) td = curthread; fs = ump->um_fs; - if (fs->fs_fmod != 0 && fs->fs_ronly != 0) { /* XXX */ - printf("fs = %s\n", fs->fs_fsmnt); - panic("ffs_sync: rofs mod"); - } + if (fs->fs_fmod != 0 && fs->fs_ronly != 0) + panic("%s: ffs_sync: modification on read-only filesystem", + fs->fs_fsmnt); /* * Write back each (modified) inode. */ @@ -1742,13 +1742,13 @@ ffs_sbupdate(mp, waitfor, suspended) bp = sbbp; if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_sblockloc != SBLOCK_UFS1 && (fs->fs_flags & FS_FLAGS_UPDATED) == 0) { - printf("%s: correcting fs_sblockloc from %jd to %d\n", + printf("WARNING: %s: correcting fs_sblockloc from %jd to %d\n", fs->fs_fsmnt, fs->fs_sblockloc, SBLOCK_UFS1); fs->fs_sblockloc = SBLOCK_UFS1; } if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_sblockloc != SBLOCK_UFS2 && (fs->fs_flags & FS_FLAGS_UPDATED) == 0) { - printf("%s: correcting fs_sblockloc from %jd to %d\n", + printf("WARNING: %s: correcting fs_sblockloc from %jd to %d\n", fs->fs_fsmnt, fs->fs_sblockloc, SBLOCK_UFS2); fs->fs_sblockloc = SBLOCK_UFS2; } From owner-svn-src-stable@FreeBSD.ORG Mon Jan 30 07:20:52 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D47D7106566C; Mon, 30 Jan 2012 07:20:52 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A7FF58FC12; Mon, 30 Jan 2012 07:20:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0U7Kqm5072689; Mon, 30 Jan 2012 07:20:52 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0U7Kqeu072686; Mon, 30 Jan 2012 07:20:52 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201201300720.q0U7Kqeu072686@svn.freebsd.org> From: Don Lewis Date: Mon, 30 Jan 2012 07:20:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230763 - stable/9/sys/geom/part X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2012 07:20:52 -0000 Author: truckman Date: Mon Jan 30 07:20:52 2012 New Revision: 230763 URL: http://svn.freebsd.org/changeset/base/230763 Log: MFC r230064: Allow an MBR primary or extended Linux swap partition to be specified as the system dump device. This was already allowed for GPT. The Linux swap metadata at the beginning of the partition should not be disturbed because the crash dump is written at the end. Reviewed by: alfred, pjd, marcel Modified: stable/9/sys/geom/part/g_part_ebr.c stable/9/sys/geom/part/g_part_mbr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/part/g_part_ebr.c ============================================================================== --- stable/9/sys/geom/part/g_part_ebr.c Mon Jan 30 05:45:11 2012 (r230762) +++ stable/9/sys/geom/part/g_part_ebr.c Mon Jan 30 07:20:52 2012 (r230763) @@ -333,9 +333,10 @@ g_part_ebr_dumpto(struct g_part_table *t { struct g_part_ebr_entry *entry; - /* Allow dumping to a FreeBSD partition only. */ + /* Allow dumping to a FreeBSD partition or Linux swap partition only. */ entry = (struct g_part_ebr_entry *)baseentry; - return ((entry->ent.dp_typ == DOSPTYP_386BSD) ? 1 : 0); + return ((entry->ent.dp_typ == DOSPTYP_386BSD || + entry->ent.dp_typ == DOSPTYP_LINSWP) ? 1 : 0); } #if defined(GEOM_PART_EBR_COMPAT) Modified: stable/9/sys/geom/part/g_part_mbr.c ============================================================================== --- stable/9/sys/geom/part/g_part_mbr.c Mon Jan 30 05:45:11 2012 (r230762) +++ stable/9/sys/geom/part/g_part_mbr.c Mon Jan 30 07:20:52 2012 (r230763) @@ -304,9 +304,10 @@ g_part_mbr_dumpto(struct g_part_table *t { struct g_part_mbr_entry *entry; - /* Allow dumping to a FreeBSD partition only. */ + /* Allow dumping to a FreeBSD partition or Linux swap partition only. */ entry = (struct g_part_mbr_entry *)baseentry; - return ((entry->ent.dp_typ == DOSPTYP_386BSD) ? 1 : 0); + return ((entry->ent.dp_typ == DOSPTYP_386BSD || + entry->ent.dp_typ == DOSPTYP_LINSWP) ? 1 : 0); } static int From owner-svn-src-stable@FreeBSD.ORG Mon Jan 30 07:23:53 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A877106566B; Mon, 30 Jan 2012 07:23:53 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F2B48FC16; Mon, 30 Jan 2012 07:23:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0U7Nrm8072824; Mon, 30 Jan 2012 07:23:53 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0U7Nr4f072821; Mon, 30 Jan 2012 07:23:53 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201201300723.q0U7Nr4f072821@svn.freebsd.org> From: Don Lewis Date: Mon, 30 Jan 2012 07:23:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230764 - stable/8/sys/geom/part X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2012 07:23:53 -0000 Author: truckman Date: Mon Jan 30 07:23:53 2012 New Revision: 230764 URL: http://svn.freebsd.org/changeset/base/230764 Log: MFC r230064: Allow an MBR primary or extended Linux swap partition to be specified as the system dump device. This was already allowed for GPT. The Linux swap metadata at the beginning of the partition should not be disturbed because the crash dump is written at the end. Reviewed by: alfred, pjd, marcel Modified: stable/8/sys/geom/part/g_part_ebr.c stable/8/sys/geom/part/g_part_mbr.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/geom/part/g_part_ebr.c ============================================================================== --- stable/8/sys/geom/part/g_part_ebr.c Mon Jan 30 07:20:52 2012 (r230763) +++ stable/8/sys/geom/part/g_part_ebr.c Mon Jan 30 07:23:53 2012 (r230764) @@ -326,9 +326,10 @@ g_part_ebr_dumpto(struct g_part_table *t { struct g_part_ebr_entry *entry; - /* Allow dumping to a FreeBSD partition only. */ + /* Allow dumping to a FreeBSD partition or Linux swap partition only. */ entry = (struct g_part_ebr_entry *)baseentry; - return ((entry->ent.dp_typ == DOSPTYP_386BSD) ? 1 : 0); + return ((entry->ent.dp_typ == DOSPTYP_386BSD || + entry->ent.dp_typ == DOSPTYP_LINSWP) ? 1 : 0); } #if defined(GEOM_PART_EBR_COMPAT) Modified: stable/8/sys/geom/part/g_part_mbr.c ============================================================================== --- stable/8/sys/geom/part/g_part_mbr.c Mon Jan 30 07:20:52 2012 (r230763) +++ stable/8/sys/geom/part/g_part_mbr.c Mon Jan 30 07:23:53 2012 (r230764) @@ -301,9 +301,10 @@ g_part_mbr_dumpto(struct g_part_table *t { struct g_part_mbr_entry *entry; - /* Allow dumping to a FreeBSD partition only. */ + /* Allow dumping to a FreeBSD partition or Linux swap partition only. */ entry = (struct g_part_mbr_entry *)baseentry; - return ((entry->ent.dp_typ == DOSPTYP_386BSD) ? 1 : 0); + return ((entry->ent.dp_typ == DOSPTYP_386BSD || + entry->ent.dp_typ == DOSPTYP_LINSWP) ? 1 : 0); } static int From owner-svn-src-stable@FreeBSD.ORG Mon Jan 30 12:10:37 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C4AC106564A; Mon, 30 Jan 2012 12:10:37 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59FBE8FC16; Mon, 30 Jan 2012 12:10:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0UCAbGB084869; Mon, 30 Jan 2012 12:10:37 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0UCAbhK084867; Mon, 30 Jan 2012 12:10:37 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201301210.q0UCAbhK084867@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 30 Jan 2012 12:10:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230769 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2012 12:10:37 -0000 Author: pluknet Date: Mon Jan 30 12:10:37 2012 New Revision: 230769 URL: http://svn.freebsd.org/changeset/base/230769 Log: MFC r230531: Remove unused variable. Modified: stable/9/sys/netinet6/nd6.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/netinet6/nd6.c ============================================================================== --- stable/9/sys/netinet6/nd6.c Mon Jan 30 09:59:33 2012 (r230768) +++ stable/9/sys/netinet6/nd6.c Mon Jan 30 12:10:37 2012 (r230769) @@ -575,7 +575,6 @@ nd6_timer(void *arg) struct nd_defrouter *dr; struct nd_prefix *pr; struct in6_ifaddr *ia6, *nia6; - struct in6_addrlifetime *lt6; callout_reset(&V_nd6_timer_ch, V_nd6_prune * hz, nd6_timer, curvnet); @@ -605,7 +604,6 @@ nd6_timer(void *arg) addrloop: TAILQ_FOREACH_SAFE(ia6, &V_in6_ifaddrhead, ia_link, nia6) { /* check address lifetime */ - lt6 = &ia6->ia6_lifetime; if (IFA6_IS_INVALID(ia6)) { int regen = 0; From owner-svn-src-stable@FreeBSD.ORG Mon Jan 30 12:13:51 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E7011065704; Mon, 30 Jan 2012 12:13:51 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C35E8FC18; Mon, 30 Jan 2012 12:13:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0UCDp6h085038; Mon, 30 Jan 2012 12:13:51 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0UCDpXr085036; Mon, 30 Jan 2012 12:13:51 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201301213.q0UCDpXr085036@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 30 Jan 2012 12:13: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: r230770 - stable/8/sys/netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2012 12:13:51 -0000 Author: pluknet Date: Mon Jan 30 12:13:50 2012 New Revision: 230770 URL: http://svn.freebsd.org/changeset/base/230770 Log: MFC r230531: Remove unused variable. Modified: stable/8/sys/netinet6/nd6.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) Modified: stable/8/sys/netinet6/nd6.c ============================================================================== --- stable/8/sys/netinet6/nd6.c Mon Jan 30 12:10:37 2012 (r230769) +++ stable/8/sys/netinet6/nd6.c Mon Jan 30 12:13:50 2012 (r230770) @@ -565,7 +565,6 @@ nd6_timer(void *arg) struct nd_defrouter *dr; struct nd_prefix *pr; struct in6_ifaddr *ia6, *nia6; - struct in6_addrlifetime *lt6; callout_reset(&V_nd6_timer_ch, V_nd6_prune * hz, nd6_timer, curvnet); @@ -595,7 +594,6 @@ nd6_timer(void *arg) addrloop: TAILQ_FOREACH_SAFE(ia6, &V_in6_ifaddrhead, ia_link, nia6) { /* check address lifetime */ - lt6 = &ia6->ia6_lifetime; if (IFA6_IS_INVALID(ia6)) { int regen = 0; From owner-svn-src-stable@FreeBSD.ORG Mon Jan 30 12:28:22 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC91D1065670; Mon, 30 Jan 2012 12:28:22 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A7628FC14; Mon, 30 Jan 2012 12:28:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0UCSMEE085537; Mon, 30 Jan 2012 12:28:22 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0UCSMI3085535; Mon, 30 Jan 2012 12:28:22 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201301228.q0UCSMI3085535@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 30 Jan 2012 12:28:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230771 - stable/9/lib/libc/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2012 12:28:22 -0000 Author: pluknet Date: Mon Jan 30 12:28:22 2012 New Revision: 230771 URL: http://svn.freebsd.org/changeset/base/230771 Log: MFC r230613: Remove a left-over reference to make.conf(5) for now-defunct -DVM_STACK Modified: stable/9/lib/libc/sys/mmap.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/stdtime/ (props changed) Modified: stable/9/lib/libc/sys/mmap.2 ============================================================================== --- stable/9/lib/libc/sys/mmap.2 Mon Jan 30 12:13:50 2012 (r230770) +++ stable/9/lib/libc/sys/mmap.2 Mon Jan 30 12:28:22 2012 (r230771) @@ -356,8 +356,7 @@ was specified and insufficient memory wa .Xr msync 2 , .Xr munlock 2 , .Xr munmap 2 , -.Xr getpagesize 3 , -.Xr make.conf 5 +.Xr getpagesize 3 .Sh BUGS The .Fa len From owner-svn-src-stable@FreeBSD.ORG Mon Jan 30 12:32:22 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2843106566C; Mon, 30 Jan 2012 12:32:22 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A03318FC0A; Mon, 30 Jan 2012 12:32:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0UCWMEp085757; Mon, 30 Jan 2012 12:32:22 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0UCWMKC085755; Mon, 30 Jan 2012 12:32:22 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201301232.q0UCWMKC085755@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 30 Jan 2012 12:32:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230773 - stable/7/lib/libc/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2012 12:32:22 -0000 Author: pluknet Date: Mon Jan 30 12:32:22 2012 New Revision: 230773 URL: http://svn.freebsd.org/changeset/base/230773 Log: MFC r230613: Remove a left-over reference to make.conf(5) for now-defunct -DVM_STACK Modified: stable/7/lib/libc/sys/mmap.2 Directory Properties: stable/7/lib/libc/ (props changed) stable/7/lib/libc/stdtime/ (props changed) Modified: stable/7/lib/libc/sys/mmap.2 ============================================================================== --- stable/7/lib/libc/sys/mmap.2 Mon Jan 30 12:29:51 2012 (r230772) +++ stable/7/lib/libc/sys/mmap.2 Mon Jan 30 12:32:22 2012 (r230773) @@ -342,8 +342,7 @@ sysctl. .Xr msync 2 , .Xr munlock 2 , .Xr munmap 2 , -.Xr getpagesize 3 , -.Xr make.conf 5 +.Xr getpagesize 3 .Sh BUGS The .Fa len From owner-svn-src-stable@FreeBSD.ORG Mon Jan 30 19:32:34 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26DE2106564A; Mon, 30 Jan 2012 19:32:34 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13B598FC12; Mon, 30 Jan 2012 19:32:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0UJWXrk099266; Mon, 30 Jan 2012 19:32:33 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0UJWXLo099263; Mon, 30 Jan 2012 19:32:33 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201301932.q0UJWXLo099263@svn.freebsd.org> From: Mikolaj Golub Date: Mon, 30 Jan 2012 19:32:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230780 - stable/9/lib/libkvm X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2012 19:32:34 -0000 Author: trociny Date: Mon Jan 30 19:32:33 2012 New Revision: 230780 URL: http://svn.freebsd.org/changeset/base/230780 Log: MFC r227839, r230146: r227839: Now kvm_getenvv() and kvm_getargv() don't need procfs(5). r230146: In kvm_argv(), the case when the supplied buffer was too short to hold the requested value was handled incorrectly, and the function retuned NULL instead of the truncated result. Fix this and also remove unnecessary check for buf != NULL, which alway retuns true. Modified: stable/9/lib/libkvm/kvm_getprocs.3 stable/9/lib/libkvm/kvm_proc.c Directory Properties: stable/9/lib/libkvm/ (props changed) Modified: stable/9/lib/libkvm/kvm_getprocs.3 ============================================================================== --- stable/9/lib/libkvm/kvm_getprocs.3 Mon Jan 30 19:31:17 2012 (r230779) +++ stable/9/lib/libkvm/kvm_getprocs.3 Mon Jan 30 19:32:33 2012 (r230780) @@ -32,7 +32,7 @@ .\" @(#)kvm_getprocs.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 27, 2003 +.Dd November 22, 2011 .Dt KVM_GETPROCS 3 .Os .Sh NAME @@ -172,10 +172,3 @@ on failure. .Xr kvm_write 3 .Sh BUGS These routines do not belong in the kvm interface. -.Pp -In order for -.Xr kvm_getenvv 3 -to function correctly, -.Xr procfs 5 -must be mounted on -.Pa /proc . Modified: stable/9/lib/libkvm/kvm_proc.c ============================================================================== --- stable/9/lib/libkvm/kvm_proc.c Mon Jan 30 19:31:17 2012 (r230779) +++ stable/9/lib/libkvm/kvm_proc.c Mon Jan 30 19:32:33 2012 (r230780) @@ -72,9 +72,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include - #include #include @@ -623,276 +620,16 @@ _kvm_realloc(kvm_t *kd, void *p, size_t return (np); } -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif - -/* - * Read in an argument vector from the user address space of process kp. - * addr if the user-space base address of narg null-terminated contiguous - * strings. This is used to read in both the command arguments and - * environment strings. Read at most maxcnt characters of strings. - */ -static char ** -kvm_argv(kvm_t *kd, const struct kinfo_proc *kp, u_long addr, int narg, - int maxcnt) -{ - char *np, *cp, *ep, *ap; - u_long oaddr = -1; - int len, cc; - char **argv; - - /* - * Check that there aren't an unreasonable number of arguments, - * and that the address is in user space. Special test for - * VM_MIN_ADDRESS as it evaluates to zero, but is not a simple zero - * constant for some archs. We cannot use the pre-processor here and - * for some archs the compiler would trigger a signedness warning. - */ - if (narg > 512 || addr + 1 < VM_MIN_ADDRESS + 1 || addr >= VM_MAXUSER_ADDRESS) - return (0); - - /* - * kd->argv : work space for fetching the strings from the target - * process's space, and is converted for returning to caller - */ - if (kd->argv == 0) { - /* - * Try to avoid reallocs. - */ - kd->argc = MAX(narg + 1, 32); - kd->argv = (char **)_kvm_malloc(kd, kd->argc * - sizeof(*kd->argv)); - if (kd->argv == 0) - return (0); - } else if (narg + 1 > kd->argc) { - kd->argc = MAX(2 * kd->argc, narg + 1); - kd->argv = (char **)_kvm_realloc(kd, kd->argv, kd->argc * - sizeof(*kd->argv)); - if (kd->argv == 0) - return (0); - } - /* - * kd->argspc : returned to user, this is where the kd->argv - * arrays are left pointing to the collected strings. - */ - if (kd->argspc == 0) { - kd->argspc = (char *)_kvm_malloc(kd, PAGE_SIZE); - if (kd->argspc == 0) - return (0); - kd->arglen = PAGE_SIZE; - } - /* - * kd->argbuf : used to pull in pages from the target process. - * the strings are copied out of here. - */ - if (kd->argbuf == 0) { - kd->argbuf = (char *)_kvm_malloc(kd, PAGE_SIZE); - if (kd->argbuf == 0) - return (0); - } - - /* Pull in the target process'es argv vector */ - cc = sizeof(char *) * narg; - if (kvm_uread(kd, kp, addr, (char *)kd->argv, cc) != cc) - return (0); - /* - * ap : saved start address of string we're working on in kd->argspc - * np : pointer to next place to write in kd->argspc - * len: length of data in kd->argspc - * argv: pointer to the argv vector that we are hunting around the - * target process space for, and converting to addresses in - * our address space (kd->argspc). - */ - ap = np = kd->argspc; - argv = kd->argv; - len = 0; - /* - * Loop over pages, filling in the argument vector. - * Note that the argv strings could be pointing *anywhere* in - * the user address space and are no longer contiguous. - * Note that *argv is modified when we are going to fetch a string - * that crosses a page boundary. We copy the next part of the string - * into to "np" and eventually convert the pointer. - */ - while (argv < kd->argv + narg && *argv != 0) { - - /* get the address that the current argv string is on */ - addr = (u_long)*argv & ~(PAGE_SIZE - 1); - - /* is it the same page as the last one? */ - if (addr != oaddr) { - if (kvm_uread(kd, kp, addr, kd->argbuf, PAGE_SIZE) != - PAGE_SIZE) - return (0); - oaddr = addr; - } - - /* offset within the page... kd->argbuf */ - addr = (u_long)*argv & (PAGE_SIZE - 1); - - /* cp = start of string, cc = count of chars in this chunk */ - cp = kd->argbuf + addr; - cc = PAGE_SIZE - addr; - - /* dont get more than asked for by user process */ - if (maxcnt > 0 && cc > maxcnt - len) - cc = maxcnt - len; - - /* pointer to end of string if we found it in this page */ - ep = memchr(cp, '\0', cc); - if (ep != 0) - cc = ep - cp + 1; - /* - * at this point, cc is the count of the chars that we are - * going to retrieve this time. we may or may not have found - * the end of it. (ep points to the null if the end is known) - */ - - /* will we exceed the malloc/realloced buffer? */ - if (len + cc > kd->arglen) { - int off; - char **pp; - char *op = kd->argspc; - - kd->arglen *= 2; - kd->argspc = (char *)_kvm_realloc(kd, kd->argspc, - kd->arglen); - if (kd->argspc == 0) - return (0); - /* - * Adjust argv pointers in case realloc moved - * the string space. - */ - off = kd->argspc - op; - for (pp = kd->argv; pp < argv; pp++) - *pp += off; - ap += off; - np += off; - } - /* np = where to put the next part of the string in kd->argspc*/ - /* np is kinda redundant.. could use "kd->argspc + len" */ - memcpy(np, cp, cc); - np += cc; /* inc counters */ - len += cc; - - /* - * if end of string found, set the *argv pointer to the - * saved beginning of string, and advance. argv points to - * somewhere in kd->argv.. This is initially relative - * to the target process, but when we close it off, we set - * it to point in our address space. - */ - if (ep != 0) { - *argv++ = ap; - ap = np; - } else { - /* update the address relative to the target process */ - *argv += cc; - } - - if (maxcnt > 0 && len >= maxcnt) { - /* - * We're stopping prematurely. Terminate the - * current string. - */ - if (ep == 0) { - *np = '\0'; - *argv++ = ap; - } - break; - } - } - /* Make sure argv is terminated. */ - *argv = 0; - return (kd->argv); -} - -static void -ps_str_a(struct ps_strings *p, u_long *addr, int *n) -{ - *addr = (u_long)p->ps_argvstr; - *n = p->ps_nargvstr; -} - -static void -ps_str_e (struct ps_strings *p, u_long *addr, int *n) -{ - *addr = (u_long)p->ps_envstr; - *n = p->ps_nenvstr; -} - /* - * Determine if the proc indicated by p is still active. - * This test is not 100% foolproof in theory, but chances of - * being wrong are very low. + * Get the command args or environment. */ -static int -proc_verify(const struct kinfo_proc *curkp) -{ - struct kinfo_proc newkp; - int mib[4]; - size_t len; - - mib[0] = CTL_KERN; - mib[1] = KERN_PROC; - mib[2] = KERN_PROC_PID; - mib[3] = curkp->ki_pid; - len = sizeof(newkp); - if (sysctl(mib, 4, &newkp, &len, NULL, 0) == -1) - return (0); - return (curkp->ki_pid == newkp.ki_pid && - (newkp.ki_stat != SZOMB || curkp->ki_stat == SZOMB)); -} - static char ** -kvm_doargv(kvm_t *kd, const struct kinfo_proc *kp, int nchr, - void (*info)(struct ps_strings *, u_long *, int *)) -{ - char **ap; - u_long addr; - int cnt; - static struct ps_strings arginfo; - static u_long ps_strings; - size_t len; - - if (ps_strings == 0) { - len = sizeof(ps_strings); - if (sysctlbyname("kern.ps_strings", &ps_strings, &len, NULL, - 0) == -1) - ps_strings = PS_STRINGS; - } - - /* - * Pointers are stored at the top of the user stack. - */ - if (kp->ki_stat == SZOMB || - kvm_uread(kd, kp, ps_strings, (char *)&arginfo, - sizeof(arginfo)) != sizeof(arginfo)) - return (0); - - (*info)(&arginfo, &addr, &cnt); - if (cnt == 0) - return (0); - ap = kvm_argv(kd, kp, addr, cnt, nchr); - /* - * For live kernels, make sure this process didn't go away. - */ - if (ap != 0 && ISALIVE(kd) && !proc_verify(kp)) - ap = 0; - return (ap); -} - -/* - * Get the command args. This code is now machine independent. - */ -char ** -kvm_getargv(kvm_t *kd, const struct kinfo_proc *kp, int nchr) +kvm_argv(kvm_t *kd, const struct kinfo_proc *kp, int env, int nchr) { int oid[4]; int i; size_t bufsz; - static unsigned long buflen; + static int buflen; static char *buf, *p; static char **bufp; static int argc; @@ -903,102 +640,66 @@ kvm_getargv(kvm_t *kd, const struct kinf return (0); } - if (!buflen) { - bufsz = sizeof(buflen); - i = sysctlbyname("kern.ps_arg_cache_limit", - &buflen, &bufsz, NULL, 0); - if (i == -1) { - buflen = 0; - } else { - buf = malloc(buflen); - if (buf == NULL) - buflen = 0; - argc = 32; - bufp = malloc(sizeof(char *) * argc); - } - } - if (buf != NULL) { - oid[0] = CTL_KERN; - oid[1] = KERN_PROC; - oid[2] = KERN_PROC_ARGS; - oid[3] = kp->ki_pid; - bufsz = buflen; - i = sysctl(oid, 4, buf, &bufsz, 0, 0); - if (i == 0 && bufsz > 0) { - i = 0; - p = buf; - do { - bufp[i++] = p; - p += strlen(p) + 1; - if (i >= argc) { - argc += argc; - bufp = realloc(bufp, - sizeof(char *) * argc); - } - } while (p < buf + bufsz); - bufp[i++] = 0; - return (bufp); - } + if (nchr == 0 || nchr > ARG_MAX) + nchr = ARG_MAX; + if (buflen == 0) { + buf = malloc(nchr); + if (buf == NULL) { + _kvm_err(kd, kd->program, "cannot allocate memory"); + return (0); + } + buflen = nchr; + argc = 32; + bufp = malloc(sizeof(char *) * argc); + } else if (nchr > buflen) { + p = realloc(buf, nchr); + if (p != NULL) { + buf = p; + buflen = nchr; + } + } + oid[0] = CTL_KERN; + oid[1] = KERN_PROC; + oid[2] = env ? KERN_PROC_ENV : KERN_PROC_ARGS; + oid[3] = kp->ki_pid; + bufsz = buflen; + if (sysctl(oid, 4, buf, &bufsz, 0, 0) == -1) { + /* + * If the supplied buf is too short to hold the requested + * value the sysctl returns with ENOMEM. The buf is filled + * with the truncated value and the returned bufsz is equal + * to the requested len. + */ + if (errno != ENOMEM || bufsz != (size_t)buflen) + return (0); + buf[bufsz - 1] = '\0'; + errno = 0; + } else if (bufsz == 0) { + return (0); } - if (kp->ki_flag & P_SYSTEM) - return (NULL); - return (kvm_doargv(kd, kp, nchr, ps_str_a)); + i = 0; + p = buf; + do { + bufp[i++] = p; + p += strlen(p) + 1; + if (i >= argc) { + argc += argc; + bufp = realloc(bufp, + sizeof(char *) * argc); + } + } while (p < buf + bufsz); + bufp[i++] = 0; + return (bufp); } char ** -kvm_getenvv(kvm_t *kd, const struct kinfo_proc *kp, int nchr) +kvm_getargv(kvm_t *kd, const struct kinfo_proc *kp, int nchr) { - return (kvm_doargv(kd, kp, nchr, ps_str_e)); + return (kvm_argv(kd, kp, 0, nchr)); } -/* - * Read from user space. The user context is given by p. - */ -ssize_t -kvm_uread(kvm_t *kd, const struct kinfo_proc *kp, u_long uva, char *buf, - size_t len) +char ** +kvm_getenvv(kvm_t *kd, const struct kinfo_proc *kp, int nchr) { - char *cp; - char procfile[MAXPATHLEN]; - ssize_t amount; - int fd; - - if (!ISALIVE(kd)) { - _kvm_err(kd, kd->program, - "cannot read user space from dead kernel"); - return (0); - } - - sprintf(procfile, "/proc/%d/mem", kp->ki_pid); - fd = open(procfile, O_RDONLY, 0); - if (fd < 0) { - _kvm_err(kd, kd->program, "cannot open %s", procfile); - return (0); - } - - cp = buf; - while (len > 0) { - errno = 0; - if (lseek(fd, (off_t)uva, 0) == -1 && errno != 0) { - _kvm_err(kd, kd->program, "invalid address (%lx) in %s", - uva, procfile); - break; - } - amount = read(fd, cp, len); - if (amount < 0) { - _kvm_syserr(kd, kd->program, "error reading %s", - procfile); - break; - } - if (amount == 0) { - _kvm_err(kd, kd->program, "EOF reading %s", procfile); - break; - } - cp += amount; - uva += amount; - len -= amount; - } - - close(fd); - return ((ssize_t)(cp - buf)); + return (kvm_argv(kd, kp, 1, nchr)); } From owner-svn-src-stable@FreeBSD.ORG Mon Jan 30 19:34:41 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0B62106566C; Mon, 30 Jan 2012 19:34:41 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B49A98FC17; Mon, 30 Jan 2012 19:34:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0UJYfO3099375; Mon, 30 Jan 2012 19:34:41 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0UJYfii099372; Mon, 30 Jan 2012 19:34:41 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201301934.q0UJYfii099372@svn.freebsd.org> From: Mikolaj Golub Date: Mon, 30 Jan 2012 19:34:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230781 - stable/9/bin/ps X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2012 19:34:42 -0000 Author: trociny Date: Mon Jan 30 19:34:41 2012 New Revision: 230781 URL: http://svn.freebsd.org/changeset/base/230781 Log: MFC r227840, r227846: r227840: No need in procfs(5). r227846 Remove yet another outdated note about procfs(5) being required. Spotted by: arundel Modified: stable/9/bin/ps/ps.1 stable/9/bin/ps/ps.c Directory Properties: stable/9/bin/ps/ (props changed) Modified: stable/9/bin/ps/ps.1 ============================================================================== --- stable/9/bin/ps/ps.1 Mon Jan 30 19:32:33 2012 (r230780) +++ stable/9/bin/ps/ps.1 Mon Jan 30 19:34:41 2012 (r230781) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd October 1, 2011 +.Dd November 22, 2011 .Dt PS 1 .Os .Sh NAME @@ -98,12 +98,6 @@ The default output format includes, for controlling terminal, state, CPU time (including both user and system time) and associated command. .Pp -The process file system (see -.Xr procfs 5 ) -should be mounted when -.Nm -is executed, otherwise not all information will be available. -.Pp The options are as follows: .Bl -tag -width indent .It Fl a @@ -682,9 +676,6 @@ attempts to automatically determine the .Bl -tag -width ".Pa /boot/kernel/kernel" -compact .It Pa /boot/kernel/kernel default system namelist -.It Pa /proc -the mount point of -.Xr procfs 5 .El .Sh SEE ALSO .Xr kill 1 , Modified: stable/9/bin/ps/ps.c ============================================================================== --- stable/9/bin/ps/ps.c Mon Jan 30 19:32:33 2012 (r230780) +++ stable/9/bin/ps/ps.c Mon Jan 30 19:34:41 2012 (r230781) @@ -132,7 +132,6 @@ struct listinfo { } l; }; -static int check_procfs(void); static int addelem_gid(struct listinfo *, const char *); static int addelem_pid(struct listinfo *, const char *); static int addelem_tty(struct listinfo *, const char *); @@ -412,14 +411,6 @@ main(int argc, char *argv[]) argv += optind; /* - * If the user specified ps -e then they want a copy of the process - * environment kvm_getenvv(3) attempts to open /proc//mem. - * Check to make sure that procfs is mounted on /proc, otherwise - * print a warning informing the user that output will be incomplete. - */ - if (needenv == 1 && check_procfs() == 0) - warnx("Process environment requires procfs(5)"); - /* * If there arguments after processing all the options, attempt * to treat them as a list of process ids. */ @@ -1317,18 +1308,6 @@ kludge_oldps_options(const char *optlist return (newopts); } -static int -check_procfs(void) -{ - struct statfs mnt; - - if (statfs("/proc", &mnt) < 0) - return (0); - if (strcmp(mnt.f_fstypename, "procfs") != 0) - return (0); - return (1); -} - static void usage(void) { From owner-svn-src-stable@FreeBSD.ORG Mon Jan 30 22:32:55 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E189106568E; Mon, 30 Jan 2012 22:32:55 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 130F28FC18; Mon, 30 Jan 2012 22:32:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0UMWson005553; Mon, 30 Jan 2012 22:32:54 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0UMWsjE005549; Mon, 30 Jan 2012 22:32:54 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201201302232.q0UMWsjE005549@svn.freebsd.org> From: Justin Hibbits Date: Mon, 30 Jan 2012 22:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230788 - in stable/9: etc/devd sys/powerpc/powermac X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2012 22:32:55 -0000 Author: jhibbits Date: Mon Jan 30 22:32:54 2012 New Revision: 230788 URL: http://svn.freebsd.org/changeset/base/230788 Log: MFC r228270,228277: Add a devd notification for closing/opening the lid on PowerBooks and iBooks. Approved by: nwhitehorn (mentor) Modified: stable/9/etc/devd/apple.conf stable/9/sys/powerpc/powermac/pmu.c stable/9/sys/powerpc/powermac/pmuvar.h Directory Properties: stable/9/etc/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/etc/devd/apple.conf ============================================================================== --- stable/9/etc/devd/apple.conf Mon Jan 30 21:02:25 2012 (r230787) +++ stable/9/etc/devd/apple.conf Mon Jan 30 22:32:54 2012 (r230788) @@ -11,6 +11,16 @@ notify 0 { }; +# PowerBook and iBook lid close. +notify 0 { + match "system" "PMU"; + match "subsystem" "lid"; + match "type" "close"; + match "notify" "0x0"; + action "shutdown -p now"; +}; + + # The next blocks enable volume hotkeys that can be found on Apple laptops notify 0 { match "system" "PMU"; Modified: stable/9/sys/powerpc/powermac/pmu.c ============================================================================== --- stable/9/sys/powerpc/powermac/pmu.c Mon Jan 30 21:02:25 2012 (r230787) +++ stable/9/sys/powerpc/powermac/pmu.c Mon Jan 30 22:32:54 2012 (r230788) @@ -701,6 +701,20 @@ pmu_intr(void *arg) adb_receive_raw_packet(sc->adb_bus,resp[1],resp[2], len - 3,&resp[3]); } + if (resp[1] & PMU_INT_ENVIRONMENT) { + /* if the lid was just closed, notify devd. */ + if ((resp[2] & PMU_ENV_LID_CLOSED) && (!sc->lid_closed)) { + sc->lid_closed = 1; + if (devctl_process_running()) + devctl_notify("PMU", "lid", "close", NULL); + } + else if (!(resp[2] & PMU_ENV_LID_CLOSED) && (sc->lid_closed)) { + /* if the lid was just opened, notify devd. */ + if (devctl_process_running()) + devctl_notify("PMU", "lid", "open", NULL); + sc->lid_closed = 0; + } + } } static u_int Modified: stable/9/sys/powerpc/powermac/pmuvar.h ============================================================================== --- stable/9/sys/powerpc/powermac/pmuvar.h Mon Jan 30 21:02:25 2012 (r230787) +++ stable/9/sys/powerpc/powermac/pmuvar.h Mon Jan 30 22:32:54 2012 (r230788) @@ -160,6 +160,7 @@ struct pmu_softc { volatile int sc_autopoll; int sc_batteries; struct cdev *sc_leddev; + int lid_closed; }; struct pmu_battstate { From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 00:49:05 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C283106568A; Tue, 31 Jan 2012 00:49:05 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 855338FC14; Tue, 31 Jan 2012 00:49:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0V0n5TR010538; Tue, 31 Jan 2012 00:49:05 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0V0n57A010535; Tue, 31 Jan 2012 00:49:05 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201201310049.q0V0n57A010535@svn.freebsd.org> From: Doug Barton Date: Tue, 31 Jan 2012 00:49:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230796 - in stable/8/lib/bind: . isc/isc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 00:49:05 -0000 Author: dougb Date: Tue Jan 31 00:49:04 2012 New Revision: 230796 URL: http://svn.freebsd.org/changeset/base/230796 Log: MFC r217071 and r217213: Make the setting of the BIND CFLAG -DWORDS_BIGENDIAN conditional on the TARGET_ENDIANNESS knob from bsd.endian.mk so that we can avoid having to special-case each arch. MFC r224093 (in part): Stop claiming that we support atomic ops except on arches where we know that they work. Many users have reported problems on the other arches, so until they can get fixed we'll take the safe route. Modified: stable/8/lib/bind/config.mk stable/8/lib/bind/isc/isc/platform.h Directory Properties: stable/8/lib/bind/ (props changed) Modified: stable/8/lib/bind/config.mk ============================================================================== --- stable/8/lib/bind/config.mk Tue Jan 31 00:32:37 2012 (r230795) +++ stable/8/lib/bind/config.mk Tue Jan 31 00:49:04 2012 (r230796) @@ -1,6 +1,7 @@ # $FreeBSD$ .include +.include # BIND version number .if defined(BIND_DIR) && exists(${BIND_DIR}/version) @@ -45,7 +46,7 @@ CFLAGS+= -DOPENSSL CFLAGS+= -DUSE_MD5 # Endianness -.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64" +.if ${TARGET_ENDIANNESS} == 4321 CFLAGS+= -DWORDS_BIGENDIAN .endif @@ -66,8 +67,10 @@ CFLAGS+= -I${LIB_BIND_DIR} # Use the right version of the atomic.h file from lib/isc .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" ISC_ATOMIC_ARCH= x86_32 +.elif ${MACHINE_ARCH} == "ia64" +ISC_ATOMIC_ARCH= ia64 .else -ISC_ATOMIC_ARCH= ${MACHINE_ARCH} +ISC_ATOMIC_ARCH= noatomic .endif # Optional features Modified: stable/8/lib/bind/isc/isc/platform.h ============================================================================== --- stable/8/lib/bind/isc/isc/platform.h Tue Jan 31 00:32:37 2012 (r230795) +++ stable/8/lib/bind/isc/isc/platform.h Tue Jan 31 00:49:04 2012 (r230796) @@ -252,7 +252,14 @@ * If the "xadd" operation is available on this architecture, * ISC_PLATFORM_HAVEXADD will be defined. */ +/* + * FreeBSD local modification, preserve this over upgrades + */ +#if defined (__i386__) || defined (__amd64__) || defined (__ia64__) #define ISC_PLATFORM_HAVEXADD 1 +#else +#undef ISC_PLATFORM_HAVEXADD +#endif /* * If the "xaddq" operation (64bit xadd) is available on this architecture, @@ -271,18 +278,39 @@ * If the "atomic swap" operation is available on this architecture, * ISC_PLATFORM_HAVEATOMICSTORE" will be defined. */ +/* + * FreeBSD local modification, preserve this over upgrades + */ +#if defined (__i386__) || defined (__amd64__) || defined (__ia64__) #define ISC_PLATFORM_HAVEATOMICSTORE 1 +#else +#undef ISC_PLATFORM_HAVEATOMICSTORE +#endif /* * If the "compare-and-exchange" operation is available on this architecture, * ISC_PLATFORM_HAVECMPXCHG will be defined. */ +/* + * FreeBSD local modification, preserve this over upgrades + */ +#if defined (__i386__) || defined (__amd64__) || defined (__ia64__) #define ISC_PLATFORM_HAVECMPXCHG 1 +#else +#undef ISC_PLATFORM_HAVECMPXCHG +#endif /* * Define if gcc ASM extension is available */ +/* + * FreeBSD local modification, preserve this over upgrades + */ +#if defined (__i386__) || defined (__amd64__) || defined (__ia64__) #define ISC_PLATFORM_USEGCCASM 1 +#else +#undef ISC_PLATFORM_USEGCCASM +#endif /* * Define if Tru64 style ASM syntax must be used. From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 00:49:34 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6335106564A; Tue, 31 Jan 2012 00:49:34 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A00008FC1B; Tue, 31 Jan 2012 00:49:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0V0nYQT010587; Tue, 31 Jan 2012 00:49:34 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0V0nY4q010584; Tue, 31 Jan 2012 00:49:34 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201201310049.q0V0nY4q010584@svn.freebsd.org> From: Doug Barton Date: Tue, 31 Jan 2012 00:49:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230797 - in stable/7/lib/bind: . isc/isc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 00:49:34 -0000 Author: dougb Date: Tue Jan 31 00:49:34 2012 New Revision: 230797 URL: http://svn.freebsd.org/changeset/base/230797 Log: MFC r217071 and r217213: Make the setting of the BIND CFLAG -DWORDS_BIGENDIAN conditional on the TARGET_ENDIANNESS knob from bsd.endian.mk so that we can avoid having to special-case each arch. MFC r224093 (in part): Stop claiming that we support atomic ops except on arches where we know that they work. Many users have reported problems on the other arches, so until they can get fixed we'll take the safe route. Modified: stable/7/lib/bind/config.mk stable/7/lib/bind/isc/isc/platform.h Directory Properties: stable/7/lib/bind/ (props changed) Modified: stable/7/lib/bind/config.mk ============================================================================== --- stable/7/lib/bind/config.mk Tue Jan 31 00:49:04 2012 (r230796) +++ stable/7/lib/bind/config.mk Tue Jan 31 00:49:34 2012 (r230797) @@ -1,6 +1,7 @@ # $FreeBSD$ .include +.include # BIND version number .if defined(BIND_DIR) && exists(${BIND_DIR}/version) @@ -45,7 +46,7 @@ CFLAGS+= -DOPENSSL CFLAGS+= -DUSE_MD5 # Endianness -.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64" +.if ${TARGET_ENDIANNESS} == 4321 CFLAGS+= -DWORDS_BIGENDIAN .endif @@ -66,8 +67,10 @@ CFLAGS+= -I${LIB_BIND_DIR} # Use the right version of the atomic.h file from lib/isc .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" ISC_ATOMIC_ARCH= x86_32 +.elif ${MACHINE_ARCH} == "ia64" +ISC_ATOMIC_ARCH= ia64 .else -ISC_ATOMIC_ARCH= ${MACHINE_ARCH} +ISC_ATOMIC_ARCH= noatomic .endif # Link against BIND libraries Modified: stable/7/lib/bind/isc/isc/platform.h ============================================================================== --- stable/7/lib/bind/isc/isc/platform.h Tue Jan 31 00:49:04 2012 (r230796) +++ stable/7/lib/bind/isc/isc/platform.h Tue Jan 31 00:49:34 2012 (r230797) @@ -238,24 +238,52 @@ * If the "xadd" operation is available on this architecture, * ISC_PLATFORM_HAVEXADD will be defined. */ +/* + * FreeBSD local modification, preserve this over upgrades + */ +#if defined (__i386__) || defined (__amd64__) || defined (__ia64__) #define ISC_PLATFORM_HAVEXADD 1 +#else +#undef ISC_PLATFORM_HAVEXADD +#endif /* * If the "atomic swap" operation is available on this architecture, * ISC_PLATFORM_HAVEATOMICSTORE" will be defined. */ +/* + * FreeBSD local modification, preserve this over upgrades + */ +#if defined (__i386__) || defined (__amd64__) || defined (__ia64__) #define ISC_PLATFORM_HAVEATOMICSTORE 1 +#else +#undef ISC_PLATFORM_HAVEATOMICSTORE +#endif /* * If the "compare-and-exchange" operation is available on this architecture, * ISC_PLATFORM_HAVECMPXCHG will be defined. */ +/* + * FreeBSD local modification, preserve this over upgrades + */ +#if defined (__i386__) || defined (__amd64__) || defined (__ia64__) #define ISC_PLATFORM_HAVECMPXCHG 1 +#else +#undef ISC_PLATFORM_HAVECMPXCHG +#endif /* * Define if gcc ASM extension is available */ +/* + * FreeBSD local modification, preserve this over upgrades + */ +#if defined (__i386__) || defined (__amd64__) || defined (__ia64__) #define ISC_PLATFORM_USEGCCASM 1 +#else +#undef ISC_PLATFORM_USEGCCASM +#endif /* * Define if Tru64 style ASM syntax must be used. From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 01:43:04 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A05D106566B; Tue, 31 Jan 2012 01:43:04 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52D328FC13; Tue, 31 Jan 2012 01:43:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0V1h4C6012222; Tue, 31 Jan 2012 01:43:04 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0V1h4mw012220; Tue, 31 Jan 2012 01:43:04 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201201310143.q0V1h4mw012220@svn.freebsd.org> From: Warren Block Date: Tue, 31 Jan 2012 01:43:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230798 - stable/8/sbin/geom/class/part X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 01:43:04 -0000 Author: wblock (doc committer) Date: Tue Jan 31 01:43:03 2012 New Revision: 230798 URL: http://svn.freebsd.org/changeset/base/230798 Log: MFC r217314 (ae): Fix up the grammar. MFC r217342 (maxim): o Typo fixes. MFC r217343 (maxim): o Start each sentence on a new line. No content changes. MFC r222359 (ae): Add example how to create MBR and BSD schemes and install boot code. MFC r222495 (ae): Document kern.geom.part.check_integrity sysctl variable. MFC r222599 (uqs): mdoc: fix markup MFC r222646 (ru): Generally clean up markup. MFC r222778 (gavin): Rework parts of this man page to improve grammar. MFC r225003 (ae): Add new section "BOOTSTRAPPING" to the gpart(8), that describes bootstrap code images used to boot from MBR, GPT, BSD and VTOC8 schemes. MFC r227774: Add a section that explicitly describes partitioning schemes. Modify existing sections to refer to the new one. Rearrange partitioning scheme list so MBR and EBR types are together. Also add several corrections for grammar, clarity, and consistency. MFC r227777: Fix date. MFC r227800: Correct and expand BSD partitioning scheme description. Correct GUID to GPT in RECOVERING section. MFC r229838: Clarity improvements. MFC r229847: Whitespace-only fix. Approved by: gjb (mentor) Modified: stable/8/sbin/geom/class/part/gpart.8 Directory Properties: stable/8/sbin/geom/ (props changed) stable/8/sbin/geom/class/part/ (props changed) Modified: stable/8/sbin/geom/class/part/gpart.8 ============================================================================== --- stable/8/sbin/geom/class/part/gpart.8 Tue Jan 31 00:49:34 2012 (r230797) +++ stable/8/sbin/geom/class/part/gpart.8 Tue Jan 31 01:43:03 2012 (r230798) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 19, 2011 +.Dd January 8, 2012 .Dt GPART 8 .Os .Sh NAME @@ -33,55 +33,25 @@ .Sh SYNOPSIS To add support for the disk partitioning GEOM class, place one or more of the following -lines in your kernel configuration file: +lines in the kernel configuration file: .Bd -ragged -offset indent .Cd "options GEOM_PART_APM" .Cd "options GEOM_PART_BSD" -.Cd "options GEOM_PART_EBR" -.Cd "options GEOM_PART_EBR_COMPAT" .Cd "options GEOM_PART_GPT" .Cd "options GEOM_PART_MBR" +.Cd "options GEOM_PART_EBR" +.Cd "options GEOM_PART_EBR_COMPAT" .Cd "options GEOM_PART_PC98" .Cd "options GEOM_PART_VTOC8" .Ed .Pp -The -.Dv GEOM_PART_APM -option adds support for the Apple Partition Map (APM) -found on Apple Macintosh computers. -The -.Dv GEOM_PART_BSD -option adds support for the traditional -.Bx -disklabel. -The -.Dv GEOM_PART_EBR -option adds support for the Extended Boot Record (EBR), -which is used to define a logical partition. -The -.Dv GEOM_PART_EBR_COMPAT -option enables backward compatibility for partition names -in the EBR scheme. Also it makes impossible any types of actions -with such partitions. -The -.Dv GEOM_PART_GPT -option adds support for the GUID Partition Table (GPT) -found on Intel Itanium computers and Intel-based Macintosh computers. -The -.Dv GEOM_PART_MBR -option adds support for the Master Boot Record (MBR) -found on PCs and used on many removable media. -The -.Dv GEOM_PART_PC98 -option adds support for the MBR variant as used on -NEC PC-98 computers. -The -.Dv GEOM_PART_VTOC8 -option adds support for Sun's SMI VTOC8 label as -found on computers based on -.Tn SPARC64 -and -.Tn UltraSPARC. +These options provide support for the various types of partitioning +schemes supported by the +.Ns Nm +utility. +See +.Sx "PARTITIONING SCHEMES" +below for more details. .Pp Usage of the .Ns Nm @@ -129,7 +99,7 @@ utility: .\" ==== DESTROY ==== .Nm .Cm destroy -.Op Fl F +.Op Fl F .Op Fl f Ar flags .Ar geom .\" ==== MODIFY ==== @@ -170,7 +140,8 @@ utility: .\" ==== SHOW ==== .Nm .Cm show -.Op Fl lrp +.Op Fl l | r +.Op Fl p .Op Ar geom ... .\" ==== UNDO ==== .Nm @@ -188,7 +159,7 @@ utility: The .Nm utility is used to partition GEOM providers, normally disks. -The first argument of which is the action to be taken: +The first argument is the action to be taken: .Bl -tag -width ".Cm bootcode" .\" ==== ADD ==== .It Cm add @@ -199,11 +170,14 @@ The partition begins on the logical bloc option. Its size is given by the .Fl s Ar size -option. SI unit suffixes are allowed. One or both +option. +SI unit suffixes are allowed. +One or both .Fl b and .Fl s -options can be ommitted. If so they are automatically calculated. +options can be omitted. +If so they are automatically calculated. The type of the partition is given by the .Fl t Ar type option. @@ -240,7 +214,7 @@ about its use. .El .\" ==== BACKUP ==== .It Cm backup -Dump a partition table to standard output in special format used by +Dump a partition table to standard output in a special format used by the .Cm restore action. .\" ==== BOOTCODE ==== @@ -285,18 +259,17 @@ about its use. .It Cm commit Commit any pending changes for geom .Ar geom . -All actions are being committed by default and will not result in +All actions are committed by default and will not result in pending changes. Actions can be modified with the .Fl f Ar flags -option so that they are not being committed by default. -As such, they become pending. +option so that they are not committed, but become pending. Pending changes are reflected by the geom and the .Nm utility, but they are not actually written to disk. The .Cm commit -action will write any and all pending changes to disk. +action will write all pending changes to disk. .\" ==== CREATE ==== .It Cm create Create a new partitioning scheme on a provider given by @@ -304,16 +277,16 @@ Create a new partitioning scheme on a pr The .Fl s Ar scheme option determines the scheme to use. -The kernel needs to have support for a particular scheme before +The kernel must have support for a particular scheme before that scheme can be used to partition a disk. .Pp Additional options include: .Bl -tag -width 10n .It Fl n Ar entries The number of entries in the partition table. -Every partitioning scheme has a minimum and a maximum number of entries -and this option allows tables to be created with the number of entries -that lies anywhere between the minimum and the maximum. +Every partitioning scheme has a minimum and maximum number of entries. +This option allows tables to be created with a number of entries +that is within the limits. Some schemes have a maximum equal to the minimum and some schemes have a maximum large enough to be considered unlimited. By default, partition tables are created with the minimum number of @@ -350,8 +323,8 @@ Destroy the partitioning scheme as imple .Pp Additional options include: .Bl -tag -width 10n -.It Fl F -Forced destroying of the partition table even if it is not empty. +.It Fl F +Forced destroying of the partition table even if it is not empty. .It Fl f Ar flags Additional operational flags. See the section entitled @@ -387,10 +360,10 @@ about its use. .El .\" ==== RECOVER ==== .It Cm recover -Recover corrupt partition's scheme metadata on the geom +Recover a corrupt partition's scheme metadata on the geom .Ar geom . See the section entitled -.Sx "RECOVERING" +.Sx RECOVERING below for the additional information. .Pp Additional options include: @@ -410,7 +383,7 @@ and further identified by the .Fl i Ar index option. New partition size is expressed in logical block -numbers and can be given by the +numbers and can be given by the .Fl s Ar size option. If @@ -438,13 +411,13 @@ about its use. .El .\" ==== RESTORE ==== .It Cm restore -Restore the partition table from backup previously created by +Restore the partition table from a backup previously created by the .Cm backup -action and given from standard input. -Only partition table may be restored. -This action does not affect content of partitions. -This mean that you should copy your data from backup after restoring -partition table and write bootcode again if it is needed. +action and read from standard input. +Only the partition table is restored. +This action does not affect the content of partitions. +After restoring the partition table and writing bootcode if needed, +user data must be restored from backup. .Pp Additional options include: .Bl -tag -width 10n @@ -465,7 +438,7 @@ about its use. .It Cm set Set the named attribute on the partition entry. See the section entitled -.Sx "ATTRIBUTES" +.Sx ATTRIBUTES below for a list of available attributes. .Pp Additional options include: @@ -484,7 +457,7 @@ or all geoms if none are specified. Additional options include: .Bl -tag -width 10n .It Fl l -For partition schemes that support partition labels print them +For partitioning schemes that support partition labels, print them instead of partition type. .It Fl p Show provider names instead of partition indexes. @@ -502,7 +475,7 @@ action and can be used to undo any chang .It Cm unset Clear the named attribute on the partition entry. See the section entitled -.Sx "ATTRIBUTES" +.Sx ATTRIBUTES below for a list of available attributes. .Pp Additional options include: @@ -515,39 +488,95 @@ below for a discussion about its use. .El .El -.\" +.Sh PARTITIONING SCHEMES +Several partitioning schemes are supported by the +.Nm +utility: +.Bl -tag -width ".Cm VTOC8" +.It Cm APM +Apple Partition Map, used by PowerPC(R) Macintosh(R) computers. +Requires the +.Cd GEOM_PART_APM +kernel option. +.It Cm BSD +Traditional BSD disklabel, usually used to subdivide MBR partitions. +.Po +This scheme can also be used as the sole partitioning method, without +an MBR. +Partition editing tools from other operating systems often do not +understand the bare disklabel partition layout, so this is sometimes +called +.Dq dangerously dedicated . +.Pc +Requires the +.Cm GEOM_PART_BSD +kernel option. +.It Cm GPT +GUID Partition Table is used on Intel-based Macintosh computers and +gradually replacing MBR on most PCs and other systems. +Requires the +.Cm GEOM_PART_GPT +kernel option. +.It Cm MBR +Master Boot Record is used on PCs and removable media. +Requires the +.Cm GEOM_PART_MBR +kernel option. +The +.Cm GEOM_PART_EBR +option adds support for the Extended Boot Record (EBR), +which is used to define a logical partition. +The +.Cm GEOM_PART_EBR_COMPAT +option enables backward compatibility for partition names +in the EBR scheme. +It also prevents any type of actions on such partitions. +.It Cm PC98 +An MBR variant for NEC PC-98 and compatible computers. +Requires the +.Cm GEOM_PART_PC98 +kernel option. +.It Cm VTOC8 +Sun's SMI Volume Table Of Contents, used by +.Tn SPARC64 +and +.Tn UltraSPARC +computers. +Requires the +.Cm GEOM_PART_VTOC8 +kernel option. +.El .Sh PARTITION TYPES Partition types are identified on disk by particular strings or magic values. The .Nm -utility uses symbolic names for common partition types to avoid the -user needing to know these values or other details of the partitioning +utility uses symbolic names for common partition types so the user +does not need to know these values or other details of the partitioning scheme in question. The .Nm utility also allows the user to specify scheme-specific partition types for partition types that do not have symbolic names. -The symbolic names currently understood are: +Symbolic names currently understood are: .Bl -tag -width ".Cm freebsd-vinum" .It Cm bios-boot The system partition dedicated to second stage of the boot loader program. -Usually it used by GRUB 2 loader when the partition table is GPT. +Usually it is used by the GRUB 2 loader for GPT partitioning schemes. The scheme-specific type is .Qq Li "!21686148-6449-6E6F-744E-656564454649" . .It Cm efi The system partition for computers that use the Extensible Firmware Interface (EFI). -In such cases, the GPT partitioning scheme is being used and the +In such cases, the GPT partitioning scheme is used and the actual partition type for the system partition can also be specified as .Qq Li "!c12a7328-f81f-11d2-ba4b-00a0c93ec93ab" . .It Cm freebsd A .Fx -partition that uses the +partition subdivided into filesystems with a .Bx -disklabel to sub-divide the -partition into file systems. +disklabel. This is a legacy partition type and should not be used for the APM or GPT schemes. The scheme-specific types are @@ -576,7 +605,7 @@ for GPT, and tag 0x0901 for VTOC8. .It Cm freebsd-ufs A .Fx -partition that contains a UFS or UFS2 file system. +partition that contains a UFS or UFS2 filesystem. The scheme-specific types are .Qq Li "!FreeBSD-UFS" for APM, @@ -601,82 +630,82 @@ for APM, .Qq Li "!516e7cba-6ecf-11d6-8ff8-00022d09712b" for GPT, and 0x0904 for VTOC8. .It Cm mbr -A partition that is sub-partitioned by a master boot record (MBR). +A partition that is sub-partitioned by a Master Boot Record (MBR). This type is known as .Qq Li "!024dee41-33e7-11d3-9d69-0008c781f39f" by GPT. .El .Sh ATTRIBUTES The scheme-specific attributes for EBR: -.Bl -tag -width ".Ar active" -.It Ar active +.Bl -tag -width ".Cm active" +.It Cm active .El .Pp The scheme-specific attributes for GPT: -.Bl -tag -width ".Ar bootfailed" -.It Ar bootme +.Bl -tag -width ".Cm bootfailed" +.It Cm bootme When set, the .Nm gptboot stage 1 boot loader will try to boot the system from this partition. Multiple partitions might be marked with the -.Ar bootme +.Cm bootme attribute. In such scenario the .Nm gptboot will try all -.Ar bootme +.Cm bootme partitions one by one, until the next boot stage is successfully entered. -.It Ar bootonce +.It Cm bootonce Setting this attribute automatically sets the -.Ar bootme +.Cm bootme attribute. When set, the .Nm gptboot stage 1 boot loader will try to boot the system from this partition only once. Partitions with both -.Ar bootonce +.Cm bootonce and -.Ar bootme +.Cm bootme attributes are tried before partitions with only the -.Ar bootme +.Cm bootme attribute. Before -.Ar bootonce +.Cm bootonce partition is tried, the .Nm gptboot removes the -.Ar bootme +.Cm bootme attribute and tries to execute the next boot stage. If it fails, the -.Ar bootonce +.Cm bootonce attribute that is now alone is replaced with the -.Ar bootfailed +.Cm bootfailed attribute. If the execution of the next boot stage succeeds, but the system is not fully booted, the .Nm gptboot will look for -.Ar bootonce +.Cm bootonce attributes alone (without the -.Ar bootme +.Cm bootme attribute) on the next system boot and will replace those with the -.Ar bootfailed +.Cm bootfailed attribute. If the system is fully booted, the .Pa /etc/rc.d/gptboot start-up script will look for partition with the -.Ar bootonce +.Cm bootonce attribute alone, will remove the attribute and log that the system was successfully booted from this partition. There should be at most one -.Ar bootonce +.Cm bootonce partition when system is successfully booted. Multiple partitions might be marked with the -.Ar bootonce +.Cm bootonce and -.Ar bootme +.Cm bootme attribute pairs. -.It Ar bootfailed +.It Cm bootfailed This attribute should not be manually managed. It is managed by the .Nm gptboot @@ -684,50 +713,51 @@ stage 1 boot loader and the .Pa /etc/rc.d/gptboot start-up script. This attribute is used to mark partitions that had the -.Ar bootonce +.Cm bootonce attribute set, but we failed to boot from them. Once we successfully boot, the .Pa /etc/rc.d/gptboot script will log all the partitions we failed to boot from and will remove the -.Ar bootfailed +.Cm bootfailed attributes. .El .Pp The scheme-specific attributes for MBR: -.Bl -tag -width ".Ar active" -.It Ar active +.Bl -tag -width ".Cm active" +.It Cm active .El .Pp The scheme-specific attributes for PC98: -.Bl -tag -width ".Ar bootable" -.It Ar active -.It Ar bootable +.Bl -tag -width ".Cm bootable" +.It Cm active +.It Cm bootable .El .Sh BOOTSTRAPPING .Fx supports several partitioning schemes and each scheme uses different bootstrap code. -The bootstrap code is located in the specific disk area for each partitioning -scheme and also it might have different size. +The bootstrap code is located in a specific disk area for each partitioning +scheme, and may vary in size for different schemes. .Pp -The bootstrap code could be separated into two types. -The first one is embedded in the partitioning scheme's metadata, the second -type is located on the specific partition. -The embedding bootstrap code should be done only with the +Bootstrap code can be separated into two types. +The first type is embedded in the partitioning scheme's metadata, while the +second type is located on a specific partition. +Embedding bootstrap code should only be done with the .Cm gpart bootcode -command with +command with the .Fl b Ar bootcode option. -The GEOM PART class has knowlege on how to embed bootstrap code into specific -partitioning scheme metadata without damage. +The GEOM PART class knows how to safely embed bootstrap code into +specific partitioning scheme metadata without causing any damage. .Pp -The Master Boot Record (MBR) uses 512-bytes bootstrap code image, embedded into -partition table's metadata area. +The Master Boot Record (MBR) uses a 512-byte bootstrap code image, embedded +into the partition table's metadata area. There are two variants of this bootstrap code: .Pa /boot/mbr and .Pa /boot/boot0 . -The first one searches partition with +.Pa /boot/mbr +searches for a partition with the .Cm active attribute (see the .Sx ATTRIBUTES @@ -735,9 +765,10 @@ section) in the partition table. Then it runs next bootstrap stage. The .Pa /boot/boot0 -image contains a boot manager with some additional interactive functions. +image contains a boot manager with some additional interactive functions +for multi-booting from a user-selected partition. .Pp -The BSD disklabel is usually created on top of the MBR partition (slice) +A BSD disklabel is usually created inside an MBR partition (slice) with type .Cm freebsd (see the @@ -745,17 +776,17 @@ with type section). It uses 8 KB size bootstrap code image .Pa /boot/boot , -embedded into partition table's metadata area. +embedded into the partition table's metadata area. .Pp Both types of bootstrap code are used to boot from the GUID Partition Table. -First of all, a protective MBR is embedded into first disk sector from the +First, a protective MBR is embedded into the first disk sector from the .Pa /boot/pmbr image. -It searches the +It searches the GPT .Cm freebsd-boot partition (see the .Sx "PARTITION TYPES" -section) in the GPT and runs next bootstrap stage from it. +section) in the GPT and runs the next bootstrap stage from it. The .Cm freebsd-boot partition should be smaller than 545 KB. @@ -763,37 +794,39 @@ There are two variants of bootstrap code .Pa /boot/gptboot and .Pa /boot/gptzfsboot . -The first one is used to boot from UFS. -It searches in the GPT partition with type -.Cm freebsd-ufs , -and it runs the third bootstrap stage ( -.Pa /boot/loader ) -if it is found. +.Pa /boot/gptboot +is used to boot from UFS. +It searches +.Cm freebsd-ufs +GPT partitions and starts +.Pa /boot/loader +.Pq the third bootstrap stage +if found. The .Pa /boot/gptzfsboot is used to boot from ZFS. -It searches partition with type +It searches .Cm freebsd-zfs -and starts +GPT partitions and starts .Pa /boot/zfsloader -from it. +if found. .Pp The VTOC8 scheme does not support embedding bootstrap code. Instead, the 8 KBytes bootstrap code image .Pa /boot/boot1 -should be written with +should be written with the .Cm gpart bootcode -command with +command with the .Fl p Ar bootcode option to all sufficiently large VTOC8 partitions. To do this the .Fl i Ar index -option could be ommited. +option could be omitted. .Pp The APM scheme also does not support embedding bootstrap code. Instead, the 800 KBytes bootstrap code image .Pa /boot/boot1.hfs -should be written with +should be written with the .Cm gpart bootcode command to a partition of type .Cm freebsd-boot , @@ -824,21 +857,22 @@ action or reverted with the action. .Sh RECOVERING The GEOM PART class supports recovering of partition tables only for GPT. -The GUID partition table has a primary and secondary (backup) copy of -metadata for redundance, these are stored at the begining and the end -of the device respectively. -As a result of having two copies, it is acceptable to have some corruption -within the metadata that is not fatal to the working of GPT. -When the kernel detects corrupt metadata it marks this table as corrupt and -reports the corruption. -Any operations on corrupt tables are prohibited except for +The GPT primary metadata is stored at the beginning of the device. +For redundancy, a secondary +.Pq backup +copy of the metadata is stored at the end of the device. +As a result of having two copies, some corruption of metadata is not +fatal to the working of GPT. +When the kernel detects corrupt metadata, it marks this table as corrupt +and reports the problem. .Cm destroy and -.Cm recover . +.Cm recover +are the only operations allowed on corrupt tables. .Pp If the first sector of a provider is corrupt, the kernel can not detect GPT -even if partition table itself is not corrupt. -You can rewrite the protective MBR using the +even if the partition table itself is not corrupt. +The protective MBR can be rewritten using the .Xr dd 1 command, to restore the ability to detect the GPT. The copy of the protective MBR is usually located in the @@ -869,7 +903,7 @@ will report about corrupt tables. If the size of the device has changed (e.g.\& volume expansion) the secondary GPT header will no longer be located in the last sector. This is not a metadata corruption, but it is dangerous because any -corruption of the primary GPT will lead to loss of partition table. +corruption of the primary GPT will lead to loss of the partition table. This problem is reported by the kernel with the message: .Bd -literal -offset indent GEOM: provider: the secondary GPT header is not in the last LBA. @@ -887,16 +921,34 @@ different GEOM providers, and some of th Be careful when choosing a provider for recovery. If you choose incorrectly you can destroy the metadata of another GEOM class, e.g.\& GEOM MIRROR or GEOM LABEL. +.Sh SYSCTL VARIABLES +The following +.Xr sysctl 8 +variables can be used to control the behavior of the +.Nm PART +GEOM class. +The default value is shown next to each variable. +.Bl -tag -width indent +.It Va kern.geom.part.check_integrity : No 1 +This variable controls the behaviour of metadata integrity checks. +When integrity checks are enabled, the +.Nm PART +GEOM class verifies all generic partition parameters obtained from the +disk metadata. +If some inconsistency is detected, the partition table will be +rejected with a diagnostic message: +.Sy "GEOM_PART: Integrity check failed (provider, scheme)" . +.El .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. .Sh EXAMPLES -Create GPT scheme on -.Pa ad0 . +Create a GPT scheme on +.Pa ad0 : .Bd -literal -offset indent /sbin/gpart create -s GPT ad0 .Ed .Pp -Embed GPT bootstrap code into protective MBR. +Embed GPT bootstrap code into a protective MBR: .Bd -literal -offset indent /sbin/gpart bootcode -b /boot/pmbr ad0 .Ed @@ -912,9 +964,11 @@ This partition must be larger than .Pa /boot/gptboot , or the GPT boot you are planning to write, but smaller than 545 KB. A size of 15 blocks (7680 bytes) would be sufficient for -booting from UFS but let's use 128 blocks (64 KB) here in -this example, in order to reserve some space for potential -future need (e.g.\& from a ZFS partition). +booting from UFS but 128 blocks (64 KB) is used in +this example to reserve some space for potential +future need (e.g.\& a larger +.Pa /boot/gptzfsboot +for booting from a ZFS partition). .Bd -literal -offset indent /sbin/gpart add -b 34 -s 128 -t freebsd-boot ad0 /sbin/gpart bootcode -p /boot/gptboot -i 1 ad0 @@ -922,54 +976,91 @@ future need (e.g.\& from a ZFS partition .Pp Create a 512MB-sized .Cm freebsd-ufs -partition that would contain UFS where the system boots from. +partition to contain a UFS filesystem from which the system can boot. .Bd -literal -offset indent /sbin/gpart add -b 162 -s 1048576 -t freebsd-ufs ad0 .Ed .Pp -Create VTOC8 scheme on -.Pa da0 . +Create an MBR scheme on +.Pa ada0 , +then create a 30GB-sized +.Fx +slice, mark it active and +install the +.Nm boot0 +boot manager: +.Bd -literal -offset indent +/sbin/gpart create -s MBR ada0 +/sbin/gpart add -t freebsd -s 30G ada0 +/sbin/gpart set -a active -i 1 ada0 +/sbin/gpart bootcode -b /boot/boot0 ada0 +.Ed +.Pp +Now create a +.Bx +scheme +.Pf ( Bx +label) with space for up to 20 partitions: +.Bd -literal -offset indent +/sbin/gpart create -s BSD -n 20 ada0s1 +.Ed +.Pp +Create a 1GB-sized UFS partition and a 4GB-sized swap partition: +.Bd -literal -offset indent +/sbin/gpart add -t freebsd-ufs -s 1G ada0s1 +/sbin/gpart add -t freebsd-swap -s 4G ada0s1 +.Ed +.Pp +Install bootstrap code for the +.Bx +label: +.Bd -literal -offset indent +/sbin/gpart bootcode -b /boot/boot ada0s1 +.Ed +.Pp +Create a VTOC8 scheme on +.Pa da0 : .Bd -literal -offset indent /sbin/gpart create -s VTOC8 da0 .Ed .Pp Create a 512MB-sized .Cm freebsd-ufs -partition that would contain UFS where the system boots from. +partition to contain a UFS filesystem from which the system can boot. .Bd -literal -offset indent /sbin/gpart add -s 512M -t freebsd-ufs da0 .Ed .Pp Create a 15GB-sized .Cm freebsd-ufs -partition that would contain UFS and aligned on 4KB boundaries: +partition to contain a UFS filesystem and aligned on 4KB boundaries: .Bd -literal -offset indent /sbin/gpart add -s 15G -t freebsd-ufs -a 4k da0 .Ed .Pp -After having created all required partitions, embed bootstrap code into them. +After creating all required partitions, embed bootstrap code into them: .Bd -literal -offset indent /sbin/gpart bootcode -p /boot/boot1 da0 .Ed .Pp -Create backup of partition table from -.Pa da0 +Create a backup of the partition table from +.Pa da0 : .Bd -literal -offset indent /sbin/gpart backup da0 > da0.backup .Ed .Pp -Restore partition table from backup to -.Pa da0 +Restore the partition table from the backup to +.Pa da0 : .Bd -literal -offset indent /sbin/gpart restore -l da0 < /mnt/da0.backup .Ed .Pp -Clone partition table from -.Pa ada0 -to -.Pa ada1 -and -.Pa ada2 +Clone the partition table from +.Pa ada0 +to +.Pa ada1 +and +.Pa ada2 : .Bd -literal -offset indent /sbin/gpart backup ada0 | /sbin/gpart restore -F ada1 ada2 .Ed From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 01:45:20 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6D1A106566B; Tue, 31 Jan 2012 01:45:20 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D7D48FC0C; Tue, 31 Jan 2012 01:45:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0V1jKPS012362; Tue, 31 Jan 2012 01:45:20 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0V1jKx7012357; Tue, 31 Jan 2012 01:45:20 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201201310145.q0V1jKx7012357@svn.freebsd.org> From: Attilio Rao Date: Tue, 31 Jan 2012 01:45:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230799 - in stable/9/sys: dev/ppbus sys vm X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 01:45:20 -0000 Author: attilio Date: Tue Jan 31 01:45:20 2012 New Revision: 230799 URL: http://svn.freebsd.org/changeset/base/230799 Log: MFC r227758,227759,227788: Introduce macro stubs in the mutex and sxlock implementation that will be always defined and will allow consumers, willing to provide options, file and line to locking requests, to not worry about options redefining the interfaces. This is typically useful when there is the need to build another locking interface on top of the mutex one. Requested by: kib Modified: stable/9/sys/dev/ppbus/ppb_base.c stable/9/sys/sys/mutex.h stable/9/sys/sys/sx.h stable/9/sys/vm/vm_map.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/ppbus/ppb_base.c ============================================================================== --- stable/9/sys/dev/ppbus/ppb_base.c Tue Jan 31 01:43:03 2012 (r230798) +++ stable/9/sys/dev/ppbus/ppb_base.c Tue Jan 31 01:45:20 2012 (r230799) @@ -236,11 +236,8 @@ ppb_unlock(device_t bus) void _ppb_assert_locked(device_t bus, const char *file, int line) { -#ifdef INVARIANTS - struct ppb_data *ppb = DEVTOSOFTC(bus); - _mtx_assert(ppb->ppc_lock, MA_OWNED, file, line); -#endif + mtx_assert_(DEVTOSOFTC(bus)->ppc_lock, MA_OWNED, file, line); } void Modified: stable/9/sys/sys/mutex.h ============================================================================== --- stable/9/sys/sys/mutex.h Tue Jan 31 01:43:03 2012 (r230798) +++ stable/9/sys/sys/mutex.h Tue Jan 31 01:45:20 2012 (r230799) @@ -81,6 +81,10 @@ * of the kernel via macros, thus allowing us to use the cpp LOCK_FILE * and LOCK_LINE. These functions should not be called directly by any * code using the API. Their macros cover their functionality. + * Functions with a `_' suffix are the entrypoint for the common + * KPI covering both compat shims and fast path case. These can be + * used by consumers willing to pass options, file and line + * informations, in an option-independent way. * * [See below for descriptions] * @@ -109,6 +113,11 @@ void _mtx_assert(struct mtx *m, int what #endif void _thread_lock_flags(struct thread *, int, const char *, int); +#define mtx_trylock_flags_(m, opts, file, line) \ + _mtx_trylock((m), (opts), (file), (line)) + +#define thread_lock_flags_(tdp, opts, file, line) \ + _thread_lock_flags((tdp), (opts), (file), (line)) #define thread_lock(tdp) \ _thread_lock_flags((tdp), 0, __FILE__, __LINE__) #define thread_lock_flags(tdp, opt) \ @@ -290,27 +299,48 @@ extern struct mtx_pool *mtxpool_sleep; #error LOCK_DEBUG not defined, include before #endif #if LOCK_DEBUG > 0 || defined(MUTEX_NOINLINE) -#define mtx_lock_flags(m, opts) \ - _mtx_lock_flags((m), (opts), LOCK_FILE, LOCK_LINE) -#define mtx_unlock_flags(m, opts) \ - _mtx_unlock_flags((m), (opts), LOCK_FILE, LOCK_LINE) -#define mtx_lock_spin_flags(m, opts) \ - _mtx_lock_spin_flags((m), (opts), LOCK_FILE, LOCK_LINE) -#define mtx_unlock_spin_flags(m, opts) \ - _mtx_unlock_spin_flags((m), (opts), LOCK_FILE, LOCK_LINE) +#define mtx_lock_flags_(m, opts, file, line) \ + _mtx_lock_flags((m), (opts), (file), (line)) +#define mtx_unlock_flags_(m, opts, file, line) \ + _mtx_unlock_flags((m), (opts), (file), (line)) +#define mtx_lock_spin_flags_(m, opts, file, line) \ + _mtx_lock_spin_flags((m), (opts), (file), (line)) +#define mtx_unlock_spin_flags_(m, opts, file, line) \ + _mtx_unlock_spin_flags((m), (opts), (file), (line)) #else /* LOCK_DEBUG == 0 && !MUTEX_NOINLINE */ +#define mtx_lock_flags_(m, opts, file, line) \ + __mtx_lock((m), curthread, (opts), (file), (line)) +#define mtx_unlock_flags_(m, opts, file, line) \ + __mtx_unlock((m), curthread, (opts), (file), (line)) +#define mtx_lock_spin_flags_(m, opts, file, line) \ + __mtx_lock_spin((m), curthread, (opts), (file), (line)) +#define mtx_unlock_spin_flags_(m, opts, file, line) \ + __mtx_unlock_spin((m)) +#endif /* LOCK_DEBUG > 0 || MUTEX_NOINLINE */ + +#ifdef INVARIANTS +#define mtx_assert_(m, what, file, line) \ + _mtx_assert((m), (what), (file), (line)) + +#define GIANT_REQUIRED mtx_assert_(&Giant, MA_OWNED, __FILE__, __LINE__) + +#else /* INVARIANTS */ +#define mtx_assert_(m, what, file, line) (void)0 +#define GIANT_REQUIRED +#endif /* INVARIANTS */ + #define mtx_lock_flags(m, opts) \ - __mtx_lock((m), curthread, (opts), LOCK_FILE, LOCK_LINE) + mtx_lock_flags_((m), (opts), LOCK_FILE, LOCK_LINE) #define mtx_unlock_flags(m, opts) \ - __mtx_unlock((m), curthread, (opts), LOCK_FILE, LOCK_LINE) + mtx_unlock_flags_((m), (opts), LOCK_FILE, LOCK_LINE) #define mtx_lock_spin_flags(m, opts) \ - __mtx_lock_spin((m), curthread, (opts), LOCK_FILE, LOCK_LINE) + mtx_lock_spin_flags_((m), (opts), LOCK_FILE, LOCK_LINE) #define mtx_unlock_spin_flags(m, opts) \ - __mtx_unlock_spin((m)) -#endif /* LOCK_DEBUG > 0 || MUTEX_NOINLINE */ - + mtx_unlock_spin_flags_((m), (opts), LOCK_FILE, LOCK_LINE) #define mtx_trylock_flags(m, opts) \ - _mtx_trylock((m), (opts), LOCK_FILE, LOCK_LINE) + mtx_trylock_flags_((m), (opts), LOCK_FILE, LOCK_LINE) +#define mtx_assert(m, what) \ + mtx_assert_((m), (what), __FILE__, __LINE__) #define mtx_sleep(chan, mtx, pri, wmesg, timo) \ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (timo)) @@ -398,17 +428,6 @@ struct mtx_args { #define MA_NOTRECURSED LA_NOTRECURSED #endif -#ifdef INVARIANTS -#define mtx_assert(m, what) \ - _mtx_assert((m), (what), __FILE__, __LINE__) - -#define GIANT_REQUIRED mtx_assert(&Giant, MA_OWNED) - -#else /* INVARIANTS */ -#define mtx_assert(m, what) (void)0 -#define GIANT_REQUIRED -#endif /* INVARIANTS */ - /* * Common lock type names. */ Modified: stable/9/sys/sys/sx.h ============================================================================== --- stable/9/sys/sys/sx.h Tue Jan 31 01:43:03 2012 (r230798) +++ stable/9/sys/sys/sx.h Tue Jan 31 01:45:20 2012 (r230799) @@ -115,6 +115,15 @@ void _sx_assert(struct sx *sx, int what, int sx_chain(struct thread *td, struct thread **ownerp); #endif +#define sx_downgrade_(sx, file, line) \ + _sx_downgrade((sx), (file), (line)) +#define sx_try_slock_(sx, file, line) \ + _sx_try_slock((sx), (file), (line)) +#define sx_try_xlock_(sx, file, line) \ + _sx_try_xlock((sx), (file), (line)) +#define sx_try_upgrade_(sx, file, line) \ + _sx_try_upgrade((sx), (file), (line)) + struct sx_args { struct sx *sa_sx; const char *sa_desc; @@ -208,30 +217,50 @@ __sx_sunlock(struct sx *sx, const char * #error "LOCK_DEBUG not defined, include before " #endif #if (LOCK_DEBUG > 0) || defined(SX_NOINLINE) -#define sx_xlock(sx) (void)_sx_xlock((sx), 0, LOCK_FILE, LOCK_LINE) -#define sx_xlock_sig(sx) \ - _sx_xlock((sx), SX_INTERRUPTIBLE, LOCK_FILE, LOCK_LINE) -#define sx_xunlock(sx) _sx_xunlock((sx), LOCK_FILE, LOCK_LINE) -#define sx_slock(sx) (void)_sx_slock((sx), 0, LOCK_FILE, LOCK_LINE) -#define sx_slock_sig(sx) \ - _sx_slock((sx), SX_INTERRUPTIBLE, LOCK_FILE, LOCK_LINE) -#define sx_sunlock(sx) _sx_sunlock((sx), LOCK_FILE, LOCK_LINE) +#define sx_xlock_(sx, file, line) \ + (void)_sx_xlock((sx), 0, (file), (line)) +#define sx_xlock_sig_(sx, file, line) \ + _sx_xlock((sx), SX_INTERRUPTIBLE, (file), (line)) +#define sx_xunlock_(sx, file, line) \ + _sx_xunlock((sx), (file), (line)) +#define sx_slock_(sx, file, line) \ + (void)_sx_slock((sx), 0, (file), (line)) +#define sx_slock_sig_(sx, file, line) \ + _sx_slock((sx), SX_INTERRUPTIBLE, (file) , (line)) +#define sx_sunlock_(sx, file, line) \ + _sx_sunlock((sx), (file), (line)) #else -#define sx_xlock(sx) \ - (void)__sx_xlock((sx), curthread, 0, LOCK_FILE, LOCK_LINE) -#define sx_xlock_sig(sx) \ - __sx_xlock((sx), curthread, SX_INTERRUPTIBLE, LOCK_FILE, LOCK_LINE) -#define sx_xunlock(sx) \ - __sx_xunlock((sx), curthread, LOCK_FILE, LOCK_LINE) -#define sx_slock(sx) (void)__sx_slock((sx), 0, LOCK_FILE, LOCK_LINE) -#define sx_slock_sig(sx) \ - __sx_slock((sx), SX_INTERRUPTIBLE, LOCK_FILE, LOCK_LINE) -#define sx_sunlock(sx) __sx_sunlock((sx), LOCK_FILE, LOCK_LINE) +#define sx_xlock_(sx, file, line) \ + (void)__sx_xlock((sx), curthread, 0, (file), (line)) +#define sx_xlock_sig_(sx, file, line) \ + __sx_xlock((sx), curthread, SX_INTERRUPTIBLE, (file), (line)) +#define sx_xunlock_(sx, file, line) \ + __sx_xunlock((sx), curthread, (file), (line)) +#define sx_slock_(sx, file, line) \ + (void)__sx_slock((sx), 0, (file), (line)) +#define sx_slock_sig_(sx, file, line) \ + __sx_slock((sx), SX_INTERRUPTIBLE, (file), (line)) +#define sx_sunlock_(sx, file, line) \ + __sx_sunlock((sx), (file), (line)) #endif /* LOCK_DEBUG > 0 || SX_NOINLINE */ -#define sx_try_slock(sx) _sx_try_slock((sx), LOCK_FILE, LOCK_LINE) -#define sx_try_xlock(sx) _sx_try_xlock((sx), LOCK_FILE, LOCK_LINE) -#define sx_try_upgrade(sx) _sx_try_upgrade((sx), LOCK_FILE, LOCK_LINE) -#define sx_downgrade(sx) _sx_downgrade((sx), LOCK_FILE, LOCK_LINE) +#define sx_try_slock(sx) sx_try_slock_((sx), LOCK_FILE, LOCK_LINE) +#define sx_try_xlock(sx) sx_try_xlock_((sx), LOCK_FILE, LOCK_LINE) +#define sx_try_upgrade(sx) sx_try_upgrade_((sx), LOCK_FILE, LOCK_LINE) +#define sx_downgrade(sx) sx_downgrade_((sx), LOCK_FILE, LOCK_LINE) +#ifdef INVARIANTS +#define sx_assert_(sx, what, file, line) \ + _sx_assert((sx), (what), (file), (line)) +#else +#define sx_assert_(sx, what, file, line) (void)0 +#endif + +#define sx_xlock(sx) sx_xlock_((sx), LOCK_FILE, LOCK_LINE) +#define sx_xlock_sig(sx) sx_xlock_sig_((sx), LOCK_FILE, LOCK_LINE) +#define sx_xunlock(sx) sx_xunlock_((sx), LOCK_FILE, LOCK_LINE) +#define sx_slock(sx) sx_slock_((sx), LOCK_FILE, LOCK_LINE) +#define sx_slock_sig(sx) sx_slock_sig_((sx), LOCK_FILE, LOCK_LINE) +#define sx_sunlock(sx) sx_sunlock_((sx), LOCK_FILE, LOCK_LINE) +#define sx_assert(sx, what) sx_assert_((sx), (what), __FILE__, __LINE__) /* * Return a pointer to the owning thread if the lock is exclusively @@ -245,13 +274,15 @@ __sx_sunlock(struct sx *sx, const char * (((sx)->sx_lock & ~(SX_LOCK_FLAGMASK & ~SX_LOCK_SHARED)) == \ (uintptr_t)curthread) -#define sx_unlock(sx) do { \ +#define sx_unlock_(sx, file, line) do { \ if (sx_xlocked(sx)) \ - sx_xunlock(sx); \ + sx_xunlock_(sx, file, line); \ else \ - sx_sunlock(sx); \ + sx_sunlock_(sx, file, line); \ } while (0) +#define sx_unlock(sx) sx_unlock_((sx), LOCK_FILE, LOCK_LINE) + #define sx_sleep(chan, sx, pri, wmesg, timo) \ _sleep((chan), &(sx)->lock_object, (pri), (wmesg), (timo)) @@ -287,12 +318,6 @@ __sx_sunlock(struct sx *sx, const char * #define SX_NOTRECURSED LA_NOTRECURSED #endif -#ifdef INVARIANTS -#define sx_assert(sx, what) _sx_assert((sx), (what), LOCK_FILE, LOCK_LINE) -#else -#define sx_assert(sx, what) (void)0 -#endif - #endif /* _KERNEL */ #endif /* !_SYS_SX_H_ */ Modified: stable/9/sys/vm/vm_map.c ============================================================================== --- stable/9/sys/vm/vm_map.c Tue Jan 31 01:43:03 2012 (r230798) +++ stable/9/sys/vm/vm_map.c Tue Jan 31 01:45:20 2012 (r230799) @@ -464,9 +464,9 @@ _vm_map_lock(vm_map_t map, const char *f { if (map->system_map) - _mtx_lock_flags(&map->system_mtx, 0, file, line); + mtx_lock_flags_(&map->system_mtx, 0, file, line); else - (void)_sx_xlock(&map->lock, 0, file, line); + sx_xlock_(&map->lock, file, line); map->timestamp++; } @@ -489,9 +489,9 @@ _vm_map_unlock(vm_map_t map, const char { if (map->system_map) - _mtx_unlock_flags(&map->system_mtx, 0, file, line); + mtx_unlock_flags_(&map->system_mtx, 0, file, line); else { - _sx_xunlock(&map->lock, file, line); + sx_xunlock_(&map->lock, file, line); vm_map_process_deferred(); } } @@ -501,9 +501,9 @@ _vm_map_lock_read(vm_map_t map, const ch { if (map->system_map) - _mtx_lock_flags(&map->system_mtx, 0, file, line); + mtx_lock_flags_(&map->system_mtx, 0, file, line); else - (void)_sx_slock(&map->lock, 0, file, line); + sx_slock_(&map->lock, file, line); } void @@ -511,9 +511,9 @@ _vm_map_unlock_read(vm_map_t map, const { if (map->system_map) - _mtx_unlock_flags(&map->system_mtx, 0, file, line); + mtx_unlock_flags_(&map->system_mtx, 0, file, line); else { - _sx_sunlock(&map->lock, file, line); + sx_sunlock_(&map->lock, file, line); vm_map_process_deferred(); } } @@ -524,8 +524,8 @@ _vm_map_trylock(vm_map_t map, const char int error; error = map->system_map ? - !_mtx_trylock(&map->system_mtx, 0, file, line) : - !_sx_try_xlock(&map->lock, file, line); + !mtx_trylock_flags_(&map->system_mtx, 0, file, line) : + !sx_try_xlock_(&map->lock, file, line); if (error == 0) map->timestamp++; return (error == 0); @@ -537,8 +537,8 @@ _vm_map_trylock_read(vm_map_t map, const int error; error = map->system_map ? - !_mtx_trylock(&map->system_mtx, 0, file, line) : - !_sx_try_slock(&map->lock, file, line); + !mtx_trylock_flags_(&map->system_mtx, 0, file, line) : + !sx_try_slock_(&map->lock, file, line); return (error == 0); } @@ -558,21 +558,19 @@ _vm_map_lock_upgrade(vm_map_t map, const unsigned int last_timestamp; if (map->system_map) { -#ifdef INVARIANTS - _mtx_assert(&map->system_mtx, MA_OWNED, file, line); -#endif + mtx_assert_(&map->system_mtx, MA_OWNED, file, line); } else { - if (!_sx_try_upgrade(&map->lock, file, line)) { + if (!sx_try_upgrade_(&map->lock, file, line)) { last_timestamp = map->timestamp; - _sx_sunlock(&map->lock, file, line); + sx_sunlock_(&map->lock, file, line); vm_map_process_deferred(); /* * If the map's timestamp does not change while the * map is unlocked, then the upgrade succeeds. */ - (void)_sx_xlock(&map->lock, 0, file, line); + sx_xlock_(&map->lock, file, line); if (last_timestamp != map->timestamp) { - _sx_xunlock(&map->lock, file, line); + sx_xunlock_(&map->lock, file, line); return (1); } } @@ -586,11 +584,9 @@ _vm_map_lock_downgrade(vm_map_t map, con { if (map->system_map) { -#ifdef INVARIANTS - _mtx_assert(&map->system_mtx, MA_OWNED, file, line); -#endif + mtx_assert_(&map->system_mtx, MA_OWNED, file, line); } else - _sx_downgrade(&map->lock, file, line); + sx_downgrade_(&map->lock, file, line); } /* @@ -615,30 +611,15 @@ _vm_map_assert_locked(vm_map_t map, cons { if (map->system_map) - _mtx_assert(&map->system_mtx, MA_OWNED, file, line); - else - _sx_assert(&map->lock, SA_XLOCKED, file, line); -} - -#if 0 -static void -_vm_map_assert_locked_read(vm_map_t map, const char *file, int line) -{ - - if (map->system_map) - _mtx_assert(&map->system_mtx, MA_OWNED, file, line); + mtx_assert_(&map->system_mtx, MA_OWNED, file, line); else - _sx_assert(&map->lock, SA_SLOCKED, file, line); + sx_assert_(&map->lock, SA_XLOCKED, file, line); } -#endif #define VM_MAP_ASSERT_LOCKED(map) \ _vm_map_assert_locked(map, LOCK_FILE, LOCK_LINE) -#define VM_MAP_ASSERT_LOCKED_READ(map) \ - _vm_map_assert_locked_read(map, LOCK_FILE, LOCK_LINE) #else #define VM_MAP_ASSERT_LOCKED(map) -#define VM_MAP_ASSERT_LOCKED_READ(map) #endif /* @@ -661,9 +642,9 @@ _vm_map_unlock_and_wait(vm_map_t map, in mtx_lock(&map_sleep_mtx); if (map->system_map) - _mtx_unlock_flags(&map->system_mtx, 0, file, line); + mtx_unlock_flags_(&map->system_mtx, 0, file, line); else - _sx_xunlock(&map->lock, file, line); + sx_xunlock_(&map->lock, file, line); return (msleep(&map->root, &map_sleep_mtx, PDROP | PVM, "vmmaps", timo)); } From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 01:51:31 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D49E106564A; Tue, 31 Jan 2012 01:51:31 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 076178FC18; Tue, 31 Jan 2012 01:51:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0V1pUgf012597; Tue, 31 Jan 2012 01:51:30 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0V1pUaZ012592; Tue, 31 Jan 2012 01:51:30 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201201310151.q0V1pUaZ012592@svn.freebsd.org> From: Attilio Rao Date: Tue, 31 Jan 2012 01:51:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230800 - stable/9/sys/dev/ppbus X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 01:51:31 -0000 Author: attilio Date: Tue Jan 31 01:51:30 2012 New Revision: 230800 URL: http://svn.freebsd.org/changeset/base/230800 Log: MFC r227814: - Use ppb_assert_locked() rather than using explicit mtx_assert call - Make ppbus code agnostic in regard of INVARIANTS option Modified: stable/9/sys/dev/ppbus/lpt.c stable/9/sys/dev/ppbus/ppb_base.c stable/9/sys/dev/ppbus/ppb_msq.c stable/9/sys/dev/ppbus/vpo.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/ppbus/lpt.c ============================================================================== --- stable/9/sys/dev/ppbus/lpt.c Tue Jan 31 01:45:20 2012 (r230799) +++ stable/9/sys/dev/ppbus/lpt.c Tue Jan 31 01:51:30 2012 (r230800) @@ -447,10 +447,9 @@ lptout(void *arg) { struct lpt_data *sc = arg; device_t dev = sc->sc_dev; -#if defined(INVARIANTS) || defined(LPT_DEBUG) - device_t ppbus = device_get_parent(dev); -#endif + device_t ppbus; + ppbus = device_get_parent(dev); ppb_assert_locked(ppbus); lprintf(("T %x ", ppb_rstr(ppbus))); if (sc->sc_state & OPEN) { Modified: stable/9/sys/dev/ppbus/ppb_base.c ============================================================================== --- stable/9/sys/dev/ppbus/ppb_base.c Tue Jan 31 01:45:20 2012 (r230799) +++ stable/9/sys/dev/ppbus/ppb_base.c Tue Jan 31 01:51:30 2012 (r230800) @@ -60,7 +60,7 @@ ppb_poll_bus(device_t bus, int max, int i, j, error; char r; - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); /* try at least up to 10ms */ for (j = 0; j < ((how & PPB_POLL) ? max : 1); j++) { @@ -96,12 +96,9 @@ ppb_poll_bus(device_t bus, int max, int ppb_get_epp_protocol(device_t bus) { -#ifdef INVARIANTS - struct ppb_data *ppb = DEVTOSOFTC(bus); -#endif uintptr_t protocol; - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); BUS_READ_IVAR(device_get_parent(bus), bus, PPC_IVAR_EPP_PROTO, &protocol); return (protocol); @@ -117,7 +114,7 @@ ppb_get_mode(device_t bus) struct ppb_data *ppb = DEVTOSOFTC(bus); /* XXX yet device mode = ppbus mode = chipset mode */ - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); return (ppb->mode); } @@ -132,7 +129,7 @@ ppb_set_mode(device_t bus, int mode) struct ppb_data *ppb = DEVTOSOFTC(bus); int old_mode = ppb_get_mode(bus); - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); if (PPBUS_SETMODE(device_get_parent(bus), mode)) return (-1); @@ -150,11 +147,8 @@ ppb_set_mode(device_t bus, int mode) int ppb_write(device_t bus, char *buf, int len, int how) { -#ifdef INVARIANTS - struct ppb_data *ppb = DEVTOSOFTC(bus); -#endif - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); return (PPBUS_WRITE(device_get_parent(bus), buf, len, how)); } @@ -166,11 +160,8 @@ ppb_write(device_t bus, char *buf, int l int ppb_reset_epp_timeout(device_t bus) { -#ifdef INVARIANTS - struct ppb_data *ppb = DEVTOSOFTC(bus); -#endif - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); return(PPBUS_RESET_EPP(device_get_parent(bus))); } @@ -182,11 +173,8 @@ ppb_reset_epp_timeout(device_t bus) int ppb_ecp_sync(device_t bus) { -#ifdef INVARIANTS - struct ppb_data *ppb = DEVTOSOFTC(bus); -#endif - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); return (PPBUS_ECP_SYNC(device_get_parent(bus))); } @@ -198,12 +186,9 @@ ppb_ecp_sync(device_t bus) int ppb_get_status(device_t bus, struct ppb_status *status) { -#ifdef INVARIANTS - struct ppb_data *ppb = DEVTOSOFTC(bus); -#endif register char r; - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); r = status->status = ppb_rstr(bus); Modified: stable/9/sys/dev/ppbus/ppb_msq.c ============================================================================== --- stable/9/sys/dev/ppbus/ppb_msq.c Tue Jan 31 01:45:20 2012 (r230799) +++ stable/9/sys/dev/ppbus/ppb_msq.c Tue Jan 31 01:51:30 2012 (r230800) @@ -117,13 +117,10 @@ mode2xfer(device_t bus, struct ppb_devic int ppb_MS_init(device_t bus, device_t dev, struct ppb_microseq *loop, int opcode) { -#ifdef INVARIANTS - struct ppb_data *ppb = device_get_softc(bus); -#endif struct ppb_device *ppbdev = (struct ppb_device *)device_get_ivars(dev); struct ppb_xfer *xfer = mode2xfer(bus, ppbdev, opcode); - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); xfer->loop = loop; return (0); Modified: stable/9/sys/dev/ppbus/vpo.c ============================================================================== --- stable/9/sys/dev/ppbus/vpo.c Tue Jan 31 01:45:20 2012 (r230799) +++ stable/9/sys/dev/ppbus/vpo.c Tue Jan 31 01:51:30 2012 (r230800) @@ -298,11 +298,8 @@ static void vpo_action(struct cam_sim *sim, union ccb *ccb) { struct vpo_data *vpo = (struct vpo_data *)sim->softc; -#ifdef INVARIANTS - device_t ppbus = device_get_parent(vpo->vpo_dev); - ppb_assert_locked(ppbus); -#endif + ppb_assert_locked(device_get_parent(vpo->vpo_dev)); switch (ccb->ccb_h.func_code) { case XPT_SCSI_IO: { From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 02:30:47 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0AE91065679; Tue, 31 Jan 2012 02:30:47 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ABD488FC18; Tue, 31 Jan 2012 02:30:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0V2UlPY014297; Tue, 31 Jan 2012 02:30:47 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0V2UlRu014295; Tue, 31 Jan 2012 02:30:47 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201201310230.q0V2UlRu014295@svn.freebsd.org> From: Justin Hibbits Date: Tue, 31 Jan 2012 02:30:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230802 - stable/9/etc/devd X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 02:30:47 -0000 Author: jhibbits Date: Tue Jan 31 02:30:47 2012 New Revision: 230802 URL: http://svn.freebsd.org/changeset/base/230802 Log: MFC r230640: Remove the notify match from a couple devd apple events, the events don't include notify tags. Approved by: nwhitehorn (mentor) Modified: stable/9/etc/devd/apple.conf Directory Properties: stable/9/etc/ (props changed) Modified: stable/9/etc/devd/apple.conf ============================================================================== --- stable/9/etc/devd/apple.conf Tue Jan 31 02:11:05 2012 (r230801) +++ stable/9/etc/devd/apple.conf Tue Jan 31 02:30:47 2012 (r230802) @@ -6,7 +6,6 @@ notify 0 { match "system" "PMU"; match "subsystem" "Button"; - match "notify" "0x0"; action "shutdown -p now"; }; @@ -16,7 +15,6 @@ notify 0 { match "system" "PMU"; match "subsystem" "lid"; match "type" "close"; - match "notify" "0x0"; action "shutdown -p now"; }; From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 10:46:51 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0D121065675; Tue, 31 Jan 2012 10:46:51 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E97E8FC08; Tue, 31 Jan 2012 10:46:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0VAkpgs031833; Tue, 31 Jan 2012 10:46:51 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0VAkpWD031831; Tue, 31 Jan 2012 10:46:51 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201311046.q0VAkpWD031831@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 31 Jan 2012 10:46:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230805 - stable/7/sys/netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 10:46:51 -0000 Author: pluknet Date: Tue Jan 31 10:46:51 2012 New Revision: 230805 URL: http://svn.freebsd.org/changeset/base/230805 Log: MFC r230531: Remove unused variable. Modified: stable/7/sys/netinet6/nd6.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/netinet6/nd6.c ============================================================================== --- stable/7/sys/netinet6/nd6.c Tue Jan 31 05:49:49 2012 (r230804) +++ stable/7/sys/netinet6/nd6.c Tue Jan 31 10:46:51 2012 (r230805) @@ -534,7 +534,6 @@ nd6_timer(void *ignored_arg) struct nd_defrouter *dr; struct nd_prefix *pr; struct in6_ifaddr *ia6, *nia6; - struct in6_addrlifetime *lt6; callout_reset(&nd6_timer_ch, nd6_prune * hz, nd6_timer, NULL); @@ -563,7 +562,6 @@ nd6_timer(void *ignored_arg) for (ia6 = in6_ifaddr; ia6; ia6 = nia6) { nia6 = ia6->ia_next; /* check address lifetime */ - lt6 = &ia6->ia6_lifetime; if (IFA6_IS_INVALID(ia6)) { int regen = 0; From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 11:00:34 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 567AE1065672; Tue, 31 Jan 2012 11:00:34 +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 447A68FC20; Tue, 31 Jan 2012 11:00:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0VB0YHd032314; Tue, 31 Jan 2012 11:00:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0VB0YXN032312; Tue, 31 Jan 2012 11:00:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201311100.q0VB0YXN032312@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 31 Jan 2012 11:00:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230806 - stable/9/share/man/man9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 11:00:34 -0000 Author: kib Date: Tue Jan 31 11:00:33 2012 New Revision: 230806 URL: http://svn.freebsd.org/changeset/base/230806 Log: MFC r227698: Update the manpage for r227697. Modified: stable/9/share/man/man9/VOP_VPTOCNP.9 Directory Properties: stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man9/VOP_VPTOCNP.9 ============================================================================== --- stable/9/share/man/man9/VOP_VPTOCNP.9 Tue Jan 31 10:46:51 2012 (r230805) +++ stable/9/share/man/man9/VOP_VPTOCNP.9 Tue Jan 31 11:00:33 2012 (r230806) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 7, 2008 +.Dd November 19, 2011 .Dt VOP_VPTOCNP 9 .Os .Sh NAME @@ -65,9 +65,9 @@ is not a directory, then .Nm returns ENOENT. .Sh LOCKS -The vnode should be locked on entry and will still be locked on exit. The -parent directory vnode will be unlocked on a successful exit. However, it -will have its hold count incremented. +The vnode should be locked on entry and will still be locked on exit. +The parent directory vnode will be unlocked on a successful exit. +However, it will have its use count incremented. .Sh RETURN VALUES Zero is returned on success, otherwise an error code is returned. .Sh ERRORS From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 18:13:50 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 710F5106566B; Tue, 31 Jan 2012 18:13:50 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E7908FC08; Tue, 31 Jan 2012 18:13:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0VIDodF048408; Tue, 31 Jan 2012 18:13:50 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0VIDoGV048406; Tue, 31 Jan 2012 18:13:50 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201201311813.q0VIDoGV048406@svn.freebsd.org> From: "Justin T. Gibbs" Date: Tue, 31 Jan 2012 18:13:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230831 - stable/8/sys/dev/xen/netfront X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 18:13:50 -0000 Author: gibbs Date: Tue Jan 31 18:13:49 2012 New Revision: 230831 URL: http://svn.freebsd.org/changeset/base/230831 Log: MFC r225708 into stable/8: Modify the netfront driver so it can successfully attach to PV devices with the ioemu attribute set. sys/dev/xen/netfront/netfront.c: o If a mac address for the interface cannot be found in the front-side XenStore tree, look for an entry in the back-side tree. With ioemu devices, the emulator does not populate the front side tree and neither does Xend. o Return an error rather than panic when an attach attempt fails. Reported by: Janne Snabb (fix inspired by patch provided) PR: kern/154302 Modified: stable/8/sys/dev/xen/netfront/netfront.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) Modified: stable/8/sys/dev/xen/netfront/netfront.c ============================================================================== --- stable/8/sys/dev/xen/netfront/netfront.c Tue Jan 31 17:51:30 2012 (r230830) +++ stable/8/sys/dev/xen/netfront/netfront.c Tue Jan 31 18:13:49 2012 (r230831) @@ -402,11 +402,33 @@ xen_net_read_mac(device_t dev, uint8_t m { int error, i; char *s, *e, *macstr; + const char *path; - error = xs_read(XST_NIL, xenbus_get_node(dev), "mac", NULL, - (void **) &macstr); - if (error) + path = xenbus_get_node(dev); + error = xs_read(XST_NIL, path, "mac", NULL, (void **) &macstr); + if (error == ENOENT) { + /* + * Deal with missing mac XenStore nodes on devices with + * HVM emulation (the 'ioemu' configuration attribute) + * enabled. + * + * The HVM emulator may execute in a stub device model + * domain which lacks the permission, only given to Dom0, + * to update the guest's XenStore tree. For this reason, + * the HVM emulator doesn't even attempt to write the + * front-side mac node, even when operating in Dom0. + * However, there should always be a mac listed in the + * backend tree. Fallback to this version if our query + * of the front side XenStore location doesn't find + * anything. + */ + path = xenbus_get_otherend_path(dev); + error = xs_read(XST_NIL, path, "mac", NULL, (void **) &macstr); + } + if (error != 0) { + xenbus_dev_fatal(dev, error, "parsing %s/mac", path); return (error); + } s = macstr; for (i = 0; i < ETHER_ADDR_LEN; i++) { @@ -447,7 +469,7 @@ netfront_attach(device_t dev) err = create_netdev(dev); if (err) { xenbus_dev_fatal(dev, err, "creating netdev"); - return err; + return (err); } #if __FreeBSD_version >= 700000 @@ -457,7 +479,7 @@ netfront_attach(device_t dev) &xn_enable_lro, 0, "Large Receive Offload"); #endif - return 0; + return (0); } @@ -2020,11 +2042,8 @@ create_netdev(device_t dev) } err = xen_net_read_mac(dev, np->mac); - if (err) { - xenbus_dev_fatal(dev, err, "parsing %s/mac", - xenbus_get_node(dev)); + if (err) goto out; - } /* Set up ifnet structure */ ifp = np->xn_ifp = if_alloc(IFT_ETHER); @@ -2066,8 +2085,7 @@ create_netdev(device_t dev) exit: gnttab_free_grant_references(np->gref_tx_head); out: - panic("do something smart"); - + return (err); } /** From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 18:42:22 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4C6F1065672; Tue, 31 Jan 2012 18:42:22 +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 994508FC08; Tue, 31 Jan 2012 18:42:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0VIgMDX049650; Tue, 31 Jan 2012 18:42:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0VIgMIZ049647; Tue, 31 Jan 2012 18:42:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201311842.q0VIgMIZ049647@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 31 Jan 2012 18:42:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230836 - stable/9/sys/vm X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 18:42:22 -0000 Author: kib Date: Tue Jan 31 18:42:22 2012 New Revision: 230836 URL: http://svn.freebsd.org/changeset/base/230836 Log: MFC r228133: Hide the internals of vm_page_lock(9) from the loadable modules. Modified: stable/9/sys/vm/vm_page.c stable/9/sys/vm/vm_page.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_page.c ============================================================================== --- stable/9/sys/vm/vm_page.c Tue Jan 31 18:37:26 2012 (r230835) +++ stable/9/sys/vm/vm_page.c Tue Jan 31 18:42:22 2012 (r230836) @@ -2642,6 +2642,36 @@ vm_page_test_dirty(vm_page_t m) vm_page_dirty(m); } +void +vm_page_lock_KBI(vm_page_t m, const char *file, int line) +{ + + mtx_lock_flags_(vm_page_lockptr(m), 0, file, line); +} + +void +vm_page_unlock_KBI(vm_page_t m, const char *file, int line) +{ + + mtx_unlock_flags_(vm_page_lockptr(m), 0, file, line); +} + +int +vm_page_trylock_KBI(vm_page_t m, const char *file, int line) +{ + + return (mtx_trylock_flags_(vm_page_lockptr(m), 0, file, line)); +} + +#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) +void +vm_page_lock_assert_KBI(vm_page_t m, int a, const char *file, int line) +{ + + mtx_assert_(vm_page_lockptr(m), a, file, line); +} +#endif + int so_zerocp_fullpage = 0; /* Modified: stable/9/sys/vm/vm_page.h ============================================================================== --- stable/9/sys/vm/vm_page.h Tue Jan 31 18:37:26 2012 (r230835) +++ stable/9/sys/vm/vm_page.h Tue Jan 31 18:42:22 2012 (r230836) @@ -218,11 +218,23 @@ extern struct vpglocks pa_lock[]; #define PA_LOCK_ASSERT(pa, a) mtx_assert(PA_LOCKPTR(pa), (a)) +#ifdef KLD_MODULE +#define vm_page_lock(m) vm_page_lock_KBI((m), LOCK_FILE, LOCK_LINE) +#define vm_page_unlock(m) vm_page_unlock_KBI((m), LOCK_FILE, LOCK_LINE) +#define vm_page_trylock(m) vm_page_trylock_KBI((m), LOCK_FILE, LOCK_LINE) +#if defined(INVARIANTS) +#define vm_page_lock_assert(m, a) \ + vm_page_lock_assert_KBI((m), (a), __FILE__, __LINE__) +#else +#define vm_page_lock_assert(m, a) +#endif +#else /* !KLD_MODULE */ #define vm_page_lockptr(m) (PA_LOCKPTR(VM_PAGE_TO_PHYS((m)))) #define vm_page_lock(m) mtx_lock(vm_page_lockptr((m))) #define vm_page_unlock(m) mtx_unlock(vm_page_lockptr((m))) #define vm_page_trylock(m) mtx_trylock(vm_page_lockptr((m))) #define vm_page_lock_assert(m, a) mtx_assert(vm_page_lockptr((m)), (a)) +#endif #define vm_page_queue_free_mtx vm_page_queue_free_lock.data /* @@ -403,6 +415,13 @@ void vm_page_cowfault (vm_page_t); int vm_page_cowsetup(vm_page_t); void vm_page_cowclear (vm_page_t); +void vm_page_lock_KBI(vm_page_t m, const char *file, int line); +void vm_page_unlock_KBI(vm_page_t m, const char *file, int line); +int vm_page_trylock_KBI(vm_page_t m, const char *file, int line); +#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) +void vm_page_lock_assert_KBI(vm_page_t m, int a, const char *file, int line); +#endif + #ifdef INVARIANTS void vm_page_object_lock_assert(vm_page_t m); #define VM_PAGE_OBJECT_LOCK_ASSERT(m) vm_page_object_lock_assert(m) From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 19:00:02 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B598106564A; Tue, 31 Jan 2012 19:00:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E99B8FC0A; Tue, 31 Jan 2012 19:00:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0VJ02Ea050410; Tue, 31 Jan 2012 19:00:02 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0VJ02rm050407; Tue, 31 Jan 2012 19:00:02 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201311900.q0VJ02rm050407@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 31 Jan 2012 19:00:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230840 - stable/9/share/man/man9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 19:00:02 -0000 Author: glebius Date: Tue Jan 31 19:00:01 2012 New Revision: 230840 URL: http://svn.freebsd.org/changeset/base/230840 Log: Merge r228499: Update this page to describe modern interfaces. Modified: stable/9/share/man/man9/rtalloc.9 Directory Properties: stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man9/rtalloc.9 ============================================================================== --- stable/9/share/man/man9/rtalloc.9 Tue Jan 31 18:48:54 2012 (r230839) +++ stable/9/share/man/man9/rtalloc.9 Tue Jan 31 19:00:01 2012 (r230840) @@ -28,160 +28,163 @@ .\" .\" $FreeBSD$ .\" -.Dd December 11, 2008 +.Dd December 14, 2011 .Dt RTALLOC 9 .Os .Sh NAME -.Nm rtalloc , -.Nm rtalloc_ign , -.Nm rtalloc1 , -.Nm rtfree +.Nm rtalloc1_fib , +.Nm rtalloc_ign_fib , +.Nm rtalloc_fib .Nd look up a route in the kernel routing table .Sh SYNOPSIS .In sys/types.h .In sys/socket.h .In net/route.h -.Ft void -.Fn rtalloc "struct route *ro" -.Ft void -.Fn rtalloc_ign "struct route *ro" "u_long flags" .Ft "struct rtentry *" -.Fn rtalloc1 "struct sockaddr *sa" "int report" "u_long flags" +.Fn rtalloc1_fib "struct sockaddr *dst" "int report" "u_long flags" "u_int fibnum" .Ft void -.Fn rtfree "struct rt_entry *rt" +.Fn rtalloc_fib "struct route *ro" "u_int fibnum" +.Ft void +.Fn rtalloc_ign_fib "struct route *ro" "u_long flags" "u_int fibnum" +.Fn RTFREE_LOCKED "struct rt_entry *rt" .Fn RTFREE "struct rt_entry *rt" .Fn RT_LOCK "struct rt_entry *rt" .Fn RT_UNLOCK "struct rt_entry *rt" .Fn RT_ADDREF "struct rt_entry *rt" .Fn RT_REMREF "struct rt_entry *rt" +.Ft void +.Fn rtfree "struct rt_entry *rt" +.Ft "struct rtentry *" +.Fn rtalloc1 "struct sockaddr *dst" "int report" "u_long flags" +.Ft void +.Fn rtalloc "struct route *ro" +.Ft void +.Fn rtalloc_ign "struct route *ro" "u_long flags" +.Pp +.Cd options RADIX_MPATH .Sh DESCRIPTION The kernel uses a radix tree structure to manage routes for the networking subsystem. +If compiled with +.Cd options RADIX_MPATH +kernel may maintain several independent forwarding information databases (FIBs). The .Fn rtalloc -family of routines is used by protocols to query this structure for a +family of routines is used by protocols to query these structures for a route corresponding to a particular end-node address, and to cause certain protocol\- and interface-specific actions to take place. -.\" XXX - -mdoc should contain a standard request for getting em and -.\" en dashes. .Pp -.Dv RTF_PRCLONING -flag is obsolete and thus ignored by facility. -If the -.Dv RTF_XRESOLVE -flag is set, then the -.Dv RTM_RESOLVE -message is sent instead on the -.Xr route 4 -socket interface, requesting that an external program resolve the -address in question and modify the route appropriately. -.Pp -The default interface is -.Fn rtalloc . -Its only argument is +The +.Fn rtalloc1_fib +function is the most general form of +.Fn rtalloc , +and all of the other forms are implemented as calls to it. +It takes a +.Fa "struct sockaddr *" +directly as the +.Fa dst +argument. +The second argument, +.Fa report , +controls whether the routing sockets are notified when a lookup fails. +The third argument, +.Fa flags , +is a combination of +the following values: +.Bl -item -offset indent +.It +.Dv RTF_RNH_LOCKED +indicates that the radix tree lock is already held +.El +.Pp +The last argument +.Fa fibnum +specifies number of forwarding information database (FIB) on which +the lookup should be performed. +In case of success the +.Fn rtalloc1_fib +function returns a pointer to a locked +.Vt "struct rtentry" +with an additional reference. +.Pp +The +.Fn rtalloc_fib +is the most simple variant. +Its main argument is .Fa ro , a pointer to a -.Dq Li "struct route" , +.Fa "struct route" , which is defined as follows: .Bd -literal -offset indent struct route { - struct sockaddr ro_dst; struct rtentry *ro_rt; + struct llentry *ro_lle; + struct sockaddr ro_dst; }; .Ed .Pp Thus, this function can only be used for address families which are smaller than the default -.Dq Li "struct sockaddr" . +.Ft "struct sockaddr" . Before calling -.Fn rtalloc +.Fn rtalloc_fib for the first time, callers should ensure that unused bits of the structure are set to zero. +The second argument +.Fa fibnum +is FIB number. +In case of success of the +.Fn rtalloc_fib +the +.Fa ro_rt +points to a valid and unlocked +.Xr rtentry 9 , +which has an additional reference put on it, freeing which is +responsibility of the caller. On subsequent calls, -.Fn rtalloc +.Fn rtalloc_fib returns without performing a lookup if .Fa ro->ro_rt is non-null and the .Dv RTF_UP -flag is set in the route's -.Li rt_flags +flag is set in the rtentry's +.Fa rt_flags field. .Pp The -.Fn rtalloc_ign -interface can be used when the caller does not want to receive -the returned -.Fa rtentry -locked. -The -.Fa ro -argument is the same as -.Fn rtalloc , -but there is additionally a +.Fn rtalloc_ign_fib +function is the same as the +.Fn rtalloc_fib , +but there is additional .Fa flags -argument, which is now only used to pass -.Dv RTF_RNH_LOCKED -indicating that the radix tree lock is already held. -Both -.Fn rtalloc -and -.Fn rtalloc_ign -functions return a pointer to an unlocked -.Vt "struct rtentry" . -.Pp -The -.Fn rtalloc1 -function is the most general form of -.Fn rtalloc -(and both of the other forms are implemented as calls to rtalloc1). -It does not use the -.Dq Li "struct route" , -and is therefore suitable for address families which require more -space than is in a traditional -.Dq Li "struct sockaddr" . -Instead, it takes a -.Dq Li "struct sockaddr *" -directly as the -.Fa sa -argument. -The second argument, -.Fa report , -controls whether the lower layers are notified when a lookup fails. -The third argument, -.Fa flags , -is a set of flags to ignore, as in -.Fn rtalloc_ign . -The -.Fn rtalloc1 -function returns a pointer to a locked -.Vt "struct rtentry" . +argument, which is same as in +.Fn rtalloc1_fib . .Pp The -.Fn rtfree -function frees a locked route entry, e.g., a previously allocated by -.Fn rtalloc1 . +.Fn RTFREE_LOCKED +macro is used to unref and possibly free a locked routing entry +with one our reference, for example previously allocated by +.Fn rtalloc1_fib . .Pp The .Fn RTFREE -macro is used to free unlocked route entries, previously allocated by -.Fn rtalloc +macro is used to unref and possibly free an unlocked route entries with +one our reference, for example previously allocated by +.Fn rtalloc_fib or -.Fn rtalloc_ign . -The -.Fn RTFREE -macro decrements the reference count on the routing table entry (see below), -and frees it if the reference count has reached zero. +.Fn rtalloc_ign_fib . .Pp -The preferred usage is allocating a route using -.Fn rtalloc -or -.Fn rtalloc_ign -and freeing using -.Fn RTFREE . +Both +.Fn RTFREE_LOCKED +and +.Fn RTFREE +macros decrement the reference count on the routing table entry, +and proceed with actual freeing if the reference count has reached zero. .Pp The .Fn RT_LOCK macro is used to lock a routing table entry. +.Pp The .Fn RT_UNLOCK macro is used to unlock a routing table entry. @@ -189,20 +192,53 @@ macro is used to unlock a routing table The .Fn RT_ADDREF macro increments the reference count on a previously locked route entry. +It should be used whenever a reference to an +.Xr rtentry 9 +is going to be stored outside the routing table. +.Pp The .Fn RT_REMREF macro decrements the reference count on a previously locked route entry. -.Sh RETURN VALUES +Its usage is contrary to +.Fn RT_ADDREF . +.Pp The -.Fn rtalloc , -.Fn rtalloc_ign -and .Fn rtfree -functions do not return a value. +function does the actual free of the routing table entry, and shouldn't +be called directly by facilities, that just perform routing table lookups. +.Sh LEGACY INTERFACE +Prior to introduction of multiple routing tables functions did not +require the +.Fa "u_int fibnum" +argument. +Legacy +.Fn rtalloc1 , +.Fn rtalloc +and +.Fn rtalloc_ign +functions are kept for compatibility, and are equivalent to +calling new interface with +.Fa fibnum +argument equal to +.Va 0 , +which implies default forwarding table. +.Sh RETURN VALUES The -.Fn rtalloc1 -function returns a pointer to a routing-table entry if it succeeds, +.Fn rtalloc1_fib +function returns a pointer to a locked routing-table entry if it succeeds, otherwise a null pointer. +The +.Fn rtalloc_fib +and +.Fn rtalloc_ign_fib +functions do not return a value, but they fill in the +.Fa *ro_rt +member of the +.Fa *ro +argument with a pointer to an unlocked routing-table entry if they +succeed, otherwise a null pointer. +In a case of success all functions put a reference on the +routing-table entry, freeing of which is responsibility of the caller. Lack of a route should in most cases be translated to the .Xr errno 2 @@ -213,7 +249,7 @@ value .Xr rtentry 9 .Sh HISTORY The -.Nm +.Nm rtalloc facility first appeared in .Bx 4.2 , although with much different internals. @@ -227,14 +263,11 @@ first appeared in .Fx 2.0 . Routing table locking was introduced in .Fx 5.2 . +Multiple routing tables were introduced in +.Fx 8.0 . .Sh AUTHORS -This manual page was written by -.An Garrett Wollman , -as were the changes to implement -.Dv RTF_PRCLONING -and the -.Fn rtalloc_ign -function and the -.Fa flags -argument to -.Fn rtalloc1 . +The original version of this manual page was written by +.An -nosplit +.An "Garrett Wollman" . +It was significantly updated by +.An "Gleb Smirnoff" . From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 19:02:34 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 446EF1065672; Tue, 31 Jan 2012 19:02:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 324888FC0A; Tue, 31 Jan 2012 19:02:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0VJ2YhT050550; Tue, 31 Jan 2012 19:02:34 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0VJ2YwP050548; Tue, 31 Jan 2012 19:02:34 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201311902.q0VJ2YwP050548@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 31 Jan 2012 19:02:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230841 - stable/9/share/man/man9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 19:02:34 -0000 Author: glebius Date: Tue Jan 31 19:02:33 2012 New Revision: 230841 URL: http://svn.freebsd.org/changeset/base/230841 Log: Merge 228500: More MLINKS for rtalloc.9 Modified: stable/9/share/man/man9/Makefile Directory Properties: stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man9/Makefile ============================================================================== --- stable/9/share/man/man9/Makefile Tue Jan 31 19:00:01 2012 (r230840) +++ stable/9/share/man/man9/Makefile Tue Jan 31 19:02:33 2012 (r230841) @@ -1033,8 +1033,12 @@ MLINKS+=rmlock.9 rm_destroy.9 \ rmlock.9 rm_wunlock.9 MLINKS+=rtalloc.9 rtalloc1.9 \ rtalloc.9 rtalloc_ign.9 \ + rtalloc.9 RTFREE_LOCKED.9 \ rtalloc.9 RTFREE.9 \ - rtalloc.9 rtfree.9 + rtalloc.9 rtfree.9 \ + rtalloc.9 rtalloc1_fib.9 \ + rtalloc.9 rtalloc_ign_fib.9 \ + rtalloc.9 rtalloc_fib.9 MLINKS+=runqueue.9 choosethread.9 \ runqueue.9 procrunnable.9 \ runqueue.9 remrunqueue.9 \ From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 19:07:09 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7BF08106564A; Tue, 31 Jan 2012 19:07:09 +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 6A1808FC08; Tue, 31 Jan 2012 19:07:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0VJ79Ix050774; Tue, 31 Jan 2012 19:07:09 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0VJ79K6050772; Tue, 31 Jan 2012 19:07:09 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201311907.q0VJ79K6050772@svn.freebsd.org> From: John Baldwin Date: Tue, 31 Jan 2012 19:07:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230842 - stable/8/lib/libc/stdtime X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 19:07:09 -0000 Author: jhb Date: Tue Jan 31 19:07:08 2012 New Revision: 230842 URL: http://svn.freebsd.org/changeset/base/230842 Log: MFC 226828: Fix a memory leak in tzload(). Modified: stable/8/lib/libc/stdtime/localtime.c Directory Properties: stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/stdtime/localtime.c ============================================================================== --- stable/8/lib/libc/stdtime/localtime.c Tue Jan 31 19:02:33 2012 (r230841) +++ stable/8/lib/libc/stdtime/localtime.c Tue Jan 31 19:07:08 2012 (r230842) @@ -457,6 +457,7 @@ register const int doextend; _close(fid); return -1; } + free(fullname); } u = malloc(sizeof(*u)); if (u == NULL) From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 22:47:11 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61704106564A; Tue, 31 Jan 2012 22:47:11 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4EA978FC14; Tue, 31 Jan 2012 22:47:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0VMlBxg058561; Tue, 31 Jan 2012 22:47:11 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0VMlBA1058553; Tue, 31 Jan 2012 22:47:11 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201201312247.q0VMlBA1058553@svn.freebsd.org> From: Jack F Vogel Date: Tue, 31 Jan 2012 22:47:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230848 - stable/8/sys/dev/e1000 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 22:47:11 -0000 Author: jfv Date: Tue Jan 31 22:47:10 2012 New Revision: 230848 URL: http://svn.freebsd.org/changeset/base/230848 Log: MFC of e1000 drivers The following revs are merged: 212303,212304,213234,214363,214441,217556,219902,221505, 223676,226436,227309,228386,228387,228405,228415,228788, 228803,229606,229767,230023,230024,230742 Modified: stable/8/sys/dev/e1000/README stable/8/sys/dev/e1000/e1000_80003es2lan.c stable/8/sys/dev/e1000/e1000_80003es2lan.h stable/8/sys/dev/e1000/e1000_82540.c stable/8/sys/dev/e1000/e1000_82541.c stable/8/sys/dev/e1000/e1000_82543.c stable/8/sys/dev/e1000/e1000_82571.c stable/8/sys/dev/e1000/e1000_82575.c stable/8/sys/dev/e1000/e1000_82575.h stable/8/sys/dev/e1000/e1000_api.c stable/8/sys/dev/e1000/e1000_api.h stable/8/sys/dev/e1000/e1000_defines.h stable/8/sys/dev/e1000/e1000_hw.h stable/8/sys/dev/e1000/e1000_ich8lan.c stable/8/sys/dev/e1000/e1000_ich8lan.h stable/8/sys/dev/e1000/e1000_mac.c stable/8/sys/dev/e1000/e1000_nvm.c stable/8/sys/dev/e1000/e1000_nvm.h stable/8/sys/dev/e1000/e1000_osdep.c stable/8/sys/dev/e1000/e1000_phy.c stable/8/sys/dev/e1000/e1000_phy.h stable/8/sys/dev/e1000/e1000_regs.h stable/8/sys/dev/e1000/e1000_vf.c stable/8/sys/dev/e1000/if_em.c stable/8/sys/dev/e1000/if_em.h stable/8/sys/dev/e1000/if_igb.c stable/8/sys/dev/e1000/if_igb.h stable/8/sys/dev/e1000/if_lem.c stable/8/sys/dev/e1000/if_lem.h Directory Properties: stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/e1000/README ============================================================================== --- stable/8/sys/dev/e1000/README Tue Jan 31 22:31:16 2012 (r230847) +++ stable/8/sys/dev/e1000/README Tue Jan 31 22:47:10 2012 (r230848) @@ -354,6 +354,7 @@ Known Limitations include: Planex FXG-08TE I-O Data ETG-SH8 + Netgear GS105v3 The driver can be compiled with the following changes: Modified: stable/8/sys/dev/e1000/e1000_80003es2lan.c ============================================================================== --- stable/8/sys/dev/e1000/e1000_80003es2lan.c Tue Jan 31 22:31:16 2012 (r230847) +++ stable/8/sys/dev/e1000/e1000_80003es2lan.c Tue Jan 31 22:47:10 2012 (r230848) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -47,18 +47,18 @@ static void e1000_release_phy_80003es2la static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw); static void e1000_release_nvm_80003es2lan(struct e1000_hw *hw); static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, - u16 *data); + u32 offset, + u16 *data); static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, - u16 data); + u32 offset, + u16 data); static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data); + u16 words, u16 *data); static s32 e1000_get_cfg_done_80003es2lan(struct e1000_hw *hw); static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw); static s32 e1000_get_cable_length_80003es2lan(struct e1000_hw *hw); static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, - u16 *duplex); + u16 *duplex); static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw); static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw); static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw); @@ -68,9 +68,9 @@ static s32 e1000_cfg_kmrn_10_100_80003e static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw); static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw); static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 *data); + u16 *data); static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 data); + u16 data); static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw); static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw); static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); @@ -85,8 +85,8 @@ static void e1000_power_down_phy_copper_ static const u16 e1000_gg82563_cable_length_table[] = { 0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF }; #define GG82563_CABLE_LENGTH_TABLE_SIZE \ - (sizeof(e1000_gg82563_cable_length_table) / \ - sizeof(e1000_gg82563_cable_length_table[0])) + (sizeof(e1000_gg82563_cable_length_table) / \ + sizeof(e1000_gg82563_cable_length_table[0])) /** * e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs. @@ -100,34 +100,34 @@ static s32 e1000_init_phy_params_80003es DEBUGFUNC("e1000_init_phy_params_80003es2lan"); if (hw->phy.media_type != e1000_media_type_copper) { - phy->type = e1000_phy_none; + phy->type = e1000_phy_none; goto out; } else { phy->ops.power_up = e1000_power_up_phy_copper; phy->ops.power_down = e1000_power_down_phy_copper_80003es2lan; } - phy->addr = 1; - phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; - phy->reset_delay_us = 100; - phy->type = e1000_phy_gg82563; - - phy->ops.acquire = e1000_acquire_phy_80003es2lan; - phy->ops.check_polarity = e1000_check_polarity_m88; - phy->ops.check_reset_block = e1000_check_reset_block_generic; - phy->ops.commit = e1000_phy_sw_reset_generic; - phy->ops.get_cfg_done = e1000_get_cfg_done_80003es2lan; - phy->ops.get_info = e1000_get_phy_info_m88; - phy->ops.release = e1000_release_phy_80003es2lan; - phy->ops.reset = e1000_phy_hw_reset_generic; - phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; + phy->addr = 1; + phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; + phy->reset_delay_us = 100; + phy->type = e1000_phy_gg82563; + + phy->ops.acquire = e1000_acquire_phy_80003es2lan; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.check_reset_block = e1000_check_reset_block_generic; + phy->ops.commit = e1000_phy_sw_reset_generic; + phy->ops.get_cfg_done = e1000_get_cfg_done_80003es2lan; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.release = e1000_release_phy_80003es2lan; + phy->ops.reset = e1000_phy_hw_reset_generic; + phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_80003es2lan; - phy->ops.get_cable_length = e1000_get_cable_length_80003es2lan; - phy->ops.read_reg = e1000_read_phy_reg_gg82563_80003es2lan; - phy->ops.write_reg = e1000_write_phy_reg_gg82563_80003es2lan; + phy->ops.get_cable_length = e1000_get_cable_length_80003es2lan; + phy->ops.read_reg = e1000_read_phy_reg_gg82563_80003es2lan; + phy->ops.write_reg = e1000_write_phy_reg_gg82563_80003es2lan; - phy->ops.cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan; + phy->ops.cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan; /* This can only be done after all function pointers are setup. */ ret_val = e1000_get_phy_id(hw); @@ -154,19 +154,19 @@ static s32 e1000_init_nvm_params_80003es DEBUGFUNC("e1000_init_nvm_params_80003es2lan"); - nvm->opcode_bits = 8; - nvm->delay_usec = 1; + nvm->opcode_bits = 8; + nvm->delay_usec = 1; switch (nvm->override) { case e1000_nvm_override_spi_large: - nvm->page_size = 32; + nvm->page_size = 32; nvm->address_bits = 16; break; case e1000_nvm_override_spi_small: - nvm->page_size = 8; + nvm->page_size = 8; nvm->address_bits = 8; break; default: - nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; + nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? 16 : 8; break; } @@ -174,7 +174,7 @@ static s32 e1000_init_nvm_params_80003es nvm->type = e1000_nvm_eeprom_spi; size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> - E1000_EECD_SIZE_EX_SHIFT); + E1000_EECD_SIZE_EX_SHIFT); /* * Added to a constant, "size" becomes the left-shift value @@ -185,16 +185,16 @@ static s32 e1000_init_nvm_params_80003es /* EEPROM access above 16k is unsupported */ if (size > 14) size = 14; - nvm->word_size = 1 << size; + nvm->word_size = 1 << size; /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_nvm_80003es2lan; - nvm->ops.read = e1000_read_nvm_eerd; - nvm->ops.release = e1000_release_nvm_80003es2lan; - nvm->ops.update = e1000_update_nvm_checksum_generic; + nvm->ops.acquire = e1000_acquire_nvm_80003es2lan; + nvm->ops.read = e1000_read_nvm_eerd; + nvm->ops.release = e1000_release_nvm_80003es2lan; + nvm->ops.update = e1000_update_nvm_checksum_generic; nvm->ops.valid_led_default = e1000_valid_led_default_generic; - nvm->ops.validate = e1000_validate_nvm_checksum_generic; - nvm->ops.write = e1000_write_nvm_80003es2lan; + nvm->ops.validate = e1000_validate_nvm_checksum_generic; + nvm->ops.write = e1000_write_nvm_80003es2lan; return E1000_SUCCESS; } @@ -215,13 +215,13 @@ static s32 e1000_init_mac_params_80003es hw->phy.media_type = e1000_media_type_internal_serdes; mac->ops.check_for_link = e1000_check_for_serdes_link_generic; mac->ops.setup_physical_interface = - e1000_setup_fiber_serdes_link_generic; + e1000_setup_fiber_serdes_link_generic; break; default: hw->phy.media_type = e1000_media_type_copper; mac->ops.check_for_link = e1000_check_for_copper_link_generic; mac->ops.setup_physical_interface = - e1000_setup_copper_link_80003es2lan; + e1000_setup_copper_link_80003es2lan; break; } @@ -234,9 +234,8 @@ static s32 e1000_init_mac_params_80003es /* FWSM register */ mac->has_fwsm = TRUE; /* ARC supported; valid only if manageability features are enabled. */ - mac->arc_subsystem_valid = - (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK) - ? TRUE : FALSE; + mac->arc_subsystem_valid = (E1000_READ_REG(hw, E1000_FWSM) & + E1000_FWSM_MODE_MASK) ? TRUE : FALSE; /* Adaptive IFS not supported */ mac->adaptive_ifs = FALSE; @@ -330,7 +329,7 @@ static void e1000_release_phy_80003es2la } /** - * e1000_acquire_mac_csr_80003es2lan - Acquire rights to access Kumeran register + * e1000_acquire_mac_csr_80003es2lan - Acquire right to access Kumeran register * @hw: pointer to the HW structure * * Acquire the semaphore to access the Kumeran interface. @@ -348,7 +347,7 @@ static s32 e1000_acquire_mac_csr_80003es } /** - * e1000_release_mac_csr_80003es2lan - Release rights to access Kumeran Register + * e1000_release_mac_csr_80003es2lan - Release right to access Kumeran Register * @hw: pointer to the HW structure * * Release the semaphore used to access the Kumeran interface @@ -488,7 +487,7 @@ static void e1000_release_swfw_sync_8000 * Read the GG82563 PHY register. **/ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, u16 *data) + u32 offset, u16 *data) { s32 ret_val; u32 page_select; @@ -538,14 +537,14 @@ static s32 e1000_read_phy_reg_gg82563_80 usec_delay(200); ret_val = e1000_read_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); usec_delay(200); } else { ret_val = e1000_read_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); } e1000_release_phy_80003es2lan(hw); @@ -563,7 +562,7 @@ out: * Write to the GG82563 PHY register. **/ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, u16 data) + u32 offset, u16 data) { s32 ret_val; u32 page_select; @@ -613,14 +612,14 @@ static s32 e1000_write_phy_reg_gg82563_8 usec_delay(200); ret_val = e1000_write_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); usec_delay(200); } else { ret_val = e1000_write_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); } e1000_release_phy_80003es2lan(hw); @@ -639,7 +638,7 @@ out: * Write "words" of data to the ESB2 NVM. **/ static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data) + u16 words, u16 *data) { DEBUGFUNC("e1000_write_nvm_80003es2lan"); @@ -729,11 +728,10 @@ static s32 e1000_phy_force_speed_duplex_ usec_delay(1); if (hw->phy.autoneg_wait_to_complete) { - DEBUGOUT("Waiting for forced speed/duplex link " - "on GG82563 phy.\n"); + DEBUGOUT("Waiting for forced speed/duplex link on GG82563 phy.\n"); ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, - 100000, &link); + 100000, &link); if (ret_val) goto out; @@ -749,12 +747,13 @@ static s32 e1000_phy_force_speed_duplex_ /* Try once more */ ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, - 100000, &link); + 100000, &link); if (ret_val) goto out; } - ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, &phy_data); + ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, + &phy_data); if (ret_val) goto out; @@ -773,7 +772,8 @@ static s32 e1000_phy_force_speed_duplex_ * duplex. */ phy_data |= GG82563_MSCR_ASSERT_CRS_ON_TX; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, phy_data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, + phy_data); out: return ret_val; @@ -826,21 +826,20 @@ out: * Retrieve the current speed and duplex configuration. **/ static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, - u16 *duplex) + u16 *duplex) { s32 ret_val; DEBUGFUNC("e1000_get_link_up_info_80003es2lan"); if (hw->phy.media_type == e1000_media_type_copper) { - ret_val = e1000_get_speed_and_duplex_copper_generic(hw, - speed, - duplex); + ret_val = e1000_get_speed_and_duplex_copper_generic(hw, speed, + duplex); hw->phy.ops.cfg_on_link_up(hw); } else { ret_val = e1000_get_speed_and_duplex_fiber_serdes_generic(hw, - speed, - duplex); + speed, + duplex); } return ret_val; @@ -939,21 +938,21 @@ static s32 e1000_init_hw_80003es2lan(str /* Disable IBIST slave mode (far-end loopback) */ e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM, - &kum_reg_data); + &kum_reg_data); kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE; e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM, - kum_reg_data); + kum_reg_data); /* Set the transmit descriptor write-back policy */ reg_data = E1000_READ_REG(hw, E1000_TXDCTL(0)); reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | - E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; + E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; E1000_WRITE_REG(hw, E1000_TXDCTL(0), reg_data); /* ...for both queues. */ reg_data = E1000_READ_REG(hw, E1000_TXDCTL(1)); reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | - E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; + E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; E1000_WRITE_REG(hw, E1000_TXDCTL(1), reg_data); /* Enable retransmit on late collisions */ @@ -981,9 +980,9 @@ static s32 e1000_init_hw_80003es2lan(str hw->dev_spec._80003es2lan.mdic_wa_enable = TRUE; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET >> - E1000_KMRNCTRLSTA_OFFSET_SHIFT, - &i); + E1000_KMRNCTRLSTA_OFFSET >> + E1000_KMRNCTRLSTA_OFFSET_SHIFT, + &i); if (!ret_val) { if ((i & E1000_KMRNCTRLSTA_OPMODE_MASK) == E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO) @@ -1056,11 +1055,7 @@ static s32 e1000_copper_link_setup_gg825 DEBUGFUNC("e1000_copper_link_setup_gg82563_80003es2lan"); - if (phy->reset_disable) - goto skip_reset; - - ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, - &data); + ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, &data); if (ret_val) goto out; @@ -1068,8 +1063,7 @@ static s32 e1000_copper_link_setup_gg825 /* Use 25MHz for both link down and 1000Base-T for Tx clock. */ data |= GG82563_MSCR_TX_CLK_1000MBPS_25; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, - data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, data); if (ret_val) goto out; @@ -1122,7 +1116,6 @@ static s32 e1000_copper_link_setup_gg825 goto out; } -skip_reset: /* Bypass Rx and Tx FIFO's */ ret_val = e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL, @@ -1132,14 +1125,12 @@ skip_reset: goto out; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, - &data); + E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, &data); if (ret_val) goto out; data |= E1000_KMRNCTRLSTA_OPMODE_E_IDLE; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, - data); + E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, data); if (ret_val) goto out; @@ -1169,18 +1160,18 @@ skip_reset: /* Enable Electrical Idle on the PHY */ data |= GG82563_PMCR_ENABLE_ELECTRICAL_IDLE; ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_PWR_MGMT_CTRL, - data); + data); if (ret_val) goto out; ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - &data); + &data); if (ret_val) goto out; data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - data); + data); if (ret_val) goto out; } @@ -1228,27 +1219,25 @@ static s32 e1000_setup_copper_link_80003 * polling the phy; this fixes erroneous timeouts at 10Mbps. */ ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 4), - 0xFFFF); + 0xFFFF); if (ret_val) goto out; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9), - ®_data); + ®_data); if (ret_val) goto out; reg_data |= 0x3F; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9), - reg_data); + reg_data); if (ret_val) goto out; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, - ®_data); + E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, ®_data); if (ret_val) goto out; reg_data |= E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, - reg_data); + E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, reg_data); if (ret_val) goto out; @@ -1279,9 +1268,8 @@ static s32 e1000_cfg_on_link_up_80003es2 DEBUGFUNC("e1000_configure_on_link_up"); if (hw->phy.media_type == e1000_media_type_copper) { - ret_val = e1000_get_speed_and_duplex_copper_generic(hw, - &speed, - &duplex); + ret_val = e1000_get_speed_and_duplex_copper_generic(hw, &speed, + &duplex); if (ret_val) goto out; @@ -1314,8 +1302,8 @@ static s32 e1000_cfg_kmrn_10_100_80003es reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, - reg_data); + E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, + reg_data); if (ret_val) goto out; @@ -1327,12 +1315,12 @@ static s32 e1000_cfg_kmrn_10_100_80003es do { ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data); + ®_data); if (ret_val) goto out; ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data2); + ®_data2); if (ret_val) goto out; i++; @@ -1343,7 +1331,8 @@ static s32 e1000_cfg_kmrn_10_100_80003es else reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, + reg_data); out: return ret_val; @@ -1367,8 +1356,7 @@ static s32 e1000_cfg_kmrn_1000_80003es2l reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, - reg_data); + E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, reg_data); if (ret_val) goto out; @@ -1380,19 +1368,20 @@ static s32 e1000_cfg_kmrn_1000_80003es2l do { ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data); + ®_data); if (ret_val) goto out; ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data2); + ®_data2); if (ret_val) goto out; i++; } while ((reg_data != reg_data2) && (i < GG82563_MAX_KMRN_RETRY)); reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, + reg_data); out: return ret_val; @@ -1409,7 +1398,7 @@ out: * Release the semaphore before exiting. **/ static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 *data) + u16 *data) { u32 kmrnctrlsta; s32 ret_val = E1000_SUCCESS; @@ -1421,8 +1410,9 @@ static s32 e1000_read_kmrn_reg_80003es2l goto out; kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & - E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; + E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta); + E1000_WRITE_FLUSH(hw); usec_delay(2); @@ -1446,7 +1436,7 @@ out: * before exiting. **/ static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 data) + u16 data) { u32 kmrnctrlsta; s32 ret_val = E1000_SUCCESS; @@ -1458,8 +1448,9 @@ static s32 e1000_write_kmrn_reg_80003es2 goto out; kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & - E1000_KMRNCTRLSTA_OFFSET) | data; + E1000_KMRNCTRLSTA_OFFSET) | data; E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta); + E1000_WRITE_FLUSH(hw); usec_delay(2); Modified: stable/8/sys/dev/e1000/e1000_80003es2lan.h ============================================================================== --- stable/8/sys/dev/e1000/e1000_80003es2lan.h Tue Jan 31 22:31:16 2012 (r230847) +++ stable/8/sys/dev/e1000/e1000_80003es2lan.h Tue Jan 31 22:47:10 2012 (r230848) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -35,48 +35,47 @@ #ifndef _E1000_80003ES2LAN_H_ #define _E1000_80003ES2LAN_H_ -#define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00 -#define E1000_KMRNCTRLSTA_OFFSET_INB_CTRL 0x02 -#define E1000_KMRNCTRLSTA_OFFSET_HD_CTRL 0x10 -#define E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE 0x1F - -#define E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS 0x0008 -#define E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS 0x0800 -#define E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING 0x0010 +#define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00 +#define E1000_KMRNCTRLSTA_OFFSET_INB_CTRL 0x02 +#define E1000_KMRNCTRLSTA_OFFSET_HD_CTRL 0x10 +#define E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE 0x1F + +#define E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS 0x0008 +#define E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS 0x0800 +#define E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING 0x0010 #define E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT 0x0004 -#define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT 0x0000 -#define E1000_KMRNCTRLSTA_OPMODE_E_IDLE 0x2000 +#define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT 0x0000 +#define E1000_KMRNCTRLSTA_OPMODE_E_IDLE 0x2000 -#define E1000_KMRNCTRLSTA_OPMODE_MASK 0x000C -#define E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO 0x0004 +#define E1000_KMRNCTRLSTA_OPMODE_MASK 0x000C +#define E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO 0x0004 #define E1000_TCTL_EXT_GCEX_MASK 0x000FFC00 /* Gigabit Carry Extend Padding */ -#define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN 0x00010000 +#define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN 0x00010000 -#define DEFAULT_TIPG_IPGT_1000_80003ES2LAN 0x8 -#define DEFAULT_TIPG_IPGT_10_100_80003ES2LAN 0x9 +#define DEFAULT_TIPG_IPGT_1000_80003ES2LAN 0x8 +#define DEFAULT_TIPG_IPGT_10_100_80003ES2LAN 0x9 /* GG82563 PHY Specific Status Register (Page 0, Register 16 */ -#define GG82563_PSCR_POLARITY_REVERSAL_DISABLE 0x0002 /* 1=Reversal Disabled */ -#define GG82563_PSCR_CROSSOVER_MODE_MASK 0x0060 -#define GG82563_PSCR_CROSSOVER_MODE_MDI 0x0000 /* 00=Manual MDI */ -#define GG82563_PSCR_CROSSOVER_MODE_MDIX 0x0020 /* 01=Manual MDIX */ -#define GG82563_PSCR_CROSSOVER_MODE_AUTO 0x0060 /* 11=Auto crossover */ +#define GG82563_PSCR_POLARITY_REVERSAL_DISABLE 0x0002 /* 1=Reversal Disabled */ +#define GG82563_PSCR_CROSSOVER_MODE_MASK 0x0060 +#define GG82563_PSCR_CROSSOVER_MODE_MDI 0x0000 /* 00=Manual MDI */ +#define GG82563_PSCR_CROSSOVER_MODE_MDIX 0x0020 /* 01=Manual MDIX */ +#define GG82563_PSCR_CROSSOVER_MODE_AUTO 0x0060 /* 11=Auto crossover */ /* PHY Specific Control Register 2 (Page 0, Register 26) */ -#define GG82563_PSCR2_REVERSE_AUTO_NEG 0x2000 - /* 1=Reverse Auto-Negotiation */ +#define GG82563_PSCR2_REVERSE_AUTO_NEG 0x2000 /* 1=Reverse Auto-Nego */ /* MAC Specific Control Register (Page 2, Register 21) */ /* Tx clock speed for Link Down and 1000BASE-T for the following speeds */ -#define GG82563_MSCR_TX_CLK_MASK 0x0007 -#define GG82563_MSCR_TX_CLK_10MBPS_2_5 0x0004 -#define GG82563_MSCR_TX_CLK_100MBPS_25 0x0005 -#define GG82563_MSCR_TX_CLK_1000MBPS_2_5 0x0006 -#define GG82563_MSCR_TX_CLK_1000MBPS_25 0x0007 +#define GG82563_MSCR_TX_CLK_MASK 0x0007 +#define GG82563_MSCR_TX_CLK_10MBPS_2_5 0x0004 +#define GG82563_MSCR_TX_CLK_100MBPS_25 0x0005 +#define GG82563_MSCR_TX_CLK_1000MBPS_2_5 0x0006 +#define GG82563_MSCR_TX_CLK_1000MBPS_25 0x0007 -#define GG82563_MSCR_ASSERT_CRS_ON_TX 0x0010 /* 1=Assert */ +#define GG82563_MSCR_ASSERT_CRS_ON_TX 0x0010 /* 1=Assert */ /* DSP Distance Register (Page 5, Register 26) */ /* @@ -86,19 +85,19 @@ * 3 = 110-140M * 4 = >140M */ -#define GG82563_DSPD_CABLE_LENGTH 0x0007 +#define GG82563_DSPD_CABLE_LENGTH 0x0007 /* Kumeran Mode Control Register (Page 193, Register 16) */ -#define GG82563_KMCR_PASS_FALSE_CARRIER 0x0800 +#define GG82563_KMCR_PASS_FALSE_CARRIER 0x0800 /* Max number of times Kumeran read/write should be validated */ -#define GG82563_MAX_KMRN_RETRY 0x5 +#define GG82563_MAX_KMRN_RETRY 0x5 /* Power Management Control Register (Page 193, Register 20) */ -#define GG82563_PMCR_ENABLE_ELECTRICAL_IDLE 0x0001 - /* 1=Enable SERDES Electrical Idle */ +/* 1=Enable SERDES Electrical Idle */ +#define GG82563_PMCR_ENABLE_ELECTRICAL_IDLE 0x0001 /* In-Band Control Register (Page 194, Register 18) */ -#define GG82563_ICR_DIS_PADDING 0x0010 /* Disable Padding */ +#define GG82563_ICR_DIS_PADDING 0x0010 /* Disable Padding */ #endif Modified: stable/8/sys/dev/e1000/e1000_82540.c ============================================================================== --- stable/8/sys/dev/e1000/e1000_82540.c Tue Jan 31 22:31:16 2012 (r230847) +++ stable/8/sys/dev/e1000/e1000_82540.c Tue Jan 31 22:47:10 2012 (r230848) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -68,23 +68,23 @@ static s32 e1000_init_phy_params_82540(s struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; - phy->addr = 1; - phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; - phy->reset_delay_us = 10000; - phy->type = e1000_phy_m88; + phy->addr = 1; + phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; + phy->reset_delay_us = 10000; + phy->type = e1000_phy_m88; /* Function Pointers */ - phy->ops.check_polarity = e1000_check_polarity_m88; - phy->ops.commit = e1000_phy_sw_reset_generic; - phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; - phy->ops.get_cable_length = e1000_get_cable_length_m88; - phy->ops.get_cfg_done = e1000_get_cfg_done_generic; - phy->ops.read_reg = e1000_read_phy_reg_m88; - phy->ops.reset = e1000_phy_hw_reset_generic; - phy->ops.write_reg = e1000_write_phy_reg_m88; - phy->ops.get_info = e1000_get_phy_info_m88; - phy->ops.power_up = e1000_power_up_phy_copper; - phy->ops.power_down = e1000_power_down_phy_copper_82540; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.commit = e1000_phy_sw_reset_generic; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; + phy->ops.get_cable_length = e1000_get_cable_length_m88; + phy->ops.get_cfg_done = e1000_get_cfg_done_generic; + phy->ops.read_reg = e1000_read_phy_reg_m88; + phy->ops.reset = e1000_phy_hw_reset_generic; + phy->ops.write_reg = e1000_write_phy_reg_m88; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.power_up = e1000_power_up_phy_copper; + phy->ops.power_down = e1000_power_down_phy_copper_82540; ret_val = e1000_get_phy_id(hw); if (ret_val) @@ -121,32 +121,32 @@ static s32 e1000_init_nvm_params_82540(s DEBUGFUNC("e1000_init_nvm_params_82540"); - nvm->type = e1000_nvm_eeprom_microwire; - nvm->delay_usec = 50; - nvm->opcode_bits = 3; + nvm->type = e1000_nvm_eeprom_microwire; + nvm->delay_usec = 50; + nvm->opcode_bits = 3; switch (nvm->override) { case e1000_nvm_override_microwire_large: - nvm->address_bits = 8; - nvm->word_size = 256; + nvm->address_bits = 8; + nvm->word_size = 256; break; case e1000_nvm_override_microwire_small: - nvm->address_bits = 6; - nvm->word_size = 64; + nvm->address_bits = 6; + nvm->word_size = 64; break; default: - nvm->address_bits = eecd & E1000_EECD_SIZE ? 8 : 6; - nvm->word_size = eecd & E1000_EECD_SIZE ? 256 : 64; + nvm->address_bits = eecd & E1000_EECD_SIZE ? 8 : 6; + nvm->word_size = eecd & E1000_EECD_SIZE ? 256 : 64; break; } /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_nvm_generic; - nvm->ops.read = e1000_read_nvm_microwire; - nvm->ops.release = e1000_release_nvm_generic; - nvm->ops.update = e1000_update_nvm_checksum_generic; - nvm->ops.valid_led_default = e1000_valid_led_default_generic; - nvm->ops.validate = e1000_validate_nvm_checksum_generic; - nvm->ops.write = e1000_write_nvm_microwire; + nvm->ops.acquire = e1000_acquire_nvm_generic; + nvm->ops.read = e1000_read_nvm_microwire; + nvm->ops.release = e1000_release_nvm_generic; + nvm->ops.update = e1000_update_nvm_checksum_generic; + nvm->ops.valid_led_default = e1000_valid_led_default_generic; + nvm->ops.validate = e1000_validate_nvm_checksum_generic; + nvm->ops.write = e1000_write_nvm_microwire; return E1000_SUCCESS; } @@ -198,9 +198,9 @@ static s32 e1000_init_mac_params_82540(s mac->ops.setup_link = e1000_setup_link_generic; /* physical interface setup */ mac->ops.setup_physical_interface = - (hw->phy.media_type == e1000_media_type_copper) - ? e1000_setup_copper_link_82540 - : e1000_setup_fiber_serdes_link_82540; + (hw->phy.media_type == e1000_media_type_copper) + ? e1000_setup_copper_link_82540 + : e1000_setup_fiber_serdes_link_82540; /* check for link */ switch (hw->phy.media_type) { case e1000_media_type_copper: @@ -219,9 +219,9 @@ static s32 e1000_init_mac_params_82540(s } /* link info */ mac->ops.get_link_up_info = - (hw->phy.media_type == e1000_media_type_copper) - ? e1000_get_speed_and_duplex_copper_generic - : e1000_get_speed_and_duplex_fiber_serdes_generic; + (hw->phy.media_type == e1000_media_type_copper) + ? e1000_get_speed_and_duplex_copper_generic + : e1000_get_speed_and_duplex_fiber_serdes_generic; /* multicast address update */ mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic; /* writing VFTA */ @@ -374,7 +374,7 @@ static s32 e1000_init_hw_82540(struct e1 txdctl = E1000_READ_REG(hw, E1000_TXDCTL(0)); txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) | - E1000_TXDCTL_FULL_TX_DESC_WB; + E1000_TXDCTL_FULL_TX_DESC_WB; E1000_WRITE_REG(hw, E1000_TXDCTL(0), txdctl); /* @@ -427,11 +427,13 @@ static s32 e1000_setup_copper_link_82540 if (hw->mac.type == e1000_82545_rev_3 || hw->mac.type == e1000_82546_rev_3) { - ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &data); + ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, + &data); if (ret_val) goto out; data |= 0x00000008; - ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, data); + ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, + data); if (ret_val) goto out; } @@ -508,9 +510,8 @@ static s32 e1000_adjust_serdes_amplitude if (nvm_data != NVM_RESERVED_WORD) { /* Adjust serdes output amplitude only. */ nvm_data &= NVM_SERDES_AMPLITUDE_MASK; - ret_val = hw->phy.ops.write_reg(hw, - M88E1000_PHY_EXT_CTRL, - nvm_data); + ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_EXT_CTRL, + nvm_data); if (ret_val) goto out; } @@ -535,9 +536,8 @@ static s32 e1000_set_vco_speed_82540(str /* Set PHY register 30, page 5, bit 8 to 0 */ - ret_val = hw->phy.ops.read_reg(hw, - M88E1000_PHY_PAGE_SELECT, - &default_page); + ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_PAGE_SELECT, + &default_page); if (ret_val) goto out; @@ -570,7 +570,7 @@ static s32 e1000_set_vco_speed_82540(str goto out; ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT, - default_page); + default_page); out: return ret_val; @@ -587,7 +587,6 @@ out: **/ static s32 e1000_set_phy_mode_82540(struct e1000_hw *hw) { - struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; u16 nvm_data; @@ -604,20 +603,18 @@ static s32 e1000_set_phy_mode_82540(stru if ((nvm_data != NVM_RESERVED_WORD) && (nvm_data & NVM_PHY_CLASS_A)) { ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT, - 0x000B); + 0x000B); if (ret_val) { ret_val = -E1000_ERR_PHY; goto out; } - ret_val = hw->phy.ops.write_reg(hw, - M88E1000_PHY_GEN_CONTROL, - 0x8104); + ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, + 0x8104); if (ret_val) { ret_val = -E1000_ERR_PHY; goto out; } - phy->reset_disable = FALSE; } out: Modified: stable/8/sys/dev/e1000/e1000_82541.c ============================================================================== --- stable/8/sys/dev/e1000/e1000_82541.c Tue Jan 31 22:31:16 2012 (r230847) +++ stable/8/sys/dev/e1000/e1000_82541.c Tue Jan 31 22:47:10 2012 (r230848) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -300,7 +300,7 @@ void e1000_init_function_pointers_82541( **/ static s32 e1000_reset_hw_82541(struct e1000_hw *hw) { - u32 ledctl, ctrl, manc; + u32 ledctl, ctrl, icr, manc; DEBUGFUNC("e1000_reset_hw_82541"); @@ -364,7 +364,7 @@ static s32 e1000_reset_hw_82541(struct e E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF); /* Clear any pending interrupt events. */ - E1000_READ_REG(hw, E1000_ICR); + icr = E1000_READ_REG(hw, E1000_ICR); return E1000_SUCCESS; } @@ -390,7 +390,7 @@ static s32 e1000_init_hw_82541(struct e1 DEBUGOUT("Error initializing identification LED\n"); /* This is not fatal and we should not stop init due to this */ } - + /* Storing the Speed Power Down value for later use */ ret_val = hw->phy.ops.read_reg(hw, IGP01E1000_GMII_FIFO, @@ -549,8 +549,6 @@ static s32 e1000_setup_copper_link_82541 ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); E1000_WRITE_REG(hw, E1000_CTRL, ctrl); - hw->phy.reset_disable = FALSE; - /* Earlier revs of the IGP phy require us to force MDI. */ if (hw->mac.type == e1000_82541 || hw->mac.type == e1000_82547) { dev_spec->dsp_config = e1000_dsp_config_disabled; Modified: stable/8/sys/dev/e1000/e1000_82543.c ============================================================================== --- stable/8/sys/dev/e1000/e1000_82543.c Tue Jan 31 22:31:16 2012 (r230847) +++ stable/8/sys/dev/e1000/e1000_82543.c Tue Jan 31 22:47:10 2012 (r230848) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 23:04:59 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 029561065674; Tue, 31 Jan 2012 23:04:59 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3A4F8FC0C; Tue, 31 Jan 2012 23:04:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0VN4wOH059177; Tue, 31 Jan 2012 23:04:58 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0VN4wqR059171; Tue, 31 Jan 2012 23:04:58 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201201312304.q0VN4wqR059171@svn.freebsd.org> From: "Kenneth D. Merry" Date: Tue, 31 Jan 2012 23:04:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230849 - in stable/9/sys/cam: . scsi X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 23:04:59 -0000 Author: ken Date: Tue Jan 31 23:04:58 2012 New Revision: 230849 URL: http://svn.freebsd.org/changeset/base/230849 Log: MFC: 230000, 230544 Fix a race condition in CAM peripheral free handling, locking in the CAM XPT bus traversal code, and a number of other periph level issues. r230544 | ken | 2012-01-25 10:58:47 -0700 (Wed, 25 Jan 2012) | 9 lines Fix a bug introduced in r230000. We were eliminating all LUNs on a target in response to CAM_DEV_NOT_THERE, instead of just the LUN in question. This will now just eliminate the specified LUN in response to CAM_DEV_NOT_THERE. Reported by: Richard Todd r230000 | ken | 2012-01-11 17:41:48 -0700 (Wed, 11 Jan 2012) | 72 lines Fix a race condition in CAM peripheral free handling, locking in the CAM XPT bus traversal code, and a number of other periph level issues. cam_periph.h, cam_periph.c: Modify cam_periph_acquire() to test the CAM_PERIPH_INVALID flag prior to allowing a reference count to be gained on a peripheral. Callers of this function will receive CAM_REQ_CMP_ERR status in the situation of attempting to reference an invalidated periph. This guarantees that a peripheral scheduled for a deferred free will not be accessed during its wait for destruction. Panic during attempts to drop a reference count on a peripheral that already has a zero reference count. In cam_periph_list(), use a local sbuf with SBUF_FIXEDLEN set so that mallocs do not occur while the xpt topology lock is held, regardless of the allocation policy of the passed in sbuf. Add a new routine, cam_periph_release_locked_buses(), that can be called when the caller already holds the CAM topology lock. Add some extra debugging for duplicate peripheral allocations in cam_periph_alloc(). Treat CAM_DEV_NOT_THERE much the same as a selection timeout (AC_LOST_DEVICE is emitted), but forgo retries. cam_xpt.c: Revamp the way the EDT traversal code does locking and reference counting. This was broken, since it assumed that the EDT would not change during traversal, but that assumption is no longer valid. So, to prevent devices from going away while we traverse the EDT, make sure we properly lock everything and hold references on devices that we are using. The two peripheral driver traversal routines should be examined. xptpdperiphtraverse() holds the topology lock for the entire time it runs. xptperiphtraverse() is now locked properly, but only holds the topology lock while it is traversing the list, and not while the traversal function is running. The bus locking code in xptbustraverse() should also be revisited at a later time, since it is complex and should probably be simplified. scsi_da.c: Pay attention to the return value from cam_periph_acquire(). Return 0 always from daclose() even if the disk is now gone. Add some rudimentary error injection support. scsi_sg.c: Fix reference counting in the sg(4) driver. The sg driver was calling cam_periph_release() on close, but never called cam_periph_acquire() (which increments the reference count) on open. The periph code correctly complained that the sg(4) driver was trying to decrement the refcount when it was already 0. Sponsored by: Spectra Logic Modified: stable/9/sys/cam/cam_periph.c stable/9/sys/cam/cam_periph.h stable/9/sys/cam/cam_xpt.c stable/9/sys/cam/scsi/scsi_da.c stable/9/sys/cam/scsi/scsi_sg.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/cam/cam_periph.c ============================================================================== --- stable/9/sys/cam/cam_periph.c Tue Jan 31 22:47:10 2012 (r230848) +++ stable/9/sys/cam/cam_periph.c Tue Jan 31 23:04:58 2012 (r230849) @@ -171,14 +171,16 @@ cam_periph_alloc(periph_ctor_t *periph_c return (CAM_REQ_INPROG); } else { printf("cam_periph_alloc: attempt to re-allocate " - "valid device %s%d rejected\n", - periph->periph_name, periph->unit_number); + "valid device %s%d rejected flags %#x " + "refcount %d\n", periph->periph_name, + periph->unit_number, periph->flags, + periph->refcount); } return (CAM_REQ_INVALID); } periph = (struct cam_periph *)malloc(sizeof(*periph), M_CAMPERIPH, - M_NOWAIT); + M_NOWAIT|M_ZERO); if (periph == NULL) return (CAM_RESRC_UNAVAIL); @@ -190,7 +192,6 @@ cam_periph_alloc(periph_ctor_t *periph_c path_id = xpt_path_path_id(path); target_id = xpt_path_target_id(path); lun_id = xpt_path_lun_id(path); - bzero(periph, sizeof(*periph)); cam_init_pinfo(&periph->pinfo); periph->periph_start = periph_start; periph->periph_dtor = periph_dtor; @@ -305,17 +306,20 @@ cam_periph_find(struct cam_path *path, c } /* - * Find a peripheral structure with the specified path, target, lun, - * and (optionally) type. If the name is NULL, this function will return - * the first peripheral driver that matches the specified path. + * Find peripheral driver instances attached to the specified path. */ int cam_periph_list(struct cam_path *path, struct sbuf *sb) { + struct sbuf local_sb; struct periph_driver **p_drv; struct cam_periph *periph; int count; + int sbuf_alloc_len; + sbuf_alloc_len = 16; +retry: + sbuf_new(&local_sb, NULL, sbuf_alloc_len, SBUF_FIXEDLEN); count = 0; xpt_lock_buses(); for (p_drv = periph_drivers; *p_drv != NULL; p_drv++) { @@ -324,49 +328,71 @@ cam_periph_list(struct cam_path *path, s if (xpt_path_comp(periph->path, path) != 0) continue; - if (sbuf_len(sb) != 0) - sbuf_cat(sb, ","); + if (sbuf_len(&local_sb) != 0) + sbuf_cat(&local_sb, ","); - sbuf_printf(sb, "%s%d", periph->periph_name, + sbuf_printf(&local_sb, "%s%d", periph->periph_name, periph->unit_number); + + if (sbuf_error(&local_sb) == ENOMEM) { + sbuf_alloc_len *= 2; + xpt_unlock_buses(); + sbuf_delete(&local_sb); + goto retry; + } count++; } } xpt_unlock_buses(); + sbuf_finish(&local_sb); + sbuf_cpy(sb, sbuf_data(&local_sb)); + sbuf_delete(&local_sb); return (count); } cam_status cam_periph_acquire(struct cam_periph *periph) { + cam_status status; + status = CAM_REQ_CMP_ERR; if (periph == NULL) - return(CAM_REQ_CMP_ERR); + return (status); xpt_lock_buses(); - periph->refcount++; + if ((periph->flags & CAM_PERIPH_INVALID) == 0) { + periph->refcount++; + status = CAM_REQ_CMP; + } xpt_unlock_buses(); - return(CAM_REQ_CMP); + return (status); } void -cam_periph_release_locked(struct cam_periph *periph) +cam_periph_release_locked_buses(struct cam_periph *periph) { - - if (periph == NULL) - return; - - xpt_lock_buses(); if (periph->refcount != 0) { periph->refcount--; } else { - xpt_print(periph->path, "%s: release %p when refcount is zero\n ", __func__, periph); + panic("%s: release of %p when refcount is zero\n ", __func__, + periph); } if (periph->refcount == 0 && (periph->flags & CAM_PERIPH_INVALID)) { camperiphfree(periph); } +} + +void +cam_periph_release_locked(struct cam_periph *periph) +{ + + if (periph == NULL) + return; + + xpt_lock_buses(); + cam_periph_release_locked_buses(periph); xpt_unlock_buses(); } @@ -1812,9 +1838,6 @@ cam_periph_error(union ccb *ccb, cam_fla error = EIO; break; case CAM_SEL_TIMEOUT: - { - struct cam_path *newpath; - if ((camflags & CAM_RETRY_SELTO) != 0) { if (ccb->ccb_h.retry_count > 0 && (periph->flags & CAM_PERIPH_INVALID) == 0) { @@ -1837,12 +1860,30 @@ cam_periph_error(union ccb *ccb, cam_fla } action_string = "Retries exhausted"; } + /* FALLTHROUGH */ + case CAM_DEV_NOT_THERE: + { + struct cam_path *newpath; + lun_id_t lun_id; + error = ENXIO; + + /* + * For a selection timeout, we consider all of the LUNs on + * the target to be gone. If the status is CAM_DEV_NOT_THERE, + * then we only get rid of the device(s) specified by the + * path in the original CCB. + */ + if (status == CAM_DEV_NOT_THERE) + lun_id = xpt_path_lun_id(ccb->ccb_h.path); + else + lun_id = CAM_LUN_WILDCARD; + /* Should we do more if we can't create the path?? */ if (xpt_create_path(&newpath, periph, xpt_path_path_id(ccb->ccb_h.path), xpt_path_target_id(ccb->ccb_h.path), - CAM_LUN_WILDCARD) != CAM_REQ_CMP) + lun_id) != CAM_REQ_CMP) break; /* @@ -1855,7 +1896,6 @@ cam_periph_error(union ccb *ccb, cam_fla } case CAM_REQ_INVALID: case CAM_PATH_INVALID: - case CAM_DEV_NOT_THERE: case CAM_NO_HBA: case CAM_PROVIDE_FAIL: case CAM_REQ_TOO_BIG: Modified: stable/9/sys/cam/cam_periph.h ============================================================================== --- stable/9/sys/cam/cam_periph.h Tue Jan 31 22:47:10 2012 (r230848) +++ stable/9/sys/cam/cam_periph.h Tue Jan 31 23:04:58 2012 (r230849) @@ -119,6 +119,7 @@ struct cam_periph { #define CAM_PERIPH_NEW_DEV_FOUND 0x10 #define CAM_PERIPH_RECOVERY_INPROG 0x20 #define CAM_PERIPH_SENSE_INPROG 0x40 +#define CAM_PERIPH_FREE 0x80 u_int32_t immediate_priority; u_int32_t refcount; SLIST_HEAD(, ccb_hdr) ccb_list; /* For "immediate" requests */ @@ -146,6 +147,7 @@ int cam_periph_list(struct cam_path *, cam_status cam_periph_acquire(struct cam_periph *periph); void cam_periph_release(struct cam_periph *periph); void cam_periph_release_locked(struct cam_periph *periph); +void cam_periph_release_locked_buses(struct cam_periph *periph); int cam_periph_hold(struct cam_periph *periph, int priority); void cam_periph_unhold(struct cam_periph *periph); void cam_periph_invalidate(struct cam_periph *periph); Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Tue Jan 31 22:47:10 2012 (r230848) +++ stable/9/sys/cam/cam_xpt.c Tue Jan 31 23:04:58 2012 (r230849) @@ -2026,12 +2026,24 @@ xptbustraverse(struct cam_eb *start_bus, for (bus = (start_bus ? start_bus : TAILQ_FIRST(&xsoftc.xpt_busses)); bus != NULL; bus = next_bus) { - next_bus = TAILQ_NEXT(bus, links); + bus->refcount++; + + /* + * XXX The locking here is obviously very complex. We + * should work to simplify it. + */ mtx_unlock(&xsoftc.xpt_topo_lock); CAM_SIM_LOCK(bus->sim); retval = tr_func(bus, arg); CAM_SIM_UNLOCK(bus->sim); + + mtx_lock(&xsoftc.xpt_topo_lock); + next_bus = TAILQ_NEXT(bus, links); + mtx_unlock(&xsoftc.xpt_topo_lock); + + xpt_release_bus(bus); + if (retval == 0) return(retval); mtx_lock(&xsoftc.xpt_topo_lock); @@ -2086,10 +2098,14 @@ xpttargettraverse(struct cam_eb *bus, st TAILQ_FIRST(&bus->et_entries)); target != NULL; target = next_target) { - next_target = TAILQ_NEXT(target, links); + target->refcount++; retval = tr_func(target, arg); + next_target = TAILQ_NEXT(target, links); + + xpt_release_target(target); + if (retval == 0) return(retval); } @@ -2110,10 +2126,22 @@ xptdevicetraverse(struct cam_et *target, device != NULL; device = next_device) { - next_device = TAILQ_NEXT(device, links); + /* + * Hold a reference so the current device does not go away + * on us. + */ + device->refcount++; retval = tr_func(device, arg); + /* + * Grab our next pointer before we release the current + * device. + */ + next_device = TAILQ_NEXT(device, links); + + xpt_release_device(device); + if (retval == 0) return(retval); } @@ -2130,18 +2158,57 @@ xptperiphtraverse(struct cam_ed *device, retval = 1; + xpt_lock_buses(); for (periph = (start_periph ? start_periph : SLIST_FIRST(&device->periphs)); periph != NULL; periph = next_periph) { - next_periph = SLIST_NEXT(periph, periph_links); + + /* + * In this case, we want to show peripherals that have been + * invalidated, but not peripherals that are scheduled to + * be freed. So instead of calling cam_periph_acquire(), + * which will fail if the periph has been invalidated, we + * just check for the free flag here. If it is free, we + * skip to the next periph. + */ + if (periph->flags & CAM_PERIPH_FREE) { + next_periph = SLIST_NEXT(periph, periph_links); + continue; + } + + /* + * Acquire a reference to this periph while we call the + * traversal function, so it can't go away. + */ + periph->refcount++; + + xpt_unlock_buses(); retval = tr_func(periph, arg); + + /* + * We need the lock for list traversal. + */ + xpt_lock_buses(); + + /* + * Grab the next peripheral before we release this one, so + * our next pointer is still valid. + */ + next_periph = SLIST_NEXT(periph, periph_links); + + cam_periph_release_locked_buses(periph); + if (retval == 0) - return(retval); + goto bailout_done; } +bailout_done: + + xpt_unlock_buses(); + return(retval); } @@ -2188,15 +2255,48 @@ xptpdperiphtraverse(struct periph_driver TAILQ_FIRST(&(*pdrv)->units)); periph != NULL; periph = next_periph) { - next_periph = TAILQ_NEXT(periph, unit_links); - retval = tr_func(periph, arg); - if (retval == 0) { - xpt_unlock_buses(); - return(retval); + /* + * In this case, we want to show peripherals that have been + * invalidated, but not peripherals that are scheduled to + * be freed. So instead of calling cam_periph_acquire(), + * which will fail if the periph has been invalidated, we + * just check for the free flag here. If it is free, we + * skip to the next periph. + */ + if (periph->flags & CAM_PERIPH_FREE) { + next_periph = TAILQ_NEXT(periph, unit_links); + continue; } + + /* + * Acquire a reference to this periph while we call the + * traversal function, so it can't go away. + */ + periph->refcount++; + + /* + * XXX KDM we have the toplogy lock here, but in + * xptperiphtraverse(), we drop it before calling the + * traversal function. Which is correct? + */ + retval = tr_func(periph, arg); + + /* + * Grab the next peripheral before we release this one, so + * our next pointer is still valid. + */ + next_periph = TAILQ_NEXT(periph, unit_links); + + cam_periph_release_locked_buses(periph); + + if (retval == 0) + goto bailout_done; } +bailout_done: + xpt_unlock_buses(); + return(retval); } Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Tue Jan 31 22:47:10 2012 (r230848) +++ stable/9/sys/cam/scsi/scsi_da.c Tue Jan 31 23:04:58 2012 (r230849) @@ -122,6 +122,7 @@ struct da_softc { da_flags flags; da_quirks quirks; int minimum_cmd_size; + int error_inject; int ordered_tag_count; int outstanding_cmds; struct disk_params params; @@ -658,7 +659,7 @@ daopen(struct disk *dp) } if (cam_periph_acquire(periph) != CAM_REQ_CMP) { - return(ENXIO); + return (ENXIO); } cam_periph_lock(periph); @@ -717,13 +718,13 @@ daclose(struct disk *dp) periph = (struct cam_periph *)dp->d_drv1; if (periph == NULL) - return (ENXIO); + return (0); cam_periph_lock(periph); if ((error = cam_periph_hold(periph, PRIBIO)) != 0) { cam_periph_unlock(periph); cam_periph_release(periph); - return (error); + return (0); } softc = (struct da_softc *)periph->softc; @@ -998,8 +999,8 @@ daoninvalidate(struct cam_periph *periph bioq_flush(&softc->bio_queue, NULL, ENXIO); disk_gone(softc->disk); - xpt_print(periph->path, "lost device - %d outstanding\n", - softc->outstanding_cmds); + xpt_print(periph->path, "lost device - %d outstanding, %d refs\n", + softc->outstanding_cmds, periph->refcount); } static void @@ -1145,6 +1146,16 @@ dasysctlinit(void *context, int pending) &softc->minimum_cmd_size, 0, dacmdsizesysctl, "I", "Minimum CDB size"); + SYSCTL_ADD_INT(&softc->sysctl_ctx, + SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, + "error_inject", + CTLFLAG_RW, + &softc->error_inject, + 0, + "error_inject leaf"); + + /* * Add some addressing info. */ @@ -1663,6 +1674,13 @@ dadone(struct cam_periph *periph, union bp->bio_resid = csio->resid; if (csio->resid > 0) bp->bio_flags |= BIO_ERROR; + if (softc->error_inject != 0) { + bp->bio_error = softc->error_inject; + bp->bio_resid = bp->bio_bcount; + bp->bio_flags |= BIO_ERROR; + softc->error_inject = 0; + } + } /* @@ -1850,13 +1868,20 @@ dadone(struct cam_periph *periph, union } free(csio->data_ptr, M_SCSIDA); if (announce_buf[0] != '\0') { - xpt_announce_periph(periph, announce_buf); /* * Create our sysctl variables, now that we know * we have successfully attached. */ - (void) cam_periph_acquire(periph); /* increase the refcount */ - taskqueue_enqueue(taskqueue_thread,&softc->sysctl_task); + /* increase the refcount */ + if (cam_periph_acquire(periph) == CAM_REQ_CMP) { + taskqueue_enqueue(taskqueue_thread, + &softc->sysctl_task); + xpt_announce_periph(periph, announce_buf); + } else { + xpt_print(periph->path, "fatal error, " + "could not acquire reference count\n"); + } + } softc->state = DA_STATE_NORMAL; /* Modified: stable/9/sys/cam/scsi/scsi_sg.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_sg.c Tue Jan 31 22:47:10 2012 (r230848) +++ stable/9/sys/cam/scsi/scsi_sg.c Tue Jan 31 23:04:58 2012 (r230849) @@ -399,18 +399,24 @@ sgopen(struct cdev *dev, int flags, int if (periph == NULL) return (ENXIO); + if (cam_periph_acquire(periph) != CAM_REQ_CMP) + return (ENXIO); + /* * Don't allow access when we're running at a high securelevel. */ error = securelevel_gt(td->td_ucred, 1); - if (error) + if (error) { + cam_periph_release(periph); return (error); + } cam_periph_lock(periph); softc = (struct sg_softc *)periph->softc; if (softc->flags & SG_FLAG_INVALID) { cam_periph_unlock(periph); + cam_periph_release(periph); return (ENXIO); } From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 23:09:28 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D3DB106564A; Tue, 31 Jan 2012 23:09:28 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE8058FC15; Tue, 31 Jan 2012 23:09:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0VN9Rs6059368; Tue, 31 Jan 2012 23:09:27 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0VN9Rew059362; Tue, 31 Jan 2012 23:09:27 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201201312309.q0VN9Rew059362@svn.freebsd.org> From: "Kenneth D. Merry" Date: Tue, 31 Jan 2012 23:09:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230850 - in stable/8/sys/cam: . scsi X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 23:09:28 -0000 Author: ken Date: Tue Jan 31 23:09:27 2012 New Revision: 230850 URL: http://svn.freebsd.org/changeset/base/230850 Log: MFC: 230000, 230544 Fix a race condition in CAM peripheral free handling, locking in the CAM XPT bus traversal code, and a number of other periph level issues. r230544 | ken | 2012-01-25 10:58:47 -0700 (Wed, 25 Jan 2012) | 9 lines Fix a bug introduced in r230000. We were eliminating all LUNs on a target in response to CAM_DEV_NOT_THERE, instead of just the LUN in question. This will now just eliminate the specified LUN in response to CAM_DEV_NOT_THERE. Reported by: Richard Todd r230000 | ken | 2012-01-11 17:41:48 -0700 (Wed, 11 Jan 2012) | 72 lines Fix a race condition in CAM peripheral free handling, locking in the CAM XPT bus traversal code, and a number of other periph level issues. cam_periph.h, cam_periph.c: Modify cam_periph_acquire() to test the CAM_PERIPH_INVALID flag prior to allowing a reference count to be gained on a peripheral. Callers of this function will receive CAM_REQ_CMP_ERR status in the situation of attempting to reference an invalidated periph. This guarantees that a peripheral scheduled for a deferred free will not be accessed during its wait for destruction. Panic during attempts to drop a reference count on a peripheral that already has a zero reference count. In cam_periph_list(), use a local sbuf with SBUF_FIXEDLEN set so that mallocs do not occur while the xpt topology lock is held, regardless of the allocation policy of the passed in sbuf. Add a new routine, cam_periph_release_locked_buses(), that can be called when the caller already holds the CAM topology lock. Add some extra debugging for duplicate peripheral allocations in cam_periph_alloc(). Treat CAM_DEV_NOT_THERE much the same as a selection timeout (AC_LOST_DEVICE is emitted), but forgo retries. cam_xpt.c: Revamp the way the EDT traversal code does locking and reference counting. This was broken, since it assumed that the EDT would not change during traversal, but that assumption is no longer valid. So, to prevent devices from going away while we traverse the EDT, make sure we properly lock everything and hold references on devices that we are using. The two peripheral driver traversal routines should be examined. xptpdperiphtraverse() holds the topology lock for the entire time it runs. xptperiphtraverse() is now locked properly, but only holds the topology lock while it is traversing the list, and not while the traversal function is running. The bus locking code in xptbustraverse() should also be revisited at a later time, since it is complex and should probably be simplified. scsi_da.c: Pay attention to the return value from cam_periph_acquire(). Return 0 always from daclose() even if the disk is now gone. Add some rudimentary error injection support. scsi_sg.c: Fix reference counting in the sg(4) driver. The sg driver was calling cam_periph_release() on close, but never called cam_periph_acquire() (which increments the reference count) on open. The periph code correctly complained that the sg(4) driver was trying to decrement the refcount when it was already 0. Sponsored by: Spectra Logic Modified: stable/8/sys/cam/cam_periph.c stable/8/sys/cam/cam_periph.h stable/8/sys/cam/cam_xpt.c stable/8/sys/cam/scsi/scsi_da.c stable/8/sys/cam/scsi/scsi_sg.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) Modified: stable/8/sys/cam/cam_periph.c ============================================================================== --- stable/8/sys/cam/cam_periph.c Tue Jan 31 23:04:58 2012 (r230849) +++ stable/8/sys/cam/cam_periph.c Tue Jan 31 23:09:27 2012 (r230850) @@ -170,14 +170,16 @@ cam_periph_alloc(periph_ctor_t *periph_c return (CAM_REQ_INPROG); } else { printf("cam_periph_alloc: attempt to re-allocate " - "valid device %s%d rejected\n", - periph->periph_name, periph->unit_number); + "valid device %s%d rejected flags %#x " + "refcount %d\n", periph->periph_name, + periph->unit_number, periph->flags, + periph->refcount); } return (CAM_REQ_INVALID); } periph = (struct cam_periph *)malloc(sizeof(*periph), M_CAMPERIPH, - M_NOWAIT); + M_NOWAIT|M_ZERO); if (periph == NULL) return (CAM_RESRC_UNAVAIL); @@ -189,7 +191,6 @@ cam_periph_alloc(periph_ctor_t *periph_c path_id = xpt_path_path_id(path); target_id = xpt_path_target_id(path); lun_id = xpt_path_lun_id(path); - bzero(periph, sizeof(*periph)); cam_init_pinfo(&periph->pinfo); periph->periph_start = periph_start; periph->periph_dtor = periph_dtor; @@ -306,34 +307,46 @@ cam_periph_find(struct cam_path *path, c cam_status cam_periph_acquire(struct cam_periph *periph) { + cam_status status; + status = CAM_REQ_CMP_ERR; if (periph == NULL) - return(CAM_REQ_CMP_ERR); + return (status); xpt_lock_buses(); - periph->refcount++; + if ((periph->flags & CAM_PERIPH_INVALID) == 0) { + periph->refcount++; + status = CAM_REQ_CMP; + } xpt_unlock_buses(); - return(CAM_REQ_CMP); + return (status); } void -cam_periph_release_locked(struct cam_periph *periph) +cam_periph_release_locked_buses(struct cam_periph *periph) { - - if (periph == NULL) - return; - - xpt_lock_buses(); if (periph->refcount != 0) { periph->refcount--; } else { - xpt_print(periph->path, "%s: release %p when refcount is zero\n ", __func__, periph); + panic("%s: release of %p when refcount is zero\n ", __func__, + periph); } if (periph->refcount == 0 && (periph->flags & CAM_PERIPH_INVALID)) { camperiphfree(periph); } +} + +void +cam_periph_release_locked(struct cam_periph *periph) +{ + + if (periph == NULL) + return; + + xpt_lock_buses(); + cam_periph_release_locked_buses(periph); xpt_unlock_buses(); } @@ -1732,9 +1745,6 @@ cam_periph_error(union ccb *ccb, cam_fla error = EIO; break; case CAM_SEL_TIMEOUT: - { - struct cam_path *newpath; - if ((camflags & CAM_RETRY_SELTO) != 0) { if (ccb->ccb_h.retry_count > 0 && (periph->flags & CAM_PERIPH_INVALID) == 0) { @@ -1757,12 +1767,30 @@ cam_periph_error(union ccb *ccb, cam_fla } action_string = "Retries exhausted"; } + /* FALLTHROUGH */ + case CAM_DEV_NOT_THERE: + { + struct cam_path *newpath; + lun_id_t lun_id; + error = ENXIO; + + /* + * For a selection timeout, we consider all of the LUNs on + * the target to be gone. If the status is CAM_DEV_NOT_THERE, + * then we only get rid of the device(s) specified by the + * path in the original CCB. + */ + if (status == CAM_DEV_NOT_THERE) + lun_id = xpt_path_lun_id(ccb->ccb_h.path); + else + lun_id = CAM_LUN_WILDCARD; + /* Should we do more if we can't create the path?? */ if (xpt_create_path(&newpath, periph, xpt_path_path_id(ccb->ccb_h.path), xpt_path_target_id(ccb->ccb_h.path), - CAM_LUN_WILDCARD) != CAM_REQ_CMP) + lun_id) != CAM_REQ_CMP) break; /* @@ -1775,7 +1803,6 @@ cam_periph_error(union ccb *ccb, cam_fla } case CAM_REQ_INVALID: case CAM_PATH_INVALID: - case CAM_DEV_NOT_THERE: case CAM_NO_HBA: case CAM_PROVIDE_FAIL: case CAM_REQ_TOO_BIG: Modified: stable/8/sys/cam/cam_periph.h ============================================================================== --- stable/8/sys/cam/cam_periph.h Tue Jan 31 23:04:58 2012 (r230849) +++ stable/8/sys/cam/cam_periph.h Tue Jan 31 23:09:27 2012 (r230850) @@ -119,6 +119,7 @@ struct cam_periph { #define CAM_PERIPH_NEW_DEV_FOUND 0x10 #define CAM_PERIPH_RECOVERY_INPROG 0x20 #define CAM_PERIPH_SENSE_INPROG 0x40 +#define CAM_PERIPH_FREE 0x80 u_int32_t immediate_priority; u_int32_t refcount; SLIST_HEAD(, ccb_hdr) ccb_list; /* For "immediate" requests */ @@ -145,6 +146,7 @@ struct cam_periph *cam_periph_find(struc cam_status cam_periph_acquire(struct cam_periph *periph); void cam_periph_release(struct cam_periph *periph); void cam_periph_release_locked(struct cam_periph *periph); +void cam_periph_release_locked_buses(struct cam_periph *periph); int cam_periph_hold(struct cam_periph *periph, int priority); void cam_periph_unhold(struct cam_periph *periph); void cam_periph_invalidate(struct cam_periph *periph); Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Tue Jan 31 23:04:58 2012 (r230849) +++ stable/8/sys/cam/cam_xpt.c Tue Jan 31 23:09:27 2012 (r230850) @@ -1975,12 +1975,24 @@ xptbustraverse(struct cam_eb *start_bus, for (bus = (start_bus ? start_bus : TAILQ_FIRST(&xsoftc.xpt_busses)); bus != NULL; bus = next_bus) { - next_bus = TAILQ_NEXT(bus, links); + bus->refcount++; + + /* + * XXX The locking here is obviously very complex. We + * should work to simplify it. + */ mtx_unlock(&xsoftc.xpt_topo_lock); CAM_SIM_LOCK(bus->sim); retval = tr_func(bus, arg); CAM_SIM_UNLOCK(bus->sim); + + mtx_lock(&xsoftc.xpt_topo_lock); + next_bus = TAILQ_NEXT(bus, links); + mtx_unlock(&xsoftc.xpt_topo_lock); + + xpt_release_bus(bus); + if (retval == 0) return(retval); mtx_lock(&xsoftc.xpt_topo_lock); @@ -2035,10 +2047,14 @@ xpttargettraverse(struct cam_eb *bus, st TAILQ_FIRST(&bus->et_entries)); target != NULL; target = next_target) { - next_target = TAILQ_NEXT(target, links); + target->refcount++; retval = tr_func(target, arg); + next_target = TAILQ_NEXT(target, links); + + xpt_release_target(target); + if (retval == 0) return(retval); } @@ -2059,10 +2075,22 @@ xptdevicetraverse(struct cam_et *target, device != NULL; device = next_device) { - next_device = TAILQ_NEXT(device, links); + /* + * Hold a reference so the current device does not go away + * on us. + */ + device->refcount++; retval = tr_func(device, arg); + /* + * Grab our next pointer before we release the current + * device. + */ + next_device = TAILQ_NEXT(device, links); + + xpt_release_device(device); + if (retval == 0) return(retval); } @@ -2079,18 +2107,57 @@ xptperiphtraverse(struct cam_ed *device, retval = 1; + xpt_lock_buses(); for (periph = (start_periph ? start_periph : SLIST_FIRST(&device->periphs)); periph != NULL; periph = next_periph) { - next_periph = SLIST_NEXT(periph, periph_links); + + /* + * In this case, we want to show peripherals that have been + * invalidated, but not peripherals that are scheduled to + * be freed. So instead of calling cam_periph_acquire(), + * which will fail if the periph has been invalidated, we + * just check for the free flag here. If it is free, we + * skip to the next periph. + */ + if (periph->flags & CAM_PERIPH_FREE) { + next_periph = SLIST_NEXT(periph, periph_links); + continue; + } + + /* + * Acquire a reference to this periph while we call the + * traversal function, so it can't go away. + */ + periph->refcount++; + + xpt_unlock_buses(); retval = tr_func(periph, arg); + + /* + * We need the lock for list traversal. + */ + xpt_lock_buses(); + + /* + * Grab the next peripheral before we release this one, so + * our next pointer is still valid. + */ + next_periph = SLIST_NEXT(periph, periph_links); + + cam_periph_release_locked_buses(periph); + if (retval == 0) - return(retval); + goto bailout_done; } +bailout_done: + + xpt_unlock_buses(); + return(retval); } @@ -2137,15 +2204,48 @@ xptpdperiphtraverse(struct periph_driver TAILQ_FIRST(&(*pdrv)->units)); periph != NULL; periph = next_periph) { - next_periph = TAILQ_NEXT(periph, unit_links); - retval = tr_func(periph, arg); - if (retval == 0) { - xpt_unlock_buses(); - return(retval); + /* + * In this case, we want to show peripherals that have been + * invalidated, but not peripherals that are scheduled to + * be freed. So instead of calling cam_periph_acquire(), + * which will fail if the periph has been invalidated, we + * just check for the free flag here. If it is free, we + * skip to the next periph. + */ + if (periph->flags & CAM_PERIPH_FREE) { + next_periph = TAILQ_NEXT(periph, unit_links); + continue; } + + /* + * Acquire a reference to this periph while we call the + * traversal function, so it can't go away. + */ + periph->refcount++; + + /* + * XXX KDM we have the toplogy lock here, but in + * xptperiphtraverse(), we drop it before calling the + * traversal function. Which is correct? + */ + retval = tr_func(periph, arg); + + /* + * Grab the next peripheral before we release this one, so + * our next pointer is still valid. + */ + next_periph = TAILQ_NEXT(periph, unit_links); + + cam_periph_release_locked_buses(periph); + + if (retval == 0) + goto bailout_done; } +bailout_done: + xpt_unlock_buses(); + return(retval); } Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Tue Jan 31 23:04:58 2012 (r230849) +++ stable/8/sys/cam/scsi/scsi_da.c Tue Jan 31 23:09:27 2012 (r230850) @@ -121,6 +121,7 @@ struct da_softc { da_flags flags; da_quirks quirks; int minimum_cmd_size; + int error_inject; int ordered_tag_count; int outstanding_cmds; struct disk_params params; @@ -656,7 +657,7 @@ daopen(struct disk *dp) } if (cam_periph_acquire(periph) != CAM_REQ_CMP) { - return(ENXIO); + return (ENXIO); } cam_periph_lock(periph); @@ -715,13 +716,13 @@ daclose(struct disk *dp) periph = (struct cam_periph *)dp->d_drv1; if (periph == NULL) - return (ENXIO); + return (0); cam_periph_lock(periph); if ((error = cam_periph_hold(periph, PRIBIO)) != 0) { cam_periph_unlock(periph); cam_periph_release(periph); - return (error); + return (0); } softc = (struct da_softc *)periph->softc; @@ -976,7 +977,8 @@ daoninvalidate(struct cam_periph *periph bioq_flush(&softc->bio_queue, NULL, ENXIO); disk_gone(softc->disk); - xpt_print(periph->path, "lost device\n"); + xpt_print(periph->path, "lost device - %d outstanding, %d refs\n", + softc->outstanding_cmds, periph->refcount); } static void @@ -1579,6 +1581,13 @@ dadone(struct cam_periph *periph, union bp->bio_resid = csio->resid; if (csio->resid > 0) bp->bio_flags |= BIO_ERROR; + if (softc->error_inject != 0) { + bp->bio_error = softc->error_inject; + bp->bio_resid = bp->bio_bcount; + bp->bio_flags |= BIO_ERROR; + softc->error_inject = 0; + } + } /* @@ -1760,13 +1769,20 @@ dadone(struct cam_periph *periph, union } free(csio->data_ptr, M_SCSIDA); if (announce_buf[0] != '\0') { - xpt_announce_periph(periph, announce_buf); /* * Create our sysctl variables, now that we know * we have successfully attached. */ - (void) cam_periph_acquire(periph); /* increase the refcount */ - taskqueue_enqueue(taskqueue_thread,&softc->sysctl_task); + /* increase the refcount */ + if (cam_periph_acquire(periph) == CAM_REQ_CMP) { + taskqueue_enqueue(taskqueue_thread, + &softc->sysctl_task); + xpt_announce_periph(periph, announce_buf); + } else { + xpt_print(periph->path, "fatal error, " + "could not acquire reference count\n"); + } + } softc->state = DA_STATE_NORMAL; /* Modified: stable/8/sys/cam/scsi/scsi_sg.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_sg.c Tue Jan 31 23:04:58 2012 (r230849) +++ stable/8/sys/cam/scsi/scsi_sg.c Tue Jan 31 23:09:27 2012 (r230850) @@ -399,18 +399,24 @@ sgopen(struct cdev *dev, int flags, int if (periph == NULL) return (ENXIO); + if (cam_periph_acquire(periph) != CAM_REQ_CMP) + return (ENXIO); + /* * Don't allow access when we're running at a high securelevel. */ error = securelevel_gt(td->td_ucred, 1); - if (error) + if (error) { + cam_periph_release(periph); return (error); + } cam_periph_lock(periph); softc = (struct sg_softc *)periph->softc; if (softc->flags & SG_FLAG_INVALID) { cam_periph_unlock(periph); + cam_periph_release(periph); return (ENXIO); } From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 23:20:14 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1E681065672; Tue, 31 Jan 2012 23:20:14 +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 903AA8FC0A; Tue, 31 Jan 2012 23:20:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0VNKEcB059799; Tue, 31 Jan 2012 23:20:14 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0VNKEqC059797; Tue, 31 Jan 2012 23:20:14 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201312320.q0VNKEqC059797@svn.freebsd.org> From: Marius Strobl Date: Tue, 31 Jan 2012 23:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230851 - stable/8/sys/sun4v/include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 23:20:14 -0000 Author: marius Date: Tue Jan 31 23:20:14 2012 New Revision: 230851 URL: http://svn.freebsd.org/changeset/base/230851 Log: Add more sparc64 compatibility macros for the shared loader. This is a direct commit to stable/8 in order to unbreak the build with r224370 in place. Modified: stable/8/sys/sun4v/include/tlb.h Modified: stable/8/sys/sun4v/include/tlb.h ============================================================================== --- stable/8/sys/sun4v/include/tlb.h Tue Jan 31 23:09:27 2012 (r230850) +++ stable/8/sys/sun4v/include/tlb.h Tue Jan 31 23:20:14 2012 (r230851) @@ -43,7 +43,20 @@ (TD_V | TD_4M | (TLB_DIRECT_ADDRESS_MASK - TLB_DIRECT_PAGE_MASK)) #define TLB_DAR_SLOT_SHIFT (3) -#define TLB_DAR_SLOT(slot) ((slot) << TLB_DAR_SLOT_SHIFT) + +/* + * sparc64 compatibility for the loader + */ +#define TLB_DAR_TLB_SHIFT (16) +#define TLB_DAR_SLOT(tlb, slot) \ + ((tlb) << TLB_DAR_TLB_SHIFT | (slot) << TLB_DAR_SLOT_SHIFT) +#define TLB_DAR_T16 (0) /* US-III{,i,+}, IV{,+} */ +#define TLB_DAR_T32 (0) /* US-I, II{,e,i} */ +#define TLB_DAR_DT512_0 (2) /* US-III{,i,+}, IV{,+} */ +#define TLB_DAR_DT512_1 (3) /* US-III{,i,+}, IV{,+} */ +#define TLB_DAR_IT128 (2) /* US-III{,i,+}, IV */ +#define TLB_DAR_IT512 (2) /* US-IV+ */ +#define TLB_DAR_FTLB (0) /* SPARC64 V, VI, VII, VIIIfx */ #define TAR_VPN_SHIFT (13) #define TAR_CTX_MASK ((1 << TAR_VPN_SHIFT) - 1) From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 23:20:17 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA77A1065670; Tue, 31 Jan 2012 23:20:17 +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 B8A988FC12; Tue, 31 Jan 2012 23:20:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0VNKHHe059836; Tue, 31 Jan 2012 23:20:17 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0VNKHw8059834; Tue, 31 Jan 2012 23:20:17 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201312320.q0VNKHw8059834@svn.freebsd.org> From: Marius Strobl Date: Tue, 31 Jan 2012 23:20:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230852 - stable/7/sys/sun4v/include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 23:20:17 -0000 Author: marius Date: Tue Jan 31 23:20:17 2012 New Revision: 230852 URL: http://svn.freebsd.org/changeset/base/230852 Log: Add more sparc64 compatibility macros for the shared loader. This is a direct commit to stable/7 in order to unbreak the build with 224371 in place. Modified: stable/7/sys/sun4v/include/tlb.h Modified: stable/7/sys/sun4v/include/tlb.h ============================================================================== --- stable/7/sys/sun4v/include/tlb.h Tue Jan 31 23:20:14 2012 (r230851) +++ stable/7/sys/sun4v/include/tlb.h Tue Jan 31 23:20:17 2012 (r230852) @@ -43,7 +43,21 @@ (TD_V | TD_4M | (TLB_DIRECT_ADDRESS_MASK - TLB_DIRECT_PAGE_MASK)) #define TLB_DAR_SLOT_SHIFT (3) -#define TLB_DAR_SLOT(slot) ((slot) << TLB_DAR_SLOT_SHIFT) + +/* + * sparc64 compatibility for the loader + */ +#define TLB_DAR_TLB_SHIFT (16) +#define TLB_DAR_SLOT(tlb, slot) \ + ((tlb) << TLB_DAR_TLB_SHIFT | (slot) << TLB_DAR_SLOT_SHIFT) +#define TLB_DAR_T16 (0) /* US-III{,i,+}, IV{,+} */ +#define TLB_DAR_T32 (0) /* US-I, II{,e,i} */ +#define TLB_DAR_DT512_0 (2) /* US-III{,i,+}, IV{,+} */ +#define TLB_DAR_DT512_1 (3) /* US-III{,i,+}, IV{,+} */ +#define TLB_DAR_IT128 (2) /* US-III{,i,+}, IV */ +#define TLB_DAR_IT512 (2) /* US-IV+ */ +#define TLB_DAR_FTLB (0) /* SPARC64 V, VI, VII, VIIIfx */ +#define TLB_DAR_STLB (2) /* SPARC64 V, VI, VII, VIIIfx */ #define TAR_VPN_SHIFT (13) #define TAR_CTX_MASK ((1 << TAR_VPN_SHIFT) - 1) From owner-svn-src-stable@FreeBSD.ORG Tue Jan 31 23:24:47 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 924F7106566C; Tue, 31 Jan 2012 23:24:47 +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 2C67F8FC14; Tue, 31 Jan 2012 23:24:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0VNOlsE060008; Tue, 31 Jan 2012 23:24:47 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0VNOkZF060005; Tue, 31 Jan 2012 23:24:46 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201312324.q0VNOkZF060005@svn.freebsd.org> From: Marius Strobl Date: Tue, 31 Jan 2012 23:24:46 +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: r230853 - in stable/8/sys: conf sun4v/include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 23:24:47 -0000 Author: marius Date: Tue Jan 31 23:24:46 2012 New Revision: 230853 URL: http://svn.freebsd.org/changeset/base/230853 Log: - Hook up VTOC8 geometry adjustments. - Remove some unused externs. This is a direct commit to stable/8 in order to unbreak the build with r230666 in place. Modified: stable/8/sys/conf/files.sun4v stable/8/sys/sun4v/include/md_var.h Modified: stable/8/sys/conf/files.sun4v ============================================================================== --- stable/8/sys/conf/files.sun4v Tue Jan 31 23:20:17 2012 (r230852) +++ stable/8/sys/conf/files.sun4v Tue Jan 31 23:24:46 2012 (r230853) @@ -39,8 +39,10 @@ sparc64/ebus/ebus.c optional ebus sparc64/isa/isa.c optional isa sparc64/isa/isa_dma.c optional isa sparc64/isa/ofw_isa.c optional ebus | isa +sparc64/sparc64/ata_machdep.c optional ada | atadisk | da sparc64/sparc64/autoconf.c standard sun4v/sun4v/bus_machdep.c standard +sparc64/sparc64/cam_machdep.c optional scbus sun4v/sun4v/clock.c standard sparc64/sparc64/db_disasm.c optional ddb sun4v/sun4v/db_interface.c optional ddb Modified: stable/8/sys/sun4v/include/md_var.h ============================================================================== --- stable/8/sys/sun4v/include/md_var.h Tue Jan 31 23:20:17 2012 (r230852) +++ stable/8/sys/sun4v/include/md_var.h Tue Jan 31 23:24:46 2012 (r230853) @@ -54,10 +54,15 @@ struct md_utrap *utrap_alloc(void); void utrap_free(struct md_utrap *ut); struct md_utrap *utrap_hold(struct md_utrap *ut); - -extern cpu_block_copy_t *cpu_block_copy; -extern cpu_block_zero_t *cpu_block_zero; - - +/* + * Given that the VTOC8 disk label only uses 16-bit fields for cylinders, + * heads and sectors we might need to adjust the geometry of large disks. + */ +struct ccb_calc_geometry; +int scsi_da_bios_params(struct ccb_calc_geometry *ccg); +struct disk; +void sparc64_ata_disk_firmware_geom_adjust(struct disk *disk); +#define ata_disk_firmware_geom_adjust(disk) \ + sparc64_ata_disk_firmware_geom_adjust(disk) #endif /* !_MACHINE_MD_VAR_H_ */ From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 01:28:36 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7338D1065675; Wed, 1 Feb 2012 01:28:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 61B0E8FC13; Wed, 1 Feb 2012 01:28:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q111SaTl063855; Wed, 1 Feb 2012 01:28:36 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q111SajD063853; Wed, 1 Feb 2012 01:28:36 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201202010128.q111SajD063853@svn.freebsd.org> From: Ed Maste Date: Wed, 1 Feb 2012 01:28:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230854 - stable/8/usr.sbin/wpa/wpa_supplicant X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 01:28:36 -0000 Author: emaste Date: Wed Feb 1 01:28:35 2012 New Revision: 230854 URL: http://svn.freebsd.org/changeset/base/230854 Log: MFC r230293: Add missing line continuation \. It did not cause any issue because the same path is already being included in ../Makefile.inc. PR: 164192 Submitted by: Devin Teske Modified: stable/8/usr.sbin/wpa/wpa_supplicant/Makefile Directory Properties: stable/8/usr.sbin/wpa/wpa_supplicant/ (props changed) Modified: stable/8/usr.sbin/wpa/wpa_supplicant/Makefile ============================================================================== --- stable/8/usr.sbin/wpa/wpa_supplicant/Makefile Tue Jan 31 23:24:46 2012 (r230853) +++ stable/8/usr.sbin/wpa/wpa_supplicant/Makefile Wed Feb 1 01:28:35 2012 (r230854) @@ -5,7 +5,7 @@ .PATH.c:${WPA_SUPPLICANT_DISTDIR} \ ${WPA_DISTDIR}/src/drivers \ ${WPA_DISTDIR}/src/eap_peer \ - ${WPA_DISTDIR}/src/rsn_supp + ${WPA_DISTDIR}/src/rsn_supp \ PROG= wpa_supplicant SRCS= aes.c aes_wrap.c blacklist.c common.c config.c ctrl_iface.c \ From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 01:36:46 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE79F1065675; Wed, 1 Feb 2012 01:36:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCE478FC14; Wed, 1 Feb 2012 01:36:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q111akeV064154; Wed, 1 Feb 2012 01:36:46 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q111akkQ064152; Wed, 1 Feb 2012 01:36:46 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201202010136.q111akkQ064152@svn.freebsd.org> From: Ed Maste Date: Wed, 1 Feb 2012 01:36:46 +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: r230855 - stable/8/usr.sbin/wpa/wpa_supplicant X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 01:36:47 -0000 Author: emaste Date: Wed Feb 1 01:36:46 2012 New Revision: 230855 URL: http://svn.freebsd.org/changeset/base/230855 Log: Revert r230854 as the change does not apply to stable/8. Modified: stable/8/usr.sbin/wpa/wpa_supplicant/Makefile Directory Properties: stable/8/usr.sbin/wpa/wpa_supplicant/ (props changed) Modified: stable/8/usr.sbin/wpa/wpa_supplicant/Makefile ============================================================================== --- stable/8/usr.sbin/wpa/wpa_supplicant/Makefile Wed Feb 1 01:28:35 2012 (r230854) +++ stable/8/usr.sbin/wpa/wpa_supplicant/Makefile Wed Feb 1 01:36:46 2012 (r230855) @@ -5,7 +5,7 @@ .PATH.c:${WPA_SUPPLICANT_DISTDIR} \ ${WPA_DISTDIR}/src/drivers \ ${WPA_DISTDIR}/src/eap_peer \ - ${WPA_DISTDIR}/src/rsn_supp \ + ${WPA_DISTDIR}/src/rsn_supp PROG= wpa_supplicant SRCS= aes.c aes_wrap.c blacklist.c common.c config.c ctrl_iface.c \ From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 03:28:19 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3339106566B; Wed, 1 Feb 2012 03:28:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD71B8FC08; Wed, 1 Feb 2012 03:28:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q113SJxT068190; Wed, 1 Feb 2012 03:28:19 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q113SJth068188; Wed, 1 Feb 2012 03:28:19 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201202010328.q113SJth068188@svn.freebsd.org> From: Ed Maste Date: Wed, 1 Feb 2012 03:28:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230858 - stable/9/usr.sbin/wpa/wpa_supplicant X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 03:28:20 -0000 Author: emaste Date: Wed Feb 1 03:28:19 2012 New Revision: 230858 URL: http://svn.freebsd.org/changeset/base/230858 Log: MFC r230293: Add missing line continuation \. It did not cause any issue because the same path is already being included in ../Makefile.inc. PR: 164192 Submitted by: Devin Teske Modified: stable/9/usr.sbin/wpa/wpa_supplicant/Makefile Directory Properties: stable/9/usr.sbin/wpa/wpa_supplicant/ (props changed) Modified: stable/9/usr.sbin/wpa/wpa_supplicant/Makefile ============================================================================== --- stable/9/usr.sbin/wpa/wpa_supplicant/Makefile Wed Feb 1 02:53:06 2012 (r230857) +++ stable/9/usr.sbin/wpa/wpa_supplicant/Makefile Wed Feb 1 03:28:19 2012 (r230858) @@ -5,7 +5,7 @@ .PATH.c:${WPA_SUPPLICANT_DISTDIR} \ ${WPA_DISTDIR}/src/drivers \ ${WPA_DISTDIR}/src/eap_peer \ - ${WPA_DISTDIR}/src/rsn_supp + ${WPA_DISTDIR}/src/rsn_supp \ ${WPA_DISTDIR}/src/crypto PROG= wpa_supplicant From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 15:04:28 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05D891065670; Wed, 1 Feb 2012 15:04:28 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DDB6D8FC1C; Wed, 1 Feb 2012 15:04:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11F4RQI091962; Wed, 1 Feb 2012 15:04:27 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11F4RkO091960; Wed, 1 Feb 2012 15:04:27 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201202011504.q11F4RkO091960@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 1 Feb 2012 15:04:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230867 - stable/9/sys/boot/forth X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 15:04:28 -0000 Author: pluknet Date: Wed Feb 1 15:04:27 2012 New Revision: 230867 URL: http://svn.freebsd.org/changeset/base/230867 Log: MFC r230545: Clarify and improve the boot menu with some small changes. PR: misc/160818 Submitted by: Warren Block Modified: stable/9/sys/boot/forth/menu.rc Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/boot/forth/menu.rc ============================================================================== --- stable/9/sys/boot/forth/menu.rc Wed Feb 1 14:34:52 2012 (r230866) +++ stable/9/sys/boot/forth/menu.rc Wed Feb 1 15:04:27 2012 (r230867) @@ -18,9 +18,9 @@ menu-init \ initialize the menu area \ Initialize main menu constructs (see `menu.4th') \ NOTE: To use the `ansi' variants, add `loader_color=1' to loader.conf(5) -set menu_caption[1]="Boot [ENTER]" +set menu_caption[1]="Boot [Enter]" set menu_command[1]="boot" -set ansi_caption[1]="Boot [ENTER]" +set ansi_caption[1]="Boot [Enter]" set menu_keycode[1]="98" set menu_caption[2]="[Esc]ape to loader prompt" @@ -38,34 +38,34 @@ set menu_reboot \ set menu_options=4 -set menu_caption[4]="[A]CPI Support: Disabled" -set toggled_text[4]="[A]CPI Support: Enabled" +set menu_caption[4]="[A]CPI Support off" +set toggled_text[4]="[A]CPI Support On" set menu_command[4]="toggle_acpi" set menu_keycode[4]="97" set menu_acpi=4 -set ansi_caption[4]="ACPI Support: Disabled" -set toggled_ansi[4]="ACPI Support: Enabled" +set ansi_caption[4]="ACPI Support Off" +set toggled_ansi[4]="ACPI Support On" -set menu_caption[5]="Boot Safe [M]ode: NO" -set toggled_text[5]="Boot Safe [M]ode: YES" +set menu_caption[5]="Safe [M]ode... off" +set toggled_text[5]="Safe [M]ode... On" set menu_command[5]="toggle_safemode" set menu_keycode[5]="109" -set ansi_caption[5]="Boot Safe Mode: NO" -set toggled_ansi[5]="Boot Safe Mode: YES" +set ansi_caption[5]="Safe Mode... Off" +set toggled_ansi[5]="Safe Mode... On" -set menu_caption[6]="Boot [S]ingle User: NO" -set toggled_text[6]="Boot [S]ingle User: YES" +set menu_caption[6]="[S]ingle User. off" +set toggled_text[6]="[S]ingle User. On" set menu_command[6]="toggle_singleuser" set menu_keycode[6]="115" -set ansi_caption[6]="Boot Single User: NO" -set toggled_ansi[6]="Boot Single User: YES" +set ansi_caption[6]="Single User. Off" +set toggled_ansi[6]="Single User. On" -set menu_caption[7]="Boot [V]erbose: NO" -set toggled_text[7]="Boot [V]erbose: YES" +set menu_caption[7]="[V]erbose..... off" +set toggled_text[7]="[V]erbose..... On" set menu_command[7]="toggle_verbose" set menu_keycode[7]="118" -set ansi_caption[7]="Boot Verbose: NO" -set toggled_ansi[7]="Boot Verbose: YES" +set ansi_caption[7]="Verbose..... Off" +set toggled_ansi[7]="Verbose..... On" \ Enable automatic booting (add ``autoboot_delay=N'' to loader.conf(5) to \ customize the timeout; default is 10-seconds) From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 15:57:50 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6251B106566B; Wed, 1 Feb 2012 15:57:50 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4EB6C8FC1B; Wed, 1 Feb 2012 15:57:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11FvocJ093537; Wed, 1 Feb 2012 15:57:50 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11FvoNj093532; Wed, 1 Feb 2012 15:57:50 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201202011557.q11FvoNj093532@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 1 Feb 2012 15:57:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230868 - in stable/9/sys: contrib/pf/net netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 15:57:50 -0000 Author: glebius Date: Wed Feb 1 15:57:49 2012 New Revision: 230868 URL: http://svn.freebsd.org/changeset/base/230868 Log: Merge some cleanups and bugfixes to pfsync(4) and pf(4) from head. Merged revisions: r229773,229777,229849-229853,229857,229959,229961-229964,229976. r229777: Merge from OpenBSD: revision 1.170 date: 2011/10/30 23:04:38; author: mikeb; state: Exp; lines: +6 -7 Allow setting big MTU values on the pfsync interface but not larger than the syncdev MTU. Prompted by the discussion with and tested by Maxim Bourmistrov; ok dlg, mpf Consistently use sc_ifp->if_mtu in the MTU check throughout the module. This backs out r228813. r229849: o Fix panic on module unload, that happened due to mutex being destroyed prior to pfsync_uninit(). To do this, move all the initialization to the module_t method, instead of SYSINIT(9). o Fix another panic after module unload, due to not clearing the m_addr_chg_pf_p pointer. o Refuse to unload module, unless being unloaded forcibly. o Revert the sub argument to MODULE_DECLARE, to the stable/8 value. r229850: Bunch of fixes to pfsync(4) module load/unload: o Make the pfsync.ko actually usable. Before this change loading it didn't register protosw, so was a nop. However, a module /boot/kernel did confused users. o Rewrite the way we are joining multicast group: - Move multicast initialization/destruction to separate functions. - Don't allocate memory if we aren't going to join a multicast group. - Use modern API for joining/leaving multicast group. - Now the utterly wrong pfsync_ifdetach() isn't needed. o Move module initialization from SYSINIT(9) to moduledata_t method. o Refuse to unload module, unless asked forcibly. o Improve a bit some FreeBSD porting code: - Use separate malloc type. - Simplify swi sheduling. r229857: Can't pass MSIZE to m_cljget(), an mbuf can't be attached as external storage to another mbuf. r229963: Add necessary locking in pfsync_in_ureq(). r229976: Redo r226660: - Define schednetisr() to swi_sched. - In the swi handler check if there is some data prepared, and if true, then call pfsync_sendout(), however tell it not to schedule swi again. - Since now we don't obtain the pfsync lock in the swi handler, don't use ifqueue mutex to synchronize queue access. r229773, r229851, r229959, r229961, r229962, r229964 - minor cleanups. Modified: stable/9/sys/contrib/pf/net/if_pfsync.c stable/9/sys/contrib/pf/net/pf.c stable/9/sys/contrib/pf/net/pf_ioctl.c stable/9/sys/contrib/pf/net/pfvar.h stable/9/sys/netinet/in_proto.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/contrib/pf/ (props changed) Modified: stable/9/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- stable/9/sys/contrib/pf/net/if_pfsync.c Wed Feb 1 15:04:27 2012 (r230867) +++ stable/9/sys/contrib/pf/net/if_pfsync.c Wed Feb 1 15:57:49 2012 (r230868) @@ -47,6 +47,8 @@ * 1.118, 1.124, 1.148, 1.149, 1.151, 1.171 - fixes to bulk updates * 1.120, 1.175 - use monotonic time_uptime * 1.122 - reduce number of updates for non-TCP sessions + * 1.128 - cleanups + * 1.170 - SIOCSIFMTU checks */ #ifdef __FreeBSD__ @@ -59,12 +61,6 @@ __FBSDID("$FreeBSD$"); #define NBPFILTER 1 -#ifdef DEV_PFSYNC -#define NPFSYNC DEV_PFSYNC -#else -#define NPFSYNC 0 -#endif - #ifdef DEV_CARP #define NCARP DEV_CARP #else @@ -92,6 +88,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #else #include #include @@ -298,19 +295,26 @@ struct pfsync_softc { #else struct timeout sc_tmo; #endif -#ifdef __FreeBSD__ - eventhandler_tag sc_detachtag; -#endif - }; #ifdef __FreeBSD__ +static MALLOC_DEFINE(M_PFSYNC, "pfsync", "pfsync data"); static VNET_DEFINE(struct pfsync_softc *, pfsyncif) = NULL; #define V_pfsyncif VNET(pfsyncif) - +static VNET_DEFINE(void *, pfsync_swi_cookie) = NULL; +#define V_pfsync_swi_cookie VNET(pfsync_swi_cookie) static VNET_DEFINE(struct pfsyncstats, pfsyncstats); #define V_pfsyncstats VNET(pfsyncstats) +static void pfsyncintr(void *); +static int pfsync_multicast_setup(struct pfsync_softc *); +static void pfsync_multicast_cleanup(struct pfsync_softc *); +static int pfsync_init(void); +static void pfsync_uninit(void); +static void pfsync_sendout1(int); + +#define schednetisr(NETISR_PFSYNC) swi_sched(V_pfsync_swi_cookie, 0) + SYSCTL_NODE(_net, OID_AUTO, pfsync, CTLFLAG_RW, 0, "PFSYNC"); SYSCTL_VNET_STRUCT(_net_pfsync, OID_AUTO, stats, CTLFLAG_RW, &VNET_NAME(pfsyncstats), pfsyncstats, @@ -321,16 +325,6 @@ struct pfsyncstats pfsyncstats; #define V_pfsyncstats pfsyncstats #endif -#ifdef __FreeBSD__ -static void pfsyncintr(void *); -struct pfsync_swi { - void * pfsync_swi_cookie; -}; -static struct pfsync_swi pfsync_swi; -#define schednetisr(p) swi_sched(pfsync_swi.pfsync_swi_cookie, 0) -#define NETISR_PFSYNC -#endif - void pfsyncattach(int); #ifdef __FreeBSD__ int pfsync_clone_create(struct if_clone *, int, caddr_t); @@ -352,7 +346,6 @@ int pfsyncioctl(struct ifnet *, u_long, void pfsyncstart(struct ifnet *); struct mbuf *pfsync_if_dequeue(struct ifnet *); -struct mbuf *pfsync_get_mbuf(struct pfsync_softc *); void pfsync_deferred(struct pf_state *, int); void pfsync_undefer(struct pfsync_deferral *, int); @@ -364,11 +357,8 @@ void pfsync_update_state_req(struct pf_s void pfsync_drop(struct pfsync_softc *); void pfsync_sendout(void); void pfsync_send_plus(void *, size_t); -int pfsync_tdb_sendout(struct pfsync_softc *); -int pfsync_sendout_mbuf(struct pfsync_softc *, struct mbuf *); void pfsync_timeout(void *); void pfsync_tdb_timeout(void *); -void pfsync_send_bus(struct pfsync_softc *, u_int8_t); void pfsync_bulk_start(void); void pfsync_bulk_status(u_int8_t); @@ -376,8 +366,6 @@ void pfsync_bulk_update(void *); void pfsync_bulk_fail(void *); #ifdef __FreeBSD__ -void pfsync_ifdetach(void *, struct ifnet *); - /* XXX: ugly */ #define betoh64 (unsigned long long)be64toh #define timeout_del callout_stop @@ -389,6 +377,10 @@ int pfsync_sync_ok; #endif #ifdef __FreeBSD__ +VNET_DEFINE(struct ifc_simple_data, pfsync_cloner_data); +VNET_DEFINE(struct if_clone, pfsync_cloner); +#define V_pfsync_cloner_data VNET(pfsync_cloner_data) +#define V_pfsync_cloner VNET(pfsync_cloner) IFC_SIMPLE_DECLARE(pfsync, 1); #else struct if_clone pfsync_cloner = @@ -414,25 +406,20 @@ pfsync_clone_create(struct if_clone *ifc if (unit != 0) return (EINVAL); -#ifndef __FreeBSD__ +#ifdef __FreeBSD__ + sc = malloc(sizeof(struct pfsync_softc), M_PFSYNC, M_WAITOK | M_ZERO); + sc->pfsync_sync_ok = 1; +#else pfsync_sync_ok = 1; + sc = malloc(sizeof(*pfsyncif), M_DEVBUF, M_NOWAIT | M_ZERO); #endif - sc = malloc(sizeof(struct pfsync_softc), M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc == NULL) - return (ENOMEM); - for (q = 0; q < PFSYNC_S_COUNT; q++) TAILQ_INIT(&sc->sc_qs[q]); #ifdef __FreeBSD__ - sc->pfsync_sync_ok = 1; - sc->sc_pool = uma_zcreate("pfsync", PFSYNC_PLSIZE, - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - if (sc->sc_pool == NULL) { - free(sc, M_DEVBUF); - return (ENOMEM); - } + sc->sc_pool = uma_zcreate("pfsync", PFSYNC_PLSIZE, NULL, NULL, NULL, + NULL, UMA_ALIGN_PTR, 0); #else pool_init(&sc->sc_pool, PFSYNC_PLSIZE, 0, 0, 0, "pfsync", NULL); #endif @@ -445,13 +432,7 @@ pfsync_clone_create(struct if_clone *ifc sc->sc_len = PFSYNC_MINPKT; sc->sc_maxupdates = 128; -#ifdef __FreeBSD__ - sc->sc_imo.imo_membership = (struct in_multi **)malloc( - (sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_DEVBUF, - M_NOWAIT | M_ZERO); - sc->sc_imo.imo_max_memberships = IP_MIN_MEMBERSHIPS; - sc->sc_imo.imo_multicast_vif = -1; -#else +#ifndef __FreeBSD__ sc->sc_imo.imo_membership = (struct in_multi **)malloc( (sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_IPMOPTS, M_WAITOK | M_ZERO); @@ -461,26 +442,11 @@ pfsync_clone_create(struct if_clone *ifc #ifdef __FreeBSD__ ifp = sc->sc_ifp = if_alloc(IFT_PFSYNC); if (ifp == NULL) { - free(sc->sc_imo.imo_membership, M_DEVBUF); uma_zdestroy(sc->sc_pool); - free(sc, M_DEVBUF); + free(sc, M_PFSYNC); return (ENOSPC); } if_initname(ifp, ifc->ifc_name, unit); - - sc->sc_detachtag = EVENTHANDLER_REGISTER(ifnet_departure_event, -#ifdef __FreeBSD__ - pfsync_ifdetach, V_pfsyncif, EVENTHANDLER_PRI_ANY); -#else - pfsync_ifdetach, pfsyncif, EVENTHANDLER_PRI_ANY); -#endif - if (sc->sc_detachtag == NULL) { - if_free(ifp); - free(sc->sc_imo.imo_membership, M_DEVBUF); - uma_zdestroy(sc->sc_pool); - free(sc, M_DEVBUF); - return (ENOSPC); - } #else ifp = &sc->sc_if; snprintf(ifp->if_xname, sizeof ifp->if_xname, "pfsync%d", unit); @@ -492,13 +458,12 @@ pfsync_clone_create(struct if_clone *ifc ifp->if_type = IFT_PFSYNC; ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_hdrlen = sizeof(struct pfsync_header); - ifp->if_mtu = 1500; /* XXX */ + ifp->if_mtu = ETHERMTU; #ifdef __FreeBSD__ callout_init(&sc->sc_tmo, CALLOUT_MPSAFE); callout_init_mtx(&sc->sc_bulk_tmo, &pf_task_mtx, 0); callout_init(&sc->sc_bulkfail_tmo, CALLOUT_MPSAFE); #else - ifp->if_hardmtu = MCLBYTES; /* XXX */ timeout_set(&sc->sc_tmo, pfsync_timeout, sc); timeout_set(&sc->sc_bulk_tmo, pfsync_bulk_update, sc); timeout_set(&sc->sc_bulkfail_tmo, pfsync_bulk_fail, sc); @@ -540,7 +505,6 @@ pfsync_clone_destroy(struct ifnet *ifp) struct pfsync_softc *sc = ifp->if_softc; #ifdef __FreeBSD__ - EVENTHANDLER_DEREGISTER(ifnet_departure_event, sc->sc_detachtag); PF_LOCK(); #endif timeout_del(&sc->sc_bulkfail_tmo); @@ -576,11 +540,13 @@ pfsync_clone_destroy(struct ifnet *ifp) #endif #ifdef __FreeBSD__ if_free(ifp); - free(sc->sc_imo.imo_membership, M_DEVBUF); + if (sc->sc_imo.imo_membership) + pfsync_multicast_cleanup(sc); + free(sc, M_PFSYNC); #else free(sc->sc_imo.imo_membership, M_IPMOPTS); -#endif free(sc, M_DEVBUF); +#endif #ifdef __FreeBSD__ V_pfsyncif = NULL; @@ -721,9 +687,9 @@ pfsync_state_import(struct pfsync_state int pool_flags; int error; +#ifdef __FreeBSD__ PF_LOCK_ASSERT(); -#ifdef __FreeBSD__ if (sp->creatorid == 0 && V_pf_status.debug >= PF_DEBUG_MISC) { #else if (sp->creatorid == 0 && pf_status.debug >= PF_DEBUG_MISC) { @@ -863,11 +829,7 @@ pfsync_state_import(struct pfsync_state CLR(st->state_flags, PFSTATE_NOSYNC); if (ISSET(st->state_flags, PFSTATE_ACK)) { pfsync_q_ins(st, PFSYNC_S_IACK); -#ifdef __FreeBSD__ - pfsync_sendout(); -#else schednetisr(NETISR_PFSYNC); -#endif } } CLR(st->state_flags, PFSTATE_ACK); @@ -1323,11 +1285,7 @@ pfsync_in_upd(struct pfsync_pkt *pkt, st V_pfsyncstats.pfsyncs_stale++; pfsync_update_state(st); -#ifdef __FreeBSD__ - pfsync_sendout(); -#else schednetisr(NETISR_PFSYNC); -#endif continue; } pfsync_alloc_scrub_memory(&sp->dst, &st->dst); @@ -1433,11 +1391,7 @@ pfsync_in_upd_c(struct pfsync_pkt *pkt, V_pfsyncstats.pfsyncs_stale++; pfsync_update_state(st); -#ifdef __FreeBSD__ - pfsync_sendout(); -#else schednetisr(NETISR_PFSYNC); -#endif continue; } pfsync_alloc_scrub_memory(&up->dst, &st->dst); @@ -1473,6 +1427,9 @@ pfsync_in_ureq(struct pfsync_pkt *pkt, s } ura = (struct pfsync_upd_req *)(mp->m_data + offp); +#ifdef __FreeBSD__ + PF_LOCK(); +#endif for (i = 0; i < count; i++) { ur = &ura[i]; @@ -1490,11 +1447,12 @@ pfsync_in_ureq(struct pfsync_pkt *pkt, s if (ISSET(st->state_flags, PFSTATE_NOSYNC)) continue; - PF_LOCK(); pfsync_update_state_req(st); - PF_UNLOCK(); } } +#ifdef __FreeBSD__ + PF_UNLOCK(); +#endif return (len); } @@ -1617,7 +1575,7 @@ pfsync_in_bus(struct pfsync_pkt *pkt, st #ifdef __FreeBSD__ callout_reset(&sc->sc_bulkfail_tmo, 4 * hz + V_pf_pool_limits[PF_LIMIT_STATES].limit / - ((sc->sc_sync_if->if_mtu - PFSYNC_MINPKT) / + ((sc->sc_ifp->if_mtu - PFSYNC_MINPKT) / sizeof(struct pfsync_state)), pfsync_bulk_fail, V_pfsyncif); #else @@ -1827,10 +1785,10 @@ pfsyncioctl(struct ifnet *ifp, u_long cm #endif break; case SIOCSIFMTU: - if (ifr->ifr_mtu <= PFSYNC_MINPKT) + if (!sc->sc_sync_if || + ifr->ifr_mtu <= PFSYNC_MINPKT || + ifr->ifr_mtu > sc->sc_sync_if->if_mtu) return (EINVAL); - if (ifr->ifr_mtu > MCLBYTES) /* XXX could be bigger */ - ifr->ifr_mtu = MCLBYTES; if (ifr->ifr_mtu < ifp->if_mtu) { s = splnet(); #ifdef __FreeBSD__ @@ -1892,12 +1850,15 @@ pfsyncioctl(struct ifnet *ifp, u_long cm sc->sc_sync_if = NULL; #ifdef __FreeBSD__ PF_UNLOCK(); -#endif + if (imo->imo_membership) + pfsync_multicast_cleanup(sc); +#else if (imo->imo_num_memberships > 0) { in_delmulti(imo->imo_membership[ --imo->imo_num_memberships]); imo->imo_multicast_ifp = NULL; } +#endif break; } @@ -1922,57 +1883,53 @@ pfsyncioctl(struct ifnet *ifp, u_long cm pfsync_sendout(); sc->sc_sync_if = sifp; - if (imo->imo_num_memberships > 0) { #ifdef __FreeBSD__ + if (imo->imo_membership) { PF_UNLOCK(); -#endif - in_delmulti(imo->imo_membership[--imo->imo_num_memberships]); -#ifdef __FreeBSD__ + pfsync_multicast_cleanup(sc); PF_LOCK(); -#endif + } +#else + if (imo->imo_num_memberships > 0) { + in_delmulti(imo->imo_membership[--imo->imo_num_memberships]); imo->imo_multicast_ifp = NULL; } +#endif - if (sc->sc_sync_if && #ifdef __FreeBSD__ + if (sc->sc_sync_if && sc->sc_sync_peer.s_addr == htonl(INADDR_PFSYNC_GROUP)) { + PF_UNLOCK(); + error = pfsync_multicast_setup(sc); + if (error) + return (error); + PF_LOCK(); + } #else + if (sc->sc_sync_if && sc->sc_sync_peer.s_addr == INADDR_PFSYNC_GROUP) { -#endif struct in_addr addr; if (!(sc->sc_sync_if->if_flags & IFF_MULTICAST)) { sc->sc_sync_if = NULL; -#ifdef __FreeBSD__ - PF_UNLOCK(); -#endif splx(s); return (EADDRNOTAVAIL); } -#ifdef __FreeBSD__ - addr.s_addr = htonl(INADDR_PFSYNC_GROUP); -#else addr.s_addr = INADDR_PFSYNC_GROUP; -#endif -#ifdef __FreeBSD__ - PF_UNLOCK(); -#endif if ((imo->imo_membership[0] = in_addmulti(&addr, sc->sc_sync_if)) == NULL) { sc->sc_sync_if = NULL; splx(s); return (ENOBUFS); } -#ifdef __FreeBSD__ - PF_LOCK(); -#endif imo->imo_num_memberships++; imo->imo_multicast_ifp = sc->sc_sync_if; imo->imo_multicast_ttl = PFSYNC_DFLTTL; imo->imo_multicast_loop = 0; } +#endif /* !__FreeBSD__ */ ip = &sc->sc_template; bzero(ip, sizeof(*ip)); @@ -2111,7 +2068,7 @@ pfsync_drop(struct pfsync_softc *sc) #ifdef PFSYNC_DEBUG #ifdef __FreeBSD__ KASSERT(st->sync_state == q, - ("%s: st->sync_state == q", + ("%s: st->sync_state == q", __FUNCTION__)); #else KASSERT(st->sync_state == q); @@ -2141,12 +2098,20 @@ pfsync_drop(struct pfsync_softc *sc) sc->sc_len = PFSYNC_MINPKT; } -void -pfsync_sendout(void) -{ #ifdef __FreeBSD__ +void pfsync_sendout() +{ + pfsync_sendout1(1); +} + +static void +pfsync_sendout1(int schedswi) +{ struct pfsync_softc *sc = V_pfsyncif; #else +void +pfsync_sendout(void) +{ struct pfsync_softc *sc = pfsyncif; #endif #if NBPFILTER > 0 @@ -2167,7 +2132,6 @@ pfsync_sendout(void) #endif #ifdef __FreeBSD__ size_t pktlen; - int dummy_error; #endif int offset; int q, count = 0; @@ -2207,8 +2171,7 @@ pfsync_sendout(void) if (pktlen > MHLEN) { /* Find the right pool to allocate from. */ /* XXX: This is ugly. */ - m_cljget(m, M_DONTWAIT, pktlen <= MSIZE ? MSIZE : - pktlen <= MCLBYTES ? MCLBYTES : + m_cljget(m, M_DONTWAIT, pktlen <= MCLBYTES ? MCLBYTES : #if MJUMPAGESIZE != MCLBYTES pktlen <= MJUMPAGESIZE ? MJUMPAGESIZE : #endif @@ -2373,8 +2336,14 @@ pfsync_sendout(void) sc->sc_ifp->if_obytes += m->m_pkthdr.len; sc->sc_len = PFSYNC_MINPKT; - IFQ_ENQUEUE(&sc->sc_ifp->if_snd, m, dummy_error); - schednetisr(NETISR_PFSYNC); + if (!_IF_QFULL(&sc->sc_ifp->if_snd)) + _IF_ENQUEUE(&sc->sc_ifp->if_snd, m); + else { + m_freem(m); + sc->sc_ifp->if_snd.ifq_drops++; + } + if (schedswi) + swi_sched(V_pfsync_swi_cookie, 0); #else sc->sc_if.if_opackets++; sc->sc_if.if_obytes += m->m_pkthdr.len; @@ -2433,11 +2402,7 @@ pfsync_insert_state(struct pf_state *st) pfsync_q_ins(st, PFSYNC_S_INS); if (ISSET(st->state_flags, PFSTATE_ACK)) -#ifdef __FreeBSD__ - pfsync_sendout(); -#else schednetisr(NETISR_PFSYNC); -#endif else st->sync_updates = 0; } @@ -2636,11 +2601,7 @@ pfsync_update_state(struct pf_state *st) if (sync || (time_uptime - st->pfsync_time) < 2) { pfsync_upds++; -#ifdef __FreeBSD__ - pfsync_sendout(); -#else schednetisr(NETISR_PFSYNC); -#endif } } @@ -2676,7 +2637,7 @@ pfsync_request_update(u_int32_t creatori nlen += sizeof(struct pfsync_subheader); #ifdef __FreeBSD__ - if (sc->sc_len + nlen > sc->sc_sync_if->if_mtu) { + if (sc->sc_len + nlen > sc->sc_ifp->if_mtu) { #else if (sc->sc_len + nlen > sc->sc_if.if_mtu) { #endif @@ -2691,11 +2652,7 @@ pfsync_request_update(u_int32_t creatori TAILQ_INSERT_TAIL(&sc->sc_upd_req_list, item, ur_entry); sc->sc_len += nlen; -#ifdef __FreeBSD__ - pfsync_sendout(); -#else schednetisr(NETISR_PFSYNC); -#endif } void @@ -2724,11 +2681,7 @@ pfsync_update_state_req(struct pf_state pfsync_q_del(st); case PFSYNC_S_NONE: pfsync_q_ins(st, PFSYNC_S_UPD); -#ifdef __FreeBSD__ - pfsync_sendout(); -#else schednetisr(NETISR_PFSYNC); -#endif return; case PFSYNC_S_INS: @@ -2892,7 +2845,7 @@ pfsync_q_del(struct pf_state *st) int q = st->sync_state; #ifdef __FreeBSD__ - KASSERT(st->sync_state != PFSYNC_S_NONE, + KASSERT(st->sync_state != PFSYNC_S_NONE, ("%s: st->sync_state != PFSYNC_S_NONE", __FUNCTION__)); #else KASSERT(st->sync_state != PFSYNC_S_NONE); @@ -3023,7 +2976,7 @@ pfsync_bulk_start(void) printf("pfsync: received bulk update request\n"); #ifdef __FreeBSD__ - PF_LOCK(); + PF_LOCK_ASSERT(); if (TAILQ_EMPTY(&V_state_list)) #else if (TAILQ_EMPTY(&state_list)) @@ -3037,15 +2990,11 @@ pfsync_bulk_start(void) #else sc->sc_bulk_next = TAILQ_FIRST(&state_list); #endif - sc->sc_bulk_last = sc->sc_bulk_next; + sc->sc_bulk_last = sc->sc_bulk_next; - pfsync_bulk_status(PFSYNC_BUS_START); - callout_reset(&sc->sc_bulk_tmo, 1, - pfsync_bulk_update, sc); + pfsync_bulk_status(PFSYNC_BUS_START); + callout_reset(&sc->sc_bulk_tmo, 1, pfsync_bulk_update, sc); } -#ifdef __FreeBSD__ - PF_UNLOCK(); -#endif } void @@ -3306,7 +3255,11 @@ pfsyncintr(void *arg) CURVNET_SET(sc->sc_ifp->if_vnet); pfsync_ints++; - IF_DEQUEUE_ALL(&sc->sc_ifp->if_snd, m); + PF_LOCK(); + if (sc->sc_len > PFSYNC_MINPKT) + pfsync_sendout1(0); + _IF_DEQUEUE_ALL(&sc->sc_ifp->if_snd, m); + PF_UNLOCK(); for (; m != NULL; m = n) { @@ -3355,54 +3308,91 @@ pfsync_sysctl(int *name, u_int namelen, } #ifdef __FreeBSD__ -void -pfsync_ifdetach(void *arg, struct ifnet *ifp) +static int +pfsync_multicast_setup(struct pfsync_softc *sc) { - struct pfsync_softc *sc = (struct pfsync_softc *)arg; - struct ip_moptions *imo; - - if (sc == NULL || sc->sc_sync_if != ifp) - return; /* not for us; unlocked read */ + struct ip_moptions *imo = &sc->sc_imo; + int error; - CURVNET_SET(sc->sc_ifp->if_vnet); + if (!(sc->sc_sync_if->if_flags & IFF_MULTICAST)) { + sc->sc_sync_if = NULL; + return (EADDRNOTAVAIL); + } - PF_LOCK(); + imo->imo_membership = (struct in_multi **)malloc( + (sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_PFSYNC, + M_WAITOK | M_ZERO); + imo->imo_max_memberships = IP_MIN_MEMBERSHIPS; + imo->imo_multicast_vif = -1; - /* Deal with a member interface going away from under us. */ - sc->sc_sync_if = NULL; - imo = &sc->sc_imo; - if (imo->imo_num_memberships > 0) { - KASSERT(imo->imo_num_memberships == 1, - ("%s: imo_num_memberships != 1", __func__)); - /* - * Our event handler is always called after protocol - * domains have been detached from the underlying ifnet. - * Do not call in_delmulti(); we held a single reference - * which the protocol domain has purged in in_purgemaddrs(). - */ - PF_UNLOCK(); - imo->imo_membership[--imo->imo_num_memberships] = NULL; - PF_LOCK(); - imo->imo_multicast_ifp = NULL; - } + if ((error = in_joingroup(sc->sc_sync_if, &sc->sc_sync_peer, NULL, + &imo->imo_membership[0])) != 0) { + free(imo->imo_membership, M_PFSYNC); + return (error); + } + imo->imo_num_memberships++; + imo->imo_multicast_ifp = sc->sc_sync_if; + imo->imo_multicast_ttl = PFSYNC_DFLTTL; + imo->imo_multicast_loop = 0; - PF_UNLOCK(); - - CURVNET_RESTORE(); + return (0); } +static void +pfsync_multicast_cleanup(struct pfsync_softc *sc) +{ + struct ip_moptions *imo = &sc->sc_imo; + + in_leavegroup(imo->imo_membership[0], NULL); + free(imo->imo_membership, M_PFSYNC); + imo->imo_membership = NULL; + imo->imo_multicast_ifp = NULL; +} + +#ifdef INET +extern struct domain inetdomain; +static struct protosw in_pfsync_protosw = { + .pr_type = SOCK_RAW, + .pr_domain = &inetdomain, + .pr_protocol = IPPROTO_PFSYNC, + .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_input = pfsync_input, + .pr_output = (pr_output_t *)rip_output, + .pr_ctloutput = rip_ctloutput, + .pr_usrreqs = &rip_usrreqs +}; +#endif + static int -vnet_pfsync_init(const void *unused) +pfsync_init() { + VNET_ITERATOR_DECL(vnet_iter); int error = 0; - pfsyncattach(0); - - error = swi_add(NULL, "pfsync", pfsyncintr, V_pfsyncif, - SWI_NET, INTR_MPSAFE, &pfsync_swi.pfsync_swi_cookie); + VNET_LIST_RLOCK(); + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); + V_pfsync_cloner = pfsync_cloner; + V_pfsync_cloner_data = pfsync_cloner_data; + V_pfsync_cloner.ifc_data = &V_pfsync_cloner_data; + if_clone_attach(&V_pfsync_cloner); + error = swi_add(NULL, "pfsync", pfsyncintr, V_pfsyncif, + SWI_NET, INTR_MPSAFE, &V_pfsync_swi_cookie); + CURVNET_RESTORE(); + if (error) + goto fail_locked; + } + VNET_LIST_RUNLOCK(); +#ifdef INET + error = pf_proto_register(PF_INET, &in_pfsync_protosw); if (error) - panic("%s: swi_add %d", __func__, error); - + goto fail; + error = ipproto_register(IPPROTO_PFSYNC); + if (error) { + pf_proto_unregister(PF_INET, IPPROTO_PFSYNC, SOCK_RAW); + goto fail; + } +#endif PF_LOCK(); pfsync_state_import_ptr = pfsync_state_import; pfsync_up_ptr = pfsync_up; @@ -3415,13 +3405,27 @@ vnet_pfsync_init(const void *unused) PF_UNLOCK(); return (0); + +fail: + VNET_LIST_RLOCK(); +fail_locked: + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); + if (V_pfsync_swi_cookie) { + swi_remove(V_pfsync_swi_cookie); + if_clone_detach(&V_pfsync_cloner); + } + CURVNET_RESTORE(); + } + VNET_LIST_RUNLOCK(); + + return (error); } -static int -vnet_pfsync_uninit(const void *unused) +static void +pfsync_uninit() { - - swi_remove(pfsync_swi.pfsync_swi_cookie); + VNET_ITERATOR_DECL(vnet_iter); PF_LOCK(); pfsync_state_import_ptr = NULL; @@ -3434,30 +3438,18 @@ vnet_pfsync_uninit(const void *unused) pfsync_defer_ptr = NULL; PF_UNLOCK(); - if_clone_detach(&pfsync_cloner); - - return (0); + ipproto_unregister(IPPROTO_PFSYNC); + pf_proto_unregister(PF_INET, IPPROTO_PFSYNC, SOCK_RAW); + VNET_LIST_RLOCK(); + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); + swi_remove(V_pfsync_swi_cookie); + if_clone_detach(&V_pfsync_cloner); + CURVNET_RESTORE(); + } + VNET_LIST_RUNLOCK(); } -/* Define startup order. */ -#define PFSYNC_SYSINIT_ORDER SI_SUB_PROTO_IF -#define PFSYNC_MODEVENT_ORDER (SI_ORDER_FIRST) /* On boot slot in here. */ -#define PFSYNC_VNET_ORDER (PFSYNC_MODEVENT_ORDER + 2) /* Later still. */ - -/* - * Starting up. - * VNET_SYSINIT is called for each existing vnet and each new vnet. - */ -VNET_SYSINIT(vnet_pfsync_init, PFSYNC_SYSINIT_ORDER, PFSYNC_VNET_ORDER, - vnet_pfsync_init, NULL); - -/* - * Closing up shop. These are done in REVERSE ORDER, - * Not called on reboot. - * VNET_SYSUNINIT is called for each exiting vnet as it exits. - */ -VNET_SYSUNINIT(vnet_pfsync_uninit, PFSYNC_SYSINIT_ORDER, PFSYNC_VNET_ORDER, - vnet_pfsync_uninit, NULL); static int pfsync_modevent(module_t mod, int type, void *data) { @@ -3465,21 +3457,23 @@ pfsync_modevent(module_t mod, int type, switch (type) { case MOD_LOAD: -#ifndef __FreeBSD__ - pfsyncattach(0); -#endif + error = pfsync_init(); + break; + case MOD_QUIESCE: + /* + * Module should not be unloaded due to race conditions. + */ + error = EPERM; break; case MOD_UNLOAD: -#ifndef __FreeBSD__ - if_clone_detach(&pfsync_cloner); -#endif + pfsync_uninit(); break; default: error = EINVAL; break; } - return error; + return (error); } static moduledata_t pfsync_mod = { @@ -3490,7 +3484,7 @@ static moduledata_t pfsync_mod = { #define PFSYNC_MODVER 1 -DECLARE_MODULE(pfsync, pfsync_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +DECLARE_MODULE(pfsync, pfsync_mod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); MODULE_VERSION(pfsync, PFSYNC_MODVER); MODULE_DEPEND(pfsync, pf, PF_MODVER, PF_MODVER, PF_MODVER); #endif /* __FreeBSD__ */ Modified: stable/9/sys/contrib/pf/net/pf.c ============================================================================== --- stable/9/sys/contrib/pf/net/pf.c Wed Feb 1 15:04:27 2012 (r230867) +++ stable/9/sys/contrib/pf/net/pf.c Wed Feb 1 15:57:49 2012 (r230868) @@ -47,23 +47,7 @@ __FBSDID("$FreeBSD$"); #include "opt_bpf.h" #include "opt_pf.h" -#ifdef DEV_BPF -#define NBPFILTER DEV_BPF -#else -#define NBPFILTER 0 -#endif - -#ifdef DEV_PFLOG -#define NPFLOG DEV_PFLOG -#else -#define NPFLOG 0 -#endif - -#ifdef DEV_PFSYNC -#define NPFSYNC DEV_PFSYNC -#else -#define NPFSYNC 0 -#endif +#define NPFSYNC 1 #ifdef DEV_PFLOW #define NPFLOW DEV_PFLOW Modified: stable/9/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- stable/9/sys/contrib/pf/net/pf_ioctl.c Wed Feb 1 15:04:27 2012 (r230867) +++ stable/9/sys/contrib/pf/net/pf_ioctl.c Wed Feb 1 15:57:49 2012 (r230868) @@ -44,11 +44,7 @@ __FBSDID("$FreeBSD$"); #include "opt_bpf.h" #include "opt_pf.h" -#ifdef DEV_BPF -#define NBPFILTER DEV_BPF -#else -#define NBPFILTER 0 -#endif +#define NPFSYNC 1 #ifdef DEV_PFLOG #define NPFLOG DEV_PFLOG @@ -56,16 +52,10 @@ __FBSDID("$FreeBSD$"); #define NPFLOG 0 #endif -#ifdef DEV_PFSYNC -#define NPFSYNC DEV_PFSYNC -#else -#define NPFSYNC 0 -#endif - -#else +#else /* !__FreeBSD__ */ #include "pfsync.h" #include "pflog.h" -#endif +#endif /* __FreeBSD__ */ #include #include @@ -4328,57 +4318,25 @@ dehook_pf(void) return (0); } -/* Vnet accessors */ -static int -vnet_pf_init(const void *unused) -{ - - V_pf_pfil_hooked = 0; - V_pf_end_threads = 0; - - V_debug_pfugidhack = 0; - - TAILQ_INIT(&V_pf_tags); - TAILQ_INIT(&V_pf_qids); - - pf_load(); - - return (0); -} - -static int -vnet_pf_uninit(const void *unused) -{ - - pf_unload(); - - return (0); -} - -/* Define startup order. */ -#define PF_SYSINIT_ORDER SI_SUB_PROTO_BEGIN -#define PF_MODEVENT_ORDER (SI_ORDER_FIRST) /* On boot slot in here. */ -#define PF_VNET_ORDER (PF_MODEVENT_ORDER + 2) /* Later still. */ - -/* - * Starting up. - * VNET_SYSINIT is called for each existing vnet and each new vnet. - */ -VNET_SYSINIT(vnet_pf_init, PF_SYSINIT_ORDER, PF_VNET_ORDER, - vnet_pf_init, NULL); - -/* - * Closing up shop. These are done in REVERSE ORDER, - * Not called on reboot. - * VNET_SYSUNINIT is called for each exiting vnet as it exits. - */ -VNET_SYSUNINIT(vnet_pf_uninit, PF_SYSINIT_ORDER, PF_VNET_ORDER, - vnet_pf_uninit, NULL); - static int pf_load(void) { + VNET_ITERATOR_DECL(vnet_iter); + VNET_LIST_RLOCK(); + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); + V_pf_pfil_hooked = 0; + V_pf_end_threads = 0; + V_debug_pfugidhack = 0; + TAILQ_INIT(&V_pf_tags); + TAILQ_INIT(&V_pf_qids); + CURVNET_RESTORE(); + } + VNET_LIST_RUNLOCK(); + + init_pf_mutex(); + pf_dev = make_dev(&pf_cdevsw, 0, 0, 0, 0600, PF_NAME); init_zone_var(); sx_init(&V_pf_consistency_lock, "pf_statetbl_lock"); if (pfattach() < 0) @@ -4395,6 +4353,7 @@ pf_unload(void) PF_LOCK(); V_pf_status.running = 0; PF_UNLOCK(); + m_addr_chg_pf_p = NULL; error = dehook_pf(); if (error) { /* @@ -4417,6 +4376,8 @@ pf_unload(void) pf_osfp_cleanup(); cleanup_pf_zone(); PF_UNLOCK(); + destroy_dev(pf_dev); + destroy_pf_mutex(); sx_destroy(&V_pf_consistency_lock); return error; } @@ -4428,12 +4389,16 @@ pf_modevent(module_t mod, int type, void switch(type) { case MOD_LOAD: - init_pf_mutex(); - pf_dev = make_dev(&pf_cdevsw, 0, 0, 0, 0600, PF_NAME); + error = pf_load(); + break; + case MOD_QUIESCE: + /* + * Module should not be unloaded due to race conditions. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 17:04:15 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AB62106566C; Wed, 1 Feb 2012 17:04:15 +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 491BC8FC08; Wed, 1 Feb 2012 17:04:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11H4FoK096300; Wed, 1 Feb 2012 17:04:15 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11H4FGT096298; Wed, 1 Feb 2012 17:04:15 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201202011704.q11H4FGT096298@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 1 Feb 2012 17:04:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230870 - stable/7/share/man/man9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 17:04:15 -0000 Author: jh Date: Wed Feb 1 17:04:14 2012 New Revision: 230870 URL: http://svn.freebsd.org/changeset/base/230870 Log: Partially MFC r228358: Fix markup. Modified: stable/7/share/man/man9/sbuf.9 Directory Properties: stable/7/share/man/man9/ (props changed) Modified: stable/7/share/man/man9/sbuf.9 ============================================================================== --- stable/7/share/man/man9/sbuf.9 Wed Feb 1 16:40:59 2012 (r230869) +++ stable/7/share/man/man9/sbuf.9 Wed Feb 1 17:04:14 2012 (r230870) @@ -380,7 +380,8 @@ function returns the actual string; only works on a finished .Fa sbuf . The -.Fn sbuf_len function returns the length of the string. +.Fn sbuf_len +function returns the length of the string. For an .Fa sbuf with an attached drain, From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 17:07:29 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD640106566C; Wed, 1 Feb 2012 17:07:29 +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 BBD0D8FC08; Wed, 1 Feb 2012 17:07:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11H7TTA096441; Wed, 1 Feb 2012 17:07:29 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11H7Tmc096439; Wed, 1 Feb 2012 17:07:29 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201202011707.q11H7Tmc096439@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 1 Feb 2012 17:07:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230871 - stable/7/share/man/man9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 17:07:29 -0000 Author: jh Date: Wed Feb 1 17:07:29 2012 New Revision: 230871 URL: http://svn.freebsd.org/changeset/base/230871 Log: MFC r228359: sbuf_data() hasn't returned NULL for overflowed buffers since r71721. Modified: stable/7/share/man/man9/sbuf.9 Directory Properties: stable/7/share/man/man9/ (props changed) Modified: stable/7/share/man/man9/sbuf.9 ============================================================================== --- stable/7/share/man/man9/sbuf.9 Wed Feb 1 17:04:14 2012 (r230870) +++ stable/7/share/man/man9/sbuf.9 Wed Feb 1 17:07:29 2012 (r230871) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 25, 2011 +.Dd December 9, 2011 .Dt SBUF 9 .Os .Sh NAME @@ -456,12 +456,8 @@ function returns a non-zero value if the buffer overflowed, and zero otherwise. .Pp The -.Fn sbuf_data -and .Fn sbuf_len -functions return -.Dv NULL -and \-1, respectively, if the buffer overflowed. +function returns \-1 if the buffer overflowed. .Pp The .Fn sbuf_copyin From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 17:56:39 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F541106564A; Wed, 1 Feb 2012 17:56:39 +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 6C8178FC12; Wed, 1 Feb 2012 17:56:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11HudFS098045; Wed, 1 Feb 2012 17:56:39 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11HudOk098043; Wed, 1 Feb 2012 17:56:39 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201202011756.q11HudOk098043@svn.freebsd.org> From: Alexander Motin Date: Wed, 1 Feb 2012 17:56:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230872 - stable/9/sys/cam/scsi X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 17:56:39 -0000 Author: mav Date: Wed Feb 1 17:56:38 2012 New Revision: 230872 URL: http://svn.freebsd.org/changeset/base/230872 Log: MFC r228820, r228851: Merge to da driver quirks hinting 4K physical sector sizes for SATA disks connected via SAS or USB. Unluckily I've found that SAS (mps) and USB-SATA I have translate models in different ways, requiring twice more quirks. Unluckily for Hitachi, their model names are trimmed on SAS, making impossible to identify 4K sector drives that way. Modified: stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Wed Feb 1 17:07:29 2012 (r230871) +++ stable/9/sys/cam/scsi/scsi_da.c Wed Feb 1 17:56:38 2012 (r230872) @@ -89,7 +89,8 @@ typedef enum { DA_Q_NONE = 0x00, DA_Q_NO_SYNC_CACHE = 0x01, DA_Q_NO_6_BYTE = 0x02, - DA_Q_NO_PREVENT = 0x04 + DA_Q_NO_PREVENT = 0x04, + DA_Q_4K = 0x08 } da_quirks; typedef enum { @@ -112,6 +113,8 @@ struct disk_params { u_int8_t secs_per_track; u_int32_t secsize; /* Number of bytes/sector */ u_int64_t sectors; /* total number sectors */ + u_int stripesize; + u_int stripeoffset; }; struct da_softc { @@ -565,7 +568,223 @@ static struct da_quirk_entry da_quirk_ta */ {T_DIRECT, SIP_MEDIA_REMOVABLE, "Sony", "Sony DSC", "*"}, /*quirks*/ DA_Q_NO_SYNC_CACHE | DA_Q_NO_PREVENT - } + }, + /* ATA/SATA devices over SAS/USB/... */ + { + /* Hitachi Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "Hitachi", "H??????????E3*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Samsung Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG HD155UI*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Samsung Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "SAMSUNG", "HD155UI*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Samsung Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG HD204UI*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Samsung Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "SAMSUNG", "HD204UI*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Barracuda Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST????DL*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Barracuda Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST????DL", "*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Barracuda Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST???DM*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Barracuda Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST???DM*", "*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Barracuda Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST????DM*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Barracuda Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST????DM", "*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST9500423AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST950042", "3AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST9500424AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST950042", "4AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST9640423AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST964042", "3AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST9640424AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST964042", "4AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST9750420AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST975042", "0AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST9750422AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST975042", "2AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST9750423AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST975042", "3AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Thin Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST???LT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Thin Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST???LT*", "*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD????RS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "??RS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD????RX*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "??RX*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD??????RS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "????RS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD??????RX*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "????RX*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Black Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD???PKT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Black Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "?PKT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Black Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD?????PKT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Black Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "???PKT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Blue Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD???PVT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Blue Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "?PVT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Blue Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD?????PVT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Blue Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "???PVT*", "*" }, + /*quirks*/DA_Q_4K + }, }; static disk_strategy_t dastrategy; @@ -586,7 +805,7 @@ static int daerror(union ccb *ccb, u_i static void daprevent(struct cam_periph *periph, int action); static int dagetcapacity(struct cam_periph *periph); static void dasetgeom(struct cam_periph *periph, uint32_t block_len, - uint64_t maxsector); + uint64_t maxsector, u_int lbppbe, u_int lalba); static timeout_t dasendorderedtag; static void dashutdown(void *arg, int howto); @@ -688,6 +907,8 @@ daopen(struct disk *dp) softc->disk->d_sectorsize = softc->params.secsize; softc->disk->d_mediasize = softc->params.secsize * (off_t)softc->params.sectors; + softc->disk->d_stripesize = softc->params.stripesize; + softc->disk->d_stripeoffset = softc->params.stripeoffset; /* XXX: these are not actually "firmware" values, so they may be wrong */ softc->disk->d_fwsectors = softc->params.secs_per_track; softc->disk->d_fwheads = softc->params.heads; @@ -1759,7 +1980,7 @@ dadone(struct cam_periph *periph, union announce_buf[0] = '\0'; cam_periph_invalidate(periph); } else { - dasetgeom(periph, block_size, maxsector); + dasetgeom(periph, block_size, maxsector, 0, 0); dp = &softc->params; snprintf(announce_buf, sizeof(announce_buf), "%juMB (%ju %u byte sectors: %dH %dS/T " @@ -2091,7 +2312,7 @@ done: (uintmax_t) block_len); error = EINVAL; } else - dasetgeom(periph, block_len, maxsector); + dasetgeom(periph, block_len, maxsector, 0, 0); } xpt_release_ccb(ccb); @@ -2102,7 +2323,8 @@ done: } static void -dasetgeom(struct cam_periph *periph, uint32_t block_len, uint64_t maxsector) +dasetgeom(struct cam_periph *periph, uint32_t block_len, uint64_t maxsector, + u_int lbppbe, u_int lalba) { struct ccb_calc_geometry ccg; struct da_softc *softc; @@ -2113,6 +2335,17 @@ dasetgeom(struct cam_periph *periph, uin dp = &softc->params; dp->secsize = block_len; dp->sectors = maxsector + 1; + if (lbppbe > 0) { + dp->stripesize = block_len << lbppbe; + dp->stripeoffset = (dp->stripesize - block_len * lalba) % + dp->stripesize; + } else if (softc->quirks & DA_Q_4K) { + dp->stripesize = 4096; + dp->stripeoffset = 0; + } else { + dp->stripesize = 0; + dp->stripeoffset = 0; + } /* * Have the controller provide us with a geometry * for this disk. The only time the geometry From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 18:05:55 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 944811065670; Wed, 1 Feb 2012 18:05:55 +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 775D28FC08; Wed, 1 Feb 2012 18:05:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11I5tFA098486; Wed, 1 Feb 2012 18:05:55 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11I5tqE098484; Wed, 1 Feb 2012 18:05:55 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201202011805.q11I5tqE098484@svn.freebsd.org> From: Alexander Motin Date: Wed, 1 Feb 2012 18:05: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: r230875 - stable/8/sys/cam/scsi X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 18:05:55 -0000 Author: mav Date: Wed Feb 1 18:05:54 2012 New Revision: 230875 URL: http://svn.freebsd.org/changeset/base/230875 Log: MFC r228820, r228851: Merge to da driver quirks hinting 4K physical sector sizes for SATA disks connected via SAS or USB. Unluckily I've found that SAS (mps) and USB-SATA I have translate models in different ways, requiring twice more quirks. Unluckily for Hitachi, their model names are trimmed on SAS, making impossible to identify 4K sector drives that way. Modified: stable/8/sys/cam/scsi/scsi_da.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/e1000/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Wed Feb 1 18:03:21 2012 (r230874) +++ stable/8/sys/cam/scsi/scsi_da.c Wed Feb 1 18:05:54 2012 (r230875) @@ -88,7 +88,8 @@ typedef enum { DA_Q_NONE = 0x00, DA_Q_NO_SYNC_CACHE = 0x01, DA_Q_NO_6_BYTE = 0x02, - DA_Q_NO_PREVENT = 0x04 + DA_Q_NO_PREVENT = 0x04, + DA_Q_4K = 0x08 } da_quirks; typedef enum { @@ -111,6 +112,8 @@ struct disk_params { u_int8_t secs_per_track; u_int32_t secsize; /* Number of bytes/sector */ u_int64_t sectors; /* total number sectors */ + u_int stripesize; + u_int stripeoffset; }; struct da_softc { @@ -563,7 +566,223 @@ static struct da_quirk_entry da_quirk_ta */ {T_DIRECT, SIP_MEDIA_REMOVABLE, "Sony", "Sony DSC", "*"}, /*quirks*/ DA_Q_NO_SYNC_CACHE | DA_Q_NO_PREVENT - } + }, + /* ATA/SATA devices over SAS/USB/... */ + { + /* Hitachi Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "Hitachi", "H??????????E3*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Samsung Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG HD155UI*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Samsung Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "SAMSUNG", "HD155UI*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Samsung Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG HD204UI*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Samsung Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "SAMSUNG", "HD204UI*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Barracuda Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST????DL*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Barracuda Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST????DL", "*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Barracuda Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST???DM*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Barracuda Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST???DM*", "*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Barracuda Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST????DM*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Barracuda Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST????DM", "*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST9500423AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST950042", "3AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST9500424AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST950042", "4AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST9640423AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST964042", "3AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST9640424AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST964042", "4AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST9750420AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST975042", "0AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST9750422AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST975042", "2AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST9750423AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST975042", "3AS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Thin Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "ST???LT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* Seagate Momentus Thin Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ST???LT*", "*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD????RS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "??RS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD????RX*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "??RX*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD??????RS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "????RS*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD??????RX*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "????RX*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Black Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD???PKT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Black Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "?PKT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Black Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD?????PKT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Black Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "???PKT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Blue Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD???PVT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Blue Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "?PVT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Blue Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "WDC WD?????PVT*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* WDC Scorpio Blue Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "???PVT*", "*" }, + /*quirks*/DA_Q_4K + }, }; static disk_strategy_t dastrategy; @@ -584,7 +803,7 @@ static int daerror(union ccb *ccb, u_i static void daprevent(struct cam_periph *periph, int action); static int dagetcapacity(struct cam_periph *periph); static void dasetgeom(struct cam_periph *periph, uint32_t block_len, - uint64_t maxsector); + uint64_t maxsector, u_int lbppbe, u_int lalba); static timeout_t dasendorderedtag; static void dashutdown(void *arg, int howto); @@ -686,6 +905,8 @@ daopen(struct disk *dp) softc->disk->d_sectorsize = softc->params.secsize; softc->disk->d_mediasize = softc->params.secsize * (off_t)softc->params.sectors; + softc->disk->d_stripesize = softc->params.stripesize; + softc->disk->d_stripeoffset = softc->params.stripeoffset; /* XXX: these are not actually "firmware" values, so they may be wrong */ softc->disk->d_fwsectors = softc->params.secs_per_track; softc->disk->d_fwheads = softc->params.heads; @@ -1661,7 +1882,7 @@ dadone(struct cam_periph *periph, union announce_buf[0] = '\0'; cam_periph_invalidate(periph); } else { - dasetgeom(periph, block_size, maxsector); + dasetgeom(periph, block_size, maxsector, 0, 0); dp = &softc->params; snprintf(announce_buf, sizeof(announce_buf), "%juMB (%ju %u byte sectors: %dH %dS/T " @@ -1992,7 +2213,7 @@ done: (uintmax_t) block_len); error = EINVAL; } else - dasetgeom(periph, block_len, maxsector); + dasetgeom(periph, block_len, maxsector, 0, 0); } xpt_release_ccb(ccb); @@ -2003,7 +2224,8 @@ done: } static void -dasetgeom(struct cam_periph *periph, uint32_t block_len, uint64_t maxsector) +dasetgeom(struct cam_periph *periph, uint32_t block_len, uint64_t maxsector, + u_int lbppbe, u_int lalba) { struct ccb_calc_geometry ccg; struct da_softc *softc; @@ -2014,6 +2236,17 @@ dasetgeom(struct cam_periph *periph, uin dp = &softc->params; dp->secsize = block_len; dp->sectors = maxsector + 1; + if (lbppbe > 0) { + dp->stripesize = block_len << lbppbe; + dp->stripeoffset = (dp->stripesize - block_len * lalba) % + dp->stripesize; + } else if (softc->quirks & DA_Q_4K) { + dp->stripesize = 4096; + dp->stripeoffset = 0; + } else { + dp->stripesize = 0; + dp->stripeoffset = 0; + } /* * Have the controller provide us with a geometry * for this disk. The only time the geometry From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:08:34 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AF38106566B; Wed, 1 Feb 2012 21:08:34 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EA8C8FC0C; Wed, 1 Feb 2012 21:08:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11L8YcG004714; Wed, 1 Feb 2012 21:08:34 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11L8YEL004711; Wed, 1 Feb 2012 21:08:34 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012108.q11L8YEL004711@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:08:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230880 - stable/9/sys/dev/ata/chipsets X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:08:34 -0000 Author: marius Date: Wed Feb 1 21:08:33 2012 New Revision: 230880 URL: http://svn.freebsd.org/changeset/base/230880 Log: MFC: r230627 Using ATA_CAM along with ATAPI DMA causes data corruption with ALI_NEW and CMD controllers for reasons unknown so disable it. PR: 164226 Modified: stable/9/sys/dev/ata/chipsets/ata-acerlabs.c stable/9/sys/dev/ata/chipsets/ata-siliconimage.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/ata/chipsets/ata-acerlabs.c ============================================================================== --- stable/9/sys/dev/ata/chipsets/ata-acerlabs.c Wed Feb 1 20:19:33 2012 (r230879) +++ stable/9/sys/dev/ata/chipsets/ata-acerlabs.c Wed Feb 1 21:08:33 2012 (r230880) @@ -213,6 +213,10 @@ ata_ali_ch_attach(device_t dev) if (ch->dma.max_iosize > 256 * 512) ch->dma.max_iosize = 256 * 512; } +#ifdef ATA_CAM + if (ctlr->chip->cfg2 & ALI_NEW) + ch->flags |= ATA_NO_ATAPI_DMA; +#endif return 0; } Modified: stable/9/sys/dev/ata/chipsets/ata-siliconimage.c ============================================================================== --- stable/9/sys/dev/ata/chipsets/ata-siliconimage.c Wed Feb 1 20:19:33 2012 (r230879) +++ stable/9/sys/dev/ata/chipsets/ata-siliconimage.c Wed Feb 1 21:08:33 2012 (r230880) @@ -240,6 +240,10 @@ ata_cmd_ch_attach(device_t dev) if (ctlr->chip->cfg2 & SII_INTR) ch->hw.status = ata_cmd_status; +#ifdef ATA_CAM + ch->flags |= ATA_NO_ATAPI_DMA; +#endif + return 0; } From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:08:36 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71B311065672; Wed, 1 Feb 2012 21:08:36 +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 5FEC48FC16; Wed, 1 Feb 2012 21:08:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11L8a90004745; Wed, 1 Feb 2012 21:08:36 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11L8aoF004742; Wed, 1 Feb 2012 21:08:36 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012108.q11L8aoF004742@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:08:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230881 - stable/8/sys/dev/ata/chipsets X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:08:36 -0000 Author: marius Date: Wed Feb 1 21:08:35 2012 New Revision: 230881 URL: http://svn.freebsd.org/changeset/base/230881 Log: MFC: r230627 Using ATA_CAM along with ATAPI DMA causes data corruption with ALI_NEW and CMD controllers for reasons unknown so disable it. PR: 164226 Modified: stable/8/sys/dev/ata/chipsets/ata-acerlabs.c stable/8/sys/dev/ata/chipsets/ata-siliconimage.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/e1000/ (props changed) Modified: stable/8/sys/dev/ata/chipsets/ata-acerlabs.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-acerlabs.c Wed Feb 1 21:08:33 2012 (r230880) +++ stable/8/sys/dev/ata/chipsets/ata-acerlabs.c Wed Feb 1 21:08:35 2012 (r230881) @@ -213,6 +213,10 @@ ata_ali_ch_attach(device_t dev) if (ch->dma.max_iosize > 256 * 512) ch->dma.max_iosize = 256 * 512; } +#ifdef ATA_CAM + if (ctlr->chip->cfg2 & ALI_NEW) + ch->flags |= ATA_NO_ATAPI_DMA; +#endif return 0; } Modified: stable/8/sys/dev/ata/chipsets/ata-siliconimage.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-siliconimage.c Wed Feb 1 21:08:33 2012 (r230880) +++ stable/8/sys/dev/ata/chipsets/ata-siliconimage.c Wed Feb 1 21:08:35 2012 (r230881) @@ -240,6 +240,10 @@ ata_cmd_ch_attach(device_t dev) if (ctlr->chip->cfg2 & SII_INTR) ch->hw.status = ata_cmd_status; +#ifdef ATA_CAM + ch->flags |= ATA_NO_ATAPI_DMA; +#endif + return 0; } From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:10:00 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E5961065672; Wed, 1 Feb 2012 21:10:00 +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 4B5368FC13; Wed, 1 Feb 2012 21:10:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LA0Vg004860; Wed, 1 Feb 2012 21:10:00 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LA008004853; Wed, 1 Feb 2012 21:10:00 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012110.q11LA008004853@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:10:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230882 - stable/9/sys/sparc64/include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:10:00 -0000 Author: marius Date: Wed Feb 1 21:09:59 2012 New Revision: 230882 URL: http://svn.freebsd.org/changeset/base/230882 Log: MFC: r230630 For machines where the kernel address space is unrestricted increase VM_KMEM_SIZE_SCALE to 2, awaiting more insight from alc@. As it turns out, the VM apparently has problems with machines that have large holes in the physical address space, causing the kmem_suballoc() call in kmeminit() to fail with a VM_KMEM_SIZE_SCALE of 1. Using a value of 2 allows these, namely Blade 1500 with 2GB of RAM, to boot. PR: 164227 Modified: stable/9/sys/sparc64/include/vmparam.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/sparc64/include/vmparam.h ============================================================================== --- stable/9/sys/sparc64/include/vmparam.h Wed Feb 1 21:08:35 2012 (r230881) +++ stable/9/sys/sparc64/include/vmparam.h Wed Feb 1 21:09:59 2012 (r230882) @@ -218,7 +218,7 @@ * is the total KVA space allocated for kmem_map. */ #ifndef VM_KMEM_SIZE_SCALE -#define VM_KMEM_SIZE_SCALE (tsb_kernel_ldd_phys == 0 ? 3 : 1) +#define VM_KMEM_SIZE_SCALE (tsb_kernel_ldd_phys == 0 ? 3 : 2) #endif /* From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:10:01 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1486D106566B; Wed, 1 Feb 2012 21:10:01 +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 F24818FC14; Wed, 1 Feb 2012 21:10:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LA0ix004880; Wed, 1 Feb 2012 21:10:00 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LA0dB004878; Wed, 1 Feb 2012 21:10:00 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012110.q11LA0dB004878@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:10: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: r230883 - stable/8/sys/sparc64/include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:10:01 -0000 Author: marius Date: Wed Feb 1 21:10:00 2012 New Revision: 230883 URL: http://svn.freebsd.org/changeset/base/230883 Log: MFC: r230630 For machines where the kernel address space is unrestricted increase VM_KMEM_SIZE_SCALE to 2, awaiting more insight from alc@. As it turns out, the VM apparently has problems with machines that have large holes in the physical address space, causing the kmem_suballoc() call in kmeminit() to fail with a VM_KMEM_SIZE_SCALE of 1. Using a value of 2 allows these, namely Blade 1500 with 2GB of RAM, to boot. PR: 164227 Modified: stable/8/sys/sparc64/include/vmparam.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/e1000/ (props changed) Modified: stable/8/sys/sparc64/include/vmparam.h ============================================================================== --- stable/8/sys/sparc64/include/vmparam.h Wed Feb 1 21:09:59 2012 (r230882) +++ stable/8/sys/sparc64/include/vmparam.h Wed Feb 1 21:10:00 2012 (r230883) @@ -222,7 +222,7 @@ * is the total KVA space allocated for kmem_map. */ #ifndef VM_KMEM_SIZE_SCALE -#define VM_KMEM_SIZE_SCALE (tsb_kernel_ldd_phys == 0 ? 3 : 1) +#define VM_KMEM_SIZE_SCALE (tsb_kernel_ldd_phys == 0 ? 3 : 2) #endif /* From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:11:07 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4767C106566B; Wed, 1 Feb 2012 21:11: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 358C18FC16; Wed, 1 Feb 2012 21:11:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LB7ED004999; Wed, 1 Feb 2012 21:11:07 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LB7AH004997; Wed, 1 Feb 2012 21:11:07 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012111.q11LB7AH004997@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:11:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230884 - stable/9/sys/dev/ofw X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:11:07 -0000 Author: marius Date: Wed Feb 1 21:11:06 2012 New Revision: 230884 URL: http://svn.freebsd.org/changeset/base/230884 Log: MFC: r230631 Implement OF_printf() using kvprintf() directly, avoiding to use a buffer and allowing to handle newlines properly. Modified: stable/9/sys/dev/ofw/openfirm.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/ofw/openfirm.c ============================================================================== --- stable/9/sys/dev/ofw/openfirm.c Wed Feb 1 21:10:00 2012 (r230883) +++ stable/9/sys/dev/ofw/openfirm.c Wed Feb 1 21:11:06 2012 (r230884) @@ -72,6 +72,8 @@ __FBSDID("$FreeBSD$"); #include "ofw_if.h" +static void OF_putchar(int c, void *arg); + MALLOC_DEFINE(M_OFWPROP, "openfirm", "Open Firmware properties"); static ihandle_t stdout; @@ -82,7 +84,7 @@ static struct ofw_kobj ofw_kernel_obj; static struct kobj_ops ofw_kernel_kops; /* - * OFW install routines. Highest priority wins, equal priority also + * OFW install routines. Highest priority wins, equal priority also * overrides allowing last-set to win. */ SET_DECLARE(ofw_set, ofw_def_t); @@ -138,15 +140,27 @@ OF_init(void *cookie) return (rv); } +static void +OF_putchar(int c, void *arg __unused) +{ + char cbuf; + + if (c == '\n') { + cbuf = '\r'; + OF_write(stdout, &cbuf, 1); + } + + cbuf = c; + OF_write(stdout, &cbuf, 1); +} + void OF_printf(const char *fmt, ...) { va_list va; - char buf[1024]; va_start(va, fmt); - vsprintf(buf, fmt, va); - OF_write(stdout, buf, strlen(buf)); + (void)kvprintf(fmt, OF_putchar, NULL, 10, va); va_end(va); } From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:11:13 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC04F1065805; Wed, 1 Feb 2012 21:11: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 1A7A68FC17; Wed, 1 Feb 2012 21:11:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LB9kN005034; Wed, 1 Feb 2012 21:11:09 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LB9EU005032; Wed, 1 Feb 2012 21:11:09 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012111.q11LB9EU005032@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:11:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230885 - stable/8/sys/dev/ofw X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:11:14 -0000 Author: marius Date: Wed Feb 1 21:11:09 2012 New Revision: 230885 URL: http://svn.freebsd.org/changeset/base/230885 Log: MFC: r230631 Implement OF_printf() using kvprintf() directly, avoiding to use a buffer and allowing to handle newlines properly. Modified: stable/8/sys/dev/ofw/openfirm.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/e1000/ (props changed) Modified: stable/8/sys/dev/ofw/openfirm.c ============================================================================== --- stable/8/sys/dev/ofw/openfirm.c Wed Feb 1 21:11:06 2012 (r230884) +++ stable/8/sys/dev/ofw/openfirm.c Wed Feb 1 21:11:09 2012 (r230885) @@ -70,6 +70,8 @@ __FBSDID("$FreeBSD$"); #include "ofw_if.h" +static void OF_putchar(int c, void *arg); + MALLOC_DEFINE(M_OFWPROP, "openfirm", "Open Firmware properties"); static ihandle_t stdout; @@ -80,7 +82,7 @@ static struct ofw_kobj ofw_kernel_obj; static struct kobj_ops ofw_kernel_kops; /* - * OFW install routines. Highest priority wins, equal priority also + * OFW install routines. Highest priority wins, equal priority also * overrides allowing last-set to win. */ SET_DECLARE(ofw_set, ofw_def_t); @@ -131,15 +133,27 @@ OF_init(void *cookie) stdout = -1; } +static void +OF_putchar(int c, void *arg __unused) +{ + char cbuf; + + if (c == '\n') { + cbuf = '\r'; + OF_write(stdout, &cbuf, 1); + } + + cbuf = c; + OF_write(stdout, &cbuf, 1); +} + void OF_printf(const char *fmt, ...) { va_list va; - char buf[1024]; va_start(va, fmt); - vsprintf(buf, fmt, va); - OF_write(stdout, buf, strlen(buf)); + (void)kvprintf(fmt, OF_putchar, NULL, 10, va); va_end(va); } From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:14:05 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64189106564A; Wed, 1 Feb 2012 21:14:05 +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 37B798FC14; Wed, 1 Feb 2012 21:14:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LE5kq005189; Wed, 1 Feb 2012 21:14:05 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LE5Cg005186; Wed, 1 Feb 2012 21:14:05 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012114.q11LE5Cg005186@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:14:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230886 - in stable/9/sys/sparc64: include sparc64 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:14:05 -0000 Author: marius Date: Wed Feb 1 21:14:04 2012 New Revision: 230886 URL: http://svn.freebsd.org/changeset/base/230886 Log: MFC: r230632 - Now that we have a working OF_printf() since r230631 (MFC'ed to stable/9 in r230884), use it for implementing a simple OF_panic() that may be used during the early cycles when panic() isn't available, yet. - Mark cpu_{exit,shutdown}() as __dead2 as appropriate. Modified: stable/9/sys/sparc64/include/ofw_machdep.h stable/9/sys/sparc64/sparc64/ofw_machdep.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/sparc64/include/ofw_machdep.h ============================================================================== --- stable/9/sys/sparc64/include/ofw_machdep.h Wed Feb 1 21:11:09 2012 (r230885) +++ stable/9/sys/sparc64/include/ofw_machdep.h Wed Feb 1 21:14:04 2012 (r230886) @@ -37,8 +37,9 @@ typedef uint64_t cell_t; int OF_decode_addr(phandle_t, int, int *, bus_addr_t *); void OF_getetheraddr(device_t, u_char *); u_int OF_getscsinitid(device_t); -void cpu_shutdown(void *); +void OF_panic(const char *fmt, ...) __dead2 __printflike(1, 2); +void cpu_shutdown(void *) __dead2; int ofw_entry(void *); -void ofw_exit(void *); +void ofw_exit(void *) __dead2; #endif /* _MACHINE_OFW_MACHDEP_H_ */ Modified: stable/9/sys/sparc64/sparc64/ofw_machdep.c ============================================================================== --- stable/9/sys/sparc64/sparc64/ofw_machdep.c Wed Feb 1 21:11:09 2012 (r230885) +++ stable/9/sys/sparc64/sparc64/ofw_machdep.c Wed Feb 1 21:14:04 2012 (r230886) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include void OF_getetheraddr(device_t dev, u_char *addr) @@ -81,6 +82,19 @@ OF_getscsinitid(device_t dev) return (7); } +void +OF_panic(const char *fmt, ...) +{ + char buf[256]; + va_list ap; + + va_start(ap, fmt); + (void)vsnprintf(buf, sizeof(buf), fmt, ap); + OF_printf("OF_panic: %s\n", buf); + va_end(ap); + OF_exit(); +} + static __inline uint32_t phys_hi_mask_space(const char *bus, uint32_t phys_hi) { From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:14:07 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C14E3106566C; Wed, 1 Feb 2012 21:14: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 94C0B8FC15; Wed, 1 Feb 2012 21:14:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LE7Dg005223; Wed, 1 Feb 2012 21:14:07 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LE7CC005220; Wed, 1 Feb 2012 21:14:07 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012114.q11LE7CC005220@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:14: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: r230887 - in stable/8/sys/sparc64: include sparc64 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:14:07 -0000 Author: marius Date: Wed Feb 1 21:14:07 2012 New Revision: 230887 URL: http://svn.freebsd.org/changeset/base/230887 Log: MFC: r230632 - Now that we have a working OF_printf() since r230631 (MFC'ed to stable/8 in r230885), use it for implementing a simple OF_panic() that may be used during the early cycles when panic() isn't available, yet. - Mark cpu_{exit,shutdown}() as __dead2 as appropriate. Modified: stable/8/sys/sparc64/include/ofw_machdep.h stable/8/sys/sparc64/sparc64/ofw_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/e1000/ (props changed) Modified: stable/8/sys/sparc64/include/ofw_machdep.h ============================================================================== --- stable/8/sys/sparc64/include/ofw_machdep.h Wed Feb 1 21:14:04 2012 (r230886) +++ stable/8/sys/sparc64/include/ofw_machdep.h Wed Feb 1 21:14:07 2012 (r230887) @@ -37,8 +37,9 @@ typedef uint64_t cell_t; int OF_decode_addr(phandle_t, int, int *, bus_addr_t *); void OF_getetheraddr(device_t, u_char *); u_int OF_getscsinitid(device_t); -void cpu_shutdown(void *); +void OF_panic(const char *fmt, ...) __dead2 __printflike(1, 2); +void cpu_shutdown(void *) __dead2; int ofw_entry(void *); -void ofw_exit(void *); +void ofw_exit(void *) __dead2; #endif /* _MACHINE_OFW_MACHDEP_H_ */ Modified: stable/8/sys/sparc64/sparc64/ofw_machdep.c ============================================================================== --- stable/8/sys/sparc64/sparc64/ofw_machdep.c Wed Feb 1 21:14:04 2012 (r230886) +++ stable/8/sys/sparc64/sparc64/ofw_machdep.c Wed Feb 1 21:14:07 2012 (r230887) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include void OF_getetheraddr(device_t dev, u_char *addr) @@ -81,6 +82,19 @@ OF_getscsinitid(device_t dev) return (7); } +void +OF_panic(const char *fmt, ...) +{ + char buf[256]; + va_list ap; + + va_start(ap, fmt); + (void)vsnprintf(buf, sizeof(buf), fmt, ap); + OF_printf("OF_panic: %s\n", buf); + va_end(ap); + OF_exit(); +} + static __inline uint32_t phys_hi_mask_space(const char *bus, uint32_t phys_hi) { From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:15:24 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7CC9106566B; Wed, 1 Feb 2012 21:15:24 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C63388FC15; Wed, 1 Feb 2012 21:15:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LFO0o005330; Wed, 1 Feb 2012 21:15:24 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LFO8H005328; Wed, 1 Feb 2012 21:15:24 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012115.q11LFO8H005328@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230888 - stable/9/sys/sparc64/include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:15:25 -0000 Author: marius Date: Wed Feb 1 21:15:24 2012 New Revision: 230888 URL: http://svn.freebsd.org/changeset/base/230888 Log: MFC: r230628 Mark cpu_{halt,reset}() as __dead2 as appropriate. Modified: stable/9/sys/sparc64/include/cpu.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/sparc64/include/cpu.h ============================================================================== --- stable/9/sys/sparc64/include/cpu.h Wed Feb 1 21:14:07 2012 (r230887) +++ stable/9/sys/sparc64/include/cpu.h Wed Feb 1 21:15:24 2012 (r230888) @@ -53,8 +53,8 @@ extern char btext[]; extern char etext[]; void cheetah_init(u_int cpu_impl); -void cpu_halt(void); -void cpu_reset(void); +void cpu_halt(void) __dead2; +void cpu_reset(void) __dead2; void fork_trampoline(void); void swi_vm(void *v); void zeus_init(u_int cpu_impl); From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:15:28 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A18A106564A; Wed, 1 Feb 2012 21:15:28 +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 EC8558FC08; Wed, 1 Feb 2012 21:15:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LFRDq005365; Wed, 1 Feb 2012 21:15:27 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LFRTm005363; Wed, 1 Feb 2012 21:15:27 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012115.q11LFRTm005363@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:15:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230889 - stable/8/sys/sparc64/include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:15:28 -0000 Author: marius Date: Wed Feb 1 21:15:27 2012 New Revision: 230889 URL: http://svn.freebsd.org/changeset/base/230889 Log: MFC: r230628 Mark cpu_{halt,reset}() as __dead2 as appropriate. Modified: stable/8/sys/sparc64/include/cpu.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/e1000/ (props changed) Modified: stable/8/sys/sparc64/include/cpu.h ============================================================================== --- stable/8/sys/sparc64/include/cpu.h Wed Feb 1 21:15:24 2012 (r230888) +++ stable/8/sys/sparc64/include/cpu.h Wed Feb 1 21:15:27 2012 (r230889) @@ -53,8 +53,8 @@ extern char btext[]; extern char etext[]; void cheetah_init(u_int cpu_impl); -void cpu_halt(void); -void cpu_reset(void); +void cpu_halt(void) __dead2; +void cpu_reset(void) __dead2; void fork_trampoline(void); void swi_vm(void *v); void zeus_init(u_int cpu_impl); From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:19:53 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59FBE106564A; Wed, 1 Feb 2012 21:19:53 +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 46B9F8FC16; Wed, 1 Feb 2012 21:19:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LJrwi005587; Wed, 1 Feb 2012 21:19:53 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LJrQN005581; Wed, 1 Feb 2012 21:19:53 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012119.q11LJrQN005581@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:19:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230890 - in stable/9/sys/sparc64: include sparc64 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:19:53 -0000 Author: marius Date: Wed Feb 1 21:19:52 2012 New Revision: 230890 URL: http://svn.freebsd.org/changeset/base/230890 Log: MFC: r230633, r230634 Now that we have a working OF_printf() since r230631 and a OF_panic() helper since r230632 (MFC'ed to stable/9 in r230884 and r230886 respectively), use these for output and panicing during the early cycles and move cninit() until after the static per-CPU data has been set up. This solves a couple of issue regarding the non- availability of the static per-CPU data: - panic() not working and only making things worse when called, - having to supply a special DELAY() implementation to the low-level console drivers, - curthread accesses of mutex(9) usage in low-level console drivers that aren't conditional due to compiler optimizations (basically, this is the problem described in r227537 but in this case for keyboards attached via uart(4)). [1] PR: 164123 [1] Modified: stable/9/sys/sparc64/include/clock.h stable/9/sys/sparc64/sparc64/cache.c stable/9/sys/sparc64/sparc64/clock.c stable/9/sys/sparc64/sparc64/machdep.c stable/9/sys/sparc64/sparc64/pmap.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/sparc64/include/clock.h ============================================================================== --- stable/9/sys/sparc64/include/clock.h Wed Feb 1 21:15:27 2012 (r230889) +++ stable/9/sys/sparc64/include/clock.h Wed Feb 1 21:19:52 2012 (r230890) @@ -1,27 +1,5 @@ /*- - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * This file is in the public domain. * * $FreeBSD$ */ @@ -29,10 +7,4 @@ #ifndef _MACHINE_CLOCK_H_ #define _MACHINE_CLOCK_H_ -extern void (*delay_func)(int usec); -extern u_long clock_boot; - -void delay_boot(int usec); -void delay_tick(int usec); - #endif /* !_MACHINE_CLOCK_H_ */ Modified: stable/9/sys/sparc64/sparc64/cache.c ============================================================================== --- stable/9/sys/sparc64/sparc64/cache.c Wed Feb 1 21:15:27 2012 (r230889) +++ stable/9/sys/sparc64/sparc64/cache.c Wed Feb 1 21:19:52 2012 (r230890) @@ -142,24 +142,24 @@ cache_init(struct pcpu *pcpu) "l2-cache-line-size", pcpu->pc_cache.ec_linesize) == -1 || OF_GET(pcpu->pc_node, !use_new_prop ? "ecache-associativity" : "l2-cache-associativity", pcpu->pc_cache.ec_assoc) == -1) - panic("cache_init: could not retrieve cache parameters"); + OF_panic("%s: could not retrieve cache parameters", __func__); set = pcpu->pc_cache.ic_size / pcpu->pc_cache.ic_assoc; if ((set & ~(1UL << (ffs(set) - 1))) != 0) - panic("cache_init: I$ set size not a power of 2"); + OF_panic("%s: I$ set size not a power of 2", __func__); if ((pcpu->pc_cache.dc_size & ~(1UL << (ffs(pcpu->pc_cache.dc_size) - 1))) != 0) - panic("cache_init: D$ size not a power of 2"); + OF_panic("%s: D$ size not a power of 2", __func__); /* * For CPUs which don't support unaliasing in hardware ensure that * the data cache doesn't have too many virtual colors. */ if (dcache_color_ignore == 0 && ((pcpu->pc_cache.dc_size / pcpu->pc_cache.dc_assoc) / PAGE_SIZE) != DCACHE_COLORS) - panic("cache_init: too many D$ colors"); + OF_panic("%s: too many D$ colors", __func__); set = pcpu->pc_cache.ec_size / pcpu->pc_cache.ec_assoc; if ((set & ~(1UL << (ffs(set) - 1))) != 0) - panic("cache_init: E$ set size not a power of 2"); + OF_panic("%s: E$ set size not a power of 2", __func__); if (pcpu->pc_impl >= CPU_IMPL_ULTRASPARCIII) { cache_enable = cheetah_cache_enable; @@ -184,5 +184,5 @@ cache_init(struct pcpu *pcpu) tlb_flush_nonlocked = spitfire_tlb_flush_nonlocked; tlb_flush_user = spitfire_tlb_flush_user; } else - panic("cache_init: unknown CPU"); + OF_panic("%s: unknown CPU", __func__); } Modified: stable/9/sys/sparc64/sparc64/clock.c ============================================================================== --- stable/9/sys/sparc64/sparc64/clock.c Wed Feb 1 21:15:27 2012 (r230889) +++ stable/9/sys/sparc64/sparc64/clock.c Wed Feb 1 21:19:52 2012 (r230890) @@ -33,36 +33,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include -void (*delay_func)(int usec); -u_long clock_boot; - void DELAY(int usec) { - - (*delay_func)(usec); -} - -void -delay_boot(int usec) -{ - u_long end; - - if (usec < 0) - return; - - end = rd(tick) + (u_long)usec * clock_boot / 1000000; - while (rd(tick) < end) - cpu_spinwait(); -} - -void -delay_tick(int usec) -{ u_long end; if (usec < 0) Modified: stable/9/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/9/sys/sparc64/sparc64/machdep.c Wed Feb 1 21:15:27 2012 (r230889) +++ stable/9/sys/sparc64/sparc64/machdep.c Wed Feb 1 21:19:52 2012 (r230890) @@ -88,7 +88,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -376,7 +375,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l /* * Parse metadata if present and fetch parameters. Must be before the - * console is inited so cninit gets the right value of boothowto. + * console is inited so cninit() gets the right value of boothowto. */ if (mdp != NULL) { preload_metadata = mdp; @@ -421,37 +420,19 @@ sparc64_init(caddr_t mdp, u_long o1, u_l root = OF_peer(0); pc->pc_node = find_bsp(root, pc->pc_mid, cpu_impl); if (pc->pc_node == 0) - OF_exit(); + OF_panic("%s: cannot find boot CPU node", __func__); if (OF_getprop(pc->pc_node, "clock-frequency", &pc->pc_clock, sizeof(pc->pc_clock)) <= 0) - OF_exit(); - - /* - * Provide a DELAY() that works before PCPU_REG is set. We can't - * set PCPU_REG without also taking over the trap table or the - * firmware will overwrite it. Unfortunately, it's way to early - * to also take over the trap table at this point. - */ - clock_boot = pc->pc_clock; - delay_func = delay_boot; - - /* - * Initialize the console before printing anything. - * NB: the low-level console drivers require a working DELAY() at - * this point. - */ - cninit(); + OF_panic("%s: cannot determine boot CPU clock", __func__); /* * Panic if there is no metadata. Most likely the kernel was booted * directly, instead of through loader(8). */ if (mdp == NULL || kmdp == NULL || end == 0 || - kernel_tlb_slots == 0 || kernel_tlbs == NULL) { - printf("sparc64_init: missing loader metadata.\n" - "This probably means you are not using loader(8).\n"); - panic("sparc64_init"); - } + kernel_tlb_slots == 0 || kernel_tlbs == NULL) + OF_panic("%s: missing loader metadata.\nThis probably means " + "you are not using loader(8).", __func__); /* * Work around the broken loader behavior of not demapping no @@ -461,7 +442,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l for (va = KERNBASE + (kernel_tlb_slots - 1) * PAGE_SIZE_4M; va >= roundup2(end, PAGE_SIZE_4M); va -= PAGE_SIZE_4M) { if (bootverbose) - printf("demapping unused kernel TLB slot " + OF_printf("demapping unused kernel TLB slot " "(va %#lx - %#lx)\n", va, va + PAGE_SIZE_4M - 1); stxa(TLB_DEMAP_VA(va) | TLB_DEMAP_PRIMARY | TLB_DEMAP_PAGE, ASI_DMMU_DEMAP, 0); @@ -479,13 +460,15 @@ sparc64_init(caddr_t mdp, u_long o1, u_l */ if (OF_getprop(pc->pc_node, "#dtlb-entries", &dtlb_slots, sizeof(dtlb_slots)) == -1) - panic("sparc64_init: cannot determine number of dTLB slots"); + OF_panic("%s: cannot determine number of dTLB slots", + __func__); if (OF_getprop(pc->pc_node, "#itlb-entries", &itlb_slots, sizeof(itlb_slots)) == -1) - panic("sparc64_init: cannot determine number of iTLB slots"); + OF_panic("%s: cannot determine number of iTLB slots", + __func__); /* - * Initialize and enable the caches. Note that his may include + * Initialize and enable the caches. Note that this may include * applying workarounds. */ cache_init(pc); @@ -573,9 +556,13 @@ sparc64_init(caddr_t mdp, u_long o1, u_l sun4u_set_traptable(tl0_base); /* - * It's now safe to use the real DELAY(). + * Initialize the console. + * NB: the low-level console drivers require a working DELAY() and + * some compiler optimizations may cause the curthread accesses of + * mutex(9) to be factored out even if the latter aren't actually + * called, both requiring PCPU_REG to be set. */ - delay_func = delay_tick; + cninit(); /* * Initialize the dynamic per-CPU area for the BSP and the message Modified: stable/9/sys/sparc64/sparc64/pmap.c ============================================================================== --- stable/9/sys/sparc64/sparc64/pmap.c Wed Feb 1 21:15:27 2012 (r230889) +++ stable/9/sys/sparc64/sparc64/pmap.c Wed Feb 1 21:19:52 2012 (r230890) @@ -333,16 +333,16 @@ pmap_bootstrap(u_int cpu_impl) * pmap_bootstrap_alloc is called. */ if ((pmem = OF_finddevice("/memory")) == -1) - panic("pmap_bootstrap: finddevice /memory"); + OF_panic("%s: finddevice /memory", __func__); if ((sz = OF_getproplen(pmem, "available")) == -1) - panic("pmap_bootstrap: getproplen /memory/available"); + OF_panic("%s: getproplen /memory/available", __func__); if (sizeof(phys_avail) < sz) - panic("pmap_bootstrap: phys_avail too small"); + OF_panic("%s: phys_avail too small", __func__); if (sizeof(mra) < sz) - panic("pmap_bootstrap: mra too small"); + OF_panic("%s: mra too small", __func__); bzero(mra, sz); if (OF_getprop(pmem, "available", mra, sz) == -1) - panic("pmap_bootstrap: getprop /memory/available"); + OF_panic("%s: getprop /memory/available", __func__); sz /= sizeof(*mra); CTR0(KTR_PMAP, "pmap_bootstrap: physical memory"); qsort(mra, sz, sizeof (*mra), mr_cmp); @@ -414,7 +414,7 @@ pmap_bootstrap(u_int cpu_impl) */ pa = pmap_bootstrap_alloc(tsb_kernel_size, colors); if (pa & PAGE_MASK_4M) - panic("pmap_bootstrap: TSB unaligned\n"); + OF_panic("%s: TSB unaligned", __func__); tsb_kernel_phys = pa; if (tsb_kernel_ldd_phys == 0) { tsb_kernel = @@ -461,7 +461,7 @@ pmap_bootstrap(u_int cpu_impl) #define PATCH_ASI(addr, asi) do { \ if (addr[0] != WR_R_I(IF_F3_RD(addr[0]), 0x0, \ IF_F3_RS1(addr[0]))) \ - panic("%s: patched instructions have changed", \ + OF_panic("%s: patched instructions have changed", \ __func__); \ addr[0] |= EIF_IMM((asi), 13); \ flush(addr); \ @@ -470,7 +470,7 @@ pmap_bootstrap(u_int cpu_impl) #define PATCH_LDD(addr, asi) do { \ if (addr[0] != LDDA_R_I_R(IF_F3_RD(addr[0]), 0x0, \ IF_F3_RS1(addr[0]), IF_F3_RS2(addr[0]))) \ - panic("%s: patched instructions have changed", \ + OF_panic("%s: patched instructions have changed", \ __func__); \ addr[0] |= EIF_F3_IMM_ASI(asi); \ flush(addr); \ @@ -481,7 +481,7 @@ pmap_bootstrap(u_int cpu_impl) addr[1] != OR_R_I_R(IF_F3_RD(addr[1]), 0x0, \ IF_F3_RS1(addr[1])) || \ addr[3] != SETHI(IF_F2_RD(addr[3]), 0x0)) \ - panic("%s: patched instructions have changed", \ + OF_panic("%s: patched instructions have changed", \ __func__); \ addr[0] |= EIF_IMM((val) >> 42, 22); \ addr[1] |= EIF_IMM((val) >> 32, 10); \ @@ -495,7 +495,7 @@ pmap_bootstrap(u_int cpu_impl) if (addr[0] != SETHI(IF_F2_RD(addr[0]), 0x0) || \ addr[1] != OR_R_I_R(IF_F3_RD(addr[1]), 0x0, \ IF_F3_RS1(addr[1]))) \ - panic("%s: patched instructions have changed", \ + OF_panic("%s: patched instructions have changed", \ __func__); \ addr[0] |= EIF_IMM((val) >> 10, 22); \ addr[1] |= EIF_IMM((val), 10); \ @@ -604,14 +604,15 @@ pmap_bootstrap(u_int cpu_impl) * Add the PROM mappings to the kernel TSB. */ if ((vmem = OF_finddevice("/virtual-memory")) == -1) - panic("pmap_bootstrap: finddevice /virtual-memory"); + OF_panic("%s: finddevice /virtual-memory", __func__); if ((sz = OF_getproplen(vmem, "translations")) == -1) - panic("pmap_bootstrap: getproplen translations"); + OF_panic("%s: getproplen translations", __func__); if (sizeof(translations) < sz) - panic("pmap_bootstrap: translations too small"); + OF_panic("%s: translations too small", __func__); bzero(translations, sz); if (OF_getprop(vmem, "translations", translations, sz) == -1) - panic("pmap_bootstrap: getprop /virtual-memory/translations"); + OF_panic("%s: getprop /virtual-memory/translations", + __func__); sz /= sizeof(*translations); translations_size = sz; CTR0(KTR_PMAP, "pmap_bootstrap: translations"); @@ -649,11 +650,11 @@ pmap_bootstrap(u_int cpu_impl) * calls in that situation. */ if ((sz = OF_getproplen(pmem, "reg")) == -1) - panic("pmap_bootstrap: getproplen /memory/reg"); + OF_panic("%s: getproplen /memory/reg", __func__); if (sizeof(sparc64_memreg) < sz) - panic("pmap_bootstrap: sparc64_memreg too small"); + OF_panic("%s: sparc64_memreg too small", __func__); if (OF_getprop(pmem, "reg", sparc64_memreg, sz) == -1) - panic("pmap_bootstrap: getprop /memory/reg"); + OF_panic("%s: getprop /memory/reg", __func__); sparc64_nmemreg = sz / sizeof(*sparc64_memreg); /* @@ -726,7 +727,7 @@ pmap_bootstrap_alloc(vm_size_t size, uin phys_avail[i] += size; return (pa); } - panic("pmap_bootstrap_alloc"); + OF_panic("%s: no suitable region found", __func__); } /* From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:19:54 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA7DA106566B; Wed, 1 Feb 2012 21:19:54 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D73E88FC08; Wed, 1 Feb 2012 21:19:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LJs04005623; Wed, 1 Feb 2012 21:19:54 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LJsEY005616; Wed, 1 Feb 2012 21:19:54 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012119.q11LJsEY005616@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:19: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: r230891 - in stable/8/sys/sparc64: include sparc64 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:19:55 -0000 Author: marius Date: Wed Feb 1 21:19:54 2012 New Revision: 230891 URL: http://svn.freebsd.org/changeset/base/230891 Log: MFC: r230633, r230634 Now that we have a working OF_printf() since r230631 and a OF_panic() helper since r230632 (MFC'ed to stable/8 in r230885 and r230887 respectively), use these for output and panicing during the early cycles and move cninit() until after the static per-CPU data has been set up. This solves a couple of issue regarding the non- availability of the static per-CPU data: - panic() not working and only making things worse when called, - having to supply a special DELAY() implementation to the low-level console drivers, - curthread accesses of mutex(9) usage in low-level console drivers that aren't conditional due to compiler optimizations (basically, this is the problem described in r227537 but in this case for keyboards attached via uart(4)). [1] PR: 164123 [1] Modified: stable/8/sys/sparc64/include/clock.h stable/8/sys/sparc64/sparc64/cache.c stable/8/sys/sparc64/sparc64/clock.c stable/8/sys/sparc64/sparc64/machdep.c 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/e1000/ (props changed) Modified: stable/8/sys/sparc64/include/clock.h ============================================================================== --- stable/8/sys/sparc64/include/clock.h Wed Feb 1 21:19:52 2012 (r230890) +++ stable/8/sys/sparc64/include/clock.h Wed Feb 1 21:19:54 2012 (r230891) @@ -1,27 +1,5 @@ /*- - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * This file is in the public domain. * * $FreeBSD$ */ @@ -29,10 +7,4 @@ #ifndef _MACHINE_CLOCK_H_ #define _MACHINE_CLOCK_H_ -extern void (*delay_func)(int usec); -extern u_long clock_boot; - -void delay_boot(int usec); -void delay_tick(int usec); - #endif /* !_MACHINE_CLOCK_H_ */ Modified: stable/8/sys/sparc64/sparc64/cache.c ============================================================================== --- stable/8/sys/sparc64/sparc64/cache.c Wed Feb 1 21:19:52 2012 (r230890) +++ stable/8/sys/sparc64/sparc64/cache.c Wed Feb 1 21:19:54 2012 (r230891) @@ -142,24 +142,24 @@ cache_init(struct pcpu *pcpu) "l2-cache-line-size", pcpu->pc_cache.ec_linesize) == -1 || OF_GET(pcpu->pc_node, !use_new_prop ? "ecache-associativity" : "l2-cache-associativity", pcpu->pc_cache.ec_assoc) == -1) - panic("cache_init: could not retrieve cache parameters"); + OF_panic("%s: could not retrieve cache parameters", __func__); set = pcpu->pc_cache.ic_size / pcpu->pc_cache.ic_assoc; if ((set & ~(1UL << (ffs(set) - 1))) != 0) - panic("cache_init: I$ set size not a power of 2"); + OF_panic("%s: I$ set size not a power of 2", __func__); if ((pcpu->pc_cache.dc_size & ~(1UL << (ffs(pcpu->pc_cache.dc_size) - 1))) != 0) - panic("cache_init: D$ size not a power of 2"); + OF_panic("%s: D$ size not a power of 2", __func__); /* * For CPUs which don't support unaliasing in hardware ensure that * the data cache doesn't have too many virtual colors. */ if (dcache_color_ignore == 0 && ((pcpu->pc_cache.dc_size / pcpu->pc_cache.dc_assoc) / PAGE_SIZE) != DCACHE_COLORS) - panic("cache_init: too many D$ colors"); + OF_panic("%s: too many D$ colors", __func__); set = pcpu->pc_cache.ec_size / pcpu->pc_cache.ec_assoc; if ((set & ~(1UL << (ffs(set) - 1))) != 0) - panic("cache_init: E$ set size not a power of 2"); + OF_panic("%s: E$ set size not a power of 2", __func__); if (pcpu->pc_impl >= CPU_IMPL_ULTRASPARCIII) { cache_enable = cheetah_cache_enable; @@ -184,5 +184,5 @@ cache_init(struct pcpu *pcpu) tlb_flush_nonlocked = spitfire_tlb_flush_nonlocked; tlb_flush_user = spitfire_tlb_flush_user; } else - panic("cache_init: unknown CPU"); + OF_panic("%s: unknown CPU", __func__); } Modified: stable/8/sys/sparc64/sparc64/clock.c ============================================================================== --- stable/8/sys/sparc64/sparc64/clock.c Wed Feb 1 21:19:52 2012 (r230890) +++ stable/8/sys/sparc64/sparc64/clock.c Wed Feb 1 21:19:54 2012 (r230891) @@ -33,36 +33,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include -void (*delay_func)(int usec); -u_long clock_boot; - void DELAY(int usec) { - - (*delay_func)(usec); -} - -void -delay_boot(int usec) -{ - u_long end; - - if (usec < 0) - return; - - end = rd(tick) + (u_long)usec * clock_boot / 1000000; - while (rd(tick) < end) - cpu_spinwait(); -} - -void -delay_tick(int usec) -{ u_long end; if (usec < 0) Modified: stable/8/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/8/sys/sparc64/sparc64/machdep.c Wed Feb 1 21:19:52 2012 (r230890) +++ stable/8/sys/sparc64/sparc64/machdep.c Wed Feb 1 21:19:54 2012 (r230891) @@ -87,7 +87,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -375,7 +374,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l /* * Parse metadata if present and fetch parameters. Must be before the - * console is inited so cninit gets the right value of boothowto. + * console is inited so cninit() gets the right value of boothowto. */ if (mdp != NULL) { preload_metadata = mdp; @@ -420,37 +419,19 @@ sparc64_init(caddr_t mdp, u_long o1, u_l root = OF_peer(0); pc->pc_node = find_bsp(root, pc->pc_mid, cpu_impl); if (pc->pc_node == 0) - OF_exit(); + OF_panic("%s: cannot find boot CPU node", __func__); if (OF_getprop(pc->pc_node, "clock-frequency", &pc->pc_clock, sizeof(pc->pc_clock)) <= 0) - OF_exit(); - - /* - * Provide a DELAY() that works before PCPU_REG is set. We can't - * set PCPU_REG without also taking over the trap table or the - * firmware will overwrite it. Unfortunately, it's way to early - * to also take over the trap table at this point. - */ - clock_boot = pc->pc_clock; - delay_func = delay_boot; - - /* - * Initialize the console before printing anything. - * NB: the low-level console drivers require a working DELAY() at - * this point. - */ - cninit(); + OF_panic("%s: cannot determine boot CPU clock", __func__); /* * Panic if there is no metadata. Most likely the kernel was booted * directly, instead of through loader(8). */ if (mdp == NULL || kmdp == NULL || end == 0 || - kernel_tlb_slots == 0 || kernel_tlbs == NULL) { - printf("sparc64_init: missing loader metadata.\n" - "This probably means you are not using loader(8).\n"); - panic("sparc64_init"); - } + kernel_tlb_slots == 0 || kernel_tlbs == NULL) + OF_panic("%s: missing loader metadata.\nThis probably means " + "you are not using loader(8).", __func__); /* * Work around the broken loader behavior of not demapping no @@ -460,7 +441,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l for (va = KERNBASE + (kernel_tlb_slots - 1) * PAGE_SIZE_4M; va >= roundup2(end, PAGE_SIZE_4M); va -= PAGE_SIZE_4M) { if (bootverbose) - printf("demapping unused kernel TLB slot " + OF_printf("demapping unused kernel TLB slot " "(va %#lx - %#lx)\n", va, va + PAGE_SIZE_4M - 1); stxa(TLB_DEMAP_VA(va) | TLB_DEMAP_PRIMARY | TLB_DEMAP_PAGE, ASI_DMMU_DEMAP, 0); @@ -478,13 +459,15 @@ sparc64_init(caddr_t mdp, u_long o1, u_l */ if (OF_getprop(pc->pc_node, "#dtlb-entries", &dtlb_slots, sizeof(dtlb_slots)) == -1) - panic("sparc64_init: cannot determine number of dTLB slots"); + OF_panic("%s: cannot determine number of dTLB slots", + __func__); if (OF_getprop(pc->pc_node, "#itlb-entries", &itlb_slots, sizeof(itlb_slots)) == -1) - panic("sparc64_init: cannot determine number of iTLB slots"); + OF_panic("%s: cannot determine number of iTLB slots", + __func__); /* - * Initialize and enable the caches. Note that his may include + * Initialize and enable the caches. Note that this may include * applying workarounds. */ cache_init(pc); @@ -572,9 +555,13 @@ sparc64_init(caddr_t mdp, u_long o1, u_l sun4u_set_traptable(tl0_base); /* - * It's now safe to use the real DELAY(). + * Initialize the console. + * NB: the low-level console drivers require a working DELAY() and + * some compiler optimizations may cause the curthread accesses of + * mutex(9) to be factored out even if the latter aren't actually + * called, both requiring PCPU_REG to be set. */ - delay_func = delay_tick; + cninit(); /* * Initialize the dynamic per-CPU area for the BSP and the message Modified: stable/8/sys/sparc64/sparc64/pmap.c ============================================================================== --- stable/8/sys/sparc64/sparc64/pmap.c Wed Feb 1 21:19:52 2012 (r230890) +++ stable/8/sys/sparc64/sparc64/pmap.c Wed Feb 1 21:19:54 2012 (r230891) @@ -340,16 +340,16 @@ pmap_bootstrap(u_int cpu_impl) * pmap_bootstrap_alloc is called. */ if ((pmem = OF_finddevice("/memory")) == -1) - panic("pmap_bootstrap: finddevice /memory"); + OF_panic("%s: finddevice /memory", __func__); if ((sz = OF_getproplen(pmem, "available")) == -1) - panic("pmap_bootstrap: getproplen /memory/available"); + OF_panic("%s: getproplen /memory/available", __func__); if (sizeof(phys_avail) < sz) - panic("pmap_bootstrap: phys_avail too small"); + OF_panic("%s: phys_avail too small", __func__); if (sizeof(mra) < sz) - panic("pmap_bootstrap: mra too small"); + OF_panic("%s: mra too small", __func__); bzero(mra, sz); if (OF_getprop(pmem, "available", mra, sz) == -1) - panic("pmap_bootstrap: getprop /memory/available"); + OF_panic("%s: getprop /memory/available", __func__); sz /= sizeof(*mra); CTR0(KTR_PMAP, "pmap_bootstrap: physical memory"); qsort(mra, sz, sizeof (*mra), mr_cmp); @@ -421,7 +421,7 @@ pmap_bootstrap(u_int cpu_impl) */ pa = pmap_bootstrap_alloc(tsb_kernel_size, colors); if (pa & PAGE_MASK_4M) - panic("pmap_bootstrap: TSB unaligned\n"); + OF_panic("%s: TSB unaligned", __func__); tsb_kernel_phys = pa; if (tsb_kernel_ldd_phys == 0) { tsb_kernel = @@ -468,7 +468,7 @@ pmap_bootstrap(u_int cpu_impl) #define PATCH_ASI(addr, asi) do { \ if (addr[0] != WR_R_I(IF_F3_RD(addr[0]), 0x0, \ IF_F3_RS1(addr[0]))) \ - panic("%s: patched instructions have changed", \ + OF_panic("%s: patched instructions have changed", \ __func__); \ addr[0] |= EIF_IMM((asi), 13); \ flush(addr); \ @@ -477,7 +477,7 @@ pmap_bootstrap(u_int cpu_impl) #define PATCH_LDD(addr, asi) do { \ if (addr[0] != LDDA_R_I_R(IF_F3_RD(addr[0]), 0x0, \ IF_F3_RS1(addr[0]), IF_F3_RS2(addr[0]))) \ - panic("%s: patched instructions have changed", \ + OF_panic("%s: patched instructions have changed", \ __func__); \ addr[0] |= EIF_F3_IMM_ASI(asi); \ flush(addr); \ @@ -488,7 +488,7 @@ pmap_bootstrap(u_int cpu_impl) addr[1] != OR_R_I_R(IF_F3_RD(addr[1]), 0x0, \ IF_F3_RS1(addr[1])) || \ addr[3] != SETHI(IF_F2_RD(addr[3]), 0x0)) \ - panic("%s: patched instructions have changed", \ + OF_panic("%s: patched instructions have changed", \ __func__); \ addr[0] |= EIF_IMM((val) >> 42, 22); \ addr[1] |= EIF_IMM((val) >> 32, 10); \ @@ -502,7 +502,7 @@ pmap_bootstrap(u_int cpu_impl) if (addr[0] != SETHI(IF_F2_RD(addr[0]), 0x0) || \ addr[1] != OR_R_I_R(IF_F3_RD(addr[1]), 0x0, \ IF_F3_RS1(addr[1]))) \ - panic("%s: patched instructions have changed", \ + OF_panic("%s: patched instructions have changed", \ __func__); \ addr[0] |= EIF_IMM((val) >> 10, 22); \ addr[1] |= EIF_IMM((val), 10); \ @@ -611,14 +611,15 @@ pmap_bootstrap(u_int cpu_impl) * Add the PROM mappings to the kernel TSB. */ if ((vmem = OF_finddevice("/virtual-memory")) == -1) - panic("pmap_bootstrap: finddevice /virtual-memory"); + OF_panic("%s: finddevice /virtual-memory", __func__); if ((sz = OF_getproplen(vmem, "translations")) == -1) - panic("pmap_bootstrap: getproplen translations"); + OF_panic("%s: getproplen translations", __func__); if (sizeof(translations) < sz) - panic("pmap_bootstrap: translations too small"); + OF_panic("%s: translations too small", __func__); bzero(translations, sz); if (OF_getprop(vmem, "translations", translations, sz) == -1) - panic("pmap_bootstrap: getprop /virtual-memory/translations"); + OF_panic("%s: getprop /virtual-memory/translations", + __func__); sz /= sizeof(*translations); translations_size = sz; CTR0(KTR_PMAP, "pmap_bootstrap: translations"); @@ -656,11 +657,11 @@ pmap_bootstrap(u_int cpu_impl) * calls in that situation. */ if ((sz = OF_getproplen(pmem, "reg")) == -1) - panic("pmap_bootstrap: getproplen /memory/reg"); + OF_panic("%s: getproplen /memory/reg", __func__); if (sizeof(sparc64_memreg) < sz) - panic("pmap_bootstrap: sparc64_memreg too small"); + OF_panic("%s: sparc64_memreg too small", __func__); if (OF_getprop(pmem, "reg", sparc64_memreg, sz) == -1) - panic("pmap_bootstrap: getprop /memory/reg"); + OF_panic("%s: getprop /memory/reg", __func__); sparc64_nmemreg = sz / sizeof(*sparc64_memreg); /* @@ -733,7 +734,7 @@ pmap_bootstrap_alloc(vm_size_t size, uin phys_avail[i] += size; return (pa); } - panic("pmap_bootstrap_alloc"); + OF_panic("%s: no suitable region found", __func__); } /* From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:24:04 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C56F1065670; Wed, 1 Feb 2012 21:24:04 +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 1A1D88FC0C; Wed, 1 Feb 2012 21:24:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LO3cW005828; Wed, 1 Feb 2012 21:24:03 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LO3O2005826; Wed, 1 Feb 2012 21:24:03 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012124.q11LO3O2005826@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:24:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230892 - stable/9/sys/sparc64/sparc64 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:24:04 -0000 Author: marius Date: Wed Feb 1 21:24:03 2012 New Revision: 230892 URL: http://svn.freebsd.org/changeset/base/230892 Log: MFC: r230662 Fully disable interrupts while we fiddle with the FP context in the VIS-based block copy/zero implementations. While with 4BSD it's sufficient to just disable the tick interrupts, with ULE+PREEMPTION it's otherwise also possible that these are preempted via IPIs. Modified: stable/9/sys/sparc64/sparc64/support.S Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/sparc64/sparc64/support.S ============================================================================== --- stable/9/sys/sparc64/sparc64/support.S Wed Feb 1 21:19:54 2012 (r230891) +++ stable/9/sys/sparc64/sparc64/support.S Wed Feb 1 21:24:03 2012 (r230892) @@ -580,8 +580,8 @@ fpu_fault_begin: * void spitfire_block_copy(void *src, void *dst, size_t len) */ ENTRY(spitfire_block_copy) - rdpr %pil, %o3 - wrpr %g0, PIL_TICK, %pil + rdpr %pstate, %o3 + wrpr %g0, PSTATE_NORMAL, %pstate wr %g0, ASI_BLK_S, %asi wr %g0, FPRS_FEF, %fprs @@ -603,7 +603,7 @@ ENTRY(spitfire_block_copy) or %o4, PCB_FEF, %o4 stx %o4, [PCB_REG + PCB_FLAGS] -1: wrpr %o3, 0, %pil +1: wrpr %o3, 0, %pstate ldda [%o0] %asi, %f0 add %o0, 64, %o0 @@ -653,8 +653,8 @@ END(spitfire_block_copy) ENTRY(zeus_block_copy) prefetch [%o0 + (0 * 64)], 0 - rdpr %pil, %o3 - wrpr %g0, PIL_TICK, %pil + rdpr %pstate, %o3 + wrpr %g0, PSTATE_NORMAL, %pstate wr %g0, ASI_BLK_S, %asi wr %g0, FPRS_FEF, %fprs @@ -676,7 +676,7 @@ ENTRY(zeus_block_copy) or %o4, PCB_FEF, %o4 stx %o4, [PCB_REG + PCB_FLAGS] -1: wrpr %o3, 0, %pil +1: wrpr %o3, 0, %pstate ldd [%o0 + (0 * 8)], %f0 prefetch [%o0 + (1 * 64)], 0 @@ -764,8 +764,8 @@ END(zeus_block_copy) */ ALTENTRY(zeus_block_zero) ENTRY(spitfire_block_zero) - rdpr %pil, %o3 - wrpr %g0, PIL_TICK, %pil + rdpr %pstate, %o3 + wrpr %g0, PSTATE_NORMAL, %pstate wr %g0, ASI_BLK_S, %asi wr %g0, FPRS_FEF, %fprs @@ -787,7 +787,7 @@ ENTRY(spitfire_block_zero) or %o4, PCB_FEF, %o4 stx %o4, [PCB_REG + PCB_FLAGS] -1: wrpr %o3, 0, %pil +1: wrpr %o3, 0, %pstate fzero %f0 fzero %f2 From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:24:06 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBB41106566B; Wed, 1 Feb 2012 21:24:06 +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 8F71F8FC13; Wed, 1 Feb 2012 21:24:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LO6hp005862; Wed, 1 Feb 2012 21:24:06 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LO6FG005860; Wed, 1 Feb 2012 21:24:06 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012124.q11LO6FG005860@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:24:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230893 - stable/8/sys/sparc64/sparc64 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:24:06 -0000 Author: marius Date: Wed Feb 1 21:24:06 2012 New Revision: 230893 URL: http://svn.freebsd.org/changeset/base/230893 Log: MFC: r230662 Fully disable interrupts while we fiddle with the FP context in the VIS-based block copy/zero implementations. While with 4BSD it's sufficient to just disable the tick interrupts, with ULE+PREEMPTION it's otherwise also possible that these are preempted via IPIs. Modified: stable/8/sys/sparc64/sparc64/support.S Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/sparc64/sparc64/support.S ============================================================================== --- stable/8/sys/sparc64/sparc64/support.S Wed Feb 1 21:24:03 2012 (r230892) +++ stable/8/sys/sparc64/sparc64/support.S Wed Feb 1 21:24:06 2012 (r230893) @@ -580,8 +580,8 @@ fpu_fault_begin: * void spitfire_block_copy(void *src, void *dst, size_t len) */ ENTRY(spitfire_block_copy) - rdpr %pil, %o3 - wrpr %g0, PIL_TICK, %pil + rdpr %pstate, %o3 + wrpr %g0, PSTATE_NORMAL, %pstate wr %g0, ASI_BLK_S, %asi wr %g0, FPRS_FEF, %fprs @@ -603,7 +603,7 @@ ENTRY(spitfire_block_copy) or %o4, PCB_FEF, %o4 stx %o4, [PCB_REG + PCB_FLAGS] -1: wrpr %o3, 0, %pil +1: wrpr %o3, 0, %pstate ldda [%o0] %asi, %f0 add %o0, 64, %o0 @@ -653,8 +653,8 @@ END(spitfire_block_copy) ENTRY(zeus_block_copy) prefetch [%o0 + (0 * 64)], 0 - rdpr %pil, %o3 - wrpr %g0, PIL_TICK, %pil + rdpr %pstate, %o3 + wrpr %g0, PSTATE_NORMAL, %pstate wr %g0, ASI_BLK_S, %asi wr %g0, FPRS_FEF, %fprs @@ -676,7 +676,7 @@ ENTRY(zeus_block_copy) or %o4, PCB_FEF, %o4 stx %o4, [PCB_REG + PCB_FLAGS] -1: wrpr %o3, 0, %pil +1: wrpr %o3, 0, %pstate ldd [%o0 + (0 * 8)], %f0 prefetch [%o0 + (1 * 64)], 0 @@ -764,8 +764,8 @@ END(zeus_block_copy) */ ALTENTRY(zeus_block_zero) ENTRY(spitfire_block_zero) - rdpr %pil, %o3 - wrpr %g0, PIL_TICK, %pil + rdpr %pstate, %o3 + wrpr %g0, PSTATE_NORMAL, %pstate wr %g0, ASI_BLK_S, %asi wr %g0, FPRS_FEF, %fprs @@ -787,7 +787,7 @@ ENTRY(spitfire_block_zero) or %o4, PCB_FEF, %o4 stx %o4, [PCB_REG + PCB_FLAGS] -1: wrpr %o3, 0, %pil +1: wrpr %o3, 0, %pstate fzero %f0 fzero %f2 From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:28:14 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3079E106564A; Wed, 1 Feb 2012 21:28:14 +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 1E1898FC0C; Wed, 1 Feb 2012 21:28:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LSDCp006050; Wed, 1 Feb 2012 21:28:13 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LSD1W006047; Wed, 1 Feb 2012 21:28:13 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012128.q11LSD1W006047@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230894 - stable/9/sys/sparc64/pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:28:14 -0000 Author: marius Date: Wed Feb 1 21:28:13 2012 New Revision: 230894 URL: http://svn.freebsd.org/changeset/base/230894 Log: MFC: r230664 As it turns out r227960 (MFC'ed to stable/9 in r228126) may still be insufficient with PREEMPTION so try harder to get the CDMA sync interrupt delivered and also in a more efficient way: - wrap the whole process of sending and receiving the CDMA sync interrupt in a critical section so we don't get preempted, - send the CDMA sync interrupt to the CPU that is actually waiting for it to happen so we don't take a detour via another CPU, - instead of waiting for up to 15 seconds for the interrupt to trigger try the whole process for up to 15 times using a one second timeout (the code was also changed to just ignore belated interrupts of a previous tries should they appear). According to testing done by Peter Jeremy with the debugging also added as part of this commit the first two changes apparently are sufficient to now properly get the CDMA sync interrupts delivered at the first try though. Modified: stable/9/sys/sparc64/pci/schizo.c stable/9/sys/sparc64/pci/schizovar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/sparc64/pci/schizo.c ============================================================================== --- stable/9/sys/sparc64/pci/schizo.c Wed Feb 1 21:24:06 2012 (r230893) +++ stable/9/sys/sparc64/pci/schizo.c Wed Feb 1 21:28:13 2012 (r230894) @@ -178,6 +178,8 @@ struct schizo_icarg { bus_addr_t sica_clr; }; +#define SCHIZO_CDMA_TIMEOUT 1 /* 1 second per try */ +#define SCHIZO_CDMA_TRIES 15 #define SCHIZO_PERF_CNT_QLTY 100 #define SCHIZO_SPC_BARRIER(spc, sc, offs, len, flags) \ @@ -706,13 +708,15 @@ schizo_attach(device_t dev) i = INTINO(bus_get_resource_start(dev, SYS_RES_IRQ, 4)); if (i == STX_CDMA_A_INO || i == STX_CDMA_B_INO) { - (void)schizo_get_intrmap(sc, i, NULL, - &sc->sc_cdma_clr); + sc->sc_cdma_vec = INTMAP_VEC(sc->sc_ign, i); + (void)schizo_get_intrmap(sc, i, + &sc->sc_cdma_map, &sc->sc_cdma_clr); schizo_set_intr(sc, 4, i, schizo_cdma); } else { i = STX_CDMA_A_INO + sc->sc_half; + sc->sc_cdma_vec = INTMAP_VEC(sc->sc_ign, i); if (bus_set_resource(dev, SYS_RES_IRQ, 5, - INTMAP_VEC(sc->sc_ign, i), 1) != 0) + sc->sc_cdma_vec, 1) != 0) panic("%s: failed to add CDMA " "interrupt", __func__); j = schizo_intr_register(sc, i); @@ -720,8 +724,8 @@ schizo_attach(device_t dev) panic("%s: could not register " "interrupt controller for CDMA " "(%d)", __func__, j); - (void)schizo_get_intrmap(sc, i, NULL, - &sc->sc_cdma_clr); + (void)schizo_get_intrmap(sc, i, + &sc->sc_cdma_map, &sc->sc_cdma_clr); schizo_set_intr(sc, 5, i, schizo_cdma); } } else { @@ -988,7 +992,8 @@ schizo_cdma(void *arg) { struct schizo_softc *sc = arg; - atomic_store_rel_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_RECEIVED); + atomic_cmpset_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_PENDING, + SCHIZO_CDMA_STATE_RECEIVED); return (FILTER_HANDLED); } @@ -1153,7 +1158,10 @@ schizo_dmamap_sync(bus_dma_tag_t dt, bus struct timeval cur, end; struct schizo_iommu_state *sis = dt->dt_cookie; struct schizo_softc *sc = sis->sis_sc; - int res; + int i, res; +#ifdef INVARIANTS + register_t pil; +#endif if ((map->dm_flags & DMF_STREAMED) != 0) { iommu_dma_methods.dm_dmamap_sync(dt, map, op); @@ -1170,20 +1178,36 @@ schizo_dmamap_sync(bus_dma_tag_t dt, bus * but given that these disable interrupts we have to emulate * one. */ + critical_enter(); + KASSERT((rdpr(pstate) & PSTATE_IE) != 0, + ("%s: interrupts disabled", __func__)); + KASSERT((pil = rdpr(pil)) <= PIL_BRIDGE, + ("%s: PIL too low (%ld)", __func__, pil)); for (; atomic_cmpset_acq_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_IDLE, SCHIZO_CDMA_STATE_PENDING) == 0;) ; - SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_clr, INTCLR_RECEIVED); - microuptime(&cur); - end.tv_sec = 15; - end.tv_usec = 0; - timevaladd(&end, &cur); - for (; (res = atomic_cmpset_rel_32(&sc->sc_cdma_state, - SCHIZO_CDMA_STATE_RECEIVED, SCHIZO_CDMA_STATE_IDLE)) == - 0 && timevalcmp(&cur, &end, <=);) + SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_map, + INTMAP_ENABLE(sc->sc_cdma_vec, PCPU_GET(mid))); + for (i = 0; i < SCHIZO_CDMA_TRIES; i++) { + if (i > 0) + printf("%s: try %d\n", __func__, i); + SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_clr, + INTCLR_RECEIVED); microuptime(&cur); + end.tv_sec = SCHIZO_CDMA_TIMEOUT; + end.tv_usec = 0; + timevaladd(&end, &cur); + for (; (res = atomic_cmpset_rel_32(&sc->sc_cdma_state, + SCHIZO_CDMA_STATE_RECEIVED, + SCHIZO_CDMA_STATE_IDLE)) == 0 && + timevalcmp(&cur, &end, <=);) + microuptime(&cur); + if (res != 0) + break; + } if (res == 0) panic("%s: DMA does not sync", __func__); + critical_exit(); } if ((op & BUS_DMASYNC_PREWRITE) != 0) @@ -1352,7 +1376,7 @@ schizo_alloc_resource(device_t bus, devi panic("%s: XXX: interrupt range", __func__); start = end = INTMAP_VEC(sc->sc_ign, end); return (bus_generic_alloc_resource(bus, child, type, rid, - start, end, count, flags)); + start, end, count, flags)); case SYS_RES_MEMORY: rm = &sc->sc_pci_mem_rman; break; Modified: stable/9/sys/sparc64/pci/schizovar.h ============================================================================== --- stable/9/sys/sparc64/pci/schizovar.h Wed Feb 1 21:24:06 2012 (r230893) +++ stable/9/sys/sparc64/pci/schizovar.h Wed Feb 1 21:28:13 2012 (r230894) @@ -59,7 +59,9 @@ struct schizo_softc { #define SCHIZO_FLAGS_BSWAR (1 << 0) #define SCHIZO_FLAGS_XMODE (1 << 1) + bus_addr_t sc_cdma_map; bus_addr_t sc_cdma_clr; + uint32_t sc_cdma_vec; uint32_t sc_cdma_state; #define SCHIZO_CDMA_STATE_IDLE (1 << 0) #define SCHIZO_CDMA_STATE_PENDING (1 << 1) From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:28:17 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 179811065677; Wed, 1 Feb 2012 21:28:17 +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 052928FC18; Wed, 1 Feb 2012 21:28:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LSGoD006089; Wed, 1 Feb 2012 21:28:16 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LSGAi006086; Wed, 1 Feb 2012 21:28:16 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012128.q11LSGAi006086@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:28:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230895 - stable/8/sys/sparc64/pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:28:17 -0000 Author: marius Date: Wed Feb 1 21:28:16 2012 New Revision: 230895 URL: http://svn.freebsd.org/changeset/base/230895 Log: MFC: r230664 As it turns out r227960 (MFC'ed to stable/8 in r228145) may still be insufficient with PREEMPTION so try harder to get the CDMA sync interrupt delivered and also in a more efficient way: - wrap the whole process of sending and receiving the CDMA sync interrupt in a critical section so we don't get preempted, - send the CDMA sync interrupt to the CPU that is actually waiting for it to happen so we don't take a detour via another CPU, - instead of waiting for up to 15 seconds for the interrupt to trigger try the whole process for up to 15 times using a one second timeout (the code was also changed to just ignore belated interrupts of a previous tries should they appear). According to testing done by Peter Jeremy with the debugging also added as part of this commit the first two changes apparently are sufficient to now properly get the CDMA sync interrupts delivered at the first try though. Modified: stable/8/sys/sparc64/pci/schizo.c stable/8/sys/sparc64/pci/schizovar.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/e1000/ (props changed) Modified: stable/8/sys/sparc64/pci/schizo.c ============================================================================== --- stable/8/sys/sparc64/pci/schizo.c Wed Feb 1 21:28:13 2012 (r230894) +++ stable/8/sys/sparc64/pci/schizo.c Wed Feb 1 21:28:16 2012 (r230895) @@ -178,6 +178,8 @@ struct schizo_icarg { bus_addr_t sica_clr; }; +#define SCHIZO_CDMA_TIMEOUT 1 /* 1 second per try */ +#define SCHIZO_CDMA_TRIES 15 #define SCHIZO_PERF_CNT_QLTY 100 #define SCHIZO_SPC_BARRIER(spc, sc, offs, len, flags) \ @@ -706,13 +708,15 @@ schizo_attach(device_t dev) i = INTINO(bus_get_resource_start(dev, SYS_RES_IRQ, 4)); if (i == STX_CDMA_A_INO || i == STX_CDMA_B_INO) { - (void)schizo_get_intrmap(sc, i, NULL, - &sc->sc_cdma_clr); + sc->sc_cdma_vec = INTMAP_VEC(sc->sc_ign, i); + (void)schizo_get_intrmap(sc, i, + &sc->sc_cdma_map, &sc->sc_cdma_clr); schizo_set_intr(sc, 4, i, schizo_cdma); } else { i = STX_CDMA_A_INO + sc->sc_half; + sc->sc_cdma_vec = INTMAP_VEC(sc->sc_ign, i); if (bus_set_resource(dev, SYS_RES_IRQ, 5, - INTMAP_VEC(sc->sc_ign, i), 1) != 0) + sc->sc_cdma_vec, 1) != 0) panic("%s: failed to add CDMA " "interrupt", __func__); j = schizo_intr_register(sc, i); @@ -720,8 +724,8 @@ schizo_attach(device_t dev) panic("%s: could not register " "interrupt controller for CDMA " "(%d)", __func__, j); - (void)schizo_get_intrmap(sc, i, NULL, - &sc->sc_cdma_clr); + (void)schizo_get_intrmap(sc, i, + &sc->sc_cdma_map, &sc->sc_cdma_clr); schizo_set_intr(sc, 5, i, schizo_cdma); } } else { @@ -988,7 +992,8 @@ schizo_cdma(void *arg) { struct schizo_softc *sc = arg; - atomic_store_rel_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_RECEIVED); + atomic_cmpset_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_PENDING, + SCHIZO_CDMA_STATE_RECEIVED); return (FILTER_HANDLED); } @@ -1153,7 +1158,10 @@ schizo_dmamap_sync(bus_dma_tag_t dt, bus struct timeval cur, end; struct schizo_iommu_state *sis = dt->dt_cookie; struct schizo_softc *sc = sis->sis_sc; - int res; + int i, res; +#ifdef INVARIANTS + register_t pil; +#endif if ((map->dm_flags & DMF_STREAMED) != 0) { iommu_dma_methods.dm_dmamap_sync(dt, map, op); @@ -1170,20 +1178,36 @@ schizo_dmamap_sync(bus_dma_tag_t dt, bus * but given that these disable interrupts we have to emulate * one. */ + critical_enter(); + KASSERT((rdpr(pstate) & PSTATE_IE) != 0, + ("%s: interrupts disabled", __func__)); + KASSERT((pil = rdpr(pil)) <= PIL_BRIDGE, + ("%s: PIL too low (%ld)", __func__, pil)); for (; atomic_cmpset_acq_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_IDLE, SCHIZO_CDMA_STATE_PENDING) == 0;) ; - SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_clr, INTCLR_RECEIVED); - microuptime(&cur); - end.tv_sec = 15; - end.tv_usec = 0; - timevaladd(&end, &cur); - for (; (res = atomic_cmpset_rel_32(&sc->sc_cdma_state, - SCHIZO_CDMA_STATE_RECEIVED, SCHIZO_CDMA_STATE_IDLE)) == - 0 && timevalcmp(&cur, &end, <=);) + SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_map, + INTMAP_ENABLE(sc->sc_cdma_vec, PCPU_GET(mid))); + for (i = 0; i < SCHIZO_CDMA_TRIES; i++) { + if (i > 0) + printf("%s: try %d\n", __func__, i); + SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_clr, + INTCLR_RECEIVED); microuptime(&cur); + end.tv_sec = SCHIZO_CDMA_TIMEOUT; + end.tv_usec = 0; + timevaladd(&end, &cur); + for (; (res = atomic_cmpset_rel_32(&sc->sc_cdma_state, + SCHIZO_CDMA_STATE_RECEIVED, + SCHIZO_CDMA_STATE_IDLE)) == 0 && + timevalcmp(&cur, &end, <=);) + microuptime(&cur); + if (res != 0) + break; + } if (res == 0) panic("%s: DMA does not sync", __func__); + critical_exit(); } if ((op & BUS_DMASYNC_PREWRITE) != 0) @@ -1352,7 +1376,7 @@ schizo_alloc_resource(device_t bus, devi panic("%s: XXX: interrupt range", __func__); start = end = INTMAP_VEC(sc->sc_ign, end); return (bus_generic_alloc_resource(bus, child, type, rid, - start, end, count, flags)); + start, end, count, flags)); case SYS_RES_MEMORY: rm = &sc->sc_pci_mem_rman; break; Modified: stable/8/sys/sparc64/pci/schizovar.h ============================================================================== --- stable/8/sys/sparc64/pci/schizovar.h Wed Feb 1 21:28:13 2012 (r230894) +++ stable/8/sys/sparc64/pci/schizovar.h Wed Feb 1 21:28:16 2012 (r230895) @@ -59,7 +59,9 @@ struct schizo_softc { #define SCHIZO_FLAGS_BSWAR (1 << 0) #define SCHIZO_FLAGS_XMODE (1 << 1) + bus_addr_t sc_cdma_map; bus_addr_t sc_cdma_clr; + uint32_t sc_cdma_vec; uint32_t sc_cdma_state; #define SCHIZO_CDMA_STATE_IDLE (1 << 0) #define SCHIZO_CDMA_STATE_PENDING (1 << 1) From owner-svn-src-stable@FreeBSD.ORG Wed Feb 1 21:31:46 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAFEC106566B; Wed, 1 Feb 2012 21:31:46 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C0FBE8FC23; Wed, 1 Feb 2012 21:31:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LVkcf006244; Wed, 1 Feb 2012 21:31:46 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LVkK4006242; Wed, 1 Feb 2012 21:31:46 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012131.q11LVkK4006242@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:31:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230896 - stable/9/sys/sparc64/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:31:47 -0000 Author: marius Date: Wed Feb 1 21:31:46 2012 New Revision: 230896 URL: http://svn.freebsd.org/changeset/base/230896 Log: MFC: r227980 Move to SCHED_ULE by default. Since r226057 SCHED_ULE and sparc64 are compatible with each other and since r227539 the last issue seen when using SCHED_ULE is fixed (MFC'ed to stable/9 in r230691 and r227714 respectively). At least on UP and 2-way machines SCHED_4BSD still performs better than SCHED_ULE, however, the optimizations done in r225889 (MFC'ed to stable/9 in r230673) pretty much compensate that so there's at least no net regression. Thanks go to Peter Jeremy for extensive testing. Modified: stable/9/sys/sparc64/conf/GENERIC Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/sparc64/conf/GENERIC ============================================================================== --- stable/9/sys/sparc64/conf/GENERIC Wed Feb 1 21:28:16 2012 (r230895) +++ stable/9/sys/sparc64/conf/GENERIC Wed Feb 1 21:31:46 2012 (r230896) @@ -26,7 +26,7 @@ makeoptions DEBUG=-g # Build kernel wit # Platforms supported # At this time all platforms are supported, as-is. -options SCHED_4BSD # 4BSD scheduler +options SCHED_ULE # ULE scheduler #options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols From owner-svn-src-stable@FreeBSD.ORG Thu Feb 2 06:18:41 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9B121065672; Thu, 2 Feb 2012 06:18:41 +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 A818F8FC15; Thu, 2 Feb 2012 06:18:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q126IfkB022510; Thu, 2 Feb 2012 06:18:41 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q126If8B022508; Thu, 2 Feb 2012 06:18:41 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202020618.q126If8B022508@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 2 Feb 2012 06:18:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230900 - stable/9/sys/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Feb 2012 06:18:41 -0000 Author: kib Date: Thu Feb 2 06:18:41 2012 New Revision: 230900 URL: http://svn.freebsd.org/changeset/base/230900 Log: MFC r230783: Add definition for PT_GNU_RELRO. Modified: stable/9/sys/sys/elf_common.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/sys/elf_common.h ============================================================================== --- stable/9/sys/sys/elf_common.h Thu Feb 2 04:20:33 2012 (r230899) +++ stable/9/sys/sys/elf_common.h Thu Feb 2 06:18:41 2012 (r230900) @@ -328,6 +328,7 @@ typedef struct { #define PT_SUNW_UNWIND 0x6464e550 /* amd64 UNWIND program header */ #define PT_GNU_EH_FRAME 0x6474e550 #define PT_GNU_STACK 0x6474e551 +#define PT_GNU_RELRO 0x6474e552 #define PT_LOSUNW 0x6ffffffa #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ #define PT_SUNWSTACK 0x6ffffffb /* describes the stack segment */ From owner-svn-src-stable@FreeBSD.ORG Thu Feb 2 06:39:33 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA820106564A; Thu, 2 Feb 2012 06:39:33 +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 98FCB8FC16; Thu, 2 Feb 2012 06:39:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q126dXge023178; Thu, 2 Feb 2012 06:39:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q126dXbI023176; Thu, 2 Feb 2012 06:39:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202020639.q126dXbI023176@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 2 Feb 2012 06:39:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230901 - stable/8/sys/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Feb 2012 06:39:33 -0000 Author: kib Date: Thu Feb 2 06:39:33 2012 New Revision: 230901 URL: http://svn.freebsd.org/changeset/base/230901 Log: MFC r230783: Add definition for PT_GNU_RELRO. Modified: stable/8/sys/sys/elf_common.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/sys/elf_common.h ============================================================================== --- stable/8/sys/sys/elf_common.h Thu Feb 2 06:18:41 2012 (r230900) +++ stable/8/sys/sys/elf_common.h Thu Feb 2 06:39:33 2012 (r230901) @@ -326,6 +326,7 @@ typedef struct { #define PT_SUNW_UNWIND 0x6464e550 /* amd64 UNWIND program header */ #define PT_GNU_EH_FRAME 0x6474e550 #define PT_GNU_STACK 0x6474e551 +#define PT_GNU_RELRO 0x6474e552 #define PT_LOSUNW 0x6ffffffa #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ #define PT_SUNWSTACK 0x6ffffffb /* describes the stack segment */ From owner-svn-src-stable@FreeBSD.ORG Thu Feb 2 18:17:50 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 518331065700; Thu, 2 Feb 2012 18:17:50 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 39AD38FC08; Thu, 2 Feb 2012 18:17:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q12IHoFq048438; Thu, 2 Feb 2012 18:17:50 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q12IHoaL048430; Thu, 2 Feb 2012 18:17:50 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201202021817.q12IHoaL048430@svn.freebsd.org> From: Mikolaj Golub Date: Thu, 2 Feb 2012 18:17:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230917 - stable/9/usr.bin/procstat X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Feb 2012 18:17:50 -0000 Author: trociny Date: Thu Feb 2 18:17:49 2012 New Revision: 230917 URL: http://svn.freebsd.org/changeset/base/230917 Log: MFC r227838, r227873, r228025, r228049, r228289, r228447, r230753: r227838, r227873: Add new options, -e and -x, to display process environment variables and ELF auxiliary vectors. r228025, r228049: Make proctstat -x output more readable. This also fixes the issue, spotted by mdf, with values that were printed as decimal and had hex prefixes. Discussed with: kib, rwatson r228289: Don't output a warning if kern.proc.auxv sysctl has returned EPERM. After r228288 this is rather a normal situation. r228447: Make 64-bit procstat output ELF auxiliary vectors for 32-bit processes. Reviewed by: kib r230753: Always return 0 if the sysctl failed. This fixes the bug: when procstat -xa was run and the sysctl for a process returned ESRCH or EPERM, for this process procstat output the result collected for the previous successful process. Added: stable/9/usr.bin/procstat/procstat_auxv.c - copied, changed from r227838, head/usr.bin/procstat/procstat_auxv.c Modified: stable/9/usr.bin/procstat/Makefile stable/9/usr.bin/procstat/procstat.1 stable/9/usr.bin/procstat/procstat.c stable/9/usr.bin/procstat/procstat.h stable/9/usr.bin/procstat/procstat_args.c Directory Properties: stable/9/usr.bin/procstat/ (props changed) Modified: stable/9/usr.bin/procstat/Makefile ============================================================================== --- stable/9/usr.bin/procstat/Makefile Thu Feb 2 17:54:35 2012 (r230916) +++ stable/9/usr.bin/procstat/Makefile Thu Feb 2 18:17:49 2012 (r230917) @@ -4,6 +4,7 @@ PROG= procstat MAN= procstat.1 SRCS= procstat.c \ procstat_args.c \ + procstat_auxv.c \ procstat_basic.c \ procstat_bin.c \ procstat_cred.c \ Modified: stable/9/usr.bin/procstat/procstat.1 ============================================================================== --- stable/9/usr.bin/procstat/procstat.1 Thu Feb 2 17:54:35 2012 (r230916) +++ stable/9/usr.bin/procstat/procstat.1 Thu Feb 2 18:17:49 2012 (r230917) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 7, 2011 +.Dd November 22, 2011 .Dt PROCSTAT 1 .Os .Sh NAME @@ -56,6 +56,8 @@ for printing: Display binary information for the process. .It Fl c Display command line arguments for the process. +.It Fl e +Display environment variables for the process. .It Fl f Display file descriptor information for the process. .It Fl i @@ -73,6 +75,8 @@ Display security credential information Display thread information for the process. .It Fl v Display virtual memory mappings for the process. +.It Fl x +Display ELF auxiliary vector for the process. .El .Pp All options generate output in the format of a table, the first field of Modified: stable/9/usr.bin/procstat/procstat.c ============================================================================== --- stable/9/usr.bin/procstat/procstat.c Thu Feb 2 17:54:35 2012 (r230916) +++ stable/9/usr.bin/procstat/procstat.c Thu Feb 2 18:17:49 2012 (r230917) @@ -39,7 +39,8 @@ #include "procstat.h" -static int aflag, bflag, cflag, fflag, iflag, jflag, kflag, sflag, tflag, vflag; +static int aflag, bflag, cflag, eflag, fflag, iflag, jflag, kflag, sflag, tflag; +static int vflag, xflag; int hflag, nflag, Cflag; static void @@ -47,8 +48,9 @@ usage(void) { fprintf(stderr, "usage: procstat [-h] [-C] [-M core] [-N system] " - "[-w interval] [-b | -c | -f | -i | -j | -k | -s | -t | -v]\n"); - fprintf(stderr, " [-a | pid ...]\n"); + "[-w interval] \n"); + fprintf(stderr, " [-b | -c | -e | -f | -i | -j | -k | " + "-s | -t | -v | -x] [-a | pid ...]\n"); exit(EX_USAGE); } @@ -60,6 +62,8 @@ procstat(struct procstat *prstat, struct procstat_bin(kipp); else if (cflag) procstat_args(kipp); + else if (eflag) + procstat_env(kipp); else if (fflag) procstat_files(prstat, kipp); else if (iflag) @@ -74,6 +78,8 @@ procstat(struct procstat *prstat, struct procstat_threads(kipp); else if (vflag) procstat_vm(kipp); + else if (xflag) + procstat_auxv(kipp); else procstat_basic(kipp); } @@ -117,7 +123,7 @@ main(int argc, char *argv[]) interval = 0; memf = nlistf = NULL; - while ((ch = getopt(argc, argv, "CN:M:abcfijkhstvw:")) != -1) { + while ((ch = getopt(argc, argv, "CN:M:abcefijkhstvw:x")) != -1) { switch (ch) { case 'C': Cflag++; @@ -141,6 +147,10 @@ main(int argc, char *argv[]) cflag++; break; + case 'e': + eflag++; + break; + case 'f': fflag++; break; @@ -186,6 +196,10 @@ main(int argc, char *argv[]) interval = l; break; + case 'x': + xflag++; + break; + case '?': default: usage(); @@ -196,7 +210,8 @@ main(int argc, char *argv[]) argv += optind; /* We require that either 0 or 1 mode flags be set. */ - tmp = bflag + cflag + fflag + (kflag ? 1 : 0) + sflag + tflag + vflag; + tmp = bflag + cflag + eflag + fflag + (kflag ? 1 : 0) + sflag + tflag + + vflag + xflag; if (!(tmp == 0 || tmp == 1)) usage(); Modified: stable/9/usr.bin/procstat/procstat.h ============================================================================== --- stable/9/usr.bin/procstat/procstat.h Thu Feb 2 17:54:35 2012 (r230916) +++ stable/9/usr.bin/procstat/procstat.h Thu Feb 2 18:17:49 2012 (r230917) @@ -35,9 +35,11 @@ struct kinfo_proc; void kinfo_proc_sort(struct kinfo_proc *kipp, int count); void procstat_args(struct kinfo_proc *kipp); +void procstat_auxv(struct kinfo_proc *kipp); void procstat_basic(struct kinfo_proc *kipp); void procstat_bin(struct kinfo_proc *kipp); void procstat_cred(struct kinfo_proc *kipp); +void procstat_env(struct kinfo_proc *kipp); void procstat_files(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_kstack(struct kinfo_proc *kipp, int kflag); void procstat_sigs(struct procstat *prstat, struct kinfo_proc *kipp); Modified: stable/9/usr.bin/procstat/procstat_args.c ============================================================================== --- stable/9/usr.bin/procstat/procstat_args.c Thu Feb 2 17:54:35 2012 (r230916) +++ stable/9/usr.bin/procstat/procstat_args.c Thu Feb 2 18:17:49 2012 (r230917) @@ -42,24 +42,26 @@ static char args[ARG_MAX]; -void -procstat_args(struct kinfo_proc *kipp) +static void +do_args(struct kinfo_proc *kipp, int env) { int error, name[4]; size_t len; char *cp; if (!hflag) - printf("%5s %-16s %-53s\n", "PID", "COMM", "ARGS"); + printf("%5s %-16s %-53s\n", "PID", "COMM", + env ? "ENVIRONMENT" : "ARGS"); name[0] = CTL_KERN; name[1] = KERN_PROC; - name[2] = KERN_PROC_ARGS; + name[2] = env ? KERN_PROC_ENV : KERN_PROC_ARGS; name[3] = kipp->ki_pid; len = sizeof(args); error = sysctl(name, 4, args, &len, NULL, 0); - if (error < 0 && errno != ESRCH) { - warn("sysctl: kern.proc.args: %d", kipp->ki_pid); + if (error < 0 && errno != ESRCH && errno != EPERM) { + warn("sysctl: kern.proc.%s: %d: %d", env ? "env" : "args", + kipp->ki_pid, errno); return; } if (error < 0) @@ -75,3 +77,15 @@ procstat_args(struct kinfo_proc *kipp) printf("%s%s", cp != args ? " " : "", cp); printf("\n"); } + +void +procstat_args(struct kinfo_proc *kipp) +{ + do_args(kipp, 0); +} + +void +procstat_env(struct kinfo_proc *kipp) +{ + do_args(kipp, 1); +} Copied and modified: stable/9/usr.bin/procstat/procstat_auxv.c (from r227838, head/usr.bin/procstat/procstat_auxv.c) ============================================================================== --- head/usr.bin/procstat/procstat_auxv.c Tue Nov 22 20:59:52 2011 (r227838, copy source) +++ stable/9/usr.bin/procstat/procstat_auxv.c Thu Feb 2 18:17:49 2012 (r230917) @@ -27,9 +27,12 @@ */ #include +#include #include #include +#include + #include #include #include @@ -38,140 +41,201 @@ #include #include -#include - #include "procstat.h" -static char auxv[sizeof(Elf_Auxinfo) * 256]; +#define PROC_AUXV_MAX 256 -void -procstat_auxv(struct kinfo_proc *kipp) +static Elf_Auxinfo auxv[PROC_AUXV_MAX]; +static char prefix[256]; + +#if __ELF_WORD_SIZE == 64 +static Elf32_Auxinfo auxv32[PROC_AUXV_MAX]; + +static const char *elf32_sv_names[] = { + "Linux ELF32", + "FreeBSD ELF32", +}; + +static int +is_elf32(pid_t pid) { - Elf_Auxinfo *aux; - int i, error, name[4]; - size_t len; + int error, name[4]; + size_t len, i; + static char sv_name[256]; - if (!hflag) - printf("%5s %-16s %-53s\n", "PID", "COMM", "AUXV"); + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_SV_NAME; + name[3] = pid; + len = sizeof(sv_name); + error = sysctl(name, 4, sv_name, &len, NULL, 0); + if (error != 0 || len == 0) + return (0); + for (i = 0; i < sizeof(elf32_sv_names) / sizeof(*elf32_sv_names); i++) { + if (strncmp(sv_name, elf32_sv_names[i], sizeof(sv_name)) == 0) + return (1); + } + return (0); +} + +static size_t +retrieve_auxv32(pid_t pid) +{ + int name[4]; + size_t len, i; + void *ptr; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_AUXV; + name[3] = pid; + len = sizeof(auxv32); + if (sysctl(name, 4, auxv32, &len, NULL, 0) == -1) { + if (errno != ESRCH && errno != EPERM) + warn("sysctl: kern.proc.auxv: %d: %d", pid, errno); + return (0); + } + for (i = 0; i < len; i++) { + /* + * XXX: We expect that values for a_type on a 32-bit platform + * are directly mapped to those on 64-bit one, which is not + * necessarily true. + */ + auxv[i].a_type = auxv32[i].a_type; + ptr = &auxv32[i].a_un; + auxv[i].a_un.a_val = *((uint32_t *)ptr); + } + return (len); +} +#endif /* __ELF_WORD_SIZE == 64 */ + +#define PRINT(name, spec, val) \ + printf("%s %-16s " #spec "\n", prefix, #name, (val)) +#define PRINT_UNKNOWN(type, val) \ + printf("%s %16ld %#lx\n", prefix, (long)type, (u_long)(val)) +static size_t +retrieve_auxv(pid_t pid) +{ + int name[4]; + size_t len; + +#if __ELF_WORD_SIZE == 64 + if (is_elf32(pid)) + return (retrieve_auxv32(pid)); +#endif name[0] = CTL_KERN; name[1] = KERN_PROC; name[2] = KERN_PROC_AUXV; - name[3] = kipp->ki_pid; + name[3] = pid; len = sizeof(auxv); - error = sysctl(name, 4, auxv, &len, NULL, 0); - if (error < 0 && errno != ESRCH) { - warn("sysctl: kern.proc.auxv: %d: %d", kipp->ki_pid, errno); - return; + if (sysctl(name, 4, auxv, &len, NULL, 0) == -1) { + if (errno != ESRCH && errno != EPERM) + warn("sysctl: kern.proc.auxv: %d: %d", pid, errno); + return (0); } - if (error < 0) - return; - printf("%5d ", kipp->ki_pid); - printf("%-16s", kipp->ki_comm); - if (len == 0) { - printf(" -\n"); + return (len); +} + +void +procstat_auxv(struct kinfo_proc *kipp) +{ + size_t len, i; + + if (!hflag) + printf("%5s %-16s %-16s %-16s\n", "PID", "COMM", "AUXV", "VALUE"); + len = retrieve_auxv(kipp->ki_pid); + if (len == 0) return; - } - for (aux = (Elf_Auxinfo *)auxv, i = 0; i < 256; i++, aux++) { - switch(aux->a_type) { + snprintf(prefix, sizeof(prefix), "%5d %-16s", kipp->ki_pid, + kipp->ki_comm); + for (i = 0; i < len; i++) { + switch(auxv[i].a_type) { case AT_NULL: - printf(" (%d)\n", i + 1); return; case AT_IGNORE: - printf(" AT_IGNORE=0x%lu", - (unsigned long)aux->a_un.a_val); break; case AT_EXECFD: - printf(" AT_EXECFD=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_EXECFD, %ld, (long)auxv[i].a_un.a_val); break; case AT_PHDR: - printf(" AT_PHDR=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_PHDR, %p, auxv[i].a_un.a_ptr); break; case AT_PHENT: - printf(" AT_PHENT=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_PHENT, %ld, (long)auxv[i].a_un.a_val); break; case AT_PHNUM: - printf(" AT_PHNUM=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_PHNUM, %ld, (long)auxv[i].a_un.a_val); break; case AT_PAGESZ: - printf(" AT_PAGESZ=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_PAGESZ, %ld, (long)auxv[i].a_un.a_val); break; case AT_BASE: - printf(" AT_BASE=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_BASE, %p, auxv[i].a_un.a_ptr); break; case AT_FLAGS: - printf(" AT_FLAGS=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_FLAGS, %#lx, (u_long)auxv[i].a_un.a_val); break; case AT_ENTRY: - printf(" AT_ENTRY=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_ENTRY, %p, auxv[i].a_un.a_ptr); break; +#ifdef AT_NOTELF case AT_NOTELF: - printf(" AT_NOTELF=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_NOTELF, %ld, (long)auxv[i].a_un.a_val); break; +#endif +#ifdef AT_UID case AT_UID: - printf(" AT_UID=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_UID, %ld, (long)auxv[i].a_un.a_val); break; +#endif +#ifdef AT_EUID case AT_EUID: - printf(" AT_EUID=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_EUID, %ld, (long)auxv[i].a_un.a_val); break; +#endif +#ifdef AT_GID case AT_GID: - printf(" AT_GID=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_GID, %ld, (long)auxv[i].a_un.a_val); break; +#endif +#ifdef AT_EGID case AT_EGID: - printf(" AT_EGID=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_EGID, %ld, (long)auxv[i].a_un.a_val); break; +#endif case AT_EXECPATH: - printf(" AT_EXECPATH=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_EXECPATH, %p, auxv[i].a_un.a_ptr); break; case AT_CANARY: - printf(" AT_CANARY=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_CANARY, %p, auxv[i].a_un.a_ptr); break; case AT_CANARYLEN: - printf(" AT_CANARYLEN=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_CANARYLEN, %ld, (long)auxv[i].a_un.a_val); break; case AT_OSRELDATE: - printf(" AT_OSRELDATE=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_OSRELDATE, %ld, (long)auxv[i].a_un.a_val); break; case AT_NCPUS: - printf(" AT_NCPUS=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_NCPUS, %ld, (long)auxv[i].a_un.a_val); break; case AT_PAGESIZES: - printf(" AT_PAGESIZES=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_PAGESIZES, %p, auxv[i].a_un.a_ptr); break; case AT_PAGESIZESLEN: - printf(" AT_PAGESIZESLEN=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_PAGESIZESLEN, %ld, (long)auxv[i].a_un.a_val); break; case AT_STACKPROT: - printf(" AT_STACKPROT=0x%lu", - (unsigned long)aux->a_un.a_val); + if ((auxv[i].a_un.a_val & VM_PROT_EXECUTE) != 0) + PRINT(AT_STACKPROT, %s, "NONEXECUTABLE"); + else + PRINT(AT_STACKPROT, %s, "EXECUTABLE"); break; case AT_COUNT: - printf(" AT_COUNT=0x%lu", - (unsigned long)aux->a_un.a_val); + PRINT(AT_COUNT, %ld, (long)auxv[i].a_un.a_val); break; default: - printf(" %ld=0x%lu", (long)aux->a_type, - (unsigned long)aux->a_un.a_val); + PRINT_UNKNOWN(auxv[i].a_type, auxv[i].a_un.a_val); break; } } From owner-svn-src-stable@FreeBSD.ORG Thu Feb 2 18:22:26 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A31A106564A; Thu, 2 Feb 2012 18:22:26 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F17798FC16; Thu, 2 Feb 2012 18:22:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q12IMPUL048728; Thu, 2 Feb 2012 18:22:25 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q12IMPPc048722; Thu, 2 Feb 2012 18:22:25 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201202021822.q12IMPPc048722@svn.freebsd.org> From: Mikolaj Golub Date: Thu, 2 Feb 2012 18:22:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230918 - stable/9/usr.bin/procstat X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Feb 2012 18:22:26 -0000 Author: trociny Date: Thu Feb 2 18:22:25 2012 New Revision: 230918 URL: http://svn.freebsd.org/changeset/base/230918 Log: MFC r227956, r228090, r228446, r230471, r230548: r227956: Add -l flag to display resource limits. PR: bin/161257 Reviewed by: kib r228090: Update SYNOPSIS to include the flags added recently. Spotted by: jhb r228446: Make procstat -l output similar to the output of limits(1). Suggested by: jhb r230471, r230548: Make procstat -l to work with the new version of kern.proc.rlimit. Submitted by: Andrey Zonov Added: stable/9/usr.bin/procstat/procstat_rlimit.c - copied, changed from r227956, head/usr.bin/procstat/procstat_rlimit.c Modified: stable/9/usr.bin/procstat/Makefile stable/9/usr.bin/procstat/procstat.1 stable/9/usr.bin/procstat/procstat.c stable/9/usr.bin/procstat/procstat.h Directory Properties: stable/9/usr.bin/procstat/ (props changed) Modified: stable/9/usr.bin/procstat/Makefile ============================================================================== --- stable/9/usr.bin/procstat/Makefile Thu Feb 2 18:17:49 2012 (r230917) +++ stable/9/usr.bin/procstat/Makefile Thu Feb 2 18:22:25 2012 (r230918) @@ -10,6 +10,7 @@ SRCS= procstat.c \ procstat_cred.c \ procstat_files.c \ procstat_kstack.c \ + procstat_rlimit.c \ procstat_sigs.c \ procstat_threads.c \ procstat_vm.c Modified: stable/9/usr.bin/procstat/procstat.1 ============================================================================== --- stable/9/usr.bin/procstat/procstat.1 Thu Feb 2 18:17:49 2012 (r230917) +++ stable/9/usr.bin/procstat/procstat.1 Thu Feb 2 18:22:25 2012 (r230918) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 22, 2011 +.Dd November 28, 2011 .Dt PROCSTAT 1 .Os .Sh NAME @@ -37,7 +37,7 @@ .Op Fl n .Op Fl C .Op Fl w Ar interval -.Op Fl b | c | f | i | j | k | s | t | v +.Op Fl b | c | e | f | i | j | k | l | s | t | v | x .Op Fl a | Ar pid ... .Sh DESCRIPTION The @@ -69,6 +69,8 @@ Display the stacks of kernel threads in threads currently running on a CPU and threads with stacks swapped to disk. If the flag is repeated, function offsets as well as function names are printed. +.It Fl l +Display resource limits for the process. .It Fl s Display security credential information for the process. .It Fl t Modified: stable/9/usr.bin/procstat/procstat.c ============================================================================== --- stable/9/usr.bin/procstat/procstat.c Thu Feb 2 18:17:49 2012 (r230917) +++ stable/9/usr.bin/procstat/procstat.c Thu Feb 2 18:22:25 2012 (r230918) @@ -39,8 +39,8 @@ #include "procstat.h" -static int aflag, bflag, cflag, eflag, fflag, iflag, jflag, kflag, sflag, tflag; -static int vflag, xflag; +static int aflag, bflag, cflag, eflag, fflag, iflag, jflag, kflag, lflag, sflag; +static int tflag, vflag, xflag; int hflag, nflag, Cflag; static void @@ -50,7 +50,7 @@ usage(void) fprintf(stderr, "usage: procstat [-h] [-C] [-M core] [-N system] " "[-w interval] \n"); fprintf(stderr, " [-b | -c | -e | -f | -i | -j | -k | " - "-s | -t | -v | -x] [-a | pid ...]\n"); + "-l | -s | -t | -v | -x] [-a | pid ...]\n"); exit(EX_USAGE); } @@ -72,6 +72,8 @@ procstat(struct procstat *prstat, struct procstat_threads_sigs(prstat, kipp); else if (kflag) procstat_kstack(kipp, kflag); + else if (lflag) + procstat_rlimit(kipp); else if (sflag) procstat_cred(kipp); else if (tflag) @@ -123,7 +125,7 @@ main(int argc, char *argv[]) interval = 0; memf = nlistf = NULL; - while ((ch = getopt(argc, argv, "CN:M:abcefijkhstvw:x")) != -1) { + while ((ch = getopt(argc, argv, "CN:M:abcefijklhstvw:x")) != -1) { switch (ch) { case 'C': Cflag++; @@ -167,6 +169,10 @@ main(int argc, char *argv[]) kflag++; break; + case 'l': + lflag++; + break; + case 'n': nflag++; break; @@ -210,8 +216,8 @@ main(int argc, char *argv[]) argv += optind; /* We require that either 0 or 1 mode flags be set. */ - tmp = bflag + cflag + eflag + fflag + (kflag ? 1 : 0) + sflag + tflag + - vflag + xflag; + tmp = bflag + cflag + eflag + fflag + (kflag ? 1 : 0) + lflag + sflag + + tflag + vflag + xflag; if (!(tmp == 0 || tmp == 1)) usage(); Modified: stable/9/usr.bin/procstat/procstat.h ============================================================================== --- stable/9/usr.bin/procstat/procstat.h Thu Feb 2 18:17:49 2012 (r230917) +++ stable/9/usr.bin/procstat/procstat.h Thu Feb 2 18:22:25 2012 (r230918) @@ -42,6 +42,7 @@ void procstat_cred(struct kinfo_proc *ki void procstat_env(struct kinfo_proc *kipp); void procstat_files(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_kstack(struct kinfo_proc *kipp, int kflag); +void procstat_rlimit(struct kinfo_proc *kipp); void procstat_sigs(struct procstat *prstat, struct kinfo_proc *kipp); void procstat_threads(struct kinfo_proc *kipp); void procstat_threads_sigs(struct procstat *prstat, struct kinfo_proc *kipp); Copied and modified: stable/9/usr.bin/procstat/procstat_rlimit.c (from r227956, head/usr.bin/procstat/procstat_rlimit.c) ============================================================================== --- head/usr.bin/procstat/procstat_rlimit.c Thu Nov 24 20:54:06 2011 (r227956, copy source) +++ stable/9/usr.bin/procstat/procstat_rlimit.c Thu Feb 2 18:22:25 2012 (r230918) @@ -28,7 +28,6 @@ #include #include -#define _RLIMIT_IDENT #include #include #include @@ -36,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -43,36 +43,77 @@ #include "procstat.h" -static struct rlimit rlimit[RLIM_NLIMITS]; +static struct { + const char *name; + const char *suffix; +} rlimit_param[13] = { + {"cputime", "sec"}, + {"filesize", "B "}, + {"datasize", "B "}, + {"stacksize", "B "}, + {"coredumpsize", "B "}, + {"memoryuse", "B "}, + {"memorylocked", "B "}, + {"maxprocesses", " "}, + {"openfiles", " "}, + {"sbsize", "B "}, + {"vmemoryuse", "B "}, + {"pseudo-terminals", " "}, + {"swapuse", "B "}, +}; + +#if RLIM_NLIMITS > 13 +#error "Resource limits have grown. Add new entries to rlimit_param[]." +#endif + +static +const char *humanize_rlimit(int indx, rlim_t limit) +{ + static char buf[14]; + int scale; + + if (limit == RLIM_INFINITY) + return ("infinity "); + + scale = humanize_number(buf, sizeof(buf) - 1, (int64_t)limit, + rlimit_param[indx].suffix, HN_AUTOSCALE | HN_GETSCALE, HN_DECIMAL); + (void)humanize_number(buf, sizeof(buf) - 1, (int64_t)limit, + rlimit_param[indx].suffix, HN_AUTOSCALE, HN_DECIMAL); + /* Pad with one space if there is no suffix prefix. */ + if (scale == 0) + sprintf(buf + strlen(buf), " "); + return (buf); +} void procstat_rlimit(struct kinfo_proc *kipp) { - int error, i, name[4]; + struct rlimit rlimit; + int error, i, name[5]; size_t len; - if (!hflag) - printf("%5s %-16s %-10s %12s %12s\n", "PID", "COMM", "RLIMIT", - "CURRENT", "MAX"); + if (!hflag) { + printf("%5s %-16s %-16s %16s %16s\n", + "PID", "COMM", "RLIMIT", "SOFT ", "HARD "); + } + len = sizeof(struct rlimit); name[0] = CTL_KERN; name[1] = KERN_PROC; name[2] = KERN_PROC_RLIMIT; name[3] = kipp->ki_pid; - len = sizeof(rlimit); - error = sysctl(name, 4, rlimit, &len, NULL, 0); - if (error < 0 && errno != ESRCH) { - warn("sysctl: kern.proc.rlimit: %d", kipp->ki_pid); - return; - } - if (error < 0 || len != sizeof(rlimit)) - return; - for (i = 0; i < RLIM_NLIMITS; i++) { - printf("%5d %-16s %-10s %12jd %12jd\n", kipp->ki_pid, - kipp->ki_comm, rlimit_ident[i], - rlimit[i].rlim_cur == RLIM_INFINITY ? - -1 : rlimit[i].rlim_cur, - rlimit[i].rlim_max == RLIM_INFINITY ? - -1 : rlimit[i].rlim_max); - } + name[4] = i; + error = sysctl(name, 5, &rlimit, &len, NULL, 0); + if (error < 0 && errno != ESRCH) { + warn("sysctl: kern.proc.rlimit: %d", kipp->ki_pid); + return; + } + if (error < 0 || len != sizeof(struct rlimit)) + return; + + printf("%5d %-16s %-16s ", kipp->ki_pid, kipp->ki_comm, + rlimit_param[i].name); + printf("%16s ", humanize_rlimit(i, rlimit.rlim_cur)); + printf("%16s\n", humanize_rlimit(i, rlimit.rlim_max)); + } } From owner-svn-src-stable@FreeBSD.ORG Thu Feb 2 18:25:12 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C144A106566B; Thu, 2 Feb 2012 18:25:12 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE8A88FC15; Thu, 2 Feb 2012 18:25:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q12IPCHL048858; Thu, 2 Feb 2012 18:25:12 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q12IPCqw048855; Thu, 2 Feb 2012 18:25:12 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201202021825.q12IPCqw048855@svn.freebsd.org> From: Mikolaj Golub Date: Thu, 2 Feb 2012 18:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230919 - stable/9/usr.bin/limits X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Feb 2012 18:25:12 -0000 Author: trociny Date: Thu Feb 2 18:25:12 2012 New Revision: 230919 URL: http://svn.freebsd.org/changeset/base/230919 Log: MFC r230549: Add -P option to allow get and set limits for other processes. Submitted by: Andrey Zonov Modified: stable/9/usr.bin/limits/limits.1 stable/9/usr.bin/limits/limits.c Directory Properties: stable/9/usr.bin/limits/ (props changed) Modified: stable/9/usr.bin/limits/limits.1 ============================================================================== --- stable/9/usr.bin/limits/limits.1 Thu Feb 2 18:22:25 2012 (r230918) +++ stable/9/usr.bin/limits/limits.1 Thu Feb 2 18:25:12 2012 (r230919) @@ -19,7 +19,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 10, 2011 +.Dd January 23, 2011 .Dt LIMITS 1 .Os .Sh NAME @@ -27,7 +27,7 @@ .Nd set or display process resource limits .Sh SYNOPSIS .Nm -.Op Fl C Ar class | Fl U Ar user +.Op Fl C Ar class | Fl P Ar pid | Fl U Ar user .Op Fl SHB .Op Fl ea .Op Fl bcdflmnstuvpw Op Ar val @@ -143,6 +143,9 @@ for the class are used, if it exists, or the .Dq Li root class if the user is a superuser account. +.It Fl P Ar pid +Select or set limits for the process identified by the +.Ar pid . .It Fl S Select display or setting of .Dq soft Modified: stable/9/usr.bin/limits/limits.c ============================================================================== --- stable/9/usr.bin/limits/limits.c Thu Feb 2 18:22:25 2012 (r230918) +++ stable/9/usr.bin/limits/limits.c Thu Feb 2 18:25:12 2012 (r230919) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -249,6 +250,8 @@ static void usage(void); static int getshelltype(void); static void print_limit(rlim_t limit, unsigned divisor, const char *inf, const char *pfx, const char *sfx, const char *which); +static void getrlimit_proc(pid_t pid, int resource, struct rlimit *rlp); +static void setrlimit_proc(pid_t pid, int resource, const struct rlimit *rlp); extern char **environ; static const char rcs_string[] = RCS_STRING; @@ -262,24 +265,24 @@ main(int argc, char *argv[]) int rcswhich, shelltype; int i, num_limits = 0; int ch, doeval = 0, doall = 0; - int rtrn; + int rtrn, setproc; login_cap_t * lc = NULL; enum { ANY=0, SOFT=1, HARD=2, BOTH=3, DISPLAYONLY=4 } type = ANY; enum { RCSUNKNOWN=0, RCSSET=1, RCSSEL=2 } todo = RCSUNKNOWN; int which_limits[RLIM_NLIMITS]; rlim_t set_limits[RLIM_NLIMITS]; struct rlimit limits[RLIM_NLIMITS]; + pid_t pid; /* init resource tables */ for (i = 0; i < RLIM_NLIMITS; i++) { which_limits[i] = 0; /* Don't set/display any */ set_limits[i] = RLIM_INFINITY; - /* Get current resource values */ - getrlimit(i, &limits[i]); } + pid = -1; optarg = NULL; - while ((ch = getopt(argc, argv, ":EeC:U:BSHab:c:d:f:l:m:n:s:t:u:v:p:w:")) != -1) { + while ((ch = getopt(argc, argv, ":EeC:U:BSHP:ab:c:d:f:l:m:n:s:t:u:v:p:w:")) != -1) { switch(ch) { case 'a': doall = 1; @@ -312,6 +315,12 @@ main(int argc, char *argv[]) case 'B': type = SOFT|HARD; break; + case 'P': + if (!isdigit(*optarg) || (pid = atoi(optarg)) < 0) { + warnx("invalid pid `%s'", optarg); + usage(); + } + break; default: case ':': /* Without arg */ if ((p = strchr(rcs_string, optopt)) != NULL) { @@ -335,6 +344,30 @@ main(int argc, char *argv[]) optarg = NULL; } + if (pid != -1) { + if (cls != NULL) { + warnx("-C cannot be used with -P option"); + usage(); + } + if (pwd != NULL) { + warnx("-U cannot be used with -P option"); + usage(); + } + } + + /* Get current resource values */ + setproc = 0; + for (i = 0; i < RLIM_NLIMITS; i++) { + if (pid == -1) { + getrlimit(i, &limits[i]); + } else if (doall || num_limits == 0) { + getrlimit_proc(pid, i, &limits[i]); + } else if (which_limits[i] != 0) { + getrlimit_proc(pid, i, &limits[i]); + setproc = 1; + } + } + /* If user was specified, get class from that */ if (pwd != NULL) lc = login_getpwclass(pwd); @@ -414,6 +447,10 @@ main(int argc, char *argv[]) warnx("-e cannot be used with `cmd' option"); usage(); } + if (pid != -1) { + warnx("-P cannot be used with `cmd' option"); + usage(); + } login_close(lc); @@ -440,6 +477,14 @@ main(int argc, char *argv[]) err(1, "%s", *argv); } + if (setproc) { + for (rcswhich = 0; rcswhich < RLIM_NLIMITS; rcswhich++) { + if (which_limits[rcswhich] != 0) + setrlimit_proc(pid, rcswhich, &limits[rcswhich]); + } + exit(EXIT_SUCCESS); + } + shelltype = doeval ? getshelltype() : SH_NONE; if (type == ANY) /* Default to soft limits */ @@ -493,7 +538,8 @@ static void usage(void) { (void)fprintf(stderr, -"usage: limits [-C class|-U user] [-eaSHBE] [-bcdflmnstuvpw [val]] [[name=val ...] cmd]\n"); + "usage: limits [-C class|-P pid|-U user] [-eaSHBE] " + "[-bcdflmnstuvpw [val]] [[name=val ...] cmd]\n"); exit(EXIT_FAILURE); } @@ -677,3 +723,38 @@ getshelltype(void) return SH_SH; } +static void +getrlimit_proc(pid_t pid, int resource, struct rlimit *rlp) +{ + int error; + int name[5]; + size_t len; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_RLIMIT; + name[3] = pid; + name[4] = resource; + len = sizeof(*rlp); + error = sysctl(name, 5, rlp, &len, NULL, 0); + if (error == -1) + err(EXIT_FAILURE, "sysctl: kern.proc.rlimit: %d", pid); + if (len != sizeof(*rlp)) + errx(EXIT_FAILURE, "sysctl() returns wrong size"); +} + +static void +setrlimit_proc(pid_t pid, int resource, const struct rlimit *rlp) +{ + int error; + int name[5]; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_RLIMIT; + name[3] = pid; + name[4] = resource; + error = sysctl(name, 5, NULL, 0, rlp, sizeof(*rlp)); + if (error == -1) + err(EXIT_FAILURE, "sysctl: kern.proc.rlimit: %d", pid); +} From owner-svn-src-stable@FreeBSD.ORG Thu Feb 2 19:01:42 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6368F1065675; Thu, 2 Feb 2012 19:01:42 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4EFDA8FC12; Thu, 2 Feb 2012 19:01:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q12J1geG050240; Thu, 2 Feb 2012 19:01:42 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q12J1g0t050233; Thu, 2 Feb 2012 19:01:42 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201202021901.q12J1g0t050233@svn.freebsd.org> From: "Kenneth D. Merry" Date: Thu, 2 Feb 2012 19:01:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230920 - in stable/9/sys: conf dev/mps dev/mps/mpi modules/mps X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Feb 2012 19:01:42 -0000 Author: ken Date: Thu Feb 2 19:01:41 2012 New Revision: 230920 URL: http://svn.freebsd.org/changeset/base/230920 Log: MFC 230592: Bring in the LSI-supported version of the mps(4) driver. This involves significant changes to the mps(4) driver, but is not a complete rewrite. Some of the changes in this version of the driver: - Integrated RAID (IR) support. - Support for WarpDrive controllers. - Support for SCSI protection information (EEDP). - Support for TLR (Transport Level Retries), needed for tape drives. - Improved error recovery code. - ioctl interface compatible with LSI utilities. mps.4: Update the mps(4) driver man page somewhat for the driver changes. The list of supported hardware still needs to be updated to reflect the full list of supported cards. conf/files: Add the new driver files. mps/mpi/*: Updated version of the MPI header files, with a BSD style copyright. mps/*: See above for a description of the new driver features. modules/mps/Makefile: Add the new mps(4) driver files. Submitted by: Kashyap Desai Sponsored by: LSI, Spectra Logic Reviewed by: ken Added: stable/9/sys/dev/mps/mps_config.c - copied unchanged from r230592, head/sys/dev/mps/mps_config.c stable/9/sys/dev/mps/mps_mapping.c - copied unchanged from r230592, head/sys/dev/mps/mps_mapping.c stable/9/sys/dev/mps/mps_mapping.h - copied unchanged from r230592, head/sys/dev/mps/mps_mapping.h stable/9/sys/dev/mps/mps_sas.h - copied unchanged from r230592, head/sys/dev/mps/mps_sas.h stable/9/sys/dev/mps/mps_sas_lsi.c - copied unchanged from r230592, head/sys/dev/mps/mps_sas_lsi.c Modified: stable/9/sys/conf/files stable/9/sys/dev/mps/mpi/mpi2.h stable/9/sys/dev/mps/mpi/mpi2_cnfg.h stable/9/sys/dev/mps/mpi/mpi2_hbd.h stable/9/sys/dev/mps/mpi/mpi2_history.txt stable/9/sys/dev/mps/mpi/mpi2_init.h stable/9/sys/dev/mps/mpi/mpi2_ioc.h stable/9/sys/dev/mps/mpi/mpi2_ra.h stable/9/sys/dev/mps/mpi/mpi2_raid.h stable/9/sys/dev/mps/mpi/mpi2_sas.h stable/9/sys/dev/mps/mpi/mpi2_targ.h stable/9/sys/dev/mps/mpi/mpi2_tool.h stable/9/sys/dev/mps/mpi/mpi2_type.h stable/9/sys/dev/mps/mps.c stable/9/sys/dev/mps/mps_ioctl.h stable/9/sys/dev/mps/mps_pci.c stable/9/sys/dev/mps/mps_sas.c stable/9/sys/dev/mps/mps_table.c stable/9/sys/dev/mps/mps_user.c stable/9/sys/dev/mps/mpsvar.h stable/9/sys/modules/mps/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Thu Feb 2 18:25:12 2012 (r230919) +++ stable/9/sys/conf/files Thu Feb 2 19:01:41 2012 (r230920) @@ -1463,8 +1463,11 @@ dev/mmc/mmcbus_if.m standard dev/mmc/mmcsd.c optional mmcsd dev/mn/if_mn.c optional mn pci dev/mps/mps.c optional mps +dev/mps/mps_config.c optional mps +dev/mps/mps_mapping.c optional mps dev/mps/mps_pci.c optional mps pci dev/mps/mps_sas.c optional mps +dev/mps/mps_sas_lsi.c optional mps dev/mps/mps_table.c optional mps dev/mps/mps_user.c optional mps dev/mpt/mpt.c optional mpt Modified: stable/9/sys/dev/mps/mpi/mpi2.h ============================================================================== --- stable/9/sys/dev/mps/mpi/mpi2.h Thu Feb 2 18:25:12 2012 (r230919) +++ stable/9/sys/dev/mps/mpi/mpi2.h Thu Feb 2 19:01:41 2012 (r230920) @@ -1,6 +1,35 @@ -/* $FreeBSD$ */ +/*- + * Copyright (c) 2011 LSI Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * LSI MPT-Fusion Host Adapter FreeBSD + * + * $FreeBSD$ + */ + /* - * Copyright (c) 2000-2009 LSI Corporation. + * Copyright (c) 2000-2011 LSI Corporation. * * * Name: mpi2.h @@ -9,7 +38,7 @@ * scatter/gather formats. * Creation Date: June 21, 2006 * - * mpi2.h Version: 02.00.14 + * mpi2.h Version: 02.00.18 * * Version History * --------------- @@ -58,6 +87,15 @@ * Added MSI-x index mask and shift for Reply Post Host * Index register. * Added function code for Host Based Discovery Action. + * 02-10-10 02.00.15 Bumped MPI2_HEADER_VERSION_UNIT. + * Added define for MPI2_FUNCTION_PWR_MGMT_CONTROL. + * Added defines for product-specific range of message + * function codes, 0xF0 to 0xFF. + * 05-12-10 02.00.16 Bumped MPI2_HEADER_VERSION_UNIT. + * Added alternative defines for the SGE Direction bit. + * 08-11-10 02.00.17 Bumped MPI2_HEADER_VERSION_UNIT. + * 11-10-10 02.00.18 Bumped MPI2_HEADER_VERSION_UNIT. + * Added MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR define. * -------------------------------------------------------------------------- */ @@ -83,7 +121,7 @@ #define MPI2_VERSION_02_00 (0x0200) /* versioning for this MPI header set */ -#define MPI2_HEADER_VERSION_UNIT (0x0E) +#define MPI2_HEADER_VERSION_UNIT (0x12) #define MPI2_HEADER_VERSION_DEV (0x00) #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) @@ -476,8 +514,6 @@ typedef union _MPI2_REPLY_DESCRIPTORS_UN /***************************************************************************** * * Message Functions -* 0x80 -> 0x8F reserved for private message use per product -* * *****************************************************************************/ @@ -508,6 +544,9 @@ typedef union _MPI2_REPLY_DESCRIPTORS_UN #define MPI2_FUNCTION_TARGET_CMD_BUF_LIST_POST (0x25) /* Target Command Buffer Post List */ #define MPI2_FUNCTION_RAID_ACCELERATOR (0x2C) /* RAID Accelerator */ #define MPI2_FUNCTION_HOST_BASED_DISCOVERY_ACTION (0x2F) /* Host Based Discovery Action */ +#define MPI2_FUNCTION_PWR_MGMT_CONTROL (0x30) /* Power Management Control */ +#define MPI2_FUNCTION_MIN_PRODUCT_SPECIFIC (0xF0) /* beginning of product-specific range */ +#define MPI2_FUNCTION_MAX_PRODUCT_SPECIFIC (0xFF) /* end of product-specific range */ @@ -922,6 +961,9 @@ typedef struct _MPI2_MPI_SGE_UNION #define MPI2_SGE_FLAGS_IOC_TO_HOST (0x00) #define MPI2_SGE_FLAGS_HOST_TO_IOC (0x04) +#define MPI2_SGE_FLAGS_DEST (MPI2_SGE_FLAGS_IOC_TO_HOST) +#define MPI2_SGE_FLAGS_SOURCE (MPI2_SGE_FLAGS_HOST_TO_IOC) + /* Address Size */ #define MPI2_SGE_FLAGS_32_BIT_ADDRESSING (0x00) @@ -1046,11 +1088,11 @@ typedef struct _MPI2_IEEE_SGE_UNION /* Data Location Address Space */ #define MPI2_IEEE_SGE_FLAGS_ADDR_MASK (0x03) -#define MPI2_IEEE_SGE_FLAGS_SYSTEM_ADDR (0x00) -#define MPI2_IEEE_SGE_FLAGS_IOCDDR_ADDR (0x01) +#define MPI2_IEEE_SGE_FLAGS_SYSTEM_ADDR (0x00) /* IEEE Simple Element only */ +#define MPI2_IEEE_SGE_FLAGS_IOCDDR_ADDR (0x01) /* IEEE Simple Element only */ #define MPI2_IEEE_SGE_FLAGS_IOCPLB_ADDR (0x02) -#define MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR (0x03) - +#define MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR (0x03) /* IEEE Simple Element only */ +#define MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR (0x03) /* IEEE Chain Element only */ /**************************************************************************** * IEEE SGE operation Macros Modified: stable/9/sys/dev/mps/mpi/mpi2_cnfg.h ============================================================================== --- stable/9/sys/dev/mps/mpi/mpi2_cnfg.h Thu Feb 2 18:25:12 2012 (r230919) +++ stable/9/sys/dev/mps/mpi/mpi2_cnfg.h Thu Feb 2 19:01:41 2012 (r230920) @@ -1,13 +1,42 @@ -/* $FreeBSD$ */ +/*- + * Copyright (c) 2011 LSI Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * LSI MPT-Fusion Host Adapter FreeBSD + * + * $FreeBSD$ + */ + /* - * Copyright (c) 2000-2009 LSI Corporation. + * Copyright (c) 2000-2011 LSI Corporation. * * * Name: mpi2_cnfg.h * Title: MPI Configuration messages and pages * Creation Date: November 10, 2006 * - * mpi2_cnfg.h Version: 02.00.13 + * mpi2_cnfg.h Version: 02.00.17 * * Version History * --------------- @@ -110,6 +139,31 @@ * Added Ethernet configuration pages. * 10-28-09 02.00.13 Added MPI2_IOUNITPAGE1_ENABLE_HOST_BASED_DISCOVERY. * Added SAS PHY Page 4 structure and defines. + * 02-10-10 02.00.14 Modified the comments for the configuration page + * structures that contain an array of data. The host + * should use the "count" field in the page data (e.g. the + * NumPhys field) to determine the number of valid elements + * in the array. + * Added/modified some MPI2_MFGPAGE_DEVID_SAS defines. + * Added PowerManagementCapabilities to IO Unit Page 7. + * Added PortWidthModGroup field to + * MPI2_SAS_IO_UNIT5_PHY_PM_SETTINGS. + * Added MPI2_CONFIG_PAGE_SASIOUNIT_6 and related defines. + * Added MPI2_CONFIG_PAGE_SASIOUNIT_7 and related defines. + * Added MPI2_CONFIG_PAGE_SASIOUNIT_8 and related defines. + * 05-12-10 02.00.15 Added MPI2_RAIDVOL0_STATUS_FLAG_VOL_NOT_CONSISTENT + * define. + * Added MPI2_PHYSDISK0_INCOMPATIBLE_MEDIA_TYPE define. + * Added MPI2_SAS_NEG_LINK_RATE_UNSUPPORTED_PHY define. + * 08-11-10 02.00.16 Removed IO Unit Page 1 device path (multi-pathing) + * defines. + * 11-10-10 02.00.17 Added ReceptacleID field (replacing Reserved1) to + * MPI2_MANPAGE7_CONNECTOR_INFO and reworked defines for + * the Pinout field. + * Added BoardTemperature and BoardTemperatureUnits fields + * to MPI2_CONFIG_PAGE_IO_UNIT_7. + * Added MPI2_CONFIG_EXTPAGETYPE_EXT_MANUFACTURING define + * and MPI2_CONFIG_PAGE_EXT_MAN_PS structure. * -------------------------------------------------------------------------- */ @@ -193,6 +247,7 @@ typedef union _MPI2_CONFIG_EXT_PAGE_HEAD #define MPI2_CONFIG_EXTPAGETYPE_DRIVER_MAPPING (0x17) #define MPI2_CONFIG_EXTPAGETYPE_SAS_PORT (0x18) #define MPI2_CONFIG_EXTPAGETYPE_ETHERNET (0x19) +#define MPI2_CONFIG_EXTPAGETYPE_EXT_MANUFACTURING (0x1A) /***************************************************************************** @@ -322,7 +377,7 @@ typedef struct _MPI2_CONFIG_REQUEST #define MPI2_CONFIG_ACTION_PAGE_READ_NVRAM (0x06) #define MPI2_CONFIG_ACTION_PAGE_GET_CHANGEABLE (0x07) -/* values for SGLFlags field are in the SGL section of mpi2.h */ +/* use MPI2_SGLFLAGS_ defines from mpi2.h for the SGLFlags field */ /* Config Reply Message */ @@ -368,14 +423,19 @@ typedef struct _MPI2_CONFIG_REPLY #define MPI2_MFGPAGE_DEVID_SAS2116_1 (0x0064) #define MPI2_MFGPAGE_DEVID_SAS2116_2 (0x0065) +#define MPI2_MFGPAGE_DEVID_SSS6200 (0x007E) + #define MPI2_MFGPAGE_DEVID_SAS2208_1 (0x0080) #define MPI2_MFGPAGE_DEVID_SAS2208_2 (0x0081) #define MPI2_MFGPAGE_DEVID_SAS2208_3 (0x0082) #define MPI2_MFGPAGE_DEVID_SAS2208_4 (0x0083) #define MPI2_MFGPAGE_DEVID_SAS2208_5 (0x0084) #define MPI2_MFGPAGE_DEVID_SAS2208_6 (0x0085) -#define MPI2_MFGPAGE_DEVID_SAS2208_7 (0x0086) -#define MPI2_MFGPAGE_DEVID_SAS2208_8 (0x0087) +#define MPI2_MFGPAGE_DEVID_SAS2308_1 (0x0086) +#define MPI2_MFGPAGE_DEVID_SAS2308_2 (0x0087) +#define MPI2_MFGPAGE_DEVID_SAS2308_3 (0x006E) + + /* Manufacturing Page 0 */ @@ -541,7 +601,7 @@ typedef struct _MPI2_CONFIG_PAGE_MAN_4 /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.PageLength or NumPhys at runtime. + * one and check the value returned for NumPhys at runtime. */ #ifndef MPI2_MAN_PAGE_5_PHY_ENTRIES #define MPI2_MAN_PAGE_5_PHY_ENTRIES (1) @@ -590,23 +650,31 @@ typedef struct _MPI2_MANPAGE7_CONNECTOR_ U32 Pinout; /* 0x00 */ U8 Connector[16]; /* 0x04 */ U8 Location; /* 0x14 */ - U8 Reserved1; /* 0x15 */ + U8 ReceptacleID; /* 0x15 */ U16 Slot; /* 0x16 */ U32 Reserved2; /* 0x18 */ } MPI2_MANPAGE7_CONNECTOR_INFO, MPI2_POINTER PTR_MPI2_MANPAGE7_CONNECTOR_INFO, Mpi2ManPage7ConnectorInfo_t, MPI2_POINTER pMpi2ManPage7ConnectorInfo_t; /* defines for the Pinout field */ -#define MPI2_MANPAGE7_PINOUT_SFF_8484_L4 (0x00080000) -#define MPI2_MANPAGE7_PINOUT_SFF_8484_L3 (0x00040000) -#define MPI2_MANPAGE7_PINOUT_SFF_8484_L2 (0x00020000) -#define MPI2_MANPAGE7_PINOUT_SFF_8484_L1 (0x00010000) -#define MPI2_MANPAGE7_PINOUT_SFF_8470_L4 (0x00000800) -#define MPI2_MANPAGE7_PINOUT_SFF_8470_L3 (0x00000400) -#define MPI2_MANPAGE7_PINOUT_SFF_8470_L2 (0x00000200) -#define MPI2_MANPAGE7_PINOUT_SFF_8470_L1 (0x00000100) -#define MPI2_MANPAGE7_PINOUT_SFF_8482 (0x00000002) -#define MPI2_MANPAGE7_PINOUT_CONNECTION_UNKNOWN (0x00000001) +#define MPI2_MANPAGE7_PINOUT_LANE_MASK (0x0000FF00) +#define MPI2_MANPAGE7_PINOUT_LANE_SHIFT (8) + +#define MPI2_MANPAGE7_PINOUT_TYPE_MASK (0x000000FF) +#define MPI2_MANPAGE7_PINOUT_TYPE_UNKNOWN (0x00) +#define MPI2_MANPAGE7_PINOUT_SATA_SINGLE (0x01) +#define MPI2_MANPAGE7_PINOUT_SFF_8482 (0x02) +#define MPI2_MANPAGE7_PINOUT_SFF_8486 (0x03) +#define MPI2_MANPAGE7_PINOUT_SFF_8484 (0x04) +#define MPI2_MANPAGE7_PINOUT_SFF_8087 (0x05) +#define MPI2_MANPAGE7_PINOUT_SFF_8643_4I (0x06) +#define MPI2_MANPAGE7_PINOUT_SFF_8643_8I (0x07) +#define MPI2_MANPAGE7_PINOUT_SFF_8470 (0x08) +#define MPI2_MANPAGE7_PINOUT_SFF_8088 (0x09) +#define MPI2_MANPAGE7_PINOUT_SFF_8644_4X (0x0A) +#define MPI2_MANPAGE7_PINOUT_SFF_8644_8X (0x0B) +#define MPI2_MANPAGE7_PINOUT_SFF_8644_16X (0x0C) +#define MPI2_MANPAGE7_PINOUT_SFF_8436 (0x0D) /* defines for the Location field */ #define MPI2_MANPAGE7_LOCATION_UNKNOWN (0x01) @@ -619,7 +687,7 @@ typedef struct _MPI2_MANPAGE7_CONNECTOR_ /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check NumPhys at runtime. + * one and check the value returned for NumPhys at runtime. */ #ifndef MPI2_MANPAGE7_CONNECTOR_INFO_MAX #define MPI2_MANPAGE7_CONNECTOR_INFO_MAX (1) @@ -640,7 +708,7 @@ typedef struct _MPI2_CONFIG_PAGE_MAN_7 MPI2_POINTER PTR_MPI2_CONFIG_PAGE_MAN_7, Mpi2ManufacturingPage7_t, MPI2_POINTER pMpi2ManufacturingPage7_t; -#define MPI2_MANUFACTURING7_PAGEVERSION (0x00) +#define MPI2_MANUFACTURING7_PAGEVERSION (0x01) /* defines for the Flags field */ #define MPI2_MANPAGE7_FLAG_USE_SLOT_INFO (0x00000001) @@ -717,6 +785,7 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT /* IO Unit Page 1 Flags defines */ #define MPI2_IOUNITPAGE1_ENABLE_HOST_BASED_DISCOVERY (0x00000800) #define MPI2_IOUNITPAGE1_MASK_SATA_WRITE_CACHE (0x00000600) +#define MPI2_IOUNITPAGE1_SATA_WRITE_CACHE_SHIFT (9) #define MPI2_IOUNITPAGE1_ENABLE_SATA_WRITE_CACHE (0x00000000) #define MPI2_IOUNITPAGE1_DISABLE_SATA_WRITE_CACHE (0x00000200) #define MPI2_IOUNITPAGE1_UNCHANGED_SATA_WRITE_CACHE (0x00000400) @@ -724,15 +793,13 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT #define MPI2_IOUNITPAGE1_DISABLE_IR (0x00000040) #define MPI2_IOUNITPAGE1_DISABLE_TASK_SET_FULL_HANDLING (0x00000020) #define MPI2_IOUNITPAGE1_IR_USE_STATIC_VOLUME_ID (0x00000004) -#define MPI2_IOUNITPAGE1_MULTI_PATHING (0x00000002) -#define MPI2_IOUNITPAGE1_SINGLE_PATHING (0x00000000) /* IO Unit Page 3 */ /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.PageLength at runtime. + * one and check the value returned for GPIOCount at runtime. */ #ifndef MPI2_IO_UNIT_PAGE_3_GPIO_VAL_MAX #define MPI2_IO_UNIT_PAGE_3_GPIO_VAL_MAX (1) @@ -761,7 +828,7 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT /* * Upper layer code (drivers, utilities, etc.) should leave this define set to - * one and check Header.PageLength or NumDmaEngines at runtime. + * one and check the value returned for NumDmaEngines at runtime. */ #ifndef MPI2_IOUNITPAGE5_DMAENGINE_ENTRIES #define MPI2_IOUNITPAGE5_DMAENGINE_ENTRIES (1) @@ -826,15 +893,17 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT U8 PCIeWidth; /* 0x06 */ U8 PCIeSpeed; /* 0x07 */ U32 ProcessorState; /* 0x08 */ - U32 Reserved2; /* 0x0C */ + U32 PowerManagementCapabilities; /* 0x0C */ U16 IOCTemperature; /* 0x10 */ U8 IOCTemperatureUnits; /* 0x12 */ U8 IOCSpeed; /* 0x13 */ - U32 Reserved3; /* 0x14 */ + U16 BoardTemperature; /* 0x14 */ + U8 BoardTemperatureUnits; /* 0x16 */ + U8 Reserved3; /* 0x17 */ } MPI2_CONFIG_PAGE_IO_UNIT_7, MPI2_POINTER PTR_MPI2_CONFIG_PAGE_IO_UNIT_7, Mpi2IOUnitPage7_t, MPI2_POINTER pMpi2IOUnitPage7_t; -#define MPI2_IOUNITPAGE7_PAGEVERSION (0x00) +#define MPI2_IOUNITPAGE7_PAGEVERSION (0x02) /* defines for IO Unit Page 7 PCIeWidth field */ #define MPI2_IOUNITPAGE7_PCIE_WIDTH_X1 (0x01) @@ -855,6 +924,13 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT #define MPI2_IOUNITPAGE7_PSTATE_DISABLED (0x01) #define MPI2_IOUNITPAGE7_PSTATE_ENABLED (0x02) +/* defines for IO Unit Page 7 PowerManagementCapabilities field */ +#define MPI2_IOUNITPAGE7_PMCAP_12_5_PCT_IOCSPEED (0x00000400) +#define MPI2_IOUNITPAGE7_PMCAP_25_0_PCT_IOCSPEED (0x00000200) +#define MPI2_IOUNITPAGE7_PMCAP_50_0_PCT_IOCSPEED (0x00000100) +#define MPI2_IOUNITPAGE7_PMCAP_PCIE_WIDTH_CHANGE (0x00000008) +#define MPI2_IOUNITPAGE7_PMCAP_PCIE_SPEED_CHANGE (0x00000004) + /* defines for IO Unit Page 7 IOCTemperatureUnits field */ #define MPI2_IOUNITPAGE7_IOC_TEMP_NOT_PRESENT (0x00) #define MPI2_IOUNITPAGE7_IOC_TEMP_FAHRENHEIT (0x01) @@ -866,6 +942,11 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT #define MPI2_IOUNITPAGE7_IOC_SPEED_QUARTER (0x04) #define MPI2_IOUNITPAGE7_IOC_SPEED_EIGHTH (0x08) +/* defines for IO Unit Page 7 BoardTemperatureUnits field */ +#define MPI2_IOUNITPAGE7_BOARD_TEMP_NOT_PRESENT (0x00) +#define MPI2_IOUNITPAGE7_BOARD_TEMP_FAHRENHEIT (0x01) +#define MPI2_IOUNITPAGE7_BOARD_TEMP_CELSIUS (0x02) + /**************************************************************************** @@ -1198,7 +1279,7 @@ typedef struct _MPI2_CONFIG_PAGE_BIOS_3 /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.PageLength or NumPhys at runtime. + * one and check the value returned for NumPhys at runtime. */ #ifndef MPI2_BIOS_PAGE_4_PHY_ENTRIES #define MPI2_BIOS_PAGE_4_PHY_ENTRIES (1) @@ -1272,7 +1353,7 @@ typedef struct _MPI2_RAIDVOL0_SETTINGS /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.PageLength at runtime. + * one and check the value returned for NumPhysDisks at runtime. */ #ifndef MPI2_RAID_VOL_PAGE_0_PHYSDISK_MAX #define MPI2_RAID_VOL_PAGE_0_PHYSDISK_MAX (1) @@ -1329,6 +1410,7 @@ typedef struct _MPI2_CONFIG_PAGE_RAID_VO #define MPI2_RAIDVOL0_STATUS_FLAG_CAPACITY_EXPANSION (0x00040000) #define MPI2_RAIDVOL0_STATUS_FLAG_BACKGROUND_INIT (0x00020000) #define MPI2_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS (0x00010000) +#define MPI2_RAIDVOL0_STATUS_FLAG_VOL_NOT_CONSISTENT (0x00000080) #define MPI2_RAIDVOL0_STATUS_FLAG_OCE_ALLOWED (0x00000040) #define MPI2_RAIDVOL0_STATUS_FLAG_BGI_COMPLETE (0x00000020) #define MPI2_RAIDVOL0_STATUS_FLAG_1E_OFFSET_MIRROR (0x00000000) @@ -1451,11 +1533,15 @@ typedef struct _MPI2_CONFIG_PAGE_RD_PDIS #define MPI2_PHYSDISK0_INCOMPATIBLE_MAX_LBA (0x03) #define MPI2_PHYSDISK0_INCOMPATIBLE_SATA_EXTENDED_CMD (0x04) #define MPI2_PHYSDISK0_INCOMPATIBLE_REMOVEABLE_MEDIA (0x05) +#define MPI2_PHYSDISK0_INCOMPATIBLE_MEDIA_TYPE (0x06) #define MPI2_PHYSDISK0_INCOMPATIBLE_UNKNOWN (0xFF) /* PhysDiskAttributes defines */ +#define MPI2_PHYSDISK0_ATTRIB_MEDIA_MASK (0x0C) #define MPI2_PHYSDISK0_ATTRIB_SOLID_STATE_DRIVE (0x08) #define MPI2_PHYSDISK0_ATTRIB_HARD_DISK_DRIVE (0x04) + +#define MPI2_PHYSDISK0_ATTRIB_PROTOCOL_MASK (0x03) #define MPI2_PHYSDISK0_ATTRIB_SAS_PROTOCOL (0x02) #define MPI2_PHYSDISK0_ATTRIB_SATA_PROTOCOL (0x01) @@ -1474,7 +1560,7 @@ typedef struct _MPI2_CONFIG_PAGE_RD_PDIS /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.PageLength or NumPhysDiskPaths at runtime. + * one and check the value returned for NumPhysDiskPaths at runtime. */ #ifndef MPI2_RAID_PHYS_DISK1_PATH_MAX #define MPI2_RAID_PHYS_DISK1_PATH_MAX (1) @@ -1527,6 +1613,7 @@ typedef struct _MPI2_CONFIG_PAGE_RD_PDIS #define MPI2_SAS_NEG_LINK_RATE_SATA_OOB_COMPLETE (0x03) #define MPI2_SAS_NEG_LINK_RATE_PORT_SELECTOR (0x04) #define MPI2_SAS_NEG_LINK_RATE_SMP_RESET_IN_PROGRESS (0x05) +#define MPI2_SAS_NEG_LINK_RATE_UNSUPPORTED_PHY (0x06) #define MPI2_SAS_NEG_LINK_RATE_1_5 (0x08) #define MPI2_SAS_NEG_LINK_RATE_3_0 (0x09) #define MPI2_SAS_NEG_LINK_RATE_6_0 (0x0A) @@ -1553,6 +1640,7 @@ typedef struct _MPI2_CONFIG_PAGE_RD_PDIS #define MPI2_SAS_PHYINFO_PHY_VACANT (0x80000000) #define MPI2_SAS_PHYINFO_PHY_POWER_CONDITION_MASK (0x18000000) +#define MPI2_SAS_PHYINFO_SHIFT_PHY_POWER_CONDITION (27) #define MPI2_SAS_PHYINFO_PHY_POWER_ACTIVE (0x00000000) #define MPI2_SAS_PHYINFO_PHY_POWER_PARTIAL (0x08000000) #define MPI2_SAS_PHYINFO_PHY_POWER_SLUMBER (0x10000000) @@ -1636,7 +1724,7 @@ typedef struct _MPI2_SAS_IO_UNIT0_PHY_DA /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.ExtPageLength or NumPhys at runtime. + * one and check the value returned for NumPhys at runtime. */ #ifndef MPI2_SAS_IOUNIT0_PHY_MAX #define MPI2_SAS_IOUNIT0_PHY_MAX (1) @@ -1707,7 +1795,7 @@ typedef struct _MPI2_SAS_IO_UNIT1_PHY_DA /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.ExtPageLength or NumPhys at runtime. + * one and check the value returned for NumPhys at runtime. */ #ifndef MPI2_SAS_IOUNIT1_PHY_MAX #define MPI2_SAS_IOUNIT1_PHY_MAX (1) @@ -1798,7 +1886,7 @@ typedef struct _MPI2_SAS_IOUNIT4_SPINUP_ /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * four and check Header.ExtPageLength or NumPhys at runtime. + * one and check the value returned for NumPhys at runtime. */ #ifndef MPI2_SAS_IOUNIT4_PHY_MAX #define MPI2_SAS_IOUNIT4_PHY_MAX (4) @@ -1837,7 +1925,7 @@ typedef struct _MPI2_CONFIG_PAGE_SASIOUN typedef struct _MPI2_SAS_IO_UNIT5_PHY_PM_SETTINGS { U8 ControlFlags; /* 0x00 */ - U8 Reserved1; /* 0x01 */ + U8 PortWidthModGroup; /* 0x01 */ U16 InactivityTimerExponent; /* 0x02 */ U8 SATAPartialTimeout; /* 0x04 */ U8 Reserved2; /* 0x05 */ @@ -1857,6 +1945,9 @@ typedef struct _MPI2_SAS_IO_UNIT5_PHY_PM #define MPI2_SASIOUNIT5_CONTROL_SATA_SLUMBER_ENABLE (0x02) #define MPI2_SASIOUNIT5_CONTROL_SATA_PARTIAL_ENABLE (0x01) +/* defines for PortWidthModeGroup field */ +#define MPI2_SASIOUNIT5_PWMG_DISABLE (0xFF) + /* defines for InactivityTimerExponent field */ #define MPI2_SASIOUNIT5_ITE_MASK_SAS_SLUMBER (0x7000) #define MPI2_SASIOUNIT5_ITE_SHIFT_SAS_SLUMBER (12) @@ -1878,7 +1969,7 @@ typedef struct _MPI2_SAS_IO_UNIT5_PHY_PM /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.ExtPageLength or NumPhys at runtime. + * one and check the value returned for NumPhys at runtime. */ #ifndef MPI2_SAS_IOUNIT5_PHY_MAX #define MPI2_SAS_IOUNIT5_PHY_MAX (1) @@ -1896,7 +1987,137 @@ typedef struct _MPI2_CONFIG_PAGE_SASIOUN MPI2_POINTER PTR_MPI2_CONFIG_PAGE_SASIOUNIT_5, Mpi2SasIOUnitPage5_t, MPI2_POINTER pMpi2SasIOUnitPage5_t; -#define MPI2_SASIOUNITPAGE5_PAGEVERSION (0x00) +#define MPI2_SASIOUNITPAGE5_PAGEVERSION (0x01) + + +/* SAS IO Unit Page 6 */ + +typedef struct _MPI2_SAS_IO_UNIT6_PORT_WIDTH_MOD_GROUP_STATUS +{ + U8 CurrentStatus; /* 0x00 */ + U8 CurrentModulation; /* 0x01 */ + U8 CurrentUtilization; /* 0x02 */ + U8 Reserved1; /* 0x03 */ + U32 Reserved2; /* 0x04 */ +} MPI2_SAS_IO_UNIT6_PORT_WIDTH_MOD_GROUP_STATUS, + MPI2_POINTER PTR_MPI2_SAS_IO_UNIT6_PORT_WIDTH_MOD_GROUP_STATUS, + Mpi2SasIOUnit6PortWidthModGroupStatus_t, + MPI2_POINTER pMpi2SasIOUnit6PortWidthModGroupStatus_t; + +/* defines for CurrentStatus field */ +#define MPI2_SASIOUNIT6_STATUS_UNAVAILABLE (0x00) +#define MPI2_SASIOUNIT6_STATUS_UNCONFIGURED (0x01) +#define MPI2_SASIOUNIT6_STATUS_INVALID_CONFIG (0x02) +#define MPI2_SASIOUNIT6_STATUS_LINK_DOWN (0x03) +#define MPI2_SASIOUNIT6_STATUS_OBSERVATION_ONLY (0x04) +#define MPI2_SASIOUNIT6_STATUS_INACTIVE (0x05) +#define MPI2_SASIOUNIT6_STATUS_ACTIVE_IOUNIT (0x06) +#define MPI2_SASIOUNIT6_STATUS_ACTIVE_HOST (0x07) + +/* defines for CurrentModulation field */ +#define MPI2_SASIOUNIT6_MODULATION_25_PERCENT (0x00) +#define MPI2_SASIOUNIT6_MODULATION_50_PERCENT (0x01) +#define MPI2_SASIOUNIT6_MODULATION_75_PERCENT (0x02) +#define MPI2_SASIOUNIT6_MODULATION_100_PERCENT (0x03) + +/* + * Host code (drivers, BIOS, utilities, etc.) should leave this define set to + * one and check the value returned for NumGroups at runtime. + */ +#ifndef MPI2_SAS_IOUNIT6_GROUP_MAX +#define MPI2_SAS_IOUNIT6_GROUP_MAX (1) +#endif + +typedef struct _MPI2_CONFIG_PAGE_SASIOUNIT_6 +{ + MPI2_CONFIG_EXTENDED_PAGE_HEADER Header; /* 0x00 */ + U32 Reserved1; /* 0x08 */ + U32 Reserved2; /* 0x0C */ + U8 NumGroups; /* 0x10 */ + U8 Reserved3; /* 0x11 */ + U16 Reserved4; /* 0x12 */ + MPI2_SAS_IO_UNIT6_PORT_WIDTH_MOD_GROUP_STATUS + PortWidthModulationGroupStatus[MPI2_SAS_IOUNIT6_GROUP_MAX]; /* 0x14 */ +} MPI2_CONFIG_PAGE_SASIOUNIT_6, + MPI2_POINTER PTR_MPI2_CONFIG_PAGE_SASIOUNIT_6, + Mpi2SasIOUnitPage6_t, MPI2_POINTER pMpi2SasIOUnitPage6_t; + +#define MPI2_SASIOUNITPAGE6_PAGEVERSION (0x00) + + +/* SAS IO Unit Page 7 */ + +typedef struct _MPI2_SAS_IO_UNIT7_PORT_WIDTH_MOD_GROUP_SETTINGS +{ + U8 Flags; /* 0x00 */ + U8 Reserved1; /* 0x01 */ + U16 Reserved2; /* 0x02 */ + U8 Threshold75Pct; /* 0x04 */ + U8 Threshold50Pct; /* 0x05 */ + U8 Threshold25Pct; /* 0x06 */ + U8 Reserved3; /* 0x07 */ +} MPI2_SAS_IO_UNIT7_PORT_WIDTH_MOD_GROUP_SETTINGS, + MPI2_POINTER PTR_MPI2_SAS_IO_UNIT7_PORT_WIDTH_MOD_GROUP_SETTINGS, + Mpi2SasIOUnit7PortWidthModGroupSettings_t, + MPI2_POINTER pMpi2SasIOUnit7PortWidthModGroupSettings_t; + +/* defines for Flags field */ +#define MPI2_SASIOUNIT7_FLAGS_ENABLE_PORT_WIDTH_MODULATION (0x01) + + +/* + * Host code (drivers, BIOS, utilities, etc.) should leave this define set to + * one and check the value returned for NumGroups at runtime. + */ +#ifndef MPI2_SAS_IOUNIT7_GROUP_MAX +#define MPI2_SAS_IOUNIT7_GROUP_MAX (1) +#endif + +typedef struct _MPI2_CONFIG_PAGE_SASIOUNIT_7 +{ + MPI2_CONFIG_EXTENDED_PAGE_HEADER Header; /* 0x00 */ + U8 SamplingInterval; /* 0x08 */ + U8 WindowLength; /* 0x09 */ + U16 Reserved1; /* 0x0A */ + U32 Reserved2; /* 0x0C */ + U32 Reserved3; /* 0x10 */ + U8 NumGroups; /* 0x14 */ + U8 Reserved4; /* 0x15 */ + U16 Reserved5; /* 0x16 */ + MPI2_SAS_IO_UNIT7_PORT_WIDTH_MOD_GROUP_SETTINGS + PortWidthModulationGroupSettings[MPI2_SAS_IOUNIT7_GROUP_MAX]; /* 0x18 */ +} MPI2_CONFIG_PAGE_SASIOUNIT_7, + MPI2_POINTER PTR_MPI2_CONFIG_PAGE_SASIOUNIT_7, + Mpi2SasIOUnitPage7_t, MPI2_POINTER pMpi2SasIOUnitPage7_t; + +#define MPI2_SASIOUNITPAGE7_PAGEVERSION (0x00) + + +/* SAS IO Unit Page 8 */ + +typedef struct _MPI2_CONFIG_PAGE_SASIOUNIT_8 +{ + MPI2_CONFIG_EXTENDED_PAGE_HEADER Header; /* 0x00 */ + U32 Reserved1; /* 0x08 */ + U32 PowerManagementCapabilities; /* 0x0C */ + U32 Reserved2; /* 0x10 */ +} MPI2_CONFIG_PAGE_SASIOUNIT_8, + MPI2_POINTER PTR_MPI2_CONFIG_PAGE_SASIOUNIT_8, + Mpi2SasIOUnitPage8_t, MPI2_POINTER pMpi2SasIOUnitPage8_t; + +#define MPI2_SASIOUNITPAGE8_PAGEVERSION (0x00) + +/* defines for PowerManagementCapabilities field */ +#define MPI2_SASIOUNIT8_PM_HOST_PORT_WIDTH_MOD (0x000001000) +#define MPI2_SASIOUNIT8_PM_HOST_SAS_SLUMBER_MODE (0x000000800) +#define MPI2_SASIOUNIT8_PM_HOST_SAS_PARTIAL_MODE (0x000000400) +#define MPI2_SASIOUNIT8_PM_HOST_SATA_SLUMBER_MODE (0x000000200) +#define MPI2_SASIOUNIT8_PM_HOST_SATA_PARTIAL_MODE (0x000000100) +#define MPI2_SASIOUNIT8_PM_IOUNIT_PORT_WIDTH_MOD (0x000000010) +#define MPI2_SASIOUNIT8_PM_IOUNIT_SAS_SLUMBER_MODE (0x000000008) +#define MPI2_SASIOUNIT8_PM_IOUNIT_SAS_PARTIAL_MODE (0x000000004) +#define MPI2_SASIOUNIT8_PM_IOUNIT_SATA_SLUMBER_MODE (0x000000002) +#define MPI2_SASIOUNIT8_PM_IOUNIT_SATA_PARTIAL_MODE (0x000000001) @@ -2187,7 +2408,7 @@ typedef struct _MPI2_SASPHY2_PHY_EVENT /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.ExtPageLength or NumPhyEvents at runtime. + * one and check the value returned for NumPhyEvents at runtime. */ #ifndef MPI2_SASPHY2_PHY_EVENT_MAX #define MPI2_SASPHY2_PHY_EVENT_MAX (1) @@ -2280,7 +2501,7 @@ typedef struct _MPI2_SASPHY3_PHY_EVENT_C /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.ExtPageLength or NumPhyEvents at runtime. + * one and check the value returned for NumPhyEvents at runtime. */ #ifndef MPI2_SASPHY3_PHY_EVENT_MAX #define MPI2_SASPHY3_PHY_EVENT_MAX (1) @@ -2392,7 +2613,7 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_ENC /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.ExtPageLength or NumPhys at runtime. + * one and check the value returned for NumLogEntries at runtime. */ #ifndef MPI2_LOG_0_NUM_LOG_ENTRIES #define MPI2_LOG_0_NUM_LOG_ENTRIES (1) @@ -2442,7 +2663,7 @@ typedef struct _MPI2_CONFIG_PAGE_LOG_0 /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.ExtPageLength or NumPhys at runtime. + * one and check the value returned for NumElements at runtime. */ #ifndef MPI2_RAIDCONFIG0_MAX_ELEMENTS #define MPI2_RAIDCONFIG0_MAX_ELEMENTS (1) @@ -2642,5 +2863,25 @@ typedef struct _MPI2_CONFIG_PAGE_ETHERNE #define MPI2_ETHPG1_MS_DATA_RATE_1GBIT (0x03) +/**************************************************************************** +* Extended Manufacturing Config Pages +****************************************************************************/ + +/* + * Generic structure to use for product-specific extended manufacturing pages + * (currently Extended Manufacturing Page 40 through Extended Manufacturing + * Page 60). + */ + +typedef struct _MPI2_CONFIG_PAGE_EXT_MAN_PS +{ + MPI2_CONFIG_EXTENDED_PAGE_HEADER Header; /* 0x00 */ + U32 ProductSpecificInfo; /* 0x08 */ +} MPI2_CONFIG_PAGE_EXT_MAN_PS, + MPI2_POINTER PTR_MPI2_CONFIG_PAGE_EXT_MAN_PS, + Mpi2ExtManufacturingPagePS_t, MPI2_POINTER pMpi2ExtManufacturingPagePS_t; + +/* PageVersion should be provided by product-specific code */ + #endif Modified: stable/9/sys/dev/mps/mpi/mpi2_hbd.h ============================================================================== --- stable/9/sys/dev/mps/mpi/mpi2_hbd.h Thu Feb 2 18:25:12 2012 (r230919) +++ stable/9/sys/dev/mps/mpi/mpi2_hbd.h Thu Feb 2 19:01:41 2012 (r230920) @@ -1,13 +1,42 @@ -/* $FreeBSD$ */ +/*- + * Copyright (c) 2011 LSI Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * LSI MPT-Fusion Host Adapter FreeBSD + * + * $FreeBSD$ + */ + /* - * Copyright (c) 2009 LSI Corporation. + * Copyright (c) 2009-2011 LSI Corporation. * * * Name: mpi2_hbd.h * Title: MPI Host Based Discovery messages and structures * Creation Date: October 21, 2009 * - * mpi2_hbd.h Version: 02.00.00 + * mpi2_hbd.h Version: 02.00.01 * * Version History * --------------- @@ -15,6 +44,8 @@ * Date Version Description * -------- -------- ------------------------------------------------------ * 10-28-09 02.00.00 Initial version. + * 08-11-10 02.00.01 Removed PortGroups, DmaGroup, and ControlGroup from + * HBD Action request, replaced by AdditionalInfo field. * -------------------------------------------------------------------------- */ @@ -48,10 +79,7 @@ typedef struct _MPI2_HBD_ACTION_REQUEST U8 Port; /* 0x25 */ U8 MaxConnections; /* 0x26 */ U8 MaxRate; /* 0x27 */ - U8 PortGroups; /* 0x28 */ - U8 DmaGroup; /* 0x29 */ - U8 ControlGroup; /* 0x2A */ - U8 Reserved6; /* 0x2B */ + U32 AdditionalInfo; /* 0x28 */ U16 InitialAWT; /* 0x2C */ U16 Reserved7; /* 0x2E */ U32 Reserved8; /* 0x30 */ Modified: stable/9/sys/dev/mps/mpi/mpi2_history.txt ============================================================================== --- stable/9/sys/dev/mps/mpi/mpi2_history.txt Thu Feb 2 18:25:12 2012 (r230919) +++ stable/9/sys/dev/mps/mpi/mpi2_history.txt Thu Feb 2 19:01:41 2012 (r230920) @@ -1,29 +1,58 @@ -/* $FreeBSD$ */ +/*- + * Copyright (c) 2011 LSI Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * LSI MPT-Fusion Host Adapter FreeBSD + * + * $FreeBSD$ + */ + ============================== Fusion-MPT MPI 2.0 Header File Change History ============================== - Copyright (c) 2000-2009 LSI Corporation. + Copyright (c) 2000-2011 LSI Corporation. --------------------------------------- - Header Set Release Version: 02.00.14 - Header Set Release Date: 10-28-09 + Header Set Release Version: 02.00.18 + Header Set Release Date: 11-10-10 --------------------------------------- Filename Current version Prior version ---------- --------------- ------------- - mpi2.h 02.00.14 02.00.13 - mpi2_cnfg.h 02.00.13 02.00.12 - mpi2_init.h 02.00.08 02.00.07 - mpi2_ioc.h 02.00.13 02.00.12 - mpi2_raid.h 02.00.04 02.00.04 - mpi2_sas.h 02.00.03 02.00.02 - mpi2_targ.h 02.00.03 02.00.03 - mpi2_tool.h 02.00.04 02.00.04 + mpi2.h 02.00.18 02.00.17 + mpi2_cnfg.h 02.00.17 02.00.16 + mpi2_init.h 02.00.11 02.00.10 + mpi2_ioc.h 02.00.16 02.00.15 + mpi2_raid.h 02.00.05 02.00.05 + mpi2_sas.h 02.00.05 02.00.05 + mpi2_targ.h 02.00.04 02.00.04 + mpi2_tool.h 02.00.06 02.00.06 mpi2_type.h 02.00.00 02.00.00 mpi2_ra.h 02.00.00 02.00.00 - mpi2_hbd.h 02.00.00 - mpi2_history.txt 02.00.14 02.00.13 + mpi2_hbd.h 02.00.01 02.00.01 + mpi2_history.txt 02.00.18 02.00.17 * Date Version Description @@ -72,6 +101,15 @@ mpi2.h * Added MSI-x index mask and shift for Reply Post Host * Index register. * Added function code for Host Based Discovery Action. + * 02-10-10 02.00.15 Bumped MPI2_HEADER_VERSION_UNIT. + * Added define for MPI2_FUNCTION_PWR_MGMT_CONTROL. + * Added defines for product-specific range of message + * function codes, 0xF0 to 0xFF. + * 05-12-10 02.00.16 Bumped MPI2_HEADER_VERSION_UNIT. + * Added alternative defines for the SGE Direction bit. + * 08-11-10 02.00.17 Bumped MPI2_HEADER_VERSION_UNIT. + * 11-10-10 02.00.18 Bumped MPI2_HEADER_VERSION_UNIT. + * Added MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR define. * -------------------------------------------------------------------------- mpi2_cnfg.h @@ -171,6 +209,31 @@ mpi2_cnfg.h * Added Ethernet configuration pages. * 10-28-09 02.00.13 Added MPI2_IOUNITPAGE1_ENABLE_HOST_BASED_DISCOVERY. * Added SAS PHY Page 4 structure and defines. + * 02-10-10 02.00.14 Modified the comments for the configuration page + * structures that contain an array of data. The host + * should use the "count" field in the page data (e.g. the + * NumPhys field) to determine the number of valid elements + * in the array. + * Added/modified some MPI2_MFGPAGE_DEVID_SAS defines. + * Added PowerManagementCapabilities to IO Unit Page 7. + * Added PortWidthModGroup field to + * MPI2_SAS_IO_UNIT5_PHY_PM_SETTINGS. + * Added MPI2_CONFIG_PAGE_SASIOUNIT_6 and related defines. + * Added MPI2_CONFIG_PAGE_SASIOUNIT_7 and related defines. + * Added MPI2_CONFIG_PAGE_SASIOUNIT_8 and related defines. + * 05-12-10 02.00.15 Added MPI2_RAIDVOL0_STATUS_FLAG_VOL_NOT_CONSISTENT + * define. + * Added MPI2_PHYSDISK0_INCOMPATIBLE_MEDIA_TYPE define. + * Added MPI2_SAS_NEG_LINK_RATE_UNSUPPORTED_PHY define. + * 08-11-10 02.00.16 Removed IO Unit Page 1 device path (multi-pathing) + * defines. + * 11-10-10 02.00.17 Added ReceptacleID field (replacing Reserved1) to + * MPI2_MANPAGE7_CONNECTOR_INFO and reworked defines for + * the Pinout field. + * Added BoardTemperature and BoardTemperatureUnits fields + * to MPI2_CONFIG_PAGE_IO_UNIT_7. + * Added MPI2_CONFIG_EXTPAGETYPE_EXT_MANUFACTURING define + * and MPI2_CONFIG_PAGE_EXT_MAN_PS structure. * -------------------------------------------------------------------------- mpi2_init.h @@ -192,6 +255,9 @@ mpi2_init.h * both SCSI IO Error Reply and SCSI Task Management Reply. * Added ResponseInfo field to MPI2_SCSI_TASK_MANAGE_REPLY. * Added MPI2_SCSITASKMGMT_RSP_TM_OVERLAPPED_TAG define. + * 02-10-10 02.00.09 Removed unused structure that had "#if 0" around it. + * 05-12-10 02.00.10 Added optional vendor-unique region to SCSI IO Request. + * 11-10-10 02.00.11 Added MPI2_SCSIIO_NUM_SGLOFFSETS define. * -------------------------------------------------------------------------- mpi2_ioc.h @@ -280,6 +346,12 @@ mpi2_ioc.h * (MPI2_FW_HEADER_PID_). * Modified values for SAS ProductID Family * (MPI2_FW_HEADER_PID_FAMILY_). + * 02-10-10 02.00.14 Added SAS Quiesce Event structure and defines. + * Added PowerManagementControl Request structures and + * defines. + * 05-12-10 02.00.15 Marked Task Set Full Event as obsolete. + * Added MPI2_EVENT_SAS_TOPO_LR_UNSUPPORTED_PHY define. + * 11-10-10 02.00.16 Added MPI2_FW_DOWNLOAD_ITYPE_MIN_PRODUCT_SPECIFIC. * -------------------------------------------------------------------------- mpi2_raid.h @@ -292,6 +364,7 @@ mpi2_raid.h * can be sized by the build environment. * 07-30-09 02.00.04 Added proper define for the Use Default Settings bit of * VolumeCreationFlags and marked the old one as obsolete. + * 05-12-10 02.00.05 Added MPI2_RAID_VOL_FLAGS_OP_MDC define. * -------------------------------------------------------------------------- mpi2_sas.h @@ -302,6 +375,8 @@ mpi2_sas.h * Request. * 10-28-09 02.00.03 Changed the type of SGL in MPI2_SATA_PASSTHROUGH_REQUEST * to MPI2_SGE_IO_UNION since it supports chained SGLs. + * 05-12-10 02.00.04 Modified some comments. + * 08-11-10 02.00.05 Added NCQ operations to SAS IO Unit Control. * -------------------------------------------------------------------------- mpi2_targ.h @@ -313,6 +388,7 @@ mpi2_targ.h * MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST. * Target Status Send Request only takes a single SGE for * response data. + * 02-10-10 02.00.04 Added comment to MPI2_TARGET_SSP_RSP_IU structure. * -------------------------------------------------------------------------- mpi2_tool.h @@ -325,6 +401,9 @@ mpi2_tool.h * and reply messages. * Added MPI2_DIAG_BUF_TYPE_EXTENDED. * Incremented MPI2_DIAG_BUF_TYPE_COUNT. + * 05-12-10 02.00.05 Added Diagnostic Data Upload tool. + * 08-11-10 02.00.06 Added defines that were missing for Diagnostic Buffer + * Post Request. * -------------------------------------------------------------------------- mpi2_type.h @@ -337,24 +416,40 @@ mpi2_ra.h mpi2_hbd.h * 10-28-09 02.00.00 Initial version. + * 08-11-10 02.00.01 Removed PortGroups, DmaGroup, and ControlGroup from + * HBD Action request, replaced by AdditionalInfo field. * -------------------------------------------------------------------------- mpi2_history.txt Parts list history -Filename 02.00.14 02.00.13 02.00.12 ----------- -------- -------- -------- -mpi2.h 02.00.14 02.00.13 02.00.12 -mpi2_cnfg.h 02.00.13 02.00.12 02.00.11 -mpi2_init.h 02.00.08 02.00.07 02.00.07 -mpi2_ioc.h 02.00.13 02.00.12 02.00.11 -mpi2_raid.h 02.00.04 02.00.04 02.00.03 -mpi2_sas.h 02.00.03 02.00.02 02.00.02 -mpi2_targ.h 02.00.03 02.00.03 02.00.03 -mpi2_tool.h 02.00.04 02.00.04 02.00.03 -mpi2_type.h 02.00.00 02.00.00 02.00.00 -mpi2_ra.h 02.00.00 02.00.00 02.00.00 -mpi2_hbd.h 02.00.00 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Thu Feb 2 19:03:30 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11EB3106564A; Thu, 2 Feb 2012 19:03:30 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F1B2B8FC0C; Thu, 2 Feb 2012 19:03:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q12J3TG5050371; Thu, 2 Feb 2012 19:03:29 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q12J3TSN050364; Thu, 2 Feb 2012 19:03:29 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201202021903.q12J3TSN050364@svn.freebsd.org> From: "Kenneth D. Merry" Date: Thu, 2 Feb 2012 19:03: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: r230922 - in stable/8/sys: conf dev/mps dev/mps/mpi modules/mps X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Feb 2012 19:03:30 -0000 Author: ken Date: Thu Feb 2 19:03:29 2012 New Revision: 230922 URL: http://svn.freebsd.org/changeset/base/230922 Log: MFC 230592: Bring in the LSI-supported version of the mps(4) driver. This involves significant changes to the mps(4) driver, but is not a complete rewrite. Some of the changes in this version of the driver: - Integrated RAID (IR) support. - Support for WarpDrive controllers. - Support for SCSI protection information (EEDP). - Support for TLR (Transport Level Retries), needed for tape drives. - Improved error recovery code. - ioctl interface compatible with LSI utilities. mps.4: Update the mps(4) driver man page somewhat for the driver changes. The list of supported hardware still needs to be updated to reflect the full list of supported cards. conf/files: Add the new driver files. mps/mpi/*: Updated version of the MPI header files, with a BSD style copyright. mps/*: See above for a description of the new driver features. modules/mps/Makefile: Add the new mps(4) driver files. Submitted by: Kashyap Desai Sponsored by: LSI, Spectra Logic Reviewed by: ken Added: stable/8/sys/dev/mps/mps_config.c - copied unchanged from r230592, head/sys/dev/mps/mps_config.c stable/8/sys/dev/mps/mps_mapping.c - copied unchanged from r230592, head/sys/dev/mps/mps_mapping.c stable/8/sys/dev/mps/mps_mapping.h - copied unchanged from r230592, head/sys/dev/mps/mps_mapping.h stable/8/sys/dev/mps/mps_sas.h - copied unchanged from r230592, head/sys/dev/mps/mps_sas.h stable/8/sys/dev/mps/mps_sas_lsi.c - copied unchanged from r230592, head/sys/dev/mps/mps_sas_lsi.c Modified: stable/8/sys/conf/files stable/8/sys/dev/mps/mpi/mpi2.h stable/8/sys/dev/mps/mpi/mpi2_cnfg.h stable/8/sys/dev/mps/mpi/mpi2_hbd.h stable/8/sys/dev/mps/mpi/mpi2_history.txt stable/8/sys/dev/mps/mpi/mpi2_init.h stable/8/sys/dev/mps/mpi/mpi2_ioc.h stable/8/sys/dev/mps/mpi/mpi2_ra.h stable/8/sys/dev/mps/mpi/mpi2_raid.h stable/8/sys/dev/mps/mpi/mpi2_sas.h stable/8/sys/dev/mps/mpi/mpi2_targ.h stable/8/sys/dev/mps/mpi/mpi2_tool.h stable/8/sys/dev/mps/mpi/mpi2_type.h stable/8/sys/dev/mps/mps.c stable/8/sys/dev/mps/mps_ioctl.h stable/8/sys/dev/mps/mps_pci.c stable/8/sys/dev/mps/mps_sas.c stable/8/sys/dev/mps/mps_table.c stable/8/sys/dev/mps/mps_user.c stable/8/sys/dev/mps/mpsvar.h stable/8/sys/modules/mps/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Thu Feb 2 19:02:15 2012 (r230921) +++ stable/8/sys/conf/files Thu Feb 2 19:03:29 2012 (r230922) @@ -1345,8 +1345,11 @@ dev/mmc/mmcbus_if.m standard dev/mmc/mmcsd.c optional mmcsd dev/mn/if_mn.c optional mn pci dev/mps/mps.c optional mps +dev/mps/mps_config.c optional mps +dev/mps/mps_mapping.c optional mps dev/mps/mps_pci.c optional mps pci dev/mps/mps_sas.c optional mps +dev/mps/mps_sas_lsi.c optional mps dev/mps/mps_table.c optional mps dev/mps/mps_user.c optional mps dev/mpt/mpt.c optional mpt Modified: stable/8/sys/dev/mps/mpi/mpi2.h ============================================================================== --- stable/8/sys/dev/mps/mpi/mpi2.h Thu Feb 2 19:02:15 2012 (r230921) +++ stable/8/sys/dev/mps/mpi/mpi2.h Thu Feb 2 19:03:29 2012 (r230922) @@ -1,6 +1,35 @@ -/* $FreeBSD$ */ +/*- + * Copyright (c) 2011 LSI Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * LSI MPT-Fusion Host Adapter FreeBSD + * + * $FreeBSD$ + */ + /* - * Copyright (c) 2000-2009 LSI Corporation. + * Copyright (c) 2000-2011 LSI Corporation. * * * Name: mpi2.h @@ -9,7 +38,7 @@ * scatter/gather formats. * Creation Date: June 21, 2006 * - * mpi2.h Version: 02.00.14 + * mpi2.h Version: 02.00.18 * * Version History * --------------- @@ -58,6 +87,15 @@ * Added MSI-x index mask and shift for Reply Post Host * Index register. * Added function code for Host Based Discovery Action. + * 02-10-10 02.00.15 Bumped MPI2_HEADER_VERSION_UNIT. + * Added define for MPI2_FUNCTION_PWR_MGMT_CONTROL. + * Added defines for product-specific range of message + * function codes, 0xF0 to 0xFF. + * 05-12-10 02.00.16 Bumped MPI2_HEADER_VERSION_UNIT. + * Added alternative defines for the SGE Direction bit. + * 08-11-10 02.00.17 Bumped MPI2_HEADER_VERSION_UNIT. + * 11-10-10 02.00.18 Bumped MPI2_HEADER_VERSION_UNIT. + * Added MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR define. * -------------------------------------------------------------------------- */ @@ -83,7 +121,7 @@ #define MPI2_VERSION_02_00 (0x0200) /* versioning for this MPI header set */ -#define MPI2_HEADER_VERSION_UNIT (0x0E) +#define MPI2_HEADER_VERSION_UNIT (0x12) #define MPI2_HEADER_VERSION_DEV (0x00) #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) @@ -476,8 +514,6 @@ typedef union _MPI2_REPLY_DESCRIPTORS_UN /***************************************************************************** * * Message Functions -* 0x80 -> 0x8F reserved for private message use per product -* * *****************************************************************************/ @@ -508,6 +544,9 @@ typedef union _MPI2_REPLY_DESCRIPTORS_UN #define MPI2_FUNCTION_TARGET_CMD_BUF_LIST_POST (0x25) /* Target Command Buffer Post List */ #define MPI2_FUNCTION_RAID_ACCELERATOR (0x2C) /* RAID Accelerator */ #define MPI2_FUNCTION_HOST_BASED_DISCOVERY_ACTION (0x2F) /* Host Based Discovery Action */ +#define MPI2_FUNCTION_PWR_MGMT_CONTROL (0x30) /* Power Management Control */ +#define MPI2_FUNCTION_MIN_PRODUCT_SPECIFIC (0xF0) /* beginning of product-specific range */ +#define MPI2_FUNCTION_MAX_PRODUCT_SPECIFIC (0xFF) /* end of product-specific range */ @@ -922,6 +961,9 @@ typedef struct _MPI2_MPI_SGE_UNION #define MPI2_SGE_FLAGS_IOC_TO_HOST (0x00) #define MPI2_SGE_FLAGS_HOST_TO_IOC (0x04) +#define MPI2_SGE_FLAGS_DEST (MPI2_SGE_FLAGS_IOC_TO_HOST) +#define MPI2_SGE_FLAGS_SOURCE (MPI2_SGE_FLAGS_HOST_TO_IOC) + /* Address Size */ #define MPI2_SGE_FLAGS_32_BIT_ADDRESSING (0x00) @@ -1046,11 +1088,11 @@ typedef struct _MPI2_IEEE_SGE_UNION /* Data Location Address Space */ #define MPI2_IEEE_SGE_FLAGS_ADDR_MASK (0x03) -#define MPI2_IEEE_SGE_FLAGS_SYSTEM_ADDR (0x00) -#define MPI2_IEEE_SGE_FLAGS_IOCDDR_ADDR (0x01) +#define MPI2_IEEE_SGE_FLAGS_SYSTEM_ADDR (0x00) /* IEEE Simple Element only */ +#define MPI2_IEEE_SGE_FLAGS_IOCDDR_ADDR (0x01) /* IEEE Simple Element only */ #define MPI2_IEEE_SGE_FLAGS_IOCPLB_ADDR (0x02) -#define MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR (0x03) - +#define MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR (0x03) /* IEEE Simple Element only */ +#define MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR (0x03) /* IEEE Chain Element only */ /**************************************************************************** * IEEE SGE operation Macros Modified: stable/8/sys/dev/mps/mpi/mpi2_cnfg.h ============================================================================== --- stable/8/sys/dev/mps/mpi/mpi2_cnfg.h Thu Feb 2 19:02:15 2012 (r230921) +++ stable/8/sys/dev/mps/mpi/mpi2_cnfg.h Thu Feb 2 19:03:29 2012 (r230922) @@ -1,13 +1,42 @@ -/* $FreeBSD$ */ +/*- + * Copyright (c) 2011 LSI Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * LSI MPT-Fusion Host Adapter FreeBSD + * + * $FreeBSD$ + */ + /* - * Copyright (c) 2000-2009 LSI Corporation. + * Copyright (c) 2000-2011 LSI Corporation. * * * Name: mpi2_cnfg.h * Title: MPI Configuration messages and pages * Creation Date: November 10, 2006 * - * mpi2_cnfg.h Version: 02.00.13 + * mpi2_cnfg.h Version: 02.00.17 * * Version History * --------------- @@ -110,6 +139,31 @@ * Added Ethernet configuration pages. * 10-28-09 02.00.13 Added MPI2_IOUNITPAGE1_ENABLE_HOST_BASED_DISCOVERY. * Added SAS PHY Page 4 structure and defines. + * 02-10-10 02.00.14 Modified the comments for the configuration page + * structures that contain an array of data. The host + * should use the "count" field in the page data (e.g. the + * NumPhys field) to determine the number of valid elements + * in the array. + * Added/modified some MPI2_MFGPAGE_DEVID_SAS defines. + * Added PowerManagementCapabilities to IO Unit Page 7. + * Added PortWidthModGroup field to + * MPI2_SAS_IO_UNIT5_PHY_PM_SETTINGS. + * Added MPI2_CONFIG_PAGE_SASIOUNIT_6 and related defines. + * Added MPI2_CONFIG_PAGE_SASIOUNIT_7 and related defines. + * Added MPI2_CONFIG_PAGE_SASIOUNIT_8 and related defines. + * 05-12-10 02.00.15 Added MPI2_RAIDVOL0_STATUS_FLAG_VOL_NOT_CONSISTENT + * define. + * Added MPI2_PHYSDISK0_INCOMPATIBLE_MEDIA_TYPE define. + * Added MPI2_SAS_NEG_LINK_RATE_UNSUPPORTED_PHY define. + * 08-11-10 02.00.16 Removed IO Unit Page 1 device path (multi-pathing) + * defines. + * 11-10-10 02.00.17 Added ReceptacleID field (replacing Reserved1) to + * MPI2_MANPAGE7_CONNECTOR_INFO and reworked defines for + * the Pinout field. + * Added BoardTemperature and BoardTemperatureUnits fields + * to MPI2_CONFIG_PAGE_IO_UNIT_7. + * Added MPI2_CONFIG_EXTPAGETYPE_EXT_MANUFACTURING define + * and MPI2_CONFIG_PAGE_EXT_MAN_PS structure. * -------------------------------------------------------------------------- */ @@ -193,6 +247,7 @@ typedef union _MPI2_CONFIG_EXT_PAGE_HEAD #define MPI2_CONFIG_EXTPAGETYPE_DRIVER_MAPPING (0x17) #define MPI2_CONFIG_EXTPAGETYPE_SAS_PORT (0x18) #define MPI2_CONFIG_EXTPAGETYPE_ETHERNET (0x19) +#define MPI2_CONFIG_EXTPAGETYPE_EXT_MANUFACTURING (0x1A) /***************************************************************************** @@ -322,7 +377,7 @@ typedef struct _MPI2_CONFIG_REQUEST #define MPI2_CONFIG_ACTION_PAGE_READ_NVRAM (0x06) #define MPI2_CONFIG_ACTION_PAGE_GET_CHANGEABLE (0x07) -/* values for SGLFlags field are in the SGL section of mpi2.h */ +/* use MPI2_SGLFLAGS_ defines from mpi2.h for the SGLFlags field */ /* Config Reply Message */ @@ -368,14 +423,19 @@ typedef struct _MPI2_CONFIG_REPLY #define MPI2_MFGPAGE_DEVID_SAS2116_1 (0x0064) #define MPI2_MFGPAGE_DEVID_SAS2116_2 (0x0065) +#define MPI2_MFGPAGE_DEVID_SSS6200 (0x007E) + #define MPI2_MFGPAGE_DEVID_SAS2208_1 (0x0080) #define MPI2_MFGPAGE_DEVID_SAS2208_2 (0x0081) #define MPI2_MFGPAGE_DEVID_SAS2208_3 (0x0082) #define MPI2_MFGPAGE_DEVID_SAS2208_4 (0x0083) #define MPI2_MFGPAGE_DEVID_SAS2208_5 (0x0084) #define MPI2_MFGPAGE_DEVID_SAS2208_6 (0x0085) -#define MPI2_MFGPAGE_DEVID_SAS2208_7 (0x0086) -#define MPI2_MFGPAGE_DEVID_SAS2208_8 (0x0087) +#define MPI2_MFGPAGE_DEVID_SAS2308_1 (0x0086) +#define MPI2_MFGPAGE_DEVID_SAS2308_2 (0x0087) +#define MPI2_MFGPAGE_DEVID_SAS2308_3 (0x006E) + + /* Manufacturing Page 0 */ @@ -541,7 +601,7 @@ typedef struct _MPI2_CONFIG_PAGE_MAN_4 /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.PageLength or NumPhys at runtime. + * one and check the value returned for NumPhys at runtime. */ #ifndef MPI2_MAN_PAGE_5_PHY_ENTRIES #define MPI2_MAN_PAGE_5_PHY_ENTRIES (1) @@ -590,23 +650,31 @@ typedef struct _MPI2_MANPAGE7_CONNECTOR_ U32 Pinout; /* 0x00 */ U8 Connector[16]; /* 0x04 */ U8 Location; /* 0x14 */ - U8 Reserved1; /* 0x15 */ + U8 ReceptacleID; /* 0x15 */ U16 Slot; /* 0x16 */ U32 Reserved2; /* 0x18 */ } MPI2_MANPAGE7_CONNECTOR_INFO, MPI2_POINTER PTR_MPI2_MANPAGE7_CONNECTOR_INFO, Mpi2ManPage7ConnectorInfo_t, MPI2_POINTER pMpi2ManPage7ConnectorInfo_t; /* defines for the Pinout field */ -#define MPI2_MANPAGE7_PINOUT_SFF_8484_L4 (0x00080000) -#define MPI2_MANPAGE7_PINOUT_SFF_8484_L3 (0x00040000) -#define MPI2_MANPAGE7_PINOUT_SFF_8484_L2 (0x00020000) -#define MPI2_MANPAGE7_PINOUT_SFF_8484_L1 (0x00010000) -#define MPI2_MANPAGE7_PINOUT_SFF_8470_L4 (0x00000800) -#define MPI2_MANPAGE7_PINOUT_SFF_8470_L3 (0x00000400) -#define MPI2_MANPAGE7_PINOUT_SFF_8470_L2 (0x00000200) -#define MPI2_MANPAGE7_PINOUT_SFF_8470_L1 (0x00000100) -#define MPI2_MANPAGE7_PINOUT_SFF_8482 (0x00000002) -#define MPI2_MANPAGE7_PINOUT_CONNECTION_UNKNOWN (0x00000001) +#define MPI2_MANPAGE7_PINOUT_LANE_MASK (0x0000FF00) +#define MPI2_MANPAGE7_PINOUT_LANE_SHIFT (8) + +#define MPI2_MANPAGE7_PINOUT_TYPE_MASK (0x000000FF) +#define MPI2_MANPAGE7_PINOUT_TYPE_UNKNOWN (0x00) +#define MPI2_MANPAGE7_PINOUT_SATA_SINGLE (0x01) +#define MPI2_MANPAGE7_PINOUT_SFF_8482 (0x02) +#define MPI2_MANPAGE7_PINOUT_SFF_8486 (0x03) +#define MPI2_MANPAGE7_PINOUT_SFF_8484 (0x04) +#define MPI2_MANPAGE7_PINOUT_SFF_8087 (0x05) +#define MPI2_MANPAGE7_PINOUT_SFF_8643_4I (0x06) +#define MPI2_MANPAGE7_PINOUT_SFF_8643_8I (0x07) +#define MPI2_MANPAGE7_PINOUT_SFF_8470 (0x08) +#define MPI2_MANPAGE7_PINOUT_SFF_8088 (0x09) +#define MPI2_MANPAGE7_PINOUT_SFF_8644_4X (0x0A) +#define MPI2_MANPAGE7_PINOUT_SFF_8644_8X (0x0B) +#define MPI2_MANPAGE7_PINOUT_SFF_8644_16X (0x0C) +#define MPI2_MANPAGE7_PINOUT_SFF_8436 (0x0D) /* defines for the Location field */ #define MPI2_MANPAGE7_LOCATION_UNKNOWN (0x01) @@ -619,7 +687,7 @@ typedef struct _MPI2_MANPAGE7_CONNECTOR_ /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check NumPhys at runtime. + * one and check the value returned for NumPhys at runtime. */ #ifndef MPI2_MANPAGE7_CONNECTOR_INFO_MAX #define MPI2_MANPAGE7_CONNECTOR_INFO_MAX (1) @@ -640,7 +708,7 @@ typedef struct _MPI2_CONFIG_PAGE_MAN_7 MPI2_POINTER PTR_MPI2_CONFIG_PAGE_MAN_7, Mpi2ManufacturingPage7_t, MPI2_POINTER pMpi2ManufacturingPage7_t; -#define MPI2_MANUFACTURING7_PAGEVERSION (0x00) +#define MPI2_MANUFACTURING7_PAGEVERSION (0x01) /* defines for the Flags field */ #define MPI2_MANPAGE7_FLAG_USE_SLOT_INFO (0x00000001) @@ -717,6 +785,7 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT /* IO Unit Page 1 Flags defines */ #define MPI2_IOUNITPAGE1_ENABLE_HOST_BASED_DISCOVERY (0x00000800) #define MPI2_IOUNITPAGE1_MASK_SATA_WRITE_CACHE (0x00000600) +#define MPI2_IOUNITPAGE1_SATA_WRITE_CACHE_SHIFT (9) #define MPI2_IOUNITPAGE1_ENABLE_SATA_WRITE_CACHE (0x00000000) #define MPI2_IOUNITPAGE1_DISABLE_SATA_WRITE_CACHE (0x00000200) #define MPI2_IOUNITPAGE1_UNCHANGED_SATA_WRITE_CACHE (0x00000400) @@ -724,15 +793,13 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT #define MPI2_IOUNITPAGE1_DISABLE_IR (0x00000040) #define MPI2_IOUNITPAGE1_DISABLE_TASK_SET_FULL_HANDLING (0x00000020) #define MPI2_IOUNITPAGE1_IR_USE_STATIC_VOLUME_ID (0x00000004) -#define MPI2_IOUNITPAGE1_MULTI_PATHING (0x00000002) -#define MPI2_IOUNITPAGE1_SINGLE_PATHING (0x00000000) /* IO Unit Page 3 */ /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.PageLength at runtime. + * one and check the value returned for GPIOCount at runtime. */ #ifndef MPI2_IO_UNIT_PAGE_3_GPIO_VAL_MAX #define MPI2_IO_UNIT_PAGE_3_GPIO_VAL_MAX (1) @@ -761,7 +828,7 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT /* * Upper layer code (drivers, utilities, etc.) should leave this define set to - * one and check Header.PageLength or NumDmaEngines at runtime. + * one and check the value returned for NumDmaEngines at runtime. */ #ifndef MPI2_IOUNITPAGE5_DMAENGINE_ENTRIES #define MPI2_IOUNITPAGE5_DMAENGINE_ENTRIES (1) @@ -826,15 +893,17 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT U8 PCIeWidth; /* 0x06 */ U8 PCIeSpeed; /* 0x07 */ U32 ProcessorState; /* 0x08 */ - U32 Reserved2; /* 0x0C */ + U32 PowerManagementCapabilities; /* 0x0C */ U16 IOCTemperature; /* 0x10 */ U8 IOCTemperatureUnits; /* 0x12 */ U8 IOCSpeed; /* 0x13 */ - U32 Reserved3; /* 0x14 */ + U16 BoardTemperature; /* 0x14 */ + U8 BoardTemperatureUnits; /* 0x16 */ + U8 Reserved3; /* 0x17 */ } MPI2_CONFIG_PAGE_IO_UNIT_7, MPI2_POINTER PTR_MPI2_CONFIG_PAGE_IO_UNIT_7, Mpi2IOUnitPage7_t, MPI2_POINTER pMpi2IOUnitPage7_t; -#define MPI2_IOUNITPAGE7_PAGEVERSION (0x00) +#define MPI2_IOUNITPAGE7_PAGEVERSION (0x02) /* defines for IO Unit Page 7 PCIeWidth field */ #define MPI2_IOUNITPAGE7_PCIE_WIDTH_X1 (0x01) @@ -855,6 +924,13 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT #define MPI2_IOUNITPAGE7_PSTATE_DISABLED (0x01) #define MPI2_IOUNITPAGE7_PSTATE_ENABLED (0x02) +/* defines for IO Unit Page 7 PowerManagementCapabilities field */ +#define MPI2_IOUNITPAGE7_PMCAP_12_5_PCT_IOCSPEED (0x00000400) +#define MPI2_IOUNITPAGE7_PMCAP_25_0_PCT_IOCSPEED (0x00000200) +#define MPI2_IOUNITPAGE7_PMCAP_50_0_PCT_IOCSPEED (0x00000100) +#define MPI2_IOUNITPAGE7_PMCAP_PCIE_WIDTH_CHANGE (0x00000008) +#define MPI2_IOUNITPAGE7_PMCAP_PCIE_SPEED_CHANGE (0x00000004) + /* defines for IO Unit Page 7 IOCTemperatureUnits field */ #define MPI2_IOUNITPAGE7_IOC_TEMP_NOT_PRESENT (0x00) #define MPI2_IOUNITPAGE7_IOC_TEMP_FAHRENHEIT (0x01) @@ -866,6 +942,11 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT #define MPI2_IOUNITPAGE7_IOC_SPEED_QUARTER (0x04) #define MPI2_IOUNITPAGE7_IOC_SPEED_EIGHTH (0x08) +/* defines for IO Unit Page 7 BoardTemperatureUnits field */ +#define MPI2_IOUNITPAGE7_BOARD_TEMP_NOT_PRESENT (0x00) +#define MPI2_IOUNITPAGE7_BOARD_TEMP_FAHRENHEIT (0x01) +#define MPI2_IOUNITPAGE7_BOARD_TEMP_CELSIUS (0x02) + /**************************************************************************** @@ -1198,7 +1279,7 @@ typedef struct _MPI2_CONFIG_PAGE_BIOS_3 /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.PageLength or NumPhys at runtime. + * one and check the value returned for NumPhys at runtime. */ #ifndef MPI2_BIOS_PAGE_4_PHY_ENTRIES #define MPI2_BIOS_PAGE_4_PHY_ENTRIES (1) @@ -1272,7 +1353,7 @@ typedef struct _MPI2_RAIDVOL0_SETTINGS /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.PageLength at runtime. + * one and check the value returned for NumPhysDisks at runtime. */ #ifndef MPI2_RAID_VOL_PAGE_0_PHYSDISK_MAX #define MPI2_RAID_VOL_PAGE_0_PHYSDISK_MAX (1) @@ -1329,6 +1410,7 @@ typedef struct _MPI2_CONFIG_PAGE_RAID_VO #define MPI2_RAIDVOL0_STATUS_FLAG_CAPACITY_EXPANSION (0x00040000) #define MPI2_RAIDVOL0_STATUS_FLAG_BACKGROUND_INIT (0x00020000) #define MPI2_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS (0x00010000) +#define MPI2_RAIDVOL0_STATUS_FLAG_VOL_NOT_CONSISTENT (0x00000080) #define MPI2_RAIDVOL0_STATUS_FLAG_OCE_ALLOWED (0x00000040) #define MPI2_RAIDVOL0_STATUS_FLAG_BGI_COMPLETE (0x00000020) #define MPI2_RAIDVOL0_STATUS_FLAG_1E_OFFSET_MIRROR (0x00000000) @@ -1451,11 +1533,15 @@ typedef struct _MPI2_CONFIG_PAGE_RD_PDIS #define MPI2_PHYSDISK0_INCOMPATIBLE_MAX_LBA (0x03) #define MPI2_PHYSDISK0_INCOMPATIBLE_SATA_EXTENDED_CMD (0x04) #define MPI2_PHYSDISK0_INCOMPATIBLE_REMOVEABLE_MEDIA (0x05) +#define MPI2_PHYSDISK0_INCOMPATIBLE_MEDIA_TYPE (0x06) #define MPI2_PHYSDISK0_INCOMPATIBLE_UNKNOWN (0xFF) /* PhysDiskAttributes defines */ +#define MPI2_PHYSDISK0_ATTRIB_MEDIA_MASK (0x0C) #define MPI2_PHYSDISK0_ATTRIB_SOLID_STATE_DRIVE (0x08) #define MPI2_PHYSDISK0_ATTRIB_HARD_DISK_DRIVE (0x04) + +#define MPI2_PHYSDISK0_ATTRIB_PROTOCOL_MASK (0x03) #define MPI2_PHYSDISK0_ATTRIB_SAS_PROTOCOL (0x02) #define MPI2_PHYSDISK0_ATTRIB_SATA_PROTOCOL (0x01) @@ -1474,7 +1560,7 @@ typedef struct _MPI2_CONFIG_PAGE_RD_PDIS /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.PageLength or NumPhysDiskPaths at runtime. + * one and check the value returned for NumPhysDiskPaths at runtime. */ #ifndef MPI2_RAID_PHYS_DISK1_PATH_MAX #define MPI2_RAID_PHYS_DISK1_PATH_MAX (1) @@ -1527,6 +1613,7 @@ typedef struct _MPI2_CONFIG_PAGE_RD_PDIS #define MPI2_SAS_NEG_LINK_RATE_SATA_OOB_COMPLETE (0x03) #define MPI2_SAS_NEG_LINK_RATE_PORT_SELECTOR (0x04) #define MPI2_SAS_NEG_LINK_RATE_SMP_RESET_IN_PROGRESS (0x05) +#define MPI2_SAS_NEG_LINK_RATE_UNSUPPORTED_PHY (0x06) #define MPI2_SAS_NEG_LINK_RATE_1_5 (0x08) #define MPI2_SAS_NEG_LINK_RATE_3_0 (0x09) #define MPI2_SAS_NEG_LINK_RATE_6_0 (0x0A) @@ -1553,6 +1640,7 @@ typedef struct _MPI2_CONFIG_PAGE_RD_PDIS #define MPI2_SAS_PHYINFO_PHY_VACANT (0x80000000) #define MPI2_SAS_PHYINFO_PHY_POWER_CONDITION_MASK (0x18000000) +#define MPI2_SAS_PHYINFO_SHIFT_PHY_POWER_CONDITION (27) #define MPI2_SAS_PHYINFO_PHY_POWER_ACTIVE (0x00000000) #define MPI2_SAS_PHYINFO_PHY_POWER_PARTIAL (0x08000000) #define MPI2_SAS_PHYINFO_PHY_POWER_SLUMBER (0x10000000) @@ -1636,7 +1724,7 @@ typedef struct _MPI2_SAS_IO_UNIT0_PHY_DA /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.ExtPageLength or NumPhys at runtime. + * one and check the value returned for NumPhys at runtime. */ #ifndef MPI2_SAS_IOUNIT0_PHY_MAX #define MPI2_SAS_IOUNIT0_PHY_MAX (1) @@ -1707,7 +1795,7 @@ typedef struct _MPI2_SAS_IO_UNIT1_PHY_DA /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.ExtPageLength or NumPhys at runtime. + * one and check the value returned for NumPhys at runtime. */ #ifndef MPI2_SAS_IOUNIT1_PHY_MAX #define MPI2_SAS_IOUNIT1_PHY_MAX (1) @@ -1798,7 +1886,7 @@ typedef struct _MPI2_SAS_IOUNIT4_SPINUP_ /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * four and check Header.ExtPageLength or NumPhys at runtime. + * one and check the value returned for NumPhys at runtime. */ #ifndef MPI2_SAS_IOUNIT4_PHY_MAX #define MPI2_SAS_IOUNIT4_PHY_MAX (4) @@ -1837,7 +1925,7 @@ typedef struct _MPI2_CONFIG_PAGE_SASIOUN typedef struct _MPI2_SAS_IO_UNIT5_PHY_PM_SETTINGS { U8 ControlFlags; /* 0x00 */ - U8 Reserved1; /* 0x01 */ + U8 PortWidthModGroup; /* 0x01 */ U16 InactivityTimerExponent; /* 0x02 */ U8 SATAPartialTimeout; /* 0x04 */ U8 Reserved2; /* 0x05 */ @@ -1857,6 +1945,9 @@ typedef struct _MPI2_SAS_IO_UNIT5_PHY_PM #define MPI2_SASIOUNIT5_CONTROL_SATA_SLUMBER_ENABLE (0x02) #define MPI2_SASIOUNIT5_CONTROL_SATA_PARTIAL_ENABLE (0x01) +/* defines for PortWidthModeGroup field */ +#define MPI2_SASIOUNIT5_PWMG_DISABLE (0xFF) + /* defines for InactivityTimerExponent field */ #define MPI2_SASIOUNIT5_ITE_MASK_SAS_SLUMBER (0x7000) #define MPI2_SASIOUNIT5_ITE_SHIFT_SAS_SLUMBER (12) @@ -1878,7 +1969,7 @@ typedef struct _MPI2_SAS_IO_UNIT5_PHY_PM /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.ExtPageLength or NumPhys at runtime. + * one and check the value returned for NumPhys at runtime. */ #ifndef MPI2_SAS_IOUNIT5_PHY_MAX #define MPI2_SAS_IOUNIT5_PHY_MAX (1) @@ -1896,7 +1987,137 @@ typedef struct _MPI2_CONFIG_PAGE_SASIOUN MPI2_POINTER PTR_MPI2_CONFIG_PAGE_SASIOUNIT_5, Mpi2SasIOUnitPage5_t, MPI2_POINTER pMpi2SasIOUnitPage5_t; -#define MPI2_SASIOUNITPAGE5_PAGEVERSION (0x00) +#define MPI2_SASIOUNITPAGE5_PAGEVERSION (0x01) + + +/* SAS IO Unit Page 6 */ + +typedef struct _MPI2_SAS_IO_UNIT6_PORT_WIDTH_MOD_GROUP_STATUS +{ + U8 CurrentStatus; /* 0x00 */ + U8 CurrentModulation; /* 0x01 */ + U8 CurrentUtilization; /* 0x02 */ + U8 Reserved1; /* 0x03 */ + U32 Reserved2; /* 0x04 */ +} MPI2_SAS_IO_UNIT6_PORT_WIDTH_MOD_GROUP_STATUS, + MPI2_POINTER PTR_MPI2_SAS_IO_UNIT6_PORT_WIDTH_MOD_GROUP_STATUS, + Mpi2SasIOUnit6PortWidthModGroupStatus_t, + MPI2_POINTER pMpi2SasIOUnit6PortWidthModGroupStatus_t; + +/* defines for CurrentStatus field */ +#define MPI2_SASIOUNIT6_STATUS_UNAVAILABLE (0x00) +#define MPI2_SASIOUNIT6_STATUS_UNCONFIGURED (0x01) +#define MPI2_SASIOUNIT6_STATUS_INVALID_CONFIG (0x02) +#define MPI2_SASIOUNIT6_STATUS_LINK_DOWN (0x03) +#define MPI2_SASIOUNIT6_STATUS_OBSERVATION_ONLY (0x04) +#define MPI2_SASIOUNIT6_STATUS_INACTIVE (0x05) +#define MPI2_SASIOUNIT6_STATUS_ACTIVE_IOUNIT (0x06) +#define MPI2_SASIOUNIT6_STATUS_ACTIVE_HOST (0x07) + +/* defines for CurrentModulation field */ +#define MPI2_SASIOUNIT6_MODULATION_25_PERCENT (0x00) +#define MPI2_SASIOUNIT6_MODULATION_50_PERCENT (0x01) +#define MPI2_SASIOUNIT6_MODULATION_75_PERCENT (0x02) +#define MPI2_SASIOUNIT6_MODULATION_100_PERCENT (0x03) + +/* + * Host code (drivers, BIOS, utilities, etc.) should leave this define set to + * one and check the value returned for NumGroups at runtime. + */ +#ifndef MPI2_SAS_IOUNIT6_GROUP_MAX +#define MPI2_SAS_IOUNIT6_GROUP_MAX (1) +#endif + +typedef struct _MPI2_CONFIG_PAGE_SASIOUNIT_6 +{ + MPI2_CONFIG_EXTENDED_PAGE_HEADER Header; /* 0x00 */ + U32 Reserved1; /* 0x08 */ + U32 Reserved2; /* 0x0C */ + U8 NumGroups; /* 0x10 */ + U8 Reserved3; /* 0x11 */ + U16 Reserved4; /* 0x12 */ + MPI2_SAS_IO_UNIT6_PORT_WIDTH_MOD_GROUP_STATUS + PortWidthModulationGroupStatus[MPI2_SAS_IOUNIT6_GROUP_MAX]; /* 0x14 */ +} MPI2_CONFIG_PAGE_SASIOUNIT_6, + MPI2_POINTER PTR_MPI2_CONFIG_PAGE_SASIOUNIT_6, + Mpi2SasIOUnitPage6_t, MPI2_POINTER pMpi2SasIOUnitPage6_t; + +#define MPI2_SASIOUNITPAGE6_PAGEVERSION (0x00) + + +/* SAS IO Unit Page 7 */ + +typedef struct _MPI2_SAS_IO_UNIT7_PORT_WIDTH_MOD_GROUP_SETTINGS +{ + U8 Flags; /* 0x00 */ + U8 Reserved1; /* 0x01 */ + U16 Reserved2; /* 0x02 */ + U8 Threshold75Pct; /* 0x04 */ + U8 Threshold50Pct; /* 0x05 */ + U8 Threshold25Pct; /* 0x06 */ + U8 Reserved3; /* 0x07 */ +} MPI2_SAS_IO_UNIT7_PORT_WIDTH_MOD_GROUP_SETTINGS, + MPI2_POINTER PTR_MPI2_SAS_IO_UNIT7_PORT_WIDTH_MOD_GROUP_SETTINGS, + Mpi2SasIOUnit7PortWidthModGroupSettings_t, + MPI2_POINTER pMpi2SasIOUnit7PortWidthModGroupSettings_t; + +/* defines for Flags field */ +#define MPI2_SASIOUNIT7_FLAGS_ENABLE_PORT_WIDTH_MODULATION (0x01) + + +/* + * Host code (drivers, BIOS, utilities, etc.) should leave this define set to + * one and check the value returned for NumGroups at runtime. + */ +#ifndef MPI2_SAS_IOUNIT7_GROUP_MAX +#define MPI2_SAS_IOUNIT7_GROUP_MAX (1) +#endif + +typedef struct _MPI2_CONFIG_PAGE_SASIOUNIT_7 +{ + MPI2_CONFIG_EXTENDED_PAGE_HEADER Header; /* 0x00 */ + U8 SamplingInterval; /* 0x08 */ + U8 WindowLength; /* 0x09 */ + U16 Reserved1; /* 0x0A */ + U32 Reserved2; /* 0x0C */ + U32 Reserved3; /* 0x10 */ + U8 NumGroups; /* 0x14 */ + U8 Reserved4; /* 0x15 */ + U16 Reserved5; /* 0x16 */ + MPI2_SAS_IO_UNIT7_PORT_WIDTH_MOD_GROUP_SETTINGS + PortWidthModulationGroupSettings[MPI2_SAS_IOUNIT7_GROUP_MAX]; /* 0x18 */ +} MPI2_CONFIG_PAGE_SASIOUNIT_7, + MPI2_POINTER PTR_MPI2_CONFIG_PAGE_SASIOUNIT_7, + Mpi2SasIOUnitPage7_t, MPI2_POINTER pMpi2SasIOUnitPage7_t; + +#define MPI2_SASIOUNITPAGE7_PAGEVERSION (0x00) + + +/* SAS IO Unit Page 8 */ + +typedef struct _MPI2_CONFIG_PAGE_SASIOUNIT_8 +{ + MPI2_CONFIG_EXTENDED_PAGE_HEADER Header; /* 0x00 */ + U32 Reserved1; /* 0x08 */ + U32 PowerManagementCapabilities; /* 0x0C */ + U32 Reserved2; /* 0x10 */ +} MPI2_CONFIG_PAGE_SASIOUNIT_8, + MPI2_POINTER PTR_MPI2_CONFIG_PAGE_SASIOUNIT_8, + Mpi2SasIOUnitPage8_t, MPI2_POINTER pMpi2SasIOUnitPage8_t; + +#define MPI2_SASIOUNITPAGE8_PAGEVERSION (0x00) + +/* defines for PowerManagementCapabilities field */ +#define MPI2_SASIOUNIT8_PM_HOST_PORT_WIDTH_MOD (0x000001000) +#define MPI2_SASIOUNIT8_PM_HOST_SAS_SLUMBER_MODE (0x000000800) +#define MPI2_SASIOUNIT8_PM_HOST_SAS_PARTIAL_MODE (0x000000400) +#define MPI2_SASIOUNIT8_PM_HOST_SATA_SLUMBER_MODE (0x000000200) +#define MPI2_SASIOUNIT8_PM_HOST_SATA_PARTIAL_MODE (0x000000100) +#define MPI2_SASIOUNIT8_PM_IOUNIT_PORT_WIDTH_MOD (0x000000010) +#define MPI2_SASIOUNIT8_PM_IOUNIT_SAS_SLUMBER_MODE (0x000000008) +#define MPI2_SASIOUNIT8_PM_IOUNIT_SAS_PARTIAL_MODE (0x000000004) +#define MPI2_SASIOUNIT8_PM_IOUNIT_SATA_SLUMBER_MODE (0x000000002) +#define MPI2_SASIOUNIT8_PM_IOUNIT_SATA_PARTIAL_MODE (0x000000001) @@ -2187,7 +2408,7 @@ typedef struct _MPI2_SASPHY2_PHY_EVENT /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.ExtPageLength or NumPhyEvents at runtime. + * one and check the value returned for NumPhyEvents at runtime. */ #ifndef MPI2_SASPHY2_PHY_EVENT_MAX #define MPI2_SASPHY2_PHY_EVENT_MAX (1) @@ -2280,7 +2501,7 @@ typedef struct _MPI2_SASPHY3_PHY_EVENT_C /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.ExtPageLength or NumPhyEvents at runtime. + * one and check the value returned for NumPhyEvents at runtime. */ #ifndef MPI2_SASPHY3_PHY_EVENT_MAX #define MPI2_SASPHY3_PHY_EVENT_MAX (1) @@ -2392,7 +2613,7 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_ENC /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.ExtPageLength or NumPhys at runtime. + * one and check the value returned for NumLogEntries at runtime. */ #ifndef MPI2_LOG_0_NUM_LOG_ENTRIES #define MPI2_LOG_0_NUM_LOG_ENTRIES (1) @@ -2442,7 +2663,7 @@ typedef struct _MPI2_CONFIG_PAGE_LOG_0 /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check Header.ExtPageLength or NumPhys at runtime. + * one and check the value returned for NumElements at runtime. */ #ifndef MPI2_RAIDCONFIG0_MAX_ELEMENTS #define MPI2_RAIDCONFIG0_MAX_ELEMENTS (1) @@ -2642,5 +2863,25 @@ typedef struct _MPI2_CONFIG_PAGE_ETHERNE #define MPI2_ETHPG1_MS_DATA_RATE_1GBIT (0x03) +/**************************************************************************** +* Extended Manufacturing Config Pages +****************************************************************************/ + +/* + * Generic structure to use for product-specific extended manufacturing pages + * (currently Extended Manufacturing Page 40 through Extended Manufacturing + * Page 60). + */ + +typedef struct _MPI2_CONFIG_PAGE_EXT_MAN_PS +{ + MPI2_CONFIG_EXTENDED_PAGE_HEADER Header; /* 0x00 */ + U32 ProductSpecificInfo; /* 0x08 */ +} MPI2_CONFIG_PAGE_EXT_MAN_PS, + MPI2_POINTER PTR_MPI2_CONFIG_PAGE_EXT_MAN_PS, + Mpi2ExtManufacturingPagePS_t, MPI2_POINTER pMpi2ExtManufacturingPagePS_t; + +/* PageVersion should be provided by product-specific code */ + #endif Modified: stable/8/sys/dev/mps/mpi/mpi2_hbd.h ============================================================================== --- stable/8/sys/dev/mps/mpi/mpi2_hbd.h Thu Feb 2 19:02:15 2012 (r230921) +++ stable/8/sys/dev/mps/mpi/mpi2_hbd.h Thu Feb 2 19:03:29 2012 (r230922) @@ -1,13 +1,42 @@ -/* $FreeBSD$ */ +/*- + * Copyright (c) 2011 LSI Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * LSI MPT-Fusion Host Adapter FreeBSD + * + * $FreeBSD$ + */ + /* - * Copyright (c) 2009 LSI Corporation. + * Copyright (c) 2009-2011 LSI Corporation. * * * Name: mpi2_hbd.h * Title: MPI Host Based Discovery messages and structures * Creation Date: October 21, 2009 * - * mpi2_hbd.h Version: 02.00.00 + * mpi2_hbd.h Version: 02.00.01 * * Version History * --------------- @@ -15,6 +44,8 @@ * Date Version Description * -------- -------- ------------------------------------------------------ * 10-28-09 02.00.00 Initial version. + * 08-11-10 02.00.01 Removed PortGroups, DmaGroup, and ControlGroup from + * HBD Action request, replaced by AdditionalInfo field. * -------------------------------------------------------------------------- */ @@ -48,10 +79,7 @@ typedef struct _MPI2_HBD_ACTION_REQUEST U8 Port; /* 0x25 */ U8 MaxConnections; /* 0x26 */ U8 MaxRate; /* 0x27 */ - U8 PortGroups; /* 0x28 */ - U8 DmaGroup; /* 0x29 */ - U8 ControlGroup; /* 0x2A */ - U8 Reserved6; /* 0x2B */ + U32 AdditionalInfo; /* 0x28 */ U16 InitialAWT; /* 0x2C */ U16 Reserved7; /* 0x2E */ U32 Reserved8; /* 0x30 */ Modified: stable/8/sys/dev/mps/mpi/mpi2_history.txt ============================================================================== --- stable/8/sys/dev/mps/mpi/mpi2_history.txt Thu Feb 2 19:02:15 2012 (r230921) +++ stable/8/sys/dev/mps/mpi/mpi2_history.txt Thu Feb 2 19:03:29 2012 (r230922) @@ -1,29 +1,58 @@ -/* $FreeBSD$ */ +/*- + * Copyright (c) 2011 LSI Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * LSI MPT-Fusion Host Adapter FreeBSD + * + * $FreeBSD$ + */ + ============================== Fusion-MPT MPI 2.0 Header File Change History ============================== - Copyright (c) 2000-2009 LSI Corporation. + Copyright (c) 2000-2011 LSI Corporation. --------------------------------------- - Header Set Release Version: 02.00.14 - Header Set Release Date: 10-28-09 + Header Set Release Version: 02.00.18 + Header Set Release Date: 11-10-10 --------------------------------------- Filename Current version Prior version ---------- --------------- ------------- - mpi2.h 02.00.14 02.00.13 - mpi2_cnfg.h 02.00.13 02.00.12 - mpi2_init.h 02.00.08 02.00.07 - mpi2_ioc.h 02.00.13 02.00.12 - mpi2_raid.h 02.00.04 02.00.04 - mpi2_sas.h 02.00.03 02.00.02 - mpi2_targ.h 02.00.03 02.00.03 - mpi2_tool.h 02.00.04 02.00.04 + mpi2.h 02.00.18 02.00.17 + mpi2_cnfg.h 02.00.17 02.00.16 + mpi2_init.h 02.00.11 02.00.10 + mpi2_ioc.h 02.00.16 02.00.15 + mpi2_raid.h 02.00.05 02.00.05 + mpi2_sas.h 02.00.05 02.00.05 + mpi2_targ.h 02.00.04 02.00.04 + mpi2_tool.h 02.00.06 02.00.06 mpi2_type.h 02.00.00 02.00.00 mpi2_ra.h 02.00.00 02.00.00 - mpi2_hbd.h 02.00.00 - mpi2_history.txt 02.00.14 02.00.13 + mpi2_hbd.h 02.00.01 02.00.01 + mpi2_history.txt 02.00.18 02.00.17 * Date Version Description @@ -72,6 +101,15 @@ mpi2.h * Added MSI-x index mask and shift for Reply Post Host * Index register. * Added function code for Host Based Discovery Action. + * 02-10-10 02.00.15 Bumped MPI2_HEADER_VERSION_UNIT. + * Added define for MPI2_FUNCTION_PWR_MGMT_CONTROL. + * Added defines for product-specific range of message + * function codes, 0xF0 to 0xFF. + * 05-12-10 02.00.16 Bumped MPI2_HEADER_VERSION_UNIT. + * Added alternative defines for the SGE Direction bit. + * 08-11-10 02.00.17 Bumped MPI2_HEADER_VERSION_UNIT. + * 11-10-10 02.00.18 Bumped MPI2_HEADER_VERSION_UNIT. + * Added MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR define. * -------------------------------------------------------------------------- mpi2_cnfg.h @@ -171,6 +209,31 @@ mpi2_cnfg.h * Added Ethernet configuration pages. * 10-28-09 02.00.13 Added MPI2_IOUNITPAGE1_ENABLE_HOST_BASED_DISCOVERY. * Added SAS PHY Page 4 structure and defines. + * 02-10-10 02.00.14 Modified the comments for the configuration page + * structures that contain an array of data. The host + * should use the "count" field in the page data (e.g. the + * NumPhys field) to determine the number of valid elements + * in the array. + * Added/modified some MPI2_MFGPAGE_DEVID_SAS defines. + * Added PowerManagementCapabilities to IO Unit Page 7. + * Added PortWidthModGroup field to + * MPI2_SAS_IO_UNIT5_PHY_PM_SETTINGS. + * Added MPI2_CONFIG_PAGE_SASIOUNIT_6 and related defines. + * Added MPI2_CONFIG_PAGE_SASIOUNIT_7 and related defines. + * Added MPI2_CONFIG_PAGE_SASIOUNIT_8 and related defines. + * 05-12-10 02.00.15 Added MPI2_RAIDVOL0_STATUS_FLAG_VOL_NOT_CONSISTENT + * define. + * Added MPI2_PHYSDISK0_INCOMPATIBLE_MEDIA_TYPE define. + * Added MPI2_SAS_NEG_LINK_RATE_UNSUPPORTED_PHY define. + * 08-11-10 02.00.16 Removed IO Unit Page 1 device path (multi-pathing) + * defines. + * 11-10-10 02.00.17 Added ReceptacleID field (replacing Reserved1) to + * MPI2_MANPAGE7_CONNECTOR_INFO and reworked defines for + * the Pinout field. + * Added BoardTemperature and BoardTemperatureUnits fields + * to MPI2_CONFIG_PAGE_IO_UNIT_7. + * Added MPI2_CONFIG_EXTPAGETYPE_EXT_MANUFACTURING define + * and MPI2_CONFIG_PAGE_EXT_MAN_PS structure. * -------------------------------------------------------------------------- mpi2_init.h @@ -192,6 +255,9 @@ mpi2_init.h * both SCSI IO Error Reply and SCSI Task Management Reply. * Added ResponseInfo field to MPI2_SCSI_TASK_MANAGE_REPLY. * Added MPI2_SCSITASKMGMT_RSP_TM_OVERLAPPED_TAG define. + * 02-10-10 02.00.09 Removed unused structure that had "#if 0" around it. + * 05-12-10 02.00.10 Added optional vendor-unique region to SCSI IO Request. + * 11-10-10 02.00.11 Added MPI2_SCSIIO_NUM_SGLOFFSETS define. * -------------------------------------------------------------------------- mpi2_ioc.h @@ -280,6 +346,12 @@ mpi2_ioc.h * (MPI2_FW_HEADER_PID_). * Modified values for SAS ProductID Family * (MPI2_FW_HEADER_PID_FAMILY_). + * 02-10-10 02.00.14 Added SAS Quiesce Event structure and defines. + * Added PowerManagementControl Request structures and + * defines. + * 05-12-10 02.00.15 Marked Task Set Full Event as obsolete. + * Added MPI2_EVENT_SAS_TOPO_LR_UNSUPPORTED_PHY define. + * 11-10-10 02.00.16 Added MPI2_FW_DOWNLOAD_ITYPE_MIN_PRODUCT_SPECIFIC. * -------------------------------------------------------------------------- mpi2_raid.h @@ -292,6 +364,7 @@ mpi2_raid.h * can be sized by the build environment. * 07-30-09 02.00.04 Added proper define for the Use Default Settings bit of * VolumeCreationFlags and marked the old one as obsolete. + * 05-12-10 02.00.05 Added MPI2_RAID_VOL_FLAGS_OP_MDC define. * -------------------------------------------------------------------------- mpi2_sas.h @@ -302,6 +375,8 @@ mpi2_sas.h * Request. * 10-28-09 02.00.03 Changed the type of SGL in MPI2_SATA_PASSTHROUGH_REQUEST * to MPI2_SGE_IO_UNION since it supports chained SGLs. + * 05-12-10 02.00.04 Modified some comments. + * 08-11-10 02.00.05 Added NCQ operations to SAS IO Unit Control. * -------------------------------------------------------------------------- mpi2_targ.h @@ -313,6 +388,7 @@ mpi2_targ.h * MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST. * Target Status Send Request only takes a single SGE for * response data. + * 02-10-10 02.00.04 Added comment to MPI2_TARGET_SSP_RSP_IU structure. * -------------------------------------------------------------------------- mpi2_tool.h @@ -325,6 +401,9 @@ mpi2_tool.h * and reply messages. * Added MPI2_DIAG_BUF_TYPE_EXTENDED. * Incremented MPI2_DIAG_BUF_TYPE_COUNT. + * 05-12-10 02.00.05 Added Diagnostic Data Upload tool. + * 08-11-10 02.00.06 Added defines that were missing for Diagnostic Buffer + * Post Request. * -------------------------------------------------------------------------- mpi2_type.h @@ -337,24 +416,40 @@ mpi2_ra.h mpi2_hbd.h * 10-28-09 02.00.00 Initial version. + * 08-11-10 02.00.01 Removed PortGroups, DmaGroup, and ControlGroup from + * HBD Action request, replaced by AdditionalInfo field. * -------------------------------------------------------------------------- mpi2_history.txt Parts list history -Filename 02.00.14 02.00.13 02.00.12 ----------- -------- -------- -------- -mpi2.h 02.00.14 02.00.13 02.00.12 -mpi2_cnfg.h 02.00.13 02.00.12 02.00.11 -mpi2_init.h 02.00.08 02.00.07 02.00.07 -mpi2_ioc.h 02.00.13 02.00.12 02.00.11 -mpi2_raid.h 02.00.04 02.00.04 02.00.03 -mpi2_sas.h 02.00.03 02.00.02 02.00.02 -mpi2_targ.h 02.00.03 02.00.03 02.00.03 -mpi2_tool.h 02.00.04 02.00.04 02.00.03 -mpi2_type.h 02.00.00 02.00.00 02.00.00 -mpi2_ra.h 02.00.00 02.00.00 02.00.00 -mpi2_hbd.h 02.00.00 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 01:36:03 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77CB0106566B; Fri, 3 Feb 2012 01:36:03 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 64E588FC0C; Fri, 3 Feb 2012 01:36:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q131a3cj064168; Fri, 3 Feb 2012 01:36:03 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q131a3wA064162; Fri, 3 Feb 2012 01:36:03 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201202030136.q131a3wA064162@svn.freebsd.org> From: Jack F Vogel Date: Fri, 3 Feb 2012 01:36:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230924 - in stable/8/sys: conf dev/ixgbe modules/ixgbe X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 01:36:03 -0000 Author: jfv Date: Fri Feb 3 01:36:02 2012 New Revision: 230924 URL: http://svn.freebsd.org/changeset/base/230924 Log: MFC of the latest ixgbe driver. Revisions included: 209602,209603,209607,209609,209622,215911, 215913,215914,215924,217129,217556,222588, 222592,225405,229767,230329,230775,230790 Modified: stable/8/sys/conf/files stable/8/sys/dev/ixgbe/LICENSE stable/8/sys/dev/ixgbe/README stable/8/sys/dev/ixgbe/ixgbe.c stable/8/sys/dev/ixgbe/ixgbe.h stable/8/sys/dev/ixgbe/ixgbe_82598.c stable/8/sys/dev/ixgbe/ixgbe_82599.c stable/8/sys/dev/ixgbe/ixgbe_api.c stable/8/sys/dev/ixgbe/ixgbe_api.h stable/8/sys/dev/ixgbe/ixgbe_common.c stable/8/sys/dev/ixgbe/ixgbe_common.h stable/8/sys/dev/ixgbe/ixgbe_mbx.c stable/8/sys/dev/ixgbe/ixgbe_mbx.h stable/8/sys/dev/ixgbe/ixgbe_osdep.h stable/8/sys/dev/ixgbe/ixgbe_phy.c stable/8/sys/dev/ixgbe/ixgbe_phy.h stable/8/sys/dev/ixgbe/ixgbe_type.h stable/8/sys/dev/ixgbe/ixgbe_vf.c stable/8/sys/dev/ixgbe/ixgbe_vf.h stable/8/sys/dev/ixgbe/ixv.c stable/8/sys/dev/ixgbe/ixv.h stable/8/sys/modules/ixgbe/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Thu Feb 2 21:04:24 2012 (r230923) +++ stable/8/sys/conf/files Fri Feb 3 01:36:02 2012 (r230924) @@ -1263,7 +1263,9 @@ dev/ixgbe/ixgbe_82598.c optional ixgbe compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_82599.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" -dev/jme/if_jme.c optional jme pci inet +dev/ixgbe/ixgbe_x540.c optional ixgbe inet \ + compile-with "${NORMAL_C} -I$S/dev/ixgbe" +dev/jme/if_jme.c optional jme pci dev/joy/joy.c optional joy dev/joy/joy_isa.c optional joy isa dev/joy/joy_pccard.c optional joy pccard Modified: stable/8/sys/dev/ixgbe/LICENSE ============================================================================== --- stable/8/sys/dev/ixgbe/LICENSE Thu Feb 2 21:04:24 2012 (r230923) +++ stable/8/sys/dev/ixgbe/LICENSE Fri Feb 3 01:36:02 2012 (r230924) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without Modified: stable/8/sys/dev/ixgbe/README ============================================================================== --- stable/8/sys/dev/ixgbe/README Thu Feb 2 21:04:24 2012 (r230923) +++ stable/8/sys/dev/ixgbe/README Fri Feb 3 01:36:02 2012 (r230924) @@ -1,8 +1,8 @@ -FreeBSD Driver for 10 Gigabit PCI Express Server Adapters -============================================= +FreeBSD Driver for Intel(R) Ethernet 10 Gigabit PCI Express Server Adapters +============================================================================ /*$FreeBSD$*/ -May 14, 2008 +November 12, 2010 Contents @@ -11,15 +11,15 @@ Contents - Overview - Supported Adapters - Building and Installation -- Additional Configurations +- Additional Configurations and Tuning - Known Limitations Overview ======== -This file describes the FreeBSD* driver for the 10 Gigabit PCIE Family of -Adapters. Drivers has been developed for use with FreeBSD 7 or later. +This file describes the FreeBSD* driver for the Intel(R) Ethernet 10 Gigabit +Family of Adapters. Driver has been developed for use with FreeBSD 7.2 or later. For questions related to hardware requirements, refer to the documentation supplied with your Intel 10GbE adapter. All hardware requirements listed @@ -29,100 +29,98 @@ apply to use with FreeBSD. Supported Adapters ================== -The following Intel network adapters are compatible with the drivers in this -release: - -Controller Adapter Name Physical Layer ----------- ------------ -------------- -82598EB Intel(R) 10 Gigabit XF SR/AF 10G Base -LR (850 nm optical fiber) - Dual Port Server Adapter 10G Base -SR (1310 nm optical fiber) -82598EB Intel(R) 10 Gigabit XF SR/LR - Server Adapter - Intel(R) 82598EB 10 Gigabit AF - Network Connection - Intel(R) 82598EB 10 Gigabit AT - CX4 Network Connection +The driver in this release is compatible with 82598 and 82599-based Intel +Network Connections. +SFP+ Devices with Pluggable Optics +---------------------------------- -Building and Installation -========================= - -NOTE: You must have kernel sources installed in order to compile the driver - module. - - In the instructions below, x.x.x is the driver version as indicated in - the name of the driver tar. - -1. Move the base driver tar file to the directory of your choice. For - example, use /home/username/ixgbe or /usr/local/src/ixgbe. - -2. Untar/unzip the archive: - tar xfz ixgbe-x.x.x.tar.gz - -3. To install man page: - cd ixgbe-x.x.x - gzip -c ixgbe.4 > /usr/share/man/man4/ixgbee.4.gz - -4. To load the driver onto a running system: - cd ixgbe-x.x.x/src - make load - -5. To assign an IP address to the interface, enter the following: - ifconfig ix - -6. Verify that the interface works. Enter the following, where - is the IP address for another machine on the same subnet as the interface - that is being tested: - ping - -7. If you want the driver to load automatically when the system is booted: - - cd ixgbe-x.x.x/src - make - make install - - Edit /boot/loader.conf, and add the following line: - ixgbe_load="YES" - - OR - - compile the driver into the kernel (see item 8). - - - Edit /etc/rc.conf, and create the appropriate ifconfig_ixgbe - entry: - - ifconfig_ix="" - - Example usage: - - ifconfig_ix0="inet 192.168.10.1 netmask 255.255.255.0" - - NOTE: For assistance, see the ifconfig man page. - -8. If you want to compile the driver into the kernel, enter: +82599-BASED ADAPTERS - FreeBSD 7 or later: +NOTE: If your 82599-based Intel(R) Ethernet Network Adapter came with Intel +optics, or is an Intel(R) Ethernet Server Adapter X520-2, then it only supports +Intel optics and/or the direct attach cables listed below. - cd ixgbe-x.x.x/src - - cp *.[ch] /usr/src/sys/dev/ixgbe - - cp Makefile.kernel /usr/src/sys/modules/ixgbe/Makefile - - Edit the kernel configuration file (i.e., GENERIC or MYKERNEL) in - /usr/src/sys/i386/conf (replace "i386" with the appropriate system - architecture if necessary), and ensure the following line is present: - - device ixgbe - - Compile and install the kernel. The system must be reboot for the kernel - updates to take affect. For additional information on compiling the kernel, - consult the FreeBSD operating system documentation. +When 82599-based SFP+ devices are connected back to back, they should be set to +the same Speed setting via Ethtool. Results may vary if you mix speed settings. + +Supplier Type Part Numbers +SR Modules +Intel DUAL RATE 1G/10G SFP+ SR (bailed) FTLX8571D3BCV-IT +Intel DUAL RATE 1G/10G SFP+ SR (bailed) AFBR-703SDZ-IN2 +Intel DUAL RATE 1G/10G SFP+ SR (bailed) AFBR-703SDDZ-IN1 +LR Modules +Intel DUAL RATE 1G/10G SFP+ LR (bailed) FTLX1471D3BCV-IT +Intel DUAL RATE 1G/10G SFP+ LR (bailed) AFCT-701SDZ-IN2 +Intel DUAL RATE 1G/10G SFP+ LR (bailed) AFCT-701SDDZ-IN1 + +The following is a list of 3rd party SFP+ modules and direct attach cables that +have received some testing. Not all modules are applicable to all devices. + +Supplier Type Part Numbers + +Finisar SFP+ SR bailed, 10g single rate FTLX8571D3BCL +Avago SFP+ SR bailed, 10g single rate AFBR-700SDZ +Finisar SFP+ LR bailed, 10g single rate FTLX8571D3BCV-IT + +Finisar DUAL RATE 1G/10G SFP+ SR (No Bail) FTLX8571D3QCV-IT +Avago DUAL RATE 1G/10G SFP+ SR (No Bail) AFBR-703SDZ-IN1 +Finisar DUAL RATE 1G/10G SFP+ LR (No Bail) FTLX1471D3QCV-IT +Avago DUAL RATE 1G/10G SFP+ LR (No Bail) AFCT-701SDZ-IN1 +Finistar 1000BASE-T SFP FCLF8522P2BTL +Avago 1000BASE-T SFP ABCU-5710RZ + +82599-based adapters support all passive and active limiting direct attach +cables that comply with SFF-8431 v4.1 and SFF-8472 v10.4 specifications. + +Laser turns off for SFP+ when ifconfig down +-------------------------------------------------------- +"ifconfig down" turns off the laser for 82599-based SFP+ fiber adapters. +"ifconfig up" turns on the later. + +82598-BASED ADAPTERS + +NOTES for 82598-Based Adapters: +- Intel(R) Ethernet Network Adapters that support removable optical modules + only support their original module type (i.e., the Intel(R) 10 Gigabit SR + Dual Port Express Module only supports SR optical modules). If you plug + in a different type of module, the driver will not load. +- Hot Swapping/hot plugging optical modules is not supported. +- Only single speed, 10 gigabit modules are supported. +- LAN on Motherboard (LOMs) may support DA, SR, or LR modules. Other module + types are not supported. Please see your system documentation for details. + +The following is a list of 3rd party SFP+ modules and direct attach cables that have +received some testing. Not all modules are applicable to all devices. + +Supplier Type Part Numbers + +Finisar SFP+ SR bailed, 10g single rate FTLX8571D3BCL +Avago SFP+ SR bailed, 10g single rate AFBR-700SDZ +Finisar SFP+ LR bailed, 10g single rate FTLX1471D3BCL + +82598-based adapters support all passive direct attach cables that comply +with SFF-8431 v4.1 and SFF-8472 v10.4 specifications. Active direct attach +cables are not supported. + +Third party optic modules and cables referred to above are listed only for the +purpose of highlighting third party specifications and potential compatibility, +and are not recommendations or endorsements or sponsorship of any third party's +product by Intel. Intel is not endorsing or promoting products made by any +third party and the third party reference is provided only to share information +regarding certain optic modules and cables with the above specifications. There +may be other manufacturers or suppliers, producing or supplying optic modules +and cables with similar or matching descriptions. Customers must use their own +discretion and diligence to purchase optic modules and cables from any third +party of their choice. Customer are solely responsible for assessing the +suitability of the product and/or devices and for the selection of the vendor +for purchasing any product. INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL +DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF +SUCH THIRD PARTY PRODUCTS OR SELECTION OF VENDOR BY CUSTOMERS. Configuration and Tuning -========================= +======================== The driver supports Transmit/Receive Checksum Offload and Jumbo Frames on all 10 Gigabit adapters. @@ -143,7 +141,7 @@ all 10 Gigabit adapters. The Jumbo Frames MTU range for Intel Adapters is 1500 to 16114. The default MTU range is 1500. To modify the setting, enter the following: - ifconfig ix mtu 9000 + ifconfig ix mtu 9000 To confirm an interface's MTU value, use the ifconfig command. To confirm the MTU used between two specific devices, use: @@ -200,6 +198,8 @@ all 10 Gigabit adapters. TSO --- + TSO is enabled by default. + To disable: ifconfig -tso @@ -209,23 +209,21 @@ all 10 Gigabit adapters. ifconfig tso LRO - ___ + --- - Large Receive Offload is available in version 1.4.4, it is on - by default. It can be toggled off and on by using: - sysctl dev.ix.X.enable_lro=[0,1] - - NOTE: when changing this feature you MUST be sure the interface - is reinitialized, it is easy to do this with ifconfig down/up. - The LRO code will ultimately move into the kernel stack code, - but for this first release it was included with the driver. + Large Receive Offload is available in the driver; it is on by default. + It can be disabled by using: + ifconfig -lro + To enable: + ifconfig lro + Important system configuration changes: --------------------------------------- - When there is a choice run on a 64bit OS rather than 32, it makes - a significant difference in improvement. - + When there is a choice run on a 64bit OS rather than 32, it makes a + significant difference in improvement. + The default scheduler SCHED_4BSD is not smart about SMP locality issues. Significant improvement can be achieved by switching to the ULE scheduler. @@ -233,34 +231,79 @@ all 10 Gigabit adapters. SCHED_ULE. Note that this is only advisable on FreeBSD 7, on 6.X there have been stability problems with ULE. - Change the file /etc/sysctl.conf, add the line: + The interface can generate high number of interrupts. To avoid running + into the limit set by the kernel, adjust hw.intr_storm_threshold + setting using sysctl: - hw.intr_storm_threshold: 8000 (the default is 1000) + sysctl hw.intr_storm_threshold=9000 (the default is 1000) + + For this change to take effect on boot, edit /etc/sysctl.conf and add the + line: + hw.intr_storm_threshold=9000 + + If you still see Interrupt Storm detected messages, increase the limit to a + higher number. Best throughput results are seen with a large MTU; use 9000 if possible. - The default number of descriptors is 256, increasing this to 1024 or even - 2048 may improve performance. + The default number of descriptors is 1024, increasing this to 2K or even + 4K may improve performance in some workloads, but change carefully. Known Limitations ================= + +For known hardware and troubleshooting issues, refer to the following website. + + http://support.intel.com/support/go/network/adapter/home.htm + +Either select the link for your adapter or perform a search for the adapter +number. The adapter's page lists many issues. For a complete list of hardware +issues download your adapter's user guide and read the Release Notes. + + UDP stress test with 10GbE driver + --------------------------------- Under small packets UDP stress test with 10GbE driver, the FreeBSD system will drop UDP packets due to the fullness of socket buffers. You may want to change the driver's Flow Control variables to the minimum value for controlling packet reception. + Attempting to configure larger MTUs with a large numbers of processors may + generate the error message "ix0:could not setup receive structures" + -------------------------------------------------------------------------- + When using the ixgbe driver with RSS autoconfigured based on the number of + cores (the default setting) and that number is larger than 4, increase the + memory resources allocated for the mbuf pool as follows: + + Add to the sysctl.conf file for the system: + + kern.ipc.nmbclusters=262144 + kern.ipc.nmbjumbop=262144 + + Lower than expected performance on dual port 10GbE devices + ---------------------------------------------------------- + Some PCI-E x8 slots are actually configured as x4 slots. These slots have + insufficient bandwidth for full 10Gbe line rate with dual port 10GbE devices. + The driver can detect this situation and will write the following message in + the system log: "PCI-Express bandwidth available for this card is not + sufficient for optimal performance. For optimal performance a x8 PCI-Express + slot is required." + + If this error occurs, moving your adapter to a true x8 slot will resolve the + issue. + + Support ======= For general information and support, go to the Intel support website at: - http://support.intel.com + www.intel.com/support/ If an issue is identified with the released source code on the supported kernel with a supported adapter, email the specific information related to -the issue to freebsd@intel.com. +the issue to freebsd@intel.com Modified: stable/8/sys/dev/ixgbe/ixgbe.c ============================================================================== --- stable/8/sys/dev/ixgbe/ixgbe.c Thu Feb 2 21:04:24 2012 (r230923) +++ stable/8/sys/dev/ixgbe/ixgbe.c Fri Feb 3 01:36:02 2012 (r230924) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2011, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -34,6 +34,7 @@ #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_inet.h" +#include "opt_inet6.h" #endif #include "ixgbe.h" @@ -46,7 +47,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.3.10"; +char ixgbe_driver_version[] = "2.4.5"; /********************************************************************* * PCI Device ID Table @@ -80,6 +81,8 @@ static ixgbe_vendor_info_t ixgbe_vendor_ {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_COMBO_BACKPLANE, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_BACKPLANE_FCOE, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_FCOE, 0, 0, 0}, + {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599EN_SFP, 0, 0, 0}, + {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T, 0, 0, 0}, /* required last entry */ {0, 0, 0, 0, 0} }; @@ -152,6 +155,7 @@ static void ixgbe_refresh_mbufs(struct r static int ixgbe_xmit(struct tx_ring *, struct mbuf **); static int ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS); static int ixgbe_set_advertise(SYSCTL_HANDLER_ARGS); +static int ixgbe_set_thermal_test(SYSCTL_HANDLER_ARGS); static int ixgbe_dma_malloc(struct adapter *, bus_size_t, struct ixgbe_dma_alloc *, int); static void ixgbe_dma_free(struct adapter *, struct ixgbe_dma_alloc *); @@ -318,7 +322,7 @@ static int fdir_pballoc = 1; * ixgbe_probe determines if the driver should be loaded on * adapter based on PCI vendor/device id of the adapter. * - * return 0 on success, positive on failure + * return BUS_PROBE_DEFAULT on success, positive on failure *********************************************************************/ static int @@ -357,7 +361,7 @@ ixgbe_probe(device_t dev) ixgbe_driver_version); device_set_desc_copy(dev, adapter_name); ++ixgbe_total_ports; - return (0); + return (BUS_PROBE_DEFAULT); } ent++; } @@ -385,6 +389,11 @@ ixgbe_attach(device_t dev) INIT_DEBUGOUT("ixgbe_attach: begin"); + if (resource_disabled("ixgbe", device_get_unit(dev))) { + device_printf(dev, "Disabled by device hint\n"); + return (ENXIO); + } + /* Allocate, clear, and link in our adapter structure */ adapter = device_get_softc(dev); adapter->dev = adapter->osdep.dev = dev; @@ -397,7 +406,7 @@ ixgbe_attach(device_t dev) SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "flow_control", CTLTYPE_INT | CTLFLAG_RW, + OID_AUTO, "fc", CTLTYPE_INT | CTLFLAG_RW, adapter, 0, ixgbe_set_flowcntl, "I", "Flow Control"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), @@ -410,6 +419,21 @@ ixgbe_attach(device_t dev) OID_AUTO, "enable_aim", CTLTYPE_INT|CTLFLAG_RW, &ixgbe_enable_aim, 1, "Interrupt Moderation"); + /* + ** Allow a kind of speed control by forcing the autoneg + ** advertised speed list to only a certain value, this + ** supports 1G on 82599 devices, and 100Mb on x540. + */ + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "advertise_speed", CTLTYPE_INT | CTLFLAG_RW, + adapter, 0, ixgbe_set_advertise, "I", "Link Speed"); + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "ts", CTLTYPE_INT | CTLFLAG_RW, adapter, + 0, ixgbe_set_thermal_test, "I", "Thermal Test"); + /* Set up the timer callout */ callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0); @@ -497,9 +521,10 @@ ixgbe_attach(device_t dev) /* Get Hardware Flow Control setting */ hw->fc.requested_mode = ixgbe_fc_full; + adapter->fc = hw->fc.requested_mode; hw->fc.pause_time = IXGBE_FC_PAUSE; hw->fc.low_water = IXGBE_FC_LO; - hw->fc.high_water = IXGBE_FC_HI; + hw->fc.high_water[0] = IXGBE_FC_HI; hw->fc.send_xon = TRUE; error = ixgbe_init_hw(hw); @@ -700,16 +725,20 @@ ixgbe_start_locked(struct tx_ring *txr, return; while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { + if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE) { + txr->queue_status |= IXGBE_QUEUE_DEPLETED; + break; + } IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; if (ixgbe_xmit(txr, &m_head)) { - if (m_head == NULL) - break; - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + if (m_head != NULL) + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE) + txr->queue_status |= IXGBE_QUEUE_DEPLETED; break; } /* Send a copy of the frame to the BPF listener */ @@ -758,11 +787,14 @@ ixgbe_mq_start(struct ifnet *ifp, struct /* Which queue to use */ if ((m->m_flags & M_FLOWID) != 0) i = m->m_pkthdr.flowid % adapter->num_queues; + else + i = curcpu % adapter->num_queues; txr = &adapter->tx_rings[i]; que = &adapter->queues[i]; - if (IXGBE_TX_TRYLOCK(txr)) { + if (((txr->queue_status & IXGBE_QUEUE_DEPLETED) == 0) && + IXGBE_TX_TRYLOCK(txr)) { err = ixgbe_mq_start_locked(ifp, txr, m); IXGBE_TX_UNLOCK(txr); } else { @@ -780,13 +812,18 @@ ixgbe_mq_start_locked(struct ifnet *ifp, struct mbuf *next; int enqueued, err = 0; - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING || adapter->link_active == 0) { + if (((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) || + (txr->queue_status == IXGBE_QUEUE_DEPLETED) || + adapter->link_active == 0) { if (m != NULL) err = drbr_enqueue(ifp, txr->br, m); return (err); } + /* Call cleanup if number of TX descriptors low */ + if (txr->tx_avail <= IXGBE_TX_CLEANUP_THRESHOLD) + ixgbe_txeof(txr); + enqueued = 0; if (m == NULL) { next = drbr_dequeue(ifp, txr->br); @@ -813,7 +850,7 @@ ixgbe_mq_start_locked(struct ifnet *ifp, if (txr->tx_avail < IXGBE_TX_OP_THRESHOLD) ixgbe_txeof(txr); if (txr->tx_avail < IXGBE_TX_OP_THRESHOLD) { - ifp->if_drv_flags |= IFF_DRV_OACTIVE; + txr->queue_status |= IXGBE_QUEUE_DEPLETED; break; } next = drbr_dequeue(ifp, txr->br); @@ -821,10 +858,13 @@ ixgbe_mq_start_locked(struct ifnet *ifp, if (enqueued > 0) { /* Set watchdog on */ - txr->queue_status = IXGBE_QUEUE_WORKING; + txr->queue_status |= IXGBE_QUEUE_WORKING; txr->watchdog_time = ticks; } + if (txr->tx_avail < IXGBE_TX_CLEANUP_THRESHOLD) + ixgbe_txeof(txr); + return (err); } @@ -862,8 +902,9 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c { struct adapter *adapter = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; -#ifdef INET +#if defined(INET) || defined(INET6) struct ifaddr *ifa = (struct ifaddr *)data; + bool avoid_reset = FALSE; #endif int error = 0; @@ -871,26 +912,28 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c case SIOCSIFADDR: #ifdef INET - if (ifa->ifa_addr->sa_family == AF_INET) { - /* - * Since resetting hardware takes a very long time - * and results in link renegotiation we only - * initialize the hardware only when it is absolutely - * required. - */ + if (ifa->ifa_addr->sa_family == AF_INET) + avoid_reset = TRUE; +#endif +#ifdef INET6 + if (ifa->ifa_addr->sa_family == AF_INET6) + avoid_reset = TRUE; +#endif +#if defined(INET) || defined(INET6) + /* + ** Calling init results in link renegotiation, + ** so we avoid doing it when possible. + */ + if (avoid_reset) { ifp->if_flags |= IFF_UP; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - IXGBE_CORE_LOCK(adapter); - ixgbe_init_locked(adapter); - IXGBE_CORE_UNLOCK(adapter); - } + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + ixgbe_init(adapter); if (!(ifp->if_flags & IFF_NOARP)) arp_ifinit(ifp, ifa); } else -#endif error = ether_ioctl(ifp, command, data); +#endif break; - case SIOCSIFMTU: IOCTL_DEBUGOUT("ioctl: SIOCSIFMTU (Set Interface MTU)"); if (ifr->ifr_mtu > IXGBE_MAX_FRAME_SIZE - ETHER_HDR_LEN) { @@ -951,6 +994,8 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; if (mask & IFCAP_VLAN_HWFILTER) ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; + if (mask & IFCAP_VLAN_HWTSO) + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { IXGBE_CORE_LOCK(adapter); ixgbe_init_locked(adapter); @@ -1058,10 +1103,14 @@ ixgbe_init_locked(struct adapter *adapte /* Enable Fan Failure Interrupt */ gpie |= IXGBE_SDP1_GPIEN; - /* Add for Thermal detection */ + /* Add for Module detection */ if (hw->mac.type == ixgbe_mac_82599EB) gpie |= IXGBE_SDP2_GPIEN; + /* Thermal Failure Detection */ + if (hw->mac.type == ixgbe_mac_X540) + gpie |= IXGBE_SDP0_GPIEN; + if (adapter->msix > 1) { /* Enable Enhanced MSIX mode */ gpie |= IXGBE_GPIE_MSIX_MODE; @@ -1142,8 +1191,12 @@ ixgbe_init_locked(struct adapter *adapte #ifdef IXGBE_FDIR /* Init Flow director */ - if (hw->mac.type != ixgbe_mac_82598EB) + if (hw->mac.type != ixgbe_mac_82598EB) { + u32 hdrm = 64 << fdir_pballoc; + + hw->mac.ops.setup_rxpba(hw, 0, hdrm, PBA_STRATEGY_EQUAL); ixgbe_init_fdir_signature_82599(&adapter->hw, fdir_pballoc); + } #endif /* @@ -1271,7 +1324,7 @@ ixgbe_handle_que(void *context, int pend ixgbe_start_locked(txr, ifp); #endif IXGBE_TX_UNLOCK(txr); - if (more) { + if (more || (ifp->if_drv_flags & IFF_DRV_OACTIVE)) { taskqueue_enqueue(que->tq, &que->que_task); return; } @@ -1338,7 +1391,7 @@ ixgbe_legacy_irq(void *arg) /********************************************************************* * - * MSI Queue Interrupt Service routine + * MSIX Queue Interrupt Service routine * **********************************************************************/ void @@ -1351,12 +1404,24 @@ ixgbe_msix_que(void *arg) bool more_tx, more_rx; u32 newitr = 0; + ixgbe_disable_queue(adapter, que->msix); ++que->irqs; more_rx = ixgbe_rxeof(que, adapter->rx_process_limit); IXGBE_TX_LOCK(txr); more_tx = ixgbe_txeof(txr); + /* + ** Make certain that if the stack + ** has anything queued the task gets + ** scheduled to handle it. + */ +#if __FreeBSD_version < 800000 + if (!IFQ_DRV_IS_EMPTY(&adapter->ifp->if_snd)) +#else + if (!drbr_empty(adapter->ifp, txr->br)) +#endif + more_tx = 1; IXGBE_TX_UNLOCK(txr); /* Do AIM now? */ @@ -1474,6 +1539,15 @@ ixgbe_msix_link(void *arg) IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1); } + /* Check for over temp condition */ + if ((hw->mac.type == ixgbe_mac_X540) && + (reg_eicr & IXGBE_EICR_GPI_SDP0)) { + device_printf(adapter->dev, "\nCRITICAL: OVER TEMP!! " + "PHY IS SHUT DOWN!!\n"); + device_printf(adapter->dev, "System shutdown required\n"); + IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP0); + } + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, IXGBE_EIMS_OTHER); return; } @@ -1506,6 +1580,9 @@ ixgbe_media_status(struct ifnet * ifp, s ifmr->ifm_status |= IFM_ACTIVE; switch (adapter->link_speed) { + case IXGBE_LINK_SPEED_100_FULL: + ifmr->ifm_active |= IFM_100_TX | IFM_FDX; + break; case IXGBE_LINK_SPEED_1GB_FULL: ifmr->ifm_active |= IFM_1000_T | IFM_FDX; break; @@ -1541,7 +1618,9 @@ ixgbe_media_change(struct ifnet * ifp) switch (IFM_SUBTYPE(ifm->ifm_media)) { case IFM_AUTO: adapter->hw.phy.autoneg_advertised = - IXGBE_LINK_SPEED_1GB_FULL | IXGBE_LINK_SPEED_10GB_FULL; + IXGBE_LINK_SPEED_100_FULL | + IXGBE_LINK_SPEED_1GB_FULL | + IXGBE_LINK_SPEED_10GB_FULL; break; default: device_printf(adapter->dev, "Only auto media type\n"); @@ -1570,7 +1649,7 @@ ixgbe_xmit(struct tx_ring *txr, struct m struct mbuf *m_head; bus_dma_segment_t segs[adapter->num_segs]; bus_dmamap_t map; - struct ixgbe_tx_buf *txbuf, *txbuf_mapped; + struct ixgbe_tx_buf *txbuf; union ixgbe_adv_tx_desc *txd = NULL; m_head = *m_headp; @@ -1589,7 +1668,6 @@ ixgbe_xmit(struct tx_ring *txr, struct m */ first = txr->next_avail_desc; txbuf = &txr->tx_buffers[first]; - txbuf_mapped = txbuf; map = txbuf->map; /* @@ -1708,6 +1786,8 @@ ixgbe_xmit(struct tx_ring *txr, struct m txr->next_avail_desc = i; txbuf->m_head = m_head; + /* Swap the dma map between the first and last descriptor */ + txr->tx_buffers[first].map = txbuf->map; txbuf->map = map; bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); @@ -1812,7 +1892,7 @@ ixgbe_set_multi(struct adapter *adapter) update_ptr = mta; ixgbe_update_mc_addr_list(&adapter->hw, - update_ptr, mcnt, ixgbe_mc_array_itr); + update_ptr, mcnt, ixgbe_mc_array_itr, TRUE); return; } @@ -1846,11 +1926,15 @@ ixgbe_mc_array_itr(struct ixgbe_hw *hw, static void ixgbe_local_timer(void *arg) { - struct adapter *adapter = arg; + struct adapter *adapter = arg; device_t dev = adapter->dev; - struct tx_ring *txr = adapter->tx_rings; + struct ifnet *ifp = adapter->ifp; + struct ix_queue *que = adapter->queues; + struct tx_ring *txr = adapter->tx_rings; + int hung, busy, paused; mtx_assert(&adapter->core_mtx, MA_OWNED); + hung = busy = paused = 0; /* Check for pluggable optics */ if (adapter->sfp_probe) @@ -1865,21 +1949,38 @@ ixgbe_local_timer(void *arg) * then don't do the watchdog check */ if (IXGBE_READ_REG(&adapter->hw, IXGBE_TFCS) & IXGBE_TFCS_TXOFF) - goto out; + paused = 1; /* - ** Check status on the TX queues for a hang - */ - for (int i = 0; i < adapter->num_queues; i++, txr++) - if (txr->queue_status == IXGBE_QUEUE_HUNG) - goto hung; + ** Check the TX queues status + ** - central locked handling of OACTIVE + ** - watchdog only if all queues show hung + */ + for (int i = 0; i < adapter->num_queues; i++, que++, txr++) { + if ((txr->queue_status & IXGBE_QUEUE_HUNG) && + (paused == 0)) + ++hung; + if (txr->queue_status & IXGBE_QUEUE_DEPLETED) + ++busy; + if ((txr->queue_status & IXGBE_QUEUE_IDLE) == 0) + taskqueue_enqueue(que->tq, &que->que_task); + } + /* Only truely watchdog if all queues show hung */ + if (hung == adapter->num_queues) + goto watchdog; + /* Only turn off the stack flow when ALL are depleted */ + if (busy == adapter->num_queues) + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + else if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) && + (busy < adapter->num_queues)) + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; out: ixgbe_rearm_queues(adapter, adapter->que_mask); callout_reset(&adapter->timer, hz, ixgbe_local_timer, adapter); return; -hung: +watchdog: device_printf(adapter->dev, "Watchdog timeout -- resetting\n"); device_printf(dev,"Queue(%d) tdh = %d, hw tdt = %d\n", txr->me, IXGBE_READ_REG(&adapter->hw, IXGBE_TDH(txr->me)), @@ -1949,9 +2050,11 @@ ixgbe_stop(void *arg) INIT_DEBUGOUT("ixgbe_stop: begin\n"); ixgbe_disable_intr(adapter); + callout_stop(&adapter->timer); - /* Tell the stack that the interface is no longer active */ - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + /* Let the stack know...*/ + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; ixgbe_reset_hw(hw); hw->adapter_stopped = FALSE; @@ -1959,7 +2062,6 @@ ixgbe_stop(void *arg) /* Turn off the laser */ if (hw->phy.multispeed_fiber) ixgbe_disable_tx_laser(hw); - callout_stop(&adapter->timer); /* reprogram the RAR[0] in case user changed it. */ ixgbe_set_rar(&adapter->hw, 0, adapter->hw.mac.addr, 0, IXGBE_RAH_AV); @@ -2013,35 +2115,41 @@ ixgbe_setup_optics(struct adapter *adapt int layer; layer = ixgbe_get_supported_physical_layer(hw); - switch (layer) { - case IXGBE_PHYSICAL_LAYER_10GBASE_T: - adapter->optics = IFM_10G_T; - break; - case IXGBE_PHYSICAL_LAYER_1000BASE_T: - adapter->optics = IFM_1000_T; - break; - case IXGBE_PHYSICAL_LAYER_10GBASE_LR: - case IXGBE_PHYSICAL_LAYER_10GBASE_LRM: - adapter->optics = IFM_10G_LR; - break; - case IXGBE_PHYSICAL_LAYER_10GBASE_SR: - adapter->optics = IFM_10G_SR; - break; - case IXGBE_PHYSICAL_LAYER_10GBASE_KX4: - case IXGBE_PHYSICAL_LAYER_10GBASE_CX4: - adapter->optics = IFM_10G_CX4; - break; - case IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU: - adapter->optics = IFM_10G_TWINAX; - break; - case IXGBE_PHYSICAL_LAYER_1000BASE_KX: - case IXGBE_PHYSICAL_LAYER_10GBASE_KR: - case IXGBE_PHYSICAL_LAYER_10GBASE_XAUI: - case IXGBE_PHYSICAL_LAYER_UNKNOWN: - default: - adapter->optics = IFM_ETHER | IFM_AUTO; - break; + + if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_T) { + adapter->optics = IFM_10G_T; + return; + } + + if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_T) { + adapter->optics = IFM_1000_T; + return; + } + + if (layer & (IXGBE_PHYSICAL_LAYER_10GBASE_LR | + IXGBE_PHYSICAL_LAYER_10GBASE_LRM)) { + adapter->optics = IFM_10G_LR; + return; + } + + if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_SR) { + adapter->optics = IFM_10G_SR; + return; + } + + if (layer & IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU) { + adapter->optics = IFM_10G_TWINAX; + return; + } + + if (layer & (IXGBE_PHYSICAL_LAYER_10GBASE_KX4 | + IXGBE_PHYSICAL_LAYER_10GBASE_CX4)) { + adapter->optics = IFM_10G_CX4; + return; } + + /* If we get here just set the default */ + adapter->optics = IFM_ETHER | IFM_AUTO; return; } @@ -2265,7 +2373,9 @@ ixgbe_setup_msix(struct adapter *adapter msi: msgs = pci_msi_count(dev); if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) - device_printf(adapter->dev,"Using MSI interrupt\n"); + device_printf(adapter->dev,"Using an MSI interrupt\n"); + else + device_printf(adapter->dev,"Using a Legacy interrupt\n"); return (msgs); } @@ -2412,19 +2522,21 @@ ixgbe_setup_interface(device_t dev, stru ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | IFCAP_VLAN_HWCSUM; - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; ifp->if_capabilities |= IFCAP_JUMBO_MTU; + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING + | IFCAP_VLAN_HWTSO + | IFCAP_VLAN_MTU; ifp->if_capenable = ifp->if_capabilities; /* Don't enable LRO by default */ ifp->if_capabilities |= IFCAP_LRO; /* - ** Dont turn this on by default, if vlans are + ** Don't turn this on by default, if vlans are ** created on another pseudo device (eg. lagg) ** then vlan events are not passed thru, breaking ** operation, but with HW FILTER off it works. If - ** using vlans directly on the em driver you can + ** using vlans directly on the ixgbe driver you can ** enable this and get full hardware tag filtering. */ ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; @@ -2876,6 +2988,7 @@ ixgbe_initialize_transmit_units(struct a txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(i)); break; case ixgbe_mac_82599EB: + case ixgbe_mac_X540: default: txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(i)); break; @@ -2886,6 +2999,7 @@ ixgbe_initialize_transmit_units(struct a IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL(i), txctrl); break; case ixgbe_mac_82599EB: + case ixgbe_mac_X540: default: IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL_82599(i), txctrl); break; @@ -3371,18 +3485,13 @@ ixgbe_txeof(struct tx_ring *txr) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 03:05:42 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 152EC1065674; Fri, 3 Feb 2012 03:05:42 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 034F98FC13; Fri, 3 Feb 2012 03:05:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1335fGk067245; Fri, 3 Feb 2012 03:05:41 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1335fSN067243; Fri, 3 Feb 2012 03:05:41 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201202030305.q1335fSN067243@svn.freebsd.org> From: Rick Macklem Date: Fri, 3 Feb 2012 03:05:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230928 - stable/9/sys/fs/nfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 03:05:42 -0000 Author: rmacklem Date: Fri Feb 3 03:05:41 2012 New Revision: 230928 URL: http://svn.freebsd.org/changeset/base/230928 Log: MFC: r230345 Martin Cracauer reported a problem to freebsd-current@ under the subject "Data corruption over NFS in -current". During investigation of this, I came across an ugly bogusity in the new NFS client where it replaced the cr_uid with the one used for the mount. This was done so that "system operations" like the NFSv4 Renew would be performed as the user that did the mount. However, if any other thread shares the credential with the one doing this operation, it could do an RPC (or just about anything else) as the wrong cr_uid. This patch fixes the above, by using the mount credentials instead of the one provided as an argument for this case. It appears to have fixed Martin's problem. This patch is needed for NFSv4 mounts and NFSv3 mounts against some non-FreeBSD servers that do not put post operation attributes in the NFSv3 Statfs RPC reply. Tested by: cracauer at cons.org, dim Modified: stable/9/sys/fs/nfs/nfs_commonkrpc.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/9/sys/fs/nfs/nfs_commonkrpc.c Fri Feb 3 02:15:59 2012 (r230927) +++ stable/9/sys/fs/nfs/nfs_commonkrpc.c Fri Feb 3 03:05:41 2012 (r230928) @@ -472,7 +472,7 @@ newnfs_request(struct nfsrv_descript *nd { u_int32_t *tl; time_t waituntil; - int i, j, set_uid = 0, set_sigset = 0, timeo; + int i, j, set_sigset = 0, timeo; int trycnt, error = 0, usegssname = 0, secflavour = AUTH_SYS; u_int16_t procnum; u_int trylater_delay = 1; @@ -483,8 +483,8 @@ newnfs_request(struct nfsrv_descript *nd enum clnt_stat stat; struct nfsreq *rep = NULL; char *srv_principal = NULL; - uid_t saved_uid = (uid_t)-1; sigset_t oldset; + struct ucred *authcred; if (xidp != NULL) *xidp = 0; @@ -494,6 +494,14 @@ newnfs_request(struct nfsrv_descript *nd return (ESTALE); } + /* + * Set authcred, which is used to acquire RPC credentials to + * the cred argument, by default. The crhold() should not be + * necessary, but will ensure that some future code change + * doesn't result in the credential being free'd prematurely. + */ + authcred = crhold(cred); + /* For client side interruptible mounts, mask off the signals. */ if (nmp != NULL && td != NULL && NFSHASINT(nmp)) { newnfs_set_sigmask(td, &oldset); @@ -532,13 +540,16 @@ newnfs_request(struct nfsrv_descript *nd /* * If there is a client side host based credential, * use that, otherwise use the system uid, if set. + * The system uid is in the nmp->nm_sockreq.nr_cred + * credentials. */ if (nmp->nm_krbnamelen > 0) { usegssname = 1; } else if (nmp->nm_uid != (uid_t)-1) { - saved_uid = cred->cr_uid; - cred->cr_uid = nmp->nm_uid; - set_uid = 1; + KASSERT(nmp->nm_sockreq.nr_cred != NULL, + ("newnfs_request: NULL nr_cred")); + crfree(authcred); + authcred = crhold(nmp->nm_sockreq.nr_cred); } } else if (nmp->nm_krbnamelen == 0 && nmp->nm_uid != (uid_t)-1 && cred->cr_uid == (uid_t)0) { @@ -547,10 +558,13 @@ newnfs_request(struct nfsrv_descript *nd * the system uid is set and this is root, use the * system uid, since root won't have user * credentials in a credentials cache file. + * The system uid is in the nmp->nm_sockreq.nr_cred + * credentials. */ - saved_uid = cred->cr_uid; - cred->cr_uid = nmp->nm_uid; - set_uid = 1; + KASSERT(nmp->nm_sockreq.nr_cred != NULL, + ("newnfs_request: NULL nr_cred")); + crfree(authcred); + authcred = crhold(nmp->nm_sockreq.nr_cred); } if (NFSHASINTEGRITY(nmp)) secflavour = RPCSEC_GSS_KRB5I; @@ -566,13 +580,13 @@ newnfs_request(struct nfsrv_descript *nd * Use the uid that did the mount when the RPC is doing * NFSv4 system operations, as indicated by the * ND_USEGSSNAME flag, for the AUTH_SYS case. + * The credentials in nm_sockreq.nr_cred were used for the + * mount. */ - saved_uid = cred->cr_uid; - if (nmp->nm_uid != (uid_t)-1) - cred->cr_uid = nmp->nm_uid; - else - cred->cr_uid = 0; - set_uid = 1; + KASSERT(nmp->nm_sockreq.nr_cred != NULL, + ("newnfs_request: NULL nr_cred")); + crfree(authcred); + authcred = crhold(nmp->nm_sockreq.nr_cred); } if (nmp != NULL) { @@ -588,12 +602,11 @@ newnfs_request(struct nfsrv_descript *nd auth = authnone_create(); else if (usegssname) auth = nfs_getauth(nrp, secflavour, nmp->nm_krbname, - srv_principal, NULL, cred); + srv_principal, NULL, authcred); else auth = nfs_getauth(nrp, secflavour, NULL, - srv_principal, NULL, cred); - if (set_uid) - cred->cr_uid = saved_uid; + srv_principal, NULL, authcred); + crfree(authcred); if (auth == NULL) { m_freem(nd->nd_mreq); if (set_sigset) From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 03:41:44 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BD24106564A; Fri, 3 Feb 2012 03:41:44 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A01F8FC08; Fri, 3 Feb 2012 03:41:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q133fiRX068584; Fri, 3 Feb 2012 03:41:44 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q133fiDD068582; Fri, 3 Feb 2012 03:41:44 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201202030341.q133fiDD068582@svn.freebsd.org> From: Rick Macklem Date: Fri, 3 Feb 2012 03:41: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: r230930 - stable/8/sys/fs/nfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 03:41:44 -0000 Author: rmacklem Date: Fri Feb 3 03:41:43 2012 New Revision: 230930 URL: http://svn.freebsd.org/changeset/base/230930 Log: MFC: r230345 Martin Cracauer reported a problem to freebsd-current@ under the subject "Data corruption over NFS in -current". During investigation of this, I came across an ugly bogusity in the new NFS client where it replaced the cr_uid with the one used for the mount. This was done so that "system operations" like the NFSv4 Renew would be performed as the user that did the mount. However, if any other thread shares the credential with the one doing this operation, it could do an RPC (or just about anything else) as the wrong cr_uid. This patch fixes the above, by using the mount credentials instead of the one provided as an argument for this case. It appears to have fixed Martin's problem. This patch is needed for NFSv4 mounts and NFSv3 mounts against some non-FreeBSD servers that do not put post operation attributes in the NFSv3 Statfs RPC reply. Modified: stable/8/sys/fs/nfs/nfs_commonkrpc.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/e1000/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonkrpc.c Fri Feb 3 03:11:08 2012 (r230929) +++ stable/8/sys/fs/nfs/nfs_commonkrpc.c Fri Feb 3 03:41:43 2012 (r230930) @@ -449,7 +449,7 @@ newnfs_request(struct nfsrv_descript *nd { u_int32_t *tl; time_t waituntil; - int i, j, set_uid = 0, set_sigset = 0, timeo; + int i, j, set_sigset = 0, timeo; int trycnt, error = 0, usegssname = 0, secflavour = AUTH_SYS; u_int16_t procnum; u_int trylater_delay = 1; @@ -460,8 +460,8 @@ newnfs_request(struct nfsrv_descript *nd enum clnt_stat stat; struct nfsreq *rep = NULL; char *srv_principal = NULL; - uid_t saved_uid = (uid_t)-1; sigset_t oldset; + struct ucred *authcred; if (xidp != NULL) *xidp = 0; @@ -471,6 +471,14 @@ newnfs_request(struct nfsrv_descript *nd return (ESTALE); } + /* + * Set authcred, which is used to acquire RPC credentials to + * the cred argument, by default. The crhold() should not be + * necessary, but will ensure that some future code change + * doesn't result in the credential being free'd prematurely. + */ + authcred = crhold(cred); + /* For client side interruptible mounts, mask off the signals. */ if (nmp != NULL && td != NULL && NFSHASINT(nmp)) { newnfs_set_sigmask(td, &oldset); @@ -509,13 +517,16 @@ newnfs_request(struct nfsrv_descript *nd /* * If there is a client side host based credential, * use that, otherwise use the system uid, if set. + * The system uid is in the nmp->nm_sockreq.nr_cred + * credentials. */ if (nmp->nm_krbnamelen > 0) { usegssname = 1; } else if (nmp->nm_uid != (uid_t)-1) { - saved_uid = cred->cr_uid; - cred->cr_uid = nmp->nm_uid; - set_uid = 1; + KASSERT(nmp->nm_sockreq.nr_cred != NULL, + ("newnfs_request: NULL nr_cred")); + crfree(authcred); + authcred = crhold(nmp->nm_sockreq.nr_cred); } } else if (nmp->nm_krbnamelen == 0 && nmp->nm_uid != (uid_t)-1 && cred->cr_uid == (uid_t)0) { @@ -524,10 +535,13 @@ newnfs_request(struct nfsrv_descript *nd * the system uid is set and this is root, use the * system uid, since root won't have user * credentials in a credentials cache file. + * The system uid is in the nmp->nm_sockreq.nr_cred + * credentials. */ - saved_uid = cred->cr_uid; - cred->cr_uid = nmp->nm_uid; - set_uid = 1; + KASSERT(nmp->nm_sockreq.nr_cred != NULL, + ("newnfs_request: NULL nr_cred")); + crfree(authcred); + authcred = crhold(nmp->nm_sockreq.nr_cred); } if (NFSHASINTEGRITY(nmp)) secflavour = RPCSEC_GSS_KRB5I; @@ -543,13 +557,13 @@ newnfs_request(struct nfsrv_descript *nd * Use the uid that did the mount when the RPC is doing * NFSv4 system operations, as indicated by the * ND_USEGSSNAME flag, for the AUTH_SYS case. + * The credentials in nm_sockreq.nr_cred were used for the + * mount. */ - saved_uid = cred->cr_uid; - if (nmp->nm_uid != (uid_t)-1) - cred->cr_uid = nmp->nm_uid; - else - cred->cr_uid = 0; - set_uid = 1; + KASSERT(nmp->nm_sockreq.nr_cred != NULL, + ("newnfs_request: NULL nr_cred")); + crfree(authcred); + authcred = crhold(nmp->nm_sockreq.nr_cred); } if (nmp != NULL) { @@ -565,12 +579,11 @@ newnfs_request(struct nfsrv_descript *nd auth = authnone_create(); else if (usegssname) auth = nfs_getauth(nrp, secflavour, nmp->nm_krbname, - srv_principal, NULL, cred); + srv_principal, NULL, authcred); else auth = nfs_getauth(nrp, secflavour, NULL, - srv_principal, NULL, cred); - if (set_uid) - cred->cr_uid = saved_uid; + srv_principal, NULL, authcred); + crfree(authcred); if (auth == NULL) { m_freem(nd->nd_mreq); if (set_sigset) From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 05:00:43 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FB20106566B; Fri, 3 Feb 2012 05:00:43 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C9938FC08; Fri, 3 Feb 2012 05:00:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1350h3u071109; Fri, 3 Feb 2012 05:00:43 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1350h2t071105; Fri, 3 Feb 2012 05:00:43 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201202030500.q1350h2t071105@svn.freebsd.org> From: Jack F Vogel Date: Fri, 3 Feb 2012 05:00: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: r230931 - stable/8/sys/dev/ixgbe X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 05:00:43 -0000 Author: jfv Date: Fri Feb 3 05:00:43 2012 New Revision: 230931 URL: http://svn.freebsd.org/changeset/base/230931 Log: MFC did not get the new files... Added: stable/8/sys/dev/ixgbe/ixgbe_82598.h (contents, props changed) stable/8/sys/dev/ixgbe/ixgbe_82599.h (contents, props changed) stable/8/sys/dev/ixgbe/ixgbe_x540.c (contents, props changed) stable/8/sys/dev/ixgbe/ixgbe_x540.h (contents, props changed) Added: stable/8/sys/dev/ixgbe/ixgbe_82598.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/dev/ixgbe/ixgbe_82598.h Fri Feb 3 05:00:43 2012 (r230931) @@ -0,0 +1,52 @@ +/****************************************************************************** + + Copyright (c) 2001-2012, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +******************************************************************************/ +/*$FreeBSD$*/ + +#ifndef _IXGBE_82598_H_ +#define _IXGBE_82598_H_ + +u32 ixgbe_get_pcie_msix_count_82598(struct ixgbe_hw *hw); +s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num); +s32 ixgbe_start_hw_82598(struct ixgbe_hw *hw); +void ixgbe_enable_relaxed_ordering_82598(struct ixgbe_hw *hw); +s32 ixgbe_set_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq); +s32 ixgbe_set_vfta_82598(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on); +s32 ixgbe_read_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 *val); +s32 ixgbe_write_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 val); +s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset, + u8 *eeprom_data); +u32 ixgbe_get_supported_physical_layer_82598(struct ixgbe_hw *hw); +s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw); +void ixgbe_set_lan_id_multi_port_pcie_82598(struct ixgbe_hw *hw); +void ixgbe_set_pcie_completion_timeout(struct ixgbe_hw *hw); +#endif /* _IXGBE_82598_H_ */ Added: stable/8/sys/dev/ixgbe/ixgbe_82599.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/dev/ixgbe/ixgbe_82599.h Fri Feb 3 05:00:43 2012 (r230931) @@ -0,0 +1,65 @@ +/****************************************************************************** + + Copyright (c) 2001-2012, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +******************************************************************************/ +/*$FreeBSD$*/ + +#ifndef _IXGBE_82599_H_ +#define _IXGBE_82599_H_ + +s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw, + ixgbe_link_speed *speed, bool *autoneg); +enum ixgbe_media_type ixgbe_get_media_type_82599(struct ixgbe_hw *hw); +void ixgbe_disable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw); +void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw); +void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw); +s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, + ixgbe_link_speed speed, bool autoneg, + bool autoneg_wait_to_complete); +s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, + ixgbe_link_speed speed, bool autoneg, + bool autoneg_wait_to_complete); +s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, + bool autoneg_wait_to_complete); +s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, ixgbe_link_speed speed, + bool autoneg, bool autoneg_wait_to_complete); +s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw); +void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw); +s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw); +s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val); +s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val); +s32 ixgbe_start_hw_82599(struct ixgbe_hw *hw); +s32 ixgbe_identify_phy_82599(struct ixgbe_hw *hw); +s32 ixgbe_init_phy_ops_82599(struct ixgbe_hw *hw); +u32 ixgbe_get_supported_physical_layer_82599(struct ixgbe_hw *hw); +s32 ixgbe_enable_rx_dma_82599(struct ixgbe_hw *hw, u32 regval); +bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw); +#endif /* _IXGBE_82599_H_ */ Added: stable/8/sys/dev/ixgbe/ixgbe_x540.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/dev/ixgbe/ixgbe_x540.c Fri Feb 3 05:00:43 2012 (r230931) @@ -0,0 +1,971 @@ +/****************************************************************************** + + Copyright (c) 2001-2012, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +******************************************************************************/ +/*$FreeBSD$*/ + +#include "ixgbe_x540.h" +#include "ixgbe_type.h" +#include "ixgbe_api.h" +#include "ixgbe_common.h" +#include "ixgbe_phy.h" + +static s32 ixgbe_update_flash_X540(struct ixgbe_hw *hw); +static s32 ixgbe_poll_flash_update_done_X540(struct ixgbe_hw *hw); +static s32 ixgbe_get_swfw_sync_semaphore(struct ixgbe_hw *hw); +static void ixgbe_release_swfw_sync_semaphore(struct ixgbe_hw *hw); + +/** + * ixgbe_init_ops_X540 - Inits func ptrs and MAC type + * @hw: pointer to hardware structure + * + * Initialize the function pointers and assign the MAC type for X540. + * Does not touch the hardware. + **/ +s32 ixgbe_init_ops_X540(struct ixgbe_hw *hw) +{ + struct ixgbe_mac_info *mac = &hw->mac; + struct ixgbe_phy_info *phy = &hw->phy; + struct ixgbe_eeprom_info *eeprom = &hw->eeprom; + s32 ret_val; + + DEBUGFUNC("ixgbe_init_ops_X540"); + + ret_val = ixgbe_init_phy_ops_generic(hw); + ret_val = ixgbe_init_ops_generic(hw); + + + /* EEPROM */ + eeprom->ops.init_params = &ixgbe_init_eeprom_params_X540; + eeprom->ops.read = &ixgbe_read_eerd_X540; + eeprom->ops.read_buffer = &ixgbe_read_eerd_buffer_X540; + eeprom->ops.write = &ixgbe_write_eewr_X540; + eeprom->ops.write_buffer = &ixgbe_write_eewr_buffer_X540; + eeprom->ops.update_checksum = &ixgbe_update_eeprom_checksum_X540; + eeprom->ops.validate_checksum = &ixgbe_validate_eeprom_checksum_X540; + eeprom->ops.calc_checksum = &ixgbe_calc_eeprom_checksum_X540; + + /* PHY */ + phy->ops.init = &ixgbe_init_phy_ops_generic; + phy->ops.reset = NULL; + + /* MAC */ + mac->ops.reset_hw = &ixgbe_reset_hw_X540; + mac->ops.enable_relaxed_ordering = &ixgbe_enable_relaxed_ordering_gen2; + mac->ops.get_media_type = &ixgbe_get_media_type_X540; + mac->ops.get_supported_physical_layer = + &ixgbe_get_supported_physical_layer_X540; + mac->ops.read_analog_reg8 = NULL; + mac->ops.write_analog_reg8 = NULL; + mac->ops.start_hw = &ixgbe_start_hw_X540; + mac->ops.get_san_mac_addr = &ixgbe_get_san_mac_addr_generic; + mac->ops.set_san_mac_addr = &ixgbe_set_san_mac_addr_generic; + mac->ops.get_device_caps = &ixgbe_get_device_caps_generic; + mac->ops.get_wwn_prefix = &ixgbe_get_wwn_prefix_generic; + mac->ops.get_fcoe_boot_status = &ixgbe_get_fcoe_boot_status_generic; + mac->ops.acquire_swfw_sync = &ixgbe_acquire_swfw_sync_X540; + mac->ops.release_swfw_sync = &ixgbe_release_swfw_sync_X540; + mac->ops.disable_sec_rx_path = &ixgbe_disable_sec_rx_path_generic; + mac->ops.enable_sec_rx_path = &ixgbe_enable_sec_rx_path_generic; + + /* RAR, Multicast, VLAN */ + mac->ops.set_vmdq = &ixgbe_set_vmdq_generic; + mac->ops.clear_vmdq = &ixgbe_clear_vmdq_generic; + mac->ops.insert_mac_addr = &ixgbe_insert_mac_addr_generic; + mac->rar_highwater = 1; + mac->ops.set_vfta = &ixgbe_set_vfta_generic; + mac->ops.set_vlvf = &ixgbe_set_vlvf_generic; + mac->ops.clear_vfta = &ixgbe_clear_vfta_generic; + mac->ops.init_uta_tables = &ixgbe_init_uta_tables_generic; + mac->ops.set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing; + mac->ops.set_vlan_anti_spoofing = &ixgbe_set_vlan_anti_spoofing; + + /* Link */ + mac->ops.get_link_capabilities = + &ixgbe_get_copper_link_capabilities_generic; + mac->ops.setup_link = &ixgbe_setup_mac_link_X540; + mac->ops.setup_rxpba = &ixgbe_set_rxpba_generic; + mac->ops.check_link = &ixgbe_check_mac_link_generic; + + mac->mcft_size = 128; + mac->vft_size = 128; + mac->num_rar_entries = 128; + mac->rx_pb_size = 384; + mac->max_tx_queues = 128; + mac->max_rx_queues = 128; + mac->max_msix_vectors = ixgbe_get_pcie_msix_count_generic(hw); + + /* + * FWSM register + * ARC supported; valid only if manageability features are + * enabled. + */ + mac->arc_subsystem_valid = (IXGBE_READ_REG(hw, IXGBE_FWSM) & + IXGBE_FWSM_MODE_MASK) ? TRUE : FALSE; + + hw->mbx.ops.init_params = ixgbe_init_mbx_params_pf; + + /* LEDs */ + mac->ops.blink_led_start = ixgbe_blink_led_start_X540; + mac->ops.blink_led_stop = ixgbe_blink_led_stop_X540; + + /* Manageability interface */ + mac->ops.set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic; + + return ret_val; +} + +/** + * ixgbe_get_link_capabilities_X540 - Determines link capabilities + * @hw: pointer to hardware structure + * @speed: pointer to link speed + * @autoneg: TRUE when autoneg or autotry is enabled + * + * Determines the link capabilities by reading the AUTOC register. + **/ +s32 ixgbe_get_link_capabilities_X540(struct ixgbe_hw *hw, + ixgbe_link_speed *speed, + bool *autoneg) +{ + ixgbe_get_copper_link_capabilities_generic(hw, speed, autoneg); + + return IXGBE_SUCCESS; +} + +/** + * ixgbe_get_media_type_X540 - Get media type + * @hw: pointer to hardware structure + * + * Returns the media type (fiber, copper, backplane) + **/ +enum ixgbe_media_type ixgbe_get_media_type_X540(struct ixgbe_hw *hw) +{ + UNREFERENCED_1PARAMETER(hw); + return ixgbe_media_type_copper; +} + +/** + * ixgbe_setup_mac_link_X540 - Sets the auto advertised capabilities + * @hw: pointer to hardware structure + * @speed: new link speed + * @autoneg: TRUE if autonegotiation enabled + * @autoneg_wait_to_complete: TRUE when waiting for completion is needed + **/ +s32 ixgbe_setup_mac_link_X540(struct ixgbe_hw *hw, + ixgbe_link_speed speed, bool autoneg, + bool autoneg_wait_to_complete) +{ + DEBUGFUNC("ixgbe_setup_mac_link_X540"); + return hw->phy.ops.setup_link_speed(hw, speed, autoneg, + autoneg_wait_to_complete); +} + +/** + * ixgbe_reset_hw_X540 - Perform hardware reset + * @hw: pointer to hardware structure + * + * Resets the hardware by resetting the transmit and receive units, masks + * and clears all interrupts, and perform a reset. + **/ +s32 ixgbe_reset_hw_X540(struct ixgbe_hw *hw) +{ + s32 status; + u32 ctrl, i; + + DEBUGFUNC("ixgbe_reset_hw_X540"); + + /* Call adapter stop to disable tx/rx and clear interrupts */ + status = hw->mac.ops.stop_adapter(hw); + if (status != IXGBE_SUCCESS) + goto reset_hw_out; + + /* flush pending Tx transactions */ + ixgbe_clear_tx_pending(hw); + +mac_reset_top: + ctrl = IXGBE_CTRL_RST; + ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL); + IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl); + IXGBE_WRITE_FLUSH(hw); + + /* Poll for reset bit to self-clear indicating reset is complete */ + for (i = 0; i < 10; i++) { + usec_delay(1); + ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL); + if (!(ctrl & IXGBE_CTRL_RST_MASK)) + break; + } + + if (ctrl & IXGBE_CTRL_RST_MASK) { + status = IXGBE_ERR_RESET_FAILED; + DEBUGOUT("Reset polling failed to complete.\n"); + } + msec_delay(100); + + /* + * Double resets are required for recovery from certain error + * conditions. Between resets, it is necessary to stall to allow time + * for any pending HW events to complete. + */ + if (hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED) { + hw->mac.flags &= ~IXGBE_FLAGS_DOUBLE_RESET_REQUIRED; + goto mac_reset_top; + } + + /* Set the Rx packet buffer size. */ + IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(0), 384 << IXGBE_RXPBSIZE_SHIFT); + + /* Store the permanent mac address */ + hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); + + /* + * Store MAC address from RAR0, clear receive address registers, and + * clear the multicast table. Also reset num_rar_entries to 128, + * since we modify this value when programming the SAN MAC address. + */ + hw->mac.num_rar_entries = 128; + hw->mac.ops.init_rx_addrs(hw); + + /* Store the permanent SAN mac address */ + hw->mac.ops.get_san_mac_addr(hw, hw->mac.san_addr); + + /* Add the SAN MAC address to the RAR only if it's a valid address */ + if (ixgbe_validate_mac_addr(hw->mac.san_addr) == 0) { + hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1, + hw->mac.san_addr, 0, IXGBE_RAH_AV); + + /* Reserve the last RAR for the SAN MAC address */ + hw->mac.num_rar_entries--; + } + + /* Store the alternative WWNN/WWPN prefix */ + hw->mac.ops.get_wwn_prefix(hw, &hw->mac.wwnn_prefix, + &hw->mac.wwpn_prefix); + +reset_hw_out: + return status; +} + +/** + * ixgbe_start_hw_X540 - Prepare hardware for Tx/Rx + * @hw: pointer to hardware structure + * + * Starts the hardware using the generic start_hw function + * and the generation start_hw function. + * Then performs revision-specific operations, if any. + **/ +s32 ixgbe_start_hw_X540(struct ixgbe_hw *hw) +{ + s32 ret_val = IXGBE_SUCCESS; + + DEBUGFUNC("ixgbe_start_hw_X540"); + + ret_val = ixgbe_start_hw_generic(hw); + if (ret_val != IXGBE_SUCCESS) + goto out; + + ret_val = ixgbe_start_hw_gen2(hw); + +out: + return ret_val; +} + +/** + * ixgbe_get_supported_physical_layer_X540 - Returns physical layer type + * @hw: pointer to hardware structure + * + * Determines physical layer capabilities of the current configuration. + **/ +u32 ixgbe_get_supported_physical_layer_X540(struct ixgbe_hw *hw) +{ + u32 physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN; + u16 ext_ability = 0; + + DEBUGFUNC("ixgbe_get_supported_physical_layer_X540"); + + hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_EXT_ABILITY, + IXGBE_MDIO_PMA_PMD_DEV_TYPE, &ext_ability); + if (ext_ability & IXGBE_MDIO_PHY_10GBASET_ABILITY) + physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_T; + if (ext_ability & IXGBE_MDIO_PHY_1000BASET_ABILITY) + physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_T; + if (ext_ability & IXGBE_MDIO_PHY_100BASETX_ABILITY) + physical_layer |= IXGBE_PHYSICAL_LAYER_100BASE_TX; + + return physical_layer; +} + +/** + * ixgbe_init_eeprom_params_X540 - Initialize EEPROM params + * @hw: pointer to hardware structure + * + * Initializes the EEPROM parameters ixgbe_eeprom_info within the + * ixgbe_hw struct in order to set up EEPROM access. + **/ +s32 ixgbe_init_eeprom_params_X540(struct ixgbe_hw *hw) +{ + struct ixgbe_eeprom_info *eeprom = &hw->eeprom; + u32 eec; + u16 eeprom_size; + + DEBUGFUNC("ixgbe_init_eeprom_params_X540"); + + if (eeprom->type == ixgbe_eeprom_uninitialized) { + eeprom->semaphore_delay = 10; + eeprom->type = ixgbe_flash; + + eec = IXGBE_READ_REG(hw, IXGBE_EEC); + eeprom_size = (u16)((eec & IXGBE_EEC_SIZE) >> + IXGBE_EEC_SIZE_SHIFT); + eeprom->word_size = 1 << (eeprom_size + + IXGBE_EEPROM_WORD_SIZE_SHIFT); + + DEBUGOUT2("Eeprom params: type = %d, size = %d\n", + eeprom->type, eeprom->word_size); + } + + return IXGBE_SUCCESS; +} + +/** + * ixgbe_read_eerd_X540- Read EEPROM word using EERD + * @hw: pointer to hardware structure + * @offset: offset of word in the EEPROM to read + * @data: word read from the EEPROM + * + * Reads a 16 bit word from the EEPROM using the EERD register. + **/ +s32 ixgbe_read_eerd_X540(struct ixgbe_hw *hw, u16 offset, u16 *data) +{ + s32 status = IXGBE_SUCCESS; + + DEBUGFUNC("ixgbe_read_eerd_X540"); + if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) == + IXGBE_SUCCESS) + status = ixgbe_read_eerd_generic(hw, offset, data); + else + status = IXGBE_ERR_SWFW_SYNC; + + hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); + return status; +} + +/** + * ixgbe_read_eerd_buffer_X540- Read EEPROM word(s) using EERD + * @hw: pointer to hardware structure + * @offset: offset of word in the EEPROM to read + * @words: number of words + * @data: word(s) read from the EEPROM + * + * Reads a 16 bit word(s) from the EEPROM using the EERD register. + **/ +s32 ixgbe_read_eerd_buffer_X540(struct ixgbe_hw *hw, + u16 offset, u16 words, u16 *data) +{ + s32 status = IXGBE_SUCCESS; + + DEBUGFUNC("ixgbe_read_eerd_buffer_X540"); + if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) == + IXGBE_SUCCESS) + status = ixgbe_read_eerd_buffer_generic(hw, offset, + words, data); + else + status = IXGBE_ERR_SWFW_SYNC; + + hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); + return status; +} + +/** + * ixgbe_write_eewr_X540 - Write EEPROM word using EEWR + * @hw: pointer to hardware structure + * @offset: offset of word in the EEPROM to write + * @data: word write to the EEPROM + * + * Write a 16 bit word to the EEPROM using the EEWR register. + **/ +s32 ixgbe_write_eewr_X540(struct ixgbe_hw *hw, u16 offset, u16 data) +{ + s32 status = IXGBE_SUCCESS; + + DEBUGFUNC("ixgbe_write_eewr_X540"); + if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) == + IXGBE_SUCCESS) + status = ixgbe_write_eewr_generic(hw, offset, data); + else + status = IXGBE_ERR_SWFW_SYNC; + + hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); + return status; +} + +/** + * ixgbe_write_eewr_buffer_X540 - Write EEPROM word(s) using EEWR + * @hw: pointer to hardware structure + * @offset: offset of word in the EEPROM to write + * @words: number of words + * @data: word(s) write to the EEPROM + * + * Write a 16 bit word(s) to the EEPROM using the EEWR register. + **/ +s32 ixgbe_write_eewr_buffer_X540(struct ixgbe_hw *hw, + u16 offset, u16 words, u16 *data) +{ + s32 status = IXGBE_SUCCESS; + + DEBUGFUNC("ixgbe_write_eewr_buffer_X540"); + if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) == + IXGBE_SUCCESS) + status = ixgbe_write_eewr_buffer_generic(hw, offset, + words, data); + else + status = IXGBE_ERR_SWFW_SYNC; + + hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); + return status; +} + +/** + * ixgbe_calc_eeprom_checksum_X540 - Calculates and returns the checksum + * + * This function does not use synchronization for EERD and EEWR. It can + * be used internally by function which utilize ixgbe_acquire_swfw_sync_X540. + * + * @hw: pointer to hardware structure + **/ +u16 ixgbe_calc_eeprom_checksum_X540(struct ixgbe_hw *hw) +{ + u16 i; + u16 j; + u16 checksum = 0; + u16 length = 0; + u16 pointer = 0; + u16 word = 0; + + /* + * Do not use hw->eeprom.ops.read because we do not want to take + * the synchronization semaphores here. Instead use + * ixgbe_read_eerd_generic + */ + + DEBUGFUNC("ixgbe_calc_eeprom_checksum_X540"); + + /* Include 0x0-0x3F in the checksum */ + for (i = 0; i < IXGBE_EEPROM_CHECKSUM; i++) { + if (ixgbe_read_eerd_generic(hw, i, &word) != IXGBE_SUCCESS) { + DEBUGOUT("EEPROM read failed\n"); + break; + } + checksum += word; + } + + /* + * Include all data from pointers 0x3, 0x6-0xE. This excludes the + * FW, PHY module, and PCIe Expansion/Option ROM pointers. + */ + for (i = IXGBE_PCIE_ANALOG_PTR; i < IXGBE_FW_PTR; i++) { + if (i == IXGBE_PHY_PTR || i == IXGBE_OPTION_ROM_PTR) + continue; + + if (ixgbe_read_eerd_generic(hw, i, &pointer) != IXGBE_SUCCESS) { + DEBUGOUT("EEPROM read failed\n"); + break; + } + + /* Skip pointer section if the pointer is invalid. */ + if (pointer == 0xFFFF || pointer == 0 || + pointer >= hw->eeprom.word_size) + continue; + + if (ixgbe_read_eerd_generic(hw, pointer, &length) != + IXGBE_SUCCESS) { + DEBUGOUT("EEPROM read failed\n"); + break; + } + + /* Skip pointer section if length is invalid. */ + if (length == 0xFFFF || length == 0 || + (pointer + length) >= hw->eeprom.word_size) + continue; + + for (j = pointer+1; j <= pointer+length; j++) { + if (ixgbe_read_eerd_generic(hw, j, &word) != + IXGBE_SUCCESS) { + DEBUGOUT("EEPROM read failed\n"); + break; + } + checksum += word; + } + } + + checksum = (u16)IXGBE_EEPROM_SUM - checksum; + + return checksum; +} + +/** + * ixgbe_validate_eeprom_checksum_X540 - Validate EEPROM checksum + * @hw: pointer to hardware structure + * @checksum_val: calculated checksum + * + * Performs checksum calculation and validates the EEPROM checksum. If the + * caller does not need checksum_val, the value can be NULL. + **/ +s32 ixgbe_validate_eeprom_checksum_X540(struct ixgbe_hw *hw, + u16 *checksum_val) +{ + s32 status; + u16 checksum; + u16 read_checksum = 0; + + DEBUGFUNC("ixgbe_validate_eeprom_checksum_X540"); + + /* + * Read the first word from the EEPROM. If this times out or fails, do + * not continue or we could be in for a very long wait while every + * EEPROM read fails + */ + status = hw->eeprom.ops.read(hw, 0, &checksum); + + if (status != IXGBE_SUCCESS) { + DEBUGOUT("EEPROM read failed\n"); + goto out; + } + + if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) == + IXGBE_SUCCESS) { + checksum = hw->eeprom.ops.calc_checksum(hw); + + /* + * Do not use hw->eeprom.ops.read because we do not want to take + * the synchronization semaphores twice here. + */ + ixgbe_read_eerd_generic(hw, IXGBE_EEPROM_CHECKSUM, + &read_checksum); + + /* + * Verify read checksum from EEPROM is the same as + * calculated checksum + */ + if (read_checksum != checksum) + status = IXGBE_ERR_EEPROM_CHECKSUM; + + /* If the user cares, return the calculated checksum */ + if (checksum_val) + *checksum_val = checksum; + } else { + status = IXGBE_ERR_SWFW_SYNC; + } + + hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); +out: + return status; +} + +/** + * ixgbe_update_eeprom_checksum_X540 - Updates the EEPROM checksum and flash + * @hw: pointer to hardware structure + * + * After writing EEPROM to shadow RAM using EEWR register, software calculates + * checksum and updates the EEPROM and instructs the hardware to update + * the flash. + **/ +s32 ixgbe_update_eeprom_checksum_X540(struct ixgbe_hw *hw) +{ + s32 status; + u16 checksum; + + DEBUGFUNC("ixgbe_update_eeprom_checksum_X540"); + + /* + * Read the first word from the EEPROM. If this times out or fails, do + * not continue or we could be in for a very long wait while every + * EEPROM read fails + */ + status = hw->eeprom.ops.read(hw, 0, &checksum); + + if (status != IXGBE_SUCCESS) + DEBUGOUT("EEPROM read failed\n"); + + if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) == + IXGBE_SUCCESS) { + checksum = hw->eeprom.ops.calc_checksum(hw); + + /* + * Do not use hw->eeprom.ops.write because we do not want to + * take the synchronization semaphores twice here. + */ + status = ixgbe_write_eewr_generic(hw, IXGBE_EEPROM_CHECKSUM, + checksum); + + if (status == IXGBE_SUCCESS) + status = ixgbe_update_flash_X540(hw); + else + status = IXGBE_ERR_SWFW_SYNC; + } + + hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); + + return status; +} + +/** + * ixgbe_update_flash_X540 - Instruct HW to copy EEPROM to Flash device + * @hw: pointer to hardware structure + * + * Set FLUP (bit 23) of the EEC register to instruct Hardware to copy + * EEPROM from shadow RAM to the flash device. + **/ +static s32 ixgbe_update_flash_X540(struct ixgbe_hw *hw) +{ + u32 flup; + s32 status = IXGBE_ERR_EEPROM; + + DEBUGFUNC("ixgbe_update_flash_X540"); + + status = ixgbe_poll_flash_update_done_X540(hw); + if (status == IXGBE_ERR_EEPROM) { + DEBUGOUT("Flash update time out\n"); + goto out; + } + + flup = IXGBE_READ_REG(hw, IXGBE_EEC) | IXGBE_EEC_FLUP; + IXGBE_WRITE_REG(hw, IXGBE_EEC, flup); + + status = ixgbe_poll_flash_update_done_X540(hw); + if (status == IXGBE_SUCCESS) + DEBUGOUT("Flash update complete\n"); + else + DEBUGOUT("Flash update time out\n"); + + if (hw->revision_id == 0) { + flup = IXGBE_READ_REG(hw, IXGBE_EEC); + + if (flup & IXGBE_EEC_SEC1VAL) { + flup |= IXGBE_EEC_FLUP; + IXGBE_WRITE_REG(hw, IXGBE_EEC, flup); + } + + status = ixgbe_poll_flash_update_done_X540(hw); + if (status == IXGBE_SUCCESS) + DEBUGOUT("Flash update complete\n"); + else + DEBUGOUT("Flash update time out\n"); + } +out: + return status; +} + +/** + * ixgbe_poll_flash_update_done_X540 - Poll flash update status + * @hw: pointer to hardware structure + * + * Polls the FLUDONE (bit 26) of the EEC Register to determine when the + * flash update is done. + **/ +static s32 ixgbe_poll_flash_update_done_X540(struct ixgbe_hw *hw) +{ + u32 i; + u32 reg; + s32 status = IXGBE_ERR_EEPROM; + + DEBUGFUNC("ixgbe_poll_flash_update_done_X540"); + + for (i = 0; i < IXGBE_FLUDONE_ATTEMPTS; i++) { + reg = IXGBE_READ_REG(hw, IXGBE_EEC); + if (reg & IXGBE_EEC_FLUDONE) { + status = IXGBE_SUCCESS; + break; + } + usec_delay(5); + } + return status; +} + +/** + * ixgbe_acquire_swfw_sync_X540 - Acquire SWFW semaphore + * @hw: pointer to hardware structure + * @mask: Mask to specify which semaphore to acquire + * + * Acquires the SWFW semaphore thought the SW_FW_SYNC register for + * the specified function (CSR, PHY0, PHY1, NVM, Flash) + **/ +s32 ixgbe_acquire_swfw_sync_X540(struct ixgbe_hw *hw, u16 mask) +{ + u32 swfw_sync; + u32 swmask = mask; + u32 fwmask = mask << 5; + u32 hwmask = 0; + u32 timeout = 200; + u32 i; + s32 ret_val = IXGBE_SUCCESS; + + DEBUGFUNC("ixgbe_acquire_swfw_sync_X540"); + + if (swmask == IXGBE_GSSR_EEP_SM) + hwmask = IXGBE_GSSR_FLASH_SM; + + /* SW only mask doesn't have FW bit pair */ + if (swmask == IXGBE_GSSR_SW_MNG_SM) + fwmask = 0; + + for (i = 0; i < timeout; i++) { + /* + * SW NVM semaphore bit is used for access to all + * SW_FW_SYNC bits (not just NVM) + */ + if (ixgbe_get_swfw_sync_semaphore(hw)) { + ret_val = IXGBE_ERR_SWFW_SYNC; + goto out; + } + + swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC); + if (!(swfw_sync & (fwmask | swmask | hwmask))) { + swfw_sync |= swmask; + IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC, swfw_sync); + ixgbe_release_swfw_sync_semaphore(hw); + msec_delay(5); + goto out; + } else { + /* + * Firmware currently using resource (fwmask), hardware + * currently using resource (hwmask), or other software + * thread currently using resource (swmask) + */ + ixgbe_release_swfw_sync_semaphore(hw); + msec_delay(5); + } + } + + /* Failed to get SW only semaphore */ + if (swmask == IXGBE_GSSR_SW_MNG_SM) { + ret_val = IXGBE_ERR_SWFW_SYNC; + goto out; + } + + /* If the resource is not released by the FW/HW the SW can assume that + * the FW/HW malfunctions. In that case the SW should sets the SW bit(s) + * of the requested resource(s) while ignoring the corresponding FW/HW + * bits in the SW_FW_SYNC register. + */ + swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC); + if (swfw_sync & (fwmask | hwmask)) { + if (ixgbe_get_swfw_sync_semaphore(hw)) { + ret_val = IXGBE_ERR_SWFW_SYNC; + goto out; + } + + swfw_sync |= swmask; + IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC, swfw_sync); + ixgbe_release_swfw_sync_semaphore(hw); + msec_delay(5); + } + +out: + return ret_val; +} + +/** + * ixgbe_release_swfw_sync_X540 - Release SWFW semaphore + * @hw: pointer to hardware structure + * @mask: Mask to specify which semaphore to release + * + * Releases the SWFW semaphore throught the SW_FW_SYNC register + * for the specified function (CSR, PHY0, PHY1, EVM, Flash) + **/ +void ixgbe_release_swfw_sync_X540(struct ixgbe_hw *hw, u16 mask) +{ + u32 swfw_sync; + u32 swmask = mask; + + DEBUGFUNC("ixgbe_release_swfw_sync_X540"); + + ixgbe_get_swfw_sync_semaphore(hw); + + swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC); + swfw_sync &= ~swmask; + IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC, swfw_sync); + + ixgbe_release_swfw_sync_semaphore(hw); + msec_delay(5); +} + +/** + * ixgbe_get_nvm_semaphore - Get hardware semaphore + * @hw: pointer to hardware structure + * + * Sets the hardware semaphores so SW/FW can gain control of shared resources + **/ +static s32 ixgbe_get_swfw_sync_semaphore(struct ixgbe_hw *hw) +{ + s32 status = IXGBE_ERR_EEPROM; + u32 timeout = 2000; + u32 i; + u32 swsm; + + DEBUGFUNC("ixgbe_get_swfw_sync_semaphore"); + + /* Get SMBI software semaphore between device drivers first */ + for (i = 0; i < timeout; i++) { + /* + * If the SMBI bit is 0 when we read it, then the bit will be + * set and we have the semaphore + */ + swsm = IXGBE_READ_REG(hw, IXGBE_SWSM); + if (!(swsm & IXGBE_SWSM_SMBI)) { + status = IXGBE_SUCCESS; + break; + } + usec_delay(50); + } + + /* Now get the semaphore between SW/FW through the REGSMP bit */ + if (status == IXGBE_SUCCESS) { + for (i = 0; i < timeout; i++) { + swsm = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC); + if (!(swsm & IXGBE_SWFW_REGSMP)) + break; + + usec_delay(50); + } + + /* + * Release semaphores and return error if SW NVM semaphore + * was not granted because we don't have access to the EEPROM + */ + if (i >= timeout) { + DEBUGOUT("REGSMP Software NVM semaphore not " + "granted.\n"); + ixgbe_release_swfw_sync_semaphore(hw); + status = IXGBE_ERR_EEPROM; + } + } else { + DEBUGOUT("Software semaphore SMBI between device drivers " + "not granted.\n"); + } + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 17:36:32 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E71BF106566B; Fri, 3 Feb 2012 17:36:32 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D15598FC08; Fri, 3 Feb 2012 17:36:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13HaWNn097193; Fri, 3 Feb 2012 17:36:32 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13HaWsY097191; Fri, 3 Feb 2012 17:36:32 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201202031736.q13HaWsY097191@svn.freebsd.org> From: Ed Schouten Date: Fri, 3 Feb 2012 17:36:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230951 - stable/9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 17:36:33 -0000 Author: ed Date: Fri Feb 3 17:36:32 2012 New Revision: 230951 URL: http://svn.freebsd.org/changeset/base/230951 Log: MFC r226785: Attempt to fix build logic for gensnmptree. There are two problems with the existing logic. It builds gensnmptree on <700018, even if WITHOUT_BSNMP is set, but more importantly, we must not forget to build gensnmptree on systems that have originally been built without. This causes a buildworld on those systems to fail. Modified: stable/9/Makefile.inc1 (contents, props changed) Directory Properties: stable/9/ (props changed) Modified: stable/9/Makefile.inc1 ============================================================================== --- stable/9/Makefile.inc1 Fri Feb 3 15:39:13 2012 (r230950) +++ stable/9/Makefile.inc1 Fri Feb 3 17:36:32 2012 (r230951) @@ -1029,7 +1029,8 @@ _yacc= usr.bin/yacc _awk= usr.bin/awk .endif -.if ${BOOTSTRAPPING} < 700018 +.if ${MK_BSNMP} != "no" && \ + (${BOOTSTRAPPING} < 700018 || !exists(/usr/sbin/gensnmptree)) _gensnmptree= usr.sbin/bsnmpd/gensnmptree .endif From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 17:50:40 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FB46106566C; Fri, 3 Feb 2012 17:50:40 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EDCDD8FC16; Fri, 3 Feb 2012 17:50:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13Hodoo097660; Fri, 3 Feb 2012 17:50:39 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13HodDw097658; Fri, 3 Feb 2012 17:50:39 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201202031750.q13HodDw097658@svn.freebsd.org> From: Ed Schouten Date: Fri, 3 Feb 2012 17:50:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230952 - stable/9/lib/libpam/modules/pam_lastlog X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 17:50:40 -0000 Author: ed Date: Fri Feb 3 17:50:39 2012 New Revision: 230952 URL: http://svn.freebsd.org/changeset/base/230952 Log: MFC r227314: Ensure pam_lastlog removes the /dev/ component of the TTY name. Some consumers of PAM remove the /dev/ component (i.e. login), while others don't (i.e. su). We must ensure that the /dev/ component is removed to ensure that the utmpx entries properly work with tools such as w(1). Modified: stable/9/lib/libpam/modules/pam_lastlog/pam_lastlog.c Directory Properties: stable/9/lib/libpam/ (props changed) Modified: stable/9/lib/libpam/modules/pam_lastlog/pam_lastlog.c ============================================================================== --- stable/9/lib/libpam/modules/pam_lastlog/pam_lastlog.c Fri Feb 3 17:36:32 2012 (r230951) +++ stable/9/lib/libpam/modules/pam_lastlog/pam_lastlog.c Fri Feb 3 17:50:39 2012 (r230952) @@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$"); #define _BSD_SOURCE #include + +#include #include #include #include @@ -96,6 +98,9 @@ pam_sm_open_session(pam_handle_t *pamh, pam_err = PAM_SERVICE_ERR; goto err; } + /* Strip /dev/ component. */ + if (strncmp(tty, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) + tty = (const char *)tty + sizeof(_PATH_DEV) - 1; if ((flags & PAM_SILENT) == 0) { if (setutxdb(UTXDB_LASTLOGIN, NULL) != 0) { From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 18:48:40 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A54221065676; Fri, 3 Feb 2012 18:48:40 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F1D78FC13; Fri, 3 Feb 2012 18:48:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13ImegJ099559; Fri, 3 Feb 2012 18:48:40 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13ImeTU099556; Fri, 3 Feb 2012 18:48:40 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201202031848.q13ImeTU099556@svn.freebsd.org> From: Ed Schouten Date: Fri, 3 Feb 2012 18:48:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230953 - in stable/9/sys: net netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 18:48:40 -0000 Author: ed Date: Fri Feb 3 18:48:40 2012 New Revision: 230953 URL: http://svn.freebsd.org/changeset/base/230953 Log: MFC r226610: Add missing #includes. According to POSIX, these two header files should be able to be included by themselves, not depending on other headers. The header uses struct sockaddr when __BSD_VISIBLE=1, while uses integer datatypes (u_int32_t, u_short, etc). Modified: stable/9/sys/net/if.h stable/9/sys/netinet/tcp.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/net/if.h ============================================================================== --- stable/9/sys/net/if.h Fri Feb 3 17:50:39 2012 (r230952) +++ stable/9/sys/net/if.h Fri Feb 3 18:48:40 2012 (r230953) @@ -43,9 +43,11 @@ /* * does not depend on on most other systems. This * helps userland compatibility. (struct timeval ifi_lastchange) + * The same holds for . (struct sockaddr ifru_addr) */ #ifndef _KERNEL #include +#include #endif struct ifnet; Modified: stable/9/sys/netinet/tcp.h ============================================================================== --- stable/9/sys/netinet/tcp.h Fri Feb 3 17:50:39 2012 (r230952) +++ stable/9/sys/netinet/tcp.h Fri Feb 3 18:48:40 2012 (r230953) @@ -34,6 +34,7 @@ #define _NETINET_TCP_H_ #include +#include #if __BSD_VISIBLE From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 20:24:19 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D30C106566B; Fri, 3 Feb 2012 20:24:19 +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 17DFD8FC0A; Fri, 3 Feb 2012 20:24:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13KOIkb002735; Fri, 3 Feb 2012 20:24:18 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13KOICY002733; Fri, 3 Feb 2012 20:24:18 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201202032024.q13KOICY002733@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 3 Feb 2012 20:24:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230955 - stable/9/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 20:24:19 -0000 Author: jilles Date: Fri Feb 3 20:24:18 2012 New Revision: 230955 URL: http://svn.freebsd.org/changeset/base/230955 Log: MFC r228510: Fix select/poll/kqueue for write on reverse direction before first write. The reverse direction of a pipe is lazily allocated on the first write in that direction (because pipes are usually used in one direction only). A special case is needed to ensure the pipe appears writable before the first write because there are 0 bytes of pending data in 0 bytes of buffer space at that point, leaving 0 bytes of data that can be written with the normal code. Note that the first write returns [ENOMEM] if kern.ipc.maxpipekva is exceeded and does not block or return [EAGAIN], so selecting true for write is correct even in that case. PR: kern/93685 Modified: stable/9/sys/kern/sys_pipe.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/sys_pipe.c ============================================================================== --- stable/9/sys/kern/sys_pipe.c Fri Feb 3 20:20:30 2012 (r230954) +++ stable/9/sys/kern/sys_pipe.c Fri Feb 3 20:24:18 2012 (r230955) @@ -1349,7 +1349,8 @@ pipe_poll(fp, events, active_cred, td) if (wpipe->pipe_present != PIPE_ACTIVE || (wpipe->pipe_state & PIPE_EOF) || (((wpipe->pipe_state & PIPE_DIRECTW) == 0) && - (wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) >= PIPE_BUF)) + ((wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) >= PIPE_BUF || + wpipe->pipe_buffer.size == 0))) revents |= events & (POLLOUT | POLLWRNORM); if ((events & POLLINIGNEOF) == 0) { @@ -1660,7 +1661,8 @@ filt_pipewrite(struct knote *kn, long hi PIPE_UNLOCK(rpipe); return (1); } - kn->kn_data = wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt; + kn->kn_data = (wpipe->pipe_buffer.size > 0) ? + (wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) : PIPE_BUF; if (wpipe->pipe_state & PIPE_DIRECTW) kn->kn_data = 0; From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 20:27:14 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C63C01065672; Fri, 3 Feb 2012 20:27:14 +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 A7A908FC14; Fri, 3 Feb 2012 20:27:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13KREx5002873; Fri, 3 Feb 2012 20:27:14 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13KREPW002872; Fri, 3 Feb 2012 20:27:14 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201202032027.q13KREPW002872@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 3 Feb 2012 20:27:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230956 - stable/9/tools/regression/pipe X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 20:27:15 -0000 Author: jilles Date: Fri Feb 3 20:27:14 2012 New Revision: 230956 URL: http://svn.freebsd.org/changeset/base/230956 Log: MFC r228512: Add test for r228510 (MFC'ed as r230955). Added: stable/9/tools/regression/pipe/pipe-reverse2.c - copied unchanged from r228512, head/tools/regression/pipe/pipe-reverse2.c Modified: Directory Properties: stable/9/tools/regression/pipe/ (props changed) Copied: stable/9/tools/regression/pipe/pipe-reverse2.c (from r228512, head/tools/regression/pipe/pipe-reverse2.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/pipe/pipe-reverse2.c Fri Feb 3 20:27:14 2012 (r230956, copy of r228512, head/tools/regression/pipe/pipe-reverse2.c) @@ -0,0 +1,67 @@ +/*- + * Copyright (c) 2010 Jilles Tjoelker + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +#include +#include +#include + +/* + * Check that pipes can be selected for writing in the reverse direction. + */ +int +main(int argc, char *argv[]) +{ + int pip[2]; + fd_set set; + int n; + + if (pipe(pip) == -1) + err(1, "FAIL: pipe"); + + FD_ZERO(&set); + FD_SET(pip[0], &set); + n = select(pip[1] + 1, NULL, &set, NULL, &(struct timeval){ 0, 0 }); + if (n != 1) + errx(1, "FAIL: select initial reverse direction"); + + n = write(pip[0], "x", 1); + if (n != 1) + err(1, "FAIL: write reverse direction"); + + FD_ZERO(&set); + FD_SET(pip[0], &set); + n = select(pip[1] + 1, NULL, &set, NULL, &(struct timeval){ 0, 0 }); + if (n != 1) + errx(1, "FAIL: select reverse direction after write"); + + printf("PASS\n"); + + return (0); +} From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 21:26:26 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BA47106564A; Fri, 3 Feb 2012 21:26:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AAB68FC0C; Fri, 3 Feb 2012 21:26:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13LQQiN004825; Fri, 3 Feb 2012 21:26:26 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13LQQQ8004822; Fri, 3 Feb 2012 21:26:26 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201202032126.q13LQQQ8004822@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 3 Feb 2012 21:26:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230959 - stable/8/contrib/gcc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 21:26:26 -0000 Author: pfg Date: Fri Feb 3 21:26:25 2012 New Revision: 230959 URL: http://svn.freebsd.org/changeset/base/230959 Log: MFC: r228756 Clean an inconsistency with -ffinite-math-only. Backported from the gcc-4_3-branch, revision (118001) under the GPLv2. This issue was also fixed in Apple's gcc. PR: 157025 Reviewed by: mm Approved by: jhb (mentor) Modified: stable/8/contrib/gcc/ChangeLog.gcc43 stable/8/contrib/gcc/builtins.c Directory Properties: stable/8/contrib/gcc/ (props changed) Modified: stable/8/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- stable/8/contrib/gcc/ChangeLog.gcc43 Fri Feb 3 21:24:28 2012 (r230958) +++ stable/8/contrib/gcc/ChangeLog.gcc43 Fri Feb 3 21:26:25 2012 (r230959) @@ -96,6 +96,14 @@ * doc/invoke.texi: Add entry about geode processor. +2006-10-24 Richard Guenther + + PR middle-end/28796 + * builtins.c (fold_builtin_classify): Use HONOR_INFINITIES + and HONOR_NANS instead of MODE_HAS_INFINITIES and MODE_HAS_NANS + for deciding optimizations in consistency with fold-const.c + (fold_builtin_unordered_cmp): Likewise. + 2006-10-22 H.J. Lu (r117958) * config.gcc (i[34567]86-*-*): Add tmmintrin.h to extra_headers. Modified: stable/8/contrib/gcc/builtins.c ============================================================================== --- stable/8/contrib/gcc/builtins.c Fri Feb 3 21:24:28 2012 (r230958) +++ stable/8/contrib/gcc/builtins.c Fri Feb 3 21:26:25 2012 (r230959) @@ -8720,7 +8720,7 @@ fold_builtin_classify (tree fndecl, tree switch (builtin_index) { case BUILT_IN_ISINF: - if (!MODE_HAS_INFINITIES (TYPE_MODE (TREE_TYPE (arg)))) + if (!HONOR_INFINITIES (TYPE_MODE (TREE_TYPE (arg)))) return omit_one_operand (type, integer_zero_node, arg); if (TREE_CODE (arg) == REAL_CST) @@ -8736,8 +8736,8 @@ fold_builtin_classify (tree fndecl, tree return NULL_TREE; case BUILT_IN_FINITE: - if (!MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg))) - && !MODE_HAS_INFINITIES (TYPE_MODE (TREE_TYPE (arg)))) + if (!HONOR_NANS (TYPE_MODE (TREE_TYPE (arg))) + && !HONOR_INFINITIES (TYPE_MODE (TREE_TYPE (arg)))) return omit_one_operand (type, integer_zero_node, arg); if (TREE_CODE (arg) == REAL_CST) @@ -8750,7 +8750,7 @@ fold_builtin_classify (tree fndecl, tree return NULL_TREE; case BUILT_IN_ISNAN: - if (!MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg)))) + if (!HONOR_NANS (TYPE_MODE (TREE_TYPE (arg)))) return omit_one_operand (type, integer_zero_node, arg); if (TREE_CODE (arg) == REAL_CST) @@ -8833,13 +8833,13 @@ fold_builtin_unordered_cmp (tree fndecl, if (unordered_code == UNORDERED_EXPR) { - if (!MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg0)))) + if (!HONOR_NANS (TYPE_MODE (TREE_TYPE (arg0)))) return omit_two_operands (type, integer_zero_node, arg0, arg1); return fold_build2 (UNORDERED_EXPR, type, arg0, arg1); } - code = MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg0))) ? unordered_code - : ordered_code; + code = HONOR_NANS (TYPE_MODE (TREE_TYPE (arg0))) ? unordered_code + : ordered_code; return fold_build1 (TRUTH_NOT_EXPR, type, fold_build2 (code, type, arg0, arg1)); } From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 21:30:32 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C3BE106564A; Fri, 3 Feb 2012 21:30:32 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62E658FC08; Fri, 3 Feb 2012 21:30:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13LUW7S005007; Fri, 3 Feb 2012 21:30:32 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13LUWWC004991; Fri, 3 Feb 2012 21:30:32 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201202032130.q13LUWWC004991@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 3 Feb 2012 21:30:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230960 - in stable/8/contrib/libstdc++: . config/os/aix include/bits include/ext include/tr1 libsupc++ src X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 21:30:32 -0000 Author: pfg Date: Fri Feb 3 21:30:31 2012 New Revision: 230960 URL: http://svn.freebsd.org/changeset/base/230960 Log: MFC: r228780 Update libstdc++ with small changes up to the latest rev. (135556) from the gcc 4.2 branch. The libraries in the gcc-4_2-branch remained under the LGPLv2. Reviewed by: mm Approved by: jhb (mentor) Modified: stable/8/contrib/libstdc++/ChangeLog stable/8/contrib/libstdc++/config/os/aix/os_defines.h stable/8/contrib/libstdc++/include/bits/allocator.h stable/8/contrib/libstdc++/include/bits/basic_string.h stable/8/contrib/libstdc++/include/bits/fstream.tcc stable/8/contrib/libstdc++/include/bits/locale_facets.tcc stable/8/contrib/libstdc++/include/ext/atomicity.h stable/8/contrib/libstdc++/include/ext/codecvt_specializations.h stable/8/contrib/libstdc++/include/ext/concurrence.h stable/8/contrib/libstdc++/include/ext/vstring.h stable/8/contrib/libstdc++/include/tr1/boost_shared_ptr.h stable/8/contrib/libstdc++/include/tr1/random stable/8/contrib/libstdc++/libsupc++/eh_personality.cc stable/8/contrib/libstdc++/libsupc++/typeinfo stable/8/contrib/libstdc++/src/valarray-inst.cc Directory Properties: stable/8/contrib/libstdc++/ (props changed) Modified: stable/8/contrib/libstdc++/ChangeLog ============================================================================== --- stable/8/contrib/libstdc++/ChangeLog Fri Feb 3 21:26:25 2012 (r230959) +++ stable/8/contrib/libstdc++/ChangeLog Fri Feb 3 21:30:31 2012 (r230960) @@ -1,3 +1,133 @@ +2008-05-19 Release Manager + + * GCC 4.2.4 released. + +2008-03-13 David Edelsohn + + Backport from mainline: + 2008-01-26 David Edelsohn + + PR target/34794 + * config/os/aix/os_defines.h: Define __COMPATMATH__. + +2008-02-14 Kaveh R. Ghazi + + * testsuite/27_io/fpos/14320-1.cc: Check for "long long" and + remove XFAIL. + +2008-02-01 Release Manager + + * GCC 4.2.3 released. + +2008-01-06 Ted Phelps + + PR c++/34152 + * libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Check + _GLIBCXX_HAVE_GETIPINFO instead of HAVE_GETIPINFO. + +2008-01-05 Paolo Carlini + + PR libstdc++/34680 + + Revert: + 2007-12-17 Jonathan Wakely + * include/bits/locale_facets.tcc (has_facet, use_facet): Simplify + RTTI checks. + + 2007-12-14 Benjamin Kosnik + + PR libstdc++/30127 + PR libstdc++/34449 + * include/bits/locale_facets.tcc (use_facet): Check facet hierarchy. + (has_facet): Same. + * testsuite/22_locale/global_templates/user_facet_hierarchies.cc: New. + * testsuite/22_locale/global_templates/ + standard_facet_hierarchies.cc: New. + +2007-12-17 Jonathan Wakely + + * include/bits/locale_facets.tcc (has_facet, use_facet): Simplify + RTTI checks. + +2007-12-17 Benjamin Kosnik + + * testsuite/22_locale/global_templates/ + standard_facet_hierarchies.cc: Fix for generic locale model. + +2007-12-14 Benjamin Kosnik + + PR libstdc++/30127 + PR libstdc++/34449 + * include/bits/locale_facets.tcc (use_facet): Check facet hierarchy. + (has_facet): Same. + * testsuite/22_locale/global_templates/user_facet_hierarchies.cc: New. + * testsuite/22_locale/global_templates/ + standard_facet_hierarchies.cc: New. + +2007-11-26 Paolo Carlini + + * include/bits/locale_facets.tcc (num_put<>::_M_insert_int): When + ios_base::showpos and the type is signed and the value is zero, + prepend +. + * testsuite/22_locale/num_put/put/char/12.cc: New. + * testsuite/22_locale/num_put/put/wchar_t/12.cc: Likewise. + +2007-10-20 Paolo Carlini + + * include/tr1/random + (uniform_int<>::_M_call(_UniformRandomNumberGenerator&, result_type, + result_type, true_type)): Fix small thinko. + +2007-10-19 Paolo Carlini + + PR libstdc++/33815 + * include/tr1/random + (uniform_int<>::_M_call(_UniformRandomNumberGenerator&, result_type, + result_type, true_type)): Avoid the modulo (which uses the low-order + bits). + +2007-10-18 Paolo Carlini + + PR libstdc++/33807 + * include/bits/allocator.h (operator==(const allocator<_Tp>&, + const allocator<_Tp>&), operator!=(const allocator<_Tp>&, + const allocator<_Tp>&)): Add. + * testsuite/20_util/memory/allocator/33807.cc: New. + +2007-10-14 Jonathan Wakely + + * docs/html/Makefile: Follow up to libstdc++/14991, remove target. + +2007-10-14 Jonathan Wakely + + * src/valarray-inst.cc, include/ext/atomicity.h, + include/ext/concurrence.h, include/bits/basic_string.h, + include/bits/fstream.tcc, include/ext/vstring.h: Fix comment typos. + +2007-10-14 Jonathan Wakely + + * include/tr1_impl/boost_shared_ptr.h: (__weak_ptr::lock()): Add + missing template argument. + * testsuite/tr1/2_general_utilities/memory/shared_ptr/ + explicit_instantiation/2.cc: New. + * testsuite/tr1/2_general_utilities/memory/weak_ptr/ + explicit_instantiation/2.cc: New. + +2007-10-11 Paolo Carlini + + PR libstdc++/33734 + * include/ext/codecvt_specializations.h (encoding_state::good, + init, destroy): Use cast notation instead of reinterpret_cast. + +2007-10-07 Release Manager + + * GCC 4.2.2 released. + +2007-10-06 Benjamin Kosnik + + PR libstdc++/33678 + * libsupc++/typeinfo (typeinfo): Revert ordering of virtual components. + 2007-08-28 Paolo Carlini PR libstdc++/33128 Modified: stable/8/contrib/libstdc++/config/os/aix/os_defines.h ============================================================================== --- stable/8/contrib/libstdc++/config/os/aix/os_defines.h Fri Feb 3 21:26:25 2012 (r230959) +++ stable/8/contrib/libstdc++/config/os/aix/os_defines.h Fri Feb 3 21:30:31 2012 (r230960) @@ -1,6 +1,6 @@ // Specific definitions for AIX -*- C++ -*- -// Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. +// Copyright (C) 2000, 2002, 2005, 2008 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -48,4 +48,9 @@ #define _ALL_SOURCE #endif +// C99 math +#ifndef __COMPATMATH__ +#define __COMPATMATH__ +#endif + #endif Modified: stable/8/contrib/libstdc++/include/bits/allocator.h ============================================================================== --- stable/8/contrib/libstdc++/include/bits/allocator.h Fri Feb 3 21:26:25 2012 (r230959) +++ stable/8/contrib/libstdc++/include/bits/allocator.h Fri Feb 3 21:30:31 2012 (r230960) @@ -115,11 +115,21 @@ _GLIBCXX_BEGIN_NAMESPACE(std) operator==(const allocator<_T1>&, const allocator<_T2>&) { return true; } + template + inline bool + operator==(const allocator<_Tp>&, const allocator<_Tp>&) + { return true; } + template inline bool operator!=(const allocator<_T1>&, const allocator<_T2>&) { return false; } + template + inline bool + operator!=(const allocator<_Tp>&, const allocator<_Tp>&) + { return false; } + // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. // NB: This syntax is a GNU extension. Modified: stable/8/contrib/libstdc++/include/bits/basic_string.h ============================================================================== --- stable/8/contrib/libstdc++/include/bits/basic_string.h Fri Feb 3 21:26:25 2012 (r230959) +++ stable/8/contrib/libstdc++/include/bits/basic_string.h Fri Feb 3 21:30:31 2012 (r230960) @@ -1672,7 +1672,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Find position of a character of C substring. * @param s String containing characters to locate. - * @param pos Index of character to search from (default 0). + * @param pos Index of character to search from. * @param n Number of characters from s to search for. * @return Index of first occurrence. * @@ -1733,7 +1733,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Find last position of a character of C substring. * @param s C string containing characters to locate. - * @param pos Index of character to search back from (default end). + * @param pos Index of character to search back from. * @param n Number of characters from s to search for. * @return Index of last occurrence. * @@ -1764,7 +1764,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Find last position of a character. * @param c Character to locate. - * @param pos Index of character to search back from (default 0). + * @param pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a pos, searches backward for @a c within this string. @@ -1794,7 +1794,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Find position of a character not in C substring. * @param s C string containing characters to avoid. - * @param pos Index of character to search from (default 0). + * @param pos Index of character to search from. * @param n Number of characters from s to consider. * @return Index of first occurrence. * @@ -1839,8 +1839,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Find last position of a character not in string. * @param str String containing characters to avoid. - * @param pos Index of character to search from (default 0). - * @return Index of first occurrence. + * @param pos Index of character to search back from (default end). + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character not * contained in @a str within this string. If found, returns the index @@ -1853,9 +1853,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Find last position of a character not in C substring. * @param s C string containing characters to avoid. - * @param pos Index of character to search from (default 0). + * @param pos Index of character to search back from. * @param n Number of characters from s to consider. - * @return Index of first occurrence. + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character not * contained in the first @a n characters of @a s within this string. @@ -1866,10 +1866,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const; /** - * @brief Find position of a character not in C string. + * @brief Find last position of a character not in C string. * @param s C string containing characters to avoid. - * @param pos Index of character to search from (default 0). - * @return Index of first occurrence. + * @param pos Index of character to search back from (default end). + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character not * contained in @a s within this string. If found, returns the index @@ -1885,8 +1885,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Find last position of a different character. * @param c Character to avoid. - * @param pos Index of character to search from (default 0). - * @return Index of first occurrence. + * @param pos Index of character to search back from (default end). + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character other than * @a c within this string. If found, returns the index where it was Modified: stable/8/contrib/libstdc++/include/bits/fstream.tcc ============================================================================== --- stable/8/contrib/libstdc++/include/bits/fstream.tcc Fri Feb 3 21:26:25 2012 (r230959) +++ stable/8/contrib/libstdc++/include/bits/fstream.tcc Fri Feb 3 21:30:31 2012 (r230960) @@ -194,7 +194,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) const bool __testin = _M_mode & ios_base::in; if (__testin && !_M_writing) { - // Check for pback madness, and if so swich back to the + // Check for pback madness, and if so switch back to the // normal buffers and jet outta here before expensive // fileops happen... _M_destroy_pback(); Modified: stable/8/contrib/libstdc++/include/bits/locale_facets.tcc ============================================================================== --- stable/8/contrib/libstdc++/include/bits/locale_facets.tcc Fri Feb 3 21:26:25 2012 (r230959) +++ stable/8/contrib/libstdc++/include/bits/locale_facets.tcc Fri Feb 3 21:30:31 2012 (r230960) @@ -1,6 +1,7 @@ // Locale support -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, +// 2006, 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -117,6 +118,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) return static_cast(*__facets[__i]); } + // Routine to access a cache for the facet. If the cache didn't // exist before, it gets constructed on the fly. template @@ -1015,13 +1017,13 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE if (__builtin_expect(__dec, true)) { // Decimal. - if (__v > 0) + if (__v >= 0) { if (__flags & ios_base::showpos && numeric_limits<_ValueT>::is_signed) *--__cs = __lit[__num_base::_S_oplus], ++__len; } - else if (__v) + else *--__cs = __lit[__num_base::_S_ominus], ++__len; } else if (__flags & ios_base::showbase && __v) Modified: stable/8/contrib/libstdc++/include/ext/atomicity.h ============================================================================== --- stable/8/contrib/libstdc++/include/ext/atomicity.h Fri Feb 3 21:26:25 2012 (r230959) +++ stable/8/contrib/libstdc++/include/ext/atomicity.h Fri Feb 3 21:30:31 2012 (r230960) @@ -42,7 +42,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) // Functions for portable atomic access. - // To abstract locking primatives across all thread policies, use: + // To abstract locking primitives across all thread policies, use: // __exchange_and_add_dispatch // __atomic_add_dispatch #ifdef _GLIBCXX_ATOMIC_BUILTINS Modified: stable/8/contrib/libstdc++/include/ext/codecvt_specializations.h ============================================================================== --- stable/8/contrib/libstdc++/include/ext/codecvt_specializations.h Fri Feb 3 21:26:25 2012 (r230959) +++ stable/8/contrib/libstdc++/include/ext/codecvt_specializations.h Fri Feb 3 21:30:31 2012 (r230960) @@ -128,7 +128,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) bool good() const throw() { - const descriptor_type __err = reinterpret_cast(-1); + const descriptor_type __err = (iconv_t)(-1); bool __test = _M_in_desc && _M_in_desc != __err; __test &= _M_out_desc && _M_out_desc != __err; return __test; @@ -166,7 +166,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) void init() { - const descriptor_type __err = reinterpret_cast(-1); + const descriptor_type __err = (iconv_t)(-1); const bool __have_encodings = _M_int_enc.size() && _M_ext_enc.size(); if (!_M_in_desc && __have_encodings) { @@ -199,7 +199,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) void destroy() throw() { - const descriptor_type __err = reinterpret_cast(-1); + const descriptor_type __err = (iconv_t)(-1); if (_M_in_desc && _M_in_desc != __err) { iconv_close(_M_in_desc); Modified: stable/8/contrib/libstdc++/include/ext/concurrence.h ============================================================================== --- stable/8/contrib/libstdc++/include/ext/concurrence.h Fri Feb 3 21:26:25 2012 (r230959) +++ stable/8/contrib/libstdc++/include/ext/concurrence.h Fri Feb 3 21:30:31 2012 (r230960) @@ -46,7 +46,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) // Available locking policies: // _S_single single-threaded code that doesn't need to be locked. // _S_mutex multi-threaded code that requires additional support - // from gthr.h or abstraction layers in concurrance.h. + // from gthr.h or abstraction layers in concurrence.h. // _S_atomic multi-threaded code using atomic operations. enum _Lock_policy { _S_single, _S_mutex, _S_atomic }; Modified: stable/8/contrib/libstdc++/include/ext/vstring.h ============================================================================== --- stable/8/contrib/libstdc++/include/ext/vstring.h Fri Feb 3 21:26:25 2012 (r230959) +++ stable/8/contrib/libstdc++/include/ext/vstring.h Fri Feb 3 21:30:31 2012 (r230960) @@ -1407,7 +1407,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) /** * @brief Find position of a character of C substring. * @param s String containing characters to locate. - * @param pos Index of character to search from (default 0). + * @param pos Index of character to search from. * @param n Number of characters from s to search for. * @return Index of first occurrence. * @@ -1468,7 +1468,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) /** * @brief Find last position of a character of C substring. * @param s C string containing characters to locate. - * @param pos Index of character to search back from (default end). + * @param pos Index of character to search back from. * @param n Number of characters from s to search for. * @return Index of last occurrence. * @@ -1499,7 +1499,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) /** * @brief Find last position of a character. * @param c Character to locate. - * @param pos Index of character to search back from (default 0). + * @param pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a pos, searches backward for @a c within this string. @@ -1529,7 +1529,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) /** * @brief Find position of a character not in C substring. * @param s C string containing characters to avoid. - * @param pos Index of character to search from (default 0). + * @param pos Index of character to search from. * @param n Number of characters from s to consider. * @return Index of first occurrence. * @@ -1574,8 +1574,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) /** * @brief Find last position of a character not in string. * @param str String containing characters to avoid. - * @param pos Index of character to search from (default 0). - * @return Index of first occurrence. + * @param pos Index of character to search back from (default end). + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character not * contained in @a str within this string. If found, returns the index @@ -1589,9 +1589,9 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) /** * @brief Find last position of a character not in C substring. * @param s C string containing characters to avoid. - * @param pos Index of character to search from (default 0). + * @param pos Index of character to search back from. * @param n Number of characters from s to consider. - * @return Index of first occurrence. + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character not * contained in the first @a n characters of @a s within this string. @@ -1602,10 +1602,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const; /** - * @brief Find position of a character not in C string. + * @brief Find last position of a character not in C string. * @param s C string containing characters to avoid. - * @param pos Index of character to search from (default 0). - * @return Index of first occurrence. + * @param pos Index of character to search back from (default end). + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character not * contained in @a s within this string. If found, returns the index @@ -1621,8 +1621,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) /** * @brief Find last position of a different character. * @param c Character to avoid. - * @param pos Index of character to search from (default 0). - * @return Index of first occurrence. + * @param pos Index of character to search back from (default end). + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character other than * @a c within this string. If found, returns the index where it was Modified: stable/8/contrib/libstdc++/include/tr1/boost_shared_ptr.h ============================================================================== --- stable/8/contrib/libstdc++/include/tr1/boost_shared_ptr.h Fri Feb 3 21:26:25 2012 (r230959) +++ stable/8/contrib/libstdc++/include/tr1/boost_shared_ptr.h Fri Feb 3 21:30:31 2012 (r230960) @@ -857,7 +857,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) // Q: How can we get here? // A: Another thread may have invalidated r after the // use_count test above. - return __shared_ptr(); + return __shared_ptr(); } #else Modified: stable/8/contrib/libstdc++/include/tr1/random ============================================================================== --- stable/8/contrib/libstdc++/include/tr1/random Fri Feb 3 21:26:25 2012 (r230959) +++ stable/8/contrib/libstdc++/include/tr1/random Fri Feb 3 21:30:31 2012 (r230960) @@ -1618,10 +1618,15 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) result_type _M_call(_UniformRandomNumberGenerator& __urng, result_type __min, result_type __max, true_type) - { + { + // XXX Must be fixed to also work when __urng.max() - __urng.min() + // is smaller than __max - __min. typedef typename __gnu_cxx::__add_unsigned::__type __utype; - return result_type(__utype(__urng()) % (__max - __min + 1)) + __min; + return result_type((__max - __min + 1.0L) + * (__utype(__urng()) - __utype(__urng.min())) + / (__utype(__urng.max()) + - __utype(__urng.min()) + 1.0L)) + __min; } template Modified: stable/8/contrib/libstdc++/libsupc++/eh_personality.cc ============================================================================== --- stable/8/contrib/libstdc++/libsupc++/eh_personality.cc Fri Feb 3 21:26:25 2012 (r230959) +++ stable/8/contrib/libstdc++/libsupc++/eh_personality.cc Fri Feb 3 21:30:31 2012 (r230960) @@ -1,5 +1,5 @@ // -*- C++ -*- The GNU C++ exception personality routine. -// Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2006, 2008 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -434,7 +434,7 @@ PERSONALITY_FUNCTION (int version, // Parse the LSDA header. p = parse_lsda_header (context, language_specific_data, &info); info.ttype_base = base_of_encoded_value (info.ttype_encoding, context); -#ifdef HAVE_GETIPINFO +#ifdef _GLIBCXX_HAVE_GETIPINFO ip = _Unwind_GetIPInfo (context, &ip_before_insn); #else ip = _Unwind_GetIP (context); Modified: stable/8/contrib/libstdc++/libsupc++/typeinfo ============================================================================== --- stable/8/contrib/libstdc++/libsupc++/typeinfo Fri Feb 3 21:26:25 2012 (r230959) +++ stable/8/contrib/libstdc++/libsupc++/typeinfo Fri Feb 3 21:30:31 2012 (r230960) @@ -99,7 +99,13 @@ namespace std #endif bool operator!=(const type_info& __arg) const { return !operator==(__arg); } - + + // Return true if this is a pointer type of some kind + virtual bool __is_pointer_p() const; + + // Return true if this is a function type + virtual bool __is_function_p() const; + // Try and catch a thrown type. Store an adjusted pointer to the // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then // THR_OBJ points to the thrown object. If THR_TYPE is a pointer @@ -113,12 +119,6 @@ namespace std virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target, void **__obj_ptr) const; - // Return true if this is a pointer type of some kind - virtual bool __is_pointer_p() const; - - // Return true if this is a function type - virtual bool __is_function_p() const; - protected: const char *__name; Modified: stable/8/contrib/libstdc++/src/valarray-inst.cc ============================================================================== --- stable/8/contrib/libstdc++/src/valarray-inst.cc Fri Feb 3 21:26:25 2012 (r230959) +++ stable/8/contrib/libstdc++/src/valarray-inst.cc Fri Feb 3 21:30:31 2012 (r230960) @@ -68,7 +68,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __gslice_to_index(size_t __o, const valarray& __l, const valarray& __s, valarray& __i) { - // There are as much as dimensions as there are strides. + // There are as many dimensions as there are strides. size_t __n = __l.size(); // Get a buffer to hold current multi-index as we go through From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 21:38:23 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFC61106566C; Fri, 3 Feb 2012 21:38:23 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F7278FC0A; Fri, 3 Feb 2012 21:38:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13LcN4E005287; Fri, 3 Feb 2012 21:38:23 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13LcN7R005285; Fri, 3 Feb 2012 21:38:23 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201202032138.q13LcN7R005285@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 3 Feb 2012 21:38:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230961 - stable/9/usr.bin/printf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 21:38:23 -0000 Author: pfg Date: Fri Feb 3 21:38:23 2012 New Revision: 230961 URL: http://svn.freebsd.org/changeset/base/230961 Log: MFC: r230027 Style cleanups for printf. PR: bin/152934 Approved by: jhb (mentor) Obtained from: Illumos Modified: stable/9/usr.bin/printf/printf.c Directory Properties: stable/9/usr.bin/printf/ (props changed) Modified: stable/9/usr.bin/printf/printf.c ============================================================================== --- stable/9/usr.bin/printf/printf.c Fri Feb 3 21:30:31 2012 (r230960) +++ stable/9/usr.bin/printf/printf.c Fri Feb 3 21:38:23 2012 (r230961) @@ -66,21 +66,21 @@ static const char rcsid[] = #include "error.h" #endif -#define PF(f, func) do { \ - char *b = NULL; \ - if (havewidth) \ - if (haveprec) \ +#define PF(f, func) do { \ + char *b = NULL; \ + if (havewidth) \ + if (haveprec) \ (void)asprintf(&b, f, fieldwidth, precision, func); \ - else \ - (void)asprintf(&b, f, fieldwidth, func); \ - else if (haveprec) \ - (void)asprintf(&b, f, precision, func); \ - else \ - (void)asprintf(&b, f, func); \ - if (b) { \ - (void)fputs(b, stdout); \ - free(b); \ - } \ + else \ + (void)asprintf(&b, f, fieldwidth, func); \ + else if (haveprec) \ + (void)asprintf(&b, f, precision, func); \ + else \ + (void)asprintf(&b, f, func); \ + if (b) { \ + (void)fputs(b, stdout); \ + free(b); \ + } \ } while (0) static int asciicode(void); @@ -357,10 +357,10 @@ mknum(char *str, char ch) static int escape(char *fmt, int percent, size_t *len) { - char *save, *store; - int value, c; + char *save, *store, c; + int value; - for (save = store = fmt; (c = *fmt); ++fmt, ++store) { + for (save = store = fmt; ((c = *fmt) != 0); ++fmt, ++store) { if (c != '\\') { *store = c; continue; @@ -414,7 +414,7 @@ escape(char *fmt, int percent, size_t *l *store++ = '%'; *store = '%'; } else - *store = value; + *store = (char)value; break; default: *store = *fmt; From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 22:06:28 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37FA0106566B; Fri, 3 Feb 2012 22:06:28 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EF498FC0C; Fri, 3 Feb 2012 22:06:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13M6SDO006253; Fri, 3 Feb 2012 22:06:28 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13M6RUi006248; Fri, 3 Feb 2012 22:06:27 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201202032206.q13M6RUi006248@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 3 Feb 2012 22:06:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230962 - in stable/9/sys: conf dev/sound/pci modules/sound/driver/emu10k1 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 22:06:28 -0000 Author: pfg Date: Fri Feb 3 22:06:27 2012 New Revision: 230962 URL: http://svn.freebsd.org/changeset/base/230962 Log: MFC: r229430, r229980 Replace a GPL'd header in the emu10k1 snd driver code. This brings in the emuxkireg.h from NetBSD (dev/pci) which is used for the same purpose but is smaller. The emu10k1 is now free from the GPL. While here also merge some cleanups to the module Makefile. PR: 153901 Obtained from: NetBSD Approved by: core (mentor implicit) Added: stable/9/sys/dev/sound/pci/emuxkireg.h - copied unchanged from r229430, head/sys/dev/sound/pci/emuxkireg.h Modified: stable/9/sys/conf/files stable/9/sys/dev/sound/pci/emu10k1.c stable/9/sys/modules/sound/driver/emu10k1/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/modules/sound/driver/emu10k1/ (props changed) Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Fri Feb 3 21:38:23 2012 (r230961) +++ stable/9/sys/conf/files Fri Feb 3 22:06:27 2012 (r230962) @@ -50,7 +50,7 @@ aic79xx_reg_print.c optional ahd pci aic79xx_reg_print.o optional ahd pci ahd_reg_pretty_print \ compile-with "${NORMAL_C}" \ no-implicit-rule local -emu10k1-alsa%diked.h optional snd_emu10k1 | snd_emu10kx \ +emu10k1-alsa%diked.h optional snd_emu10kx \ dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h" \ compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h emu10k1-alsa%diked.h" \ no-obj no-implicit-rule before-depend \ @@ -1727,9 +1727,7 @@ dev/sound/pci/csa.c optional snd_csa pc warning "kernel contains GPL contaminated csaimg.h header" dev/sound/pci/csapcm.c optional snd_csa pci dev/sound/pci/ds1.c optional snd_ds1 pci -dev/sound/pci/emu10k1.c optional snd_emu10k1 pci \ - dependency "emu10k1-alsa%diked.h" \ - warning "kernel contains GPL contaminated emu10k1 headers" +dev/sound/pci/emu10k1.c optional snd_emu10k1 pci dev/sound/pci/emu10kx.c optional snd_emu10kx pci \ dependency "emu10k1-alsa%diked.h" \ dependency "p16v-alsa%diked.h" \ Modified: stable/9/sys/dev/sound/pci/emu10k1.c ============================================================================== --- stable/9/sys/dev/sound/pci/emu10k1.c Fri Feb 3 21:38:23 2012 (r230961) +++ stable/9/sys/dev/sound/pci/emu10k1.c Fri Feb 3 22:06:27 2012 (r230962) @@ -32,7 +32,7 @@ #include #include -#include "emu10k1-alsa%diked.h" +#include #include #include @@ -66,12 +66,94 @@ SND_DECLARE_FILE("$FreeBSD$"); #define ENABLE 0xffffffff #define DISABLE 0x00000000 -#define ENV_ON DCYSUSV_CHANNELENABLE_MASK +#define ENV_ON EMU_CHAN_DCYSUSV_CHANNELENABLE_MASK #define ENV_OFF 0x00 /* XXX: should this be 1? */ -#define A_IOCFG_GPOUT_A 0x40 /* Analog Output */ -#define A_IOCFG_GPOUT_D 0x04 /* Digital Output */ -#define A_IOCFG_GPOUT_AD (A_IOCFG_GPOUT_A|A_IOCFG_GPOUT_D) /* A_IOCFG_GPOUT0 */ +#define EMU_A_IOCFG_GPOUT_A 0x40 +#define EMU_A_IOCFG_GPOUT_D 0x04 +#define EMU_A_IOCFG_GPOUT_AD (EMU_A_IOCFG_GPOUT_A|EMU_A_IOCFG_GPOUT_D) /* EMU_A_IOCFG_GPOUT0 */ + +#define EMU_HCFG_GPOUT1 0x00000800 + +/* instruction set */ +#define iACC3 0x06 +#define iMACINT0 0x04 +#define iINTERP 0x0e + +#define C_00000000 0x40 +#define C_00000001 0x41 +#define C_00000004 0x44 +#define C_40000000 0x4d +/* Audigy constants */ +#define A_C_00000000 0xc0 +#define A_C_40000000 0xcd + +/* GPRs */ +#define FXBUS(x) (0x00 + (x)) +#define EXTIN(x) (0x10 + (x)) +#define EXTOUT(x) (0x20 + (x)) + +#define GPR(x) (EMU_FXGPREGBASE + (x)) +#define A_EXTIN(x) (0x40 + (x)) +#define A_FXBUS(x) (0x00 + (x)) +#define A_EXTOUT(x) (0x60 + (x)) +#define A_GPR(x) (EMU_A_FXGPREGBASE + (x)) + +/* FX buses */ +#define FXBUS_PCM_LEFT 0x00 +#define FXBUS_PCM_RIGHT 0x01 +#define FXBUS_MIDI_LEFT 0x04 +#define FXBUS_MIDI_RIGHT 0x05 +#define FXBUS_MIDI_REVERB 0x0c +#define FXBUS_MIDI_CHORUS 0x0d + +/* Inputs */ +#define EXTIN_AC97_L 0x00 +#define EXTIN_AC97_R 0x01 +#define EXTIN_SPDIF_CD_L 0x02 +#define EXTIN_SPDIF_CD_R 0x03 +#define EXTIN_TOSLINK_L 0x06 +#define EXTIN_TOSLINK_R 0x07 +#define EXTIN_COAX_SPDIF_L 0x0a +#define EXTIN_COAX_SPDIF_R 0x0b +/* Audigy Inputs */ +#define A_EXTIN_AC97_L 0x00 +#define A_EXTIN_AC97_R 0x01 + +/* Outputs */ +#define EXTOUT_AC97_L 0x00 +#define EXTOUT_AC97_R 0x01 +#define EXTOUT_TOSLINK_L 0x02 +#define EXTOUT_TOSLINK_R 0x03 +#define EXTOUT_AC97_CENTER 0x04 +#define EXTOUT_AC97_LFE 0x05 +#define EXTOUT_HEADPHONE_L 0x06 +#define EXTOUT_HEADPHONE_R 0x07 +#define EXTOUT_REAR_L 0x08 +#define EXTOUT_REAR_R 0x09 +#define EXTOUT_ADC_CAP_L 0x0a +#define EXTOUT_ADC_CAP_R 0x0b +#define EXTOUT_ACENTER 0x11 +#define EXTOUT_ALFE 0x12 +/* Audigy Outputs */ +#define A_EXTOUT_FRONT_L 0x00 +#define A_EXTOUT_FRONT_R 0x01 +#define A_EXTOUT_CENTER 0x02 +#define A_EXTOUT_LFE 0x03 +#define A_EXTOUT_HEADPHONE_L 0x04 +#define A_EXTOUT_HEADPHONE_R 0x05 +#define A_EXTOUT_REAR_L 0x06 +#define A_EXTOUT_REAR_R 0x07 +#define A_EXTOUT_AFRONT_L 0x08 +#define A_EXTOUT_AFRONT_R 0x09 +#define A_EXTOUT_ACENTER 0x0a +#define A_EXTOUT_ALFE 0x0b +#define A_EXTOUT_AREAR_L 0x0e +#define A_EXTOUT_AREAR_R 0x0f +#define A_EXTOUT_AC97_L 0x10 +#define A_EXTOUT_AC97_R 0x11 +#define A_EXTOUT_ADC_CAP_L 0x16 +#define A_EXTOUT_ADC_CAP_R 0x17 struct emu_memblk { SLIST_ENTRY(emu_memblk) link; @@ -247,9 +329,9 @@ emu_rdptr(struct sc_info *sc, int chn, i { u_int32_t ptr, val, mask, size, offset; - ptr = ((reg << 16) & sc->addrmask) | (chn & PTR_CHANNELNUM_MASK); - emu_wr(sc, PTR, ptr, 4); - val = emu_rd(sc, DATA, 4); + ptr = ((reg << 16) & sc->addrmask) | (chn & EMU_PTR_CHNO_MASK); + emu_wr(sc, EMU_PTR, ptr, 4); + val = emu_rd(sc, EMU_DATA, 4); if (reg & 0xff000000) { size = (reg >> 24) & 0x3f; offset = (reg >> 16) & 0x1f; @@ -265,23 +347,23 @@ emu_wrptr(struct sc_info *sc, int chn, i { u_int32_t ptr, mask, size, offset; - ptr = ((reg << 16) & sc->addrmask) | (chn & PTR_CHANNELNUM_MASK); - emu_wr(sc, PTR, ptr, 4); + ptr = ((reg << 16) & sc->addrmask) | (chn & EMU_PTR_CHNO_MASK); + emu_wr(sc, EMU_PTR, ptr, 4); if (reg & 0xff000000) { size = (reg >> 24) & 0x3f; offset = (reg >> 16) & 0x1f; mask = ((1 << size) - 1) << offset; data <<= offset; data &= mask; - data |= emu_rd(sc, DATA, 4) & ~mask; + data |= emu_rd(sc, EMU_DATA, 4) & ~mask; } - emu_wr(sc, DATA, data, 4); + emu_wr(sc, EMU_DATA, data, 4); } static void emu_wrefx(struct sc_info *sc, unsigned int pc, unsigned int data) { - pc += sc->audigy ? A_MICROCODEBASE : MICROCODEBASE; + pc += sc->audigy ? EMU_A_MICROCODEBASE : EMU_MICROCODEBASE; emu_wrptr(sc, 0, pc, data); } @@ -294,8 +376,8 @@ emu_rdcd(kobj_t obj, void *devinfo, int { struct sc_info *sc = (struct sc_info *)devinfo; - emu_wr(sc, AC97ADDRESS, regno, 1); - return emu_rd(sc, AC97DATA, 2); + emu_wr(sc, EMU_AC97ADDR, regno, 1); + return emu_rd(sc, EMU_AC97DATA, 2); } static int @@ -303,8 +385,8 @@ emu_wrcd(kobj_t obj, void *devinfo, int { struct sc_info *sc = (struct sc_info *)devinfo; - emu_wr(sc, AC97ADDRESS, regno, 1); - emu_wr(sc, AC97DATA, data, 2); + emu_wr(sc, EMU_AC97ADDR, regno, 1); + emu_wr(sc, EMU_AC97DATA, data, 2); return 0; } @@ -346,7 +428,7 @@ emu_settimer(struct sc_info *sc) } RANGE(rate, 48, 9600); sc->timerinterval = 48000 / rate; - emu_wr(sc, TIMER, sc->timerinterval & 0x03ff, 2); + emu_wr(sc, EMU_TIMER, sc->timerinterval & 0x03ff, 2); return sc->timerinterval; } @@ -357,15 +439,15 @@ emu_enatimer(struct sc_info *sc, int go) u_int32_t x; if (go) { if (sc->timer++ == 0) { - x = emu_rd(sc, INTE, 4); - x |= INTE_INTERVALTIMERENB; - emu_wr(sc, INTE, x, 4); + x = emu_rd(sc, EMU_INTE, 4); + x |= EMU_INTE_INTERTIMERENB; + emu_wr(sc, EMU_INTE, x, 4); } } else { sc->timer = 0; - x = emu_rd(sc, INTE, 4); - x &= ~INTE_INTERVALTIMERENB; - emu_wr(sc, INTE, x, 4); + x = emu_rd(sc, EMU_INTE, 4); + x &= ~EMU_INTE_INTERTIMERENB; + emu_wr(sc, EMU_INTE, x, 4); } return 0; } @@ -373,7 +455,7 @@ emu_enatimer(struct sc_info *sc, int go) static void emu_enastop(struct sc_info *sc, char channel, int enable) { - int reg = (channel & 0x20) ? SOLEH : SOLEL; + int reg = (channel & 0x20) ? EMU_SOLEH : EMU_SOLEL; channel &= 0x1f; reg |= 1 << 24; reg |= channel << 16; @@ -568,49 +650,49 @@ emu_vwrite(struct sc_info *sc, struct em r = v->ismaster ? 0 : r; } - emu_wrptr(sc, v->vnum, CPF, v->stereo ? CPF_STEREO_MASK : 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF, v->stereo ? EMU_CHAN_CPF_STEREO_MASK : 0); val = v->stereo ? 28 : 30; val *= v->b16 ? 1 : 2; start = sa + val; if (sc->audigy) { - emu_wrptr(sc, v->vnum, A_FXRT1, v->fxrt1); - emu_wrptr(sc, v->vnum, A_FXRT2, v->fxrt2); - emu_wrptr(sc, v->vnum, A_SENDAMOUNTS, 0); + emu_wrptr(sc, v->vnum, EMU_A_CHAN_FXRT1, v->fxrt1); + emu_wrptr(sc, v->vnum, EMU_A_CHAN_FXRT2, v->fxrt2); + emu_wrptr(sc, v->vnum, EMU_A_CHAN_SENDAMOUNTS, 0); } else - emu_wrptr(sc, v->vnum, FXRT, v->fxrt1 << 16); + emu_wrptr(sc, v->vnum, EMU_CHAN_FXRT, v->fxrt1 << 16); - emu_wrptr(sc, v->vnum, PTRX, (x << 8) | r); - emu_wrptr(sc, v->vnum, DSL, ea | (y << 24)); - emu_wrptr(sc, v->vnum, PSST, sa | (l << 24)); - emu_wrptr(sc, v->vnum, CCCA, start | (v->b16 ? 0 : CCCA_8BITSELECT)); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX, (x << 8) | r); + emu_wrptr(sc, v->vnum, EMU_CHAN_DSL, ea | (y << 24)); + emu_wrptr(sc, v->vnum, EMU_CHAN_PSST, sa | (l << 24)); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCCA, start | (v->b16 ? 0 : EMU_CHAN_CCCA_8BITSELECT)); - emu_wrptr(sc, v->vnum, Z1, 0); - emu_wrptr(sc, v->vnum, Z2, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_Z1, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_Z2, 0); silent_page = ((u_int32_t)(sc->mem.silent_page_addr) << 1) - | MAP_PTI_MASK; - emu_wrptr(sc, v->vnum, MAPA, silent_page); - emu_wrptr(sc, v->vnum, MAPB, silent_page); - - emu_wrptr(sc, v->vnum, CVCF, CVCF_CURRENTFILTER_MASK); - emu_wrptr(sc, v->vnum, VTFT, VTFT_FILTERTARGET_MASK); - emu_wrptr(sc, v->vnum, ATKHLDM, 0); - emu_wrptr(sc, v->vnum, DCYSUSM, DCYSUSM_DECAYTIME_MASK); - emu_wrptr(sc, v->vnum, LFOVAL1, 0x8000); - emu_wrptr(sc, v->vnum, LFOVAL2, 0x8000); - emu_wrptr(sc, v->vnum, FMMOD, 0); - emu_wrptr(sc, v->vnum, TREMFRQ, 0); - emu_wrptr(sc, v->vnum, FM2FRQ2, 0); - emu_wrptr(sc, v->vnum, ENVVAL, 0x8000); - - emu_wrptr(sc, v->vnum, ATKHLDV, - ATKHLDV_HOLDTIME_MASK | ATKHLDV_ATTACKTIME_MASK); - emu_wrptr(sc, v->vnum, ENVVOL, 0x8000); + | EMU_CHAN_MAP_PTI_MASK; + emu_wrptr(sc, v->vnum, EMU_CHAN_MAPA, silent_page); + emu_wrptr(sc, v->vnum, EMU_CHAN_MAPB, silent_page); + + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, EMU_CHAN_CVCF_CURRFILTER_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, EMU_CHAN_VTFT_FILTERTARGET_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_ATKHLDM, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_DCYSUSM, EMU_CHAN_DCYSUSM_DECAYTIME_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_LFOVAL1, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_LFOVAL2, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_FMMOD, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_TREMFRQ, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_FM2FRQ2, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_ENVVAL, 0x8000); + + emu_wrptr(sc, v->vnum, EMU_CHAN_ATKHLDV, + EMU_CHAN_ATKHLDV_HOLDTIME_MASK | EMU_CHAN_ATKHLDV_ATTACKTIME_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_ENVVOL, 0x8000); - emu_wrptr(sc, v->vnum, PEFE_FILTERAMOUNT, 0x7f); - emu_wrptr(sc, v->vnum, PEFE_PITCHAMOUNT, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_PEFE_FILTERAMOUNT, 0x7f); + emu_wrptr(sc, v->vnum, EMU_CHAN_PEFE_PITCHAMOUNT, 0); if (v->slave != NULL) emu_vwrite(sc, v->slave); @@ -631,29 +713,29 @@ emu_vtrigger(struct sc_info *sc, struct sample = v->b16 ? 0x00000000 : 0x80808080; for (i = 0; i < cs; i++) - emu_wrptr(sc, v->vnum, CD0 + i, sample); - emu_wrptr(sc, v->vnum, CCR_CACHEINVALIDSIZE, 0); - emu_wrptr(sc, v->vnum, CCR_READADDRESS, cra); - emu_wrptr(sc, v->vnum, CCR_CACHEINVALIDSIZE, ccis); - - emu_wrptr(sc, v->vnum, IFATN, 0xff00); - emu_wrptr(sc, v->vnum, VTFT, 0xffffffff); - emu_wrptr(sc, v->vnum, CVCF, 0xffffffff); - emu_wrptr(sc, v->vnum, DCYSUSV, 0x00007f7f); + emu_wrptr(sc, v->vnum, EMU_CHAN_CD0 + i, sample); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_CACHEINVALIDSIZE, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_READADDRESS, cra); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_CACHEINVALIDSIZE, ccis); + + emu_wrptr(sc, v->vnum, EMU_CHAN_IFATN, 0xff00); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, 0xffffffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, 0xffffffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_DCYSUSV, 0x00007f7f); emu_enastop(sc, v->vnum, 0); pitch_target = emu_rate_to_linearpitch(v->speed); initial_pitch = emu_rate_to_pitch(v->speed) >> 8; - emu_wrptr(sc, v->vnum, PTRX_PITCHTARGET, pitch_target); - emu_wrptr(sc, v->vnum, CPF_CURRENTPITCH, pitch_target); - emu_wrptr(sc, v->vnum, IP, initial_pitch); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX_PITCHTARGET, pitch_target); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF_PITCH, pitch_target); + emu_wrptr(sc, v->vnum, EMU_CHAN_IP, initial_pitch); } else { - emu_wrptr(sc, v->vnum, PTRX_PITCHTARGET, 0); - emu_wrptr(sc, v->vnum, CPF_CURRENTPITCH, 0); - emu_wrptr(sc, v->vnum, IFATN, 0xffff); - emu_wrptr(sc, v->vnum, VTFT, 0x0000ffff); - emu_wrptr(sc, v->vnum, CVCF, 0x0000ffff); - emu_wrptr(sc, v->vnum, IP, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX_PITCHTARGET, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF_PITCH, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_IFATN, 0xffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, 0x0000ffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, 0x0000ffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_IP, 0); emu_enastop(sc, v->vnum, 1); } if (v->slave != NULL) @@ -666,7 +748,7 @@ emu_vpos(struct sc_info *sc, struct emu_ int s, ptr; s = (v->b16 ? 1 : 0) + (v->stereo ? 1 : 0); - ptr = (emu_rdptr(sc, v->vnum, CCCA_CURRADDR) - (v->start >> s)) << s; + ptr = (emu_rdptr(sc, v->vnum, EMU_CHAN_CCCA_CURRADDR) - (v->start >> s)) << s; return ptr & ~0x0000001f; } @@ -875,27 +957,27 @@ emurchan_init(kobj_t obj, void *devinfo, ch->num = sc->rnum; switch(sc->rnum) { case 0: - ch->idxreg = sc->audigy ? A_ADCIDX : ADCIDX; - ch->basereg = ADCBA; - ch->sizereg = ADCBS; - ch->setupreg = ADCCR; - ch->irqmask = INTE_ADCBUFENABLE; + ch->idxreg = sc->audigy ? EMU_A_ADCIDX : EMU_ADCIDX; + ch->basereg = EMU_ADCBA; + ch->sizereg = EMU_ADCBS; + ch->setupreg = EMU_ADCCR; + ch->irqmask = EMU_INTE_ADCBUFENABLE; break; case 1: - ch->idxreg = FXIDX; - ch->basereg = FXBA; - ch->sizereg = FXBS; - ch->setupreg = FXWC; - ch->irqmask = INTE_EFXBUFENABLE; + ch->idxreg = EMU_FXIDX; + ch->basereg = EMU_FXBA; + ch->sizereg = EMU_FXBS; + ch->setupreg = EMU_FXWC; + ch->irqmask = EMU_INTE_EFXBUFENABLE; break; case 2: - ch->idxreg = MICIDX; - ch->basereg = MICBA; - ch->sizereg = MICBS; + ch->idxreg = EMU_MICIDX; + ch->basereg = EMU_MICBA; + ch->sizereg = EMU_MICBS; ch->setupreg = 0; - ch->irqmask = INTE_MICBUFENABLE; + ch->irqmask = EMU_INTE_MICBUFENABLE; break; } sc->rnum++; @@ -967,27 +1049,27 @@ emurchan_trigger(kobj_t obj, void *data, switch(sc->bufsz) { case 4096: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; break; case 8192: - sz = ADCBS_BUFSIZE_8192; + sz = EMU_RECBS_BUFSIZE_8192; break; case 16384: - sz = ADCBS_BUFSIZE_16384; + sz = EMU_RECBS_BUFSIZE_16384; break; case 32768: - sz = ADCBS_BUFSIZE_32768; + sz = EMU_RECBS_BUFSIZE_32768; break; case 65536: - sz = ADCBS_BUFSIZE_65536; + sz = EMU_RECBS_BUFSIZE_65536; break; default: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; } snd_mtxlock(sc->lock); @@ -997,23 +1079,23 @@ emurchan_trigger(kobj_t obj, void *data, emu_wrptr(sc, 0, ch->sizereg, sz); if (ch->num == 0) { if (sc->audigy) { - val = A_ADCCR_LCHANENABLE; + val = EMU_A_ADCCR_LCHANENABLE; if (AFMT_CHANNEL(ch->fmt) > 1) - val |= A_ADCCR_RCHANENABLE; + val |= EMU_A_ADCCR_RCHANENABLE; val |= audigy_recval(ch->spd); } else { - val = ADCCR_LCHANENABLE; + val = EMU_ADCCR_LCHANENABLE; if (AFMT_CHANNEL(ch->fmt) > 1) - val |= ADCCR_RCHANENABLE; + val |= EMU_ADCCR_RCHANENABLE; val |= emu_recval(ch->spd); } emu_wrptr(sc, 0, ch->setupreg, 0); emu_wrptr(sc, 0, ch->setupreg, val); } - val = emu_rd(sc, INTE, 4); + val = emu_rd(sc, EMU_INTE, 4); val |= ch->irqmask; - emu_wr(sc, INTE, val, 4); + emu_wr(sc, EMU_INTE, val, 4); break; case PCMTRIG_STOP: @@ -1022,9 +1104,9 @@ emurchan_trigger(kobj_t obj, void *data, emu_wrptr(sc, 0, ch->sizereg, 0); if (ch->setupreg) emu_wrptr(sc, 0, ch->setupreg, 0); - val = emu_rd(sc, INTE, 4); + val = emu_rd(sc, EMU_INTE, 4); val &= ~ch->irqmask; - emu_wr(sc, INTE, val, 4); + emu_wr(sc, EMU_INTE, val, 4); break; case PCMTRIG_EMLDMAWR: @@ -1122,9 +1204,9 @@ emu_midiattach(struct sc_info *sc) { int i; - i = emu_rd(sc, INTE, 4); - i |= INTE_MIDIRXENABLE; - emu_wr(sc, INTE, i, 4); + i = emu_rd(sc, EMU_INTE, 4); + i |= EMU_INTE_MIDIRXENABLE; + emu_wr(sc, EMU_INTE, i, 4); sc->mpu = mpu401_init(&emu_mpu_class, sc, emu_intr2, &sc->mpu_intr); } @@ -1139,52 +1221,52 @@ emu_intr(void *data) snd_mtxlock(sc->lock); while (1) { - stat = emu_rd(sc, IPR, 4); + stat = emu_rd(sc, EMU_IPR, 4); if (stat == 0) break; ack = 0; /* process irq */ - if (stat & IPR_INTERVALTIMER) - ack |= IPR_INTERVALTIMER; + if (stat & EMU_IPR_INTERVALTIMER) + ack |= EMU_IPR_INTERVALTIMER; - if (stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL)) - ack |= stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL); + if (stat & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL)) + ack |= stat & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL); - if (stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL)) - ack |= stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL); + if (stat & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL)) + ack |= stat & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL); - if (stat & (IPR_MICBUFFULL | IPR_MICBUFHALFFULL)) - ack |= stat & (IPR_MICBUFFULL | IPR_MICBUFHALFFULL); + if (stat & (EMU_IPR_MICBUFFULL | EMU_IPR_MICBUFHALFFULL)) + ack |= stat & (EMU_IPR_MICBUFFULL | EMU_IPR_MICBUFHALFFULL); - if (stat & IPR_PCIERROR) { - ack |= IPR_PCIERROR; + if (stat & EMU_PCIERROR) { + ack |= EMU_PCIERROR; device_printf(sc->dev, "pci error\n"); /* we still get an nmi with ecc ram even if we ack this */ } - if (stat & IPR_SAMPLERATETRACKER) { - ack |= IPR_SAMPLERATETRACKER; + if (stat & EMU_IPR_RATETRCHANGE) { + ack |= EMU_IPR_RATETRCHANGE; #ifdef EMUDEBUG device_printf(sc->dev, "sample rate tracker lock status change\n"); #endif } - if (stat & IPR_MIDIRECVBUFEMPTY) + if (stat & EMU_IPR_MIDIRECVBUFE) if (sc->mpu_intr) { (sc->mpu_intr)(sc->mpu); - ack |= IPR_MIDIRECVBUFEMPTY | IPR_MIDITRANSBUFEMPTY; + ack |= EMU_IPR_MIDIRECVBUFE | EMU_IPR_MIDITRANSBUFE; } if (stat & ~ack) device_printf(sc->dev, "dodgy irq: %x (harmless)\n", stat & ~ack); - emu_wr(sc, IPR, stat, 4); + emu_wr(sc, EMU_IPR, stat, 4); if (ack) { snd_mtxunlock(sc->lock); - if (ack & IPR_INTERVALTIMER) { + if (ack & EMU_IPR_INTERVALTIMER) { x = 0; for (i = 0; i < sc->nchans; i++) { if (sc->pch[i].run) { @@ -1197,15 +1279,15 @@ emu_intr(void *data) } - if (ack & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL)) { + if (ack & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL)) { if (sc->rch[0].channel) chn_intr(sc->rch[0].channel); } - if (ack & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL)) { + if (ack & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL)) { if (sc->rch[1].channel) chn_intr(sc->rch[1].channel); } - if (ack & (IPR_MICBUFFULL | IPR_MICBUFHALFFULL)) { + if (ack & (EMU_IPR_MICBUFFULL | EMU_IPR_MICBUFHALFFULL)) { if (sc->rch[2].channel) chn_intr(sc->rch[2].channel); } @@ -1378,12 +1460,12 @@ audigy_initefx(struct sc_info *sc) audigy_addefxop(sc, 0x0f, 0x0c0, 0x0c0, 0x0cf, 0x0c0, &pc); for (i = 0; i < 512; i++) - emu_wrptr(sc, 0, A_FXGPREGBASE + i, 0x0); + emu_wrptr(sc, 0, EMU_A_FXGPREGBASE + i, 0x0); pc = 16; /* stop fx processor */ - emu_wrptr(sc, 0, A_DBG, A_DBG_SINGLE_STEP); + emu_wrptr(sc, 0, EMU_A_DBG, EMU_A_DBG_SINGLE_STEP); /* Audigy 2 (EMU10K2) DSP Registers: FX Bus @@ -1518,7 +1600,7 @@ audigy_initefx(struct sc_info *sc) A_C_00000000, A_EXTIN(A_EXTIN_AC97_R), &pc); /* resume normal operations */ - emu_wrptr(sc, 0, A_DBG, 0); + emu_wrptr(sc, 0, EMU_A_DBG, 0); } static void @@ -1534,7 +1616,7 @@ emu_initefx(struct sc_info *sc) } for (i = 0; i < 256; i++) - emu_wrptr(sc, 0, FXGPREGBASE + i, 0); + emu_wrptr(sc, 0, EMU_FXGPREGBASE + i, 0); /* FX-8010 DSP Registers: FX Bus @@ -1654,7 +1736,7 @@ emu_initefx(struct sc_info *sc) C_00000000, EXTIN(EXTIN_AC97_R), &pc); /* resume normal operations */ - emu_wrptr(sc, 0, DBG, 0); + emu_wrptr(sc, 0, EMU_DBG, 0); } /* Probe and attach the card */ @@ -1665,69 +1747,69 @@ emu_init(struct sc_info *sc) if (sc->audigy) { /* enable additional AC97 slots */ - emu_wrptr(sc, 0, AC97SLOT, AC97SLOT_CNTR | AC97SLOT_LFE); + emu_wrptr(sc, 0, EMU_AC97SLOT, EMU_AC97SLOT_CENTER | EMU_AC97SLOT_LFE); } /* disable audio and lock cache */ - emu_wr(sc, HCFG, - HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, + emu_wr(sc, EMU_HCFG, + EMU_HCFG_LOCKSOUNDCACHE | EMU_HCFG_LOCKTANKCACHE_MASK | EMU_HCFG_MUTEBUTTONENABLE, 4); /* reset recording buffers */ - emu_wrptr(sc, 0, MICBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, MICBA, 0); - emu_wrptr(sc, 0, FXBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, FXBA, 0); - emu_wrptr(sc, 0, ADCBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, ADCBA, 0); + emu_wrptr(sc, 0, EMU_MICBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_MICBA, 0); + emu_wrptr(sc, 0, EMU_FXBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_FXBA, 0); + emu_wrptr(sc, 0, EMU_ADCBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_ADCBA, 0); /* disable channel interrupt */ - emu_wr(sc, INTE, - INTE_INTERVALTIMERENB | INTE_SAMPLERATETRACKER | INTE_PCIERRORENABLE, + emu_wr(sc, EMU_INTE, + EMU_INTE_INTERTIMERENB | EMU_INTE_SAMPLERATER | EMU_INTE_PCIERRENABLE, 4); - emu_wrptr(sc, 0, CLIEL, 0); - emu_wrptr(sc, 0, CLIEH, 0); - emu_wrptr(sc, 0, SOLEL, 0); - emu_wrptr(sc, 0, SOLEH, 0); + emu_wrptr(sc, 0, EMU_CLIEL, 0); + emu_wrptr(sc, 0, EMU_CLIEH, 0); + emu_wrptr(sc, 0, EMU_SOLEL, 0); + emu_wrptr(sc, 0, EMU_SOLEH, 0); /* wonder what these do... */ if (sc->audigy) { - emu_wrptr(sc, 0, SPBYPASS, 0xf00); - emu_wrptr(sc, 0, AC97SLOT, 0x3); + emu_wrptr(sc, 0, EMU_SPBYPASS, 0xf00); + emu_wrptr(sc, 0, EMU_AC97SLOT, 0x3); } /* init envelope engine */ for (ch = 0; ch < NUM_G; ch++) { - emu_wrptr(sc, ch, DCYSUSV, ENV_OFF); - emu_wrptr(sc, ch, IP, 0); - emu_wrptr(sc, ch, VTFT, 0xffff); - emu_wrptr(sc, ch, CVCF, 0xffff); - emu_wrptr(sc, ch, PTRX, 0); - emu_wrptr(sc, ch, CPF, 0); - emu_wrptr(sc, ch, CCR, 0); - - emu_wrptr(sc, ch, PSST, 0); - emu_wrptr(sc, ch, DSL, 0x10); - emu_wrptr(sc, ch, CCCA, 0); - emu_wrptr(sc, ch, Z1, 0); - emu_wrptr(sc, ch, Z2, 0); - emu_wrptr(sc, ch, FXRT, 0xd01c0000); - - emu_wrptr(sc, ch, ATKHLDM, 0); - emu_wrptr(sc, ch, DCYSUSM, 0); - emu_wrptr(sc, ch, IFATN, 0xffff); - emu_wrptr(sc, ch, PEFE, 0); - emu_wrptr(sc, ch, FMMOD, 0); - emu_wrptr(sc, ch, TREMFRQ, 24); /* 1 Hz */ - emu_wrptr(sc, ch, FM2FRQ2, 24); /* 1 Hz */ - emu_wrptr(sc, ch, TEMPENV, 0); + emu_wrptr(sc, ch, EMU_CHAN_DCYSUSV, ENV_OFF); + emu_wrptr(sc, ch, EMU_CHAN_IP, 0); + emu_wrptr(sc, ch, EMU_CHAN_VTFT, 0xffff); + emu_wrptr(sc, ch, EMU_CHAN_CVCF, 0xffff); + emu_wrptr(sc, ch, EMU_CHAN_PTRX, 0); + emu_wrptr(sc, ch, EMU_CHAN_CPF, 0); + emu_wrptr(sc, ch, EMU_CHAN_CCR, 0); + + emu_wrptr(sc, ch, EMU_CHAN_PSST, 0); + emu_wrptr(sc, ch, EMU_CHAN_DSL, 0x10); + emu_wrptr(sc, ch, EMU_CHAN_CCCA, 0); + emu_wrptr(sc, ch, EMU_CHAN_Z1, 0); + emu_wrptr(sc, ch, EMU_CHAN_Z2, 0); + emu_wrptr(sc, ch, EMU_CHAN_FXRT, 0xd01c0000); + + emu_wrptr(sc, ch, EMU_CHAN_ATKHLDM, 0); + emu_wrptr(sc, ch, EMU_CHAN_DCYSUSM, 0); + emu_wrptr(sc, ch, EMU_CHAN_IFATN, 0xffff); + emu_wrptr(sc, ch, EMU_CHAN_PEFE, 0); + emu_wrptr(sc, ch, EMU_CHAN_FMMOD, 0); + emu_wrptr(sc, ch, EMU_CHAN_TREMFRQ, 24); /* 1 Hz */ + emu_wrptr(sc, ch, EMU_CHAN_FM2FRQ2, 24); /* 1 Hz */ + emu_wrptr(sc, ch, EMU_CHAN_TEMPENV, 0); /*** these are last so OFF prevents writing ***/ - emu_wrptr(sc, ch, LFOVAL2, 0); - emu_wrptr(sc, ch, LFOVAL1, 0); - emu_wrptr(sc, ch, ATKHLDV, 0); - emu_wrptr(sc, ch, ENVVOL, 0); - emu_wrptr(sc, ch, ENVVAL, 0); + emu_wrptr(sc, ch, EMU_CHAN_LFOVAL2, 0); + emu_wrptr(sc, ch, EMU_CHAN_LFOVAL1, 0); + emu_wrptr(sc, ch, EMU_CHAN_ATKHLDV, 0); + emu_wrptr(sc, ch, EMU_CHAN_ENVVOL, 0); + emu_wrptr(sc, ch, EMU_CHAN_ENVVAL, 0); if (sc->audigy) { /* audigy cards need this to initialize correctly */ @@ -1736,9 +1818,9 @@ emu_init(struct sc_info *sc) emu_wrptr(sc, ch, 0x4e, 0); emu_wrptr(sc, ch, 0x4f, 0); /* set default routing */ - emu_wrptr(sc, ch, A_FXRT1, 0x03020100); - emu_wrptr(sc, ch, A_FXRT2, 0x3f3f3f3f); - emu_wrptr(sc, ch, A_SENDAMOUNTS, 0); + emu_wrptr(sc, ch, EMU_A_CHAN_FXRT1, 0x03020100); + emu_wrptr(sc, ch, EMU_A_CHAN_FXRT2, 0x3f3f3f3f); + emu_wrptr(sc, ch, EMU_A_CHAN_SENDAMOUNTS, 0); } sc->voice[ch].vnum = ch; @@ -1769,13 +1851,13 @@ emu_init(struct sc_info *sc) * AN = 0 (Audio data) * P = 0 (Consumer) */ - spcs = SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | - SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | - SPCS_GENERATIONSTATUS | 0x00001200 | 0x00000000 | - SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT; - emu_wrptr(sc, 0, SPCS0, spcs); - emu_wrptr(sc, 0, SPCS1, spcs); - emu_wrptr(sc, 0, SPCS2, spcs); + spcs = EMU_SPCS_CLKACCY_1000PPM | EMU_SPCS_SAMPLERATE_48 | + EMU_SPCS_CHANNELNUM_LEFT | EMU_SPCS_SOURCENUM_UNSPEC | + EMU_SPCS_GENERATIONSTATUS | 0x00001200 | 0x00000000 | + EMU_SPCS_EMPHASIS_NONE | EMU_SPCS_COPYRIGHT; + emu_wrptr(sc, 0, EMU_SPCS0, spcs); + emu_wrptr(sc, 0, EMU_SPCS1, spcs); + emu_wrptr(sc, 0, EMU_SPCS2, spcs); if (!sc->audigy) emu_initefx(sc); @@ -1786,8 +1868,8 @@ emu_init(struct sc_info *sc) u_int32_t tmp; /* Setup SRCMulti_I2S SamplingRate */ - tmp = emu_rdptr(sc, 0, A_SPDIF_SAMPLERATE) & 0xfffff1ff; - emu_wrptr(sc, 0, A_SPDIF_SAMPLERATE, tmp | 0x400); + tmp = emu_rdptr(sc, 0, EMU_A_SPDIF_SAMPLERATE) & 0xfffff1ff; + emu_wrptr(sc, 0, EMU_A_SPDIF_SAMPLERATE, tmp | 0x400); /* Setup SRCSel (Enable SPDIF, I2S SRCMulti) */ emu_wr(sc, 0x20, 0x00600000, 4); @@ -1816,13 +1898,13 @@ emu_init(struct sc_info *sc) for (i = 0; i < EMUMAXPAGES; i++) sc->mem.ptb_pages[i] = tmp | i; - emu_wrptr(sc, 0, PTB, (sc->mem.ptb_pages_addr)); - emu_wrptr(sc, 0, TCB, 0); /* taken from original driver */ - emu_wrptr(sc, 0, TCBS, 0); /* taken from original driver */ + emu_wrptr(sc, 0, EMU_PTB, (sc->mem.ptb_pages_addr)); + emu_wrptr(sc, 0, EMU_TCB, 0); /* taken from original driver */ + emu_wrptr(sc, 0, EMU_TCBS, 0); /* taken from original driver */ for (ch = 0; ch < NUM_G; ch++) { - emu_wrptr(sc, ch, MAPA, tmp | MAP_PTI_MASK); - emu_wrptr(sc, ch, MAPB, tmp | MAP_PTI_MASK); + emu_wrptr(sc, ch, EMU_CHAN_MAPA, tmp | EMU_CHAN_MAP_PTI_MASK); + emu_wrptr(sc, ch, EMU_CHAN_MAPB, tmp | EMU_CHAN_MAP_PTI_MASK); } /* emu_memalloc(sc, EMUPAGESIZE); */ @@ -1850,19 +1932,19 @@ emu_init(struct sc_info *sc) */ if (sc->audigy) { - tmp = HCFG_AUTOMUTE | HCFG_JOYENABLE; + tmp = EMU_HCFG_AUTOMUTE | EMU_HCFG_JOYENABLE; if (sc->audigy2) /* Audigy 2 */ - tmp = HCFG_AUDIOENABLE | HCFG_AC3ENABLE_CDSPDIF | - HCFG_AC3ENABLE_GPSPDIF; - emu_wr(sc, HCFG, tmp, 4); + tmp = EMU_HCFG_AUDIOENABLE | EMU_HCFG_AC3ENABLE_CDSPDIF | + EMU_HCFG_AC3ENABLE_GPSPDIF; + emu_wr(sc, EMU_HCFG, tmp, 4); audigy_initefx(sc); /* from ALSA initialization code: */ /* enable audio and disable both audio/digital outputs */ - emu_wr(sc, HCFG, emu_rd(sc, HCFG, 4) | HCFG_AUDIOENABLE, 4); - emu_wr(sc, A_IOCFG, emu_rd(sc, A_IOCFG, 4) & ~A_IOCFG_GPOUT_AD, + emu_wr(sc, EMU_HCFG, emu_rd(sc, EMU_HCFG, 4) | EMU_HCFG_AUDIOENABLE, 4); + emu_wr(sc, EMU_A_IOCFG, emu_rd(sc, EMU_A_IOCFG, 4) & ~EMU_A_IOCFG_GPOUT_AD, 4); if (sc->audigy2) { /* Audigy 2 */ /* Unmute Analog. @@ -1870,27 +1952,27 @@ emu_init(struct sc_info *sc) * init Alice3 I2SOut beyond 48kHz. * So, sequence is important. */ - emu_wr(sc, A_IOCFG, - emu_rd(sc, A_IOCFG, 4) | A_IOCFG_GPOUT_A, 4); + emu_wr(sc, EMU_A_IOCFG, + emu_rd(sc, EMU_A_IOCFG, 4) | EMU_A_IOCFG_GPOUT_A, 4); } } else { /* EMU10K1 initialization code */ - tmp = HCFG_AUDIOENABLE | HCFG_LOCKTANKCACHE_MASK - | HCFG_AUTOMUTE; + tmp = EMU_HCFG_AUDIOENABLE | EMU_HCFG_LOCKTANKCACHE_MASK + | EMU_HCFG_AUTOMUTE; if (sc->rev >= 6) - tmp |= HCFG_JOYENABLE; + tmp |= EMU_HCFG_JOYENABLE; - emu_wr(sc, HCFG, tmp, 4); + emu_wr(sc, EMU_HCFG, tmp, 4); /* TOSLink detection */ sc->tos_link = 0; - tmp = emu_rd(sc, HCFG, 4); - if (tmp & (HCFG_GPINPUT0 | HCFG_GPINPUT1)) { - emu_wr(sc, HCFG, tmp | HCFG_GPOUT1, 4); + tmp = emu_rd(sc, EMU_HCFG, 4); + if (tmp & (EMU_HCFG_GPINPUT0 | EMU_HCFG_GPINPUT1)) { + emu_wr(sc, EMU_HCFG, tmp | EMU_HCFG_GPOUT1, 4); DELAY(50); - if (tmp != (emu_rd(sc, HCFG, 4) & ~HCFG_GPOUT1)) { + if (tmp != (emu_rd(sc, EMU_HCFG, 4) & ~EMU_HCFG_GPOUT1)) { sc->tos_link = 1; - emu_wr(sc, HCFG, tmp, 4); + emu_wr(sc, EMU_HCFG, tmp, 4); } } } @@ -1903,42 +1985,42 @@ emu_uninit(struct sc_info *sc) { u_int32_t ch; - emu_wr(sc, INTE, 0, 4); + emu_wr(sc, EMU_INTE, 0, 4); for (ch = 0; ch < NUM_G; ch++) - emu_wrptr(sc, ch, DCYSUSV, ENV_OFF); + emu_wrptr(sc, ch, EMU_CHAN_DCYSUSV, ENV_OFF); for (ch = 0; ch < NUM_G; ch++) { - emu_wrptr(sc, ch, VTFT, 0); - emu_wrptr(sc, ch, CVCF, 0); - emu_wrptr(sc, ch, PTRX, 0); - emu_wrptr(sc, ch, CPF, 0); + emu_wrptr(sc, ch, EMU_CHAN_VTFT, 0); + emu_wrptr(sc, ch, EMU_CHAN_CVCF, 0); + emu_wrptr(sc, ch, EMU_CHAN_PTRX, 0); + emu_wrptr(sc, ch, EMU_CHAN_CPF, 0); } if (sc->audigy) { /* stop fx processor */ - emu_wrptr(sc, 0, A_DBG, A_DBG_SINGLE_STEP); + emu_wrptr(sc, 0, EMU_A_DBG, EMU_A_DBG_SINGLE_STEP); } /* disable audio and lock cache */ - emu_wr(sc, HCFG, - HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, + emu_wr(sc, EMU_HCFG, + EMU_HCFG_LOCKSOUNDCACHE | EMU_HCFG_LOCKTANKCACHE_MASK | EMU_HCFG_MUTEBUTTONENABLE, 4); - emu_wrptr(sc, 0, PTB, 0); + emu_wrptr(sc, 0, EMU_PTB, 0); /* reset recording buffers */ - emu_wrptr(sc, 0, MICBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, MICBA, 0); - emu_wrptr(sc, 0, FXBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, FXBA, 0); - emu_wrptr(sc, 0, FXWC, 0); - emu_wrptr(sc, 0, ADCBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, ADCBA, 0); - emu_wrptr(sc, 0, TCB, 0); - emu_wrptr(sc, 0, TCBS, 0); + emu_wrptr(sc, 0, EMU_MICBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_MICBA, 0); + emu_wrptr(sc, 0, EMU_FXBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_FXBA, 0); + emu_wrptr(sc, 0, EMU_FXWC, 0); + emu_wrptr(sc, 0, EMU_ADCBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_ADCBA, 0); + emu_wrptr(sc, 0, EMU_TCB, 0); + emu_wrptr(sc, 0, EMU_TCBS, 0); /* disable channel interrupt */ - emu_wrptr(sc, 0, CLIEL, 0); - emu_wrptr(sc, 0, CLIEH, 0); - emu_wrptr(sc, 0, SOLEL, 0); - emu_wrptr(sc, 0, SOLEH, 0); + emu_wrptr(sc, 0, EMU_CLIEL, 0); + emu_wrptr(sc, 0, EMU_CLIEH, 0); + emu_wrptr(sc, 0, EMU_SOLEL, 0); + emu_wrptr(sc, 0, EMU_SOLEH, 0); /* init envelope engine */ if (!SLIST_EMPTY(&sc->mem.blocks)) @@ -1997,7 +2079,7 @@ emu_pci_attach(device_t dev) sc->audigy = sc->type == EMU10K2_PCI_ID || sc->type == EMU10K3_PCI_ID; sc->audigy2 = (sc->audigy && sc->rev == 0x04); sc->nchans = sc->audigy ? 8 : 4; - sc->addrmask = sc->audigy ? A_PTR_ADDRESS_MASK : PTR_ADDRESS_MASK; + sc->addrmask = sc->audigy ? EMU_A_PTR_ADDR_MASK : EMU_PTR_ADDR_MASK; data = pci_read_config(dev, PCIR_COMMAND, 2); data |= (PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN); Copied: stable/9/sys/dev/sound/pci/emuxkireg.h (from r229430, head/sys/dev/sound/pci/emuxkireg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/sound/pci/emuxkireg.h Fri Feb 3 22:06:27 2012 (r230962, copy of r229430, head/sys/dev/sound/pci/emuxkireg.h) @@ -0,0 +1,689 @@ +/* $FreeBSD$ */ +/* $NetBSD: emuxkireg.h,v 1.8 2008/04/28 20:23:54 martin Exp $ */ + +/*- + * Copyright (c) 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Yannick Montulet. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#ifndef _DEV_PCI_EMUXKIREG_H_ +#define _DEV_PCI_EMUXKIREG_H_ + +/* + * Register values for Creative EMU10000. The register values have been + * taken from GPLed SBLive! header file published by Creative. The comments + * have been stripped to avoid GPL pollution in kernel. The Creative version + * including comments is available in Linux 2.4.* kernel as file + * drivers/sound/emu10k1/8010.h + */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 22:13:36 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A93451065670; Fri, 3 Feb 2012 22:13:36 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90D658FC0C; Fri, 3 Feb 2012 22:13:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13MDauK006559; Fri, 3 Feb 2012 22:13:36 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13MDaLT006554; Fri, 3 Feb 2012 22:13:36 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201202032213.q13MDaLT006554@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 3 Feb 2012 22:13:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230963 - in stable/8/sys: conf dev/sound/pci modules/sound/driver/emu10k1 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 22:13:36 -0000 Author: pfg Date: Fri Feb 3 22:13:36 2012 New Revision: 230963 URL: http://svn.freebsd.org/changeset/base/230963 Log: MFC: r229430, r229980 Replace a GPL'd header in the emu10k1 snd driver code. This brings in the emuxkireg.h from NetBSD (dev/pci) which is used for the same purpose but is smaller. The emu10k1 is now free from the GPL. While here also merge some cleanups to the module Makefile. PR: 153901 Obtained from: NetBSD Approved by: core (mentor implicit) Added: stable/8/sys/dev/sound/pci/emuxkireg.h - copied unchanged from r229430, head/sys/dev/sound/pci/emuxkireg.h Modified: stable/8/sys/conf/files stable/8/sys/dev/sound/pci/emu10k1.c stable/8/sys/modules/sound/driver/emu10k1/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/modules/sound/driver/emu10k1/ (props changed) Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Fri Feb 3 22:06:27 2012 (r230962) +++ stable/8/sys/conf/files Fri Feb 3 22:13:36 2012 (r230963) @@ -50,7 +50,7 @@ aic79xx_reg_print.c optional ahd pci aic79xx_reg_print.o optional ahd pci ahd_reg_pretty_print \ compile-with "${NORMAL_C}" \ no-implicit-rule local -emu10k1-alsa%diked.h optional snd_emu10k1 | snd_emu10kx \ +emu10k1-alsa%diked.h optional snd_emu10kx \ dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h" \ compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h emu10k1-alsa%diked.h" \ no-obj no-implicit-rule before-depend \ @@ -1601,9 +1601,7 @@ dev/sound/pci/csa.c optional snd_csa pc warning "kernel contains GPL contaminated csaimg.h header" dev/sound/pci/csapcm.c optional snd_csa pci dev/sound/pci/ds1.c optional snd_ds1 pci -dev/sound/pci/emu10k1.c optional snd_emu10k1 pci \ - dependency "emu10k1-alsa%diked.h" \ - warning "kernel contains GPL contaminated emu10k1 headers" +dev/sound/pci/emu10k1.c optional snd_emu10k1 pci dev/sound/pci/emu10kx.c optional snd_emu10kx pci \ dependency "emu10k1-alsa%diked.h" \ dependency "p16v-alsa%diked.h" \ Modified: stable/8/sys/dev/sound/pci/emu10k1.c ============================================================================== --- stable/8/sys/dev/sound/pci/emu10k1.c Fri Feb 3 22:06:27 2012 (r230962) +++ stable/8/sys/dev/sound/pci/emu10k1.c Fri Feb 3 22:13:36 2012 (r230963) @@ -32,7 +32,7 @@ #include #include -#include "emu10k1-alsa%diked.h" +#include #include #include @@ -66,12 +66,94 @@ SND_DECLARE_FILE("$FreeBSD$"); #define ENABLE 0xffffffff #define DISABLE 0x00000000 -#define ENV_ON DCYSUSV_CHANNELENABLE_MASK +#define ENV_ON EMU_CHAN_DCYSUSV_CHANNELENABLE_MASK #define ENV_OFF 0x00 /* XXX: should this be 1? */ -#define A_IOCFG_GPOUT_A 0x40 /* Analog Output */ -#define A_IOCFG_GPOUT_D 0x04 /* Digital Output */ -#define A_IOCFG_GPOUT_AD (A_IOCFG_GPOUT_A|A_IOCFG_GPOUT_D) /* A_IOCFG_GPOUT0 */ +#define EMU_A_IOCFG_GPOUT_A 0x40 +#define EMU_A_IOCFG_GPOUT_D 0x04 +#define EMU_A_IOCFG_GPOUT_AD (EMU_A_IOCFG_GPOUT_A|EMU_A_IOCFG_GPOUT_D) /* EMU_A_IOCFG_GPOUT0 */ + +#define EMU_HCFG_GPOUT1 0x00000800 + +/* instruction set */ +#define iACC3 0x06 +#define iMACINT0 0x04 +#define iINTERP 0x0e + +#define C_00000000 0x40 +#define C_00000001 0x41 +#define C_00000004 0x44 +#define C_40000000 0x4d +/* Audigy constants */ +#define A_C_00000000 0xc0 +#define A_C_40000000 0xcd + +/* GPRs */ +#define FXBUS(x) (0x00 + (x)) +#define EXTIN(x) (0x10 + (x)) +#define EXTOUT(x) (0x20 + (x)) + +#define GPR(x) (EMU_FXGPREGBASE + (x)) +#define A_EXTIN(x) (0x40 + (x)) +#define A_FXBUS(x) (0x00 + (x)) +#define A_EXTOUT(x) (0x60 + (x)) +#define A_GPR(x) (EMU_A_FXGPREGBASE + (x)) + +/* FX buses */ +#define FXBUS_PCM_LEFT 0x00 +#define FXBUS_PCM_RIGHT 0x01 +#define FXBUS_MIDI_LEFT 0x04 +#define FXBUS_MIDI_RIGHT 0x05 +#define FXBUS_MIDI_REVERB 0x0c +#define FXBUS_MIDI_CHORUS 0x0d + +/* Inputs */ +#define EXTIN_AC97_L 0x00 +#define EXTIN_AC97_R 0x01 +#define EXTIN_SPDIF_CD_L 0x02 +#define EXTIN_SPDIF_CD_R 0x03 +#define EXTIN_TOSLINK_L 0x06 +#define EXTIN_TOSLINK_R 0x07 +#define EXTIN_COAX_SPDIF_L 0x0a +#define EXTIN_COAX_SPDIF_R 0x0b +/* Audigy Inputs */ +#define A_EXTIN_AC97_L 0x00 +#define A_EXTIN_AC97_R 0x01 + +/* Outputs */ +#define EXTOUT_AC97_L 0x00 +#define EXTOUT_AC97_R 0x01 +#define EXTOUT_TOSLINK_L 0x02 +#define EXTOUT_TOSLINK_R 0x03 +#define EXTOUT_AC97_CENTER 0x04 +#define EXTOUT_AC97_LFE 0x05 +#define EXTOUT_HEADPHONE_L 0x06 +#define EXTOUT_HEADPHONE_R 0x07 +#define EXTOUT_REAR_L 0x08 +#define EXTOUT_REAR_R 0x09 +#define EXTOUT_ADC_CAP_L 0x0a +#define EXTOUT_ADC_CAP_R 0x0b +#define EXTOUT_ACENTER 0x11 +#define EXTOUT_ALFE 0x12 +/* Audigy Outputs */ +#define A_EXTOUT_FRONT_L 0x00 +#define A_EXTOUT_FRONT_R 0x01 +#define A_EXTOUT_CENTER 0x02 +#define A_EXTOUT_LFE 0x03 +#define A_EXTOUT_HEADPHONE_L 0x04 +#define A_EXTOUT_HEADPHONE_R 0x05 +#define A_EXTOUT_REAR_L 0x06 +#define A_EXTOUT_REAR_R 0x07 +#define A_EXTOUT_AFRONT_L 0x08 +#define A_EXTOUT_AFRONT_R 0x09 +#define A_EXTOUT_ACENTER 0x0a +#define A_EXTOUT_ALFE 0x0b +#define A_EXTOUT_AREAR_L 0x0e +#define A_EXTOUT_AREAR_R 0x0f +#define A_EXTOUT_AC97_L 0x10 +#define A_EXTOUT_AC97_R 0x11 +#define A_EXTOUT_ADC_CAP_L 0x16 +#define A_EXTOUT_ADC_CAP_R 0x17 struct emu_memblk { SLIST_ENTRY(emu_memblk) link; @@ -247,9 +329,9 @@ emu_rdptr(struct sc_info *sc, int chn, i { u_int32_t ptr, val, mask, size, offset; - ptr = ((reg << 16) & sc->addrmask) | (chn & PTR_CHANNELNUM_MASK); - emu_wr(sc, PTR, ptr, 4); - val = emu_rd(sc, DATA, 4); + ptr = ((reg << 16) & sc->addrmask) | (chn & EMU_PTR_CHNO_MASK); + emu_wr(sc, EMU_PTR, ptr, 4); + val = emu_rd(sc, EMU_DATA, 4); if (reg & 0xff000000) { size = (reg >> 24) & 0x3f; offset = (reg >> 16) & 0x1f; @@ -265,23 +347,23 @@ emu_wrptr(struct sc_info *sc, int chn, i { u_int32_t ptr, mask, size, offset; - ptr = ((reg << 16) & sc->addrmask) | (chn & PTR_CHANNELNUM_MASK); - emu_wr(sc, PTR, ptr, 4); + ptr = ((reg << 16) & sc->addrmask) | (chn & EMU_PTR_CHNO_MASK); + emu_wr(sc, EMU_PTR, ptr, 4); if (reg & 0xff000000) { size = (reg >> 24) & 0x3f; offset = (reg >> 16) & 0x1f; mask = ((1 << size) - 1) << offset; data <<= offset; data &= mask; - data |= emu_rd(sc, DATA, 4) & ~mask; + data |= emu_rd(sc, EMU_DATA, 4) & ~mask; } - emu_wr(sc, DATA, data, 4); + emu_wr(sc, EMU_DATA, data, 4); } static void emu_wrefx(struct sc_info *sc, unsigned int pc, unsigned int data) { - pc += sc->audigy ? A_MICROCODEBASE : MICROCODEBASE; + pc += sc->audigy ? EMU_A_MICROCODEBASE : EMU_MICROCODEBASE; emu_wrptr(sc, 0, pc, data); } @@ -294,8 +376,8 @@ emu_rdcd(kobj_t obj, void *devinfo, int { struct sc_info *sc = (struct sc_info *)devinfo; - emu_wr(sc, AC97ADDRESS, regno, 1); - return emu_rd(sc, AC97DATA, 2); + emu_wr(sc, EMU_AC97ADDR, regno, 1); + return emu_rd(sc, EMU_AC97DATA, 2); } static int @@ -303,8 +385,8 @@ emu_wrcd(kobj_t obj, void *devinfo, int { struct sc_info *sc = (struct sc_info *)devinfo; - emu_wr(sc, AC97ADDRESS, regno, 1); - emu_wr(sc, AC97DATA, data, 2); + emu_wr(sc, EMU_AC97ADDR, regno, 1); + emu_wr(sc, EMU_AC97DATA, data, 2); return 0; } @@ -346,7 +428,7 @@ emu_settimer(struct sc_info *sc) } RANGE(rate, 48, 9600); sc->timerinterval = 48000 / rate; - emu_wr(sc, TIMER, sc->timerinterval & 0x03ff, 2); + emu_wr(sc, EMU_TIMER, sc->timerinterval & 0x03ff, 2); return sc->timerinterval; } @@ -357,15 +439,15 @@ emu_enatimer(struct sc_info *sc, int go) u_int32_t x; if (go) { if (sc->timer++ == 0) { - x = emu_rd(sc, INTE, 4); - x |= INTE_INTERVALTIMERENB; - emu_wr(sc, INTE, x, 4); + x = emu_rd(sc, EMU_INTE, 4); + x |= EMU_INTE_INTERTIMERENB; + emu_wr(sc, EMU_INTE, x, 4); } } else { sc->timer = 0; - x = emu_rd(sc, INTE, 4); - x &= ~INTE_INTERVALTIMERENB; - emu_wr(sc, INTE, x, 4); + x = emu_rd(sc, EMU_INTE, 4); + x &= ~EMU_INTE_INTERTIMERENB; + emu_wr(sc, EMU_INTE, x, 4); } return 0; } @@ -373,7 +455,7 @@ emu_enatimer(struct sc_info *sc, int go) static void emu_enastop(struct sc_info *sc, char channel, int enable) { - int reg = (channel & 0x20) ? SOLEH : SOLEL; + int reg = (channel & 0x20) ? EMU_SOLEH : EMU_SOLEL; channel &= 0x1f; reg |= 1 << 24; reg |= channel << 16; @@ -568,49 +650,49 @@ emu_vwrite(struct sc_info *sc, struct em r = v->ismaster ? 0 : r; } - emu_wrptr(sc, v->vnum, CPF, v->stereo ? CPF_STEREO_MASK : 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF, v->stereo ? EMU_CHAN_CPF_STEREO_MASK : 0); val = v->stereo ? 28 : 30; val *= v->b16 ? 1 : 2; start = sa + val; if (sc->audigy) { - emu_wrptr(sc, v->vnum, A_FXRT1, v->fxrt1); - emu_wrptr(sc, v->vnum, A_FXRT2, v->fxrt2); - emu_wrptr(sc, v->vnum, A_SENDAMOUNTS, 0); + emu_wrptr(sc, v->vnum, EMU_A_CHAN_FXRT1, v->fxrt1); + emu_wrptr(sc, v->vnum, EMU_A_CHAN_FXRT2, v->fxrt2); + emu_wrptr(sc, v->vnum, EMU_A_CHAN_SENDAMOUNTS, 0); } else - emu_wrptr(sc, v->vnum, FXRT, v->fxrt1 << 16); + emu_wrptr(sc, v->vnum, EMU_CHAN_FXRT, v->fxrt1 << 16); - emu_wrptr(sc, v->vnum, PTRX, (x << 8) | r); - emu_wrptr(sc, v->vnum, DSL, ea | (y << 24)); - emu_wrptr(sc, v->vnum, PSST, sa | (l << 24)); - emu_wrptr(sc, v->vnum, CCCA, start | (v->b16 ? 0 : CCCA_8BITSELECT)); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX, (x << 8) | r); + emu_wrptr(sc, v->vnum, EMU_CHAN_DSL, ea | (y << 24)); + emu_wrptr(sc, v->vnum, EMU_CHAN_PSST, sa | (l << 24)); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCCA, start | (v->b16 ? 0 : EMU_CHAN_CCCA_8BITSELECT)); - emu_wrptr(sc, v->vnum, Z1, 0); - emu_wrptr(sc, v->vnum, Z2, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_Z1, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_Z2, 0); silent_page = ((u_int32_t)(sc->mem.silent_page_addr) << 1) - | MAP_PTI_MASK; - emu_wrptr(sc, v->vnum, MAPA, silent_page); - emu_wrptr(sc, v->vnum, MAPB, silent_page); - - emu_wrptr(sc, v->vnum, CVCF, CVCF_CURRENTFILTER_MASK); - emu_wrptr(sc, v->vnum, VTFT, VTFT_FILTERTARGET_MASK); - emu_wrptr(sc, v->vnum, ATKHLDM, 0); - emu_wrptr(sc, v->vnum, DCYSUSM, DCYSUSM_DECAYTIME_MASK); - emu_wrptr(sc, v->vnum, LFOVAL1, 0x8000); - emu_wrptr(sc, v->vnum, LFOVAL2, 0x8000); - emu_wrptr(sc, v->vnum, FMMOD, 0); - emu_wrptr(sc, v->vnum, TREMFRQ, 0); - emu_wrptr(sc, v->vnum, FM2FRQ2, 0); - emu_wrptr(sc, v->vnum, ENVVAL, 0x8000); - - emu_wrptr(sc, v->vnum, ATKHLDV, - ATKHLDV_HOLDTIME_MASK | ATKHLDV_ATTACKTIME_MASK); - emu_wrptr(sc, v->vnum, ENVVOL, 0x8000); + | EMU_CHAN_MAP_PTI_MASK; + emu_wrptr(sc, v->vnum, EMU_CHAN_MAPA, silent_page); + emu_wrptr(sc, v->vnum, EMU_CHAN_MAPB, silent_page); + + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, EMU_CHAN_CVCF_CURRFILTER_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, EMU_CHAN_VTFT_FILTERTARGET_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_ATKHLDM, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_DCYSUSM, EMU_CHAN_DCYSUSM_DECAYTIME_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_LFOVAL1, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_LFOVAL2, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_FMMOD, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_TREMFRQ, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_FM2FRQ2, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_ENVVAL, 0x8000); + + emu_wrptr(sc, v->vnum, EMU_CHAN_ATKHLDV, + EMU_CHAN_ATKHLDV_HOLDTIME_MASK | EMU_CHAN_ATKHLDV_ATTACKTIME_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_ENVVOL, 0x8000); - emu_wrptr(sc, v->vnum, PEFE_FILTERAMOUNT, 0x7f); - emu_wrptr(sc, v->vnum, PEFE_PITCHAMOUNT, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_PEFE_FILTERAMOUNT, 0x7f); + emu_wrptr(sc, v->vnum, EMU_CHAN_PEFE_PITCHAMOUNT, 0); if (v->slave != NULL) emu_vwrite(sc, v->slave); @@ -631,29 +713,29 @@ emu_vtrigger(struct sc_info *sc, struct sample = v->b16 ? 0x00000000 : 0x80808080; for (i = 0; i < cs; i++) - emu_wrptr(sc, v->vnum, CD0 + i, sample); - emu_wrptr(sc, v->vnum, CCR_CACHEINVALIDSIZE, 0); - emu_wrptr(sc, v->vnum, CCR_READADDRESS, cra); - emu_wrptr(sc, v->vnum, CCR_CACHEINVALIDSIZE, ccis); - - emu_wrptr(sc, v->vnum, IFATN, 0xff00); - emu_wrptr(sc, v->vnum, VTFT, 0xffffffff); - emu_wrptr(sc, v->vnum, CVCF, 0xffffffff); - emu_wrptr(sc, v->vnum, DCYSUSV, 0x00007f7f); + emu_wrptr(sc, v->vnum, EMU_CHAN_CD0 + i, sample); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_CACHEINVALIDSIZE, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_READADDRESS, cra); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_CACHEINVALIDSIZE, ccis); + + emu_wrptr(sc, v->vnum, EMU_CHAN_IFATN, 0xff00); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, 0xffffffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, 0xffffffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_DCYSUSV, 0x00007f7f); emu_enastop(sc, v->vnum, 0); pitch_target = emu_rate_to_linearpitch(v->speed); initial_pitch = emu_rate_to_pitch(v->speed) >> 8; - emu_wrptr(sc, v->vnum, PTRX_PITCHTARGET, pitch_target); - emu_wrptr(sc, v->vnum, CPF_CURRENTPITCH, pitch_target); - emu_wrptr(sc, v->vnum, IP, initial_pitch); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX_PITCHTARGET, pitch_target); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF_PITCH, pitch_target); + emu_wrptr(sc, v->vnum, EMU_CHAN_IP, initial_pitch); } else { - emu_wrptr(sc, v->vnum, PTRX_PITCHTARGET, 0); - emu_wrptr(sc, v->vnum, CPF_CURRENTPITCH, 0); - emu_wrptr(sc, v->vnum, IFATN, 0xffff); - emu_wrptr(sc, v->vnum, VTFT, 0x0000ffff); - emu_wrptr(sc, v->vnum, CVCF, 0x0000ffff); - emu_wrptr(sc, v->vnum, IP, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX_PITCHTARGET, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF_PITCH, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_IFATN, 0xffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, 0x0000ffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, 0x0000ffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_IP, 0); emu_enastop(sc, v->vnum, 1); } if (v->slave != NULL) @@ -666,7 +748,7 @@ emu_vpos(struct sc_info *sc, struct emu_ int s, ptr; s = (v->b16 ? 1 : 0) + (v->stereo ? 1 : 0); - ptr = (emu_rdptr(sc, v->vnum, CCCA_CURRADDR) - (v->start >> s)) << s; + ptr = (emu_rdptr(sc, v->vnum, EMU_CHAN_CCCA_CURRADDR) - (v->start >> s)) << s; return ptr & ~0x0000001f; } @@ -875,27 +957,27 @@ emurchan_init(kobj_t obj, void *devinfo, ch->num = sc->rnum; switch(sc->rnum) { case 0: - ch->idxreg = sc->audigy ? A_ADCIDX : ADCIDX; - ch->basereg = ADCBA; - ch->sizereg = ADCBS; - ch->setupreg = ADCCR; - ch->irqmask = INTE_ADCBUFENABLE; + ch->idxreg = sc->audigy ? EMU_A_ADCIDX : EMU_ADCIDX; + ch->basereg = EMU_ADCBA; + ch->sizereg = EMU_ADCBS; + ch->setupreg = EMU_ADCCR; + ch->irqmask = EMU_INTE_ADCBUFENABLE; break; case 1: - ch->idxreg = FXIDX; - ch->basereg = FXBA; - ch->sizereg = FXBS; - ch->setupreg = FXWC; - ch->irqmask = INTE_EFXBUFENABLE; + ch->idxreg = EMU_FXIDX; + ch->basereg = EMU_FXBA; + ch->sizereg = EMU_FXBS; + ch->setupreg = EMU_FXWC; + ch->irqmask = EMU_INTE_EFXBUFENABLE; break; case 2: - ch->idxreg = MICIDX; - ch->basereg = MICBA; - ch->sizereg = MICBS; + ch->idxreg = EMU_MICIDX; + ch->basereg = EMU_MICBA; + ch->sizereg = EMU_MICBS; ch->setupreg = 0; - ch->irqmask = INTE_MICBUFENABLE; + ch->irqmask = EMU_INTE_MICBUFENABLE; break; } sc->rnum++; @@ -967,27 +1049,27 @@ emurchan_trigger(kobj_t obj, void *data, switch(sc->bufsz) { case 4096: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; break; case 8192: - sz = ADCBS_BUFSIZE_8192; + sz = EMU_RECBS_BUFSIZE_8192; break; case 16384: - sz = ADCBS_BUFSIZE_16384; + sz = EMU_RECBS_BUFSIZE_16384; break; case 32768: - sz = ADCBS_BUFSIZE_32768; + sz = EMU_RECBS_BUFSIZE_32768; break; case 65536: - sz = ADCBS_BUFSIZE_65536; + sz = EMU_RECBS_BUFSIZE_65536; break; default: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; } snd_mtxlock(sc->lock); @@ -997,23 +1079,23 @@ emurchan_trigger(kobj_t obj, void *data, emu_wrptr(sc, 0, ch->sizereg, sz); if (ch->num == 0) { if (sc->audigy) { - val = A_ADCCR_LCHANENABLE; + val = EMU_A_ADCCR_LCHANENABLE; if (AFMT_CHANNEL(ch->fmt) > 1) - val |= A_ADCCR_RCHANENABLE; + val |= EMU_A_ADCCR_RCHANENABLE; val |= audigy_recval(ch->spd); } else { - val = ADCCR_LCHANENABLE; + val = EMU_ADCCR_LCHANENABLE; if (AFMT_CHANNEL(ch->fmt) > 1) - val |= ADCCR_RCHANENABLE; + val |= EMU_ADCCR_RCHANENABLE; val |= emu_recval(ch->spd); } emu_wrptr(sc, 0, ch->setupreg, 0); emu_wrptr(sc, 0, ch->setupreg, val); } - val = emu_rd(sc, INTE, 4); + val = emu_rd(sc, EMU_INTE, 4); val |= ch->irqmask; - emu_wr(sc, INTE, val, 4); + emu_wr(sc, EMU_INTE, val, 4); break; case PCMTRIG_STOP: @@ -1022,9 +1104,9 @@ emurchan_trigger(kobj_t obj, void *data, emu_wrptr(sc, 0, ch->sizereg, 0); if (ch->setupreg) emu_wrptr(sc, 0, ch->setupreg, 0); - val = emu_rd(sc, INTE, 4); + val = emu_rd(sc, EMU_INTE, 4); val &= ~ch->irqmask; - emu_wr(sc, INTE, val, 4); + emu_wr(sc, EMU_INTE, val, 4); break; case PCMTRIG_EMLDMAWR: @@ -1122,9 +1204,9 @@ emu_midiattach(struct sc_info *sc) { int i; - i = emu_rd(sc, INTE, 4); - i |= INTE_MIDIRXENABLE; - emu_wr(sc, INTE, i, 4); + i = emu_rd(sc, EMU_INTE, 4); + i |= EMU_INTE_MIDIRXENABLE; + emu_wr(sc, EMU_INTE, i, 4); sc->mpu = mpu401_init(&emu_mpu_class, sc, emu_intr2, &sc->mpu_intr); } @@ -1139,52 +1221,52 @@ emu_intr(void *data) snd_mtxlock(sc->lock); while (1) { - stat = emu_rd(sc, IPR, 4); + stat = emu_rd(sc, EMU_IPR, 4); if (stat == 0) break; ack = 0; /* process irq */ - if (stat & IPR_INTERVALTIMER) - ack |= IPR_INTERVALTIMER; + if (stat & EMU_IPR_INTERVALTIMER) + ack |= EMU_IPR_INTERVALTIMER; - if (stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL)) - ack |= stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL); + if (stat & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL)) + ack |= stat & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL); - if (stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL)) - ack |= stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL); + if (stat & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL)) + ack |= stat & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL); - if (stat & (IPR_MICBUFFULL | IPR_MICBUFHALFFULL)) - ack |= stat & (IPR_MICBUFFULL | IPR_MICBUFHALFFULL); + if (stat & (EMU_IPR_MICBUFFULL | EMU_IPR_MICBUFHALFFULL)) + ack |= stat & (EMU_IPR_MICBUFFULL | EMU_IPR_MICBUFHALFFULL); - if (stat & IPR_PCIERROR) { - ack |= IPR_PCIERROR; + if (stat & EMU_PCIERROR) { + ack |= EMU_PCIERROR; device_printf(sc->dev, "pci error\n"); /* we still get an nmi with ecc ram even if we ack this */ } - if (stat & IPR_SAMPLERATETRACKER) { - ack |= IPR_SAMPLERATETRACKER; + if (stat & EMU_IPR_RATETRCHANGE) { + ack |= EMU_IPR_RATETRCHANGE; #ifdef EMUDEBUG device_printf(sc->dev, "sample rate tracker lock status change\n"); #endif } - if (stat & IPR_MIDIRECVBUFEMPTY) + if (stat & EMU_IPR_MIDIRECVBUFE) if (sc->mpu_intr) { (sc->mpu_intr)(sc->mpu); - ack |= IPR_MIDIRECVBUFEMPTY | IPR_MIDITRANSBUFEMPTY; + ack |= EMU_IPR_MIDIRECVBUFE | EMU_IPR_MIDITRANSBUFE; } if (stat & ~ack) device_printf(sc->dev, "dodgy irq: %x (harmless)\n", stat & ~ack); - emu_wr(sc, IPR, stat, 4); + emu_wr(sc, EMU_IPR, stat, 4); if (ack) { snd_mtxunlock(sc->lock); - if (ack & IPR_INTERVALTIMER) { + if (ack & EMU_IPR_INTERVALTIMER) { x = 0; for (i = 0; i < sc->nchans; i++) { if (sc->pch[i].run) { @@ -1197,15 +1279,15 @@ emu_intr(void *data) } - if (ack & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL)) { + if (ack & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL)) { if (sc->rch[0].channel) chn_intr(sc->rch[0].channel); } - if (ack & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL)) { + if (ack & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL)) { if (sc->rch[1].channel) chn_intr(sc->rch[1].channel); } - if (ack & (IPR_MICBUFFULL | IPR_MICBUFHALFFULL)) { + if (ack & (EMU_IPR_MICBUFFULL | EMU_IPR_MICBUFHALFFULL)) { if (sc->rch[2].channel) chn_intr(sc->rch[2].channel); } @@ -1378,12 +1460,12 @@ audigy_initefx(struct sc_info *sc) audigy_addefxop(sc, 0x0f, 0x0c0, 0x0c0, 0x0cf, 0x0c0, &pc); for (i = 0; i < 512; i++) - emu_wrptr(sc, 0, A_FXGPREGBASE + i, 0x0); + emu_wrptr(sc, 0, EMU_A_FXGPREGBASE + i, 0x0); pc = 16; /* stop fx processor */ - emu_wrptr(sc, 0, A_DBG, A_DBG_SINGLE_STEP); + emu_wrptr(sc, 0, EMU_A_DBG, EMU_A_DBG_SINGLE_STEP); /* Audigy 2 (EMU10K2) DSP Registers: FX Bus @@ -1518,7 +1600,7 @@ audigy_initefx(struct sc_info *sc) A_C_00000000, A_EXTIN(A_EXTIN_AC97_R), &pc); /* resume normal operations */ - emu_wrptr(sc, 0, A_DBG, 0); + emu_wrptr(sc, 0, EMU_A_DBG, 0); } static void @@ -1534,7 +1616,7 @@ emu_initefx(struct sc_info *sc) } for (i = 0; i < 256; i++) - emu_wrptr(sc, 0, FXGPREGBASE + i, 0); + emu_wrptr(sc, 0, EMU_FXGPREGBASE + i, 0); /* FX-8010 DSP Registers: FX Bus @@ -1654,7 +1736,7 @@ emu_initefx(struct sc_info *sc) C_00000000, EXTIN(EXTIN_AC97_R), &pc); /* resume normal operations */ - emu_wrptr(sc, 0, DBG, 0); + emu_wrptr(sc, 0, EMU_DBG, 0); } /* Probe and attach the card */ @@ -1665,69 +1747,69 @@ emu_init(struct sc_info *sc) if (sc->audigy) { /* enable additional AC97 slots */ - emu_wrptr(sc, 0, AC97SLOT, AC97SLOT_CNTR | AC97SLOT_LFE); + emu_wrptr(sc, 0, EMU_AC97SLOT, EMU_AC97SLOT_CENTER | EMU_AC97SLOT_LFE); } /* disable audio and lock cache */ - emu_wr(sc, HCFG, - HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, + emu_wr(sc, EMU_HCFG, + EMU_HCFG_LOCKSOUNDCACHE | EMU_HCFG_LOCKTANKCACHE_MASK | EMU_HCFG_MUTEBUTTONENABLE, 4); /* reset recording buffers */ - emu_wrptr(sc, 0, MICBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, MICBA, 0); - emu_wrptr(sc, 0, FXBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, FXBA, 0); - emu_wrptr(sc, 0, ADCBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, ADCBA, 0); + emu_wrptr(sc, 0, EMU_MICBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_MICBA, 0); + emu_wrptr(sc, 0, EMU_FXBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_FXBA, 0); + emu_wrptr(sc, 0, EMU_ADCBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_ADCBA, 0); /* disable channel interrupt */ - emu_wr(sc, INTE, - INTE_INTERVALTIMERENB | INTE_SAMPLERATETRACKER | INTE_PCIERRORENABLE, + emu_wr(sc, EMU_INTE, + EMU_INTE_INTERTIMERENB | EMU_INTE_SAMPLERATER | EMU_INTE_PCIERRENABLE, 4); - emu_wrptr(sc, 0, CLIEL, 0); - emu_wrptr(sc, 0, CLIEH, 0); - emu_wrptr(sc, 0, SOLEL, 0); - emu_wrptr(sc, 0, SOLEH, 0); + emu_wrptr(sc, 0, EMU_CLIEL, 0); + emu_wrptr(sc, 0, EMU_CLIEH, 0); + emu_wrptr(sc, 0, EMU_SOLEL, 0); + emu_wrptr(sc, 0, EMU_SOLEH, 0); /* wonder what these do... */ if (sc->audigy) { - emu_wrptr(sc, 0, SPBYPASS, 0xf00); - emu_wrptr(sc, 0, AC97SLOT, 0x3); + emu_wrptr(sc, 0, EMU_SPBYPASS, 0xf00); + emu_wrptr(sc, 0, EMU_AC97SLOT, 0x3); } /* init envelope engine */ for (ch = 0; ch < NUM_G; ch++) { - emu_wrptr(sc, ch, DCYSUSV, ENV_OFF); - emu_wrptr(sc, ch, IP, 0); - emu_wrptr(sc, ch, VTFT, 0xffff); - emu_wrptr(sc, ch, CVCF, 0xffff); - emu_wrptr(sc, ch, PTRX, 0); - emu_wrptr(sc, ch, CPF, 0); - emu_wrptr(sc, ch, CCR, 0); - - emu_wrptr(sc, ch, PSST, 0); - emu_wrptr(sc, ch, DSL, 0x10); - emu_wrptr(sc, ch, CCCA, 0); - emu_wrptr(sc, ch, Z1, 0); - emu_wrptr(sc, ch, Z2, 0); - emu_wrptr(sc, ch, FXRT, 0xd01c0000); - - emu_wrptr(sc, ch, ATKHLDM, 0); - emu_wrptr(sc, ch, DCYSUSM, 0); - emu_wrptr(sc, ch, IFATN, 0xffff); - emu_wrptr(sc, ch, PEFE, 0); - emu_wrptr(sc, ch, FMMOD, 0); - emu_wrptr(sc, ch, TREMFRQ, 24); /* 1 Hz */ - emu_wrptr(sc, ch, FM2FRQ2, 24); /* 1 Hz */ - emu_wrptr(sc, ch, TEMPENV, 0); + emu_wrptr(sc, ch, EMU_CHAN_DCYSUSV, ENV_OFF); + emu_wrptr(sc, ch, EMU_CHAN_IP, 0); + emu_wrptr(sc, ch, EMU_CHAN_VTFT, 0xffff); + emu_wrptr(sc, ch, EMU_CHAN_CVCF, 0xffff); + emu_wrptr(sc, ch, EMU_CHAN_PTRX, 0); + emu_wrptr(sc, ch, EMU_CHAN_CPF, 0); + emu_wrptr(sc, ch, EMU_CHAN_CCR, 0); + + emu_wrptr(sc, ch, EMU_CHAN_PSST, 0); + emu_wrptr(sc, ch, EMU_CHAN_DSL, 0x10); + emu_wrptr(sc, ch, EMU_CHAN_CCCA, 0); + emu_wrptr(sc, ch, EMU_CHAN_Z1, 0); + emu_wrptr(sc, ch, EMU_CHAN_Z2, 0); + emu_wrptr(sc, ch, EMU_CHAN_FXRT, 0xd01c0000); + + emu_wrptr(sc, ch, EMU_CHAN_ATKHLDM, 0); + emu_wrptr(sc, ch, EMU_CHAN_DCYSUSM, 0); + emu_wrptr(sc, ch, EMU_CHAN_IFATN, 0xffff); + emu_wrptr(sc, ch, EMU_CHAN_PEFE, 0); + emu_wrptr(sc, ch, EMU_CHAN_FMMOD, 0); + emu_wrptr(sc, ch, EMU_CHAN_TREMFRQ, 24); /* 1 Hz */ + emu_wrptr(sc, ch, EMU_CHAN_FM2FRQ2, 24); /* 1 Hz */ + emu_wrptr(sc, ch, EMU_CHAN_TEMPENV, 0); /*** these are last so OFF prevents writing ***/ - emu_wrptr(sc, ch, LFOVAL2, 0); - emu_wrptr(sc, ch, LFOVAL1, 0); - emu_wrptr(sc, ch, ATKHLDV, 0); - emu_wrptr(sc, ch, ENVVOL, 0); - emu_wrptr(sc, ch, ENVVAL, 0); + emu_wrptr(sc, ch, EMU_CHAN_LFOVAL2, 0); + emu_wrptr(sc, ch, EMU_CHAN_LFOVAL1, 0); + emu_wrptr(sc, ch, EMU_CHAN_ATKHLDV, 0); + emu_wrptr(sc, ch, EMU_CHAN_ENVVOL, 0); + emu_wrptr(sc, ch, EMU_CHAN_ENVVAL, 0); if (sc->audigy) { /* audigy cards need this to initialize correctly */ @@ -1736,9 +1818,9 @@ emu_init(struct sc_info *sc) emu_wrptr(sc, ch, 0x4e, 0); emu_wrptr(sc, ch, 0x4f, 0); /* set default routing */ - emu_wrptr(sc, ch, A_FXRT1, 0x03020100); - emu_wrptr(sc, ch, A_FXRT2, 0x3f3f3f3f); - emu_wrptr(sc, ch, A_SENDAMOUNTS, 0); + emu_wrptr(sc, ch, EMU_A_CHAN_FXRT1, 0x03020100); + emu_wrptr(sc, ch, EMU_A_CHAN_FXRT2, 0x3f3f3f3f); + emu_wrptr(sc, ch, EMU_A_CHAN_SENDAMOUNTS, 0); } sc->voice[ch].vnum = ch; @@ -1769,13 +1851,13 @@ emu_init(struct sc_info *sc) * AN = 0 (Audio data) * P = 0 (Consumer) */ - spcs = SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | - SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | - SPCS_GENERATIONSTATUS | 0x00001200 | 0x00000000 | - SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT; - emu_wrptr(sc, 0, SPCS0, spcs); - emu_wrptr(sc, 0, SPCS1, spcs); - emu_wrptr(sc, 0, SPCS2, spcs); + spcs = EMU_SPCS_CLKACCY_1000PPM | EMU_SPCS_SAMPLERATE_48 | + EMU_SPCS_CHANNELNUM_LEFT | EMU_SPCS_SOURCENUM_UNSPEC | + EMU_SPCS_GENERATIONSTATUS | 0x00001200 | 0x00000000 | + EMU_SPCS_EMPHASIS_NONE | EMU_SPCS_COPYRIGHT; + emu_wrptr(sc, 0, EMU_SPCS0, spcs); + emu_wrptr(sc, 0, EMU_SPCS1, spcs); + emu_wrptr(sc, 0, EMU_SPCS2, spcs); if (!sc->audigy) emu_initefx(sc); @@ -1786,8 +1868,8 @@ emu_init(struct sc_info *sc) u_int32_t tmp; /* Setup SRCMulti_I2S SamplingRate */ - tmp = emu_rdptr(sc, 0, A_SPDIF_SAMPLERATE) & 0xfffff1ff; - emu_wrptr(sc, 0, A_SPDIF_SAMPLERATE, tmp | 0x400); + tmp = emu_rdptr(sc, 0, EMU_A_SPDIF_SAMPLERATE) & 0xfffff1ff; + emu_wrptr(sc, 0, EMU_A_SPDIF_SAMPLERATE, tmp | 0x400); /* Setup SRCSel (Enable SPDIF, I2S SRCMulti) */ emu_wr(sc, 0x20, 0x00600000, 4); @@ -1816,13 +1898,13 @@ emu_init(struct sc_info *sc) for (i = 0; i < EMUMAXPAGES; i++) sc->mem.ptb_pages[i] = tmp | i; - emu_wrptr(sc, 0, PTB, (sc->mem.ptb_pages_addr)); - emu_wrptr(sc, 0, TCB, 0); /* taken from original driver */ - emu_wrptr(sc, 0, TCBS, 0); /* taken from original driver */ + emu_wrptr(sc, 0, EMU_PTB, (sc->mem.ptb_pages_addr)); + emu_wrptr(sc, 0, EMU_TCB, 0); /* taken from original driver */ + emu_wrptr(sc, 0, EMU_TCBS, 0); /* taken from original driver */ for (ch = 0; ch < NUM_G; ch++) { - emu_wrptr(sc, ch, MAPA, tmp | MAP_PTI_MASK); - emu_wrptr(sc, ch, MAPB, tmp | MAP_PTI_MASK); + emu_wrptr(sc, ch, EMU_CHAN_MAPA, tmp | EMU_CHAN_MAP_PTI_MASK); + emu_wrptr(sc, ch, EMU_CHAN_MAPB, tmp | EMU_CHAN_MAP_PTI_MASK); } /* emu_memalloc(sc, EMUPAGESIZE); */ @@ -1850,19 +1932,19 @@ emu_init(struct sc_info *sc) */ if (sc->audigy) { - tmp = HCFG_AUTOMUTE | HCFG_JOYENABLE; + tmp = EMU_HCFG_AUTOMUTE | EMU_HCFG_JOYENABLE; if (sc->audigy2) /* Audigy 2 */ - tmp = HCFG_AUDIOENABLE | HCFG_AC3ENABLE_CDSPDIF | - HCFG_AC3ENABLE_GPSPDIF; - emu_wr(sc, HCFG, tmp, 4); + tmp = EMU_HCFG_AUDIOENABLE | EMU_HCFG_AC3ENABLE_CDSPDIF | + EMU_HCFG_AC3ENABLE_GPSPDIF; + emu_wr(sc, EMU_HCFG, tmp, 4); audigy_initefx(sc); /* from ALSA initialization code: */ /* enable audio and disable both audio/digital outputs */ - emu_wr(sc, HCFG, emu_rd(sc, HCFG, 4) | HCFG_AUDIOENABLE, 4); - emu_wr(sc, A_IOCFG, emu_rd(sc, A_IOCFG, 4) & ~A_IOCFG_GPOUT_AD, + emu_wr(sc, EMU_HCFG, emu_rd(sc, EMU_HCFG, 4) | EMU_HCFG_AUDIOENABLE, 4); + emu_wr(sc, EMU_A_IOCFG, emu_rd(sc, EMU_A_IOCFG, 4) & ~EMU_A_IOCFG_GPOUT_AD, 4); if (sc->audigy2) { /* Audigy 2 */ /* Unmute Analog. @@ -1870,27 +1952,27 @@ emu_init(struct sc_info *sc) * init Alice3 I2SOut beyond 48kHz. * So, sequence is important. */ - emu_wr(sc, A_IOCFG, - emu_rd(sc, A_IOCFG, 4) | A_IOCFG_GPOUT_A, 4); + emu_wr(sc, EMU_A_IOCFG, + emu_rd(sc, EMU_A_IOCFG, 4) | EMU_A_IOCFG_GPOUT_A, 4); } } else { /* EMU10K1 initialization code */ - tmp = HCFG_AUDIOENABLE | HCFG_LOCKTANKCACHE_MASK - | HCFG_AUTOMUTE; + tmp = EMU_HCFG_AUDIOENABLE | EMU_HCFG_LOCKTANKCACHE_MASK + | EMU_HCFG_AUTOMUTE; if (sc->rev >= 6) - tmp |= HCFG_JOYENABLE; + tmp |= EMU_HCFG_JOYENABLE; - emu_wr(sc, HCFG, tmp, 4); + emu_wr(sc, EMU_HCFG, tmp, 4); /* TOSLink detection */ sc->tos_link = 0; - tmp = emu_rd(sc, HCFG, 4); - if (tmp & (HCFG_GPINPUT0 | HCFG_GPINPUT1)) { - emu_wr(sc, HCFG, tmp | HCFG_GPOUT1, 4); + tmp = emu_rd(sc, EMU_HCFG, 4); + if (tmp & (EMU_HCFG_GPINPUT0 | EMU_HCFG_GPINPUT1)) { + emu_wr(sc, EMU_HCFG, tmp | EMU_HCFG_GPOUT1, 4); DELAY(50); - if (tmp != (emu_rd(sc, HCFG, 4) & ~HCFG_GPOUT1)) { + if (tmp != (emu_rd(sc, EMU_HCFG, 4) & ~EMU_HCFG_GPOUT1)) { sc->tos_link = 1; - emu_wr(sc, HCFG, tmp, 4); + emu_wr(sc, EMU_HCFG, tmp, 4); } } } @@ -1903,42 +1985,42 @@ emu_uninit(struct sc_info *sc) { u_int32_t ch; - emu_wr(sc, INTE, 0, 4); + emu_wr(sc, EMU_INTE, 0, 4); for (ch = 0; ch < NUM_G; ch++) - emu_wrptr(sc, ch, DCYSUSV, ENV_OFF); + emu_wrptr(sc, ch, EMU_CHAN_DCYSUSV, ENV_OFF); for (ch = 0; ch < NUM_G; ch++) { - emu_wrptr(sc, ch, VTFT, 0); - emu_wrptr(sc, ch, CVCF, 0); - emu_wrptr(sc, ch, PTRX, 0); - emu_wrptr(sc, ch, CPF, 0); + emu_wrptr(sc, ch, EMU_CHAN_VTFT, 0); + emu_wrptr(sc, ch, EMU_CHAN_CVCF, 0); + emu_wrptr(sc, ch, EMU_CHAN_PTRX, 0); + emu_wrptr(sc, ch, EMU_CHAN_CPF, 0); } if (sc->audigy) { /* stop fx processor */ - emu_wrptr(sc, 0, A_DBG, A_DBG_SINGLE_STEP); + emu_wrptr(sc, 0, EMU_A_DBG, EMU_A_DBG_SINGLE_STEP); } /* disable audio and lock cache */ - emu_wr(sc, HCFG, - HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, + emu_wr(sc, EMU_HCFG, + EMU_HCFG_LOCKSOUNDCACHE | EMU_HCFG_LOCKTANKCACHE_MASK | EMU_HCFG_MUTEBUTTONENABLE, 4); - emu_wrptr(sc, 0, PTB, 0); + emu_wrptr(sc, 0, EMU_PTB, 0); /* reset recording buffers */ - emu_wrptr(sc, 0, MICBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, MICBA, 0); - emu_wrptr(sc, 0, FXBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, FXBA, 0); - emu_wrptr(sc, 0, FXWC, 0); - emu_wrptr(sc, 0, ADCBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, ADCBA, 0); - emu_wrptr(sc, 0, TCB, 0); - emu_wrptr(sc, 0, TCBS, 0); + emu_wrptr(sc, 0, EMU_MICBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_MICBA, 0); + emu_wrptr(sc, 0, EMU_FXBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_FXBA, 0); + emu_wrptr(sc, 0, EMU_FXWC, 0); + emu_wrptr(sc, 0, EMU_ADCBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_ADCBA, 0); + emu_wrptr(sc, 0, EMU_TCB, 0); + emu_wrptr(sc, 0, EMU_TCBS, 0); /* disable channel interrupt */ - emu_wrptr(sc, 0, CLIEL, 0); - emu_wrptr(sc, 0, CLIEH, 0); - emu_wrptr(sc, 0, SOLEL, 0); - emu_wrptr(sc, 0, SOLEH, 0); + emu_wrptr(sc, 0, EMU_CLIEL, 0); + emu_wrptr(sc, 0, EMU_CLIEH, 0); + emu_wrptr(sc, 0, EMU_SOLEL, 0); + emu_wrptr(sc, 0, EMU_SOLEH, 0); /* init envelope engine */ if (!SLIST_EMPTY(&sc->mem.blocks)) @@ -1997,7 +2079,7 @@ emu_pci_attach(device_t dev) sc->audigy = sc->type == EMU10K2_PCI_ID || sc->type == EMU10K3_PCI_ID; sc->audigy2 = (sc->audigy && sc->rev == 0x04); sc->nchans = sc->audigy ? 8 : 4; - sc->addrmask = sc->audigy ? A_PTR_ADDRESS_MASK : PTR_ADDRESS_MASK; + sc->addrmask = sc->audigy ? EMU_A_PTR_ADDR_MASK : EMU_PTR_ADDR_MASK; data = pci_read_config(dev, PCIR_COMMAND, 2); data |= (PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN); Copied: stable/8/sys/dev/sound/pci/emuxkireg.h (from r229430, head/sys/dev/sound/pci/emuxkireg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/dev/sound/pci/emuxkireg.h Fri Feb 3 22:13:36 2012 (r230963, copy of r229430, head/sys/dev/sound/pci/emuxkireg.h) @@ -0,0 +1,689 @@ +/* $FreeBSD$ */ +/* $NetBSD: emuxkireg.h,v 1.8 2008/04/28 20:23:54 martin Exp $ */ + +/*- + * Copyright (c) 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Yannick Montulet. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#ifndef _DEV_PCI_EMUXKIREG_H_ +#define _DEV_PCI_EMUXKIREG_H_ + +/* + * Register values for Creative EMU10000. The register values have been + * taken from GPLed SBLive! header file published by Creative. The comments + * have been stripped to avoid GPL pollution in kernel. The Creative version + * including comments is available in Linux 2.4.* kernel as file + * drivers/sound/emu10k1/8010.h + */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 22:39:05 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0057F106566C; Fri, 3 Feb 2012 22:39:05 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E075F8FC0C; Fri, 3 Feb 2012 22:39:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13Md4EB007472; Fri, 3 Feb 2012 22:39:04 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13Md4WN007466; Fri, 3 Feb 2012 22:39:04 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201202032239.q13Md4WN007466@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 3 Feb 2012 22:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230964 - in stable/9/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 22:39:05 -0000 Author: pfg Date: Fri Feb 3 22:39:04 2012 New Revision: 230964 URL: http://svn.freebsd.org/changeset/base/230964 Log: MFC: r229981, r230898 Replace a GPL'd header in the emu10kx snd driver code. This uses the emuxkireg.h already used in the emu10k1 snd driver. Special thanks go to Alexander Motin as he was able to find some errors and reverse engineer some wrong values in the emuxkireg header. While here also merge some cleanups to the module Makefile. PR: 153901 Obtained from: NetBSD Approved by: core (mentor implicit) Deleted: stable/9/sys/gnu/dev/sound/pci/emu10k1-alsa.h stable/9/sys/gnu/dev/sound/pci/p16v-alsa.h stable/9/sys/gnu/dev/sound/pci/p17v-alsa.h Modified: stable/9/sys/conf/files stable/9/sys/dev/sound/pci/emu10kx-midi.c stable/9/sys/dev/sound/pci/emu10kx-pcm.c stable/9/sys/dev/sound/pci/emu10kx.c stable/9/sys/dev/sound/pci/emu10kx.h stable/9/sys/dev/sound/pci/emuxkireg.h stable/9/sys/modules/sound/driver/emu10kx/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/modules/sound/driver/emu10kx/ (props changed) Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Fri Feb 3 22:13:36 2012 (r230963) +++ stable/9/sys/conf/files Fri Feb 3 22:39:04 2012 (r230964) @@ -50,11 +50,6 @@ aic79xx_reg_print.c optional ahd pci aic79xx_reg_print.o optional ahd pci ahd_reg_pretty_print \ compile-with "${NORMAL_C}" \ no-implicit-rule local -emu10k1-alsa%diked.h optional snd_emu10kx \ - dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h" \ - compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h emu10k1-alsa%diked.h" \ - no-obj no-implicit-rule before-depend \ - clean "emu10k1-alsa%diked.h" # # The 'fdt_dtb_file' target covers an actual DTB file name, which is derived # from the specified source (DTS) file: .dts -> .dtb @@ -67,16 +62,6 @@ fdt_static_dtb.h optional fdt fdt_dtb_s compile-with "sh $S/tools/fdt/make_dtbh.sh ${FDT_DTS_FILE} ." \ no-obj no-implicit-rule before-depend \ clean "fdt_static_dtb.h" -p16v-alsa%diked.h optional snd_emu10kx pci \ - dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h" \ - compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h p16v-alsa%diked.h" \ - no-obj no-implicit-rule before-depend \ - clean "p16v-alsa%diked.h" -p17v-alsa%diked.h optional snd_emu10kx pci \ - dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p17v-alsa.h" \ - compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p17v-alsa.h p17v-alsa%diked.h" \ - no-obj no-implicit-rule before-depend \ - clean "p17v-alsa%diked.h" feeder_eq_gen.h optional sound \ dependency "$S/tools/sound/feeder_eq_mkfilter.awk" \ compile-with "${AWK} -f $S/tools/sound/feeder_eq_mkfilter.awk -- ${FEEDER_EQ_PRESETS} > feeder_eq_gen.h" \ @@ -1728,19 +1713,9 @@ dev/sound/pci/csa.c optional snd_csa pc dev/sound/pci/csapcm.c optional snd_csa pci dev/sound/pci/ds1.c optional snd_ds1 pci dev/sound/pci/emu10k1.c optional snd_emu10k1 pci -dev/sound/pci/emu10kx.c optional snd_emu10kx pci \ - dependency "emu10k1-alsa%diked.h" \ - dependency "p16v-alsa%diked.h" \ - dependency "p17v-alsa%diked.h" \ - warning "kernel contains GPL contaminated emu10kx headers" -dev/sound/pci/emu10kx-pcm.c optional snd_emu10kx pci \ - dependency "emu10k1-alsa%diked.h" \ - dependency "p16v-alsa%diked.h" \ - dependency "p17v-alsa%diked.h" \ - warning "kernel contains GPL contaminated emu10kx headers" -dev/sound/pci/emu10kx-midi.c optional snd_emu10kx pci \ - dependency "emu10k1-alsa%diked.h" \ - warning "kernel contains GPL contaminated emu10kx headers" +dev/sound/pci/emu10kx.c optional snd_emu10kx pci +dev/sound/pci/emu10kx-pcm.c optional snd_emu10kx pci +dev/sound/pci/emu10kx-midi.c optional snd_emu10kx pci dev/sound/pci/envy24.c optional snd_envy24 pci dev/sound/pci/envy24ht.c optional snd_envy24ht pci dev/sound/pci/es137x.c optional snd_es137x pci Modified: stable/9/sys/dev/sound/pci/emu10kx-midi.c ============================================================================== --- stable/9/sys/dev/sound/pci/emu10kx-midi.c Fri Feb 3 22:13:36 2012 (r230963) +++ stable/9/sys/dev/sound/pci/emu10kx-midi.c Fri Feb 3 22:39:04 2012 (r230964) @@ -50,8 +50,8 @@ #include #include "mpufoi_if.h" +#include #include -#include "emu10k1-alsa%diked.h" struct emu_midi_softc { struct mtx mtx; @@ -176,25 +176,25 @@ emu_midi_attach(device_t dev) if (scp->is_emu10k1) { /* SB Live! - only one MIDI device here */ inte_val = 0; - /* inte_val |= INTE_MIDITXENABLE;*/ - inte_val |= INTE_MIDIRXENABLE; - ipr_val = IPR_MIDITRANSBUFEMPTY; - ipr_val |= IPR_MIDIRECVBUFEMPTY; + /* inte_val |= EMU_INTE_MIDITXENABLE;*/ + inte_val |= EMU_INTE_MIDIRXENABLE; + ipr_val = EMU_IPR_MIDITRANSBUFE; + ipr_val |= EMU_IPR_MIDIRECVBUFE; } else { - if (scp->port == A_MUDATA1) { + if (scp->port == EMU_A_MUDATA1) { /* EXTERNAL MIDI (AudigyDrive) */ inte_val = 0; - /* inte_val |= A_INTE_MIDITXENABLE1;*/ - inte_val |= INTE_MIDIRXENABLE; - ipr_val = IPR_MIDITRANSBUFEMPTY; - ipr_val |= IPR_MIDIRECVBUFEMPTY; + /* inte_val |= A_EMU_INTE_MIDITXENABLE1;*/ + inte_val |= EMU_INTE_MIDIRXENABLE; + ipr_val = EMU_IPR_MIDITRANSBUFE; + ipr_val |= EMU_IPR_MIDIRECVBUFE; } else { /* MIDI hw config port 2 */ inte_val = 0; - /* inte_val |= A_INTE_MIDITXENABLE2;*/ - inte_val |= INTE_A_MIDIRXENABLE2; - ipr_val = IPR_A_MIDITRANSBUFEMPTY2; - ipr_val |= IPR_A_MIDIRECVBUFEMPTY2; + /* inte_val |= A_EMU_INTE_MIDITXENABLE2;*/ + inte_val |= EMU_INTE_A_MIDIRXENABLE2; + ipr_val = EMU_IPR_A_MIDITRANSBUFE2; + ipr_val |= EMU_IPR_A_MIDIRECBUFE2; } } @@ -214,7 +214,7 @@ emu_midi_attach(device_t dev) if (scp->is_emu10k1) emu_enable_ir(scp->card); else { - if (scp->port == A_MUDATA1) + if (scp->port == EMU_A_MUDATA1) emu_enable_ir(scp->card); } Modified: stable/9/sys/dev/sound/pci/emu10kx-pcm.c ============================================================================== --- stable/9/sys/dev/sound/pci/emu10kx-pcm.c Fri Feb 3 22:13:36 2012 (r230963) +++ stable/9/sys/dev/sound/pci/emu10kx-pcm.c Fri Feb 3 22:39:04 2012 (r230964) @@ -49,8 +49,8 @@ #include "mixer_if.h" +#include #include -#include "emu10k1-alsa%diked.h" struct emu_pcm_pchinfo { int spd; @@ -555,8 +555,8 @@ emu_ac97_read_emulation(struct emu_pcm_i break; } - emu_wr(sc->card, AC97ADDRESS, regno, 1); - tmp = emu_rd(sc->card, AC97DATA, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + tmp = emu_rd(sc->card, EMU_AC97DATA, 2); if (use_ac97) emulated = tmp; @@ -621,8 +621,8 @@ emu_ac97_write_emulation(struct emu_pcm_ break; } if (write_ac97) { - emu_wr(sc->card, AC97ADDRESS, regno, 1); - emu_wr(sc->card, AC97DATA, data, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + emu_wr(sc->card, EMU_AC97DATA, data, 2); } } @@ -658,8 +658,8 @@ emu_rdcd(kobj_t obj __unused, void *devi struct emu_pcm_info *sc = (struct emu_pcm_info *)devinfo; KASSERT(sc->card != NULL, ("emu_rdcd: no soundcard")); - emu_wr(sc->card, AC97ADDRESS, regno, 1); - rd = emu_rd(sc->card, AC97DATA, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + rd = emu_rd(sc->card, EMU_AC97DATA, 2); return (rd); } @@ -669,8 +669,8 @@ emu_wrcd(kobj_t obj __unused, void *devi struct emu_pcm_info *sc = (struct emu_pcm_info *)devinfo; KASSERT(sc->card != NULL, ("emu_wrcd: no soundcard")); - emu_wr(sc->card, AC97ADDRESS, regno, 1); - emu_wr(sc->card, AC97DATA, data, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + emu_wr(sc->card, EMU_AC97DATA, data, 2); return (0); } @@ -870,12 +870,12 @@ emurchan_init(kobj_t obj __unused, void ch->blksz = sc->bufsz / 2; /* We rise interrupt for half-full buffer */ ch->fmt = SND_FORMAT(AFMT_U8, 1, 0); ch->spd = 8000; - ch->idxreg = sc->is_emu10k1 ? ADCIDX : A_ADCIDX; - ch->basereg = ADCBA; - ch->sizereg = ADCBS; - ch->setupreg = ADCCR; - ch->irqmask = INTE_ADCBUFENABLE; - ch->iprmask = IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL; + ch->idxreg = sc->is_emu10k1 ? EMU_ADCIDX : EMU_A_ADCIDX; + ch->basereg = EMU_ADCBA; + ch->sizereg = EMU_ADCBS; + ch->setupreg = EMU_ADCCR; + ch->irqmask = EMU_INTE_ADCBUFENABLE; + ch->iprmask = EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL; if (sndbuf_alloc(ch->buffer, emu_gettag(sc->card), 0, sc->bufsz) != 0) return (NULL); @@ -953,22 +953,22 @@ emurchan_trigger(kobj_t obj __unused, vo switch (sc->bufsz) { case 4096: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; break; case 8192: - sz = ADCBS_BUFSIZE_8192; + sz = EMU_RECBS_BUFSIZE_8192; break; case 16384: - sz = ADCBS_BUFSIZE_16384; + sz = EMU_RECBS_BUFSIZE_16384; break; case 32768: - sz = ADCBS_BUFSIZE_32768; + sz = EMU_RECBS_BUFSIZE_32768; break; case 65536: - sz = ADCBS_BUFSIZE_65536; + sz = EMU_RECBS_BUFSIZE_65536; break; default: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; } snd_mtxlock(sc->lock); @@ -976,9 +976,9 @@ emurchan_trigger(kobj_t obj __unused, vo case PCMTRIG_START: ch->run = 1; emu_wrptr(sc->card, 0, ch->sizereg, sz); - val = sc->is_emu10k1 ? ADCCR_LCHANENABLE : A_ADCCR_LCHANENABLE; + val = sc->is_emu10k1 ? EMU_ADCCR_LCHANENABLE : EMU_A_ADCCR_LCHANENABLE; if (AFMT_CHANNEL(ch->fmt) > 1) - val |= sc->is_emu10k1 ? ADCCR_RCHANENABLE : A_ADCCR_RCHANENABLE; + val |= sc->is_emu10k1 ? EMU_ADCCR_RCHANENABLE : EMU_A_ADCCR_RCHANENABLE; val |= sc->is_emu10k1 ? emu_k1_recval(ch->spd) : emu_k2_recval(ch->spd); emu_wrptr(sc->card, 0, ch->setupreg, 0); emu_wrptr(sc->card, 0, ch->setupreg, val); @@ -1049,11 +1049,11 @@ emufxrchan_init(kobj_t obj __unused, voi ch = &(sc->rch_efx); ch->fmt = SND_FORMAT(AFMT_S16_LE, 1, 0); ch->spd = sc->is_emu10k1 ? 48000*32 : 48000 * 64; - ch->idxreg = FXIDX; - ch->basereg = FXBA; - ch->sizereg = FXBS; - ch->irqmask = INTE_EFXBUFENABLE; - ch->iprmask = IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL; + ch->idxreg = EMU_FXIDX; + ch->basereg = EMU_FXBA; + ch->sizereg = EMU_FXBS; + ch->irqmask = EMU_INTE_EFXBUFENABLE; + ch->iprmask = EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL; ch->buffer = b; ch->pcm = sc; ch->channel = c; @@ -1113,22 +1113,22 @@ emufxrchan_trigger(kobj_t obj __unused, switch (sc->bufsz) { case 4096: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; break; case 8192: - sz = ADCBS_BUFSIZE_8192; + sz = EMU_RECBS_BUFSIZE_8192; break; case 16384: - sz = ADCBS_BUFSIZE_16384; + sz = EMU_RECBS_BUFSIZE_16384; break; case 32768: - sz = ADCBS_BUFSIZE_32768; + sz = EMU_RECBS_BUFSIZE_32768; break; case 65536: - sz = ADCBS_BUFSIZE_65536; + sz = EMU_RECBS_BUFSIZE_65536; break; default: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; } snd_mtxlock(sc->lock); @@ -1140,14 +1140,14 @@ emufxrchan_trigger(kobj_t obj __unused, /* * SB Live! is limited to 32 mono channels. Audigy * has 64 mono channels. Channels are enabled - * by setting a bit in A_FXWC[1|2] registers. + * by setting a bit in EMU_A_FXWC[1|2] registers. */ /* XXX there is no way to demultiplex this streams for now */ if (sc->is_emu10k1) { - emu_wrptr(sc->card, 0, FXWC, 0xffffffff); + emu_wrptr(sc->card, 0, EMU_FXWC, 0xffffffff); } else { - emu_wrptr(sc->card, 0, A_FXWC1, 0xffffffff); - emu_wrptr(sc->card, 0, A_FXWC2, 0xffffffff); + emu_wrptr(sc->card, 0, EMU_A_FXWC1, 0xffffffff); + emu_wrptr(sc->card, 0, EMU_A_FXWC2, 0xffffffff); } break; case PCMTRIG_STOP: @@ -1155,10 +1155,10 @@ emufxrchan_trigger(kobj_t obj __unused, case PCMTRIG_ABORT: ch->run = 0; if (sc->is_emu10k1) { - emu_wrptr(sc->card, 0, FXWC, 0x0); + emu_wrptr(sc->card, 0, EMU_FXWC, 0x0); } else { - emu_wrptr(sc->card, 0, A_FXWC1, 0x0); - emu_wrptr(sc->card, 0, A_FXWC2, 0x0); + emu_wrptr(sc->card, 0, EMU_A_FXWC1, 0x0); + emu_wrptr(sc->card, 0, EMU_A_FXWC2, 0x0); } emu_wrptr(sc->card, 0, ch->sizereg, 0); (void)emu_intr_unregister(sc->card, ch->ihandle); @@ -1238,8 +1238,8 @@ emu_pcm_intr(void *pcm, uint32_t stat) snd_mtxlock(sc->lock); - if (stat & IPR_INTERVALTIMER) { - ack |= IPR_INTERVALTIMER; + if (stat & EMU_IPR_INTERVALTIMER) { + ack |= EMU_IPR_INTERVALTIMER; for (i = 0; i < MAX_CHANNELS; i++) if (sc->pch[i].channel) { if (sc->pch[i].run == 1) { @@ -1262,8 +1262,8 @@ emu_pcm_intr(void *pcm, uint32_t stat) } - if (stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL)) { - ack |= stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL); + if (stat & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL)) { + ack |= stat & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL); if (sc->rch_adc.channel) { snd_mtxunlock(sc->lock); chn_intr(sc->rch_adc.channel); @@ -1271,8 +1271,8 @@ emu_pcm_intr(void *pcm, uint32_t stat) } } - if (stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL)) { - ack |= stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL); + if (stat & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL)) { + ack |= stat & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL); if (sc->rch_efx.channel) { snd_mtxunlock(sc->lock); chn_intr(sc->rch_efx.channel); @@ -1450,8 +1450,8 @@ emu_pcm_attach(device_t dev) goto bad; } - inte = INTE_INTERVALTIMERENB; - ipr = IPR_INTERVALTIMER; /* Used by playback & ADC */ + inte = EMU_INTE_INTERTIMERENB; + ipr = EMU_IPR_INTERVALTIMER; /* Used by playback & ADC */ sc->ihandle = emu_intr_register(sc->card, inte, ipr, &emu_pcm_intr, sc); if (emu_pcm_init(sc) == -1) { Modified: stable/9/sys/dev/sound/pci/emu10kx.c ============================================================================== --- stable/9/sys/dev/sound/pci/emu10kx.c Fri Feb 3 22:13:36 2012 (r230963) +++ stable/9/sys/dev/sound/pci/emu10kx.c Fri Feb 3 22:39:04 2012 (r230964) @@ -53,6 +53,7 @@ #include #include +#include #include /* hw flags */ @@ -181,7 +182,7 @@ #define A_IN_AUX2_R 0x0d #define A_IN_AUX2 A_IN_AUX2_L -/* Audigiy Outputs */ +/* Audigy Outputs */ #define A_OUT_D_FRONT_L 0x00 #define A_OUT_D_FRONT_R 0x01 #define A_OUT_D_FRONT A_OUT_D_FRONT_L @@ -217,9 +218,19 @@ #define A_OUT_ADC_REC_R 0x17 #define A_OUT_ADC_REC A_OUT_ADC_REC_L -#include "emu10k1-alsa%diked.h" -#include "p16v-alsa%diked.h" -#include "p17v-alsa%diked.h" +#define EMU_DATA2 0x24 +#define EMU_IPR2 0x28 +#define EMU_INTE2 0x2c +#define EMU_IPR3 0x38 +#define EMU_INTE3 0x3c + +#define EMU_A2_SRCSel 0x60 +#define EMU_A2_SRCMULTI_ENABLE 0x6e + +#define EMU_A_I2S_CAPTURE_96000 0x00000400 + +#define EMU_A2_MIXER_I2S_ENABLE 0x7B +#define EMU_A2_MIXER_SPDIF_ENABLE 0x7A #define C_FRONT_L 0 #define C_FRONT_R 1 @@ -630,7 +641,7 @@ emu_wr_nolock(struct emu_sc_info *sc, un } } /* - * PTR / DATA interface. Access to EMU10Kx is made + * EMU_PTR / EMU_DATA interface. Access to EMU10Kx is made * via (channel, register) pair. Some registers are channel-specific, * some not. */ @@ -639,11 +650,11 @@ emu_rdptr(struct emu_sc_info *sc, unsign { uint32_t ptr, val, mask, size, offset; - ptr = ((reg << 16) & sc->address_mask) | (chn & PTR_CHANNELNUM_MASK); + ptr = ((reg << 16) & sc->address_mask) | (chn & EMU_PTR_CHNO_MASK); EMU_RWLOCK(); - emu_wr_nolock(sc, PTR, ptr, 4); - val = emu_rd_nolock(sc, DATA, 4); + emu_wr_nolock(sc, EMU_PTR, ptr, 4); + val = emu_rd_nolock(sc, EMU_DATA, 4); EMU_RWUNLOCK(); /* @@ -666,10 +677,10 @@ emu_wrptr(struct emu_sc_info *sc, unsign { uint32_t ptr, mask, size, offset; - ptr = ((reg << 16) & sc->address_mask) | (chn & PTR_CHANNELNUM_MASK); + ptr = ((reg << 16) & sc->address_mask) | (chn & EMU_PTR_CHNO_MASK); EMU_RWLOCK(); - emu_wr_nolock(sc, PTR, ptr, 4); + emu_wr_nolock(sc, EMU_PTR, ptr, 4); /* * XXX Another kind of magic encoding in register number. This can * give you side effect - it will read previous data from register @@ -681,13 +692,13 @@ emu_wrptr(struct emu_sc_info *sc, unsign mask = ((1 << size) - 1) << offset; data <<= offset; data &= mask; - data |= emu_rd_nolock(sc, DATA, 4) & ~mask; + data |= emu_rd_nolock(sc, EMU_DATA, 4) & ~mask; } - emu_wr_nolock(sc, DATA, data, 4); + emu_wr_nolock(sc, EMU_DATA, data, 4); EMU_RWUNLOCK(); } /* - * PTR2 / DATA2 interface. Access to P16v is made + * EMU_A2_PTR / EMU_DATA2 interface. Access to P16v is made * via (channel, register) pair. Some registers are channel-specific, * some not. This interface is supported by CA0102 and CA0108 chips only. */ @@ -698,8 +709,8 @@ emu_rd_p16vptr(struct emu_sc_info *sc, u /* XXX separate lock? */ EMU_RWLOCK(); - emu_wr_nolock(sc, PTR2, (reg << 16) | chn, 4); - val = emu_rd_nolock(sc, DATA2, 4); + emu_wr_nolock(sc, EMU_A2_PTR, (reg << 16) | chn, 4); + val = emu_rd_nolock(sc, EMU_DATA2, 4); EMU_RWUNLOCK(); @@ -711,8 +722,8 @@ emu_wr_p16vptr(struct emu_sc_info *sc, u { EMU_RWLOCK(); - emu_wr_nolock(sc, PTR2, (reg << 16) | chn, 4); - emu_wr_nolock(sc, DATA2, data, 4); + emu_wr_nolock(sc, EMU_A2_PTR, (reg << 16) | chn, 4); + emu_wr_nolock(sc, EMU_DATA2, data, 4); EMU_RWUNLOCK(); } /* @@ -737,13 +748,13 @@ emu_wr_cbptr(struct emu_sc_info *sc, uin /* * Direct hardware register access - * Assume that it is never used to access PTR-based registers and can run unlocked. + * Assume that it is never used to access EMU_PTR-based registers and can run unlocked. */ void emu_wr(struct emu_sc_info *sc, unsigned int regno, uint32_t data, unsigned int size) { - KASSERT(regno != PTR, ("emu_wr: attempt to write to PTR")); - KASSERT(regno != PTR2, ("emu_wr: attempt to write to PTR2")); + KASSERT(regno != EMU_PTR, ("emu_wr: attempt to write to EMU_PTR")); + KASSERT(regno != EMU_A2_PTR, ("emu_wr: attempt to write to EMU_A2_PTR")); emu_wr_nolock(sc, regno, data, size); } @@ -753,8 +764,8 @@ emu_rd(struct emu_sc_info *sc, unsigned { uint32_t rd; - KASSERT(regno != DATA, ("emu_rd: attempt to read DATA")); - KASSERT(regno != DATA2, ("emu_rd: attempt to read DATA2")); + KASSERT(regno != EMU_DATA, ("emu_rd: attempt to read DATA")); + KASSERT(regno != EMU_DATA2, ("emu_rd: attempt to read DATA2")); rd = emu_rd_nolock(sc, regno, size); return (rd); @@ -770,24 +781,24 @@ emu_enable_ir(struct emu_sc_info *sc) uint32_t iocfg; if (sc->is_emu10k2 || sc->is_ca0102) { - iocfg = emu_rd_nolock(sc, A_IOCFG, 2); - emu_wr_nolock(sc, A_IOCFG, iocfg | A_IOCFG_GPOUT2, 2); + iocfg = emu_rd_nolock(sc, EMU_A_IOCFG, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg | EMU_A_IOCFG_GPOUT2, 2); DELAY(500); - emu_wr_nolock(sc, A_IOCFG, iocfg | A_IOCFG_GPOUT1 | A_IOCFG_GPOUT2, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg | EMU_A_IOCFG_GPOUT1 | EMU_A_IOCFG_GPOUT2, 2); DELAY(500); - emu_wr_nolock(sc, A_IOCFG, iocfg | A_IOCFG_GPOUT1, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg | EMU_A_IOCFG_GPOUT1, 2); DELAY(100); - emu_wr_nolock(sc, A_IOCFG, iocfg, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg, 2); device_printf(sc->dev, "Audigy IR MIDI events enabled.\n"); sc->enable_ir = 1; } if (sc->is_emu10k1) { - iocfg = emu_rd_nolock(sc, HCFG, 4); - emu_wr_nolock(sc, HCFG, iocfg | HCFG_GPOUT2, 4); + iocfg = emu_rd_nolock(sc, EMU_HCFG, 4); + emu_wr_nolock(sc, EMU_HCFG, iocfg | EMU_HCFG_GPOUT2, 4); DELAY(500); - emu_wr_nolock(sc, HCFG, iocfg | HCFG_GPOUT1 | HCFG_GPOUT2, 4); + emu_wr_nolock(sc, EMU_HCFG, iocfg | EMU_HCFG_GPOUT1 | EMU_HCFG_GPOUT2, 4); DELAY(100); - emu_wr_nolock(sc, HCFG, iocfg, 4); + emu_wr_nolock(sc, EMU_HCFG, iocfg, 4); device_printf(sc->dev, "SB Live! IR MIDI events enabled.\n"); sc->enable_ir = 1; } @@ -835,7 +846,7 @@ emu_timer_set(struct emu_sc_info *sc, in sc->timerinterval = sc->timer[i]; /* XXX */ - emu_wr(sc, TIMER, sc->timerinterval & 0x03ff, 2); + emu_wr(sc, EMU_TIMER, sc->timerinterval & 0x03ff, 2); mtx_unlock(&sc->lock); return (timer); @@ -868,16 +879,16 @@ emu_timer_enable(struct emu_sc_info *sc, ena_int = 1; } - emu_wr(sc, TIMER, sc->timerinterval & 0x03ff, 2); + emu_wr(sc, EMU_TIMER, sc->timerinterval & 0x03ff, 2); if (ena_int == 1) { - x = emu_rd(sc, INTE, 4); - x |= INTE_INTERVALTIMERENB; - emu_wr(sc, INTE, x, 4); + x = emu_rd(sc, EMU_INTE, 4); + x |= EMU_INTE_INTERTIMERENB; + emu_wr(sc, EMU_INTE, x, 4); } else { - x = emu_rd(sc, INTE, 4); - x &= ~INTE_INTERVALTIMERENB; - emu_wr(sc, INTE, x, 4); + x = emu_rd(sc, EMU_INTE, 4); + x &= ~EMU_INTE_INTERTIMERENB; + emu_wr(sc, EMU_INTE, x, 4); } mtx_unlock(&sc->lock); return (0); @@ -917,9 +928,9 @@ emu_intr_register(struct emu_sc_info *sc sc->ihandler[i].intr_mask = intr_mask; sc->ihandler[i].softc = isc; sc->ihandler[i].irq_func = func; - x = emu_rd(sc, INTE, 4); + x = emu_rd(sc, EMU_INTE, 4); x |= inte_mask; - emu_wr(sc, INTE, x, 4); + emu_wr(sc, EMU_INTE, x, 4); mtx_unlock(&sc->lock); if (sc->dbg_level > 1) device_printf(sc->dev, "ihandle %d registered\n", i); @@ -946,7 +957,7 @@ emu_intr_unregister(struct emu_sc_info * return (-1); } - x = emu_rd(sc, INTE, 4); + x = emu_rd(sc, EMU_INTE, 4); x &= ~sc->ihandler[hnumber].inte_mask; sc->ihandler[hnumber].inte_mask = 0; @@ -954,12 +965,12 @@ emu_intr_unregister(struct emu_sc_info * sc->ihandler[hnumber].softc = NULL; sc->ihandler[hnumber].irq_func = NULL; - /* other interrupt handlers may use this INTE value */ + /* other interrupt handlers may use this EMU_INTE value */ for (i = 0; i < EMU_MAX_IRQ_CONSUMERS; i++) if (sc->ihandler[i].inte_mask != 0) x |= sc->ihandler[i].inte_mask; - emu_wr(sc, INTE, x, 4); + emu_wr(sc, EMU_INTE, x, 4); mtx_unlock(&sc->lock); return (hnumber); @@ -973,11 +984,11 @@ emu_intr(void *p) int i; for (;;) { - stat = emu_rd(sc, IPR, 4); + stat = emu_rd(sc, EMU_IPR, 4); ack = 0; if (stat == 0) break; - emu_wr(sc, IPR, stat, 4); + emu_wr(sc, EMU_IPR, stat, 4); for (i = 0; i < EMU_MAX_IRQ_CONSUMERS; i++) { if ((((sc->ihandler[i].intr_mask) & stat) != 0) && (((void *)sc->ihandler[i].irq_func) != NULL)) { @@ -993,13 +1004,13 @@ emu_intr(void *p) if ((sc->is_ca0102) || (sc->is_ca0108)) for (;;) { - stat = emu_rd(sc, IPR2, 4); + stat = emu_rd(sc, EMU_IPR2, 4); ack = 0; if (stat == 0) break; - emu_wr(sc, IPR2, stat, 4); + emu_wr(sc, EMU_IPR2, stat, 4); if (sc->dbg_level > 1) - device_printf(sc->dev, "IPR2: %08x\n", stat); + device_printf(sc->dev, "EMU_IPR2: %08x\n", stat); break; /* to avoid infinite loop. shoud be removed * after completion of P16V interface. */ @@ -1007,13 +1018,13 @@ emu_intr(void *p) if (sc->is_ca0102) for (;;) { - stat = emu_rd(sc, IPR3, 4); + stat = emu_rd(sc, EMU_IPR3, 4); ack = 0; if (stat == 0) break; - emu_wr(sc, IPR3, stat, 4); + emu_wr(sc, EMU_IPR3, stat, 4); if (sc->dbg_level > 1) - device_printf(sc->dev, "IPR3: %08x\n", stat); + device_printf(sc->dev, "EMU_IPR3: %08x\n", stat); break; /* to avoid infinite loop. should be removed * after completion of S/PDIF interface */ @@ -1374,61 +1385,61 @@ emu_vwrite(struct emu_sc_info *sc, struc if (v->stereo) { - emu_wrptr(sc, v->vnum, CPF, CPF_STEREO_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF, EMU_CHAN_CPF_STEREO_MASK); } else { - emu_wrptr(sc, v->vnum, CPF, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF, 0); } val = v->stereo ? 28 : 30; val *= v->b16 ? 1 : 2; start = v->sa + val; if (sc->is_emu10k1) { - emu_wrptr(sc, v->vnum, FXRT, ((v->routing[3] << 12) | + emu_wrptr(sc, v->vnum, EMU_CHAN_FXRT, ((v->routing[3] << 12) | (v->routing[2] << 8) | (v->routing[1] << 4) | (v->routing[0] << 0)) << 16); } else { - emu_wrptr(sc, v->vnum, A_FXRT1, (v->routing[3] << 24) | + emu_wrptr(sc, v->vnum, EMU_A_CHAN_FXRT1, (v->routing[3] << 24) | (v->routing[2] << 16) | (v->routing[1] << 8) | (v->routing[0] << 0)); - emu_wrptr(sc, v->vnum, A_FXRT2, (v->routing[7] << 24) | + emu_wrptr(sc, v->vnum, EMU_A_CHAN_FXRT2, (v->routing[7] << 24) | (v->routing[6] << 16) | (v->routing[5] << 8) | (v->routing[4] << 0)); - emu_wrptr(sc, v->vnum, A_SENDAMOUNTS, (v->amounts[7] << 24) | + emu_wrptr(sc, v->vnum, EMU_A_CHAN_SENDAMOUNTS, (v->amounts[7] << 24) | (v->amounts[6] << 26) | (v->amounts[5] << 8) | (v->amounts[4] << 0)); } - emu_wrptr(sc, v->vnum, PTRX, (v->amounts[0] << 8) | (v->amounts[1] << 0)); - emu_wrptr(sc, v->vnum, DSL, v->ea | (v->amounts[3] << 24)); - emu_wrptr(sc, v->vnum, PSST, v->sa | (v->amounts[2] << 24)); - - emu_wrptr(sc, v->vnum, CCCA, start | (v->b16 ? 0 : CCCA_8BITSELECT)); - emu_wrptr(sc, v->vnum, Z1, 0); - emu_wrptr(sc, v->vnum, Z2, 0); - - silent_page = ((uint32_t) (sc->mem.silent_page_addr) << 1) | MAP_PTI_MASK; - emu_wrptr(sc, v->vnum, MAPA, silent_page); - emu_wrptr(sc, v->vnum, MAPB, silent_page); - - emu_wrptr(sc, v->vnum, CVCF, CVCF_CURRENTFILTER_MASK); - emu_wrptr(sc, v->vnum, VTFT, VTFT_FILTERTARGET_MASK); - emu_wrptr(sc, v->vnum, ATKHLDM, 0); - emu_wrptr(sc, v->vnum, DCYSUSM, DCYSUSM_DECAYTIME_MASK); - emu_wrptr(sc, v->vnum, LFOVAL1, 0x8000); - emu_wrptr(sc, v->vnum, LFOVAL2, 0x8000); - emu_wrptr(sc, v->vnum, FMMOD, 0); - emu_wrptr(sc, v->vnum, TREMFRQ, 0); - emu_wrptr(sc, v->vnum, FM2FRQ2, 0); - emu_wrptr(sc, v->vnum, ENVVAL, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX, (v->amounts[0] << 8) | (v->amounts[1] << 0)); + emu_wrptr(sc, v->vnum, EMU_CHAN_DSL, v->ea | (v->amounts[3] << 24)); + emu_wrptr(sc, v->vnum, EMU_CHAN_PSST, v->sa | (v->amounts[2] << 24)); + + emu_wrptr(sc, v->vnum, EMU_CHAN_CCCA, start | (v->b16 ? 0 : EMU_CHAN_CCCA_8BITSELECT)); + emu_wrptr(sc, v->vnum, EMU_CHAN_Z1, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_Z2, 0); + + silent_page = ((uint32_t) (sc->mem.silent_page_addr) << 1) | EMU_CHAN_MAP_PTI_MASK; + emu_wrptr(sc, v->vnum, EMU_CHAN_MAPA, silent_page); + emu_wrptr(sc, v->vnum, EMU_CHAN_MAPB, silent_page); + + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, EMU_CHAN_CVCF_CURRFILTER_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, EMU_CHAN_VTFT_FILTERTARGET_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_ATKHLDM, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_DCYSUSM, EMU_CHAN_DCYSUSM_DECAYTIME_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_LFOVAL1, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_LFOVAL2, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_FMMOD, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_TREMFRQ, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_FM2FRQ2, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_ENVVAL, 0x8000); - emu_wrptr(sc, v->vnum, ATKHLDV, ATKHLDV_HOLDTIME_MASK | ATKHLDV_ATTACKTIME_MASK); - emu_wrptr(sc, v->vnum, ENVVOL, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_ATKHLDV, EMU_CHAN_ATKHLDV_HOLDTIME_MASK | EMU_CHAN_ATKHLDV_ATTACKTIME_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_ENVVOL, 0x8000); - emu_wrptr(sc, v->vnum, PEFE_FILTERAMOUNT, 0x7f); - emu_wrptr(sc, v->vnum, PEFE_PITCHAMOUNT, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_PEFE_FILTERAMOUNT, 0x7f); + emu_wrptr(sc, v->vnum, EMU_CHAN_PEFE_PITCHAMOUNT, 0); if ((v->stereo) && (v->slave != NULL)) emu_vwrite(sc, v->slave); } @@ -1438,7 +1449,7 @@ emu_vstop(struct emu_sc_info *sc, char c { int reg; - reg = (channel & 0x20) ? SOLEH : SOLEL; + reg = (channel & 0x20) ? EMU_SOLEH : EMU_SOLEL; channel &= 0x1f; reg |= 1 << 24; reg |= channel << 16; @@ -1459,29 +1470,29 @@ emu_vtrigger(struct emu_sc_info *sc, str ccis *= v->b16 ? 1 : 2; sample = v->b16 ? 0x00000000 : 0x80808080; for (i = 0; i < cs; i++) - emu_wrptr(sc, v->vnum, CD0 + i, sample); - emu_wrptr(sc, v->vnum, CCR_CACHEINVALIDSIZE, 0); - emu_wrptr(sc, v->vnum, CCR_READADDRESS, cra); - emu_wrptr(sc, v->vnum, CCR_CACHEINVALIDSIZE, ccis); - - emu_wrptr(sc, v->vnum, IFATN, 0xff00); - emu_wrptr(sc, v->vnum, VTFT, 0xffffffff); - emu_wrptr(sc, v->vnum, CVCF, 0xffffffff); - emu_wrptr(sc, v->vnum, DCYSUSV, 0x00007f7f); + emu_wrptr(sc, v->vnum, EMU_CHAN_CD0 + i, sample); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_CACHEINVALIDSIZE, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_READADDRESS, cra); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_CACHEINVALIDSIZE, ccis); + + emu_wrptr(sc, v->vnum, EMU_CHAN_IFATN, 0xff00); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, 0xffffffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, 0xffffffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_DCYSUSV, 0x00007f7f); emu_vstop(sc, v->vnum, 0); pitch_target = emu_rate_to_linearpitch(v->speed); initial_pitch = emu_rate_to_pitch(v->speed) >> 8; - emu_wrptr(sc, v->vnum, PTRX_PITCHTARGET, pitch_target); - emu_wrptr(sc, v->vnum, CPF_CURRENTPITCH, pitch_target); - emu_wrptr(sc, v->vnum, IP, initial_pitch); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX_PITCHTARGET, pitch_target); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF_PITCH, pitch_target); + emu_wrptr(sc, v->vnum, EMU_CHAN_IP, initial_pitch); } else { - emu_wrptr(sc, v->vnum, PTRX_PITCHTARGET, 0); - emu_wrptr(sc, v->vnum, CPF_CURRENTPITCH, 0); - emu_wrptr(sc, v->vnum, IFATN, 0xffff); - emu_wrptr(sc, v->vnum, VTFT, 0x0000ffff); - emu_wrptr(sc, v->vnum, CVCF, 0x0000ffff); - emu_wrptr(sc, v->vnum, IP, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX_PITCHTARGET, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF_PITCH, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_IFATN, 0xffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, 0x0000ffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, 0x0000ffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_IP, 0); emu_vstop(sc, v->vnum, 1); } if ((v->stereo) && (v->slave != NULL)) @@ -1494,7 +1505,7 @@ emu_vpos(struct emu_sc_info *sc, struct int s, ptr; s = (v->b16 ? 1 : 0) + (v->stereo ? 1 : 0); - ptr = (emu_rdptr(sc, v->vnum, CCCA_CURRADDR) - (v->start >> s)) << s; + ptr = (emu_rdptr(sc, v->vnum, EMU_CHAN_CCCA_CURRADDR) - (v->start >> s)) << s; return (ptr & ~0x0000001f); } @@ -1694,9 +1705,9 @@ emu_initefx(struct emu_sc_info *sc) /* stop DSP */ if (sc->is_emu10k1) { - emu_wrptr(sc, 0, DBG, EMU10K1_DBG_SINGLE_STEP); + emu_wrptr(sc, 0, EMU_DBG, EMU_DBG_SINGLE_STEP); } else { - emu_wrptr(sc, 0, A_DBG, A_DBG_SINGLE_STEP); + emu_wrptr(sc, 0, EMU_A_DBG, EMU_A_DBG_SINGLE_STEP); } /* code size is in instructions */ @@ -2162,9 +2173,9 @@ emu_initefx(struct emu_sc_info *sc) /* start DSP */ if (sc->is_emu10k1) { - emu_wrptr(sc, 0, DBG, 0); + emu_wrptr(sc, 0, EMU_DBG, 0); } else { - emu_wrptr(sc, 0, A_DBG, 0); + emu_wrptr(sc, 0, EMU_A_DBG, 0); } } @@ -2450,24 +2461,24 @@ emumix_set_mode(struct emu_sc_info *sc, return; } - hcfg = HCFG_AUDIOENABLE | HCFG_AUTOMUTE; + hcfg = EMU_HCFG_AUDIOENABLE | EMU_HCFG_AUTOMUTE; a_iocfg = 0; if (sc->rev >= 6) - hcfg |= HCFG_JOYENABLE; + hcfg |= EMU_HCFG_JOYENABLE; if (sc->is_emu10k1) - hcfg |= HCFG_LOCKTANKCACHE_MASK; + hcfg |= EMU_HCFG_LOCKTANKCACHE_MASK; else - hcfg |= HCFG_CODECFORMAT_I2S | HCFG_JOYENABLE; + hcfg |= EMU_HCFG_CODECFMT_I2S | EMU_HCFG_JOYENABLE; if (mode == MODE_DIGITAL) { if (sc->broken_digital) { device_printf(sc->dev, "Digital mode is reported as broken on this card.\n"); } - a_iocfg |= A_IOCFG_ENABLE_DIGITAL; - hcfg |= HCFG_GPOUT0; + a_iocfg |= EMU_A_IOCFG_GPOUT1; + hcfg |= EMU_HCFG_GPOUT0; } if (mode == MODE_ANALOG) @@ -2478,12 +2489,12 @@ emumix_set_mode(struct emu_sc_info *sc, if ((sc->is_ca0102) || (sc->is_ca0108)) /* - * Setting A_IOCFG_DISABLE_ANALOG will do opposite things + * Setting EMU_A_IOCFG_DISABLE_ANALOG will do opposite things * on diffrerent cards. * "don't disable analog outs" on Audigy 2 (ca0102/ca0108) * "disable analog outs" on Audigy (emu10k2) */ - a_iocfg |= A_IOCFG_DISABLE_ANALOG; + a_iocfg |= EMU_A_IOCFG_DISABLE_ANALOG; if (sc->is_ca0108) a_iocfg |= 0x20; /* XXX */ @@ -2492,12 +2503,12 @@ emumix_set_mode(struct emu_sc_info *sc, if (mode == MODE_DIGITAL) emumix_set_gpr(sc, sc->mute_gpr[ANALOGMUTE], 1); - emu_wr(sc, HCFG, hcfg, 4); + emu_wr(sc, EMU_HCFG, hcfg, 4); if ((sc->is_emu10k2) || (sc->is_ca0102) || (sc->is_ca0108)) { - tmp = emu_rd(sc, A_IOCFG, 2); + tmp = emu_rd(sc, EMU_A_IOCFG, 2); tmp = a_iocfg; - emu_wr(sc, A_IOCFG, tmp, 2); + emu_wr(sc, EMU_A_IOCFG, tmp, 2); } /* Unmute if we have changed mode to analog. */ @@ -2523,16 +2534,16 @@ emumix_set_spdif_mode(struct emu_sc_info return; } - spcs = SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | - SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | - SPCS_GENERATIONSTATUS | 0x00001200 | 0x00000000 | - SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT; + spcs = EMU_SPCS_CLKACCY_1000PPM | EMU_SPCS_SAMPLERATE_48 | + EMU_SPCS_CHANNELNUM_LEFT | EMU_SPCS_SOURCENUM_UNSPEC | + EMU_SPCS_GENERATIONSTATUS | 0x00001200 | 0x00000000 | + EMU_SPCS_EMPHASIS_NONE | EMU_SPCS_COPYRIGHT; mode = SPDIF_MODE_PCM; - emu_wrptr(sc, 0, SPCS0, spcs); - emu_wrptr(sc, 0, SPCS1, spcs); - emu_wrptr(sc, 0, SPCS2, spcs); + emu_wrptr(sc, 0, EMU_SPCS0, spcs); + emu_wrptr(sc, 0, EMU_SPCS1, spcs); + emu_wrptr(sc, 0, EMU_SPCS2, spcs); } #define L2L_POINTS 10 @@ -2635,8 +2646,8 @@ emu_cardbus_init(struct emu_sc_info *sc) { /* - * XXX May not need this if we have IPR3 handler. - * Is it a real init calls, or IPR3 interrupt acknowledgments? + * XXX May not need this if we have EMU_IPR3 handler. + * Is it a real init calls, or EMU_IPR3 interrupt acknowledgments? * Looks much like "(data << 16) | register". */ emu_wr_cbptr(sc, (0x00d0 << 16) | 0x0000); @@ -2660,42 +2671,42 @@ emu_init(struct emu_sc_info *sc) int i; /* disable audio and lock cache */ - emu_wr(sc, HCFG, HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, 4); + emu_wr(sc, EMU_HCFG, EMU_HCFG_LOCKSOUNDCACHE | EMU_HCFG_LOCKTANKCACHE_MASK | EMU_HCFG_MUTEBUTTONENABLE, 4); /* reset recording buffers */ - emu_wrptr(sc, 0, MICBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, MICBA, 0); - emu_wrptr(sc, 0, FXBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, FXBA, 0); - emu_wrptr(sc, 0, ADCBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, ADCBA, 0); + emu_wrptr(sc, 0, EMU_MICBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_MICBA, 0); + emu_wrptr(sc, 0, EMU_FXBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_FXBA, 0); + emu_wrptr(sc, 0, EMU_ADCBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_ADCBA, 0); /* disable channel interrupt */ - emu_wr(sc, INTE, INTE_INTERVALTIMERENB | INTE_SAMPLERATETRACKER | INTE_PCIERRORENABLE, 4); - emu_wrptr(sc, 0, CLIEL, 0); - emu_wrptr(sc, 0, CLIEH, 0); - emu_wrptr(sc, 0, SOLEL, 0); - emu_wrptr(sc, 0, SOLEH, 0); + emu_wr(sc, EMU_INTE, EMU_INTE_INTERTIMERENB | EMU_INTE_SAMPLERATER | EMU_INTE_PCIERRENABLE, 4); + emu_wrptr(sc, 0, EMU_CLIEL, 0); + emu_wrptr(sc, 0, EMU_CLIEH, 0); + emu_wrptr(sc, 0, EMU_SOLEL, 0); + emu_wrptr(sc, 0, EMU_SOLEH, 0); /* disable P16V and S/PDIF interrupts */ if ((sc->is_ca0102) || (sc->is_ca0108)) - emu_wr(sc, INTE2, 0, 4); + emu_wr(sc, EMU_INTE2, 0, 4); if (sc->is_ca0102) - emu_wr(sc, INTE3, 0, 4); + emu_wr(sc, EMU_INTE3, 0, 4); /* init phys inputs and outputs */ ac97slot = 0; if (sc->has_51) - ac97slot = AC97SLOT_CNTR | AC97SLOT_LFE; + ac97slot = EMU_AC97SLOT_CENTER | EMU_AC97SLOT_LFE; if (sc->has_71) - ac97slot = AC97SLOT_CNTR | AC97SLOT_LFE | AC97SLOT_REAR_LEFT | AC97SLOT_REAR_RIGHT; + ac97slot = EMU_AC97SLOT_CENTER | EMU_AC97SLOT_LFE | EMU_AC97SLOT_REAR_LEFT | EMU_AC97SLOT_REAR_RIGHT; if (sc->is_emu10k2) ac97slot |= 0x40; - emu_wrptr(sc, 0, AC97SLOT, ac97slot); + emu_wrptr(sc, 0, EMU_AC97SLOT, ac97slot); if (sc->is_emu10k2) /* XXX for later cards? */ - emu_wrptr(sc, 0, SPBYPASS, 0xf00); /* What will happen if + emu_wrptr(sc, 0, EMU_SPBYPASS, 0xf00); /* What will happen if * we write 1 here? */ if (bus_dma_tag_create( /* parent */ bus_get_dma_tag(sc->dev), @@ -2729,61 +2740,61 @@ emu_init(struct emu_sc_info *sc) sc->mem.ptb_pages[i] = tmp | i; for (ch = 0; ch < NUM_G; ch++) { - emu_wrptr(sc, ch, MAPA, tmp | MAP_PTI_MASK); - emu_wrptr(sc, ch, MAPB, tmp | MAP_PTI_MASK); + emu_wrptr(sc, ch, EMU_CHAN_MAPA, tmp | EMU_CHAN_MAP_PTI_MASK); + emu_wrptr(sc, ch, EMU_CHAN_MAPB, tmp | EMU_CHAN_MAP_PTI_MASK); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 23:00:29 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AC231065675; Fri, 3 Feb 2012 23:00:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1B6E8FC16; Fri, 3 Feb 2012 23:00:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13N0SJT008261; Fri, 3 Feb 2012 23:00:28 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13N0S9P008255; Fri, 3 Feb 2012 23:00:28 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201202032300.q13N0S9P008255@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 3 Feb 2012 23:00:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230965 - in stable/8/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 23:00:29 -0000 Author: pfg Date: Fri Feb 3 23:00:28 2012 New Revision: 230965 URL: http://svn.freebsd.org/changeset/base/230965 Log: MFC: r229981, r230898 Replace a GPL'd header in the emu10kx snd driver code. This uses the emuxkireg.h already used in the emu10k1 snd driver. Special thanks go to Alexander Motin as he was able to find some errors and reverse engineer some wrong values in the emuxkireg header. While here also merge some cleanups to the module Makefile. PR: 153901 Obtained from: NetBSD Approved by: core (mentor implicit) Deleted: stable/8/sys/gnu/dev/sound/pci/emu10k1-alsa.h stable/8/sys/gnu/dev/sound/pci/p16v-alsa.h stable/8/sys/gnu/dev/sound/pci/p17v-alsa.h Modified: stable/8/sys/conf/files stable/8/sys/dev/sound/pci/emu10kx-midi.c stable/8/sys/dev/sound/pci/emu10kx-pcm.c stable/8/sys/dev/sound/pci/emu10kx.c stable/8/sys/dev/sound/pci/emu10kx.h stable/8/sys/dev/sound/pci/emuxkireg.h stable/8/sys/modules/sound/driver/emu10kx/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/modules/sound/driver/emu10kx/ (props changed) Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Fri Feb 3 22:39:04 2012 (r230964) +++ stable/8/sys/conf/files Fri Feb 3 23:00:28 2012 (r230965) @@ -50,21 +50,6 @@ aic79xx_reg_print.c optional ahd pci aic79xx_reg_print.o optional ahd pci ahd_reg_pretty_print \ compile-with "${NORMAL_C}" \ no-implicit-rule local -emu10k1-alsa%diked.h optional snd_emu10kx \ - dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h" \ - compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h emu10k1-alsa%diked.h" \ - no-obj no-implicit-rule before-depend \ - clean "emu10k1-alsa%diked.h" -p16v-alsa%diked.h optional snd_emu10kx pci \ - dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h" \ - compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h p16v-alsa%diked.h" \ - no-obj no-implicit-rule before-depend \ - clean "p16v-alsa%diked.h" -p17v-alsa%diked.h optional snd_emu10kx pci \ - dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p17v-alsa.h" \ - compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p17v-alsa.h p17v-alsa%diked.h" \ - no-obj no-implicit-rule before-depend \ - clean "p17v-alsa%diked.h" feeder_eq_gen.h optional sound \ dependency "$S/tools/sound/feeder_eq_mkfilter.awk" \ compile-with "${AWK} -f $S/tools/sound/feeder_eq_mkfilter.awk -- ${FEEDER_EQ_PRESETS} > feeder_eq_gen.h" \ @@ -1602,19 +1587,9 @@ dev/sound/pci/csa.c optional snd_csa pc dev/sound/pci/csapcm.c optional snd_csa pci dev/sound/pci/ds1.c optional snd_ds1 pci dev/sound/pci/emu10k1.c optional snd_emu10k1 pci -dev/sound/pci/emu10kx.c optional snd_emu10kx pci \ - dependency "emu10k1-alsa%diked.h" \ - dependency "p16v-alsa%diked.h" \ - dependency "p17v-alsa%diked.h" \ - warning "kernel contains GPL contaminated emu10kx headers" -dev/sound/pci/emu10kx-pcm.c optional snd_emu10kx pci \ - dependency "emu10k1-alsa%diked.h" \ - dependency "p16v-alsa%diked.h" \ - dependency "p17v-alsa%diked.h" \ - warning "kernel contains GPL contaminated emu10kx headers" -dev/sound/pci/emu10kx-midi.c optional snd_emu10kx pci \ - dependency "emu10k1-alsa%diked.h" \ - warning "kernel contains GPL contaminated emu10kx headers" +dev/sound/pci/emu10kx.c optional snd_emu10kx pci +dev/sound/pci/emu10kx-pcm.c optional snd_emu10kx pci +dev/sound/pci/emu10kx-midi.c optional snd_emu10kx pci dev/sound/pci/envy24.c optional snd_envy24 pci dev/sound/pci/envy24ht.c optional snd_envy24ht pci dev/sound/pci/es137x.c optional snd_es137x pci Modified: stable/8/sys/dev/sound/pci/emu10kx-midi.c ============================================================================== --- stable/8/sys/dev/sound/pci/emu10kx-midi.c Fri Feb 3 22:39:04 2012 (r230964) +++ stable/8/sys/dev/sound/pci/emu10kx-midi.c Fri Feb 3 23:00:28 2012 (r230965) @@ -50,8 +50,8 @@ #include #include "mpufoi_if.h" +#include #include -#include "emu10k1-alsa%diked.h" struct emu_midi_softc { struct mtx mtx; @@ -176,25 +176,25 @@ emu_midi_attach(device_t dev) if (scp->is_emu10k1) { /* SB Live! - only one MIDI device here */ inte_val = 0; - /* inte_val |= INTE_MIDITXENABLE;*/ - inte_val |= INTE_MIDIRXENABLE; - ipr_val = IPR_MIDITRANSBUFEMPTY; - ipr_val |= IPR_MIDIRECVBUFEMPTY; + /* inte_val |= EMU_INTE_MIDITXENABLE;*/ + inte_val |= EMU_INTE_MIDIRXENABLE; + ipr_val = EMU_IPR_MIDITRANSBUFE; + ipr_val |= EMU_IPR_MIDIRECVBUFE; } else { - if (scp->port == A_MUDATA1) { + if (scp->port == EMU_A_MUDATA1) { /* EXTERNAL MIDI (AudigyDrive) */ inte_val = 0; - /* inte_val |= A_INTE_MIDITXENABLE1;*/ - inte_val |= INTE_MIDIRXENABLE; - ipr_val = IPR_MIDITRANSBUFEMPTY; - ipr_val |= IPR_MIDIRECVBUFEMPTY; + /* inte_val |= A_EMU_INTE_MIDITXENABLE1;*/ + inte_val |= EMU_INTE_MIDIRXENABLE; + ipr_val = EMU_IPR_MIDITRANSBUFE; + ipr_val |= EMU_IPR_MIDIRECVBUFE; } else { /* MIDI hw config port 2 */ inte_val = 0; - /* inte_val |= A_INTE_MIDITXENABLE2;*/ - inte_val |= INTE_A_MIDIRXENABLE2; - ipr_val = IPR_A_MIDITRANSBUFEMPTY2; - ipr_val |= IPR_A_MIDIRECVBUFEMPTY2; + /* inte_val |= A_EMU_INTE_MIDITXENABLE2;*/ + inte_val |= EMU_INTE_A_MIDIRXENABLE2; + ipr_val = EMU_IPR_A_MIDITRANSBUFE2; + ipr_val |= EMU_IPR_A_MIDIRECBUFE2; } } @@ -214,7 +214,7 @@ emu_midi_attach(device_t dev) if (scp->is_emu10k1) emu_enable_ir(scp->card); else { - if (scp->port == A_MUDATA1) + if (scp->port == EMU_A_MUDATA1) emu_enable_ir(scp->card); } Modified: stable/8/sys/dev/sound/pci/emu10kx-pcm.c ============================================================================== --- stable/8/sys/dev/sound/pci/emu10kx-pcm.c Fri Feb 3 22:39:04 2012 (r230964) +++ stable/8/sys/dev/sound/pci/emu10kx-pcm.c Fri Feb 3 23:00:28 2012 (r230965) @@ -49,8 +49,8 @@ #include "mixer_if.h" +#include #include -#include "emu10k1-alsa%diked.h" struct emu_pcm_pchinfo { int spd; @@ -555,8 +555,8 @@ emu_ac97_read_emulation(struct emu_pcm_i break; } - emu_wr(sc->card, AC97ADDRESS, regno, 1); - tmp = emu_rd(sc->card, AC97DATA, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + tmp = emu_rd(sc->card, EMU_AC97DATA, 2); if (use_ac97) emulated = tmp; @@ -621,8 +621,8 @@ emu_ac97_write_emulation(struct emu_pcm_ break; } if (write_ac97) { - emu_wr(sc->card, AC97ADDRESS, regno, 1); - emu_wr(sc->card, AC97DATA, data, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + emu_wr(sc->card, EMU_AC97DATA, data, 2); } } @@ -658,8 +658,8 @@ emu_rdcd(kobj_t obj __unused, void *devi struct emu_pcm_info *sc = (struct emu_pcm_info *)devinfo; KASSERT(sc->card != NULL, ("emu_rdcd: no soundcard")); - emu_wr(sc->card, AC97ADDRESS, regno, 1); - rd = emu_rd(sc->card, AC97DATA, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + rd = emu_rd(sc->card, EMU_AC97DATA, 2); return (rd); } @@ -669,8 +669,8 @@ emu_wrcd(kobj_t obj __unused, void *devi struct emu_pcm_info *sc = (struct emu_pcm_info *)devinfo; KASSERT(sc->card != NULL, ("emu_wrcd: no soundcard")); - emu_wr(sc->card, AC97ADDRESS, regno, 1); - emu_wr(sc->card, AC97DATA, data, 2); + emu_wr(sc->card, EMU_AC97ADDR, regno, 1); + emu_wr(sc->card, EMU_AC97DATA, data, 2); return (0); } @@ -870,12 +870,12 @@ emurchan_init(kobj_t obj __unused, void ch->blksz = sc->bufsz / 2; /* We rise interrupt for half-full buffer */ ch->fmt = SND_FORMAT(AFMT_U8, 1, 0); ch->spd = 8000; - ch->idxreg = sc->is_emu10k1 ? ADCIDX : A_ADCIDX; - ch->basereg = ADCBA; - ch->sizereg = ADCBS; - ch->setupreg = ADCCR; - ch->irqmask = INTE_ADCBUFENABLE; - ch->iprmask = IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL; + ch->idxreg = sc->is_emu10k1 ? EMU_ADCIDX : EMU_A_ADCIDX; + ch->basereg = EMU_ADCBA; + ch->sizereg = EMU_ADCBS; + ch->setupreg = EMU_ADCCR; + ch->irqmask = EMU_INTE_ADCBUFENABLE; + ch->iprmask = EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL; if (sndbuf_alloc(ch->buffer, emu_gettag(sc->card), 0, sc->bufsz) != 0) return (NULL); @@ -953,22 +953,22 @@ emurchan_trigger(kobj_t obj __unused, vo switch (sc->bufsz) { case 4096: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; break; case 8192: - sz = ADCBS_BUFSIZE_8192; + sz = EMU_RECBS_BUFSIZE_8192; break; case 16384: - sz = ADCBS_BUFSIZE_16384; + sz = EMU_RECBS_BUFSIZE_16384; break; case 32768: - sz = ADCBS_BUFSIZE_32768; + sz = EMU_RECBS_BUFSIZE_32768; break; case 65536: - sz = ADCBS_BUFSIZE_65536; + sz = EMU_RECBS_BUFSIZE_65536; break; default: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; } snd_mtxlock(sc->lock); @@ -976,9 +976,9 @@ emurchan_trigger(kobj_t obj __unused, vo case PCMTRIG_START: ch->run = 1; emu_wrptr(sc->card, 0, ch->sizereg, sz); - val = sc->is_emu10k1 ? ADCCR_LCHANENABLE : A_ADCCR_LCHANENABLE; + val = sc->is_emu10k1 ? EMU_ADCCR_LCHANENABLE : EMU_A_ADCCR_LCHANENABLE; if (AFMT_CHANNEL(ch->fmt) > 1) - val |= sc->is_emu10k1 ? ADCCR_RCHANENABLE : A_ADCCR_RCHANENABLE; + val |= sc->is_emu10k1 ? EMU_ADCCR_RCHANENABLE : EMU_A_ADCCR_RCHANENABLE; val |= sc->is_emu10k1 ? emu_k1_recval(ch->spd) : emu_k2_recval(ch->spd); emu_wrptr(sc->card, 0, ch->setupreg, 0); emu_wrptr(sc->card, 0, ch->setupreg, val); @@ -1049,11 +1049,11 @@ emufxrchan_init(kobj_t obj __unused, voi ch = &(sc->rch_efx); ch->fmt = SND_FORMAT(AFMT_S16_LE, 1, 0); ch->spd = sc->is_emu10k1 ? 48000*32 : 48000 * 64; - ch->idxreg = FXIDX; - ch->basereg = FXBA; - ch->sizereg = FXBS; - ch->irqmask = INTE_EFXBUFENABLE; - ch->iprmask = IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL; + ch->idxreg = EMU_FXIDX; + ch->basereg = EMU_FXBA; + ch->sizereg = EMU_FXBS; + ch->irqmask = EMU_INTE_EFXBUFENABLE; + ch->iprmask = EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL; ch->buffer = b; ch->pcm = sc; ch->channel = c; @@ -1113,22 +1113,22 @@ emufxrchan_trigger(kobj_t obj __unused, switch (sc->bufsz) { case 4096: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; break; case 8192: - sz = ADCBS_BUFSIZE_8192; + sz = EMU_RECBS_BUFSIZE_8192; break; case 16384: - sz = ADCBS_BUFSIZE_16384; + sz = EMU_RECBS_BUFSIZE_16384; break; case 32768: - sz = ADCBS_BUFSIZE_32768; + sz = EMU_RECBS_BUFSIZE_32768; break; case 65536: - sz = ADCBS_BUFSIZE_65536; + sz = EMU_RECBS_BUFSIZE_65536; break; default: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; } snd_mtxlock(sc->lock); @@ -1140,14 +1140,14 @@ emufxrchan_trigger(kobj_t obj __unused, /* * SB Live! is limited to 32 mono channels. Audigy * has 64 mono channels. Channels are enabled - * by setting a bit in A_FXWC[1|2] registers. + * by setting a bit in EMU_A_FXWC[1|2] registers. */ /* XXX there is no way to demultiplex this streams for now */ if (sc->is_emu10k1) { - emu_wrptr(sc->card, 0, FXWC, 0xffffffff); + emu_wrptr(sc->card, 0, EMU_FXWC, 0xffffffff); } else { - emu_wrptr(sc->card, 0, A_FXWC1, 0xffffffff); - emu_wrptr(sc->card, 0, A_FXWC2, 0xffffffff); + emu_wrptr(sc->card, 0, EMU_A_FXWC1, 0xffffffff); + emu_wrptr(sc->card, 0, EMU_A_FXWC2, 0xffffffff); } break; case PCMTRIG_STOP: @@ -1155,10 +1155,10 @@ emufxrchan_trigger(kobj_t obj __unused, case PCMTRIG_ABORT: ch->run = 0; if (sc->is_emu10k1) { - emu_wrptr(sc->card, 0, FXWC, 0x0); + emu_wrptr(sc->card, 0, EMU_FXWC, 0x0); } else { - emu_wrptr(sc->card, 0, A_FXWC1, 0x0); - emu_wrptr(sc->card, 0, A_FXWC2, 0x0); + emu_wrptr(sc->card, 0, EMU_A_FXWC1, 0x0); + emu_wrptr(sc->card, 0, EMU_A_FXWC2, 0x0); } emu_wrptr(sc->card, 0, ch->sizereg, 0); (void)emu_intr_unregister(sc->card, ch->ihandle); @@ -1238,8 +1238,8 @@ emu_pcm_intr(void *pcm, uint32_t stat) snd_mtxlock(sc->lock); - if (stat & IPR_INTERVALTIMER) { - ack |= IPR_INTERVALTIMER; + if (stat & EMU_IPR_INTERVALTIMER) { + ack |= EMU_IPR_INTERVALTIMER; for (i = 0; i < MAX_CHANNELS; i++) if (sc->pch[i].channel) { if (sc->pch[i].run == 1) { @@ -1262,8 +1262,8 @@ emu_pcm_intr(void *pcm, uint32_t stat) } - if (stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL)) { - ack |= stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL); + if (stat & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL)) { + ack |= stat & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL); if (sc->rch_adc.channel) { snd_mtxunlock(sc->lock); chn_intr(sc->rch_adc.channel); @@ -1271,8 +1271,8 @@ emu_pcm_intr(void *pcm, uint32_t stat) } } - if (stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL)) { - ack |= stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL); + if (stat & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL)) { + ack |= stat & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL); if (sc->rch_efx.channel) { snd_mtxunlock(sc->lock); chn_intr(sc->rch_efx.channel); @@ -1450,8 +1450,8 @@ emu_pcm_attach(device_t dev) goto bad; } - inte = INTE_INTERVALTIMERENB; - ipr = IPR_INTERVALTIMER; /* Used by playback & ADC */ + inte = EMU_INTE_INTERTIMERENB; + ipr = EMU_IPR_INTERVALTIMER; /* Used by playback & ADC */ sc->ihandle = emu_intr_register(sc->card, inte, ipr, &emu_pcm_intr, sc); if (emu_pcm_init(sc) == -1) { Modified: stable/8/sys/dev/sound/pci/emu10kx.c ============================================================================== --- stable/8/sys/dev/sound/pci/emu10kx.c Fri Feb 3 22:39:04 2012 (r230964) +++ stable/8/sys/dev/sound/pci/emu10kx.c Fri Feb 3 23:00:28 2012 (r230965) @@ -53,6 +53,7 @@ #include #include +#include #include /* hw flags */ @@ -181,7 +182,7 @@ #define A_IN_AUX2_R 0x0d #define A_IN_AUX2 A_IN_AUX2_L -/* Audigiy Outputs */ +/* Audigy Outputs */ #define A_OUT_D_FRONT_L 0x00 #define A_OUT_D_FRONT_R 0x01 #define A_OUT_D_FRONT A_OUT_D_FRONT_L @@ -217,9 +218,19 @@ #define A_OUT_ADC_REC_R 0x17 #define A_OUT_ADC_REC A_OUT_ADC_REC_L -#include "emu10k1-alsa%diked.h" -#include "p16v-alsa%diked.h" -#include "p17v-alsa%diked.h" +#define EMU_DATA2 0x24 +#define EMU_IPR2 0x28 +#define EMU_INTE2 0x2c +#define EMU_IPR3 0x38 +#define EMU_INTE3 0x3c + +#define EMU_A2_SRCSel 0x60 +#define EMU_A2_SRCMULTI_ENABLE 0x6e + +#define EMU_A_I2S_CAPTURE_96000 0x00000400 + +#define EMU_A2_MIXER_I2S_ENABLE 0x7B +#define EMU_A2_MIXER_SPDIF_ENABLE 0x7A #define C_FRONT_L 0 #define C_FRONT_R 1 @@ -630,7 +641,7 @@ emu_wr_nolock(struct emu_sc_info *sc, un } } /* - * PTR / DATA interface. Access to EMU10Kx is made + * EMU_PTR / EMU_DATA interface. Access to EMU10Kx is made * via (channel, register) pair. Some registers are channel-specific, * some not. */ @@ -639,11 +650,11 @@ emu_rdptr(struct emu_sc_info *sc, unsign { uint32_t ptr, val, mask, size, offset; - ptr = ((reg << 16) & sc->address_mask) | (chn & PTR_CHANNELNUM_MASK); + ptr = ((reg << 16) & sc->address_mask) | (chn & EMU_PTR_CHNO_MASK); EMU_RWLOCK(); - emu_wr_nolock(sc, PTR, ptr, 4); - val = emu_rd_nolock(sc, DATA, 4); + emu_wr_nolock(sc, EMU_PTR, ptr, 4); + val = emu_rd_nolock(sc, EMU_DATA, 4); EMU_RWUNLOCK(); /* @@ -666,10 +677,10 @@ emu_wrptr(struct emu_sc_info *sc, unsign { uint32_t ptr, mask, size, offset; - ptr = ((reg << 16) & sc->address_mask) | (chn & PTR_CHANNELNUM_MASK); + ptr = ((reg << 16) & sc->address_mask) | (chn & EMU_PTR_CHNO_MASK); EMU_RWLOCK(); - emu_wr_nolock(sc, PTR, ptr, 4); + emu_wr_nolock(sc, EMU_PTR, ptr, 4); /* * XXX Another kind of magic encoding in register number. This can * give you side effect - it will read previous data from register @@ -681,13 +692,13 @@ emu_wrptr(struct emu_sc_info *sc, unsign mask = ((1 << size) - 1) << offset; data <<= offset; data &= mask; - data |= emu_rd_nolock(sc, DATA, 4) & ~mask; + data |= emu_rd_nolock(sc, EMU_DATA, 4) & ~mask; } - emu_wr_nolock(sc, DATA, data, 4); + emu_wr_nolock(sc, EMU_DATA, data, 4); EMU_RWUNLOCK(); } /* - * PTR2 / DATA2 interface. Access to P16v is made + * EMU_A2_PTR / EMU_DATA2 interface. Access to P16v is made * via (channel, register) pair. Some registers are channel-specific, * some not. This interface is supported by CA0102 and CA0108 chips only. */ @@ -698,8 +709,8 @@ emu_rd_p16vptr(struct emu_sc_info *sc, u /* XXX separate lock? */ EMU_RWLOCK(); - emu_wr_nolock(sc, PTR2, (reg << 16) | chn, 4); - val = emu_rd_nolock(sc, DATA2, 4); + emu_wr_nolock(sc, EMU_A2_PTR, (reg << 16) | chn, 4); + val = emu_rd_nolock(sc, EMU_DATA2, 4); EMU_RWUNLOCK(); @@ -711,8 +722,8 @@ emu_wr_p16vptr(struct emu_sc_info *sc, u { EMU_RWLOCK(); - emu_wr_nolock(sc, PTR2, (reg << 16) | chn, 4); - emu_wr_nolock(sc, DATA2, data, 4); + emu_wr_nolock(sc, EMU_A2_PTR, (reg << 16) | chn, 4); + emu_wr_nolock(sc, EMU_DATA2, data, 4); EMU_RWUNLOCK(); } /* @@ -737,13 +748,13 @@ emu_wr_cbptr(struct emu_sc_info *sc, uin /* * Direct hardware register access - * Assume that it is never used to access PTR-based registers and can run unlocked. + * Assume that it is never used to access EMU_PTR-based registers and can run unlocked. */ void emu_wr(struct emu_sc_info *sc, unsigned int regno, uint32_t data, unsigned int size) { - KASSERT(regno != PTR, ("emu_wr: attempt to write to PTR")); - KASSERT(regno != PTR2, ("emu_wr: attempt to write to PTR2")); + KASSERT(regno != EMU_PTR, ("emu_wr: attempt to write to EMU_PTR")); + KASSERT(regno != EMU_A2_PTR, ("emu_wr: attempt to write to EMU_A2_PTR")); emu_wr_nolock(sc, regno, data, size); } @@ -753,8 +764,8 @@ emu_rd(struct emu_sc_info *sc, unsigned { uint32_t rd; - KASSERT(regno != DATA, ("emu_rd: attempt to read DATA")); - KASSERT(regno != DATA2, ("emu_rd: attempt to read DATA2")); + KASSERT(regno != EMU_DATA, ("emu_rd: attempt to read DATA")); + KASSERT(regno != EMU_DATA2, ("emu_rd: attempt to read DATA2")); rd = emu_rd_nolock(sc, regno, size); return (rd); @@ -770,24 +781,24 @@ emu_enable_ir(struct emu_sc_info *sc) uint32_t iocfg; if (sc->is_emu10k2 || sc->is_ca0102) { - iocfg = emu_rd_nolock(sc, A_IOCFG, 2); - emu_wr_nolock(sc, A_IOCFG, iocfg | A_IOCFG_GPOUT2, 2); + iocfg = emu_rd_nolock(sc, EMU_A_IOCFG, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg | EMU_A_IOCFG_GPOUT2, 2); DELAY(500); - emu_wr_nolock(sc, A_IOCFG, iocfg | A_IOCFG_GPOUT1 | A_IOCFG_GPOUT2, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg | EMU_A_IOCFG_GPOUT1 | EMU_A_IOCFG_GPOUT2, 2); DELAY(500); - emu_wr_nolock(sc, A_IOCFG, iocfg | A_IOCFG_GPOUT1, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg | EMU_A_IOCFG_GPOUT1, 2); DELAY(100); - emu_wr_nolock(sc, A_IOCFG, iocfg, 2); + emu_wr_nolock(sc, EMU_A_IOCFG, iocfg, 2); device_printf(sc->dev, "Audigy IR MIDI events enabled.\n"); sc->enable_ir = 1; } if (sc->is_emu10k1) { - iocfg = emu_rd_nolock(sc, HCFG, 4); - emu_wr_nolock(sc, HCFG, iocfg | HCFG_GPOUT2, 4); + iocfg = emu_rd_nolock(sc, EMU_HCFG, 4); + emu_wr_nolock(sc, EMU_HCFG, iocfg | EMU_HCFG_GPOUT2, 4); DELAY(500); - emu_wr_nolock(sc, HCFG, iocfg | HCFG_GPOUT1 | HCFG_GPOUT2, 4); + emu_wr_nolock(sc, EMU_HCFG, iocfg | EMU_HCFG_GPOUT1 | EMU_HCFG_GPOUT2, 4); DELAY(100); - emu_wr_nolock(sc, HCFG, iocfg, 4); + emu_wr_nolock(sc, EMU_HCFG, iocfg, 4); device_printf(sc->dev, "SB Live! IR MIDI events enabled.\n"); sc->enable_ir = 1; } @@ -835,7 +846,7 @@ emu_timer_set(struct emu_sc_info *sc, in sc->timerinterval = sc->timer[i]; /* XXX */ - emu_wr(sc, TIMER, sc->timerinterval & 0x03ff, 2); + emu_wr(sc, EMU_TIMER, sc->timerinterval & 0x03ff, 2); mtx_unlock(&sc->lock); return (timer); @@ -868,16 +879,16 @@ emu_timer_enable(struct emu_sc_info *sc, ena_int = 1; } - emu_wr(sc, TIMER, sc->timerinterval & 0x03ff, 2); + emu_wr(sc, EMU_TIMER, sc->timerinterval & 0x03ff, 2); if (ena_int == 1) { - x = emu_rd(sc, INTE, 4); - x |= INTE_INTERVALTIMERENB; - emu_wr(sc, INTE, x, 4); + x = emu_rd(sc, EMU_INTE, 4); + x |= EMU_INTE_INTERTIMERENB; + emu_wr(sc, EMU_INTE, x, 4); } else { - x = emu_rd(sc, INTE, 4); - x &= ~INTE_INTERVALTIMERENB; - emu_wr(sc, INTE, x, 4); + x = emu_rd(sc, EMU_INTE, 4); + x &= ~EMU_INTE_INTERTIMERENB; + emu_wr(sc, EMU_INTE, x, 4); } mtx_unlock(&sc->lock); return (0); @@ -917,9 +928,9 @@ emu_intr_register(struct emu_sc_info *sc sc->ihandler[i].intr_mask = intr_mask; sc->ihandler[i].softc = isc; sc->ihandler[i].irq_func = func; - x = emu_rd(sc, INTE, 4); + x = emu_rd(sc, EMU_INTE, 4); x |= inte_mask; - emu_wr(sc, INTE, x, 4); + emu_wr(sc, EMU_INTE, x, 4); mtx_unlock(&sc->lock); if (sc->dbg_level > 1) device_printf(sc->dev, "ihandle %d registered\n", i); @@ -946,7 +957,7 @@ emu_intr_unregister(struct emu_sc_info * return (-1); } - x = emu_rd(sc, INTE, 4); + x = emu_rd(sc, EMU_INTE, 4); x &= ~sc->ihandler[hnumber].inte_mask; sc->ihandler[hnumber].inte_mask = 0; @@ -954,12 +965,12 @@ emu_intr_unregister(struct emu_sc_info * sc->ihandler[hnumber].softc = NULL; sc->ihandler[hnumber].irq_func = NULL; - /* other interrupt handlers may use this INTE value */ + /* other interrupt handlers may use this EMU_INTE value */ for (i = 0; i < EMU_MAX_IRQ_CONSUMERS; i++) if (sc->ihandler[i].inte_mask != 0) x |= sc->ihandler[i].inte_mask; - emu_wr(sc, INTE, x, 4); + emu_wr(sc, EMU_INTE, x, 4); mtx_unlock(&sc->lock); return (hnumber); @@ -973,11 +984,11 @@ emu_intr(void *p) int i; for (;;) { - stat = emu_rd(sc, IPR, 4); + stat = emu_rd(sc, EMU_IPR, 4); ack = 0; if (stat == 0) break; - emu_wr(sc, IPR, stat, 4); + emu_wr(sc, EMU_IPR, stat, 4); for (i = 0; i < EMU_MAX_IRQ_CONSUMERS; i++) { if ((((sc->ihandler[i].intr_mask) & stat) != 0) && (((void *)sc->ihandler[i].irq_func) != NULL)) { @@ -993,13 +1004,13 @@ emu_intr(void *p) if ((sc->is_ca0102) || (sc->is_ca0108)) for (;;) { - stat = emu_rd(sc, IPR2, 4); + stat = emu_rd(sc, EMU_IPR2, 4); ack = 0; if (stat == 0) break; - emu_wr(sc, IPR2, stat, 4); + emu_wr(sc, EMU_IPR2, stat, 4); if (sc->dbg_level > 1) - device_printf(sc->dev, "IPR2: %08x\n", stat); + device_printf(sc->dev, "EMU_IPR2: %08x\n", stat); break; /* to avoid infinite loop. shoud be removed * after completion of P16V interface. */ @@ -1007,13 +1018,13 @@ emu_intr(void *p) if (sc->is_ca0102) for (;;) { - stat = emu_rd(sc, IPR3, 4); + stat = emu_rd(sc, EMU_IPR3, 4); ack = 0; if (stat == 0) break; - emu_wr(sc, IPR3, stat, 4); + emu_wr(sc, EMU_IPR3, stat, 4); if (sc->dbg_level > 1) - device_printf(sc->dev, "IPR3: %08x\n", stat); + device_printf(sc->dev, "EMU_IPR3: %08x\n", stat); break; /* to avoid infinite loop. should be removed * after completion of S/PDIF interface */ @@ -1374,61 +1385,61 @@ emu_vwrite(struct emu_sc_info *sc, struc if (v->stereo) { - emu_wrptr(sc, v->vnum, CPF, CPF_STEREO_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF, EMU_CHAN_CPF_STEREO_MASK); } else { - emu_wrptr(sc, v->vnum, CPF, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF, 0); } val = v->stereo ? 28 : 30; val *= v->b16 ? 1 : 2; start = v->sa + val; if (sc->is_emu10k1) { - emu_wrptr(sc, v->vnum, FXRT, ((v->routing[3] << 12) | + emu_wrptr(sc, v->vnum, EMU_CHAN_FXRT, ((v->routing[3] << 12) | (v->routing[2] << 8) | (v->routing[1] << 4) | (v->routing[0] << 0)) << 16); } else { - emu_wrptr(sc, v->vnum, A_FXRT1, (v->routing[3] << 24) | + emu_wrptr(sc, v->vnum, EMU_A_CHAN_FXRT1, (v->routing[3] << 24) | (v->routing[2] << 16) | (v->routing[1] << 8) | (v->routing[0] << 0)); - emu_wrptr(sc, v->vnum, A_FXRT2, (v->routing[7] << 24) | + emu_wrptr(sc, v->vnum, EMU_A_CHAN_FXRT2, (v->routing[7] << 24) | (v->routing[6] << 16) | (v->routing[5] << 8) | (v->routing[4] << 0)); - emu_wrptr(sc, v->vnum, A_SENDAMOUNTS, (v->amounts[7] << 24) | + emu_wrptr(sc, v->vnum, EMU_A_CHAN_SENDAMOUNTS, (v->amounts[7] << 24) | (v->amounts[6] << 26) | (v->amounts[5] << 8) | (v->amounts[4] << 0)); } - emu_wrptr(sc, v->vnum, PTRX, (v->amounts[0] << 8) | (v->amounts[1] << 0)); - emu_wrptr(sc, v->vnum, DSL, v->ea | (v->amounts[3] << 24)); - emu_wrptr(sc, v->vnum, PSST, v->sa | (v->amounts[2] << 24)); - - emu_wrptr(sc, v->vnum, CCCA, start | (v->b16 ? 0 : CCCA_8BITSELECT)); - emu_wrptr(sc, v->vnum, Z1, 0); - emu_wrptr(sc, v->vnum, Z2, 0); - - silent_page = ((uint32_t) (sc->mem.silent_page_addr) << 1) | MAP_PTI_MASK; - emu_wrptr(sc, v->vnum, MAPA, silent_page); - emu_wrptr(sc, v->vnum, MAPB, silent_page); - - emu_wrptr(sc, v->vnum, CVCF, CVCF_CURRENTFILTER_MASK); - emu_wrptr(sc, v->vnum, VTFT, VTFT_FILTERTARGET_MASK); - emu_wrptr(sc, v->vnum, ATKHLDM, 0); - emu_wrptr(sc, v->vnum, DCYSUSM, DCYSUSM_DECAYTIME_MASK); - emu_wrptr(sc, v->vnum, LFOVAL1, 0x8000); - emu_wrptr(sc, v->vnum, LFOVAL2, 0x8000); - emu_wrptr(sc, v->vnum, FMMOD, 0); - emu_wrptr(sc, v->vnum, TREMFRQ, 0); - emu_wrptr(sc, v->vnum, FM2FRQ2, 0); - emu_wrptr(sc, v->vnum, ENVVAL, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX, (v->amounts[0] << 8) | (v->amounts[1] << 0)); + emu_wrptr(sc, v->vnum, EMU_CHAN_DSL, v->ea | (v->amounts[3] << 24)); + emu_wrptr(sc, v->vnum, EMU_CHAN_PSST, v->sa | (v->amounts[2] << 24)); + + emu_wrptr(sc, v->vnum, EMU_CHAN_CCCA, start | (v->b16 ? 0 : EMU_CHAN_CCCA_8BITSELECT)); + emu_wrptr(sc, v->vnum, EMU_CHAN_Z1, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_Z2, 0); + + silent_page = ((uint32_t) (sc->mem.silent_page_addr) << 1) | EMU_CHAN_MAP_PTI_MASK; + emu_wrptr(sc, v->vnum, EMU_CHAN_MAPA, silent_page); + emu_wrptr(sc, v->vnum, EMU_CHAN_MAPB, silent_page); + + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, EMU_CHAN_CVCF_CURRFILTER_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, EMU_CHAN_VTFT_FILTERTARGET_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_ATKHLDM, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_DCYSUSM, EMU_CHAN_DCYSUSM_DECAYTIME_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_LFOVAL1, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_LFOVAL2, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_FMMOD, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_TREMFRQ, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_FM2FRQ2, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_ENVVAL, 0x8000); - emu_wrptr(sc, v->vnum, ATKHLDV, ATKHLDV_HOLDTIME_MASK | ATKHLDV_ATTACKTIME_MASK); - emu_wrptr(sc, v->vnum, ENVVOL, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_ATKHLDV, EMU_CHAN_ATKHLDV_HOLDTIME_MASK | EMU_CHAN_ATKHLDV_ATTACKTIME_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_ENVVOL, 0x8000); - emu_wrptr(sc, v->vnum, PEFE_FILTERAMOUNT, 0x7f); - emu_wrptr(sc, v->vnum, PEFE_PITCHAMOUNT, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_PEFE_FILTERAMOUNT, 0x7f); + emu_wrptr(sc, v->vnum, EMU_CHAN_PEFE_PITCHAMOUNT, 0); if ((v->stereo) && (v->slave != NULL)) emu_vwrite(sc, v->slave); } @@ -1438,7 +1449,7 @@ emu_vstop(struct emu_sc_info *sc, char c { int reg; - reg = (channel & 0x20) ? SOLEH : SOLEL; + reg = (channel & 0x20) ? EMU_SOLEH : EMU_SOLEL; channel &= 0x1f; reg |= 1 << 24; reg |= channel << 16; @@ -1459,29 +1470,29 @@ emu_vtrigger(struct emu_sc_info *sc, str ccis *= v->b16 ? 1 : 2; sample = v->b16 ? 0x00000000 : 0x80808080; for (i = 0; i < cs; i++) - emu_wrptr(sc, v->vnum, CD0 + i, sample); - emu_wrptr(sc, v->vnum, CCR_CACHEINVALIDSIZE, 0); - emu_wrptr(sc, v->vnum, CCR_READADDRESS, cra); - emu_wrptr(sc, v->vnum, CCR_CACHEINVALIDSIZE, ccis); - - emu_wrptr(sc, v->vnum, IFATN, 0xff00); - emu_wrptr(sc, v->vnum, VTFT, 0xffffffff); - emu_wrptr(sc, v->vnum, CVCF, 0xffffffff); - emu_wrptr(sc, v->vnum, DCYSUSV, 0x00007f7f); + emu_wrptr(sc, v->vnum, EMU_CHAN_CD0 + i, sample); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_CACHEINVALIDSIZE, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_READADDRESS, cra); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_CACHEINVALIDSIZE, ccis); + + emu_wrptr(sc, v->vnum, EMU_CHAN_IFATN, 0xff00); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, 0xffffffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, 0xffffffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_DCYSUSV, 0x00007f7f); emu_vstop(sc, v->vnum, 0); pitch_target = emu_rate_to_linearpitch(v->speed); initial_pitch = emu_rate_to_pitch(v->speed) >> 8; - emu_wrptr(sc, v->vnum, PTRX_PITCHTARGET, pitch_target); - emu_wrptr(sc, v->vnum, CPF_CURRENTPITCH, pitch_target); - emu_wrptr(sc, v->vnum, IP, initial_pitch); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX_PITCHTARGET, pitch_target); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF_PITCH, pitch_target); + emu_wrptr(sc, v->vnum, EMU_CHAN_IP, initial_pitch); } else { - emu_wrptr(sc, v->vnum, PTRX_PITCHTARGET, 0); - emu_wrptr(sc, v->vnum, CPF_CURRENTPITCH, 0); - emu_wrptr(sc, v->vnum, IFATN, 0xffff); - emu_wrptr(sc, v->vnum, VTFT, 0x0000ffff); - emu_wrptr(sc, v->vnum, CVCF, 0x0000ffff); - emu_wrptr(sc, v->vnum, IP, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX_PITCHTARGET, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF_PITCH, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_IFATN, 0xffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, 0x0000ffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, 0x0000ffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_IP, 0); emu_vstop(sc, v->vnum, 1); } if ((v->stereo) && (v->slave != NULL)) @@ -1494,7 +1505,7 @@ emu_vpos(struct emu_sc_info *sc, struct int s, ptr; s = (v->b16 ? 1 : 0) + (v->stereo ? 1 : 0); - ptr = (emu_rdptr(sc, v->vnum, CCCA_CURRADDR) - (v->start >> s)) << s; + ptr = (emu_rdptr(sc, v->vnum, EMU_CHAN_CCCA_CURRADDR) - (v->start >> s)) << s; return (ptr & ~0x0000001f); } @@ -1694,9 +1705,9 @@ emu_initefx(struct emu_sc_info *sc) /* stop DSP */ if (sc->is_emu10k1) { - emu_wrptr(sc, 0, DBG, EMU10K1_DBG_SINGLE_STEP); + emu_wrptr(sc, 0, EMU_DBG, EMU_DBG_SINGLE_STEP); } else { - emu_wrptr(sc, 0, A_DBG, A_DBG_SINGLE_STEP); + emu_wrptr(sc, 0, EMU_A_DBG, EMU_A_DBG_SINGLE_STEP); } /* code size is in instructions */ @@ -2162,9 +2173,9 @@ emu_initefx(struct emu_sc_info *sc) /* start DSP */ if (sc->is_emu10k1) { - emu_wrptr(sc, 0, DBG, 0); + emu_wrptr(sc, 0, EMU_DBG, 0); } else { - emu_wrptr(sc, 0, A_DBG, 0); + emu_wrptr(sc, 0, EMU_A_DBG, 0); } } @@ -2450,24 +2461,24 @@ emumix_set_mode(struct emu_sc_info *sc, return; } - hcfg = HCFG_AUDIOENABLE | HCFG_AUTOMUTE; + hcfg = EMU_HCFG_AUDIOENABLE | EMU_HCFG_AUTOMUTE; a_iocfg = 0; if (sc->rev >= 6) - hcfg |= HCFG_JOYENABLE; + hcfg |= EMU_HCFG_JOYENABLE; if (sc->is_emu10k1) - hcfg |= HCFG_LOCKTANKCACHE_MASK; + hcfg |= EMU_HCFG_LOCKTANKCACHE_MASK; else - hcfg |= HCFG_CODECFORMAT_I2S | HCFG_JOYENABLE; + hcfg |= EMU_HCFG_CODECFMT_I2S | EMU_HCFG_JOYENABLE; if (mode == MODE_DIGITAL) { if (sc->broken_digital) { device_printf(sc->dev, "Digital mode is reported as broken on this card.\n"); } - a_iocfg |= A_IOCFG_ENABLE_DIGITAL; - hcfg |= HCFG_GPOUT0; + a_iocfg |= EMU_A_IOCFG_GPOUT1; + hcfg |= EMU_HCFG_GPOUT0; } if (mode == MODE_ANALOG) @@ -2478,12 +2489,12 @@ emumix_set_mode(struct emu_sc_info *sc, if ((sc->is_ca0102) || (sc->is_ca0108)) /* - * Setting A_IOCFG_DISABLE_ANALOG will do opposite things + * Setting EMU_A_IOCFG_DISABLE_ANALOG will do opposite things * on diffrerent cards. * "don't disable analog outs" on Audigy 2 (ca0102/ca0108) * "disable analog outs" on Audigy (emu10k2) */ - a_iocfg |= A_IOCFG_DISABLE_ANALOG; + a_iocfg |= EMU_A_IOCFG_DISABLE_ANALOG; if (sc->is_ca0108) a_iocfg |= 0x20; /* XXX */ @@ -2492,12 +2503,12 @@ emumix_set_mode(struct emu_sc_info *sc, if (mode == MODE_DIGITAL) emumix_set_gpr(sc, sc->mute_gpr[ANALOGMUTE], 1); - emu_wr(sc, HCFG, hcfg, 4); + emu_wr(sc, EMU_HCFG, hcfg, 4); if ((sc->is_emu10k2) || (sc->is_ca0102) || (sc->is_ca0108)) { - tmp = emu_rd(sc, A_IOCFG, 2); + tmp = emu_rd(sc, EMU_A_IOCFG, 2); tmp = a_iocfg; - emu_wr(sc, A_IOCFG, tmp, 2); + emu_wr(sc, EMU_A_IOCFG, tmp, 2); } /* Unmute if we have changed mode to analog. */ @@ -2523,16 +2534,16 @@ emumix_set_spdif_mode(struct emu_sc_info return; } - spcs = SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | - SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | - SPCS_GENERATIONSTATUS | 0x00001200 | 0x00000000 | - SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT; + spcs = EMU_SPCS_CLKACCY_1000PPM | EMU_SPCS_SAMPLERATE_48 | + EMU_SPCS_CHANNELNUM_LEFT | EMU_SPCS_SOURCENUM_UNSPEC | + EMU_SPCS_GENERATIONSTATUS | 0x00001200 | 0x00000000 | + EMU_SPCS_EMPHASIS_NONE | EMU_SPCS_COPYRIGHT; mode = SPDIF_MODE_PCM; - emu_wrptr(sc, 0, SPCS0, spcs); - emu_wrptr(sc, 0, SPCS1, spcs); - emu_wrptr(sc, 0, SPCS2, spcs); + emu_wrptr(sc, 0, EMU_SPCS0, spcs); + emu_wrptr(sc, 0, EMU_SPCS1, spcs); + emu_wrptr(sc, 0, EMU_SPCS2, spcs); } #define L2L_POINTS 10 @@ -2635,8 +2646,8 @@ emu_cardbus_init(struct emu_sc_info *sc) { /* - * XXX May not need this if we have IPR3 handler. - * Is it a real init calls, or IPR3 interrupt acknowledgments? + * XXX May not need this if we have EMU_IPR3 handler. + * Is it a real init calls, or EMU_IPR3 interrupt acknowledgments? * Looks much like "(data << 16) | register". */ emu_wr_cbptr(sc, (0x00d0 << 16) | 0x0000); @@ -2660,42 +2671,42 @@ emu_init(struct emu_sc_info *sc) int i; /* disable audio and lock cache */ - emu_wr(sc, HCFG, HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, 4); + emu_wr(sc, EMU_HCFG, EMU_HCFG_LOCKSOUNDCACHE | EMU_HCFG_LOCKTANKCACHE_MASK | EMU_HCFG_MUTEBUTTONENABLE, 4); /* reset recording buffers */ - emu_wrptr(sc, 0, MICBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, MICBA, 0); - emu_wrptr(sc, 0, FXBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, FXBA, 0); - emu_wrptr(sc, 0, ADCBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, ADCBA, 0); + emu_wrptr(sc, 0, EMU_MICBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_MICBA, 0); + emu_wrptr(sc, 0, EMU_FXBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_FXBA, 0); + emu_wrptr(sc, 0, EMU_ADCBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_ADCBA, 0); /* disable channel interrupt */ - emu_wr(sc, INTE, INTE_INTERVALTIMERENB | INTE_SAMPLERATETRACKER | INTE_PCIERRORENABLE, 4); - emu_wrptr(sc, 0, CLIEL, 0); - emu_wrptr(sc, 0, CLIEH, 0); - emu_wrptr(sc, 0, SOLEL, 0); - emu_wrptr(sc, 0, SOLEH, 0); + emu_wr(sc, EMU_INTE, EMU_INTE_INTERTIMERENB | EMU_INTE_SAMPLERATER | EMU_INTE_PCIERRENABLE, 4); + emu_wrptr(sc, 0, EMU_CLIEL, 0); + emu_wrptr(sc, 0, EMU_CLIEH, 0); + emu_wrptr(sc, 0, EMU_SOLEL, 0); + emu_wrptr(sc, 0, EMU_SOLEH, 0); /* disable P16V and S/PDIF interrupts */ if ((sc->is_ca0102) || (sc->is_ca0108)) - emu_wr(sc, INTE2, 0, 4); + emu_wr(sc, EMU_INTE2, 0, 4); if (sc->is_ca0102) - emu_wr(sc, INTE3, 0, 4); + emu_wr(sc, EMU_INTE3, 0, 4); /* init phys inputs and outputs */ ac97slot = 0; if (sc->has_51) - ac97slot = AC97SLOT_CNTR | AC97SLOT_LFE; + ac97slot = EMU_AC97SLOT_CENTER | EMU_AC97SLOT_LFE; if (sc->has_71) - ac97slot = AC97SLOT_CNTR | AC97SLOT_LFE | AC97SLOT_REAR_LEFT | AC97SLOT_REAR_RIGHT; + ac97slot = EMU_AC97SLOT_CENTER | EMU_AC97SLOT_LFE | EMU_AC97SLOT_REAR_LEFT | EMU_AC97SLOT_REAR_RIGHT; if (sc->is_emu10k2) ac97slot |= 0x40; - emu_wrptr(sc, 0, AC97SLOT, ac97slot); + emu_wrptr(sc, 0, EMU_AC97SLOT, ac97slot); if (sc->is_emu10k2) /* XXX for later cards? */ - emu_wrptr(sc, 0, SPBYPASS, 0xf00); /* What will happen if + emu_wrptr(sc, 0, EMU_SPBYPASS, 0xf00); /* What will happen if * we write 1 here? */ if (bus_dma_tag_create( /* parent */ bus_get_dma_tag(sc->dev), @@ -2729,61 +2740,61 @@ emu_init(struct emu_sc_info *sc) sc->mem.ptb_pages[i] = tmp | i; for (ch = 0; ch < NUM_G; ch++) { - emu_wrptr(sc, ch, MAPA, tmp | MAP_PTI_MASK); - emu_wrptr(sc, ch, MAPB, tmp | MAP_PTI_MASK); + emu_wrptr(sc, ch, EMU_CHAN_MAPA, tmp | EMU_CHAN_MAP_PTI_MASK); + emu_wrptr(sc, ch, EMU_CHAN_MAPB, tmp | EMU_CHAN_MAP_PTI_MASK); } - emu_wrptr(sc, 0, PTB, (sc->mem.ptb_pages_addr)); - emu_wrptr(sc, 0, TCB, 0); /* taken from original driver */ - emu_wrptr(sc, 0, TCBS, 0); /* taken from original driver */ + emu_wrptr(sc, 0, EMU_PTB, (sc->mem.ptb_pages_addr)); + emu_wrptr(sc, 0, EMU_TCB, 0); /* taken from original driver */ + emu_wrptr(sc, 0, EMU_TCBS, 0); /* taken from original driver */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 23:07:27 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68B62106566C; Fri, 3 Feb 2012 23:07:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 571A68FC08; Fri, 3 Feb 2012 23:07:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13N7RBo008521; Fri, 3 Feb 2012 23:07:27 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13N7RgE008519; Fri, 3 Feb 2012 23:07:27 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202032307.q13N7RgE008519@svn.freebsd.org> From: Dimitry Andric Date: Fri, 3 Feb 2012 23:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230966 - stable/9/sys/contrib/rdma X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 23:07:27 -0000 Author: dim Date: Fri Feb 3 23:07:26 2012 New Revision: 230966 URL: http://svn.freebsd.org/changeset/base/230966 Log: MFC r229753: In sys/contrib/rdma/ib_addr.h, bump MAX_ADDR_LEN to 20 bytes (the same value used in sys/ofed/include/linux/netdevice.h), so there will be no buffer overruns in the rest of the inline functions in this file. Reviewed by: kmacy Modified: stable/9/sys/contrib/rdma/ib_addr.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/contrib/rdma/ib_addr.h ============================================================================== --- stable/9/sys/contrib/rdma/ib_addr.h Fri Feb 3 23:00:28 2012 (r230965) +++ stable/9/sys/contrib/rdma/ib_addr.h Fri Feb 3 23:07:26 2012 (r230966) @@ -42,7 +42,7 @@ #include -#define MAX_ADDR_LEN ETHER_ADDR_LEN /* XXX doesn't support IB! */ +#define MAX_ADDR_LEN 20 struct rdma_addr_client { int refcount; From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 23:08:59 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D48E106566C; Fri, 3 Feb 2012 23:08:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFF018FC0C; Fri, 3 Feb 2012 23:08:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13N8w8O008615; Fri, 3 Feb 2012 23:08:58 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13N8wBc008613; Fri, 3 Feb 2012 23:08:58 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202032308.q13N8wBc008613@svn.freebsd.org> From: Dimitry Andric Date: Fri, 3 Feb 2012 23:08: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: r230967 - stable/8/sys/contrib/rdma X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 23:08:59 -0000 Author: dim Date: Fri Feb 3 23:08:58 2012 New Revision: 230967 URL: http://svn.freebsd.org/changeset/base/230967 Log: MFC r229753: In sys/contrib/rdma/ib_addr.h, bump MAX_ADDR_LEN to 20 bytes (the same value used in sys/ofed/include/linux/netdevice.h), so there will be no buffer overruns in the rest of the inline functions in this file. Reviewed by: kmacy Modified: stable/8/sys/contrib/rdma/ib_addr.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/contrib/rdma/ib_addr.h ============================================================================== --- stable/8/sys/contrib/rdma/ib_addr.h Fri Feb 3 23:07:26 2012 (r230966) +++ stable/8/sys/contrib/rdma/ib_addr.h Fri Feb 3 23:08:58 2012 (r230967) @@ -42,7 +42,7 @@ #include -#define MAX_ADDR_LEN ETHER_ADDR_LEN /* XXX doesn't support IB! */ +#define MAX_ADDR_LEN 20 struct rdma_addr_client { int refcount; From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 23:27:07 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3BF8106566C; Fri, 3 Feb 2012 23:27:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D227C8FC0C; Fri, 3 Feb 2012 23:27:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13NR7hN009254; Fri, 3 Feb 2012 23:27:07 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13NR7xx009252; Fri, 3 Feb 2012 23:27:07 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202032327.q13NR7xx009252@svn.freebsd.org> From: Dimitry Andric Date: Fri, 3 Feb 2012 23:27:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230968 - stable/7/sys/contrib/rdma X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 23:27:08 -0000 Author: dim Date: Fri Feb 3 23:27:07 2012 New Revision: 230968 URL: http://svn.freebsd.org/changeset/base/230968 Log: MFC r229753: In sys/contrib/rdma/ib_addr.h, bump MAX_ADDR_LEN to 20 bytes (the same value used in sys/ofed/include/linux/netdevice.h), so there will be no buffer overruns in the rest of the inline functions in this file. Reviewed by: kmacy Modified: stable/7/sys/contrib/rdma/ib_addr.h Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/contrib/rdma/ib_addr.h ============================================================================== --- stable/7/sys/contrib/rdma/ib_addr.h Fri Feb 3 23:08:58 2012 (r230967) +++ stable/7/sys/contrib/rdma/ib_addr.h Fri Feb 3 23:27:07 2012 (r230968) @@ -42,7 +42,7 @@ #include -#define MAX_ADDR_LEN ETHER_ADDR_LEN /* XXX doesn't support IB! */ +#define MAX_ADDR_LEN 20 struct rdma_addr_client { int refcount; From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 23:32:23 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CFDD1065670; Fri, 3 Feb 2012 23:32:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B2488FC12; Fri, 3 Feb 2012 23:32:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13NWNBW009480; Fri, 3 Feb 2012 23:32:23 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13NWN3J009478; Fri, 3 Feb 2012 23:32:23 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202032332.q13NWN3J009478@svn.freebsd.org> From: Dimitry Andric Date: Fri, 3 Feb 2012 23:32:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230969 - stable/9/contrib/llvm/lib/Target/X86 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 23:32:23 -0000 Author: dim Date: Fri Feb 3 23:32:22 2012 New Revision: 230969 URL: http://svn.freebsd.org/changeset/base/230969 Log: MFC r230393: Pull in r148240 from upstream llvm trunk: Make sure the non-SSE lowering for fences correctly clobbers EFLAGS. PR11768. In particular, this fixes segfaults during the build of devel/icu on i386. The __sync_synchronize() builtin used for implementing icu's internal barrier could lead to incorrect behaviour. Modified: stable/9/contrib/llvm/lib/Target/X86/X86InstrCompiler.td Directory Properties: stable/9/contrib/llvm/ (props changed) Modified: stable/9/contrib/llvm/lib/Target/X86/X86InstrCompiler.td ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86InstrCompiler.td Fri Feb 3 23:27:07 2012 (r230968) +++ stable/9/contrib/llvm/lib/Target/X86/X86InstrCompiler.td Fri Feb 3 23:32:22 2012 (r230969) @@ -533,7 +533,7 @@ def ATOMSWAP6432 : I<0, Pseudo, (outs GR // Memory barriers // TODO: Get this to fold the constant into the instruction. -let isCodeGenOnly = 1 in +let isCodeGenOnly = 1, Defs = [EFLAGS] in def OR32mrLocked : I<0x09, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$zero), "lock\n\t" "or{l}\t{$zero, $dst|$dst, $zero}", From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 23:35:39 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E934B106566B; Fri, 3 Feb 2012 23:35:39 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D64D08FC0A; Fri, 3 Feb 2012 23:35:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13NZdVq009645; Fri, 3 Feb 2012 23:35:39 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13NZdYj009642; Fri, 3 Feb 2012 23:35:39 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201202032335.q13NZdYj009642@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 3 Feb 2012 23:35: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: r230970 - stable/8/sbin/newfs_msdos X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 23:35:40 -0000 Author: pfg Date: Fri Feb 3 23:35:39 2012 New Revision: 230970 URL: http://svn.freebsd.org/changeset/base/230970 Log: MFC: r228740 Many style fixes. Remove C99 initializers: they don't help in this case. Set errno to 0 before strtoll() (from NetBSD). PR: 151850 Suggested by: bde Approved by: jhb (Mentor) Modified: stable/8/sbin/newfs_msdos/newfs_msdos.8 stable/8/sbin/newfs_msdos/newfs_msdos.c Directory Properties: stable/8/sbin/newfs_msdos/ (props changed) Modified: stable/8/sbin/newfs_msdos/newfs_msdos.8 ============================================================================== --- stable/8/sbin/newfs_msdos/newfs_msdos.8 Fri Feb 3 23:32:22 2012 (r230969) +++ stable/8/sbin/newfs_msdos/newfs_msdos.8 Fri Feb 3 23:35:39 2012 (r230970) @@ -180,27 +180,27 @@ For reference purposes, this structure i below. .Bd -literal struct bsbpb { - u_int16_t bps; /* [-S] bytes per sector */ - u_int8_t spc; /* [-c] sectors per cluster */ - u_int16_t res; /* [-r] reserved sectors */ - u_int8_t nft; /* [-n] number of FATs */ - u_int16_t rde; /* [-e] root directory entries */ - u_int16_t sec; /* [-s] total sectors */ - u_int8_t mid; /* [-m] media descriptor */ - u_int16_t spf; /* [-a] sectors per FAT */ - u_int16_t spt; /* [-u] sectors per track */ - u_int16_t hds; /* [-h] drive heads */ - u_int32_t hid; /* [-o] hidden sectors */ - u_int32_t bsec; /* [-s] big total sectors */ + u_int16_t bpbBytesPerSec; /* [-S] bytes per sector */ + u_int8_t bpbSecPerClust; /* [-c] sectors per cluster */ + u_int16_t bpbResSectors; /* [-r] reserved sectors */ + u_int8_t bpbFATs; /* [-n] number of FATs */ + u_int16_t bpbRootDirEnts; /* [-e] root directory entries */ + u_int16_t bpbSectors; /* [-s] total sectors */ + u_int8_t bpbMedia; /* [-m] media descriptor */ + u_int16_t bpbFATsecs; /* [-a] sectors per FAT */ + u_int16_t bpbSecPerTrack; /* [-u] sectors per track */ + u_int16_t bpbHeads; /* [-h] drive heads */ + u_int32_t bpbHiddenSecs; /* [-o] hidden sectors */ + u_int32_t bpbHugeSectors; /* [-s] big total sectors */ }; /* FAT32 extensions */ struct bsxbpb { - u_int32_t bspf; /* [-a] big sectors per FAT */ - u_int16_t xflg; /* control flags */ - u_int16_t vers; /* file system version */ - u_int32_t rdcl; /* root directory start cluster */ - u_int16_t infs; /* [-i] file system info sector */ - u_int16_t bkbs; /* [-k] backup boot sector */ + u_int32_t bpbBigFATsecs; /* [-a] big sectors per FAT */ + u_int16_t bpbExtFlags; /* control flags */ + u_int16_t bpbFSVers; /* file system version */ + u_int32_t bpbRootClust; /* root directory start cluster */ + u_int16_t bpbFSInfo; /* [-i] file system info sector */ + u_int16_t bpbBackup; /* [-k] backup boot sector */ }; .Ed .Sh LIMITATION Modified: stable/8/sbin/newfs_msdos/newfs_msdos.c ============================================================================== --- stable/8/sbin/newfs_msdos/newfs_msdos.c Fri Feb 3 23:32:22 2012 (r230969) +++ stable/8/sbin/newfs_msdos/newfs_msdos.c Fri Feb 3 23:35:39 2012 (r230970) @@ -66,7 +66,7 @@ static const char rcsid[] = #define MINCLS12 1U /* minimum FAT12 clusters */ #define MINCLS16 0x1000U /* minimum FAT16 clusters */ #define MINCLS32 2U /* minimum FAT32 clusters */ -#define MAXCLS12 0xfedU /* maximum FAT12 clusters */ +#define MAXCLS12 0xfedU /* maximum FAT12 clusters */ #define MAXCLS16 0xfff5U /* maximum FAT16 clusters */ #define MAXCLS32 0xffffff5U /* maximum FAT32 clusters */ @@ -97,7 +97,7 @@ static const char rcsid[] = #define argtox(arg, lo, msg) argtou(arg, lo, UINT_MAX, msg) struct bs { - u_int8_t bsJump[3]; /* bootstrap entry point */ + u_int8_t bsJump[3]; /* bootstrap entry point */ u_int8_t bsOemName[8]; /* OEM name and version */ }; @@ -123,7 +123,7 @@ struct bsxbpb { u_int8_t bpbRootClust[4]; /* root directory start cluster */ u_int8_t bpbFSInfo[2]; /* file system info sector */ u_int8_t bpbBackup[2]; /* backup boot sector */ - u_int8_t bpbReserved[12]; /* reserved */ + u_int8_t bpbReserved[12]; /* reserved */ }; struct bsx { @@ -136,13 +136,13 @@ struct bsx { }; struct de { - u_int8_t deName[11]; /* name and extension */ - u_int8_t deAttributes; /* attributes */ - u_int8_t rsvd[10]; /* reserved */ - u_int8_t deMTime[2]; /* creation time */ - u_int8_t deMDate[2]; /* creation date */ - u_int8_t deStartCluster[2]; /* starting cluster */ - u_int8_t deFileSize[4]; /* size */ + u_int8_t deName[11]; /* name and extension */ + u_int8_t deAttributes; /* attributes */ + u_int8_t rsvd[10]; /* reserved */ + u_int8_t deMTime[2]; /* creation time */ + u_int8_t deMDate[2]; /* creation date */ + u_int8_t deStartCluster[2]; /* starting cluster */ + u_int8_t deFileSize[4]; /* size */ }; struct bpb { @@ -160,29 +160,26 @@ struct bpb { u_int bpbHugeSectors; /* big total sectors */ u_int bpbBigFATsecs; /* big sectors per FAT */ u_int bpbRootClust; /* root directory start cluster */ - u_int bpbFSInfo; /* file system info sector */ - u_int bpbBackup; /* backup boot sector */ + u_int bpbFSInfo; /* file system info sector */ + u_int bpbBackup; /* backup boot sector */ }; #define BPBGAP 0, 0, 0, 0, 0, 0 -#define INIT(a, b, c, d, e, f, g, h, i, j) \ - { .bpbBytesPerSec = a, .bpbSecPerClust = b, .bpbResSectors = c, .bpbFATs = d, .bpbRootDirEnts = e, \ - .bpbSectors = f, .bpbMedia = g, .bpbFATsecs = h, .bpbSecPerTrack = i, .bpbHeads = j, } static struct { const char *name; struct bpb bpb; } const stdfmt[] = { - {"160", INIT(512, 1, 1, 2, 64, 320, 0xfe, 1, 8, 1)}, - {"180", INIT(512, 1, 1, 2, 64, 360, 0xfc, 2, 9, 1)}, - {"320", INIT(512, 2, 1, 2, 112, 640, 0xff, 1, 8, 2)}, - {"360", INIT(512, 2, 1, 2, 112, 720, 0xfd, 2, 9, 2)}, - {"640", INIT(512, 2, 1, 2, 112, 1280, 0xfb, 2, 8, 2)}, - {"720", INIT(512, 2, 1, 2, 112, 1440, 0xf9, 3, 9, 2)}, - {"1200", INIT(512, 1, 1, 2, 224, 2400, 0xf9, 7, 15, 2)}, - {"1232", INIT(1024,1, 1, 2, 192, 1232, 0xfe, 2, 8, 2)}, - {"1440", INIT(512, 1, 1, 2, 224, 2880, 0xf0, 9, 18, 2)}, - {"2880", INIT(512, 2, 1, 2, 240, 5760, 0xf0, 9, 36, 2)} + {"160", {512, 1, 1, 2, 64, 320, 0xfe, 1, 8, 1, BPBGAP}}, + {"180", {512, 1, 1, 2, 64, 360, 0xfc, 2, 9, 1, BPBGAP}}, + {"320", {512, 2, 1, 2, 112, 640, 0xff, 1, 8, 2, BPBGAP}}, + {"360", {512, 2, 1, 2, 112, 720, 0xfd, 2, 9, 2, BPBGAP}}, + {"640", {512, 2, 1, 2, 112, 1280, 0xfb, 2, 8, 2, BPBGAP}}, + {"720", {512, 2, 1, 2, 112, 1440, 0xf9, 3, 9, 2, BPBGAP}}, + {"1200", {512, 1, 1, 2, 224, 2400, 0xf9, 7, 15, 2, BPBGAP}}, + {"1232", {1024,1, 1, 2, 192, 1232, 0xfe, 2, 8, 2, BPBGAP}}, + {"1440", {512, 1, 1, 2, 224, 2880, 0xf0, 9, 18, 2, BPBGAP}}, + {"2880", {512, 2, 1, 2, 240, 5760, 0xf0, 9, 36, 2, BPBGAP}} }; static const u_int8_t bootcode[] = { @@ -494,7 +491,8 @@ main(int argc, char *argv[]) if ((fd1 = open(bname, O_RDONLY)) == -1 || fstat(fd1, &sb)) err(1, "%s", bname); if (!S_ISREG(sb.st_mode) || sb.st_size % bpb.bpbBytesPerSec || - sb.st_size < bpb.bpbBytesPerSec || sb.st_size > bpb.bpbBytesPerSec * MAXU16) + sb.st_size < bpb.bpbBytesPerSec || + sb.st_size > bpb.bpbBytesPerSec * MAXU16) errx(1, "%s: inappropriate file type or format", bname); bss = sb.st_size / bpb.bpbBytesPerSec; } @@ -503,19 +501,23 @@ main(int argc, char *argv[]) if (!fat) { if (bpb.bpbHugeSectors < (bpb.bpbResSectors ? bpb.bpbResSectors : bss) + howmany((RESFTE + (bpb.bpbSecPerClust ? MINCLS16 : MAXCLS12 + 1)) * - ((bpb.bpbSecPerClust ? 16 : 12) / BPN), bpb.bpbBytesPerSec * NPB) * + (bpb.bpbSecPerClust ? 16 : 12) / BPN, + bpb.bpbBytesPerSec * NPB) * bpb.bpbFATs + howmany(bpb.bpbRootDirEnts ? bpb.bpbRootDirEnts : DEFRDE, bpb.bpbBytesPerSec / sizeof(struct de)) + (bpb.bpbSecPerClust ? MINCLS16 : MAXCLS12 + 1) * - (bpb.bpbSecPerClust ? bpb.bpbSecPerClust : howmany(DEFBLK, bpb.bpbBytesPerSec))) + (bpb.bpbSecPerClust ? bpb.bpbSecPerClust : + howmany(DEFBLK, bpb.bpbBytesPerSec))) fat = 12; else if (bpb.bpbRootDirEnts || bpb.bpbHugeSectors < (bpb.bpbResSectors ? bpb.bpbResSectors : bss) + - howmany((RESFTE + MAXCLS16) * 2, bpb.bpbBytesPerSec) * bpb.bpbFATs + + howmany((RESFTE + MAXCLS16) * 2, bpb.bpbBytesPerSec) * + bpb.bpbFATs + howmany(DEFRDE, bpb.bpbBytesPerSec / sizeof(struct de)) + (MAXCLS16 + 1) * - (bpb.bpbSecPerClust ? bpb.bpbSecPerClust : howmany(8192, bpb.bpbBytesPerSec))) + (bpb.bpbSecPerClust ? bpb.bpbSecPerClust : + howmany(8192, bpb.bpbBytesPerSec))) fat = 16; else fat = 32; @@ -539,21 +541,27 @@ main(int argc, char *argv[]) x = bpb.bpbBackup + 1; } if (!bpb.bpbResSectors) - bpb.bpbResSectors = fat == 32 ? MAX(x, MAX(16384 / bpb.bpbBytesPerSec, 4)) : x; + bpb.bpbResSectors = fat == 32 ? + MAX(x, MAX(16384 / bpb.bpbBytesPerSec, 4)) : x; else if (bpb.bpbResSectors < x) - errx(1, "too few reserved sectors (need %d have %d)", x, bpb.bpbResSectors); + errx(1, "too few reserved sectors (need %d have %d)", x, + bpb.bpbResSectors); if (fat != 32 && !bpb.bpbRootDirEnts) bpb.bpbRootDirEnts = DEFRDE; rds = howmany(bpb.bpbRootDirEnts, bpb.bpbBytesPerSec / sizeof(struct de)); if (!bpb.bpbSecPerClust) - for (bpb.bpbSecPerClust = howmany(fat == 16 ? DEFBLK16 : DEFBLK, bpb.bpbBytesPerSec); + for (bpb.bpbSecPerClust = howmany(fat == 16 ? DEFBLK16 : + DEFBLK, bpb.bpbBytesPerSec); bpb.bpbSecPerClust < MAXSPC && bpb.bpbResSectors + howmany((RESFTE + maxcls(fat)) * (fat / BPN), - bpb.bpbBytesPerSec * NPB) * bpb.bpbFATs + + bpb.bpbBytesPerSec * NPB) * + bpb.bpbFATs + rds + - (u_int64_t)(maxcls(fat) + 1) * bpb.bpbSecPerClust <= bpb.bpbHugeSectors; - bpb.bpbSecPerClust <<= 1); + (u_int64_t) (maxcls(fat) + 1) * + bpb.bpbSecPerClust <= bpb.bpbHugeSectors; + bpb.bpbSecPerClust <<= 1) + continue; if (fat != 32 && bpb.bpbBigFATsecs > MAXU16) errx(1, "too many sectors/FAT for FAT12/16"); x1 = bpb.bpbResSectors + rds; @@ -562,7 +570,8 @@ main(int argc, char *argv[]) errx(1, "meta data exceeds file system size"); x1 += x * bpb.bpbFATs; x = (u_int64_t)(bpb.bpbHugeSectors - x1) * bpb.bpbBytesPerSec * NPB / - (bpb.bpbSecPerClust * bpb.bpbBytesPerSec * NPB + fat / BPN * bpb.bpbFATs); + (bpb.bpbSecPerClust * bpb.bpbBytesPerSec * NPB + fat / + BPN * bpb.bpbFATs); x2 = howmany((RESFTE + MIN(x, maxcls(fat))) * (fat / BPN), bpb.bpbBytesPerSec * NPB); if (!bpb.bpbBigFATsecs) { @@ -570,7 +579,8 @@ main(int argc, char *argv[]) x1 += (bpb.bpbBigFATsecs - 1) * bpb.bpbFATs; } cls = (bpb.bpbHugeSectors - x1) / bpb.bpbSecPerClust; - x = (u_int64_t)bpb.bpbBigFATsecs * bpb.bpbBytesPerSec * NPB / (fat / BPN) - RESFTE; + x = (u_int64_t)bpb.bpbBigFATsecs * bpb.bpbBytesPerSec * NPB / (fat / BPN) - + RESFTE; if (cls > x) cls = x; if (bpb.bpbBigFATsecs < x2) @@ -608,7 +618,8 @@ main(int argc, char *argv[]) tm = localtime(&now); if (!(img = malloc(bpb.bpbBytesPerSec))) err(1, NULL); - dir = bpb.bpbResSectors + (bpb.bpbFATsecs ? bpb.bpbFATsecs : bpb.bpbBigFATsecs) * bpb.bpbFATs; + dir = bpb.bpbResSectors + (bpb.bpbFATsecs ? bpb.bpbFATsecs : + bpb.bpbBigFATsecs) * bpb.bpbFATs; memset(&si_sa, 0, sizeof(si_sa)); si_sa.sa_handler = infohandler; if (sigaction(SIGINFO, &si_sa, NULL) == -1) @@ -638,7 +649,8 @@ main(int argc, char *argv[]) } else memset(img, 0, bpb.bpbBytesPerSec); if (!lsn || - (fat == 32 && bpb.bpbBackup != MAXU16 && lsn == bpb.bpbBackup)) { + (fat == 32 && bpb.bpbBackup != MAXU16 && + lsn == bpb.bpbBackup)) { x1 = sizeof(struct bs); bsbpb = (struct bsbpb *)(img + x1); mk2(bsbpb->bpbBytesPerSec, bpb.bpbBytesPerSec); @@ -702,7 +714,8 @@ main(int argc, char *argv[]) mk2(img + MINBPS - 2, DOSMAGIC); } else if (lsn >= bpb.bpbResSectors && lsn < dir && !((lsn - bpb.bpbResSectors) % - (bpb.bpbFATsecs ? bpb.bpbFATsecs : bpb.bpbBigFATsecs))) { + (bpb.bpbFATsecs ? bpb.bpbFATsecs : + bpb.bpbBigFATsecs))) { mk1(img[0], bpb.bpbMedia); for (x = 1; x < fat * (fat == 32 ? 3 : 2) / 8; x++) mk1(img[x], fat == 32 && x % 4 == 3 ? 0x0f : 0xff); @@ -817,16 +830,19 @@ getdiskinfo(int fd, const char *fname, c if (bpb->bpbBytesPerSec) dlp.d_secsize = bpb->bpbBytesPerSec; if (ioctl(fd, DIOCGDINFO, &dlp) == -1) { - if (bpb->bpbBytesPerSec == 0 && ioctl(fd, DIOCGSECTORSIZE, &dlp.d_secsize) == -1) + if (bpb->bpbBytesPerSec == 0 && ioctl(fd, DIOCGSECTORSIZE, + &dlp.d_secsize) == -1) errx(1, "Cannot get sector size, %s", strerror(errno)); dlp.d_secperunit = ms / dlp.d_secsize; - if (bpb->bpbSecPerTrack == 0 && ioctl(fd, DIOCGFWSECTORS, &dlp.d_nsectors) == -1) { + if (bpb->bpbSecPerTrack == 0 && ioctl(fd, DIOCGFWSECTORS, + &dlp.d_nsectors) == -1) { warnx("Cannot get number of sectors per track, %s", strerror(errno)); dlp.d_nsectors = 63; } - if (bpb->bpbHeads == 0 && ioctl(fd, DIOCGFWHEADS, &dlp.d_ntracks) == -1) { + if (bpb->bpbHeads == 0 && + ioctl(fd, DIOCGFWHEADS, &dlp.d_ntracks) == -1) { warnx("Cannot get number of heads, %s", strerror(errno)); if (dlp.d_secperunit <= 63*1*1024) dlp.d_ntracks = 1; @@ -859,7 +875,8 @@ getdiskinfo(int fd, const char *fname, c static void print_bpb(struct bpb *bpb) { - printf("BytesPerSec=%u SecPerClust=%u ResSectors=%u FATs=%u", bpb->bpbBytesPerSec, bpb->bpbSecPerClust, bpb->bpbResSectors, + printf("BytesPerSec=%u SecPerClust=%u ResSectors=%u FATs=%u", + bpb->bpbBytesPerSec, bpb->bpbSecPerClust, bpb->bpbResSectors, bpb->bpbFATs); if (bpb->bpbRootDirEnts) printf(" RootDirEnts=%u", bpb->bpbRootDirEnts); @@ -868,11 +885,13 @@ print_bpb(struct bpb *bpb) printf(" Media=%#x", bpb->bpbMedia); if (bpb->bpbFATsecs) printf(" FATsecs=%u", bpb->bpbFATsecs); - printf(" SecPerTrack=%u Heads=%u HiddenSecs=%u", bpb->bpbSecPerTrack, bpb->bpbHeads, bpb->bpbHiddenSecs); + printf(" SecPerTrack=%u Heads=%u HiddenSecs=%u", bpb->bpbSecPerTrack, + bpb->bpbHeads, bpb->bpbHiddenSecs); if (bpb->bpbHugeSectors) printf(" HugeSectors=%u", bpb->bpbHugeSectors); if (!bpb->bpbFATsecs) { - printf(" FATsecs=%u RootCluster=%u", bpb->bpbBigFATsecs, bpb->bpbRootClust); + printf(" FATsecs=%u RootCluster=%u", bpb->bpbBigFATsecs, + bpb->bpbRootClust); printf(" FSInfo="); printf(bpb->bpbFSInfo == MAXU16 ? "%#x" : "%u", bpb->bpbFSInfo); printf(" Backup="); @@ -919,6 +938,7 @@ argtooff(const char *arg, const char *ms char *s; off_t x; + errno = 0; x = strtoll(arg, &s, 0); /* allow at most one extra char */ if (errno || x < 0 || (s[0] && s[1]) ) @@ -929,30 +949,30 @@ argtooff(const char *arg, const char *ms errx(1, "%s: bad %s", arg, msg); /* notreached */ - case 's': /* sector */ + case 's': /* sector */ case 'S': - x <<= 9; /* times 512 */ + x <<= 9; /* times 512 */ break; - case 'k': /* kilobyte */ + case 'k': /* kilobyte */ case 'K': - x <<= 10; /* times 1024 */ + x <<= 10; /* times 1024 */ break; - case 'm': /* megabyte */ + case 'm': /* megabyte */ case 'M': - x <<= 20; /* times 1024*1024 */ + x <<= 20; /* times 1024*1024 */ break; - case 'g': /* gigabyte */ + case 'g': /* gigabyte */ case 'G': - x <<= 30; /* times 1024*1024*1024 */ + x <<= 30; /* times 1024*1024*1024 */ break; - case 'p': /* partition start */ - case 'P': /* partition start */ - case 'l': /* partition length */ - case 'L': /* partition length */ + case 'p': /* partition start */ + case 'P': + case 'l': /* partition length */ + case 'L': errx(1, "%s: not supported yet %s", arg, msg); /* notreached */ } From owner-svn-src-stable@FreeBSD.ORG Fri Feb 3 23:36:09 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 625431065678; Fri, 3 Feb 2012 23:36:09 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 50EFF8FC17; Fri, 3 Feb 2012 23:36:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q13Na9dI009698; Fri, 3 Feb 2012 23:36:09 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q13Na9mY009696; Fri, 3 Feb 2012 23:36:09 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202032336.q13Na9mY009696@svn.freebsd.org> From: Dimitry Andric Date: Fri, 3 Feb 2012 23:36:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230971 - stable/9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2012 23:36:09 -0000 Author: dim Date: Fri Feb 3 23:36:08 2012 New Revision: 230971 URL: http://svn.freebsd.org/changeset/base/230971 Log: MFC r230622: When the buildkernel stage 2.3 (build tools) runs, the PATH is still set to the default from the top-level Makefile. Therefore, invocations of lex and yacc (used during building of aicasm) will use the executables in /usr/bin, not those optionally built during the previous buildworld or kernel-toolchain. This makes kernel builds from older FreeBSD releases more difficult than necessary. Fix this by setting PATH to ${BPATH}:${PATH} in stage 2.3, so the bootstrap tools directories are searched before the regular ones. Silence from: svn-src-{all,head} Modified: stable/9/Makefile.inc1 (contents, props changed) Modified: stable/9/Makefile.inc1 ============================================================================== --- stable/9/Makefile.inc1 Fri Feb 3 23:35:39 2012 (r230970) +++ stable/9/Makefile.inc1 Fri Feb 3 23:36:08 2012 (r230971) @@ -830,6 +830,7 @@ buildkernel: @echo ">>> stage 2.3: build tools" @echo "--------------------------------------------------------------" cd ${KRNLOBJDIR}/${_kernel}; \ + PATH=${BPATH}:${PATH} \ MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \ -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile @@ -837,6 +838,7 @@ buildkernel: .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) .for target in obj depend all cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ + PATH=${BPATH}:${PATH} \ MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target} .endfor From owner-svn-src-stable@FreeBSD.ORG Sat Feb 4 04:31:29 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60F42106566B; Sat, 4 Feb 2012 04:31:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E47E8FC13; Sat, 4 Feb 2012 04:31:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q144VT65019187; Sat, 4 Feb 2012 04:31:29 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q144VTcm019185; Sat, 4 Feb 2012 04:31:29 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201202040431.q144VTcm019185@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sat, 4 Feb 2012 04:31:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230975 - stable/9/lib/libvgl X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Feb 2012 04:31:29 -0000 Author: pfg Date: Sat Feb 4 04:31:28 2012 New Revision: 230975 URL: http://svn.freebsd.org/changeset/base/230975 Log: MFC: r229415, r229516 Integrate the line drawing algorithm from the book "Graphic Gems 1". http://www.graphicsgems.org/ At the time it claimed to be 3-4 times faster than the traditional algorithm. Make sure this doesn't give problems to clang. PR: 18769 Approved by: jhb (mentor) Modified: stable/9/lib/libvgl/simple.c Directory Properties: stable/9/lib/libvgl/ (props changed) Modified: stable/9/lib/libvgl/simple.c ============================================================================== --- stable/9/lib/libvgl/simple.c Sat Feb 4 03:08:23 2012 (r230974) +++ stable/9/lib/libvgl/simple.c Sat Feb 4 04:31:28 2012 (r230975) @@ -198,36 +198,205 @@ get_planar: return 0; /* XXX black? */ } + /* + * Symmetric Double Step Line Algorithm by Brian Wyvill from + * "Graphics Gems", Academic Press, 1990. + */ + +#define SL_SWAP(a,b) {a^=b; b^=a; a^=b;} +#define SL_ABSOLUTE(i,j,k) ( (i-j)*(k = ( (i-j)<0 ? -1 : 1))) + +void +plot(VGLBitmap * object, int x, int y, int flag, byte color) +{ + /* non-zero flag indicates the pixels need swapping back. */ + if (flag) + VGLSetXY(object, y, x, color); + else + VGLSetXY(object, x, y, color); +} + + void VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color) { - int d, x, y, ax, ay, sx, sy, dx, dy; + int dx, dy, incr1, incr2, D, x, y, xend, c, pixels_left; + int sign_x, sign_y, step, reverse, i; - dx = x2-x1; ax = ABS(dx)<<1; sx = SGN(dx); x = x1; - dy = y2-y1; ay = ABS(dy)<<1; sy = SGN(dy); y = y1; + dx = SL_ABSOLUTE(x2, x1, sign_x); + dy = SL_ABSOLUTE(y2, y1, sign_y); + /* decide increment sign by the slope sign */ + if (sign_x == sign_y) + step = 1; + else + step = -1; + + if (dy > dx) { /* chooses axis of greatest movement (make dx) */ + SL_SWAP(x1, y1); + SL_SWAP(x2, y2); + SL_SWAP(dx, dy); + reverse = 1; + } else + reverse = 0; + /* note error check for dx==0 should be included here */ + if (x1 > x2) { /* start from the smaller coordinate */ + x = x2; + y = y2; +/* x1 = x1; + y1 = y1; */ + } else { + x = x1; + y = y1; + x1 = x2; + y1 = y2; + } + + + /* Note dx=n implies 0 - n or (dx+1) pixels to be set */ + /* Go round loop dx/4 times then plot last 0,1,2 or 3 pixels */ + /* In fact (dx-1)/4 as 2 pixels are already plotted */ + xend = (dx - 1) / 4; + pixels_left = (dx - 1) % 4; /* number of pixels left over at the + * end */ + plot(object, x, y, reverse, color); + if (pixels_left < 0) + return; /* plot only one pixel for zero length + * vectors */ + plot(object, x1, y1, reverse, color); /* plot first two points */ + incr2 = 4 * dy - 2 * dx; + if (incr2 < 0) { /* slope less than 1/2 */ + c = 2 * dy; + incr1 = 2 * c; + D = incr1 - dx; + + for (i = 0; i < xend; i++) { /* plotting loop */ + ++x; + --x1; + if (D < 0) { + /* pattern 1 forwards */ + plot(object, x, y, reverse, color); + plot(object, ++x, y, reverse, color); + /* pattern 1 backwards */ + plot(object, x1, y1, reverse, color); + plot(object, --x1, y1, reverse, color); + D += incr1; + } else { + if (D < c) { + /* pattern 2 forwards */ + plot(object, x, y, reverse, color); + plot(object, ++x, y += step, reverse, + color); + /* pattern 2 backwards */ + plot(object, x1, y1, reverse, color); + plot(object, --x1, y1 -= step, reverse, + color); + } else { + /* pattern 3 forwards */ + plot(object, x, y += step, reverse, color); + plot(object, ++x, y, reverse, color); + /* pattern 3 backwards */ + plot(object, x1, y1 -= step, reverse, + color); + plot(object, --x1, y1, reverse, color); + } + D += incr2; + } + } /* end for */ - if (ax>ay) { /* x dominant */ - d = ay-(ax>>1); - for (;;) { - VGLSetXY(object, x, y, color); - if (x==x2) - break; - if (d>=0) { - y += sy; d -= ax; + /* plot last pattern */ + if (pixels_left) { + if (D < 0) { + plot(object, ++x, y, reverse, color); /* pattern 1 */ + if (pixels_left > 1) + plot(object, ++x, y, reverse, color); + if (pixels_left > 2) + plot(object, --x1, y1, reverse, color); + } else { + if (D < c) { + plot(object, ++x, y, reverse, color); /* pattern 2 */ + if (pixels_left > 1) + plot(object, ++x, y += step, reverse, color); + if (pixels_left > 2) + plot(object, --x1, y1, reverse, color); + } else { + /* pattern 3 */ + plot(object, ++x, y += step, reverse, color); + if (pixels_left > 1) + plot(object, ++x, y, reverse, color); + if (pixels_left > 2) + plot(object, --x1, y1 -= step, reverse, color); + } } - x += sx; d += ay; - } + } /* end if pixels_left */ } - else { /* y dominant */ - d = ax-(ay>>1); - for (;;) { - VGLSetXY(object, x, y, color); - if (y==y2) - break; - if (d>=0) { - x += sx; d -= ay; + /* end slope < 1/2 */ + else { /* slope greater than 1/2 */ + c = 2 * (dy - dx); + incr1 = 2 * c; + D = incr1 + dx; + for (i = 0; i < xend; i++) { + ++x; + --x1; + if (D > 0) { + /* pattern 4 forwards */ + plot(object, x, y += step, reverse, color); + plot(object, ++x, y += step, reverse, color); + /* pattern 4 backwards */ + plot(object, x1, y1 -= step, reverse, color); + plot(object, --x1, y1 -= step, reverse, color); + D += incr1; + } else { + if (D < c) { + /* pattern 2 forwards */ + plot(object, x, y, reverse, color); + plot(object, ++x, y += step, reverse, + color); + + /* pattern 2 backwards */ + plot(object, x1, y1, reverse, color); + plot(object, --x1, y1 -= step, reverse, + color); + } else { + /* pattern 3 forwards */ + plot(object, x, y += step, reverse, color); + plot(object, ++x, y, reverse, color); + /* pattern 3 backwards */ + plot(object, x1, y1 -= step, reverse, color); + plot(object, --x1, y1, reverse, color); + } + D += incr2; + } + } /* end for */ + /* plot last pattern */ + if (pixels_left) { + if (D > 0) { + plot(object, ++x, y += step, reverse, color); /* pattern 4 */ + if (pixels_left > 1) + plot(object, ++x, y += step, reverse, + color); + if (pixels_left > 2) + plot(object, --x1, y1 -= step, reverse, + color); + } else { + if (D < c) { + plot(object, ++x, y, reverse, color); /* pattern 2 */ + if (pixels_left > 1) + plot(object, ++x, y += step, reverse, color); + if (pixels_left > 2) + plot(object, --x1, y1, reverse, color); + } else { + /* pattern 3 */ + plot(object, ++x, y += step, reverse, color); + if (pixels_left > 1) + plot(object, ++x, y, reverse, color); + if (pixels_left > 2) { + if (D > c) /* step 3 */ + plot(object, --x1, y1 -= step, reverse, color); + else /* step 2 */ + plot(object, --x1, y1, reverse, color); + } + } } - y += sy; d += ax; } } } From owner-svn-src-stable@FreeBSD.ORG Sat Feb 4 15:42:08 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B2201065672; Sat, 4 Feb 2012 15:42:08 +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 055278FC14; Sat, 4 Feb 2012 15:42:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q14Fg78O041375; Sat, 4 Feb 2012 15:42:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q14Fg7gh041373; Sat, 4 Feb 2012 15:42:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201202041542.q14Fg7gh041373@svn.freebsd.org> From: Alexander Motin Date: Sat, 4 Feb 2012 15:42:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230982 - stable/9/usr.sbin/mixer X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Feb 2012 15:42:08 -0000 Author: mav Date: Sat Feb 4 15:42:07 2012 New Revision: 230982 URL: http://svn.freebsd.org/changeset/base/230982 Log: MFC r230611: Return proper error message if recording device is not specified. Modified: stable/9/usr.sbin/mixer/mixer.c Directory Properties: stable/9/usr.sbin/mixer/ (props changed) Modified: stable/9/usr.sbin/mixer/mixer.c ============================================================================== --- stable/9/usr.sbin/mixer/mixer.c Sat Feb 4 15:00:26 2012 (r230981) +++ stable/9/usr.sbin/mixer/mixer.c Sat Feb 4 15:42:07 2012 (r230982) @@ -193,13 +193,18 @@ main(int argc, char *argv[]) argc--; argv++; continue; - } else if (argc > 1 && strcmp("rec", *argv + 1) == 0) { + } else if (strcmp("rec", *argv + 1) == 0) { if (**argv != '+' && **argv != '-' && **argv != '=' && **argv != '^') { warnx("unknown modifier: %c", **argv); dusage = 1; break; } + if (argc <= 1) { + warnx("no recording device specified"); + dusage = 1; + break; + } if ((dev = res_name(argv[1], recmask)) == -1) { warnx("unknown recording device: %s", argv[1]); dusage = 1; From owner-svn-src-stable@FreeBSD.ORG Sat Feb 4 15:43:16 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1270106564A; Sat, 4 Feb 2012 15:43:16 +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 8BEB38FC1D; Sat, 4 Feb 2012 15:43:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q14FhGQ6041465; Sat, 4 Feb 2012 15:43:16 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q14FhG8n041463; Sat, 4 Feb 2012 15:43:16 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201202041543.q14FhG8n041463@svn.freebsd.org> From: Alexander Motin Date: Sat, 4 Feb 2012 15:43:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230983 - stable/8/usr.sbin/mixer X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Feb 2012 15:43:16 -0000 Author: mav Date: Sat Feb 4 15:43:16 2012 New Revision: 230983 URL: http://svn.freebsd.org/changeset/base/230983 Log: MFC r230611: Return proper error message if recording device is not specified. Modified: stable/8/usr.sbin/mixer/mixer.c Directory Properties: stable/8/usr.sbin/mixer/ (props changed) Modified: stable/8/usr.sbin/mixer/mixer.c ============================================================================== --- stable/8/usr.sbin/mixer/mixer.c Sat Feb 4 15:42:07 2012 (r230982) +++ stable/8/usr.sbin/mixer/mixer.c Sat Feb 4 15:43:16 2012 (r230983) @@ -193,13 +193,18 @@ main(int argc, char *argv[]) argc--; argv++; continue; - } else if (argc > 1 && strcmp("rec", *argv + 1) == 0) { + } else if (strcmp("rec", *argv + 1) == 0) { if (**argv != '+' && **argv != '-' && **argv != '=' && **argv != '^') { warnx("unknown modifier: %c", **argv); dusage = 1; break; } + if (argc <= 1) { + warnx("no recording device specified"); + dusage = 1; + break; + } if ((dev = res_name(argv[1], recmask)) == -1) { warnx("unknown recording device: %s", argv[1]); dusage = 1; From owner-svn-src-stable@FreeBSD.ORG Sat Feb 4 17:13:35 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88ABE1065780; Sat, 4 Feb 2012 17:13:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E25C8FC17; Sat, 4 Feb 2012 17:13:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q14HDZMo044357; Sat, 4 Feb 2012 17:13:35 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q14HDYbA044352; Sat, 4 Feb 2012 17:13:34 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201202041713.q14HDYbA044352@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sat, 4 Feb 2012 17:13:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230985 - in stable/9/sys: conf dev/sound/pci gnu/dev/sound/pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Feb 2012 17:13:35 -0000 Author: pfg Date: Sat Feb 4 17:13:34 2012 New Revision: 230985 URL: http://svn.freebsd.org/changeset/base/230985 Log: MFC: r230401, r230898 Replace GPLd headers from the Maestro3 driver with BSD licensed versions derived from /usr/ports/audio/oss. The particular headers used were taken from the attic/drv/oss_allegro directory and are mostly identical to the previous files. The Maestro3 driver is now free from the GPL. NOTE: due to lack of testers this driver is being considered for deprecation and removal, however the MFC still makes sense instead of distribution a GPL'd firmware without source code. PR: kern/153920 Approved by: jhb (mentor) Added: stable/9/sys/dev/sound/pci/allegro_code.h - copied unchanged from r230401, head/sys/dev/sound/pci/allegro_code.h stable/9/sys/dev/sound/pci/allegro_reg.h - copied unchanged from r230401, head/sys/dev/sound/pci/allegro_reg.h Deleted: stable/9/sys/gnu/dev/sound/pci/maestro3_dsp.h stable/9/sys/gnu/dev/sound/pci/maestro3_reg.h Modified: stable/9/sys/conf/files stable/9/sys/dev/sound/pci/maestro3.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/modules/sound/driver/maestro3/ (props changed) Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Sat Feb 4 16:49:29 2012 (r230984) +++ stable/9/sys/conf/files Sat Feb 4 17:13:34 2012 (r230985) @@ -1722,8 +1722,7 @@ dev/sound/pci/es137x.c optional snd_es1 dev/sound/pci/fm801.c optional snd_fm801 pci dev/sound/pci/ich.c optional snd_ich pci dev/sound/pci/maestro.c optional snd_maestro pci -dev/sound/pci/maestro3.c optional snd_maestro3 pci \ - warning "kernel contains GPL contaminated maestro3 headers" +dev/sound/pci/maestro3.c optional snd_maestro3 pci dev/sound/pci/neomagic.c optional snd_neomagic pci dev/sound/pci/solo.c optional snd_solo pci dev/sound/pci/spicds.c optional snd_spicds pci Copied: stable/9/sys/dev/sound/pci/allegro_code.h (from r230401, head/sys/dev/sound/pci/allegro_code.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/sound/pci/allegro_code.h Sat Feb 4 17:13:34 2012 (r230985, copy of r230401, head/sys/dev/sound/pci/allegro_code.h) @@ -0,0 +1,218 @@ +/* $FreeBSD$ */ +/*- + * Copyright (C) 1996-2008, 4Front Technologies + * Copyright (C) 1997-1999 ESS Technology, Inc + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +/*--------------------------------------------------------------------------- + * This source code, its compiled object code, and its associated data sets + * are copyright (C) 1997-1999 ESS Technology, Inc. This source code and its + * associated data sets are trade secrets of ESS Technology, Inc. + *--------------------------------------------------------------------------- + * DESCRIPTION: DSP binaries + *--------------------------------------------------------------------------- + * AUTHOR: Henry Tang / Hong Kim / Alger Yeung/Don Kim + *--------------------------------------------------------------------------- + * For practical purposes we only include what is necessary for current + * Maestro3 driver. Files used in this header include: + * kernel.dat + * 400m_src.dat + * mini_src_lpf from srcmgr.h + *--------------------------------------------------------------------------- + */ +#ifndef _DEV_SOUND_PCI_ALLEGRO_CODE_H +#define _DEV_SOUND_PCI_ALLEGRO_CODE_H + +/* + * Kernel + */ + +uint16_t gaw_kernel_vect_code[] = { + 0x7980, 0x0030, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x00FB, 0x7980, + 0x00DD, 0x7980, 0x03B4, 0x7980, 0x0332, 0x7980, 0x0287, 0x7980, 0x03B4, + 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x031A, 0x7980, + 0x03B4, 0x7980, 0x022F, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x03B4, + 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x0063, 0x7980, 0x006B, 0x7980, + 0x03B4, 0x7980, 0x03B4, 0xBF80, 0x2C7C, 0x8806, 0x8804, 0xBE40, 0xBC20, + 0xAE09, 0x1000, 0xAE0A, 0x0001, 0x6938, 0xEB08, 0x0053, 0x695A, 0xEB08, + 0x00D6, 0x0009, 0x8B88, 0x6980, 0xE388, 0x0036, 0xBE30, 0xBC20, 0x6909, + 0xB801, 0x9009, 0xBE41, 0xBE41, 0x6928, 0xEB88, 0x0078, 0xBE41, 0xBE40, + 0x7980, 0x0038, 0xBE41, 0xBE41, 0x903A, 0x6938, 0xE308, 0x0056, 0x903A, + 0xBE41, 0xBE40, 0xEF00, 0x903A, 0x6939, 0xE308, 0x005E, 0x903A, 0xEF00, + 0x690B, 0x660C, 0xEF8C, 0x690A, 0x660C, 0x620B, 0x6609, 0xEF00, 0x6910, + 0x660F, 0xEF04, 0xE388, 0x0075, 0x690E, 0x660F, 0x6210, 0x660D, 0xEF00, + 0x690E, 0x660D, 0xEF00, 0xAE70, 0x0001, 0xBC20, 0xAE27, 0x0001, 0x6939, + 0xEB08, 0x005D, 0x6926, 0xB801, 0x9026, 0x0026, 0x8B88, 0x6980, 0xE388, + 0x00CB, 0x9028, 0x0D28, 0x4211, 0xE100, 0x007A, 0x4711, 0xE100, 0x00A0, + 0x7A80, 0x0063, 0xB811, 0x660A, 0x6209, 0xE304, 0x007A, 0x0C0B, 0x4005, + 0x100A, 0xBA01, 0x9012, 0x0C12, 0x4002, 0x7980, 0x00AF, 0x7A80, 0x006B, + 0xBE02, 0x620E, 0x660D, 0xBA10, 0xE344, 0x007A, 0x0C10, 0x4005, 0x100E, + 0xBA01, 0x9012, 0x0C12, 0x4002, 0x1003, 0xBA02, 0x9012, 0x0C12, 0x4000, + 0x1003, 0xE388, 0x00BA, 0x1004, 0x7980, 0x00BC, 0x1004, 0xBA01, 0x9012, + 0x0C12, 0x4001, 0x0C05, 0x4003, 0x0C06, 0x4004, 0x1011, 0xBFB0, 0x01FF, + 0x9012, 0x0C12, 0x4006, 0xBC20, 0xEF00, 0xAE26, 0x1028, 0x6970, 0xBFD0, + 0x0001, 0x9070, 0xE388, 0x007A, 0xAE28, 0x0000, 0xEF00, 0xAE70, 0x0300, + 0x0C70, 0xB00C, 0xAE5A, 0x0000, 0xEF00, 0x7A80, 0x038A, 0x697F, 0xB801, + 0x907F, 0x0056, 0x8B88, 0x0CA0, 0xB008, 0xAF71, 0xB000, 0x4E71, 0xE200, + 0x00F3, 0xAE56, 0x1057, 0x0056, 0x0CA0, 0xB008, 0x8056, 0x7980, 0x03A1, + 0x0810, 0xBFA0, 0x1059, 0xE304, 0x03A1, 0x8056, 0x7980, 0x03A1, 0x7A80, + 0x038A, 0xBF01, 0xBE43, 0xBE59, 0x907C, 0x6937, 0xE388, 0x010D, 0xBA01, + 0xE308, 0x010C, 0xAE71, 0x0004, 0x0C71, 0x5000, 0x6936, 0x9037, 0xBF0A, + 0x109E, 0x8B8A, 0xAF80, 0x8014, 0x4C80, 0xBF0A, 0x0560, 0xF500, 0xBF0A, + 0x0520, 0xB900, 0xBB17, 0x90A0, 0x6917, 0xE388, 0x0148, 0x0D17, 0xE100, + 0x0127, 0xBF0C, 0x0578, 0xBF0D, 0x057C, 0x7980, 0x012B, 0xBF0C, 0x0538, + 0xBF0D, 0x053C, 0x6900, 0xE308, 0x0135, 0x8B8C, 0xBE59, 0xBB07, 0x90A0, + 0xBC20, 0x7980, 0x0157, 0x030C, 0x8B8B, 0xB903, 0x8809, 0xBEC6, 0x013E, + 0x69AC, 0x90AB, 0x69AD, 0x90AB, 0x0813, 0x660A, 0xE344, 0x0144, 0x0309, + 0x830C, 0xBC20, 0x7980, 0x0157, 0x6955, 0xE388, 0x0157, 0x7C38, 0xBF0B, + 0x0578, 0xF500, 0xBF0B, 0x0538, 0xB907, 0x8809, 0xBEC6, 0x0156, 0x10AB, + 0x90AA, 0x6974, 0xE388, 0x0163, 0xAE72, 0x0540, 0xF500, 0xAE72, 0x0500, + 0xAE61, 0x103B, 0x7A80, 0x02F6, 0x6978, 0xE388, 0x0182, 0x8B8C, 0xBF0C, + 0x0560, 0xE500, 0x7C40, 0x0814, 0xBA20, 0x8812, 0x733D, 0x7A80, 0x0380, + 0x733E, 0x7A80, 0x0380, 0x8B8C, 0xBF0C, 0x056C, 0xE500, 0x7C40, 0x0814, + 0xBA2C, 0x8812, 0x733F, 0x7A80, 0x0380, 0x7340, 0x7A80, 0x0380, 0x6975, + 0xE388, 0x018E, 0xAE72, 0x0548, 0xF500, 0xAE72, 0x0508, 0xAE61, 0x1041, + 0x7A80, 0x02F6, 0x6979, 0xE388, 0x01AD, 0x8B8C, 0xBF0C, 0x0560, 0xE500, + 0x7C40, 0x0814, 0xBA18, 0x8812, 0x7343, 0x7A80, 0x0380, 0x7344, 0x7A80, + 0x0380, 0x8B8C, 0xBF0C, 0x056C, 0xE500, 0x7C40, 0x0814, 0xBA24, 0x8812, + 0x7345, 0x7A80, 0x0380, 0x7346, 0x7A80, 0x0380, 0x6976, 0xE388, 0x01B9, + 0xAE72, 0x0558, 0xF500, 0xAE72, 0x0518, 0xAE61, 0x1047, 0x7A80, 0x02F6, + 0x697A, 0xE388, 0x01D8, 0x8B8C, 0xBF0C, 0x0560, 0xE500, 0x7C40, 0x0814, + 0xBA08, 0x8812, 0x7349, 0x7A80, 0x0380, 0x734A, 0x7A80, 0x0380, 0x8B8C, + 0xBF0C, 0x056C, 0xE500, 0x7C40, 0x0814, 0xBA14, 0x8812, 0x734B, 0x7A80, + 0x0380, 0x734C, 0x7A80, 0x0380, 0xBC21, 0xAE1C, 0x1090, 0x8B8A, 0xBF0A, + 0x0560, 0xE500, 0x7C40, 0x0812, 0xB804, 0x8813, 0x8B8D, 0xBF0D, 0x056C, + 0xE500, 0x7C40, 0x0815, 0xB804, 0x8811, 0x7A80, 0x034A, 0x8B8A, 0xBF0A, + 0x0560, 0xE500, 0x7C40, 0x731F, 0xB903, 0x8809, 0xBEC6, 0x01F9, 0x548A, + 0xBE03, 0x98A0, 0x7320, 0xB903, 0x8809, 0xBEC6, 0x0201, 0x548A, 0xBE03, + 0x98A0, 0x1F20, 0x2F1F, 0x9826, 0xBC20, 0x6935, 0xE388, 0x03A1, 0x6933, + 0xB801, 0x9033, 0xBFA0, 0x02EE, 0xE308, 0x03A1, 0x9033, 0xBF00, 0x6951, + 0xE388, 0x021F, 0x7334, 0xBE80, 0x5760, 0xBE03, 0x9F7E, 0xBE59, 0x9034, + 0x697E, 0x0D51, 0x9013, 0xBC20, 0x695C, 0xE388, 0x03A1, 0x735E, 0xBE80, + 0x5760, 0xBE03, 0x9F7E, 0xBE59, 0x905E, 0x697E, 0x0D5C, 0x9013, 0x7980, + 0x03A1, 0x7A80, 0x038A, 0xBF01, 0xBE43, 0x6977, 0xE388, 0x024E, 0xAE61, + 0x104D, 0x0061, 0x8B88, 0x6980, 0xE388, 0x024E, 0x9071, 0x0D71, 0x000B, + 0xAFA0, 0x8010, 0xAFA0, 0x8010, 0x0810, 0x660A, 0xE308, 0x0249, 0x0009, + 0x0810, 0x660C, 0xE388, 0x024E, 0x800B, 0xBC20, 0x697B, 0xE388, 0x03A1, + 0xBF0A, 0x109E, 0x8B8A, 0xAF80, 0x8014, 0x4C80, 0xE100, 0x0266, 0x697C, + 0xBF90, 0x0560, 0x9072, 0x0372, 0x697C, 0xBF90, 0x0564, 0x9073, 0x0473, + 0x7980, 0x0270, 0x697C, 0xBF90, 0x0520, 0x9072, 0x0372, 0x697C, 0xBF90, + 0x0524, 0x9073, 0x0473, 0x697C, 0xB801, 0x907C, 0xBF0A, 0x10FD, 0x8B8A, + 0xAF80, 0x8010, 0x734F, 0x548A, 0xBE03, 0x9880, 0xBC21, 0x7326, 0x548B, + 0xBE03, 0x618B, 0x988C, 0xBE03, 0x6180, 0x9880, 0x7980, 0x03A1, 0x7A80, + 0x038A, 0x0D28, 0x4711, 0xE100, 0x02BE, 0xAF12, 0x4006, 0x6912, 0xBFB0, + 0x0C00, 0xE388, 0x02B6, 0xBFA0, 0x0800, 0xE388, 0x02B2, 0x6912, 0xBFB0, + 0x0C00, 0xBFA0, 0x0400, 0xE388, 0x02A3, 0x6909, 0x900B, 0x7980, 0x02A5, + 0xAF0B, 0x4005, 0x6901, 0x9005, 0x6902, 0x9006, 0x4311, 0xE100, 0x02ED, + 0x6911, 0xBFC0, 0x2000, 0x9011, 0x7980, 0x02ED, 0x6909, 0x900B, 0x7980, + 0x02B8, 0xAF0B, 0x4005, 0xAF05, 0x4003, 0xAF06, 0x4004, 0x7980, 0x02ED, + 0xAF12, 0x4006, 0x6912, 0xBFB0, 0x0C00, 0xE388, 0x02E7, 0xBFA0, 0x0800, + 0xE388, 0x02E3, 0x6912, 0xBFB0, 0x0C00, 0xBFA0, 0x0400, 0xE388, 0x02D4, + 0x690D, 0x9010, 0x7980, 0x02D6, 0xAF10, 0x4005, 0x6901, 0x9005, 0x6902, + 0x9006, 0x4311, 0xE100, 0x02ED, 0x6911, 0xBFC0, 0x2000, 0x9011, 0x7980, + 0x02ED, 0x690D, 0x9010, 0x7980, 0x02E9, 0xAF10, 0x4005, 0xAF05, 0x4003, + 0xAF06, 0x4004, 0xBC20, 0x6970, 0x9071, 0x7A80, 0x0078, 0x6971, 0x9070, + 0x7980, 0x03A1, 0xBC20, 0x0361, 0x8B8B, 0x6980, 0xEF88, 0x0272, 0x0372, + 0x7804, 0x9071, 0x0D71, 0x8B8A, 0x000B, 0xB903, 0x8809, 0xBEC6, 0x0309, + 0x69A8, 0x90AB, 0x69A8, 0x90AA, 0x0810, 0x660A, 0xE344, 0x030F, 0x0009, + 0x0810, 0x660C, 0xE388, 0x0314, 0x800B, 0xBC20, 0x6961, 0xB801, 0x9061, + 0x7980, 0x02F7, 0x7A80, 0x038A, 0x5D35, 0x0001, 0x6934, 0xB801, 0x9034, + 0xBF0A, 0x109E, 0x8B8A, 0xAF80, 0x8014, 0x4880, 0xAE72, 0x0550, 0xF500, + 0xAE72, 0x0510, 0xAE61, 0x1051, 0x7A80, 0x02F6, 0x7980, 0x03A1, 0x7A80, + 0x038A, 0x5D35, 0x0002, 0x695E, 0xB801, 0x905E, 0xBF0A, 0x109E, 0x8B8A, + 0xAF80, 0x8014, 0x4780, 0xAE72, 0x0558, 0xF500, 0xAE72, 0x0518, 0xAE61, + 0x105C, 0x7A80, 0x02F6, 0x7980, 0x03A1, 0x001C, 0x8B88, 0x6980, 0xEF88, + 0x901D, 0x0D1D, 0x100F, 0x6610, 0xE38C, 0x0358, 0x690E, 0x6610, 0x620F, + 0x660D, 0xBA0F, 0xE301, 0x037A, 0x0410, 0x8B8A, 0xB903, 0x8809, 0xBEC6, + 0x036C, 0x6A8C, 0x61AA, 0x98AB, 0x6A8C, 0x61AB, 0x98AD, 0x6A8C, 0x61AD, + 0x98A9, 0x6A8C, 0x61A9, 0x98AA, 0x7C04, 0x8B8B, 0x7C04, 0x8B8D, 0x7C04, + 0x8B89, 0x7C04, 0x0814, 0x660E, 0xE308, 0x0379, 0x040D, 0x8410, 0xBC21, + 0x691C, 0xB801, 0x901C, 0x7980, 0x034A, 0xB903, 0x8809, 0x8B8A, 0xBEC6, + 0x0388, 0x54AC, 0xBE03, 0x618C, 0x98AA, 0xEF00, 0xBC20, 0xBE46, 0x0809, + 0x906B, 0x080A, 0x906C, 0x080B, 0x906D, 0x081A, 0x9062, 0x081B, 0x9063, + 0x081E, 0x9064, 0xBE59, 0x881E, 0x8065, 0x8166, 0x8267, 0x8368, 0x8469, + 0x856A, 0xEF00, 0xBC20, 0x696B, 0x8809, 0x696C, 0x880A, 0x696D, 0x880B, + 0x6962, 0x881A, 0x6963, 0x881B, 0x6964, 0x881E, 0x0065, 0x0166, 0x0267, + 0x0368, 0x0469, 0x056A, 0xBE3A, +}; + +/* + * MINI Sample Rate Conversion + */ + +uint16_t gaw_minisrc_code_0400[] = { + 0xBF80, 0x101E, 0x906E, 0x006E, 0x8B88, 0x6980, 0xEF88, 0x906F, 0x0D6F, + 0x6900, 0xEB08, 0x0412, 0xBC20, 0x696E, 0xB801, 0x906E, 0x7980, 0x0403, + 0xB90E, 0x8807, 0xBE43, 0xBF01, 0xBE47, 0xBE41, 0x7A80, 0x002A, 0xBE40, + 0x3029, 0xEFCC, 0xBE41, 0x7A80, 0x0028, 0xBE40, 0x3028, 0xEFCC, 0x6907, + 0xE308, 0x042A, 0x6909, 0x902C, 0x7980, 0x042C, 0x690D, 0x902C, 0x1009, + 0x881A, 0x100A, 0xBA01, 0x881B, 0x100D, 0x881C, 0x100E, 0xBA01, 0x881D, + 0xBF80, 0x00ED, 0x881E, 0x050C, 0x0124, 0xB904, 0x9027, 0x6918, 0xE308, + 0x04B3, 0x902D, 0x6913, 0xBFA0, 0x7598, 0xF704, 0xAE2D, 0x00FF, 0x8B8D, + 0x6919, 0xE308, 0x0463, 0x691A, 0xE308, 0x0456, 0xB907, 0x8809, 0xBEC6, + 0x0453, 0x10A9, 0x90AD, 0x7980, 0x047C, 0xB903, 0x8809, 0xBEC6, 0x0460, + 0x1889, 0x6C22, 0x90AD, 0x10A9, 0x6E23, 0x6C22, 0x90AD, 0x7980, 0x047C, + 0x101A, 0xE308, 0x046F, 0xB903, 0x8809, 0xBEC6, 0x046C, 0x10A9, 0x90A0, + 0x90AD, 0x7980, 0x047C, 0xB901, 0x8809, 0xBEC6, 0x047B, 0x1889, 0x6C22, + 0x90A0, 0x90AD, 0x10A9, 0x6E23, 0x6C22, 0x90A0, 0x90AD, 0x692D, 0xE308, + 0x049C, 0x0124, 0xB703, 0xB902, 0x8818, 0x8B89, 0x022C, 0x108A, 0x7C04, + 0x90A0, 0x692B, 0x881F, 0x7E80, 0x055B, 0x692A, 0x8809, 0x8B89, 0x99A0, + 0x108A, 0x90A0, 0x692B, 0x881F, 0x7E80, 0x055B, 0x692A, 0x8809, 0x8B89, + 0x99AF, 0x7B99, 0x0484, 0x0124, 0x060F, 0x101B, 0x2013, 0x901B, 0xBFA0, + 0x7FFF, 0xE344, 0x04AC, 0x901B, 0x8B89, 0x7A80, 0x051A, 0x6927, 0xBA01, + 0x9027, 0x7A80, 0x0523, 0x6927, 0xE308, 0x049E, 0x7980, 0x050F, 0x0624, + 0x1026, 0x2013, 0x9026, 0xBFA0, 0x7FFF, 0xE304, 0x04C0, 0x8B8D, 0x7A80, + 0x051A, 0x7980, 0x04B4, 0x9026, 0x1013, 0x3026, 0x901B, 0x8B8D, 0x7A80, + 0x051A, 0x7A80, 0x0523, 0x1027, 0xBA01, 0x9027, 0xE308, 0x04B4, 0x0124, + 0x060F, 0x8B89, 0x691A, 0xE308, 0x04EA, 0x6919, 0xE388, 0x04E0, 0xB903, + 0x8809, 0xBEC6, 0x04DD, 0x1FA0, 0x2FAE, 0x98A9, 0x7980, 0x050F, 0xB901, + 0x8818, 0xB907, 0x8809, 0xBEC6, 0x04E7, 0x10EE, 0x90A9, 0x7980, 0x050F, + 0x6919, 0xE308, 0x04FE, 0xB903, 0x8809, 0xBE46, 0xBEC6, 0x04FA, 0x17A0, + 0xBE1E, 0x1FAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, 0x99A9, 0xBE47, + 0x7980, 0x050F, 0xB901, 0x8809, 0xBEC6, 0x050E, 0x16A0, 0x26A0, 0xBFB7, + 0xFF00, 0xBE1E, 0x1EA0, 0x2EAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, + 0x99A9, 0x850C, 0x860F, 0x6907, 0xE388, 0x0516, 0x0D07, 0x8510, 0xBE59, + 0x881E, 0xBE4A, 0xEF00, 0x101E, 0x901C, 0x101F, 0x901D, 0x10A0, 0x901E, + 0x10A0, 0x901F, 0xEF00, 0x101E, 0x301C, 0x9020, 0x731B, 0x5420, 0xBE03, + 0x9825, 0x1025, 0x201C, 0x9025, 0x7325, 0x5414, 0xBE03, 0x8B8E, 0x9880, + 0x692F, 0xE388, 0x0539, 0xBE59, 0xBB07, 0x6180, 0x9880, 0x8BA0, 0x101F, + 0x301D, 0x9021, 0x731B, 0x5421, 0xBE03, 0x982E, 0x102E, 0x201D, 0x902E, + 0x732E, 0x5415, 0xBE03, 0x9880, 0x692F, 0xE388, 0x054F, 0xBE59, 0xBB07, + 0x6180, 0x9880, 0x8BA0, 0x6918, 0xEF08, 0x7325, 0x5416, 0xBE03, 0x98A0, + 0x732E, 0x5417, 0xBE03, 0x98A0, 0xEF00, 0x8BA0, 0xBEC6, 0x056B, 0xBE59, + 0xBB04, 0xAA90, 0xBE04, 0xBE1E, 0x99E0, 0x8BE0, 0x69A0, 0x90D0, 0x69A0, + 0x90D0, 0x081F, 0xB805, 0x881F, 0x8B90, 0x69A0, 0x90D0, 0x69A0, 0x9090, + 0x8BD0, 0x8BD8, 0xBE1F, 0xEF00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; + +uint16_t minisrc_lpf[10] = { + 0X0743, 0X1104, 0X0A4C, 0XF88D, 0X242C, + 0X1023, 0X1AA9, 0X0B60, 0XEFDD, 0X186F +}; + +#endif /* !_DEV_SOUND_PCI_ALLEGRO_CODE_H */ Copied: stable/9/sys/dev/sound/pci/allegro_reg.h (from r230401, head/sys/dev/sound/pci/allegro_reg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/sound/pci/allegro_reg.h Sat Feb 4 17:13:34 2012 (r230985, copy of r230401, head/sys/dev/sound/pci/allegro_reg.h) @@ -0,0 +1,790 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 1996-2008, 4Front Technologies + * Copyright (C) 1992-2000 Don Kim (don.kim@esstech.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN 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) 1997-1999, ESS Technology, Inc. + * This source code, its compiled object code, and its associated data sets + * are copyright (C) 1997-1999 ESS Technology, Inc. + *--------------------------------------------------------------------------- + * This header contains data structures and registers taken from the + * 4Front OSS Allegro BSD licensed driver (in the Attic/ directory). + * Files used for this header include: + * hardware.h + * kernel.h and hckernel.h + * srcmgr.h + *--------------------------------------------------------------------------- + */ + +#ifndef _DEV_SOUND_PCI_ALLEGRO_REG_H +#define _DEV_SOUND_PCI_ALLEGRO_REG_H + +/* Allegro PCI configuration registers */ +#define PCI_LEGACY_AUDIO_CTRL 0x40 +#define SOUND_BLASTER_ENABLE 0x00000001 +#define FM_SYNTHESIS_ENABLE 0x00000002 +#define GAME_PORT_ENABLE 0x00000004 +#define MPU401_IO_ENABLE 0x00000008 +#define MPU401_IRQ_ENABLE 0x00000010 +#define ALIAS_10BIT_IO 0x00000020 +#define SB_DMA_MASK 0x000000C0 +#define SB_DMA_0 0x00000040 +#define SB_DMA_1 0x00000040 +#define SB_DMA_R 0x00000080 +#define SB_DMA_3 0x000000C0 +#define SB_IRQ_MASK 0x00000700 +#define SB_IRQ_5 0x00000000 +#define SB_IRQ_7 0x00000100 +#define SB_IRQ_9 0x00000200 +#define SB_IRQ_10 0x00000300 +#define MIDI_IRQ_MASK 0x00003800 +#define SERIAL_IRQ_ENABLE 0x00004000 +#define DISABLE_LEGACY 0x00008000 + +#define PCI_ALLEGRO_CONFIG 0x50 +#define SB_ADDR_240 0x00000004 +#define MPU_ADDR_MASK 0x00000018 +#define MPU_ADDR_330 0x00000000 +#define MPU_ADDR_300 0x00000008 +#define MPU_ADDR_320 0x00000010 +#define MPU_ADDR_340 0x00000018 +#define USE_PCI_TIMING 0x00000040 +#define POSTED_WRITE_ENABLE 0x00000080 +#define DMA_POLICY_MASK 0x00000700 +#define DMA_DDMA 0x00000000 +#define DMA_TDMA 0x00000100 +#define DMA_PCPCI 0x00000200 +#define DMA_WBDMA16 0x00000400 +#define DMA_WBDMA4 0x00000500 +#define DMA_WBDMA2 0x00000600 +#define DMA_WBDMA1 0x00000700 +#define DMA_SAFE_GUARD 0x00000800 +#define HI_PERF_GP_ENABLE 0x00001000 +#define PIC_SNOOP_MODE_0 0x00002000 +#define PIC_SNOOP_MODE_1 0x00004000 +#define SOUNDBLASTER_IRQ_MASK 0x00008000 +#define RING_IN_ENABLE 0x00010000 +#define SPDIF_TEST_MODE 0x00020000 +#define CLK_MULT_MODE_SELECT_2 0x00040000 +#define EEPROM_WRITE_ENABLE 0x00080000 +#define CODEC_DIR_IN 0x00100000 +#define HV_BUTTON_FROM_GD 0x00200000 +#define REDUCED_DEBOUNCE 0x00400000 +#define HV_CTRL_ENABLE 0x00800000 +#define SPDIF_ENABLE 0x01000000 +#define CLK_DIV_SELECT 0x06000000 +#define CLK_DIV_BY_48 0x00000000 +#define CLK_DIV_BY_49 0x02000000 +#define CLK_DIV_BY_50 0x04000000 +#define CLK_DIV_RESERVED 0x06000000 +#define PM_CTRL_ENABLE 0x08000000 +#define CLK_MULT_MODE_SELECT 0x30000000 +#define CLK_MULT_MODE_SHIFT 28 +#define CLK_MULT_MODE_0 0x00000000 +#define CLK_MULT_MODE_1 0x10000000 +#define CLK_MULT_MODE_2 0x20000000 +#define CLK_MULT_MODE_3 0x30000000 +#define INT_CLK_SELECT 0x40000000 +#define INT_CLK_MULT_RESET 0x80000000 + +/* M3 */ +#define INT_CLK_SRC_NOT_PCI 0x00100000 +#define INT_CLK_MULT_ENABLE 0x80000000 + +#define PCI_ACPI_CONTROL 0x54 +#define PCI_ACPI_D0 0x00000000 +#define PCI_ACPI_D1 0xB4F70000 +#define PCI_ACPI_D2 0xB4F7B4F7 + +#define PCI_USER_CONFIG 0x58 +#define EXT_PCI_MASTER_ENABLE 0x00000001 +#define SPDIF_OUT_SELECT 0x00000002 +#define TEST_PIN_DIR_CTRL 0x00000004 +#define AC97_CODEC_TEST 0x00000020 +#define TRI_STATE_BUFFER 0x00000080 +#define IN_CLK_12MHZ_SELECT 0x00000100 +#define MULTI_FUNC_DISABLE 0x00000200 +#define EXT_MASTER_PAIR_SEL 0x00000400 +#define PCI_MASTER_SUPPORT 0x00000800 +#define STOP_CLOCK_ENABLE 0x00001000 +#define EAPD_DRIVE_ENABLE 0x00002000 +#define REQ_TRI_STATE_ENABLE 0x00004000 +#define REQ_LOW_ENABLE 0x00008000 +#define MIDI_1_ENABLE 0x00010000 +#define MIDI_2_ENABLE 0x00020000 +#define SB_AUDIO_SYNC 0x00040000 +#define HV_CTRL_TEST 0x00100000 +#define SOUNDBLASTER_TEST 0x00400000 + +#define PCI_USER_CONFIG_C 0x5C + +#define PCI_DDMA_CTRL 0x60 +#define DDMA_ENABLE 0x00000001 + + +/* Allegro registers */ +#define HOST_INT_CTRL 0x18 +#define SB_INT_ENABLE 0x0001 +#define MPU401_INT_ENABLE 0x0002 +#define ASSP_INT_ENABLE 0x0010 +#define RING_INT_ENABLE 0x0020 +#define HV_INT_ENABLE 0x0040 +#define CLKRUN_GEN_ENABLE 0x0100 +#define HV_CTRL_TO_PME 0x0400 +#define SOFTWARE_RESET_ENABLE 0x8000 + +#define HOST_INT_STATUS 0x1A +#define SB_INT_PENDING 0x01 +#define MPU401_INT_PENDING 0x02 +#define ASSP_INT_PENDING 0x10 +#define RING_INT_PENDING 0x20 +#define HV_INT_PENDING 0x40 + +#define HARDWARE_VOL_CTRL 0x1B +#define SHADOW_MIX_REG_VOICE 0x1C +#define HW_VOL_COUNTER_VOICE 0x1D +#define SHADOW_MIX_REG_MASTER 0x1E +#define HW_VOL_COUNTER_MASTER 0x1F + +#define CODEC_COMMAND 0x30 +#define CODEC_READ_B 0x80 + +#define CODEC_STATUS 0x30 +#define CODEC_BUSY_B 0x01 + +#define CODEC_DATA 0x32 + +/* AC97 registers */ +#ifndef M3_MODEL +#define AC97_RESET 0x00 +#endif + +#define AC97_VOL_MUTE_B 0x8000 +#define AC97_VOL_M 0x1F +#define AC97_LEFT_VOL_S 8 + +#define AC97_MASTER_VOL 0x02 +#define AC97_LINE_LEVEL_VOL 0x04 +#define AC97_MASTER_MONO_VOL 0x06 +#define AC97_PC_BEEP_VOL 0x0A +#define AC97_PC_BEEP_VOL_M 0x0F +#define AC97_SROUND_MASTER_VOL 0x38 +#define AC97_PC_BEEP_VOL_S 1 + +#ifndef M3_MODEL +#define AC97_PHONE_VOL 0x0C +#define AC97_MIC_VOL 0x0E +#endif +#define AC97_MIC_20DB_ENABLE 0x40 + +#ifndef M3_MODEL +#define AC97_LINEIN_VOL 0x10 +#define AC97_CD_VOL 0x12 +#define AC97_VIDEO_VOL 0x14 +#define AC97_AUX_VOL 0x16 +#endif +#define AC97_PCM_OUT_VOL 0x18 +#ifndef M3_MODEL +#define AC97_RECORD_SELECT 0x1A +#endif +#define AC97_RECORD_MIC 0x00 +#define AC97_RECORD_CD 0x01 +#define AC97_RECORD_VIDEO 0x02 +#define AC97_RECORD_AUX 0x03 +#define AC97_RECORD_MONO_MUX 0x02 +#define AC97_RECORD_DIGITAL 0x03 +#define AC97_RECORD_LINE 0x04 +#define AC97_RECORD_STEREO 0x05 +#define AC97_RECORD_MONO 0x06 +#define AC97_RECORD_PHONE 0x07 + +#ifndef M3_MODEL +#define AC97_RECORD_GAIN 0x1C +#endif +#define AC97_RECORD_VOL_M 0x0F + +#ifndef M3_MODEL +#define AC97_GENERAL_PURPOSE 0x20 +#endif +#define AC97_POWER_DOWN_CTRL 0x26 +#define AC97_ADC_READY 0x0001 +#define AC97_DAC_READY 0x0002 +#define AC97_ANALOG_READY 0x0004 +#define AC97_VREF_ON 0x0008 +#define AC97_PR0 0x0100 +#define AC97_PR1 0x0200 +#define AC97_PR2 0x0400 +#define AC97_PR3 0x0800 +#define AC97_PR4 0x1000 + +#define AC97_RESERVED1 0x28 + +#define AC97_VENDOR_TEST 0x5A + +#define AC97_CLOCK_DELAY 0x5C +#define AC97_LINEOUT_MUX_SEL 0x0001 +#define AC97_MONO_MUX_SEL 0x0002 +#define AC97_CLOCK_DELAY_SEL 0x1F +#define AC97_DAC_CDS_SHIFT 6 +#define AC97_ADC_CDS_SHIFT 11 + +#define AC97_MULTI_CHANNEL_SEL 0x74 + +#ifndef M3_MODEL +#define AC97_VENDOR_ID1 0x7C +#define AC97_VENDOR_ID2 0x7E +#endif + +#define RING_BUS_CTRL_A 0x36 +#define RAC_PME_ENABLE 0x0100 +#define RAC_SDFS_ENABLE 0x0200 +#define LAC_PME_ENABLE 0x0400 +#define LAC_SDFS_ENABLE 0x0800 +#define SERIAL_AC_LINK_ENABLE 0x1000 +#define IO_SRAM_ENABLE 0x2000 +#define IIS_INPUT_ENABLE 0x8000 + +#define RING_BUS_CTRL_B 0x38 +#define SECOND_CODEC_ID_MASK 0x0003 +#define SPDIF_FUNC_ENABLE 0x0010 +#define SECOND_AC_ENABLE 0x0020 +#define SB_MODULE_INTF_ENABLE 0x0040 +#define SSPE_ENABLE 0x0040 +#define M3I_DOCK_ENABLE 0x0080 + +#define SDO_OUT_DEST_CTRL 0x3A +#define COMMAND_ADDR_OUT 0x0003 +#define PCM_LR_OUT_LOCAL 0x0000 +#define PCM_LR_OUT_REMOTE 0x0004 +#define PCM_LR_OUT_MUTE 0x0008 +#define PCM_LR_OUT_BOTH 0x000C +#define LINE1_DAC_OUT_LOCAL 0x0000 +#define LINE1_DAC_OUT_REMOTE 0x0010 +#define LINE1_DAC_OUT_MUTE 0x0020 +#define LINE1_DAC_OUT_BOTH 0x0030 +#define PCM_CLS_OUT_LOCAL 0x0000 +#define PCM_CLS_OUT_REMOTE 0x0040 +#define PCM_CLS_OUT_MUTE 0x0080 +#define PCM_CLS_OUT_BOTH 0x00C0 +#define PCM_RLF_OUT_LOCAL 0x0000 +#define PCM_RLF_OUT_REMOTE 0x0100 +#define PCM_RLF_OUT_MUTE 0x0200 +#define PCM_RLF_OUT_BOTH 0x0300 +#define LINE2_DAC_OUT_LOCAL 0x0000 +#define LINE2_DAC_OUT_REMOTE 0x0400 +#define LINE2_DAC_OUT_MUTE 0x0800 +#define LINE2_DAC_OUT_BOTH 0x0C00 +#define HANDSET_OUT_LOCAL 0x0000 +#define HANDSET_OUT_REMOTE 0x1000 +#define HANDSET_OUT_MUTE 0x2000 +#define HANDSET_OUT_BOTH 0x3000 +#define IO_CTRL_OUT_LOCAL 0x0000 +#define IO_CTRL_OUT_REMOTE 0x4000 +#define IO_CTRL_OUT_MUTE 0x8000 +#define IO_CTRL_OUT_BOTH 0xC000 + +#define SDO_IN_DEST_CTRL 0x3C +#define STATUS_ADDR_IN 0x0003 +#define PCM_LR_IN_LOCAL 0x0000 +#define PCM_LR_IN_REMOTE 0x0004 +#define PCM_LR_RESERVED 0x0008 +#define PCM_LR_IN_BOTH 0x000C +#define LINE1_ADC_IN_LOCAL 0x0000 +#define LINE1_ADC_IN_REMOTE 0x0010 +#define LINE1_ADC_IN_MUTE 0x0020 +#define MIC_ADC_IN_LOCAL 0x0000 +#define MIC_ADC_IN_REMOTE 0x0040 +#define MIC_ADC_IN_MUTE 0x0080 +#define LINE2_DAC_IN_LOCAL 0x0000 +#define LINE2_DAC_IN_REMOTE 0x0400 +#define LINE2_DAC_IN_MUTE 0x0800 +#define HANDSET_IN_LOCAL 0x0000 +#define HANDSET_IN_REMOTE 0x1000 +#define HANDSET_IN_MUTE 0x2000 +#define IO_STATUS_IN_LOCAL 0x0000 +#define IO_STATUS_IN_REMOTE 0x4000 + +#define SPDIF_IN_CTRL 0x3E +#define SPDIF_IN_ENABLE 0x0001 + +#define GPIO_DATA 0x60 +#define GPIO_DATA_MASK 0x0FFF +#define GPIO_HV_STATUS 0x3000 +#define GPIO_PME_STATUS 0x4000 + +#define GPIO_MASK 0x64 +#define GPIO_DIRECTION 0x68 +#define GPO_PRIMARY_AC97 0x0001 +#define GPI_LINEOUT_SENSE 0x0004 +#define GPO_SECONDARY_AC97 0x0008 +#define GPI_VOL_DOWN 0x0010 +#define GPI_VOL_UP 0x0020 +#define GPI_IIS_CLK 0x0040 +#define GPI_IIS_LRCLK 0x0080 +#define GPI_IIS_DATA 0x0100 +#define GPI_DOCKING_STATUS 0x0100 +#define GPI_HEADPHONE_SENSE 0x0200 +#define GPO_EXT_AMP_SHUTDOWN 0x1000 + +/* M3 */ +#define GPO_M3_EXT_AMP_SHUTDN 0x0002 + +#define ASSP_INDEX_PORT 0x80 +#define ASSP_MEMORY_PORT 0x82 +#define ASSP_DATA_PORT 0x84 + +#define MPU401_DATA_PORT 0x98 +#define MPU401_STATUS_PORT 0x99 + +#define CLK_MULT_DATA_PORT 0x9C + +#define ASSP_CONTROL_A 0xA2 +#define ASSP_0_WS_ENABLE 0x01 +#define ASSP_CTRL_A_RESERVED1 0x02 +#define ASSP_CTRL_A_RESERVED2 0x04 +#define ASSP_CLK_49MHZ_SELECT 0x08 +#define FAST_PLU_ENABLE 0x10 +#define ASSP_CTRL_A_RESERVED3 0x20 +#define DSP_CLK_36MHZ_SELECT 0x40 + +#define ASSP_CONTROL_B 0xA4 +#define RESET_ASSP 0x00 +#define RUN_ASSP 0x01 +#define ENABLE_ASSP_CLOCK 0x00 +#define STOP_ASSP_CLOCK 0x10 +#define RESET_TOGGLE 0x40 + +#define ASSP_CONTROL_C 0xA6 +#define ASSP_HOST_INT_ENABLE 0x01 +#define FM_ADDR_REMAP_DISABLE 0x02 +#define HOST_WRITE_PORT_ENABLE 0x08 + +#define ASSP_HOST_INT_STATUS 0xAC +#define DSP2HOST_REQ_PIORECORD 0x01 +#define DSP2HOST_REQ_I2SRATE 0x02 +#define DSP2HOST_REQ_TIMER 0x04 + +/* + * DSP memory map + */ + +#define REV_A_CODE_MEMORY_BEGIN 0x0000 +#define REV_A_CODE_MEMORY_END 0x0FFF +#define REV_A_CODE_MEMORY_UNIT_LENGTH 0x0040 +#define REV_A_CODE_MEMORY_LENGTH (REV_A_CODE_MEMORY_END - REV_A_CODE_MEMORY_BEGIN + 1) + +#define REV_B_CODE_MEMORY_BEGIN 0x0000 +#define REV_B_CODE_MEMORY_END 0x0BFF +#define REV_B_CODE_MEMORY_UNIT_LENGTH 0x0040 +#define REV_B_CODE_MEMORY_LENGTH (REV_B_CODE_MEMORY_END - REV_B_CODE_MEMORY_BEGIN + 1) + +#if (REV_A_CODE_MEMORY_LENGTH % REV_A_CODE_MEMORY_UNIT_LENGTH) +#error Assumption about code memory unit length failed. +#endif +#if (REV_B_CODE_MEMORY_LENGTH % REV_B_CODE_MEMORY_UNIT_LENGTH) +#error Assumption about code memory unit length failed. +#endif + +#define REV_A_DATA_MEMORY_BEGIN 0x1000 +#define REV_A_DATA_MEMORY_END 0x2FFF +#define REV_A_DATA_MEMORY_UNIT_LENGTH 0x0080 +#define REV_A_DATA_MEMORY_LENGTH (REV_A_DATA_MEMORY_END - REV_A_DATA_MEMORY_BEGIN + 1) + +#define REV_B_DATA_MEMORY_BEGIN 0x1000 +/*#define REV_B_DATA_MEMORY_END 0x23FF */ +#define REV_B_DATA_MEMORY_END 0x2BFF +#define REV_B_DATA_MEMORY_UNIT_LENGTH 0x0080 +#define REV_B_DATA_MEMORY_LENGTH (REV_B_DATA_MEMORY_END - REV_B_DATA_MEMORY_BEGIN + 1) + +#if (REV_A_DATA_MEMORY_LENGTH % REV_A_DATA_MEMORY_UNIT_LENGTH) +#error Assumption about data memory unit length failed. +#endif +#if (REV_B_DATA_MEMORY_LENGTH % REV_B_DATA_MEMORY_UNIT_LENGTH) +#error Assumption about data memory unit length failed. +#endif + +#define CODE_MEMORY_MAP_LENGTH (64 + 1) +#define DATA_MEMORY_MAP_LENGTH (64 + 1) + +#if (CODE_MEMORY_MAP_LENGTH < ((REV_A_CODE_MEMORY_LENGTH / REV_A_CODE_MEMORY_UNIT_LENGTH) + 1)) +#error Code memory map length too short. +#endif +#if (DATA_MEMORY_MAP_LENGTH < ((REV_A_DATA_MEMORY_LENGTH / REV_A_DATA_MEMORY_UNIT_LENGTH) + 1)) +#error Data memory map length too short. +#endif +#if (CODE_MEMORY_MAP_LENGTH < ((REV_B_CODE_MEMORY_LENGTH / REV_B_CODE_MEMORY_UNIT_LENGTH) + 1)) +#error Code memory map length too short. +#endif +#if (DATA_MEMORY_MAP_LENGTH < ((REV_B_DATA_MEMORY_LENGTH / REV_B_DATA_MEMORY_UNIT_LENGTH) + 1)) +#error Data memory map length too short. +#endif + + +/* + * Kernel code memory definition + */ + +#define KCODE_VECTORS_BEGIN 0x0000 +#define KCODE_VECTORS_END 0x002F +#define KCODE_VECTORS_UNIT_LENGTH 0x0002 +#define KCODE_VECTORS_LENGTH (KCODE_VECTORS_END - KCODE_VECTORS_BEGIN + 1) + + +/* + * Kernel data memory definition + */ + +#define KDATA_BASE_ADDR 0x1000 +#define KDATA_BASE_ADDR2 0x1080 + +#define KDATA_TASK0 (KDATA_BASE_ADDR + 0x0000) +#define KDATA_TASK1 (KDATA_BASE_ADDR + 0x0001) +#define KDATA_TASK2 (KDATA_BASE_ADDR + 0x0002) +#define KDATA_TASK3 (KDATA_BASE_ADDR + 0x0003) +#define KDATA_TASK4 (KDATA_BASE_ADDR + 0x0004) +#define KDATA_TASK5 (KDATA_BASE_ADDR + 0x0005) +#define KDATA_TASK6 (KDATA_BASE_ADDR + 0x0006) +#define KDATA_TASK7 (KDATA_BASE_ADDR + 0x0007) +#define KDATA_TASK_ENDMARK (KDATA_BASE_ADDR + 0x0008) + +#define KDATA_CURRENT_TASK (KDATA_BASE_ADDR + 0x0009) +#define KDATA_TASK_SWITCH (KDATA_BASE_ADDR + 0x000A) + +#define KDATA_INSTANCE0_POS3D (KDATA_BASE_ADDR + 0x000B) +#define KDATA_INSTANCE1_POS3D (KDATA_BASE_ADDR + 0x000C) +#define KDATA_INSTANCE2_POS3D (KDATA_BASE_ADDR + 0x000D) +#define KDATA_INSTANCE3_POS3D (KDATA_BASE_ADDR + 0x000E) +#define KDATA_INSTANCE4_POS3D (KDATA_BASE_ADDR + 0x000F) +#define KDATA_INSTANCE5_POS3D (KDATA_BASE_ADDR + 0x0010) +#define KDATA_INSTANCE6_POS3D (KDATA_BASE_ADDR + 0x0011) +#define KDATA_INSTANCE7_POS3D (KDATA_BASE_ADDR + 0x0012) +#define KDATA_INSTANCE8_POS3D (KDATA_BASE_ADDR + 0x0013) +#define KDATA_INSTANCE_POS3D_ENDMARK (KDATA_BASE_ADDR + 0x0014) + +#define KDATA_INSTANCE0_SPKVIRT (KDATA_BASE_ADDR + 0x0015) +#define KDATA_INSTANCE_SPKVIRT_ENDMARK (KDATA_BASE_ADDR + 0x0016) + +#define KDATA_INSTANCE0_SPDIF (KDATA_BASE_ADDR + 0x0017) +#define KDATA_INSTANCE_SPDIF_ENDMARK (KDATA_BASE_ADDR + 0x0018) + +#define KDATA_INSTANCE0_MODEM (KDATA_BASE_ADDR + 0x0019) +#define KDATA_INSTANCE_MODEM_ENDMARK (KDATA_BASE_ADDR + 0x001A) + +#define KDATA_INSTANCE0_SRC (KDATA_BASE_ADDR + 0x001B) +#define KDATA_INSTANCE1_SRC (KDATA_BASE_ADDR + 0x001C) +#define KDATA_INSTANCE_SRC_ENDMARK (KDATA_BASE_ADDR + 0x001D) + +#define KDATA_INSTANCE0_MINISRC (KDATA_BASE_ADDR + 0x001E) +#define KDATA_INSTANCE1_MINISRC (KDATA_BASE_ADDR + 0x001F) +#define KDATA_INSTANCE2_MINISRC (KDATA_BASE_ADDR + 0x0020) +#define KDATA_INSTANCE3_MINISRC (KDATA_BASE_ADDR + 0x0021) +#define KDATA_INSTANCE_MINISRC_ENDMARK (KDATA_BASE_ADDR + 0x0022) + +#define KDATA_INSTANCE0_CPYTHRU (KDATA_BASE_ADDR + 0x0023) +#define KDATA_INSTANCE1_CPYTHRU (KDATA_BASE_ADDR + 0x0024) +#define KDATA_INSTANCE_CPYTHRU_ENDMARK (KDATA_BASE_ADDR + 0x0025) + +#define KDATA_CURRENT_DMA (KDATA_BASE_ADDR + 0x0026) +#define KDATA_DMA_SWITCH (KDATA_BASE_ADDR + 0x0027) +#define KDATA_DMA_ACTIVE (KDATA_BASE_ADDR + 0x0028) + +#define KDATA_DMA_XFER0 (KDATA_BASE_ADDR + 0x0029) +#define KDATA_DMA_XFER1 (KDATA_BASE_ADDR + 0x002A) +#define KDATA_DMA_XFER2 (KDATA_BASE_ADDR + 0x002B) +#define KDATA_DMA_XFER3 (KDATA_BASE_ADDR + 0x002C) +#define KDATA_DMA_XFER4 (KDATA_BASE_ADDR + 0x002D) +#define KDATA_DMA_XFER5 (KDATA_BASE_ADDR + 0x002E) +#define KDATA_DMA_XFER6 (KDATA_BASE_ADDR + 0x002F) +#define KDATA_DMA_XFER7 (KDATA_BASE_ADDR + 0x0030) +#define KDATA_DMA_XFER8 (KDATA_BASE_ADDR + 0x0031) +#define KDATA_DMA_XFER_ENDMARK (KDATA_BASE_ADDR + 0x0032) + +#define KDATA_I2S_SAMPLE_COUNT (KDATA_BASE_ADDR + 0x0033) +#define KDATA_I2S_INT_METER (KDATA_BASE_ADDR + 0x0034) +#define KDATA_I2S_ACTIVE (KDATA_BASE_ADDR + 0x0035) + +#define KDATA_TIMER_COUNT_RELOAD (KDATA_BASE_ADDR + 0x0036) +#define KDATA_TIMER_COUNT_CURRENT (KDATA_BASE_ADDR + 0x0037) + +#define KDATA_HALT_SYNCH_CLIENT (KDATA_BASE_ADDR + 0x0038) +#define KDATA_HALT_SYNCH_DMA (KDATA_BASE_ADDR + 0x0039) +#define KDATA_HALT_ACKNOWLEDGE (KDATA_BASE_ADDR + 0x003A) + +#define KDATA_ADC1_XFER0 (KDATA_BASE_ADDR + 0x003B) +#define KDATA_ADC1_XFER_ENDMARK (KDATA_BASE_ADDR + 0x003C) +#define KDATA_ADC1_LEFT_VOLUME (KDATA_BASE_ADDR + 0x003D) +#define KDATA_ADC1_RIGHT_VOLUME (KDATA_BASE_ADDR + 0x003E) +#define KDATA_ADC1_LEFT_SUR_VOL (KDATA_BASE_ADDR + 0x003F) +#define KDATA_ADC1_RIGHT_SUR_VOL (KDATA_BASE_ADDR + 0x0040) + +#define KDATA_ADC2_XFER0 (KDATA_BASE_ADDR + 0x0041) +#define KDATA_ADC2_XFER_ENDMARK (KDATA_BASE_ADDR + 0x0042) +#define KDATA_ADC2_LEFT_VOLUME (KDATA_BASE_ADDR + 0x0043) +#define KDATA_ADC2_RIGHT_VOLUME (KDATA_BASE_ADDR + 0x0044) +#define KDATA_ADC2_LEFT_SUR_VOL (KDATA_BASE_ADDR + 0x0045) +#define KDATA_ADC2_RIGHT_SUR_VOL (KDATA_BASE_ADDR + 0x0046) + +#define KDATA_CD_XFER0 (KDATA_BASE_ADDR + 0x0047) +#define KDATA_CD_XFER_ENDMARK (KDATA_BASE_ADDR + 0x0048) +#define KDATA_CD_LEFT_VOLUME (KDATA_BASE_ADDR + 0x0049) +#define KDATA_CD_RIGHT_VOLUME (KDATA_BASE_ADDR + 0x004A) +#define KDATA_CD_LEFT_SUR_VOL (KDATA_BASE_ADDR + 0x004B) +#define KDATA_CD_RIGHT_SUR_VOL (KDATA_BASE_ADDR + 0x004C) + +#define KDATA_MIC_XFER0 (KDATA_BASE_ADDR + 0x004D) +#define KDATA_MIC_XFER_ENDMARK (KDATA_BASE_ADDR + 0x004E) +#define KDATA_MIC_VOLUME (KDATA_BASE_ADDR + 0x004F) +#define KDATA_MIC_SUR_VOL (KDATA_BASE_ADDR + 0x0050) + +#define KDATA_I2S_XFER0 (KDATA_BASE_ADDR + 0x0051) +#define KDATA_I2S_XFER_ENDMARK (KDATA_BASE_ADDR + 0x0052) + +#define KDATA_CHI_XFER0 (KDATA_BASE_ADDR + 0x0053) +#define KDATA_CHI_XFER_ENDMARK (KDATA_BASE_ADDR + 0x0054) + +#define KDATA_SPDIF_XFER (KDATA_BASE_ADDR + 0x0055) +#define KDATA_SPDIF_CURRENT_FRAME (KDATA_BASE_ADDR + 0x0056) +#define KDATA_SPDIF_FRAME0 (KDATA_BASE_ADDR + 0x0057) +#define KDATA_SPDIF_FRAME1 (KDATA_BASE_ADDR + 0x0058) +#define KDATA_SPDIF_FRAME2 (KDATA_BASE_ADDR + 0x0059) + +#define KDATA_SPDIF_REQUEST (KDATA_BASE_ADDR + 0x005A) +#define KDATA_SPDIF_TEMP (KDATA_BASE_ADDR + 0x005B) + +/*AY SPDIF IN */ +#define KDATA_SPDIFIN_XFER0 (KDATA_BASE_ADDR + 0x005C) +#define KDATA_SPDIFIN_XFER_ENDMARK (KDATA_BASE_ADDR + 0x005D) +#define KDATA_SPDIFIN_INT_METER (KDATA_BASE_ADDR + 0x005E) + +#define KDATA_DSP_RESET_COUNT (KDATA_BASE_ADDR + 0x005F) +#define KDATA_DEBUG_OUTPUT (KDATA_BASE_ADDR + 0x0060) + +#define KDATA_KERNEL_ISR_LIST (KDATA_BASE_ADDR + 0x0061) + +#define KDATA_KERNEL_ISR_CBSR1 (KDATA_BASE_ADDR + 0x0062) +#define KDATA_KERNEL_ISR_CBER1 (KDATA_BASE_ADDR + 0x0063) +#define KDATA_KERNEL_ISR_CBCR (KDATA_BASE_ADDR + 0x0064) +#define KDATA_KERNEL_ISR_AR0 (KDATA_BASE_ADDR + 0x0065) +#define KDATA_KERNEL_ISR_AR1 (KDATA_BASE_ADDR + 0x0066) +#define KDATA_KERNEL_ISR_AR2 (KDATA_BASE_ADDR + 0x0067) +#define KDATA_KERNEL_ISR_AR3 (KDATA_BASE_ADDR + 0x0068) +#define KDATA_KERNEL_ISR_AR4 (KDATA_BASE_ADDR + 0x0069) +#define KDATA_KERNEL_ISR_AR5 (KDATA_BASE_ADDR + 0x006A) +#define KDATA_KERNEL_ISR_BRCR (KDATA_BASE_ADDR + 0x006B) +#define KDATA_KERNEL_ISR_PASR (KDATA_BASE_ADDR + 0x006C) +#define KDATA_KERNEL_ISR_PAER (KDATA_BASE_ADDR + 0x006D) + +#define KDATA_CLIENT_SCRATCH0 (KDATA_BASE_ADDR + 0x006E) +#define KDATA_CLIENT_SCRATCH1 (KDATA_BASE_ADDR + 0x006F) +#define KDATA_KERNEL_SCRATCH (KDATA_BASE_ADDR + 0x0070) +#define KDATA_KERNEL_ISR_SCRATCH (KDATA_BASE_ADDR + 0x0071) + +#define KDATA_OUEUE_LEFT (KDATA_BASE_ADDR + 0x0072) +#define KDATA_QUEUE_RIGHT (KDATA_BASE_ADDR + 0x0073) + +#define KDATA_ADC1_REQUEST (KDATA_BASE_ADDR + 0x0074) +#define KDATA_ADC2_REQUEST (KDATA_BASE_ADDR + 0x0075) +#define KDATA_CD_REQUEST (KDATA_BASE_ADDR + 0x0076) +#define KDATA_MIC_REQUEST (KDATA_BASE_ADDR + 0x0077) + +#define KDATA_ADC1_MIXER_REQUEST (KDATA_BASE_ADDR + 0x0078) +#define KDATA_ADC2_MIXER_REQUEST (KDATA_BASE_ADDR + 0x0079) +#define KDATA_CD_MIXER_REQUEST (KDATA_BASE_ADDR + 0x007A) +#define KDATA_MIC_MIXER_REQUEST (KDATA_BASE_ADDR + 0x007B) +#define KDATA_MIC_SYNC_COUNTER (KDATA_BASE_ADDR + 0x007C) + +/* + * second segment + */ + +/* smart mixer buffer */ + +#define KDATA_MIXER_WORD0 (KDATA_BASE_ADDR2 + 0x0000) +#define KDATA_MIXER_WORD1 (KDATA_BASE_ADDR2 + 0x0001) +#define KDATA_MIXER_WORD2 (KDATA_BASE_ADDR2 + 0x0002) +#define KDATA_MIXER_WORD3 (KDATA_BASE_ADDR2 + 0x0003) +#define KDATA_MIXER_WORD4 (KDATA_BASE_ADDR2 + 0x0004) +#define KDATA_MIXER_WORD5 (KDATA_BASE_ADDR2 + 0x0005) +#define KDATA_MIXER_WORD6 (KDATA_BASE_ADDR2 + 0x0006) +#define KDATA_MIXER_WORD7 (KDATA_BASE_ADDR2 + 0x0007) +#define KDATA_MIXER_WORD8 (KDATA_BASE_ADDR2 + 0x0008) +#define KDATA_MIXER_WORD9 (KDATA_BASE_ADDR2 + 0x0009) +#define KDATA_MIXER_WORDA (KDATA_BASE_ADDR2 + 0x000A) +#define KDATA_MIXER_WORDB (KDATA_BASE_ADDR2 + 0x000B) +#define KDATA_MIXER_WORDC (KDATA_BASE_ADDR2 + 0x000C) +#define KDATA_MIXER_WORDD (KDATA_BASE_ADDR2 + 0x000D) +#define KDATA_MIXER_WORDE (KDATA_BASE_ADDR2 + 0x000E) +#define KDATA_MIXER_WORDF (KDATA_BASE_ADDR2 + 0x000F) + +#define KDATA_MIXER_XFER0 (KDATA_BASE_ADDR2 + 0x0010) +#define KDATA_MIXER_XFER1 (KDATA_BASE_ADDR2 + 0x0011) +#define KDATA_MIXER_XFER2 (KDATA_BASE_ADDR2 + 0x0012) +#define KDATA_MIXER_XFER3 (KDATA_BASE_ADDR2 + 0x0013) +#define KDATA_MIXER_XFER4 (KDATA_BASE_ADDR2 + 0x0014) +#define KDATA_MIXER_XFER5 (KDATA_BASE_ADDR2 + 0x0015) +#define KDATA_MIXER_XFER6 (KDATA_BASE_ADDR2 + 0x0016) +#define KDATA_MIXER_XFER7 (KDATA_BASE_ADDR2 + 0x0017) +#define KDATA_MIXER_XFER8 (KDATA_BASE_ADDR2 + 0x0018) +#define KDATA_MIXER_XFER9 (KDATA_BASE_ADDR2 + 0x0019) +#define KDATA_MIXER_XFER_ENDMARK (KDATA_BASE_ADDR2 + 0x001A) + +#define KDATA_MIXER_TASK_NUMBER (KDATA_BASE_ADDR2 + 0x001B) +#define KDATA_CURRENT_MIXER (KDATA_BASE_ADDR2 + 0x001C) +#define KDATA_MIXER_ACTIVE (KDATA_BASE_ADDR2 + 0x001D) +#define KDATA_MIXER_BANK_STATUS (KDATA_BASE_ADDR2 + 0x001E) +#define KDATA_DAC_LEFT_VOLUME (KDATA_BASE_ADDR2 + 0x001F) +#define KDATA_DAC_RIGHT_VOLUME (KDATA_BASE_ADDR2 + 0x0020) + +/* + * Client data memory definition + */ + +#define CDATA_INSTANCE_READY 0x00 + +#define CDATA_HOST_SRC_ADDRL 0x01 +#define CDATA_HOST_SRC_ADDRH 0x02 +#define CDATA_HOST_SRC_END_PLUS_1L 0x03 +#define CDATA_HOST_SRC_END_PLUS_1H 0x04 +#define CDATA_HOST_SRC_CURRENTL 0x05 +#define CDATA_HOST_SRC_CURRENTH 0x06 + +#define CDATA_IN_BUF_CONNECT 0x07 +#define CDATA_OUT_BUF_CONNECT 0x08 + +#define CDATA_IN_BUF_BEGIN 0x09 +#define CDATA_IN_BUF_END_PLUS_1 0x0A +#define CDATA_IN_BUF_HEAD 0x0B +#define CDATA_IN_BUF_TAIL 0x0C + +#define CDATA_OUT_BUF_BEGIN 0x0D +#define CDATA_OUT_BUF_END_PLUS_1 0x0E +#define CDATA_OUT_BUF_HEAD 0x0F +#define CDATA_OUT_BUF_TAIL 0x10 + +#define CDATA_DMA_CONTROL 0x11 +#define CDATA_RESERVED 0x12 + +#define CDATA_FREQUENCY 0x13 +#define CDATA_LEFT_VOLUME 0x14 +#define CDATA_RIGHT_VOLUME 0x15 +#define CDATA_LEFT_SUR_VOL 0x16 +#define CDATA_RIGHT_SUR_VOL 0x17 + +/* These are from Allegro hckernel.h */ +#define CDATA_HEADER_LEN 0x18 +#define SRC3_DIRECTION_OFFSET CDATA_HEADER_LEN +#define SRC3_MODE_OFFSET CDATA_HEADER_LEN + 1 +#define SRC3_WORD_LENGTH_OFFSET CDATA_HEADER_LEN + 2 +#define SRC3_PARAMETER_OFFSET CDATA_HEADER_LEN + 3 +#define SRC3_COEFF_ADDR_OFFSET CDATA_HEADER_LEN + 8 +#define SRC3_FILTAP_ADDR_OFFSET CDATA_HEADER_LEN + 10 +#define SRC3_TEMP_INBUF_ADDR_OFFSET CDATA_HEADER_LEN + 16 +#define SRC3_TEMP_OUTBUF_ADDR_OFFSET CDATA_HEADER_LEN + 17 +#define FOR_FUTURE_USE 10 /* for storing temporary variable in future */ + +/* + * DMA control definition + */ + +#define DMACONTROL_BLOCK_MASK 0x000F +#define DMAC_BLOCK0_SELECTOR 0x0000 +#define DMAC_BLOCK1_SELECTOR 0x0001 +#define DMAC_BLOCK2_SELECTOR 0x0002 +#define DMAC_BLOCK3_SELECTOR 0x0003 +#define DMAC_BLOCK4_SELECTOR 0x0004 +#define DMAC_BLOCK5_SELECTOR 0x0005 +#define DMAC_BLOCK6_SELECTOR 0x0006 +#define DMAC_BLOCK7_SELECTOR 0x0007 +#define DMAC_BLOCK8_SELECTOR 0x0008 +#define DMAC_BLOCK9_SELECTOR 0x0009 +#define DMAC_BLOCKA_SELECTOR 0x000A +#define DMAC_BLOCKB_SELECTOR 0x000B +#define DMAC_BLOCKC_SELECTOR 0x000C +#define DMAC_BLOCKD_SELECTOR 0x000D +#define DMAC_BLOCKE_SELECTOR 0x000E +#define DMAC_BLOCKF_SELECTOR 0x000F +#define DMACONTROL_PAGE_MASK 0x00F0 +#define DMAC_PAGE0_SELECTOR 0x0030 +#define DMAC_PAGE1_SELECTOR 0x0020 +#define DMAC_PAGE2_SELECTOR 0x0010 +#define DMAC_PAGE3_SELECTOR 0x0000 +#define DMACONTROL_AUTOREPEAT 0x1000 +#define DMACONTROL_STOPPED 0x2000 +#define DMACONTROL_DIRECTION 0x0100 + +/* + * Kernel/client memory allocation + */ + +#define NUM_UNITS_KERNEL_CODE 16 +#define NUM_UNITS_KERNEL_DATA 2 + +#define NUM_UNITS_KERNEL_CODE_WITH_HSP 16 +#ifdef M3_MODEL +#define NUM_UNITS_KERNEL_DATA_WITH_HSP 5 +#else +#define NUM_UNITS_KERNEL_DATA_WITH_HSP 4 +#endif + +#define NUM_UNITS( BYTES, UNITLEN ) ((((BYTES+1)>>1) + (UNITLEN-1)) / UNITLEN) + +/* + * DSP hardware + */ + +#define DSP_PORT_TIMER_COUNT 0x06 +#define DSP_PORT_MEMORY_INDEX 0x80 +#define DSP_PORT_MEMORY_TYPE 0x82 +#define DSP_PORT_MEMORY_DATA 0x84 +#define DSP_PORT_CONTROL_REG_A 0xA2 *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***