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, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22/* 23 * Copyright (c) 2000-2001 by Sun Microsystems, Inc. 24 * All rights reserved. 25 */ 26 27 28#ifndef _FRU_DATA_IMPL_H 29#define _FRU_DATA_IMPL_H 30 31#pragma ident "%Z%%M% %I% %E% SMI" 32 33#ifdef __cplusplus 34extern "C" { 35#endif 36 37#include <dlfcn.h> 38#include <errno.h> 39#include <fcntl.h> 40#include <stdio.h> 41#include <string.h> 42#include <stdlib.h> 43#include <strings.h> 44#include "libfru.h" 45#include "picldefs.h" 46#include "fru_access.h" 47 48#define TABLE_SIZE 64 /* hash table size */ 49 50#define NUM_OF_COL_IN_PKT_TABLE 2 51 52#define FRUTREE_PATH "/frutree" /* picltree path of frutree node */ 53 54#define FRUDATA_CONFFILE_NAME \ 55 "/usr/platform/%s/lib/picl/plugins/libpiclfrudata.conf" 56 57#define SECNAMESIZE 10 /* section name length */ 58 59typedef enum {CONTAINER_NODE, SECTION_NODE, SEGMENT_NODE, PACKET_NODE} node_t; 60 61typedef uint64_t fru_access_hdl_t; 62 63struct hash_obj; 64 65typedef struct { 66 fru_access_hdl_t pkt_handle; /* fru access handle */ 67 size_t paylen; /* payload length */ 68 fru_tag_t tag; 69 struct hash_obj *next; 70} packet_node_t; 71 72typedef struct { 73 fru_access_hdl_t segment_hdl; /* fru_access handle */ 74 picl_nodehdl_t sec_nodehdl; /* section node handle */ 75 int num_of_pkt; /* number of packet */ 76 struct hash_obj *packet_list; 77 struct hash_obj *next; 78} segment_node_t; 79 80typedef struct { 81 fru_access_hdl_t section_hdl; /* fru_access handle */ 82 picl_nodehdl_t container_hdl; /* container node hdl. */ 83 int num_of_segment; /* number of segment */ 84 struct hash_obj *segment_list; 85 struct hash_obj *next; 86} section_node_t; 87 88typedef struct { 89 fru_access_hdl_t cont_hdl; /* fru_access handle */ 90 int num_of_section; /* number of section */ 91 struct hash_obj *section_list; 92} container_node_t; 93 94typedef struct hash_obj { 95 uint64_t picl_hdl; /* picl node/property handle */ 96 node_t object_type; 97 union { 98 container_node_t *cont_node; /* container */ 99 section_node_t *sec_node; /* section */ 100 segment_node_t *seg_node; /* segment */ 101 packet_node_t *pkt_node; /* packet */ 102 } u; 103 struct hash_obj *next; 104 struct hash_obj *prev; 105} hash_obj_t; 106 107typedef struct container_tbl { 108 uint64_t picl_hdl; 109 pthread_rwlock_t rwlock; 110 pthread_cond_t cond_var; 111 hash_obj_t *hash_obj; 112 struct container_tbl *next; 113 struct container_tbl *prev; 114} container_tbl_t; 115 116#ifdef __cplusplus 117} 118#endif 119 120#endif /* _FRU_DATA_IMPL_H */ 121