]> git.zerfleddert.de Git - rsbs2/commitdiff
add defines for BOARD_DESCRIPTION settings
authorMichael Gernoth <michael@gernoth.net>
Thu, 29 Jan 2009 20:24:13 +0000 (21:24 +0100)
committerMichael Gernoth <michael@gernoth.net>
Thu, 29 Jan 2009 20:24:13 +0000 (21:24 +0100)
firmware.c

index 1542d39db53866804fd3a10d063df9b5b0f32864..0595bd9645ed973ad0ee01463c06f61de534dcc7 100644 (file)
@@ -152,6 +152,33 @@ void change_properties(unsigned char *fw, int len, struct propaction *paction)
        }
 }
 
+#define BD_SERIAL1     0x14,0x02
+#define BD_ICMB                0x14,0x04
+#define BD_LAN         0x14,0x08
+#define BD_SERIAL2     0x14,0x10
+#define BD_SERIAL3     0x14,0x20
+#define BD_USB         0x14,0x40
+#define BD_PCI         0x15,0x03
+#define BD_LPC         0x15,0x04
+#define BD_VGA         0x15,0x08
+#define BD_BATTERY     0x15,0x10
+#define BD_ACDC                0x15,0x20
+#define BD_STANDBY     0x15,0x40
+#define BD_POWERCONN   0x15,0x70
+#define BD_DVI         0x15,0x80
+#define BD_PWRATX      0x16,0x01
+#define BD_PWRRELAY    0x16,0x02
+#define BD_PS2A                0x19,0xff
+
+#define MAGIC(fn, args...) fn(args)
+
+#define _BD_IS_SET(bd, byte, bits) (bd[byte] & bits)
+#define BD_IS_SET(bd, ident) MAGIC(_BD_IS_SET, bd, BD_##ident)
+#define BD_TEXT(bd, ident) (BD_IS_SET(bd, ident) ? "TRUE" : "FALSE")
+
+#define _BD_SET(bd, byte, bits) (bd[byte] |= bits)
+#define BD_SET(bd, ident) MAGIC(_BD_SET, bd, BD_##ident)
+
 void print_boarddescription(unsigned char *bd)
 {
        int j;
@@ -168,24 +195,24 @@ void print_boarddescription(unsigned char *bd)
         * com/agilent/rmc/mgui/panels/PowerMgmtConf.jad
         * com/agilent/rmc/mgui/panels/RemoteDiskConf.jad
         */
-       printf("\tserial1Present\t\t: %s\n", ((bd[20] & 2) ? "TRUE" : "FALSE"));
-       printf("\ticmbPresent\t\t: %s\n", ((bd[20] & 4) ? "TRUE" : "FALSE"));
-       printf("\tlanPresent\t\t: %s\n", ((bd[20] & 8) ? "TRUE" : "FALSE"));
-       printf("\tserial2Present\t\t: %s\n", ((bd[20] & 0x10) ? "TRUE" : "FALSE"));
-       printf("\tserial3Present\t\t: %s\n", ((bd[20] & 0x20) ? "TRUE" : "FALSE"));
-       printf("\tusbPresent\t\t: %s\n", ((bd[20] & 0x40) ? "TRUE" : "FALSE"));
-       printf("\tpciPresent\t\t: %s\n", ((bd[21] & 3) ? "TRUE" : "FALSE"));
-       printf("\tlpcPresent\t\t: %s\n", ((bd[21] & 4) ? "TRUE" : "FALSE"));
-       printf("\tvgaPresent\t\t: %s\n", ((bd[21] & 8) ? "TRUE" : "FALSE"));
-       printf("\tbatteryPresent\t\t: %s\n", ((bd[21] & 0x10) ? "TRUE" : "FALSE"));
-       printf("\tacdcPresent\t\t: %s\n", ((bd[21] & 0x20) ? "TRUE" : "FALSE"));
-       printf("\tstandbyPresent\t\t: %s\n", ((bd[21] & 0x40) ? "TRUE" : "FALSE"));
-       printf("\thasPowerConnectors\t: %s\n", ((bd[21] & 0x70) ? "TRUE" : "FALSE"));
-       printf("\tdviPresent\t\t: %s\n", ((bd[21] & 0x80) ? "TRUE" : "FALSE"));
-       printf("\tpowerSwitchATX\t\t: %s\n", ((bd[22] & 1) ? "TRUE" : "FALSE"));
-       printf("\tpowerSwitchRelay\t: %s\n", ((bd[22] & 2) ? "TRUE" : "FALSE"));
+       printf("\tserial1Present\t\t: %s\n", BD_TEXT(bd, SERIAL1));
+       printf("\ticmbPresent\t\t: %s\n", BD_TEXT(bd, ICMB));
+       printf("\tlanPresent\t\t: %s\n", BD_TEXT(bd, LAN));
+       printf("\tserial2Present\t\t: %s\n", BD_TEXT(bd, SERIAL2));
+       printf("\tserial3Present\t\t: %s\n", BD_TEXT(bd, SERIAL3));
+       printf("\tusbPresent\t\t: %s\n", BD_TEXT(bd, USB));
+       printf("\tpciPresent\t\t: %s\n", BD_TEXT(bd, PCI));
+       printf("\tlpcPresent\t\t: %s\n", BD_TEXT(bd, LPC));
+       printf("\tvgaPresent\t\t: %s\n", BD_TEXT(bd, VGA));
+       printf("\tbatteryPresent\t\t: %s\n", BD_TEXT(bd, BATTERY));
+       printf("\tacdcPresent\t\t: %s\n", BD_TEXT(bd, ACDC));
+       printf("\tstandbyPresent\t\t: %s\n", BD_TEXT(bd, STANDBY));
+       printf("\thasPowerConnectors\t: %s\n", BD_TEXT(bd, POWERCONN));
+       printf("\tdviPresent\t\t: %s\n", BD_TEXT(bd, DVI));
+       printf("\tpowerSwitchATX\t\t: %s\n", BD_TEXT(bd, PWRATX));
+       printf("\tpowerSwitchRelay\t: %s\n", BD_TEXT(bd, PWRRELAY));
        /* 22 & 4 */
-       printf("\tps2aPresent\t\t: %s\n", ((bd[25]) ? "TRUE" : "FALSE"));
+       printf("\tps2aPresent\t\t: %s\n", BD_TEXT(bd, PS2A));
 }
 
 void handle_boarddescription(unsigned char *fw, int len, int patch)
@@ -210,7 +237,12 @@ void handle_boarddescription(unsigned char *fw, int len, int patch)
 
                        if (patch) {
                                /* Enable ATX and relay power switching */
-                               pos[22] |= 0x03;
+                               BD_SET(pos, PWRATX);
+                               BD_SET(pos, PWRRELAY);
+                               /* Serial */
+                               BD_SET(pos, SERIAL2);
+                               /* ATX standby */
+                               BD_SET(pos, STANDBY);
                        }
                        printf("0x%08x: BOARD_DESCRIPTION: ", pos-fw);
                        print_boarddescription(pos);
Impressum, Datenschutz