fru_access_impl.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _FRU_ACCESS_IMPL_H
#define _FRU_ACCESS_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#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 <picl.h>
#include <picltree.h>
#include <syslog.h>
#include <errno.h>
#include <limits.h>
#include "picldefs.h"
#include "libfru.h"
#include "fru_tag.h"
#include "fru_access.h"
/* converts slot# to ipmb addr */
#define SEG_NAME_LEN 2
#define MANR_TIME_LEN 4
#define MANR_FRUDESCR_LEN 80
#define MANR_MFRLOC_LEN 64
#define MANR_PARTNUM_LEN 7
#define MANR_SERIALNUM_LEN 6
#define MANR_VENDORNAME_LEN 2
#define MANR_DASHLVL_LEN 2
#define MANR_REVLVL_LEN 2
#define MANR_FRUNAME_LEN 16
#define NO_FRUDATA 0x0
#define IPMI_FORMAT 0x1
#define SUN_FORMAT 0x2
/* These are newly introduced #defines for Snowbird */
#define INPUT_FILE "/dev/ctsmc"
#define NUM_OF_SECTIONS 2
#define DYNAMIC_OFFSET 0x0
#define STATIC_OFFSET 0x1800
#define WRITE_SECTION 0
#define PICL_SLOT_CPCI "cpci"
#define PICL_SLOT_PCI "pci"
#define PICL_NODE_CHASSIS "chassis"
#define SD_SEGMENT_NAME "SD"
#define SD_SEGMENT_DESCRIPTOR 0x00004924
#define SEGMENT_TRAILER_LEN 1
#define SEGMENT_CHKSM_LEN 4
/* format structure */
typedef struct {
int format;
int sun_lun; /* this info comes from SDR */
int sun_device_id; /* this info comes from SDR */
} format_t;
/* ManR payload structure */
typedef struct {
char timestamp[MANR_TIME_LEN];
char fru_descr[MANR_FRUDESCR_LEN];
char manufacture_loc[MANR_MFRLOC_LEN];
char sun_part_no[MANR_PARTNUM_LEN];
char sun_serial_no[MANR_SERIALNUM_LEN];
char inital_hw_rev_lvl[MANR_REVLVL_LEN];
char fru_short_name[MANR_FRUNAME_LEN];
} payload_t;
/* 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
#define DEFAULT_FD -1
#define DEFAULT_SEQN -1
#define FRUACCESS_MSG_ID 11
typedef union {
struct {
unsigned read_only : 1;
unsigned unused : 8;
unsigned : 8;
unsigned : 8;
unsigned : 7;
} field;
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 */
/* contianer 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 */