Hi.

On Fri, 14 Mar 2008 08:50:24 +0100
"Pierre Sangouard" <[EMAIL PROTECTED]> wrote:

> Could you please get the same logs with OpenHPI 2.10.2?

I put two files.

* 
http://www.homa.ne.jp/~ashie/linux/files/openhpi-2.10.2-amc-hotswap-log.tar.gz:
  - OpenHPI-2.10.2 without any patches.
  - 01-AMC_PRESENT: Start the openhpid after inserting an AMC.
  - 02-AMC_NOT_PRESENT: Start the openhpid without AMC.

* 
http://www.homa.ne.jp/~ashie/linux/files/openhpi-2.10.2-amc-hotswapfix-log.tar.gz
  - OpenHPI-2.10.2 with the attached patch.
  - 01-AMC_PRESENT: Start the openhpid after inserting an AMC.
  - 02-AMC_NOT_PRESENT: Start the openhpid without AMC.

Please pay your attention to:

  {SYSTEM_CHASSIS,7}{PHYSICAL_SLOT,10}{PICMG_FRONT_BLADE,0}
  {SYSTEM_CHASSIS,7}{PHYSICAL_SLOT,10}{AMC,8}

especially, following sensors:

  Sensor Num: 4, Type: OEM_SENSOR, Category: SENSOR_SPECIFIC, Tag: B4 Hot Swap
  Sensor Num: 20, Type: CURRENT, Category: THRESHOLD, Tag: B4 +12V Curr
  Sensor Num: 21, Type: VOLTAGE, Category: THRESHOLD, Tag: B4 +12V Volt

Regards,
--
Takuro Ashie <[EMAIL PROTECTED]>
Index: plugins/ipmidirect/ipmi_mc_vendor.cpp
===================================================================
--- plugins/ipmidirect/ipmi_mc_vendor.cpp	(revision 6710)
+++ plugins/ipmidirect/ipmi_mc_vendor.cpp	(working copy)
@@ -627,16 +627,28 @@
 
        type     = (SaHpiEntityTypeT)sdr->m_data[8];
        instance = (SaHpiEntityLocationT)sdr->m_data[9];
+       bool exact_matched = true;
 
        parent_fru_id = sdrs->FindParentFru( type,
                                             instance,
                                             parent_type,
-                                            parent_instance
+                                            parent_instance,
+                                            exact_matched
                                           );
 
        cIpmiResource *res = FindResource( domain, sensor->Mc(),
                                           parent_fru_id, parent_type, parent_instance,
                                           sdrs );
