summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Config.lb4
-rw-r--r--src/lib/clog2.c9
-rw-r--r--src/lib/fallback_boot.c15
3 files changed, 21 insertions, 7 deletions
diff --git a/src/lib/Config.lb b/src/lib/Config.lb
index 32566d2737..3a1baf66c3 100644
--- a/src/lib/Config.lb
+++ b/src/lib/Config.lb
@@ -9,9 +9,7 @@ object memcmp.o
object memmove.o
object malloc.o
object delay.o
-if HAVE_FALLBACK_BOOT
- object fallback_boot.o
-end
+object fallback_boot.o
object compute_ip_checksum.o
object version.o
# Force version.o to recompile every time
diff --git a/src/lib/clog2.c b/src/lib/clog2.c
index 41e2af9791..b9b173177c 100644
--- a/src/lib/clog2.c
+++ b/src/lib/clog2.c
@@ -4,16 +4,19 @@
#include <console/console.h>
#endif
+/* Assume 8 bits per byte */
+#define CHAR_BIT 8
+
unsigned long log2(unsigned long x)
{
// assume 8 bits per byte.
- unsigned long i = 1 << (sizeof(x)*8 - 1);
- unsigned long pow = sizeof(x) * 8 - 1;
+ unsigned long i = 1ULL << (sizeof(x)* CHAR_BIT - 1ULL);
+ unsigned long pow = sizeof(x) * CHAR_BIT - 1ULL;
if (! x) {
#ifdef DEBUG_LOG2
printk_warning("%s called with invalid parameter of 0\n",
- __FUNCTION__);
+ __func__);
#endif
return -1;
}
diff --git a/src/lib/fallback_boot.c b/src/lib/fallback_boot.c
index fe34e081fb..9e892dd680 100644
--- a/src/lib/fallback_boot.c
+++ b/src/lib/fallback_boot.c
@@ -1,9 +1,12 @@
#include <console/console.h>
#include <part/fallback_boot.h>
+#include <part/watchdog.h>
#include <pc80/mc146818rtc.h>
#include <arch/io.h>
-void boot_successful(void)
+
+#if HAVE_FALLBACK_BOOT == 1
+void set_boot_successful(void)
{
/* Remember I succesfully booted by setting
* the initial boot direction
@@ -23,3 +26,13 @@ void boot_successful(void)
byte &= 0x0f;
outb(byte, RTC_PORT(1));
}
+#endif
+
+void boot_successful(void)
+{
+ /* Remember this was a successful boot */
+ set_boot_successful();
+
+ /* turn off the boot watchdog */
+ watchdog_off();
+}