chip.h revision 7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fe
/*
* 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
* 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
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _CHIP_H
#define _CHIP_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* generic kernel CMT processor support
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/processor.h>
/*
* Chip types
*/
typedef enum chip_type {
CHIP_DEFAULT, /* Default, non CMT processor */
CHIP_SMT, /* SMT, single core */
CHIP_CMP_SPLIT_CACHE, /* CMP with split caches */
CHIP_CMP_SHARED_CACHE, /* CMP with shared caches */
CHIP_CMT, /* CMT w/ multiple cores and threads */
} chip_type_t;
/*
* Balancing is possible if multiple chips exist in the lgroup
* but only necessary if the chip has multiple online logical CPUs
*/
#define CHIP_SHOULD_BALANCE(chp) \
/*
* Platform's definition of a chip's properties
*/
typedef struct chip_def {
int chipd_rechoose_adj;
} chip_def_t;
/*
* Per chip kstats
*/
typedef enum chip_stat_types {
CHIP_ID, /* chip "id" */
CHIP_NCPUS, /* number of active cpus */
CHIP_NRUNNING, /* number of running threads on chip */
CHIP_RECHOOSE, /* chip's rechoose_interval */
CHIP_NUM_STATS /* always last */
} chip_stat_t;
#define CHIP_KSTAT_NAMES \
static char *chip_kstat_names[] = { \
\
"chip_id", \
"logical_cpus", \
"chip_nrunning", \
"chip_rechoose_interval", \
}
/*
* Physical processor (chip) structure.
*/
typedef struct chip {
int chip_rechoose_adj; /* chip specific adjustment */
/*
* chip kstats
*/
} chip_t;
/*
* Change the number of running threads on the chip
*/
#define CHIP_NRUNNING(chp, n) { \
}
/*
* True if this CPU is active on the chip
*/
/*
* Sets of chips
* The "id" used here should be a chip's sequential id.
* (chip_seqid)
*/
#if defined(_MACHDEP)
#define CHIP_MAX_CHIPS NCPU
typedef struct chip_set {
} chip_set_t;
extern int chip_set_isnull(chip_set_t *);
#define CHIP_SET_ZERO(set) { \
int _i; \
}
#endif /* _MACHDEP */
/*
* Common kernel chip operations
*/
void chip_cpu_init(cpu_t *);
void chip_cpu_fini(cpu_t *);
void chip_cpu_assign(cpu_t *);
void chip_cpu_unassign(cpu_t *);
void chip_cpu_startup(cpu_t *);
void chip_bootstrap_cpu(cpu_t *);
struct cpupart *);
void chip_kstat_create(chip_t *);
/*
* Platform chip operations
*/
int chip_plat_get_clogid(cpu_t *);
#endif /* !_KERNEL && !_KMEMUSER */
#ifdef __cplusplus
}
#endif
#endif /* _CHIP_H */