From cc3d937224fbe6b30a3909c0cc6a890eea686e9f Mon Sep 17 00:00:00 2001 From: Paul Saab Date: Wed, 14 Jun 2000 10:34:29 +0000 Subject: [PATCH] Delay calling the device cleanup routines until the absolute last moment. We were cleaning up after PXE too early and the module dependancy code would not be able to load any files if it needed too. --- sys/boot/alpha/libalpha/elf_freebsd.c | 1 + sys/boot/common/boot.c | 5 ----- sys/boot/common/bootstrap.h | 2 ++ sys/boot/common/misc.c | 11 +++++++++++ sys/boot/i386/libi386/aout_freebsd.c | 1 + sys/boot/i386/libi386/elf32_freebsd.c | 1 + sys/boot/i386/libi386/elf64_freebsd.c | 1 + sys/boot/i386/libi386/elf_freebsd.c | 1 + 8 files changed, 18 insertions(+), 5 deletions(-) diff --git a/sys/boot/alpha/libalpha/elf_freebsd.c b/sys/boot/alpha/libalpha/elf_freebsd.c index 71849b5ff046..e76741f526c0 100644 --- a/sys/boot/alpha/libalpha/elf_freebsd.c +++ b/sys/boot/alpha/libalpha/elf_freebsd.c @@ -152,6 +152,7 @@ elf_exec(struct preloaded_file *fp) printf("Entering %s at 0x%lx...\n", fp->f_name, hdr->e_entry); closeall(); + dev_cleanup(); alpha_pal_imb(); (*(void (*)())hdr->e_entry)(ffp_save, ptbr_save, BOOTINFO_MAGIC, &bootinfo_v1, 1, 0); diff --git a/sys/boot/common/boot.c b/sys/boot/common/boot.c index dfd400ce4b9f..7c02e56ccc47 100644 --- a/sys/boot/common/boot.c +++ b/sys/boot/common/boot.c @@ -110,11 +110,6 @@ command_boot(int argc, char *argv[]) if (archsw.arch_autoload() != 0) return(CMD_ERROR); - /* Call cleanup routines */ - for (i = 0; devsw[i] != NULL; ++i) - if (devsw[i]->dv_cleanup != NULL) - (devsw[i]->dv_cleanup)(); - /* Call the exec handler from the loader matching the kernel */ file_formats[fp->f_loader]->l_exec(fp); return(CMD_ERROR); diff --git a/sys/boot/common/bootstrap.h b/sys/boot/common/bootstrap.h index 4c38154f7bcf..67ca5029f9c8 100644 --- a/sys/boot/common/bootstrap.h +++ b/sys/boot/common/bootstrap.h @@ -314,3 +314,5 @@ extern struct arch_switch archsw; /* This must be provided by the MD code, but should it be in the archsw? */ extern void delay(int delay); + +extern void dev_cleanup(void); diff --git a/sys/boot/common/misc.c b/sys/boot/common/misc.c index 819d4a46594c..bc33c5362f63 100644 --- a/sys/boot/common/misc.c +++ b/sys/boot/common/misc.c @@ -131,3 +131,14 @@ hexdump(caddr_t region, size_t len) } pager_close(); } + +void +dev_cleanup(void) +{ + int i; + + /* Call cleanup routines */ + for (i = 0; devsw[i] != NULL; ++i) + if (devsw[i]->dv_cleanup != NULL) + (devsw[i]->dv_cleanup)(); +} diff --git a/sys/boot/i386/libi386/aout_freebsd.c b/sys/boot/i386/libi386/aout_freebsd.c index 5f720c2c6c77..857dc3a4596e 100644 --- a/sys/boot/i386/libi386/aout_freebsd.c +++ b/sys/boot/i386/libi386/aout_freebsd.c @@ -77,6 +77,7 @@ aout_exec(struct preloaded_file *fp) bi->bi_symtab = ssym; /* XXX this is only the primary kernel symtab */ bi->bi_esymtab = esym; + dev_cleanup(); __exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop); panic("exec returned"); diff --git a/sys/boot/i386/libi386/elf32_freebsd.c b/sys/boot/i386/libi386/elf32_freebsd.c index f528d9653f19..a3ad9fb19043 100644 --- a/sys/boot/i386/libi386/elf32_freebsd.c +++ b/sys/boot/i386/libi386/elf32_freebsd.c @@ -84,6 +84,7 @@ elf_exec(struct preloaded_file *fp) printf("Start @ 0x%lx ...\n", entry); #endif + dev_cleanup(); __exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop); panic("exec returned"); diff --git a/sys/boot/i386/libi386/elf64_freebsd.c b/sys/boot/i386/libi386/elf64_freebsd.c index f528d9653f19..a3ad9fb19043 100644 --- a/sys/boot/i386/libi386/elf64_freebsd.c +++ b/sys/boot/i386/libi386/elf64_freebsd.c @@ -84,6 +84,7 @@ elf_exec(struct preloaded_file *fp) printf("Start @ 0x%lx ...\n", entry); #endif + dev_cleanup(); __exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop); panic("exec returned"); diff --git a/sys/boot/i386/libi386/elf_freebsd.c b/sys/boot/i386/libi386/elf_freebsd.c index f528d9653f19..a3ad9fb19043 100644 --- a/sys/boot/i386/libi386/elf_freebsd.c +++ b/sys/boot/i386/libi386/elf_freebsd.c @@ -84,6 +84,7 @@ elf_exec(struct preloaded_file *fp) printf("Start @ 0x%lx ...\n", entry); #endif + dev_cleanup(); __exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop); panic("exec returned");