1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
/*
* ipmi_resource.h
*
* Copyright (c) 2004 by FORCE Computers.
* Copyright (c) 2005 by ESO Technologies.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
* file and program are licensed under a BSD style license. See
* the Copying file included with the OpenHPI distribution for
* full licensing terms.
*
* Authors:
* Thomas Kanngieser <thomas.kanngieser@fci.com>
* Pierre Sangouard <psangouard@eso-tech.com>
*/
#ifndef dIpmiResource_h
#define dIpmiResource_h
#ifndef dIpmiSensorHotswap_h
#include "ipmi_sensor_hotswap.h"
#endif
#ifndef dIpmiControl_h
#include "ipmi_control.h"
#endif
#ifndef dArray_h
#include "array.h"
#endif
#ifndef dIpmiCon_h
#include "ipmi_con.h"
#endif
class cIpmiResource : cArray<cIpmiRdr>
{
public:
bool m_sel; // true if this is a resource,
// which provides access to SEL
// find a specific rdr
cIpmiRdr *FindRdr( cIpmiMc *mc, SaHpiRdrTypeT type, unsigned int num, unsigned int lun = 0 );
cIpmiRdr *FindRdr( cIpmiMc *mc, SaHpiRdrTypeT type, cIpmiRdr *rdr );
bool AddRdr( cIpmiRdr *rdr );
bool RemRdr( cIpmiRdr *rdr );
int FindRdr( cIpmiRdr *rdr ) { return Find( rdr ); }
int NumRdr() { return Num(); }
cIpmiRdr *GetRdr( int idx ) { return operator[]( idx ); }
protected:
cIpmiMc *m_mc;
unsigned int m_fru_id;
cIpmiEntityPath m_entity_path;
bool m_is_fru;
cIpmiSensorHotswap *m_hotswap_sensor;
// state only to create state change Mx -> M0
// where Mx is m_picmg_fru_state
tIpmiFruState m_picmg_fru_state;
bool m_policy_canceled;
SaHpiTimeoutT m_extract_timeout;
tIpmiFruState m_prev_prev_fru_state;
unsigned int m_oem;
// mapping of sensor numbers
int m_sensor_num[256];
public:
int CreateSensorNum( SaHpiSensorNumT num );
public:
cIpmiMc *Mc() const { return m_mc; }
unsigned int FruId() const { return m_fru_id; }
tIpmiFruState &PicmgFruState() { return m_picmg_fru_state; }
bool &PolicyCanceled() { return m_policy_canceled; }
SaHpiTimeoutT &ExtractTimeout() { return m_extract_timeout; }
tIpmiFruState &PreviousPrevFruState() { return m_prev_prev_fru_state; }
cIpmiDomain *Domain() const;
unsigned int &Oem() { return m_oem; }
cIpmiEntityPath &EntityPath() { return m_entity_path; }
bool &IsFru() { return m_is_fru; }
protected:
cIpmiTextBuffer m_resource_tag;
public:
cIpmiTextBuffer &ResourceTag() { return m_resource_tag; }
public:
cIpmiResource( cIpmiMc *mc, unsigned int fru_id );
virtual ~cIpmiResource();
public:
// return hotswap sensor if there is one
cIpmiSensorHotswap *GetHotswapSensor() { return m_hotswap_sensor; }
protected:
unsigned int m_current_control_id;
public:
// get a unique control num for this resource
unsigned int GetControlNum()
{
return ++m_current_control_id;
}
// HPI resource id
SaHpiResourceIdT m_resource_id;
virtual bool Create( SaHpiRptEntryT &entry );
virtual void Destroy();
SaErrorT SendCommand( const cIpmiMsg &msg, cIpmiMsg &rsp,
unsigned int lun = 0, int retries = dIpmiDefaultRetries );
SaErrorT SendCommandReadLock( cIpmiRdr *rdr, const cIpmiMsg &msg, cIpmiMsg &rsp,
unsigned int lun = 0, int retries = dIpmiDefaultRetries );
SaErrorT SendCommandReadLock( const cIpmiMsg &msg, cIpmiMsg &rsp,
unsigned int lun = 0, int retries = dIpmiDefaultRetries );
void Activate();
void Deactivate();
SaHpiHsStateT GetHpiState();
private:
bool m_populate;
public:
// create and populate hpi resource
virtual bool Populate();
};
#endif
|