summaryrefslogtreecommitdiff
path: root/gpxe/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'gpxe/src/core')
-rw-r--r--gpxe/src/core/config.c40
-rw-r--r--gpxe/src/core/console.c6
-rw-r--r--gpxe/src/core/debug.c2
-rw-r--r--gpxe/src/core/gdbudp.c2
-rw-r--r--gpxe/src/core/main.c16
-rw-r--r--gpxe/src/core/malloc.c2
-rw-r--r--gpxe/src/core/monojob.c7
-rw-r--r--gpxe/src/core/null_nap.c3
-rw-r--r--gpxe/src/core/nvo.c2
-rw-r--r--gpxe/src/core/pc_kbd.c2
-rw-r--r--gpxe/src/core/process.c2
-rw-r--r--gpxe/src/core/serial.c2
-rw-r--r--gpxe/src/core/settings.c20
-rw-r--r--gpxe/src/core/timer.c91
-rw-r--r--gpxe/src/core/uri.c8
15 files changed, 81 insertions, 124 deletions
diff --git a/gpxe/src/core/config.c b/gpxe/src/core/config.c
index b5624fae..b14d25a8 100644
--- a/gpxe/src/core/config.c
+++ b/gpxe/src/core/config.c
@@ -5,7 +5,8 @@
* your option) any later version.
*/
-#include "config/general.h"
+#include <config/general.h>
+#include <config/console.h>
/*
* Build ID string calculations
@@ -38,19 +39,9 @@
/*
* Drag in all requested console types
*
- * CONSOLE_DUAL sets both CONSOLE_FIRMWARE and CONSOLE_SERIAL for
- * legacy compatibility.
- *
*/
-#ifdef CONSOLE_DUAL
-#undef CONSOLE_FIRMWARE
-#define CONSOLE_FIRMWARE 1
-#undef CONSOLE_SERIAL
-#define CONSOLE_SERIAL 1
-#endif
-
-#ifdef CONSOLE_FIRMWARE
+#ifdef CONSOLE_PCBIOS
REQUIRE_OBJECT ( bios_console );
#endif
#ifdef CONSOLE_SERIAL
@@ -68,15 +59,8 @@ REQUIRE_OBJECT ( pc_kbd );
#ifdef CONSOLE_SYSLOG
REQUIRE_OBJECT ( syslog );
#endif
-
-/*
- * Drag in all requested timers
- */
-#ifdef TIMER_BIOS
-REQUIRE_OBJECT ( timer_bios );
-#endif
-#ifdef TIMER_RDTSC
-REQUIRE_OBJECT ( timer_rdtsc );
+#ifdef CONSOLE_EFI
+REQUIRE_OBJECT ( efi_console );
#endif
/*
@@ -114,6 +98,17 @@ REQUIRE_OBJECT ( slam );
#endif
/*
+ * Drag in all requested SAN boot protocols
+ *
+ */
+#ifdef SANBOOT_PROTO_ISCSI
+REQUIRE_OBJECT ( iscsiboot );
+#endif
+#ifdef SANBOOT_PROTO_AOE
+REQUIRE_OBJECT ( aoeboot );
+#endif
+
+/*
* Drag in all requested resolvers
*
*/
@@ -166,6 +161,9 @@ REQUIRE_OBJECT ( com32_call );
REQUIRE_OBJECT ( com32_wrapper );
REQUIRE_OBJECT ( comboot_resolv );
#endif
+#ifdef IMAGE_EFI
+REQUIRE_OBJECT ( efi_image );
+#endif
/*
* Drag in all requested commands
diff --git a/gpxe/src/core/console.c b/gpxe/src/core/console.c
index 653f689d..c9773f71 100644
--- a/gpxe/src/core/console.c
+++ b/gpxe/src/core/console.c
@@ -1,11 +1,10 @@
#include "stddef.h"
#include "console.h"
#include <gpxe/process.h>
+#include <gpxe/nap.h>
/** @file */
-#include "bios.h"
-
static struct console_driver console_drivers[0]
__table_start ( struct console_driver, console );
static struct console_driver console_drivers_end[0]
@@ -82,9 +81,6 @@ static struct console_driver * has_input ( void ) {
*
* The character read will not be echoed back to any console.
*
- * @bug We need a cleaner way to pick up cpu_nap(). It makes a
- * real-mode call, and so we don't want to use it with LinuxBIOS.
- *
*/
int getchar ( void ) {
struct console_driver *console;
diff --git a/gpxe/src/core/debug.c b/gpxe/src/core/debug.c
index 09830420..3079cd4c 100644
--- a/gpxe/src/core/debug.c
+++ b/gpxe/src/core/debug.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
-#include <io.h>
+#include <gpxe/io.h>
#include <console.h>
void pause ( void ) {
diff --git a/gpxe/src/core/gdbudp.c b/gpxe/src/core/gdbudp.c
index c49a1bca..26feb38a 100644
--- a/gpxe/src/core/gdbudp.c
+++ b/gpxe/src/core/gdbudp.c
@@ -19,7 +19,6 @@
#include <stdio.h>
#include <string.h>
#include <byteswap.h>
-#include <bios.h>
#include <gpxe/iobuf.h>
#include <gpxe/in.h>
#include <gpxe/if_arp.h>
@@ -27,6 +26,7 @@
#include <gpxe/ip.h>
#include <gpxe/udp.h>
#include <gpxe/netdevice.h>
+#include <gpxe/nap.h>
#include <gpxe/gdbstub.h>
#include <gpxe/gdbudp.h>
diff --git a/gpxe/src/core/main.c b/gpxe/src/core/main.c
index d5892261..aaf8111b 100644
--- a/gpxe/src/core/main.c
+++ b/gpxe/src/core/main.c
@@ -20,6 +20,7 @@ Literature dealing with the network protocols:
#include <gpxe/shell.h>
#include <gpxe/shell_banner.h>
#include <usr/autoboot.h>
+#include <config/general.h>
#define NORMAL "\033[0m"
#define BOLD "\033[1m"
@@ -39,8 +40,19 @@ __cdecl int main ( void ) {
initialise();
startup();
- /* Print welcome banner */
- printf ( NORMAL "\n\n\n" BOLD "gPXE " VERSION
+ /*
+ * Print welcome banner
+ *
+ *
+ * If you wish to brand this build of gPXE, please do so by
+ * defining the string PRODUCT_NAME in config/general.h.
+ *
+ * While nothing in the GPL prevents you from removing all
+ * references to gPXE or http://etherboot.org, we prefer you
+ * not to do so.
+ *
+ */
+ printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD "gPXE " VERSION
NORMAL " -- Open Source Boot Firmware -- "
CYAN "http://etherboot.org" NORMAL "\n"
"Features:" );
diff --git a/gpxe/src/core/malloc.c b/gpxe/src/core/malloc.c
index 2d892f42..db7f1bed 100644
--- a/gpxe/src/core/malloc.c
+++ b/gpxe/src/core/malloc.c
@@ -20,7 +20,7 @@
#include <stdint.h>
#include <string.h>
#include <strings.h>
-#include <io.h>
+#include <gpxe/io.h>
#include <gpxe/list.h>
#include <gpxe/init.h>
#include <gpxe/malloc.h>
diff --git a/gpxe/src/core/monojob.c b/gpxe/src/core/monojob.c
index 2c91e132..657bfd7a 100644
--- a/gpxe/src/core/monojob.c
+++ b/gpxe/src/core/monojob.c
@@ -63,7 +63,8 @@ struct job_interface monojob = {
int monojob_wait ( const char *string ) {
int key;
int rc;
- tick_t last_progress_dot;
+ unsigned long last_progress_dot;
+ unsigned long elapsed;
printf ( "%s.", string );
monojob_rc = -EINPROGRESS;
@@ -81,7 +82,8 @@ int monojob_wait ( const char *string ) {
break;
}
}
- if ( ( currticks() - last_progress_dot ) > TICKS_PER_SEC ) {
+ elapsed = ( currticks() - last_progress_dot );
+ if ( elapsed >= TICKS_PER_SEC ) {
printf ( "." );
last_progress_dot = currticks();
}
@@ -89,6 +91,7 @@ int monojob_wait ( const char *string ) {
rc = monojob_rc;
done:
+ job_done ( &monojob, rc );
if ( rc ) {
printf ( " %s\n", strerror ( rc ) );
} else {
diff --git a/gpxe/src/core/null_nap.c b/gpxe/src/core/null_nap.c
new file mode 100644
index 00000000..a3b01eb1
--- /dev/null
+++ b/gpxe/src/core/null_nap.c
@@ -0,0 +1,3 @@
+#include <gpxe/nap.h>
+
+PROVIDE_NAP_INLINE ( null, cpu_nap );
diff --git a/gpxe/src/core/nvo.c b/gpxe/src/core/nvo.c
index 13078022..e5c07d98 100644
--- a/gpxe/src/core/nvo.c
+++ b/gpxe/src/core/nvo.c
@@ -203,7 +203,7 @@ void nvo_init ( struct nvo_block *nvo, struct nvs_device *nvs,
nvo->nvs = nvs;
nvo->fragments = fragments;
settings_init ( &nvo->settings, &nvo_settings_operations, refcnt,
- "nvo" );
+ "nvo", 0 );
}
/**
diff --git a/gpxe/src/core/pc_kbd.c b/gpxe/src/core/pc_kbd.c
index d43357fe..799c8beb 100644
--- a/gpxe/src/core/pc_kbd.c
+++ b/gpxe/src/core/pc_kbd.c
@@ -10,7 +10,7 @@
* yhlu@tyan.com
*/
-#include "io.h"
+#include <gpxe/io.h>
#include "console.h"
static char key_map[][128] = {
diff --git a/gpxe/src/core/process.c b/gpxe/src/core/process.c
index cf931acf..6a687140 100644
--- a/gpxe/src/core/process.c
+++ b/gpxe/src/core/process.c
@@ -79,7 +79,9 @@ void step ( void ) {
list_for_each_entry ( process, &run_queue, list ) {
list_del ( &process->list );
list_add_tail ( &process->list, &run_queue );
+ DBGC2 ( process, "PROCESS %p executing\n", process );
process->step ( process );
+ DBGC2 ( process, "PROCESS %p finished executing\n", process );
break;
}
}
diff --git a/gpxe/src/core/serial.c b/gpxe/src/core/serial.c
index 97640f93..5b3be39c 100644
--- a/gpxe/src/core/serial.c
+++ b/gpxe/src/core/serial.c
@@ -13,7 +13,7 @@
#include "stddef.h"
#include <gpxe/init.h>
-#include "io.h"
+#include <gpxe/io.h>
#include <unistd.h>
#include <gpxe/serial.h>
#include "config/serial.h"
diff --git a/gpxe/src/core/settings.c b/gpxe/src/core/settings.c
index 3e9eb18a..2d9c096e 100644
--- a/gpxe/src/core/settings.c
+++ b/gpxe/src/core/settings.c
@@ -333,6 +333,9 @@ int fetch_setting ( struct settings *settings, struct setting *setting,
struct settings *child;
int ret;
+ /* Avoid returning uninitialised data on error */
+ memset ( data, 0, len );
+
/* NULL settings implies starting at the global settings root */
if ( ! settings )
settings = &settings_root;
@@ -417,20 +420,23 @@ int fetch_ipv4_setting ( struct settings *settings, struct setting *setting,
int fetch_int_setting ( struct settings *settings, struct setting *setting,
long *value ) {
union {
- long value;
uint8_t u8[ sizeof ( long ) ];
int8_t s8[ sizeof ( long ) ];
} buf;
int len;
int i;
- buf.value = 0;
+ /* Avoid returning uninitialised data on error */
+ *value = 0;
+
+ /* Fetch raw (network-ordered, variable-length) setting */
len = fetch_setting ( settings, setting, &buf, sizeof ( buf ) );
if ( len < 0 )
return len;
if ( len > ( int ) sizeof ( buf ) )
return -ERANGE;
+ /* Convert to host-ordered signed long */
*value = ( ( buf.s8[0] >= 0 ) ? 0 : -1L );
for ( i = 0 ; i < len ; i++ ) {
*value = ( ( *value << 8 ) | buf.u8[i] );
@@ -452,10 +458,15 @@ int fetch_uint_setting ( struct settings *settings, struct setting *setting,
long svalue;
int len;
+ /* Avoid returning uninitialised data on error */
+ *value = 0;
+
+ /* Fetch as a signed long */
len = fetch_int_setting ( settings, setting, &svalue );
if ( len < 0 )
return len;
+ /* Mask off sign-extended bits */
*value = ( svalue & ( -1UL >> ( sizeof ( long ) - len ) ) );
return len;
@@ -469,7 +480,7 @@ int fetch_uint_setting ( struct settings *settings, struct setting *setting,
* @ret value Setting value, or zero
*/
long fetch_intz_setting ( struct settings *settings, struct setting *setting ){
- long value = 0;
+ long value;
fetch_int_setting ( settings, setting, &value );
return value;
@@ -484,7 +495,7 @@ long fetch_intz_setting ( struct settings *settings, struct setting *setting ){
*/
unsigned long fetch_uintz_setting ( struct settings *settings,
struct setting *setting ) {
- unsigned long value = 0;
+ unsigned long value;
fetch_uint_setting ( settings, setting, &value );
return value;
@@ -655,6 +666,7 @@ static int parse_setting_name ( const char *name, struct settings **settings,
}
tmp++;
}
+ setting->tag |= (*settings)->tag_magic;
}
/* Identify setting type, if specified */
diff --git a/gpxe/src/core/timer.c b/gpxe/src/core/timer.c
index 4e047ea7..d71e3da1 100644
--- a/gpxe/src/core/timer.c
+++ b/gpxe/src/core/timer.c
@@ -1,7 +1,5 @@
/*
- * core/timer.c
- *
- * Copyright (C) 2007 Alexey Zaytsev <alexey.zaytsev@gmail.com>
+ * Copyright (C) 2008 Michael Brown <mbrown@fensystems.co.uk>.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -18,96 +16,25 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <stddef.h>
-#include <assert.h>
-#include <gpxe/timer.h>
-
-static struct timer ts_table[0]
- __table_start ( struct timer, timers );
-static struct timer ts_table_end[0]
- __table_end ( struct timer, timers );
-
-/*
- * This function may be used in custom timer driver.
- *
- * This udelay implementation works well if you've got a
- * fast currticks().
- */
-void generic_currticks_udelay ( unsigned int usecs ) {
- tick_t start;
- tick_t elapsed;
-
- start = currticks();
- do {
- /* xxx: Relax the cpu some way. */
- elapsed = ( currticks() - start );
- } while ( elapsed < usecs );
-}
-
-/**
- * Identify timer source
- *
- * @ret timer Timer source
- */
-static struct timer * timer ( void ) {
- static struct timer *ts = NULL;
-
- /* If we have a timer, use it */
- if ( ts )
- return ts;
-
- /* Scan for a usable timer */
- for ( ts = ts_table ; ts < ts_table_end ; ts++ ) {
- if ( ts->init() == 0 )
- return ts;
- }
-
- /* No timer found; we cannot continue */
- assert ( 0 );
- while ( 1 ) {};
-}
-
-/**
- * Read current time
- *
- * @ret ticks Current time, in ticks
- */
-tick_t currticks ( void ) {
- tick_t ct;
-
- ct = timer()->currticks();
- DBG ( "currticks: %ld.%06ld seconds\n",
- ct / USECS_IN_SEC, ct % USECS_IN_SEC );
-
- return ct;
-}
-
-/**
- * Delay
- *
- * @v usecs Time to delay, in microseconds
- */
-void udelay ( unsigned int usecs ) {
- timer()->udelay ( usecs );
-}
+#include <unistd.h>
/**
- * Delay
+ * Delay for a fixed number of milliseconds
*
- * @v msecs Time to delay, in milliseconds
+ * @v msecs Number of milliseconds for which to delay
*/
-void mdelay ( unsigned int msecs ) {
+void mdelay ( unsigned long msecs ) {
while ( msecs-- )
- udelay ( USECS_IN_MSEC );
+ udelay ( 1000 );
}
/**
- * Delay
+ * Delay for a fixed number of seconds
*
- * @v secs Time to delay, in seconds
+ * @v secs Number of seconds for which to delay
*/
unsigned int sleep ( unsigned int secs ) {
while ( secs-- )
- mdelay ( MSECS_IN_SEC );
+ mdelay ( 1000 );
return 0;
}
diff --git a/gpxe/src/core/uri.c b/gpxe/src/core/uri.c
index cf2b071d..7bb46da0 100644
--- a/gpxe/src/core/uri.c
+++ b/gpxe/src/core/uri.c
@@ -92,8 +92,12 @@ struct uri * parse_uri ( const char *uri_string ) {
uri->fragment = tmp;
}
- /* Identify absolute/relative URI */
- if ( ( tmp = strchr ( raw, ':' ) ) ) {
+ /* Identify absolute/relative URI. We ignore schemes that are
+ * apparently only a single character long, since otherwise we
+ * misinterpret a DOS-style path name ("C:\path\to\file") as a
+ * URI with scheme="C",opaque="\path\to\file".
+ */
+ if ( ( tmp = strchr ( raw, ':' ) ) && ( tmp > ( raw + 1 ) ) ) {
/* Absolute URI: identify hierarchical/opaque */
uri->scheme = raw;
*(tmp++) = '\0';