processor.h revision 168404
1168404Spjd/* 2168404Spjd * CDDL HEADER START 3168404Spjd * 4168404Spjd * The contents of this file are subject to the terms of the 5168404Spjd * Common Development and Distribution License, Version 1.0 only 6168404Spjd * (the "License"). You may not use this file except in compliance 7168404Spjd * with the License. 8168404Spjd * 9168404Spjd * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10168404Spjd * or http://www.opensolaris.org/os/licensing. 11168404Spjd * See the License for the specific language governing permissions 12168404Spjd * and limitations under the License. 13168404Spjd * 14168404Spjd * When distributing Covered Code, include this CDDL HEADER in each 15168404Spjd * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16168404Spjd * If applicable, add the following below this CDDL HEADER, with the 17168404Spjd * fields enclosed by brackets "[]" replaced with your own identifying 18168404Spjd * information: Portions Copyright [yyyy] [name of copyright owner] 19168404Spjd * 20168404Spjd * CDDL HEADER END 21168404Spjd */ 22168404Spjd/* 23168404Spjd * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T 24168404Spjd * All Rights Reserved 25168404Spjd * 26168404Spjd */ 27168404Spjd 28168404Spjd/* 29168404Spjd * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 30168404Spjd * Use is subject to license terms. 31168404Spjd */ 32168404Spjd 33168404Spjd#ifndef _SYS_PROCESSOR_H 34168404Spjd#define _SYS_PROCESSOR_H 35168404Spjd 36168404Spjd#pragma ident "%Z%%M% %I% %E% SMI" 37168404Spjd 38168404Spjd#include <sys/types.h> 39168404Spjd#include <sys/procset.h> 40168404Spjd 41168404Spjd#ifdef __cplusplus 42168404Spjdextern "C" { 43168404Spjd#endif 44168404Spjd 45168404Spjd/* 46168404Spjd * Definitions for p_online, processor_info & lgrp system calls. 47168404Spjd */ 48168404Spjd 49168404Spjd/* 50168404Spjd * Type for an lgrpid 51168404Spjd */ 52168404Spjdtypedef uint16_t lgrpid_t; 53168404Spjd 54168404Spjd/* 55168404Spjd * Type for processor name (CPU number). 56168404Spjd */ 57168404Spjdtypedef int processorid_t; 58168404Spjdtypedef int chipid_t; 59168404Spjd 60168404Spjd/* 61168404Spjd * Flags and return values for p_online(2), and pi_state for processor_info(2). 62168404Spjd * These flags are *not* for in-kernel examination of CPU states. 63168404Spjd * See <sys/cpuvar.h> for appropriate informational functions. 64168404Spjd */ 65168404Spjd#define P_OFFLINE 0x0001 /* processor is offline, as quiet as possible */ 66168404Spjd#define P_ONLINE 0x0002 /* processor is online */ 67168404Spjd#define P_STATUS 0x0003 /* value passed to p_online to request status */ 68168404Spjd#define P_FAULTED 0x0004 /* processor is offline, in faulted state */ 69168404Spjd#define P_POWEROFF 0x0005 /* processor is powered off */ 70168404Spjd#define P_NOINTR 0x0006 /* processor is online, but no I/O interrupts */ 71168404Spjd#define P_SPARE 0x0007 /* processor is offline, can be reactivated */ 72168404Spjd#define P_BAD P_FAULTED /* unused but defined by USL */ 73168404Spjd#define P_FORCED 0x10000000 /* force processor offline */ 74168404Spjd 75168404Spjd/* 76168404Spjd * String names for processor states defined above. 77168404Spjd */ 78168404Spjd#define PS_OFFLINE "off-line" 79168404Spjd#define PS_ONLINE "on-line" 80168404Spjd#define PS_FAULTED "faulted" 81168404Spjd#define PS_POWEROFF "powered-off" 82168404Spjd#define PS_NOINTR "no-intr" 83168404Spjd#define PS_SPARE "spare" 84168404Spjd 85168404Spjd/* 86168404Spjd * Structure filled in by processor_info(2). 87168404Spjd * 88168404Spjd * The string fields are guaranteed to contain a NULL. 89168404Spjd * 90168404Spjd * The pi_fputypes field contains a (possibly empty) comma-separated 91168404Spjd * list of floating point identifier strings. 92168404Spjd */ 93168404Spjd#define PI_TYPELEN 16 /* max size of CPU type string */ 94168404Spjd#define PI_FPUTYPE 32 /* max size of FPU types string */ 95168404Spjd 96168404Spjdtypedef struct { 97168404Spjd int pi_state; /* processor state, see above */ 98168404Spjd char pi_processor_type[PI_TYPELEN]; /* ASCII CPU type */ 99168404Spjd char pi_fputypes[PI_FPUTYPE]; /* ASCII FPU types */ 100168404Spjd int pi_clock; /* CPU clock freq in MHz */ 101168404Spjd} processor_info_t; 102168404Spjd 103168404Spjd/* 104168404Spjd * Binding values for processor_bind(2) 105168404Spjd */ 106168404Spjd#define PBIND_NONE -1 /* LWP/thread is not bound */ 107168404Spjd#define PBIND_QUERY -2 /* don't set, just return the binding */ 108168404Spjd 109168404Spjd/* 110168404Spjd * User-level system call interface prototypes 111168404Spjd */ 112168404Spjd#ifndef _KERNEL 113168404Spjd#ifdef __STDC__ 114168404Spjd 115168404Spjdextern int p_online(processorid_t processorid, int flag); 116168404Spjdextern int processor_info(processorid_t processorid, 117168404Spjd processor_info_t *infop); 118168404Spjdextern int processor_bind(idtype_t idtype, id_t id, 119168404Spjd processorid_t processorid, processorid_t *obind); 120168404Spjdextern processorid_t getcpuid(void); 121168404Spjdextern lgrpid_t gethomelgroup(void); 122168404Spjd 123168404Spjd#else 124168404Spjd 125168404Spjdextern int p_online(); 126168404Spjdextern int processor_info(); 127168404Spjdextern int processor_bind(); 128168404Spjdextern processorid_t getcpuid(); 129168404Spjdextern lgrpid_t gethomelgroup(); 130168404Spjd 131168404Spjd#endif /* __STDC__ */ 132168404Spjd 133168404Spjd#else /* _KERNEL */ 134168404Spjd 135168404Spjd/* 136168404Spjd * Internal interface prototypes 137168404Spjd */ 138168404Spjdextern int p_online_internal(processorid_t, int, int *); 139168404Spjd 140168404Spjd#endif /* !_KERNEL */ 141168404Spjd 142168404Spjd#ifdef __cplusplus 143168404Spjd} 144168404Spjd#endif 145168404Spjd 146168404Spjd#endif /* _SYS_PROCESSOR_H */ 147