10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 54667Smh27603 * Common Development and Distribution License (the "License"). 64667Smh27603 * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 220Sstevel@tonic-gate * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T 230Sstevel@tonic-gate * All Rights Reserved 240Sstevel@tonic-gate * 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate /* 286298Sakolb * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 290Sstevel@tonic-gate * Use is subject to license terms. 300Sstevel@tonic-gate */ 310Sstevel@tonic-gate 320Sstevel@tonic-gate #ifndef _SYS_PROCESSOR_H 330Sstevel@tonic-gate #define _SYS_PROCESSOR_H 340Sstevel@tonic-gate 350Sstevel@tonic-gate #include <sys/types.h> 360Sstevel@tonic-gate #include <sys/procset.h> 370Sstevel@tonic-gate 380Sstevel@tonic-gate #ifdef __cplusplus 390Sstevel@tonic-gate extern "C" { 400Sstevel@tonic-gate #endif 410Sstevel@tonic-gate 420Sstevel@tonic-gate /* 430Sstevel@tonic-gate * Definitions for p_online, processor_info & lgrp system calls. 440Sstevel@tonic-gate */ 450Sstevel@tonic-gate 460Sstevel@tonic-gate /* 470Sstevel@tonic-gate * Type for an lgrpid 480Sstevel@tonic-gate */ 490Sstevel@tonic-gate typedef uint16_t lgrpid_t; 500Sstevel@tonic-gate 510Sstevel@tonic-gate /* 520Sstevel@tonic-gate * Type for processor name (CPU number). 530Sstevel@tonic-gate */ 540Sstevel@tonic-gate typedef int processorid_t; 550Sstevel@tonic-gate typedef int chipid_t; 560Sstevel@tonic-gate 570Sstevel@tonic-gate /* 580Sstevel@tonic-gate * Flags and return values for p_online(2), and pi_state for processor_info(2). 590Sstevel@tonic-gate * These flags are *not* for in-kernel examination of CPU states. 600Sstevel@tonic-gate * See <sys/cpuvar.h> for appropriate informational functions. 610Sstevel@tonic-gate */ 620Sstevel@tonic-gate #define P_OFFLINE 0x0001 /* processor is offline, as quiet as possible */ 630Sstevel@tonic-gate #define P_ONLINE 0x0002 /* processor is online */ 640Sstevel@tonic-gate #define P_STATUS 0x0003 /* value passed to p_online to request status */ 650Sstevel@tonic-gate #define P_FAULTED 0x0004 /* processor is offline, in faulted state */ 660Sstevel@tonic-gate #define P_POWEROFF 0x0005 /* processor is powered off */ 670Sstevel@tonic-gate #define P_NOINTR 0x0006 /* processor is online, but no I/O interrupts */ 680Sstevel@tonic-gate #define P_SPARE 0x0007 /* processor is offline, can be reactivated */ 690Sstevel@tonic-gate #define P_BAD P_FAULTED /* unused but defined by USL */ 700Sstevel@tonic-gate #define P_FORCED 0x10000000 /* force processor offline */ 710Sstevel@tonic-gate 720Sstevel@tonic-gate /* 730Sstevel@tonic-gate * String names for processor states defined above. 740Sstevel@tonic-gate */ 750Sstevel@tonic-gate #define PS_OFFLINE "off-line" 760Sstevel@tonic-gate #define PS_ONLINE "on-line" 770Sstevel@tonic-gate #define PS_FAULTED "faulted" 780Sstevel@tonic-gate #define PS_POWEROFF "powered-off" 790Sstevel@tonic-gate #define PS_NOINTR "no-intr" 800Sstevel@tonic-gate #define PS_SPARE "spare" 810Sstevel@tonic-gate 820Sstevel@tonic-gate /* 834718Smh27603 * Structure filled in by processor_info(2). This structure 844718Smh27603 * SHOULD NOT BE MODIFIED. Changes to the structure would 854718Smh27603 * negate ABI compatibility. 860Sstevel@tonic-gate * 870Sstevel@tonic-gate * The string fields are guaranteed to contain a NULL. 880Sstevel@tonic-gate * 890Sstevel@tonic-gate * The pi_fputypes field contains a (possibly empty) comma-separated 900Sstevel@tonic-gate * list of floating point identifier strings. 910Sstevel@tonic-gate */ 920Sstevel@tonic-gate #define PI_TYPELEN 16 /* max size of CPU type string */ 930Sstevel@tonic-gate #define PI_FPUTYPE 32 /* max size of FPU types string */ 940Sstevel@tonic-gate 950Sstevel@tonic-gate typedef struct { 960Sstevel@tonic-gate int pi_state; /* processor state, see above */ 970Sstevel@tonic-gate char pi_processor_type[PI_TYPELEN]; /* ASCII CPU type */ 980Sstevel@tonic-gate char pi_fputypes[PI_FPUTYPE]; /* ASCII FPU types */ 990Sstevel@tonic-gate int pi_clock; /* CPU clock freq in MHz */ 1000Sstevel@tonic-gate } processor_info_t; 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate /* 1030Sstevel@tonic-gate * Binding values for processor_bind(2) 1040Sstevel@tonic-gate */ 1050Sstevel@tonic-gate #define PBIND_NONE -1 /* LWP/thread is not bound */ 1060Sstevel@tonic-gate #define PBIND_QUERY -2 /* don't set, just return the binding */ 1076298Sakolb #define PBIND_HARD -3 /* prevents offlining CPU (default) */ 1086298Sakolb #define PBIND_SOFT -4 /* allows offlining CPU */ 1096298Sakolb #define PBIND_QUERY_TYPE -5 /* Return binding type */ 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate /* 1120Sstevel@tonic-gate * User-level system call interface prototypes 1130Sstevel@tonic-gate */ 1140Sstevel@tonic-gate #ifndef _KERNEL 1150Sstevel@tonic-gate #ifdef __STDC__ 1160Sstevel@tonic-gate 1170Sstevel@tonic-gate extern int p_online(processorid_t processorid, int flag); 1180Sstevel@tonic-gate extern int processor_info(processorid_t processorid, 1190Sstevel@tonic-gate processor_info_t *infop); 1200Sstevel@tonic-gate extern int processor_bind(idtype_t idtype, id_t id, 1210Sstevel@tonic-gate processorid_t processorid, processorid_t *obind); 1220Sstevel@tonic-gate extern processorid_t getcpuid(void); 1230Sstevel@tonic-gate extern lgrpid_t gethomelgroup(void); 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate #else 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate extern int p_online(); 1280Sstevel@tonic-gate extern int processor_info(); 1290Sstevel@tonic-gate extern int processor_bind(); 1300Sstevel@tonic-gate extern processorid_t getcpuid(); 1310Sstevel@tonic-gate extern lgrpid_t gethomelgroup(); 1320Sstevel@tonic-gate 1330Sstevel@tonic-gate #endif /* __STDC__ */ 1340Sstevel@tonic-gate 1350Sstevel@tonic-gate #else /* _KERNEL */ 1360Sstevel@tonic-gate 1370Sstevel@tonic-gate /* 1380Sstevel@tonic-gate * Internal interface prototypes 1390Sstevel@tonic-gate */ 1400Sstevel@tonic-gate extern int p_online_internal(processorid_t, int, int *); 141*12004Sjiang.liu@intel.com extern int p_online_internal_locked(processorid_t, int, int *); 1420Sstevel@tonic-gate 1430Sstevel@tonic-gate #endif /* !_KERNEL */ 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate #ifdef __cplusplus 1460Sstevel@tonic-gate } 1470Sstevel@tonic-gate #endif 1480Sstevel@tonic-gate 1490Sstevel@tonic-gate #endif /* _SYS_PROCESSOR_H */ 150