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