00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019  
00020 #ifndef __NEW_SIM_MC_H__
00021 #define __NEW_SIM_MC_H__
00022 
00023 
00024 #include <glib.h>
00025 #include <sys/time.h>
00026 
00033 class NewSimulatorDomain;
00034 class NewSimulatorMcThread;
00035 
00036 
00037 class NewSimulatorMc : cArray<NewSimulatorResource>
00038 {
00039 protected:
00040   NewSimulatorMcVendor *m_vendor;
00041 
00042   
00043   
00044   
00045   
00046   bool           m_active;
00047 
00048   NewSimulatorDomain   *m_domain;
00049 
00050   
00051   GList         *m_sensors_in_my_sdr;
00052 
00053   
00054   unsigned char m_picmg_major;
00055   unsigned char m_picmg_minor;
00056 
00057   
00058   unsigned char  m_device_id;
00059 
00060   unsigned char  m_device_revision;
00061 
00062   bool           m_provides_device_sdrs;
00063   bool           m_device_available;
00064 
00065   unsigned char  m_device_support;
00066   bool           m_chassis_support;
00067   bool           m_bridge_support;
00068   bool           m_ipmb_event_generator_support;
00069   bool           m_ipmb_event_receiver_support;
00070   bool           m_fru_inventory_support;
00071   bool           m_sel_device_support;
00072   bool           m_sdr_repository_support;
00073   bool           m_sensor_device_support;
00074 
00075   unsigned char  m_major_fw_revision;
00076   unsigned char  m_minor_fw_revision;
00077 
00078   unsigned char  m_major_version;
00079   unsigned char  m_minor_version;
00080 
00081   unsigned int   m_manufacturer_id;
00082   unsigned short m_product_id;
00083 
00084   unsigned char  m_aux_fw_revision[4];
00085 
00086   bool           m_is_tca_mc;
00087   bool           m_is_rms_board;
00088 
00089   SaErrorT SendSetEventRcvr( unsigned int addr );
00090 
00091 public:
00092   void AddResource( NewSimulatorResource *res );
00093   void RemResource( NewSimulatorResource *res );
00094   NewSimulatorResource *FindResource( const NewSimulatorEntityPath &ep );
00095   NewSimulatorResource *FindResource( NewSimulatorResource *res );
00096   NewSimulatorResource *GetResource( int i );
00097   int           NumResources() const { return Num(); }
00098 public:
00099   NewSimulatorMc( NewSimulatorDomain *domain, const NewSimulatorAddr &addr );
00100   virtual ~NewSimulatorMc();
00101 
00102   NewSimulatorDomain *Domain() const { return m_domain; }
00103 
00104   unsigned char DeviceRevision() const { return m_device_revision; }
00105   unsigned char DeviceSupport() const { return m_device_support; }
00106 
00107   unsigned char MajorFwRevision() const { return m_major_fw_revision; }
00108   unsigned char MinorFwRevision() const { return m_minor_fw_revision; }
00109 
00110   unsigned char MajorVersion()    const { return m_major_version; }
00111   unsigned char MinorVersion()    const { return m_minor_version; }
00112 
00113   unsigned int  ManufacturerId()  const { return m_manufacturer_id; }
00114   unsigned short ProductId()      const { return m_product_id; }
00115 
00116   unsigned char AuxFwRevision( int v ) const
00117   {
00118     if ( v >= 0 && v < 4 )
00119         return m_aux_fw_revision[v];
00120     else
00121         return 0;
00122   }
00123 
00124   const NewSimulatorAddr &Addr() { return m_addr; }
00125 
00126   void CheckTca();
00127 
00128   bool IsTcaMc() { return m_is_tca_mc; }
00129 
00130   bool &IsRmsBoard() { return m_is_rms_board; }
00131 
00132   void SetSel( bool sel ) { m_sel_device_support = sel; }
00133 
00134   NewSimulatorSensorHotswap *FindHotswapSensor();
00135 
00136   GList *GetSdrSensors() const
00137   {
00138     return m_sensors_in_my_sdr;
00139   }
00140 
00141   void SetSdrSensors( GList *sensors )
00142   {
00143     m_sensors_in_my_sdr = sensors;
00144   }
00145 
00146   bool ProvidesDeviceSdrs() const { return m_provides_device_sdrs; }
00147   void SetProvidesDeviceSdrs(bool val) { m_provides_device_sdrs = val; }
00148 
00149   bool &SdrRepositorySupport() { return m_sdr_repository_support; }
00150   bool SelDeviceSupport() const { return m_sel_device_support; }
00151 
00152   NewSimulatorSel *Sel() const { return m_sel; }
00153 
00154   bool Cleanup(); 
00155 
00156   SaErrorT HandleNew();
00157   bool     DeviceDataCompares( const NewSimulatorMsg &msg ) const;
00158   int      GetDeviceIdDataFromRsp( const NewSimulatorMsg &msg );
00159   void     CheckEventRcvr();
00160   SaErrorT SendCommand( const NewSimulatorMsg &msg, NewSimulatorMsg &rsp_msg,
00161                         unsigned int lun = 0, int retries = dIpmiDefaultRetries );
00162 
00163   unsigned int GetChannel() const;
00164   unsigned int GetAddress() const;
00165   void         SetActive();
00166   NewSimulatorSensor *FindSensor( unsigned int lun, unsigned int sensor_id );
00167   NewSimulatorRdr *FindRdr( NewSimulatorRdr *r );
00168 
00169   void SetVendor( NewSimulatorMcVendor *mv )
00170   {
00171     if ( mv )
00172         m_vendor = mv;
00173   }
00174 
00175   NewSimulatorMcVendor *GetVendor()  { return m_vendor; }
00176 protected:
00177   bool DumpFrus( NewSimulatorLog &dump, const char *name ) const;
00178   bool DumpControls( NewSimulatorLog &dump, const char *name ) const;
00179 
00180 public:
00181   void Dump( NewSimulatorLog &dump, const char *name ) const;
00182 
00183   
00184   virtual bool Populate();
00185 };
00186 
00187 
00188 #endif