17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*87a18d3fSMadhavan Venkataraman * Common Development and Distribution License (the "License"). 6*87a18d3fSMadhavan Venkataraman * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*87a18d3fSMadhavan Venkataraman * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23*87a18d3fSMadhavan Venkataraman * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_CYCLIC_H 277c478bd9Sstevel@tonic-gate #define _SYS_CYCLIC_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifdef __cplusplus 307c478bd9Sstevel@tonic-gate extern "C" { 317c478bd9Sstevel@tonic-gate #endif 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #ifndef _ASM 347c478bd9Sstevel@tonic-gate #include <sys/time.h> 357c478bd9Sstevel@tonic-gate #include <sys/cpuvar.h> 367c478bd9Sstevel@tonic-gate #include <sys/cpupart.h> 377c478bd9Sstevel@tonic-gate #endif /* !_ASM */ 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #define CY_LOW_LEVEL 0 407c478bd9Sstevel@tonic-gate #define CY_LOCK_LEVEL 1 417c478bd9Sstevel@tonic-gate #define CY_HIGH_LEVEL 2 427c478bd9Sstevel@tonic-gate #define CY_SOFT_LEVELS 2 437c478bd9Sstevel@tonic-gate #define CY_LEVELS 3 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate #ifndef _ASM 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate typedef uintptr_t cyclic_id_t; 487c478bd9Sstevel@tonic-gate typedef int cyc_index_t; 497c478bd9Sstevel@tonic-gate typedef int cyc_cookie_t; 507c478bd9Sstevel@tonic-gate typedef uint16_t cyc_level_t; 517c478bd9Sstevel@tonic-gate typedef void (*cyc_func_t)(void *); 527c478bd9Sstevel@tonic-gate typedef void *cyb_arg_t; 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate #define CYCLIC_NONE ((cyclic_id_t)0) 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gate typedef struct cyc_handler { 577c478bd9Sstevel@tonic-gate cyc_func_t cyh_func; 587c478bd9Sstevel@tonic-gate void *cyh_arg; 597c478bd9Sstevel@tonic-gate cyc_level_t cyh_level; 607c478bd9Sstevel@tonic-gate } cyc_handler_t; 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate typedef struct cyc_time { 637c478bd9Sstevel@tonic-gate hrtime_t cyt_when; 647c478bd9Sstevel@tonic-gate hrtime_t cyt_interval; 657c478bd9Sstevel@tonic-gate } cyc_time_t; 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate typedef struct cyc_omni_handler { 687c478bd9Sstevel@tonic-gate void (*cyo_online)(void *, cpu_t *, cyc_handler_t *, cyc_time_t *); 697c478bd9Sstevel@tonic-gate void (*cyo_offline)(void *, cpu_t *, void *); 707c478bd9Sstevel@tonic-gate void *cyo_arg; 717c478bd9Sstevel@tonic-gate } cyc_omni_handler_t; 727c478bd9Sstevel@tonic-gate 73*87a18d3fSMadhavan Venkataraman #define CY_INFINITY INT64_MAX 74*87a18d3fSMadhavan Venkataraman 757c478bd9Sstevel@tonic-gate #ifdef _KERNEL 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate extern cyclic_id_t cyclic_add(cyc_handler_t *, cyc_time_t *); 787c478bd9Sstevel@tonic-gate extern cyclic_id_t cyclic_add_omni(cyc_omni_handler_t *); 797c478bd9Sstevel@tonic-gate extern void cyclic_remove(cyclic_id_t); 807c478bd9Sstevel@tonic-gate extern void cyclic_bind(cyclic_id_t, cpu_t *, cpupart_t *); 81*87a18d3fSMadhavan Venkataraman extern int cyclic_reprogram(cyclic_id_t, hrtime_t); 827c478bd9Sstevel@tonic-gate extern hrtime_t cyclic_getres(); 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate extern int cyclic_offline(cpu_t *cpu); 857c478bd9Sstevel@tonic-gate extern void cyclic_online(cpu_t *cpu); 867c478bd9Sstevel@tonic-gate extern int cyclic_juggle(cpu_t *cpu); 877c478bd9Sstevel@tonic-gate extern void cyclic_move_in(cpu_t *); 887c478bd9Sstevel@tonic-gate extern int cyclic_move_out(cpu_t *); 897c478bd9Sstevel@tonic-gate extern void cyclic_suspend(); 907c478bd9Sstevel@tonic-gate extern void cyclic_resume(); 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate extern void cyclic_fire(cpu_t *cpu); 937c478bd9Sstevel@tonic-gate extern void cyclic_softint(cpu_t *cpu, cyc_level_t level); 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate #endif /* !_ASM */ 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1007c478bd9Sstevel@tonic-gate } 1017c478bd9Sstevel@tonic-gate #endif 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate #endif /* _SYS_CYCLIC_H */ 104