Home | History | Annotate | Download | only in platform-cpu
      1 /*
      2  * CDDL HEADER START
      3  *
      4  * The contents of this file are subject to the terms of the
      5  * Common Development and Distribution License (the "License").
      6  * You may not use this file except in compliance with the License.
      7  *
      8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9  * or http://www.opensolaris.org/os/licensing.
     10  * See the License for the specific language governing permissions
     11  * and limitations under the License.
     12  *
     13  * When distributing Covered Code, include this CDDL HEADER in each
     14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15  * If applicable, add the following below this CDDL HEADER, with the
     16  * fields enclosed by brackets "[]" replaced with your own identifying
     17  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  *
     19  * CDDL HEADER END
     20  */
     21 
     22 /*
     23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
     24  * Use is subject to license terms.
     25  */
     26 
     27 #ifndef	_CPU_MDESC_H
     28 #define	_CPU_MDESC_H
     29 
     30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
     31 
     32 #include <fm/topo_mod.h>
     33 
     34 #ifdef	__cplusplus
     35 extern "C" {
     36 #endif
     37 
     38 /*
     39  * Node/Field names in the PRI/MD
     40  */
     41 #define	MD_STR_ID		"id"
     42 #define	MD_STR_PID		"pid"
     43 #define	MD_STR_CPU_SERIAL	"serial#"
     44 #define	MD_STR_CPU		"cpu"
     45 #define	MD_STR_COMPONENT	"component"
     46 #define	MD_STR_TYPE		"type"
     47 #define	MD_STR_PROCESSOR	"processor"
     48 #define	MD_STR_STRAND		"strand"
     49 #define	MD_STR_FRU		"fru"
     50 #define	MD_STR_NAC		"nac"
     51 #define	MD_STR_SERIAL		"serial_number"
     52 #define	MD_STR_PART		"part_number"
     53 #define	MD_STR_DASH		"dash_number"
     54 
     55 #define	MD_FRU_DEF		"MB"
     56 #define	MD_STR_BLANK		""
     57 
     58 typedef struct md_cpumap {
     59 	uint32_t cpumap_id;		/* virtual cpuid/strandid */
     60 	uint32_t cpumap_pid;		/* physical cpuid/strandid */
     61 	uint64_t cpumap_serialno;	/* cpu serial number */
     62 	int cpumap_chipidx;		/* chip idx */
     63 } md_cpumap_t;
     64 
     65 typedef struct md_fru {
     66 	char *nac;			/* FRU or nac */
     67 	char *serial;			/* FRU serial */
     68 	char *part;			/* FRU part number */
     69 	char *dash;			/* FRU dash */
     70 } md_fru_t;
     71 
     72 typedef struct md_proc {
     73 	int32_t id;			/* physiscal id of the CMP processor */
     74 	uint64_t serialno;		/* processor serial number */
     75 	md_fru_t *fru;			/* FRU info */
     76 } md_proc_t;
     77 
     78 typedef struct md_info {
     79 	md_proc_t *procs;		/* list of processors */
     80 	uint32_t nprocs;		/* size */
     81 	md_cpumap_t *cpus;		/* List of cpu maps */
     82 	uint32_t ncpus;			/* size */
     83 } md_info_t;
     84 
     85 
     86 extern int cpu_mdesc_init(topo_mod_t *mod, md_info_t *chip);
     87 extern void cpu_mdesc_fini(topo_mod_t *mod, md_info_t *chip);
     88 
     89 extern int cpu_get_serialid_mdesc(md_info_t *chip, uint32_t cpuid,
     90 					uint64_t *serialno);
     91 extern md_cpumap_t *cpu_find_cpumap(md_info_t *chip, uint32_t cpuid);
     92 extern md_proc_t *cpu_find_proc(md_info_t *chip, uint32_t procid);
     93 
     94 #ifdef __cplusplus
     95 }
     96 #endif
     97 
     98 #endif	/* _CPU_MDESC_H */
     99