Let lib_get_sysinfo() pass through the success of get_coreboot_info()
authorPhilip Prindeville <philipp@redfish-solutions.com>
Sat, 24 Dec 2011 01:33:05 +0000 (18:33 -0700)
committerPatrick Georgi <patrick@georgi-clan.de>
Sat, 24 Dec 2011 11:02:18 +0000 (12:02 +0100)
The return status of get_coreboot_info() might be handy to a platform
driver calling lib_get_sysinfo() to test for the presence of coreboot.

Change-Id: I0176c93ee92c9dff733112026ee50f2ca797bdff
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Reviewed-on: http://review.coreboot.org/503
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
payloads/libpayload/arch/i386/sysinfo.c
payloads/libpayload/arch/powerpc/sysinfo.c
payloads/libpayload/include/libpayload.h

index 599a81140dcc91ad47260911f30a10ce8aa4ea2f..6c1ef3fc1ca1583ad4b6f89c78c4c5df01d610d5 100644 (file)
@@ -45,8 +45,10 @@ struct sysinfo_t lib_sysinfo = {
 #endif
 };
 
-void lib_get_sysinfo(void)
+int lib_get_sysinfo(void)
 {
+       int ret;
+
        /* Get the CPU speed (for delays). */
        lib_sysinfo.cpu_khz = get_cpu_speed();
 
@@ -59,7 +61,7 @@ void lib_get_sysinfo(void)
        /* Get information from the coreboot tables,
         * if they exist */
 
-       get_coreboot_info(&lib_sysinfo);
+       ret = get_coreboot_info(&lib_sysinfo);
 
        if (!lib_sysinfo.n_memranges) {
                /* If we can't get a good memory range, use the default. */
@@ -73,4 +75,6 @@ void lib_get_sysinfo(void)
                lib_sysinfo.memrange[1].size = 31 * 1024 * 1024;
                lib_sysinfo.memrange[1].type = CB_MEM_RAM;
        }
+
+       return ret;
 }
index 599a81140dcc91ad47260911f30a10ce8aa4ea2f..6c1ef3fc1ca1583ad4b6f89c78c4c5df01d610d5 100644 (file)
@@ -45,8 +45,10 @@ struct sysinfo_t lib_sysinfo = {
 #endif
 };
 
-void lib_get_sysinfo(void)
+int lib_get_sysinfo(void)
 {
+       int ret;
+
        /* Get the CPU speed (for delays). */
        lib_sysinfo.cpu_khz = get_cpu_speed();
 
@@ -59,7 +61,7 @@ void lib_get_sysinfo(void)
        /* Get information from the coreboot tables,
         * if they exist */
 
-       get_coreboot_info(&lib_sysinfo);
+       ret = get_coreboot_info(&lib_sysinfo);
 
        if (!lib_sysinfo.n_memranges) {
                /* If we can't get a good memory range, use the default. */
@@ -73,4 +75,6 @@ void lib_get_sysinfo(void)
                lib_sysinfo.memrange[1].size = 31 * 1024 * 1024;
                lib_sysinfo.memrange[1].type = CB_MEM_RAM;
        }
+
+       return ret;
 }
index 8c8abc437ed822b736f59d710e36a3f36696ed1c..d9f7d217815e9c03f194dc77a3a3ac0463d93003 100644 (file)
@@ -369,7 +369,7 @@ int sysinfo_have_multiboot(unsigned long *addr);
 int get_coreboot_info(struct sysinfo_t *info);
 int get_multiboot_info(struct sysinfo_t *info);
 
-void lib_get_sysinfo(void);
+int lib_get_sysinfo(void);
 
 /* Timer functions - defined by each architecture. */
 unsigned int get_cpu_speed(void);