aboutsummaryrefslogtreecommitdiffstats
path: root/com32
diff options
context:
space:
mode:
Diffstat (limited to 'com32')
-rw-r--r--com32/hdt/hdt-cli-dmi.c3
-rw-r--r--com32/hdt/hdt-common.c9
-rw-r--r--com32/hdt/hdt-common.h2
-rw-r--r--com32/hdt/hdt-menu.c2
4 files changed, 15 insertions, 1 deletions
diff --git a/com32/hdt/hdt-cli-dmi.c b/com32/hdt/hdt-cli-dmi.c
index dc0e3c66..968308b1 100644
--- a/com32/hdt/hdt-cli-dmi.c
+++ b/com32/hdt/hdt-cli-dmi.c
@@ -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);
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c
index c802abd6..ce594535 100644
--- a/com32/hdt/hdt-common.c
+++ b/com32/hdt/hdt-common.c
@@ -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)
diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h
index e04ab720..d7a58e2f 100644
--- a/com32/hdt/hdt-common.h
+++ b/com32/hdt/hdt-common.h
@@ -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
diff --git a/com32/hdt/hdt-menu.c b/com32/hdt/hdt-menu.c
index db650fac..1aa0906f 100644
--- a/com32/hdt/hdt-menu.c
+++ b/com32/hdt/hdt-menu.c
@@ -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");