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