aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-05-26 21:03:16 -0700
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-05-26 21:03:16 -0700
commitad1235725d17522fb10d34052fe7e118ab43b7fa (patch)
tree10caf925b236c4db6102d7cc047b8cba2dbab322
parenta98e2b4b62967ef972b6817d5a8a1ac064fcfb51 (diff)
downloadsyslinux-ad1235725d17522fb10d34052fe7e118ab43b7fa.tar.gz
syslinux-ad1235725d17522fb10d34052fe7e118ab43b7fa.tar.xz
syslinux-ad1235725d17522fb10d34052fe7e118ab43b7fa.zip
gpllib: Add support for 3.3.24 System Reset (Type 23) (dmi)
From SMBIOS spec (v2.6.1): This structure describes whether Automatic System Reset functions enabled (Status). If the system has a watchdog Timer and the timer is not reset (Timer Reset) before the Interval elapses, an automatic system reset will occur. The system will re-boot according to the Boot Option. This function may repeat until the Limit is reached, at which time the system will re-boot according to the Boot Option at Limit. Note: This structure type was added for specification v2.2. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
-rw-r--r--com32/gplinclude/dmi/dmi_system.h11
-rw-r--r--com32/gpllib/dmi/dmi.c51
2 files changed, 62 insertions, 0 deletions
diff --git a/com32/gplinclude/dmi/dmi_system.h b/com32/gplinclude/dmi/dmi_system.h
index 896c1e54..218fa4f9 100644
--- a/com32/gplinclude/dmi/dmi_system.h
+++ b/com32/gplinclude/dmi/dmi_system.h
@@ -38,5 +38,16 @@ char family[SYSTEM_FAMILY_SIZE];
bool filled;
char system_boot_status[SYSTEM_BOOT_STATUS_SIZE];
char configuration_options[SYSTEM_CONFIGURATION_OPTIONS_SIZE];
+struct {
+ bool filled;
+ uint8_t status;
+ uint8_t watchdog;
+ char boot_option[17];
+ char boot_option_on_limit[17];
+ char reset_count[8];
+ char reset_limit[8];
+ char timer_interval[8];
+ char timeout[8];
+} system_reset;
} s_system;
#endif
diff --git a/com32/gpllib/dmi/dmi.c b/com32/gpllib/dmi/dmi.c
index 7498b7fa..1f96c3a7 100644
--- a/com32/gpllib/dmi/dmi.c
+++ b/com32/gpllib/dmi/dmi.c
@@ -38,6 +38,39 @@ const char *bad_index = "<BAD INDEX>";
*/
/*
+ * 3.3.24 System Reset (Type 23)
+ */
+
+static const char *dmi_system_reset_boot_option(uint8_t code)
+{
+ static const char *option[]={
+ "Operating System", /* 0x1 */
+ "System Utilities",
+ "Do Not Reboot" /* 0x3 */
+ };
+
+ if (code >= 0x1)
+ return option[code-0x1];
+ return out_of_spec;
+}
+
+static void dmi_system_reset_count(uint16_t code, char* array)
+{
+ if (code == 0xFFFF)
+ strncpy(array, "Unknown", sizeof array);
+ else
+ snprintf(array, sizeof array, "%u", code);
+}
+
+static void dmi_system_reset_timer(uint16_t code, char* array)
+{
+ if (code == 0xFFFF)
+ strncpy(array, "Unknown", sizeof array);
+ else
+ snprintf(array, sizeof array, "%u min", code);
+}
+
+/*
* 3.3.13 System Configuration Options (Type 12)
*/
static void dmi_system_configuration_options(struct dmi_header *h, const char *prefix, s_dmi *dmi)
@@ -644,6 +677,24 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi *dmi)
// sprintf(dmi->battery.oem_info,"0x%08X",DWORD(h, data+0x16));
break;
+ case 23: /* 3.3.24 System Reset */
+ if(h->length<0x0D) break;
+ dmi->system.system_reset.filled = true;
+ dmi->system.system_reset.status = data[0x04]&(1<<0);
+ dmi->system.system_reset.watchdog = data[0x04]&(1<<5);
+ if (!(data[0x04]&(1<<5)))
+ break;
+ strncpy(dmi->system.system_reset.boot_option,
+ dmi_system_reset_boot_option((data[0x04]>>1)&0x3),
+ sizeof dmi->system.system_reset.boot_option);
+ strncpy(dmi->system.system_reset.boot_option_on_limit,
+ dmi_system_reset_boot_option((data[0x04]>>3)&0x3),
+ sizeof dmi->system.system_reset.boot_option_on_limit);
+ dmi_system_reset_count(WORD(data+0x05), dmi->system.system_reset.reset_count);
+ dmi_system_reset_count(WORD(data+0x07), dmi->system.system_reset.reset_limit);
+ dmi_system_reset_timer(WORD(data+0x09), dmi->system.system_reset.timer_interval);
+ dmi_system_reset_timer(WORD(data+0x0B), dmi->system.system_reset.timeout);
+ break;
case 32: /* 3.3.33 System Boot Information */
if (h->length < 0x0B) break;
dmi_system_boot_status(data[0x0A],