+
+       // Don't register AMC sensors on an AMC carrier board when the carrier board doesn't exist.
+       // (Also for RTM)
+       if (!exact_matched && (type == 193 || type == 192) && parent_type == 160)
+       {
+	   // FIXME!: How should we treat such sensors?
+	   delete sensor;
+	   continue;
+       }
+
        if (!res )
        {
            delete sensor;
@@ -804,6 +816,7 @@
   SaHpiEntityTypeT     type, parent_type;
   SaHpiEntityLocationT instance, parent_instance;
   unsigned int parent_fru_id;
+  bool exact_matched = true;
 
   if ( sdr )
      {
@@ -819,7 +832,8 @@
   parent_fru_id = sdrs->FindParentFru( type,
                                        instance,
                                        parent_type,
-                                       parent_instance
+                                       parent_instance,
+                                       exact_matched
                                      );
 
   stdlog << "CreateSensorEntityPath mc " << source_mc->GetAddress() << " FRU " << parent_fru_id << " type " << type << " instance " << instance << "\n";
Index: plugins/ipmidirect/ipmi_discover.cpp
===================================================================
--- plugins/ipmidirect/ipmi_discover.cpp	(revision 6710)
+++ plugins/ipmidirect/ipmi_discover.cpp	(working copy)
@@ -247,6 +247,28 @@
 
 
 void
+cIpmiMcThread::DiscoverForSubboard()
+{
+  if ( !m_mc ) {
+    stdlog << "Discovery for a sub board with no parent carrier board.\n";
+    return;
+  }
+
+  SaErrorT rv = m_mc->HandleNew();
+  if ( rv != SA_OK ) {
+    stdlog << "Failed to HandleNew()." << m_addr << ".\n";
+    return;
+  }
+
+  WriteLock();
+  m_mc->Populate();
+  WriteUnlock();
+
+  stdlog << "Discovery for sub board done." << m_addr << ".\n";
+}
+
+
+void
 cIpmiMcThread::Discover( cIpmiMsg *get_device_id_rsp )
 {
   cIpmiAddr addr( eIpmiAddrTypeIpmb, 0, 0, m_addr );
@@ -487,6 +509,12 @@
 
   cIpmiSensor *sensor = m_mc->FindSensor( (event->m_data[5] & 0x3), event->m_data[8] );
 
+  if ( event->m_data[7] == eIpmiSensorTypeAtcaHotSwap && sensor == 0 )
+    {
+      DiscoverForSubboard();
+      sensor = m_mc->FindSensor( (event->m_data[5] & 0x3), event->m_data[8] );
+    }
+
   if ( sensor == 0 )
      {
        stdlog << "sensor of event not found !\n";
@@ -561,6 +589,13 @@
        WriteUnlock();
 
        m_mc = 0;
+    } else {
+      // remove the sensor
+       WriteLock();
+       cIpmiResource *res = sensor->Resource();
+       m_mc->CleanupResourceSensors(res);
+       res->Destroy();
+       WriteUnlock();
     }
     break;
 
Index: plugins/ipmidirect/ipmi_sdr.cpp
===================================================================
--- plugins/ipmidirect/ipmi_sdr.cpp	(revision 6710)
+++ plugins/ipmidirect/ipmi_sdr.cpp	(working copy)
@@ -1174,7 +1174,8 @@
 cIpmiSdrs::FindParentFru( SaHpiEntityTypeT type,
                           SaHpiEntityLocationT instance,
                           SaHpiEntityTypeT & parent_type,
-                          SaHpiEntityLocationT & parent_instance
+                          SaHpiEntityLocationT & parent_instance,
+                          bool &exact_matched
                         )
 {
   SaHpiEntityTypeT mc_type = SAHPI_ENT_UNSPECIFIED;
@@ -1182,6 +1183,7 @@
 
   parent_type = SAHPI_ENT_UNSPECIFIED;
   parent_instance = 0;
+  exact_matched = true;
 
   // First look for FRUs themselves
   for( unsigned int i = 0; i < NumSdrs(); i++ )
@@ -1218,6 +1220,7 @@
        }
     }
 
+  exact_matched = false;
   stdlog << "Entity ID " << type << ", Instance " << instance << " is not a FRU\n";
 
   // SDR entity is not a FRU: look for association records
Index: plugins/ipmidirect/ipmi_mc.h
===================================================================
--- plugins/ipmidirect/ipmi_mc.h	(revision 6710)
+++ plugins/ipmidirect/ipmi_mc.h	(working copy)
@@ -190,6 +190,7 @@
   cIpmiSel *Sel() const { return m_sel; }
 
   bool Cleanup(); // true => it is safe to destroy mc
+  bool CleanupResourceSensors(cIpmiResource *res);
 
   SaErrorT HandleNew();
   bool     DeviceDataCompares( const cIpmiMsg &msg ) const;
Index: plugins/ipmidirect/ipmi_discover.h
===================================================================
--- plugins/ipmidirect/ipmi_discover.h	(revision 6710)
+++ plugins/ipmidirect/ipmi_discover.h	(working copy)
@@ -82,6 +82,7 @@
 protected:
   // discover MC
   void Discover( cIpmiMsg *get_device_id_rsp = 0 );
+  void DiscoverForSubboard();
 
   // poll mc task
   void PollAddr( void *userdata );
Index: plugins/ipmidirect/ipmi_sdr.h
===================================================================
--- plugins/ipmidirect/ipmi_sdr.h	(revision 6710)
+++ plugins/ipmidirect/ipmi_sdr.h	(working copy)
@@ -173,7 +173,8 @@
   unsigned int FindParentFru( SaHpiEntityTypeT type,
                               SaHpiEntityLocationT instance,
                               SaHpiEntityTypeT & parent_type,
-                              SaHpiEntityLocationT & parent_instance
+                              SaHpiEntityLocationT & parent_instance,
+                              bool &exact_matched
                             );
 };
 
Index: plugins/ipmidirect/ipmi_mc.cpp
===================================================================
--- plugins/ipmidirect/ipmi_mc.cpp	(revision 6710)
+++ plugins/ipmidirect/ipmi_mc.cpp	(working copy)
@@ -184,7 +184,31 @@
   return true;
 }
 
+bool
+cIpmiMc::CleanupResourceSensors(cIpmiResource *res)
+{
+  GList *sensors = NULL, *node;
 
+  for( node = m_sensors_in_my_sdr; node; node = g_list_next(node) )
+  {
+    cIpmiSensor *sensor = (cIpmiSensor *)node->data;
+    if (sensor->Resource() == res)
+      sensors = g_list_append(sensors, sensor);
+  }
+
+  for( node = sensors; node; node = g_list_next(node) )
+  {
+    cIpmiSensor *sensor = (cIpmiSensor *)node->data;
+    m_sensors_in_my_sdr = g_list_remove( m_sensors_in_my_sdr, sensor );
+    sensor->Resource()->RemRdr( sensor );
+    delete sensor;
+  }
+
+  g_list_free(sensors);
+
+  return true;
+}
+
 SaErrorT
 cIpmiMc::SendSetEventRcvr( unsigned int addr )
 {
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Openhpi-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openhpi-devel

Reply via email to