hdt: Fixing memory detection
authorErwan Velu <erwan.velu@free.fr>
Fri, 27 Nov 2009 15:09:01 +0000 (16:09 +0100)
committerErwan Velu <erwan.velu@free.fr>
Fri, 4 Dec 2009 09:11:14 +0000 (10:11 +0100)
Impact: Fix memory detection under cli

Under the CLI, the memory detection wasn't started...
This commit fixes the memory initialisation path

com32/hdt/hdt-cli-dmi.c
com32/hdt/hdt-common.c
com32/hdt/hdt-common.h
com32/hdt/hdt-menu.c

index dc0e3c6..968308b 100644 (file)
@@ -516,6 +516,9 @@ void show_dmi_memory_modules(int argc __unused, char **argv __unused,
     /* Needed, if called by the memory mode */
     detect_dmi(hardware);
 
+    /* Detecting installed memory */
+    detect_memory(hardware);
+
     more_printf("Memory Size   : %lu MB (%lu KB)\n",
                (hardware->detected_memory_size + (1 << 9)) >> 10,
                hardware->detected_memory_size);
index c802abd..ce59453 100644 (file)
@@ -35,6 +35,7 @@
 #include "hdt-common.h"
 #include <disk/util.h>
 #include <disk/mbrs.h>
+#include <memory.h>
 
 /* ISOlinux requires a 8.3 format */
 void convert_isolinux_filename(char *filename, struct s_hardware *hardware)
@@ -167,6 +168,7 @@ void init_hardware(struct s_hardware *hardware)
     hardware->pxe_detection = false;
     hardware->vesa_detection = false;
     hardware->vpd_detection = false;
+    hardware->memory_detection = false;
     hardware->nb_pci_devices = 0;
     hardware->is_dmi_valid = false;
     hardware->is_pxe_valid = false;
@@ -463,6 +465,13 @@ int detect_pxe(struct s_hardware *hardware)
     return 0;
 }
 
+void detect_memory(struct s_hardware *hardware) {
+     if (hardware->memory_detection == false) {
+            hardware->memory_detection = true;
+     hardware->detected_memory_size = detect_memsize();
+     }
+}
+
 void detect_pci(struct s_hardware *hardware)
 {
     if (hardware->pci_detection == true)
index e04ab72..d7a58e2 100644 (file)
@@ -188,6 +188,7 @@ struct s_hardware {
     bool pxe_detection;                /* Does the pxe stuff has already been detected? */
     bool vesa_detection;       /* Does the vesa sutff have been already detected? */
     bool vpd_detection;                /* Does the vpd stuff has already been detected? */
+    bool memory_detection;     /* Does the memory size got detected ?*/
 
     char syslinux_fs[22];
     const struct syslinux_version *sv;
@@ -218,5 +219,6 @@ void detect_syslinux(struct s_hardware *hardware);
 void detect_parameters(const int argc, const char *argv[],
                       struct s_hardware *hardware);
 int detect_vesa(struct s_hardware *hardware);
+void detect_memory(struct s_hardware *hardware);
 void init_console(struct s_hardware *hardware);
 #endif
index db650fa..1aa0906 100644 (file)
@@ -295,7 +295,7 @@ void detect_hardware(struct s_hardware *hardware)
 {
     if (!quiet)
        more_printf("MEMORY: Detecting\n");
-    hardware->detected_memory_size = detect_memsize();
+    detect_memory(hardware);
 
     if (!quiet)
        more_printf("DMI: Detecting Table\n");