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
5ab761399Sesaxe  * Common Development and Distribution License (the "License").
6ab761399Sesaxe  * 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 /*
22ab761399Sesaxe  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #pragma D depends_on module unix
277c478bd9Sstevel@tonic-gate #pragma D depends_on provider sched
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate struct cpuinfo {
307c478bd9Sstevel@tonic-gate 	processorid_t cpu_id;		/* CPU identifier */
317c478bd9Sstevel@tonic-gate 	psetid_t cpu_pset;		/* processor set identifier */
327c478bd9Sstevel@tonic-gate 	chipid_t cpu_chip;		/* chip identifier */
337c478bd9Sstevel@tonic-gate 	lgrp_id_t cpu_lgrp;		/* locality group identifer */
347c478bd9Sstevel@tonic-gate 	processor_info_t cpu_info;	/* CPU information */
357c478bd9Sstevel@tonic-gate };
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate typedef struct cpuinfo cpuinfo_t;
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate translator cpuinfo_t < cpu_t *C > {
407c478bd9Sstevel@tonic-gate 	cpu_id = C->cpu_id;
417c478bd9Sstevel@tonic-gate 	cpu_pset = C->cpu_part->cp_id;
42ab761399Sesaxe 	cpu_chip = C->cpu_physid->cpu_chipid;
43ab761399Sesaxe 	cpu_lgrp = C->cpu_lpl->lpl_lgrpid;
447c478bd9Sstevel@tonic-gate 	cpu_info = (processor_info_t)C->cpu_type_info;
45*1da57d55SToomas Soome };
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate translator cpuinfo_t < disp_t *D > {
487c478bd9Sstevel@tonic-gate 	cpu_id = D->disp_cpu == NULL ? -1 :
497c478bd9Sstevel@tonic-gate 	    xlate <cpuinfo_t> (D->disp_cpu).cpu_id;
507c478bd9Sstevel@tonic-gate 	cpu_pset = D->disp_cpu == NULL ? -1 :
517c478bd9Sstevel@tonic-gate 	    xlate <cpuinfo_t> (D->disp_cpu).cpu_pset;
527c478bd9Sstevel@tonic-gate 	cpu_chip = D->disp_cpu == NULL ? -1 :
537c478bd9Sstevel@tonic-gate 	    xlate <cpuinfo_t> (D->disp_cpu).cpu_chip;
547c478bd9Sstevel@tonic-gate 	cpu_lgrp = D->disp_cpu == NULL ? -1 :
557c478bd9Sstevel@tonic-gate 	    xlate <cpuinfo_t> (D->disp_cpu).cpu_lgrp;
567c478bd9Sstevel@tonic-gate 	cpu_info = D->disp_cpu == NULL ?
577c478bd9Sstevel@tonic-gate 	    *((processor_info_t *)dtrace`dtrace_zero) :
587c478bd9Sstevel@tonic-gate 	    (processor_info_t)xlate <cpuinfo_t> (D->disp_cpu).cpu_info;
597c478bd9Sstevel@tonic-gate };
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate inline cpuinfo_t *curcpu = xlate <cpuinfo_t *> (curthread->t_cpu);
627c478bd9Sstevel@tonic-gate #pragma D attributes Stable/Stable/Common curcpu
637c478bd9Sstevel@tonic-gate #pragma D binding "1.0" curcpu
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate inline processorid_t cpu = curcpu->cpu_id;
667c478bd9Sstevel@tonic-gate #pragma D attributes Stable/Stable/Common cpu
677c478bd9Sstevel@tonic-gate #pragma D binding "1.0" cpu
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate inline psetid_t pset = curcpu->cpu_pset;
707c478bd9Sstevel@tonic-gate #pragma D attributes Stable/Stable/Common pset
717c478bd9Sstevel@tonic-gate #pragma D binding "1.0" pset
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate inline chipid_t chip = curcpu->cpu_chip;
747c478bd9Sstevel@tonic-gate #pragma D attributes Stable/Stable/Common chip
757c478bd9Sstevel@tonic-gate #pragma D binding "1.0" chip
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate inline lgrp_id_t lgrp = curcpu->cpu_lgrp;
787c478bd9Sstevel@tonic-gate #pragma D attributes Stable/Stable/Common lgrp
797c478bd9Sstevel@tonic-gate #pragma D binding "1.0" lgrp
807c478bd9Sstevel@tonic-gate 
81