File bnc533813_update_to_ibm-prtmd.patch of Package ibmrtpkgs
diff -Napur ibmrtpkgs-2/ibm-prtm/ibm-prtmd ibmrtpkgs-2.new/ibm-prtm/ibm-prtmd
--- ibmrtpkgs-2/ibm-prtm/ibm-prtmd 2009-09-24 11:53:50.000000000 -0600
+++ ibmrtpkgs-2.new/ibm-prtm/ibm-prtmd 2009-09-24 11:54:21.000000000 -0600
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# ex: set encoding=utf8 tabstop=4 expandtab shiftwidth=4 softtabstop=4:
#
# © Copyright IBM Corp. 2008. All Rights Reserved.
@@ -41,7 +41,7 @@ def detach_tty():
childpid = os.fork()
if childpid < 0:
die("fork failed")
- elif childpid > 0:
+ elif childpid > 0:
sys.exit(0)
# lose controlling tty
@@ -63,7 +63,7 @@ def detach_tty():
sys.exit(0)
def daemonize (logfile=None):
- if os.getppid() != 1:
+ if os.getppid() != 1:
detach_tty()
os.close(0)
@@ -162,7 +162,7 @@ class Edac(object):
dmi_record = {"dimm": re.compile(r"Locator: (?P<dimm>DIMM\d+)"),
"size": re.compile(r"Size: (?P<size>\d+) MB")}
- dmi_handle = r"Handle [A-F\d]x[A-F\d]{4}\, DMI type \d+\, \d+ bytes\."
+ dmi_handle = r"Handle 0x[A-F\d]{4}\, DMI type \d+\, \d+ bytes[\s,.]*"
count = 0
dmi_list = []
@@ -377,6 +377,11 @@ class ls21_edac(amd_edac):
def fixup_tables(self):
order = None
super(ls21_edac, self).fixup_tables(order);
+ for ch in self.edac_data:
+ if ch["dimm"] % 2 == 0:
+ ch["dimm"] -= 1
+ else:
+ ch["dimm"] += 1
class ls22_edac(amd_edac):
edac_mc_name = 'Family-F10h-Quad-Core'
@@ -391,7 +396,7 @@ class ls22_edac(amd_edac):
return os.popen(exec_str).readlines() != []
def fixup_tables(self):
- order = 2,4,1,3,6,8,5,7
+ order = 4,2,3,1,8,6,7,5
super(ls22_edac, self).fixup_tables(order);
class hs21_edac(Edac):
@@ -416,9 +421,91 @@ class hs21_edac(Edac):
# With the channels sorted toplogy always looks like
order=4,2,5,7,4,2,5,7,3,1,6,8,3,1,6,8
- for channel in range(0,len(ch_list)):
+ for channel in range(len(ch_list)):
ch_list[channel]["dimm"] = order[channel]
+class i7core_hs22(Edac):
+ edac_mc_name = 'i7 Core'
+ def __init__(self):
+ super(i7core_hs22, self).__init__()
+
+ @staticmethod
+ def probe():
+ # check for i7 core memory controller and 7870 machine type
+ exec_str = "grep '%s' %s" % (
+ i7core_hs22.edac_mc_name, Edac.sysfs_mc_name_path
+ )
+ if os.popen(exec_str).readlines() != [] and \
+ os.popen("dmidecode | grep 7870").readlines() != []:
+ return True
+ return False
+
+ def fixup_tables(self):
+ ch_list = self.edac_data
+ new_dmi = []
+ map=2,1,6,5,4,3,8,7,12,11,10,9
+
+ def def_sort(x,y):
+ return int(x["name"][5:]) - int(y["name"][5:])
+
+ ch_list.sort(def_sort)
+
+ for m in map:
+ for dmi in self.dmi_data:
+ if dmi["dimm"] == m:
+ new_dmi.append(dmi)
+
+ for channel in range(len(ch_list)):
+ ch_list[channel]["dimm"] = new_dmi[channel]["dimm"]
+ ch_list[channel]["n"] = channel
+
+ def generate_ecc_ipmi_msg(self, dimm):
+ # we are setting bit 12 the "sensor number" 0xd1 == dimm 1
+ dim_value = 0xd0 + dimm
+ os.popen("ipmitool raw 0xa 0x44 0xe3 0x00 0x02 0x23 0xf2 0x92 0x4a " +
+ " 0x20 0x00 0x04 0x0c 0x%x 0x6f 0x05 0xff 0xff"%(dim_value))
+
+class i7core_rack(Edac):
+ edac_mc_name = 'i7 Core'
+ def __init__(self):
+ super(i7core_rack, self).__init__()
+
+ @staticmethod
+ def probe():
+ # check for i7 core memory controller and 7947 in dmidecode
+ exec_str = "grep '%s' %s" % (
+ i7core_rack.edac_mc_name, Edac.sysfs_mc_name_path
+ )
+ if os.popen(exec_str).readlines() != [] and \
+ os.popen("dmidecode | grep 794[7,6]").readlines() != []:
+ return True
+ return False
+
+ def fixup_tables(self):
+ ch_list = self.edac_data
+ new_dmi = []
+ map=3,2,1,6,5,4,8,7,11,10,9,14,13,12,16,15
+
+ def def_sort(x,y):
+ return int(x["name"][5:]) - int(y["name"][5:])
+
+ ch_list.sort(def_sort)
+
+ for m in map:
+ for dmi in self.dmi_data:
+ if dmi["dimm"] == m:
+ new_dmi.append(dmi)
+
+ for channel in range(len(ch_list)):
+ ch_list[channel]["dimm"] = new_dmi[channel]["dimm"]
+ ch_list[channel]["n"] = channel
+
+ def generate_ecc_ipmi_msg(self, dimm):
+ # we are setting bit 12 the "sensor number" 0xd0 == dimm 1
+ dim_value = 0xd0 + dimm -1
+ os.popen("ipmitool raw 0xa 0x44 0xe3 0x00 0x02 0x23 0xf2 0x92 0x4a " +
+ " 0x20 0x00 0x04 0x0c 0x%x 0x6f 0x05 0xff 0xff"%(dim_value))
+
def usage(name, exitval=0):
print "Usage: %s [options]" % name
print " --test run tests, but don't start daemon"