Fix bugs from test runs

POST and FW Boot progres where not getting set on DBUS
Memory and CPU faults now show up on DBUS
OS Boot Status was never sent
diff --git a/ipmisensor.C b/ipmisensor.C
index 513e485..6d3d3bd 100644
--- a/ipmisensor.C
+++ b/ipmisensor.C
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdint.h>
+#include <malloc.h>
 
 
 extern uint8_t find_sensor(uint8_t);
@@ -30,8 +31,8 @@
 	uint8_t offset;
 	int (*func)(const sensorRES_t *, const lookup_t *, const char *);
 	char    method[16];
-	char    assertion[16];
-	char    deassertion[16];
+	char    assertion[64];
+	char    deassertion[64];
 };
 
 
@@ -46,7 +47,7 @@
 
 struct event_data_t {
 	uint8_t data;
-	char    text[32];
+	char    text[64];
 };
 
 event_data_t g_fwprogress02h[] = {
@@ -79,10 +80,26 @@
 	{0xFF, "Unknown"}
 };
 
+event_data_t g_fwprogress00h[] = {
+	{0x00, "Unspecified."},
+	{0x01, "No system memory detected"},
+	{0x02, "No usable system memory"},
+	{0x03, "Unrecoverable hard-disk/ATAPI/IDE"},
+	{0x04, "Unrecoverable system-board"},
+	{0x05, "Unrecoverable diskette"},
+	{0x06, "Unrecoverable hard-disk controller"},
+	{0x07, "Unrecoverable PS/2 or USB keyboard"},
+	{0x08, "Removable boot media not found"},
+	{0x09, "Unrecoverable video controller"},
+	{0x0A, "No video device detected"},
+	{0x0B, "Firmware ROM corruption detected"},
+	{0x0C, "CPU voltage mismatch"},
+	{0x0D, "CPU speed matching"},
+	{0xFF, "unknown"},
+};
 
-char *getfw02string(uint8_t b) {
 
-	event_data_t *p = g_fwprogress02h;
+char *event_data_lookup(event_data_t *p, uint8_t b) {
 
 	while(p->data != 0xFF) {
 		if (p->data == b) {
@@ -93,20 +110,24 @@
 
 	return p->text;
 }
+
+
+
 //  The fw progress sensor contains some additional information that needs to be processed
 //  prior to calling the dbus code.  
 int set_sensor_dbus_state_fwprogress(const sensorRES_t *pRec, const lookup_t *pTable, const char *value) {
 
-	char valuestring[64];
+	char valuestring[128];
 	char* p = valuestring;
 
 	switch (pTable->offset) {
 
-		case 0x00 : snprintf(p, sizeof(valuestring), "POST Error, 0x%02x", pRec->event_data2);
+		case 0x00 : snprintf(p, sizeof(valuestring), "POST Error, %s", event_data_lookup(g_fwprogress00h, pRec->event_data2));
 					break;
-		case 0x01 : snprintf(p, sizeof(valuestring), "FW Hang, 0x%02x", pRec->event_data2);
+		case 0x01 : /* Using g_fwprogress02h for 0x01 because thats what the ipmi spec says to do */
+					snprintf(p, sizeof(valuestring), "FW Hang, %s", event_data_lookup(g_fwprogress02h, pRec->event_data2));
 					break;
-		case 0x02 : snprintf(p, sizeof(valuestring), "FW Progress, %s", getfw02string(pRec->event_data2));
+		case 0x02 : snprintf(p, sizeof(valuestring), "FW Progress, %s", event_data_lookup(g_fwprogress02h, pRec->event_data2));
 					break;
 	}
 
@@ -115,7 +136,7 @@
 
 // Handling this special OEM sensor by coping what is in byte 4.  I also think that is odd
 // considering byte 3 is for sensor reading.  This seems like a misuse of the IPMI spec
-int set_sensor_dbus_state_osboot(const sensorRES_t *pRec, const lookup_t *pTable, const char *value) {
+int set_sensor_dbus_state_osbootcount(const sensorRES_t *pRec, const lookup_t *pTable, const char *value) {
 	char valuestring[32];
 	char* pStr = valuestring;
 
@@ -125,13 +146,14 @@
 }
 
 
+
 //  This table lists only senors we care about telling dbus about.
 //  Offset definition cab be found in section 42.2 of the IPMI 2.0
 //  spec.  Add more if/when there are more items of interest.
 lookup_t g_ipmidbuslookup[] = {
 
-	{0x07, 0x00, set_sensor_dbus_state_simple, "setPresent", "False", "False"}, // OCC Inactive 0
-	{0x07, 0x01, set_sensor_dbus_state_simple, "setPresent", "True", "True"},   // OCC Active 1
+	{0xe9, 0x00, set_sensor_dbus_state_simple, "setValue", "Disabled", ""}, // OCC Inactive 0
+	{0xe9, 0x01, set_sensor_dbus_state_simple, "setValue", "Enabled", ""},   // OCC Active 1
 	{0x07, 0x07, set_sensor_dbus_state_simple, "setPresent", "True", "False"},
 	{0x07, 0x08, set_sensor_dbus_state_simple, "setFault",   "True", ""},
 	{0x0C, 0x06, set_sensor_dbus_state_simple, "setPresent", "True", "False"},
@@ -140,13 +162,19 @@
 	{0x0F, 0x01, set_sensor_dbus_state_fwprogress, "setValue", "True", "False"},
 	{0x0F, 0x00, set_sensor_dbus_state_fwprogress, "setValue", "True", "False"},
 	{0xC7, 0x01, set_sensor_dbus_state_simple, "setFault", "True", ""},
-	{0xc3, 0x00, set_sensor_dbus_state_osboot, "setValue", "" ,""},
+	{0xc3, 0x00, set_sensor_dbus_state_osbootcount, "setValue", "" ,""},
+	{0x1F, 0x00, set_sensor_dbus_state_simple, "setValue", "Boot completed (00)", ""},
+	{0x1F, 0x01, set_sensor_dbus_state_simple, "setValue", "Boot completed (01)", ""},
+	{0x1F, 0x02, set_sensor_dbus_state_simple, "setValue", "PXE boot completed", ""},
+	{0x1F, 0x03, set_sensor_dbus_state_simple, "setValue", "Diagnostic boot completed", ""},
+	{0x1F, 0x04, set_sensor_dbus_state_simple, "setValue", "CD-ROM boot completed", ""},
+	{0x1F, 0x05, set_sensor_dbus_state_simple, "setValue", "ROM boot completed", ""},
+	{0x1F, 0x06, set_sensor_dbus_state_simple, "setValue", "Boot completed (06)", ""},
 
 	{0xFF, 0xFF, NULL, "", "", ""}
 };
 
 
-
 void reportSensorEventAssert(sensorRES_t *pRec, int index) {
 	lookup_t *pTable = &g_ipmidbuslookup[index];
 	(*pTable->func)(pRec, pTable, pTable->assertion);
@@ -198,8 +226,8 @@
 	sensorRES_t *pRec = (sensorRES_t *) record;
 	uint8_t stype;
 	int index, i=0;
-	stype = find_sensor(pRec->sensor_number);
 
+	stype = find_sensor(pRec->sensor_number);
 
 	// 0xC3 types use the assertion7_0 for the value to be set
 	// so skip the reseach and call the correct event reporting
@@ -213,6 +241,7 @@
 		// Scroll through each bit position .  Determine
 		// if any bit is either asserted or Deasserted.
 		for(i=0;i<8;i++) {
+
 			if ((ISBITSET(pRec->assert_state7_0,i))  &&
 				(shouldReport(stype, i, &index)))
 			{