fru_access_impl.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_ACCESS_IMPL_H
#define _FRU_ACCESS_IMPL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <dial.h>
#include <strings.h>
#include <libdevinfo.h>
#include <sys/systeminfo.h>
#include <sys/byteorder.h>
#include <syslog.h>
#include <errno.h>
#include <libfru.h>
#include <limits.h>
#include <fru_tag.h>
#include <fru_access.h>
/* object types */
/* section header */
#define SECTION_HDR_TAG 0x08
#define SECTION_HDR_VER 0x0001
#define SECTION_HDR_LENGTH 0x06
#define SECTION_HDR_CRC8 0x00
#define SECTION_HDR_VER_BIT0 0x00
#define SECTION_HDR_VER_BIT1 0x01
#define GET_SEGMENT_DESCRIPTOR \
#define GET_SECTION_HDR_VERSION \
/* Segment Trailer Tag */
#define SEG_TRAILER_TAG 0x0C
/* defines fixed segment */
#define SEGMENT_FIXED 1
typedef union {
struct {
unsigned read_only : 1;
unsigned unused : 8;
unsigned : 8;
unsigned : 8;
unsigned : 7;
} field;
typedef enum {
ENC_STANDARD = 0, /* proper fruid data */
ENC_SPD /* serial presence detect data */
typedef struct {
typedef uint16_t headerrev_t;
#define MAX_NUMOF_SECTION 2
typedef struct {
int num_sections;
/* section header layout */
typedef struct {
/* segment header layout */
typedef struct {
/* segment information used in finding new offset for a new segment */
typedef struct {
int segnum; /* segment number */
int offset; /* segment offset */
int length; /* segment length */
int fixed; /* fixed or non-fixed segment */
} seg_info_t;
struct hash_obj;
/* packet hash object */
typedef struct {
int tag_size;
} packet_obj_t;
/* segment hash object */
typedef struct {
int num_of_packets; /* in a segment */
int trailer_offset;
/* section hash object */
typedef struct {
int num_of_segment; /* in a section */
/* container hash object */
typedef struct {
int num_of_section; /* num of section in container */
/* hash object */
typedef struct hash_obj {
int object_type;
union {
} u;
} hash_obj_t;
#ifdef __cplusplus
}
#endif
#endif /* _FRU_ACCESS_IMPL_H */