fru_tag.h revision 6bbe05905a1c10a2703f95fb4912eb14b87f6670
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _FRU_TAG_H
#define _FRU_TAG_H
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_LITTLE_ENDIAN)
typedef union {
unsigned char byte[8];
struct {
unsigned pl_len : 3;
unsigned dense : 4;
unsigned type : 1;
} a;
struct {
unsigned pl_len : 3;
unsigned dense : 11;
unsigned type : 2;
} b;
struct {
unsigned pl_len : 5;
unsigned dense : 8;
unsigned type : 3;
} c;
struct {
unsigned pl_len : 3;
unsigned dense : 17;
unsigned type : 4;
} d;
struct {
unsigned pl_len : 7;
unsigned dense : 12;
unsigned type : 5;
} e;
struct {
unsigned pl_len : 12;
unsigned dense : 14;
unsigned type : 6;
} f;
struct {
unsigned pl_len : 32;
unsigned dense : 9;
unsigned type : 7;
} g;
} fru_tag_t;
#else
typedef union {
char byte[8];
struct {
unsigned type : 1;
unsigned dense : 4;
unsigned pl_len : 3;
} a;
struct {
unsigned type : 2;
unsigned dense : 11;
unsigned pl_len : 3;
} b;
struct {
unsigned type : 3;
unsigned dense : 8;
unsigned pl_len : 5;
} c;
struct {
unsigned type : 4;
unsigned dense : 17;
unsigned pl_len : 3;
} d;
struct {
unsigned type : 5;
unsigned dense : 12;
unsigned pl_len : 7;
} e;
struct {
unsigned type : 6;
unsigned dense : 14;
unsigned pl_len : 12;
} f;
struct {
unsigned type : 7;
unsigned dense : 9;
unsigned pl_len : 32;
} g;
} fru_tag_t;
#endif /* LITTLE_ENDIAN */
#define FRU_ID_MASK 0xFF
#define FRU_A_ID 0x00
#define FRU_B_ID 0x02
#define FRU_C_ID 0x06
#define FRU_D_ID 0x0E
#define FRU_E_ID 0x1E
#define FRU_F_ID 0x3E
#define FRU_G_ID 0x7E
char *get_tagtype_str(fru_tagtype_t e);
/* Returns -1 on error */
/* Returns 1 if equal, 0 if not */
#ifdef __cplusplus
}
#endif
#endif /* _FRU_TAG_H */