Module Name: src Committed By: chs Date: Sun Dec 2 00:05:39 UTC 2012
Modified Files: src/external/cddl/osnet/dev/cyclic: cyclic.c src/external/cddl/osnet/dev/cyclic/i386: cyclic_machdep.c src/external/cddl/osnet/sys/sys: cyclic.h cyclic_impl.h src/sys/sys: dtrace_bsd.h Removed Files: src/external/cddl/osnet/dev/cyclic/amd64: cyclic_machdep.c Log Message: update cyclic module to the freebsd 8-stable version as of svn r219520. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/dev/cyclic/cyclic.c cvs rdiff -u -r1.2 -r0 \ src/external/cddl/osnet/dev/cyclic/amd64/cyclic_machdep.c cvs rdiff -u -r1.2 -r1.3 \ src/external/cddl/osnet/dev/cyclic/i386/cyclic_machdep.c cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/sys/sys/cyclic.h cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/sys/sys/cyclic_impl.h cvs rdiff -u -r1.5 -r1.6 src/sys/sys/dtrace_bsd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/cddl/osnet/dev/cyclic/cyclic.c diff -u src/external/cddl/osnet/dev/cyclic/cyclic.c:1.2 src/external/cddl/osnet/dev/cyclic/cyclic.c:1.3 --- src/external/cddl/osnet/dev/cyclic/cyclic.c:1.2 Sun Feb 21 01:46:33 2010 +++ src/external/cddl/osnet/dev/cyclic/cyclic.c Sun Dec 2 00:05:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cyclic.c,v 1.2 2010/02/21 01:46:33 darran Exp $ */ +/* $NetBSD: cyclic.c,v 1.3 2012/12/02 00:05:38 chs Exp $ */ /* * CDDL HEADER START @@ -23,7 +23,7 @@ * * Portions Copyright 2008 John Birrell <j...@freebsd.org> * - * $FreeBSD: src/sys/cddl/dev/cyclic/cyclic.c,v 1.2.2.1 2009/08/03 08:13:06 kensmith Exp $ + * $FreeBSD$ * * This is a simplified version of the cyclic timer subsystem from * OpenSolaris. In the FreeBSD version, we don't use interrupt levels. @@ -475,73 +475,6 @@ cyclic_expire(cyc_cpu_t *cpu, cyc_index_ (*handler)(arg); } -static void -cyclic_enable_xcall(void *v) -{ - cyc_xcallarg_t *argp = v; - cyc_cpu_t *cpu = argp->cyx_cpu; - cyc_backend_t *be = cpu->cyp_backend; - - be->cyb_enable(be->cyb_arg); -} - -static void -cyclic_enable(cyc_cpu_t *cpu) -{ - cyc_backend_t *be = cpu->cyp_backend; - cyc_xcallarg_t arg; - - arg.cyx_cpu = cpu; - - /* Cross call to the target CPU */ - be->cyb_xcall(be->cyb_arg, cpu->cyp_cpu, cyclic_enable_xcall, &arg); -} - -static void -cyclic_disable_xcall(void *v) -{ - cyc_xcallarg_t *argp = v; - cyc_cpu_t *cpu = argp->cyx_cpu; - cyc_backend_t *be = cpu->cyp_backend; - - be->cyb_disable(be->cyb_arg); -} - -static void -cyclic_disable(cyc_cpu_t *cpu) -{ - cyc_backend_t *be = cpu->cyp_backend; - cyc_xcallarg_t arg; - - arg.cyx_cpu = cpu; - - /* Cross call to the target CPU */ - be->cyb_xcall(be->cyb_arg, cpu->cyp_cpu, cyclic_disable_xcall, &arg); -} - -static void -cyclic_reprogram_xcall(void *v) -{ - cyc_xcallarg_t *argp = v; - cyc_cpu_t *cpu = argp->cyx_cpu; - cyc_backend_t *be = cpu->cyp_backend; - - be->cyb_reprogram(be->cyb_arg, argp->cyx_exp); -} - -static void -cyclic_reprogram(cyc_cpu_t *cpu, hrtime_t exp) -{ - cyc_backend_t *be = cpu->cyp_backend; - cyc_xcallarg_t arg; - - arg.cyx_cpu = cpu; - arg.cyx_exp = exp; - - /* Cross call to the target CPU */ - be->cyb_xcall(be->cyb_arg, cpu->cyp_cpu, cyclic_reprogram_xcall, &arg); -} - /* * cyclic_fire(cpu_t *) * @@ -572,17 +505,15 @@ static void cyclic_fire(cpu_t *c) { cyc_cpu_t *cpu = c->cpu_cyclic; - - mtx_lock_spin(&cpu->cyp_mtx); - + cyc_backend_t *be = cpu->cyp_backend; cyc_index_t *heap = cpu->cyp_heap; cyclic_t *cyclic, *cyclics = cpu->cyp_cyclics; + void *arg = be->cyb_arg; hrtime_t now = gethrtime(); hrtime_t exp; if (cpu->cyp_nelems == 0) { /* This is a spurious fire. */ - mtx_unlock_spin(&cpu->cyp_mtx); return; } @@ -633,8 +564,45 @@ cyclic_fire(cpu_t *c) * Now we have a cyclic in the root slot which isn't in the past; * reprogram the interrupt source. */ - cyclic_reprogram(cpu, exp); + be->cyb_reprogram(arg, exp); +} + +static void +cyclic_expand_xcall(cyc_xcallarg_t *arg) +{ + cyc_cpu_t *cpu = arg->cyx_cpu; + cyc_index_t new_size = arg->cyx_size, size = cpu->cyp_size, i; + cyc_index_t *new_heap = arg->cyx_heap; + cyclic_t *cyclics = cpu->cyp_cyclics, *new_cyclics = arg->cyx_cyclics; + + /* Disable preemption and interrupts. */ + mtx_lock_spin(&cpu->cyp_mtx); + + /* + * Assert that the new size is a power of 2. + */ + ASSERT((new_size & (new_size - 1)) == 0); + ASSERT(new_size == (size << 1)); + ASSERT(cpu->cyp_heap != NULL && cpu->cyp_cyclics != NULL); + + bcopy(cpu->cyp_heap, new_heap, sizeof (cyc_index_t) * size); + bcopy(cyclics, new_cyclics, sizeof (cyclic_t) * size); + + /* + * Set up the free list, and set all of the new cyclics to be CYF_FREE. + */ + for (i = size; i < new_size; i++) { + new_heap[i] = i; + new_cyclics[i].cy_flags = CYF_FREE; + } + /* + * We can go ahead and plow the value of cyp_heap and cyp_cyclics; + * cyclic_expand() has kept a copy. + */ + cpu->cyp_heap = new_heap; + cpu->cyp_cyclics = new_cyclics; + cpu->cyp_size = new_size; mtx_unlock_spin(&cpu->cyp_mtx); } @@ -645,102 +613,70 @@ cyclic_fire(cpu_t *c) static void cyclic_expand(cyc_cpu_t *cpu) { - cyc_index_t new_size, old_size, i; + cyc_index_t new_size, old_size; cyc_index_t *new_heap, *old_heap; cyclic_t *new_cyclics, *old_cyclics; + cyc_xcallarg_t arg; + cyc_backend_t *be = cpu->cyp_backend; ASSERT(MUTEX_HELD(&cpu_lock)); - if ((new_size = ((old_size = cpu->cyp_size) << 1)) == 0) + old_heap = cpu->cyp_heap; + old_cyclics = cpu->cyp_cyclics; + + if ((new_size = ((old_size = cpu->cyp_size) << 1)) == 0) { new_size = CY_DEFAULT_PERCPU; + ASSERT(old_heap == NULL && old_cyclics == NULL); + } /* * Check that the new_size is a power of 2. */ ASSERT(((new_size - 1) & new_size) == 0); - /* Unlock the mutex while allocating memory so we can wait... */ - mtx_unlock_spin(&cpu->cyp_mtx); - new_heap = malloc(sizeof(cyc_index_t) * new_size, M_CYCLIC, M_WAITOK); new_cyclics = malloc(sizeof(cyclic_t) * new_size, M_CYCLIC, M_ZERO | M_WAITOK); - /* Grab the lock again now we've got the memory... */ - mtx_lock_spin(&cpu->cyp_mtx); - - /* Check if another thread beat us while the mutex was unlocked. */ - if (old_size != cpu->cyp_size) { - /* Oh well, he won. */ - mtx_unlock_spin(&cpu->cyp_mtx); - - free(new_heap, M_CYCLIC); - free(new_cyclics, M_CYCLIC); - - mtx_lock_spin(&cpu->cyp_mtx); - return; - } - - old_heap = cpu->cyp_heap; - old_cyclics = cpu->cyp_cyclics; - - bcopy(cpu->cyp_heap, new_heap, sizeof (cyc_index_t) * old_size); - bcopy(old_cyclics, new_cyclics, sizeof (cyclic_t) * old_size); - - /* - * Set up the free list, and set all of the new cyclics to be CYF_FREE. - */ - for (i = old_size; i < new_size; i++) { - new_heap[i] = i; - new_cyclics[i].cy_flags = CYF_FREE; - } + arg.cyx_cpu = cpu; + arg.cyx_heap = new_heap; + arg.cyx_cyclics = new_cyclics; + arg.cyx_size = new_size; - /* - * We can go ahead and plow the value of cyp_heap and cyp_cyclics; - * cyclic_expand() has kept a copy. - */ - cpu->cyp_heap = new_heap; - cpu->cyp_cyclics = new_cyclics; - cpu->cyp_size = new_size; + be->cyb_xcall(be->cyb_arg, cpu->cyp_cpu, + (cyc_func_t)cyclic_expand_xcall, &arg); if (old_cyclics != NULL) { ASSERT(old_heap != NULL); ASSERT(old_size != 0); - mtx_unlock_spin(&cpu->cyp_mtx); - free(old_cyclics, M_CYCLIC); free(old_heap, M_CYCLIC); - - mtx_lock_spin(&cpu->cyp_mtx); } } -static cyc_index_t -cyclic_add_here(cyc_cpu_t *cpu, cyc_handler_t *hdlr, - cyc_time_t *when, uint16_t flags) +static void +cyclic_add_xcall(cyc_xcallarg_t *arg) { + cyc_cpu_t *cpu = arg->cyx_cpu; + cyc_handler_t *hdlr = arg->cyx_hdlr; + cyc_time_t *when = arg->cyx_when; + cyc_backend_t *be = cpu->cyp_backend; cyc_index_t ndx, nelems; + cyb_arg_t bar = be->cyb_arg; cyclic_t *cyclic; - ASSERT(MUTEX_HELD(&cpu_lock)); - - mtx_lock_spin(&cpu->cyp_mtx); - - ASSERT(!(cpu->cyp_cpu->cpu_flags & CPU_OFFLINE)); - ASSERT(when->cyt_when >= 0 && when->cyt_interval > 0); - - while (cpu->cyp_nelems == cpu->cyp_size) - cyclic_expand(cpu); - ASSERT(cpu->cyp_nelems < cpu->cyp_size); + /* Disable preemption and interrupts. */ + mtx_lock_spin(&cpu->cyp_mtx); nelems = cpu->cyp_nelems++; - if (nelems == 0) + if (nelems == 0) { /* * If this is the first element, we need to enable the * backend on this CPU. */ - cyclic_enable(cpu); + be->cyb_enable(bar); + } ndx = cpu->cyp_heap[nelems]; cyclic = &cpu->cyp_cyclics[ndx]; @@ -748,14 +684,20 @@ cyclic_add_here(cyc_cpu_t *cpu, cyc_hand ASSERT(cyclic->cy_flags == CYF_FREE); cyclic->cy_interval = when->cyt_interval; - if (when->cyt_when == 0) - cyclic->cy_expire = gethrtime() + cyclic->cy_interval; - else + if (when->cyt_when == 0) { + /* + * If a start time hasn't been explicitly specified, we'll + * start on the next interval boundary. + */ + cyclic->cy_expire = (gethrtime() / cyclic->cy_interval + 1) * + cyclic->cy_interval; + } else { cyclic->cy_expire = when->cyt_when; + } cyclic->cy_handler = hdlr->cyh_func; cyclic->cy_arg = hdlr->cyh_arg; - cyclic->cy_flags = flags; + cyclic->cy_flags = arg->cyx_flags; if (cyclic_upheap(cpu, nelems)) { hrtime_t exp = cyclic->cy_expire; @@ -764,31 +706,63 @@ cyclic_add_here(cyc_cpu_t *cpu, cyc_hand * If our upheap propagated to the root, we need to * reprogram the interrupt source. */ - cyclic_reprogram(cpu, exp); + be->cyb_reprogram(bar, exp); } - mtx_unlock_spin(&cpu->cyp_mtx); - return (ndx); + arg->cyx_ndx = ndx; } - -static int -cyclic_remove_here(cyc_cpu_t *cpu, cyc_index_t ndx, cyc_time_t *when, int wait) +static cyc_index_t +cyclic_add_here(cyc_cpu_t *cpu, cyc_handler_t *hdlr, + cyc_time_t *when, uint16_t flags) { - cyc_index_t nelems, i; - cyclic_t *cyclic; - cyc_index_t *heap, last; + cyc_backend_t *be = cpu->cyp_backend; + cyb_arg_t bar = be->cyb_arg; + cyc_xcallarg_t arg; ASSERT(MUTEX_HELD(&cpu_lock)); - ASSERT(wait == CY_WAIT || wait == CY_NOWAIT); + ASSERT(!(cpu->cyp_cpu->cpu_flags & CPU_OFFLINE)); + ASSERT(when->cyt_when >= 0 && when->cyt_interval > 0); - mtx_lock_spin(&cpu->cyp_mtx); + if (cpu->cyp_nelems == cpu->cyp_size) { + /* + * This is expensive; it will cross call onto the other + * CPU to perform the expansion. + */ + cyclic_expand(cpu); + ASSERT(cpu->cyp_nelems < cpu->cyp_size); + } - heap = cpu->cyp_heap; + /* + * By now, we know that we're going to be able to successfully + * perform the add. Now cross call over to the CPU of interest to + * actually add our cyclic. + */ + arg.cyx_cpu = cpu; + arg.cyx_hdlr = hdlr; + arg.cyx_when = when; + arg.cyx_flags = flags; + + be->cyb_xcall(bar, cpu->cyp_cpu, (cyc_func_t)cyclic_add_xcall, &arg); + + return (arg.cyx_ndx); +} + +static void +cyclic_remove_xcall(cyc_xcallarg_t *arg) +{ + cyc_cpu_t *cpu = arg->cyx_cpu; + cyc_backend_t *be = cpu->cyp_backend; + cyb_arg_t bar = be->cyb_arg; + cyc_index_t ndx = arg->cyx_ndx, nelems = cpu->cyp_nelems, i; + cyc_index_t *heap = cpu->cyp_heap, last; + cyclic_t *cyclic; - nelems = cpu->cyp_nelems; + ASSERT(nelems > 0); + /* Disable preemption and interrupts. */ + mtx_lock_spin(&cpu->cyp_mtx); cyclic = &cpu->cyp_cyclics[ndx]; /* @@ -796,11 +770,17 @@ cyclic_remove_here(cyc_cpu_t *cpu, cyc_i * removed as part of a juggling operation, the expiration time * will be used when the cyclic is added to the new CPU. */ - if (when != NULL) { - when->cyt_when = cyclic->cy_expire; - when->cyt_interval = cyclic->cy_interval; + if (arg->cyx_when != NULL) { + arg->cyx_when->cyt_when = cyclic->cy_expire; + arg->cyx_when->cyt_interval = cyclic->cy_interval; } + /* + * Now set the flags to CYF_FREE. We don't need a membar_enter() + * between zeroing pend and setting the flags because we're at + * CY_HIGH_LEVEL (that is, the zeroing of pend and the setting + * of cy_flags appear atomic to softints). + */ cyclic->cy_flags = CYF_FREE; for (i = 0; i < nelems; i++) { @@ -813,19 +793,21 @@ cyclic_remove_here(cyc_cpu_t *cpu, cyc_i cpu->cyp_nelems = --nelems; - if (nelems == 0) + if (nelems == 0) { /* * If we just removed the last element, then we need to * disable the backend on this CPU. */ - cyclic_disable(cpu); + be->cyb_disable(bar); + } - if (i == nelems) + if (i == nelems) { /* * If we just removed the last element of the heap, then * we don't have to downheap. */ - goto done; + goto out; + } /* * Swap the last element of the heap with the one we want to @@ -835,17 +817,18 @@ cyclic_remove_here(cyc_cpu_t *cpu, cyc_i heap[i] = (last = heap[nelems]); heap[nelems] = ndx; - if (i == 0) + if (i == 0) { cyclic_downheap(cpu, 0); - else { + } else { if (cyclic_upheap(cpu, i) == 0) { /* * The upheap didn't propagate to the root; if it * didn't propagate at all, we need to downheap. */ - if (heap[i] == last) + if (heap[i] == last) { cyclic_downheap(cpu, i); - goto done; + } + goto out; } } @@ -856,10 +839,27 @@ cyclic_remove_here(cyc_cpu_t *cpu, cyc_i cyclic = &cpu->cyp_cyclics[heap[0]]; ASSERT(nelems != 0); - cyclic_reprogram(cpu, cyclic->cy_expire); - -done: + be->cyb_reprogram(bar, cyclic->cy_expire); +out: mtx_unlock_spin(&cpu->cyp_mtx); +} + +static int +cyclic_remove_here(cyc_cpu_t *cpu, cyc_index_t ndx, cyc_time_t *when, int wait) +{ + cyc_backend_t *be = cpu->cyp_backend; + cyc_xcallarg_t arg; + + ASSERT(MUTEX_HELD(&cpu_lock)); + ASSERT(wait == CY_WAIT || wait == CY_NOWAIT); + + arg.cyx_ndx = ndx; + arg.cyx_cpu = cpu; + arg.cyx_when = when; + arg.cyx_wait = wait; + + be->cyb_xcall(be->cyb_arg, cpu->cyp_cpu, + (cyc_func_t)cyclic_remove_xcall, &arg); return (1); } @@ -1216,15 +1216,10 @@ cyclic_add_omni(cyc_omni_handler_t *omni idp->cyi_omni_hdlr = *omni; - for (i = 0; i < MAXCPU; i++) { - if (pcpu_find(i) == NULL) - continue; - + CPU_FOREACH(i) { c = &solaris_cpu[i]; - if ((cpu = c->cpu_cyclic) == NULL) continue; - cyclic_omni_start(idp, cpu); } @@ -1327,12 +1322,8 @@ cyclic_mp_init(void) mutex_enter(&cpu_lock); - for (i = 0; i <= mp_maxid; i++) { - if (pcpu_find(i) == NULL) - continue; - + CPU_FOREACH(i) { c = &solaris_cpu[i]; - if (c->cpu_cyclic == NULL) cyclic_configure(c); } @@ -1346,15 +1337,10 @@ cyclic_uninit(void) cpu_t *c; int id; - for (id = 0; id <= mp_maxid; id++) { - if (pcpu_find(id) == NULL) - continue; - + CPU_FOREACH(id) { c = &solaris_cpu[id]; - if (c->cpu_cyclic == NULL) continue; - cyclic_unconfigure(c); } Index: src/external/cddl/osnet/dev/cyclic/i386/cyclic_machdep.c diff -u src/external/cddl/osnet/dev/cyclic/i386/cyclic_machdep.c:1.2 src/external/cddl/osnet/dev/cyclic/i386/cyclic_machdep.c:1.3 --- src/external/cddl/osnet/dev/cyclic/i386/cyclic_machdep.c:1.2 Sun Feb 21 01:46:33 2010 +++ src/external/cddl/osnet/dev/cyclic/i386/cyclic_machdep.c Sun Dec 2 00:05:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cyclic_machdep.c,v 1.2 2010/02/21 01:46:33 darran Exp $ */ +/* $NetBSD: cyclic_machdep.c,v 1.3 2012/12/02 00:05:38 chs Exp $ */ /*- * Copyright 2006-2008 John Birrell <j...@freebsd.org> @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/cddl/dev/cyclic/i386/cyclic_machdep.c,v 1.1.4.1 2009/08/03 08:13:06 kensmith Exp $ + * $FreeBSD$ * */ @@ -69,7 +69,7 @@ cyclic_machdep_uninit(void) for (i = 0; i <= mp_maxid; i++) /* Reset the cyclic clock callback hook. */ - lapic_cyclic_clock_func[i] = NULL; + cyclic_clock_func[i] = NULL; /* De-register the cyclic backend. */ cyclic_uninit(); @@ -107,13 +107,13 @@ cyclic_clock(struct trapframe *frame) static void enable(cyb_arg_t arg) { /* Register the cyclic clock callback function. */ - lapic_cyclic_clock_func[curcpu] = cyclic_clock; + cyclic_clock_func[curcpu] = cyclic_clock; } static void disable(cyb_arg_t arg) { /* Reset the cyclic clock callback function. */ - lapic_cyclic_clock_func[curcpu] = NULL; + cyclic_clock_func[curcpu] = NULL; } static void reprogram(cyb_arg_t arg, hrtime_t exp) @@ -123,13 +123,7 @@ static void reprogram(cyb_arg_t arg, hrt static void xcall(cyb_arg_t arg, cpu_t *c, cyc_func_t func, void *param) { - /* - * If the target CPU is the current one, just call the - * function. This covers the non-SMP case. - */ - if (c == &solaris_cpu[curcpu]) - (*func)(param); - else - smp_rendezvous_cpus((cpumask_t) (1 << c->cpuid), NULL, - func, smp_no_rendevous_barrier, param); + + smp_rendezvous_cpus((cpumask_t) (1 << c->cpuid), + smp_no_rendevous_barrier, func, smp_no_rendevous_barrier, param); } Index: src/external/cddl/osnet/sys/sys/cyclic.h diff -u src/external/cddl/osnet/sys/sys/cyclic.h:1.3 src/external/cddl/osnet/sys/sys/cyclic.h:1.4 --- src/external/cddl/osnet/sys/sys/cyclic.h:1.3 Sun Feb 21 01:46:35 2010 +++ src/external/cddl/osnet/sys/sys/cyclic.h Sun Dec 2 00:05:39 2012 @@ -1,33 +1,33 @@ -/* $NetBSD: cyclic.h,v 1.3 2010/02/21 01:46:35 darran Exp $ */ +/* $NetBSD: cyclic.h,v 1.4 2012/12/02 00:05:39 chs Exp $ */ /* - * Copyright (C) 2007 John Birrell <j...@freebsd.org> - * 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 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 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. + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END * - * $FreeBSD: src/sys/compat/opensolaris/sys/cyclic.h,v 1.1 2007/11/28 21:50:40 jb Exp $ + * $FreeBSD$ * */ +/* + * Copyright (c) 1999-2001 by Sun Microsystems, Inc. + * All rights reserved. + */ #ifndef _COMPAT_OPENSOLARIS_SYS_CYCLIC_H_ #define _COMPAT_OPENSOLARIS_SYS_CYCLIC_H_ @@ -36,6 +36,46 @@ typedef void cpu_t; #endif -#include_next <sys/cyclic.h> + +#ifndef _ASM +#include <sys/time.h> +#include <sys/cpuvar.h> +#endif /* !_ASM */ + +#ifndef _ASM + +typedef uintptr_t cyclic_id_t; +typedef int cyc_index_t; +typedef uint16_t cyc_level_t; +typedef void (*cyc_func_t)(void *); +typedef void *cyb_arg_t; + +#define CYCLIC_NONE ((cyclic_id_t)0) + +typedef struct cyc_handler { + cyc_func_t cyh_func; + void *cyh_arg; +} cyc_handler_t; + +typedef struct cyc_time { + hrtime_t cyt_when; + hrtime_t cyt_interval; +} cyc_time_t; + +typedef struct cyc_omni_handler { + void (*cyo_online)(void *, cpu_t *, cyc_handler_t *, cyc_time_t *); + void (*cyo_offline)(void *, cpu_t *, void *); + void *cyo_arg; +} cyc_omni_handler_t; + +#ifdef _KERNEL + +cyclic_id_t cyclic_add(cyc_handler_t *, cyc_time_t *); +cyclic_id_t cyclic_add_omni(cyc_omni_handler_t *); +void cyclic_remove(cyclic_id_t); + +#endif /* _KERNEL */ + +#endif /* !_ASM */ #endif Index: src/external/cddl/osnet/sys/sys/cyclic_impl.h diff -u src/external/cddl/osnet/sys/sys/cyclic_impl.h:1.2 src/external/cddl/osnet/sys/sys/cyclic_impl.h:1.3 --- src/external/cddl/osnet/sys/sys/cyclic_impl.h:1.2 Sun Feb 21 01:46:35 2010 +++ src/external/cddl/osnet/sys/sys/cyclic_impl.h Sun Dec 2 00:05:39 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cyclic_impl.h,v 1.2 2010/02/21 01:46:35 darran Exp $ */ +/* $NetBSD: cyclic_impl.h,v 1.3 2012/12/02 00:05:39 chs Exp $ */ /* * CDDL HEADER START @@ -21,7 +21,7 @@ * * CDDL HEADER END * - * $FreeBSD: src/sys/cddl/compat/opensolaris/sys/cyclic_impl.h,v 1.1.4.1 2009/08/03 08:13:06 kensmith Exp $ + * $FreeBSD$ * */ /* @@ -290,7 +290,14 @@ typedef struct cyc_id { typedef struct cyc_xcallarg { cyc_cpu_t *cyx_cpu; - hrtime_t cyx_exp; + cyc_handler_t *cyx_hdlr; + cyc_time_t *cyx_when; + cyc_index_t cyx_ndx; + cyc_index_t *cyx_heap; + cyclic_t *cyx_cyclics; + cyc_index_t cyx_size; + uint16_t cyx_flags; + int cyx_wait; } cyc_xcallarg_t; #define CY_DEFAULT_PERCPU 1 Index: src/sys/sys/dtrace_bsd.h diff -u src/sys/sys/dtrace_bsd.h:1.5 src/sys/sys/dtrace_bsd.h:1.6 --- src/sys/sys/dtrace_bsd.h:1.5 Mon Jan 30 23:31:27 2012 +++ src/sys/sys/dtrace_bsd.h Sun Dec 2 00:05:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: dtrace_bsd.h,v 1.5 2012/01/30 23:31:27 matt Exp $ */ +/* $NetBSD: dtrace_bsd.h,v 1.6 2012/12/02 00:05:38 chs Exp $ */ /*- * Copyright (c) 2007-2008 John Birrell (j...@freebsd.org) @@ -63,7 +63,7 @@ typedef void (*cyclic_clock_func_t)(stru * * Defining them here avoids a proliferation of header files. */ -extern cyclic_clock_func_t lapic_cyclic_clock_func[]; +extern cyclic_clock_func_t cyclic_clock_func[]; /* * The dtrace module handles traps that occur during a DTrace probe.