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*ab761399Sesaxe * Common Development and Distribution License (the "License"). 6*ab761399Sesaxe * 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*ab761399Sesaxe * 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 ident "%Z%%M% %I% %E% SMI" 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate #pragma D depends_on module unix 297c478bd9Sstevel@tonic-gate #pragma D depends_on provider sched 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate struct cpuinfo { 327c478bd9Sstevel@tonic-gate processorid_t cpu_id; /* CPU identifier */ 337c478bd9Sstevel@tonic-gate psetid_t cpu_pset; /* processor set identifier */ 347c478bd9Sstevel@tonic-gate chipid_t cpu_chip; /* chip identifier */ 357c478bd9Sstevel@tonic-gate lgrp_id_t cpu_lgrp; /* locality group identifer */ 367c478bd9Sstevel@tonic-gate processor_info_t cpu_info; /* CPU information */ 377c478bd9Sstevel@tonic-gate }; 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate typedef struct cpuinfo cpuinfo_t; 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate translator cpuinfo_t < cpu_t *C > { 427c478bd9Sstevel@tonic-gate cpu_id = C->cpu_id; 437c478bd9Sstevel@tonic-gate cpu_pset = C->cpu_part->cp_id; 44*ab761399Sesaxe cpu_chip = C->cpu_physid->cpu_chipid; 45*ab761399Sesaxe cpu_lgrp = C->cpu_lpl->lpl_lgrpid; 467c478bd9Sstevel@tonic-gate cpu_info = (processor_info_t)C->cpu_type_info; 477c478bd9Sstevel@tonic-gate }; 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate translator cpuinfo_t < disp_t *D > { 507c478bd9Sstevel@tonic-gate cpu_id = D->disp_cpu == NULL ? -1 : 517c478bd9Sstevel@tonic-gate xlate <cpuinfo_t> (D->disp_cpu).cpu_id; 527c478bd9Sstevel@tonic-gate cpu_pset = D->disp_cpu == NULL ? -1 : 537c478bd9Sstevel@tonic-gate xlate <cpuinfo_t> (D->disp_cpu).cpu_pset; 547c478bd9Sstevel@tonic-gate cpu_chip = D->disp_cpu == NULL ? -1 : 557c478bd9Sstevel@tonic-gate xlate <cpuinfo_t> (D->disp_cpu).cpu_chip; 567c478bd9Sstevel@tonic-gate cpu_lgrp = D->disp_cpu == NULL ? -1 : 577c478bd9Sstevel@tonic-gate xlate <cpuinfo_t> (D->disp_cpu).cpu_lgrp; 587c478bd9Sstevel@tonic-gate cpu_info = D->disp_cpu == NULL ? 597c478bd9Sstevel@tonic-gate *((processor_info_t *)dtrace`dtrace_zero) : 607c478bd9Sstevel@tonic-gate (processor_info_t)xlate <cpuinfo_t> (D->disp_cpu).cpu_info; 617c478bd9Sstevel@tonic-gate }; 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate inline cpuinfo_t *curcpu = xlate <cpuinfo_t *> (curthread->t_cpu); 647c478bd9Sstevel@tonic-gate #pragma D attributes Stable/Stable/Common curcpu 657c478bd9Sstevel@tonic-gate #pragma D binding "1.0" curcpu 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate inline processorid_t cpu = curcpu->cpu_id; 687c478bd9Sstevel@tonic-gate #pragma D attributes Stable/Stable/Common cpu 697c478bd9Sstevel@tonic-gate #pragma D binding "1.0" cpu 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate inline psetid_t pset = curcpu->cpu_pset; 727c478bd9Sstevel@tonic-gate #pragma D attributes Stable/Stable/Common pset 737c478bd9Sstevel@tonic-gate #pragma D binding "1.0" pset 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate inline chipid_t chip = curcpu->cpu_chip; 767c478bd9Sstevel@tonic-gate #pragma D attributes Stable/Stable/Common chip 777c478bd9Sstevel@tonic-gate #pragma D binding "1.0" chip 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate inline lgrp_id_t lgrp = curcpu->cpu_lgrp; 807c478bd9Sstevel@tonic-gate #pragma D attributes Stable/Stable/Common lgrp 817c478bd9Sstevel@tonic-gate #pragma D binding "1.0" lgrp 827c478bd9Sstevel@tonic-gate 83