Replaced main loop with a trivial implementation so that we can try

out the new probing logic.
pull/1/head
Michael Brown 2005-04-12 16:43:18 +00:00
parent 17aad49028
commit 3901d197f7
1 changed files with 39 additions and 20 deletions

View File

@ -41,6 +41,8 @@ int freebsd_howto = 0;
char freebsd_kernel_env[FREEBSD_KERNEL_ENV_SIZE]; char freebsd_kernel_env[FREEBSD_KERNEL_ENV_SIZE];
#endif #endif
#if 0
static inline unsigned long ask_boot(unsigned *index) static inline unsigned long ask_boot(unsigned *index)
{ {
unsigned long order = DEFAULT_BOOT_ORDER; unsigned long order = DEFAULT_BOOT_ORDER;
@ -131,6 +133,9 @@ operations[] = {
{ &disk.dev, disk_probe, disk_load_configuration, disk_load }, { &disk.dev, disk_probe, disk_load_configuration, disk_load },
}; };
#endif
static int main_loop(int state); static int main_loop(int state);
static int exit_ok; static int exit_ok;
@ -138,6 +143,9 @@ static int exit_status;
static int initialized; static int initialized;
/* Global instance of the current boot device */
struct dev dev;
/************************************************************************** /**************************************************************************
* initialise() - perform any C-level initialisation * initialise() - perform any C-level initialisation
* *
@ -150,8 +158,7 @@ void initialise ( void ) {
/* Zero the BSS */ /* Zero the BSS */
memset ( _bss, 0, _ebss - _bss ); memset ( _bss, 0, _ebss - _bss );
/* Call all registered initialisation functions. /* Call all registered initialisation functions */
*/
call_init_fns (); call_init_fns ();
} }
@ -159,28 +166,34 @@ void initialise ( void ) {
MAIN - Kick off routine MAIN - Kick off routine
**************************************************************************/ **************************************************************************/
int main ( void ) { int main ( void ) {
int state;
/* Print out configuration */
print_config(); print_config();
cleanup();
/* -1: timeout or ESC /*
-2: error return from loader * Trivial main loop: we need to think about how we want to
-3: finish the current run. * prompt the user etc.
0: retry booting bootp and tftp *
1: retry tftp with possibly modified bootp reply
2: retry bootp and tftp
3: retry probe bootp and tftp
4: start with the next device and retry from there...
255: exit Etherboot
256: retry after relocation
*/ */
state = setjmp(restart_etherboot); for ( ; ; disable ( &dev ), call_reset_fns() ) {
exit_ok = 1;
for(;state != 255;) { /* Get next boot device */
state = main_loop(state); if ( ! probe ( &dev ) ) {
/* Reached end of device list */
continue;
}
/* Load configuration (e.g. DHCP) */
if ( ! load_configuration ( &dev ) ) {
/* DHCP failed */
continue;
}
/* Load image */
if ( ! load ( &dev ) )
/* Load failed */
continue;
} }
/* arch_on_exit(exit_status) */
/* Call registered per-object exit functions */ /* Call registered per-object exit functions */
call_exit_fns (); call_exit_fns ();
@ -196,6 +209,9 @@ void exit(int status)
longjmp(restart_etherboot, 255); longjmp(restart_etherboot, 255);
} }
#if 0
static int main_loop(int state) static int main_loop(int state)
{ {
/* Splitting main into 2 pieces makes the semantics of /* Splitting main into 2 pieces makes the semantics of
@ -331,6 +347,9 @@ static int main_loop(int state)
} }
#endif
/************************************************************************** /**************************************************************************
LOADKERNEL - Try to load kernel image LOADKERNEL - Try to load kernel image
**************************************************************************/ **************************************************************************/