diff options
author | msmith <msmith@FreeBSD.org> | 1998-09-14 18:27:06 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1998-09-14 18:27:06 +0000 |
commit | 97d5b830761c0a62490a16c2f4942930afcbba94 (patch) | |
tree | 9b227328959ed217910f704d659822fa67002976 /sys/boot | |
parent | 34e8f6424cbf5128e7dc3149486965dd4e17c6fe (diff) | |
download | FreeBSD-src-97d5b830761c0a62490a16c2f4942930afcbba94.zip FreeBSD-src-97d5b830761c0a62490a16c2f4942930afcbba94.tar.gz |
Resynch with working sources before BTX integration.
- Use format-independant module allocator.
- Conditionalise ISA PnP support.
- Simplify PnP enumerator interface.
- Improve module/object searching.
- Add missing depend/install targets in BTX makefiles.
- Pass the kernel environment and module data in extended bootinfo fields.
- Add a pointer to the end of the kernel + modules in bootinfo.
- Fix parsing of old-style kernel arguments.
Diffstat (limited to 'sys/boot')
-rw-r--r-- | sys/boot/alpha/libalpha/elf_freebsd.c | 7 | ||||
-rw-r--r-- | sys/boot/common/Makefile.inc | 12 | ||||
-rw-r--r-- | sys/boot/common/bootstrap.h | 53 | ||||
-rw-r--r-- | sys/boot/common/interp.c | 4 | ||||
-rw-r--r-- | sys/boot/common/load_aout.c | 10 | ||||
-rw-r--r-- | sys/boot/common/module.c | 114 | ||||
-rw-r--r-- | sys/boot/common/pnp.c | 161 | ||||
-rw-r--r-- | sys/boot/i386/btx/btx/Makefile | 6 | ||||
-rw-r--r-- | sys/boot/i386/btx/btxldr/Makefile | 7 | ||||
-rw-r--r-- | sys/boot/i386/libi386/aout_freebsd.c | 31 | ||||
-rw-r--r-- | sys/boot/i386/libi386/bootinfo.c | 20 | ||||
-rw-r--r-- | sys/boot/i386/libi386/bootinfo32.c | 20 | ||||
-rw-r--r-- | sys/boot/i386/libi386/bootinfo64.c | 20 | ||||
-rw-r--r-- | sys/boot/i386/libi386/crt/bootsect/bbinfo.h | 4 | ||||
-rw-r--r-- | sys/boot/i386/libi386/i386_copy.c | 2 | ||||
-rw-r--r-- | sys/boot/i386/libi386/libi386.h | 3 | ||||
-rw-r--r-- | sys/boot/i386/loader/Makefile | 6 | ||||
-rw-r--r-- | sys/boot/i386/loader/conf.c | 11 | ||||
-rw-r--r-- | sys/boot/i386/loader/main.c | 4 |
19 files changed, 348 insertions, 147 deletions
diff --git a/sys/boot/alpha/libalpha/elf_freebsd.c b/sys/boot/alpha/libalpha/elf_freebsd.c index b2e59ae..402266b 100644 --- a/sys/boot/alpha/libalpha/elf_freebsd.c +++ b/sys/boot/alpha/libalpha/elf_freebsd.c @@ -1,4 +1,4 @@ -/* $Id: elf_freebsd.c,v 1.1.1.1 1998/08/21 03:17:42 msmith Exp $ */ +/* $Id: elf_freebsd.c,v 1.2 1998/08/31 21:10:40 msmith Exp $ */ /* $NetBSD: loadfile.c,v 1.10 1998/06/25 06:45:46 ross Exp $ */ /*- @@ -130,11 +130,10 @@ elf_loadmodule(char *filename, vm_offset_t dest, struct loaded_module **result) /* * Ok, we think this is for us. */ - mp = malloc(sizeof(struct loaded_module)); + mp = mod_allocmodule(); mp->m_name = strdup(filename); /* XXX should we prune the name? */ mp->m_type = strdup("elf kernel"); /* XXX only if that's what we really are */ - mp->m_args = NULL; /* XXX should we put the bootstrap args here and parse later? */ - mp->m_metadata = NULL; + dest = (vm_offset_t) hdr.e_entry; mp->m_addr = dest; if (mod_findmodule(NULL, NULL) != NULL) { diff --git a/sys/boot/common/Makefile.inc b/sys/boot/common/Makefile.inc index 8826353..0eacbe7 100644 --- a/sys/boot/common/Makefile.inc +++ b/sys/boot/common/Makefile.inc @@ -1,4 +1,12 @@ -# $Id: Makefile.inc,v 1.3 1998/09/01 00:41:24 msmith Exp $ +# $Id: Makefile.inc,v 1.4 1998/09/04 02:43:26 msmith Exp $ SRCS+= boot.c commands.c console.c devopen.c interp.c interp_backslash.c -SRCS+= interp_parse.c load_aout.c ls.c misc.c module.c panic.c # pnp.c +SRCS+= interp_parse.c load_aout.c ls.c misc.c module.c panic.c + +# Machine-independant ISA PnP +.if HAVE_ISABUS +SRCS+= isapnp.c +.endif +.if HAVE_PNP +SRCS+= pnp.c +.endif diff --git a/sys/boot/common/bootstrap.h b/sys/boot/common/bootstrap.h index 0d7950c..f624c29 100644 --- a/sys/boot/common/bootstrap.h +++ b/sys/boot/common/bootstrap.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bootstrap.h,v 1.3 1998/09/03 02:10:07 msmith Exp $ + * $Id: bootstrap.h,v 1.4 1998/09/04 02:43:26 msmith Exp $ */ #include <sys/types.h> @@ -57,6 +57,9 @@ extern char command_errbuf[]; /* XXX blah, length */ extern void interact(void); extern void source(char *filename); +/* interp_parse.c */ +extern int parse(int *argc, char ***argv, char *str); + /* boot.c */ extern int autoboot(int delay, char *prompt); @@ -89,25 +92,33 @@ extern void cons_probe(void); /* * Plug-and-play enumerator/configurator interface. */ +struct pnpident +{ + char *id_ident; /* ASCII identifier, actual format varies with bus/handler */ + struct pnpident *id_next; /* the next identifier */ +}; + +struct pnphandler; struct pnpinfo { - char *pi_ident; /* ASCII identifier, actual format varies with bus/handler */ + struct pnpident *pi_ident; /* list of identifiers */ int pi_revision; /* optional revision (or -1) if not supported */ char *pi_module; /* module/args nominated to handle device */ int pi_argc; /* module arguments */ char **pi_argv; - int pi_handler; /* handler which detected this device */ + struct pnphandler *pi_handler; /* handler which detected this device */ struct pnpinfo *pi_next; -} +}; struct pnphandler { - char *pp_name; /* handler/bus name */ - struct pnpinfo *(pp_enumerate *)(int index); /* return a string identifying device (index) */ + char *pp_name; /* handler/bus name */ + void (* pp_enumerate)(struct pnpinfo **); /* add detected devices to chain */ }; -extern struct pnphandler *pnphandlers[]; /* provided by MD code */ - +extern struct pnphandler *pnphandlers[]; /* provided by MD code */ + +extern void pnp_addident(struct pnpinfo *pi, char *ident); /* * Module metadata header. @@ -158,11 +169,21 @@ extern struct loaded_module *mod_findmodule(char *name, char *type); extern void mod_addmetadata(struct loaded_module *mp, int type, size_t size, void *p); extern struct module_metadata *mod_findmetadata(struct loaded_module *mp, int type); extern void mod_discard(struct loaded_module *mp); +extern struct loaded_module *mod_allocmodule(void); + + +/* MI module loaders */ +extern int aout_loadmodule(char *filename, vm_offset_t dest, struct loaded_module **result); +extern vm_offset_t aout_findsym(char *name, struct loaded_module *mp); + +/* extern int elf_loadmodule(char *filename, vm_offset_t dest, struct loaded_module **result); */ /* * Module information subtypes + * + * XXX these are copies of the defines in <sys/linker.h>, and should be nuked + * XXX before being committed. */ -/* XXX these belong in <machine/bootinfo.h> */ #define MODINFO_NAME 0x0000 #define MODINFO_TYPE 0x0001 #define MODINFO_ADDR 0x0002 @@ -173,16 +194,12 @@ extern void mod_discard(struct loaded_module *mp); #define MODINFOMD_ELFHDR 0x0002 /* ELF header */ #define MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */ -/* MI module loaders */ -extern int aout_loadmodule(char *filename, vm_offset_t dest, struct loaded_module **result); -extern vm_offset_t aout_findsym(char *name, struct loaded_module *mp); - -/* extern int elf_loadmodule(char *filename, vm_offset_t dest, struct loaded_module **result); */ - #define KLD_IDENT_SYMNAME "kld_identifier_" #define MODINFOMD_KLDIDENT (MODINFOMD_NOCOPY | 0x4000) #define MODINFOMD_KLDDEP (MODINFOMD_NOCOPY | 0x4001) + + #if defined(__ELF__) /* @@ -268,9 +285,15 @@ struct arch_switch int (*arch_copyout)(vm_offset_t src, void *dest, size_t len); /* Read from file to module address space, same semantics as read() */ int (*arch_readin)(int fd, vm_offset_t dest, size_t len); + /* Perform ISA byte port I/O (only for systems with ISA) */ + int (*arch_isainb)(int port); + void (*arch_isaoutb)(int port, int value); }; 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); + /* * XXX these belong in a system header */ diff --git a/sys/boot/common/interp.c b/sys/boot/common/interp.c index c58b1c4..69a2fc3 100644 --- a/sys/boot/common/interp.c +++ b/sys/boot/common/interp.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: interp.c,v 1.2 1998/09/01 00:41:24 msmith Exp $ + * $Id: interp.c,v 1.3 1998/09/03 02:10:07 msmith Exp $ */ /* * Simple commandline interpreter, toplevel and misc. @@ -37,8 +37,6 @@ #define MAXARGS 20 /* maximum number of arguments allowed */ -extern int parse(int *argc, char ***argv, char *str); /* interp_parse.c */ - static void prompt(void); /* diff --git a/sys/boot/common/load_aout.c b/sys/boot/common/load_aout.c index 5c59372..3ecba66 100644 --- a/sys/boot/common/load_aout.c +++ b/sys/boot/common/load_aout.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: load_aout.c,v 1.1 1998/08/31 21:10:42 msmith Exp $ + * $Id: load_aout.c,v 1.2 1998/09/03 02:10:07 msmith Exp $ */ #include <sys/param.h> @@ -126,11 +126,11 @@ aout_loadmodule(char *filename, vm_offset_t dest, struct loaded_module **result) /* * Ok, we think we should handle this. */ - mp = malloc(sizeof(struct loaded_module)); - mp->m_name = kernel ? strdup(filename) : NULL; /* XXX should we prune the name? */ + mp = mod_allocmodule(); + if (kernel) + mp->m_name = strdup(filename); /* XXX should we prune the name? */ mp->m_type = strdup(kernel ? aout_kerneltype : aout_moduletype); - mp->m_args = NULL; /* filled in by parent */ - mp->m_metadata = NULL; + /* Page-align the load address */ addr = dest; pad = (u_int)addr & PAGE_MASK; diff --git a/sys/boot/common/module.c b/sys/boot/common/module.c index f10fe3b..d7f4019 100644 --- a/sys/boot/common/module.c +++ b/sys/boot/common/module.c @@ -23,14 +23,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: module.c,v 1.2 1998/08/31 21:10:42 msmith Exp $ + * $Id: module.c,v 1.3 1998/09/03 02:10:08 msmith Exp $ */ /* * module function dispatcher, support, etc. - * - * XXX need a 'searchmodule' function that takes a name and - * traverses a search path. */ #include <stand.h> @@ -40,12 +37,15 @@ static struct loaded_module *mod_loadmodule(char *name, int argc, char *argv[]); static char *mod_searchdep(struct loaded_module *mp); +static char *mod_searchfile(char *name); static char *mod_searchmodule(char *name); static void mod_append(struct loaded_module *mp); -/* XXX load address should be tweaked by first module loaded (kernel) */ +/* load address should be tweaked by first module loaded (kernel) */ static vm_offset_t loadaddr = 0; +static char *default_searchpath ="/;/boot"; + struct loaded_module *loaded_modules = NULL; /* @@ -231,9 +231,13 @@ mod_loadobj(char *type, char *name) return(CMD_ERROR); } - /* Try to come up with a fully-qualified name if we don't have one */ - if ((cp = mod_searchmodule(name)) != NULL) - name = cp; + /* locate the file on the load path */ + cp = mod_searchfile(name); + if (cp == NULL) { + sprintf(command_errbuf, "can't find '%s'", name); + return(CMD_ERROR); + } + name = cp; if ((fd = open(name, O_RDONLY)) < 0) { sprintf(command_errbuf, "can't open '%s': %s", name, strerror(errno)); @@ -282,9 +286,14 @@ mod_loadmodule(char *name, int argc, char *argv[]) int i, err; char *cp; - /* Try to come up with a fully-qualified name if we don't have one */ - if ((cp = mod_searchmodule(name)) != NULL) - name = cp; + /* locate the module on the search path */ + cp = mod_searchmodule(name); + if (cp == NULL) { + sprintf(command_errbuf, "can't find '%s'", name); + return(NULL); + } + name = cp; + err = 0; for (i = 0, mp = NULL; (module_formats[i] != NULL) && (mp == NULL); i++) { if ((err = (module_formats[i]->l_load)(name, loadaddr, &mp)) != 0) { @@ -422,7 +431,7 @@ mod_findmetadata(struct loaded_module *mp, int type) } /* - * Attempt to locate a kernel module file for the module (name). + * Attempt to find the file (name) on the module searchpath. * If (name) is qualified in any way, we simply check it and * return it or NULL. If it is not qualified, then we attempt * to construct a path using entries in the environment variable @@ -432,10 +441,10 @@ mod_findmetadata(struct loaded_module *mp, int type) * it internally. */ static char * -mod_searchmodule(char *name) +mod_searchfile(char *name) { static char *result = NULL; - static char *defpath = "/boot", *path; + char *path; char *cp, *sp; struct stat sb; @@ -458,7 +467,7 @@ mod_searchmodule(char *name) * Get the module path */ if ((cp = getenv("module_path")) == NULL) - cp = defpath; + cp = default_searchpath; sp = path = strdup(cp); /* @@ -467,9 +476,14 @@ mod_searchmodule(char *name) if (result != NULL) free(result); while((cp = strsep(&path, ";")) != NULL) { - result = malloc(strlen(cp) + strlen(name) + 2); - sprintf(result, "%s/%s", cp, name); - if (stat(result, &sb) == 0) + result = malloc(strlen(cp) + strlen(name) + 5); + strcpy(result, cp); + if (cp[strlen(cp) - 1] != '/') + strcat(result, "/"); + strcat(result, name); +/* printf("search '%s'\n", result); */ + if ((stat(result, &sb) == 0) && + S_ISREG(sb.st_mode)) break; free(result); result = NULL; @@ -479,6 +493,28 @@ mod_searchmodule(char *name) } /* + * Attempt to locate the file containing the module (name) + */ +static char * +mod_searchmodule(char *name) +{ + char *tn, *result; + + /* Look for (name).ko */ + tn = malloc(strlen(name) + 3); + strcpy(tn, name); + strcat(tn, ".ko"); + result = mod_searchfile(tn); + free(tn); + /* Look for just (name) (useful for finding kernels) */ + if (result == NULL) + result = mod_searchfile(name); + + return(result); +} + + +/* * Throw a module away */ void @@ -486,21 +522,39 @@ mod_discard(struct loaded_module *mp) { struct module_metadata *md; - while (mp->m_metadata != NULL) { - md = mp->m_metadata; - mp->m_metadata = mp->m_metadata->md_next; - free(md); - } - if (mp->m_name != NULL) - free(mp->m_name); - if (mp->m_type != NULL) - free(mp->m_type); - if (mp->m_args != NULL) - free(mp->m_args); - free(mp); + if (mp != NULL) { + while (mp->m_metadata != NULL) { + md = mp->m_metadata; + mp->m_metadata = mp->m_metadata->md_next; + free(md); + } + if (mp->m_name != NULL) + free(mp->m_name); + if (mp->m_type != NULL) + free(mp->m_type); + if (mp->m_args != NULL) + free(mp->m_args); + free(mp); + } } /* + * Allocate a new module; must be used instead of malloc() + * to ensure safe initialisation. + */ +struct loaded_module * +mod_allocmodule(void) +{ + struct loaded_module *mp; + + if ((mp = malloc(sizeof(struct loaded_module))) != NULL) { + bzero(mp, sizeof(struct loaded_module)); + } + return(mp); +} + + +/* * Add a module to the chain */ static void diff --git a/sys/boot/common/pnp.c b/sys/boot/common/pnp.c index d0b6061..84f3825 100644 --- a/sys/boot/common/pnp.c +++ b/sys/boot/common/pnp.c @@ -10,81 +10,97 @@ */ #include <stand.h> +#include <string.h> #include <bootstrap.h> static struct pnpinfo *pnp_devices = NULL; -static void pnp_discard(void); +static void pnp_discard(struct pnpinfo **list); +static int pnp_readconf(char *path); +static int pnp_scankernel(void); /* * Perform complete enumeration sweep, and load required module(s) if possible. */ +COMMAND_SET(pnpscan, "pnpscan", "scan for PnP devices", pnp_scan); + int -pnp_autoload(void) +pnp_scan(int argc, char *argv[]) { - int hdlr, idx; + int hdlr; /* forget anything we think we knew */ - pnp_discard(); + pnp_discard(&pnp_devices); /* iterate over all of the handlers */ - for (hdlr = 0; pnphandlers[hdlr]->pp_name != NULL; i++) { + for (hdlr = 0; pnphandlers[hdlr] != NULL; hdlr++) { printf("Probing bus '%s'...\n", pnphandlers[hdlr]->pp_name); - idx = 0; - while ((pi = pnphandlers[hdlr]->pp_enumerate(idx++)) != NULL) { - printf(" %s\n", pi->pi_ident); - pi->pi_handler = hdlr; - pi->pi_next = pnp_devices; - pnp_devices = pi; - } - } - /* find anything? */ - if (pnp_devices != NULL) { - /* XXX hardcoded paths! should use loaddev? */ - pnp_readconf("/boot/pnpdata.local"); - pnp_readconf("/boot/pnpdata"); - - pnp_reload(); + pnphandlers[hdlr]->pp_enumerate(&pnp_devices); } + return(CMD_OK); } /* * Try to load outstanding modules (eg. after disk change) */ int -pnp_reload(void) +pnp_reload(char *fname) { struct pnpinfo *pi; char *modfname; - /* try to load any modules that have been nominated */ - for (pi = pnp_devices; pi != NULL; pi = pi->pi_next) { - /* Already loaded? */ - if ((pi->pi_module != NULL) && (mod_findmodule(pi->pi_module, NULL) == NULL)) { - modfname = malloc(strlen(pi->pi_module + 3)); - sprintf(modfname, "%s.ko", pi->pi_module); /* XXX implicit knowledge of KLD module filenames */ - if (mod_load(pi->pi_module, pi->pi_argc, pi->pi_argv)) - printf("Could not load module '%s' for device '%s'\n", modfname, pi->pi_ident); - free(modfname); + /* find anything? */ + if (pnp_devices != NULL) { + + /* check for kernel, assign modules handled by static drivers there */ + if (pnp_scankernel()) { + command_errmsg = "cannot load drivers until kernel loaded"; + return(CMD_ERROR); + } + if (fname == NULL) { + /* default paths */ + pnp_readconf("/boot/pnpdata.local"); + pnp_readconf("/boot/pnpdata"); + } else { + if (pnp_readconf("fname")) { + sprintf(command_errbuf, "can't read PnP information from '%s'", fname); + return(CMD_ERROR); + } + } + + /* try to load any modules that have been nominated */ + for (pi = pnp_devices; pi != NULL; pi = pi->pi_next) { + /* Already loaded? */ + if ((pi->pi_module != NULL) && (mod_findmodule(pi->pi_module, NULL) == NULL)) { + modfname = malloc(strlen(pi->pi_module + 3)); + sprintf(modfname, "%s.ko", pi->pi_module); /* XXX implicit knowledge of KLD module filenames */ + if (mod_load(pi->pi_module, pi->pi_argc, pi->pi_argv)) + printf("Could not load module '%s' for device '%s'\n", modfname, pi->pi_ident->id_ident); + free(modfname); + } } } + return(CMD_OK); } - /* - * Throw away anything we think we know about PnP devices + * Throw away anything we think we know about PnP devices on (list) */ static void -pnp_discard(void) +pnp_discard(struct pnpinfo **list) { struct pnpinfo *pi; + struct pnpident *id; - while (pnp_devices != NULL) { - pi = pnp_devices; - pnp_devices = pnp_devices->pi_next; - if (pi->pi_ident) - free(pi->pi_ident); + while (*list != NULL) { + pi = *list; + *list = (*list)->pi_next; + while (pi->pi_ident) { + id = pi->pi_ident; + pi->pi_ident = pi->pi_ident->id_next; + free(id); + } if (pi->pi_module) free(pi->pi_module); if (pi->pi_argv) @@ -114,10 +130,11 @@ pnp_discard(void) * ignored (but should be used), and the 'args' field must come * last. */ -static void +static int pnp_readconf(char *path) { struct pnpinfo *pi; + struct pnpident *id; int fd, line; char lbuf[128], *currbus, *ident, *revision, *module, *args; char *cp, *ep, *tp, c; @@ -155,7 +172,7 @@ pnp_readconf(char *path) continue; /* mapping */ - for (ident = module = args = NULL; *cp != 0;) { + for (ident = module = args = revision = NULL; *cp != 0;) { /* discard leading whitespace */ if (isspace(*cp)) { @@ -164,12 +181,12 @@ pnp_readconf(char *path) } /* scan for terminator, separator */ - for (ep = cp; (*ep != 0) && (*ep != '=') && !isspace(ep); ep++) + for (ep = cp; (*ep != 0) && (*ep != '=') && !isspace(*ep); ep++) ; if (*ep == '=') { *ep = 0; - for (tp = ep + 1; (*tp != 0) && !isspace(tp); tp++) + for (tp = ep + 1; (*tp != 0) && !isspace(*tp); tp++) ; c = *tp; *tp = 0; @@ -200,22 +217,64 @@ pnp_readconf(char *path) } /* - * Loop looking for module/bus that might match this + * Loop looking for module/bus that might match this, but aren't already + * assigned. * XXX no revision parse/test here yet. */ - for (pi = pnp_modules; pi != NULL; pi = pi->pi_next) { - if (!strcmp(pnphandlers[pi->pi_handler]->pp_name, currbus) && - !strcmp(pi->pi_indent, ident)) { - if (args != NULL) - if (parse(&pi->pi_argc, &pi->pi_argv, args)) { - printf("%s line %d: bad arguments\n", path, line); + for (pi = pnp_devices; pi != NULL; pi = pi->pi_next) { + + /* no driver assigned, bus matches OK */ + if ((pi->pi_module == NULL) && + !strcmp(pi->pi_handler->pp_name, currbus)) { + + /* scan idents, take first match */ + for (id = pi->pi_ident; id != NULL; id = id->id_next) + if (!strcmp(id->id_ident, ident)) break; - } - pi->pi_module = strdup(module); + + /* find a match? */ + if (id != NULL) { + if (args != NULL) + if (parse(&pi->pi_argc, &pi->pi_argv, args)) { + printf("%s line %d: bad arguments\n", path, line); + continue; + } + pi->pi_module = strdup(module); + printf("use module '%s' for %s:%s\n", module, pi->pi_handler->pp_name, id->id_ident); + } } } } close(fd); } + return(CMD_OK); +} + +static int +pnp_scankernel(void) +{ + return(CMD_OK); +} + +/* + * Add a unique identifier to (pi) + */ +void +pnp_addident(struct pnpinfo *pi, char *ident) +{ + struct pnpident *id, **idp; + + if (pi->pi_ident == NULL) { + idp = &(pi->pi_ident); + } else { + for (id = pi->pi_ident; id->id_next != NULL; id = id->id_next) + if (!strcmp(id->id_ident, ident)) + return; /* already have this one */ + ; + idp = &(id->id_next); + } + *idp = malloc(sizeof(struct pnpident)); + (*idp)->id_next = NULL; + (*idp)->id_ident = strdup(ident); } diff --git a/sys/boot/i386/btx/btx/Makefile b/sys/boot/i386/btx/btx/Makefile index bd0cb6f..9897217 100644 --- a/sys/boot/i386/btx/btx/Makefile +++ b/sys/boot/i386/btx/btx/Makefile @@ -1,4 +1,4 @@ -# $Id:$ +# $Id: Makefile,v 1.1.1.1 1998/09/12 04:29:23 rnordier Exp $ M4?= m4 @@ -20,3 +20,7 @@ btx.o: btx.m4 btx.s clean: rm -f btx btx.out btx.o + +depend: + +install: diff --git a/sys/boot/i386/btx/btxldr/Makefile b/sys/boot/i386/btx/btxldr/Makefile index 97c8e7f..c7fcecf 100644 --- a/sys/boot/i386/btx/btxldr/Makefile +++ b/sys/boot/i386/btx/btxldr/Makefile @@ -1,4 +1,4 @@ -# $Id:$ +# $Id: Makefile,v 1.1 1998/09/12 06:30:26 rnordier Exp $ ORG=0x100000 @@ -18,3 +18,8 @@ btxldr.o: btxldr.s clean: rm -f btxldr btxldr.out btxldr.o + +depend: + +install: + diff --git a/sys/boot/i386/libi386/aout_freebsd.c b/sys/boot/i386/libi386/aout_freebsd.c index be4cea6..7d570d3 100644 --- a/sys/boot/i386/libi386/aout_freebsd.c +++ b/sys/boot/i386/libi386/aout_freebsd.c @@ -23,13 +23,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: aout_freebsd.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ + * $Id: aout_freebsd.c,v 1.2 1998/08/31 21:10:43 msmith Exp $ */ #include <sys/param.h> #include <sys/exec.h> #include <sys/imgact_aout.h> #include <sys/reboot.h> +#include <sys/linker.h> #include <string.h> #include <machine/bootinfo.h> #include <stand.h> @@ -80,14 +81,6 @@ aout_exec(struct loaded_module *mp) } free(currdev); - /* Device data is kept in the kernel argv array */ - argv[0] = bi_getboothowto(mp->m_args); - argv[1] = bootdevnr; - argv[2] = 0; - argv[3] = 0; - argv[4] = 0; - argv[5] = (u_int32_t)vtophys(&bi); - /* legacy bootinfo structure */ bi.bi_version = BOOTINFO_VERSION; bi.bi_kernelname = 0; /* XXX char * -> kernel name */ @@ -102,6 +95,14 @@ aout_exec(struct loaded_module *mp) bi.bi_symtab = mp->m_addr + ehdr->a_text + ehdr->a_data + ehdr->a_bss; bi.bi_esymtab = bi.bi_symtab + sizeof(ehdr->a_syms) + ehdr->a_syms; + /* Device data is kept in the kernel argv array */ + argv[0] = bi_getboothowto(mp->m_args); /* boothowto */ + argv[1] = bootdevnr; /* bootdev */ + argv[2] = 0; /* old cyloffset */ + argv[3] = 0; /* old esym */ + argv[4] = 0; /* "new" bootinfo magic */ + argv[5] = (u_int32_t)vtophys(&bi); + /* find the last module in the chain */ for (xp = mp; xp->m_next != NULL; xp = xp->m_next) ; @@ -112,7 +113,8 @@ aout_exec(struct loaded_module *mp) pad = PAGE_SIZE - pad; addr += pad; } - /* copy our environment XXX save addr here as env pointer, store in bootinfo? */ + /* copy our environment */ + bi.bi_envp = addr; addr = bi_copyenv(addr); /* pad to a page boundary */ @@ -121,9 +123,12 @@ aout_exec(struct loaded_module *mp) pad = PAGE_SIZE - pad; addr += pad; } - /* copy module list and metadata XXX save addr here as env pointer, store in bootinfo? */ - bi_copymodules(addr); - + /* copy module list and metadata */ + bi.bi_modulep = addr; + addr = bi_copymodules(addr); + + /* all done copying stuff in, save end of loaded object space */ + bi.bi_kernend = addr; entry = ehdr->a_entry & 0xffffff; #ifdef DEBUG diff --git a/sys/boot/i386/libi386/bootinfo.c b/sys/boot/i386/libi386/bootinfo.c index 041ccb8..02d217b 100644 --- a/sys/boot/i386/libi386/bootinfo.c +++ b/sys/boot/i386/libi386/bootinfo.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bootinfo.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ + * $Id: bootinfo.c,v 1.2 1998/09/03 02:10:09 msmith Exp $ */ #include <sys/reboot.h> @@ -57,6 +57,7 @@ bi_getboothowto(char *kargs) int active; int i; + /* Parse kargs */ howto = 0; if (kargs != NULL) { cp = kargs; @@ -94,9 +95,11 @@ bi_getboothowto(char *kargs) active = 0; break; } + active = 0; + cp++; } - cp++; } + /* get equivalents from the environment */ for (i = 0; howto_names[i].ev != NULL; i++) if (getenv(howto_names[i].ev) != NULL) howto |= howto_names[i].mask; @@ -137,7 +140,7 @@ bi_copyenv(vm_offset_t addr) * used as a directory for loaded modules. * * Module data is presented in a self-describing format. Each datum - * is preceeded by a 16-bit identifier and a 16-bit size field. + * is preceeded by a 32-bit identifier and a 32-bit size field. * * Currently, the following data are saved: * @@ -177,6 +180,14 @@ bi_copyenv(vm_offset_t addr) a += mm->md_size; \ } +#define MOD_END(a) { \ + u_int32_t ident = 0; \ + vpbcopy(&ident, a, sizeof(ident)); \ + a += sizeof(ident); \ + vpbcopy(&ident, a, sizeof(ident)); \ + a += sizeof(ident); \ +} + vm_offset_t bi_copymodules(vm_offset_t addr) { @@ -186,7 +197,7 @@ bi_copymodules(vm_offset_t addr) /* start with the first module on the list, should be the kernel */ for (mp = mod_findmodule(NULL, NULL); mp != NULL; mp = mp->m_next) { - MOD_NAME(addr, mp->m_name); + MOD_NAME(addr, mp->m_name); /* this field must come first */ MOD_TYPE(addr, mp->m_type); MOD_ADDR(addr, mp->m_addr); MOD_SIZE(addr, mp->m_size); @@ -194,5 +205,6 @@ bi_copymodules(vm_offset_t addr) if (!(md->md_type & MODINFOMD_NOCOPY)) MOD_METADATA(addr, md); } + MOD_END(addr); return(addr); } diff --git a/sys/boot/i386/libi386/bootinfo32.c b/sys/boot/i386/libi386/bootinfo32.c index 041ccb8..02d217b 100644 --- a/sys/boot/i386/libi386/bootinfo32.c +++ b/sys/boot/i386/libi386/bootinfo32.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bootinfo.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ + * $Id: bootinfo.c,v 1.2 1998/09/03 02:10:09 msmith Exp $ */ #include <sys/reboot.h> @@ -57,6 +57,7 @@ bi_getboothowto(char *kargs) int active; int i; + /* Parse kargs */ howto = 0; if (kargs != NULL) { cp = kargs; @@ -94,9 +95,11 @@ bi_getboothowto(char *kargs) active = 0; break; } + active = 0; + cp++; } - cp++; } + /* get equivalents from the environment */ for (i = 0; howto_names[i].ev != NULL; i++) if (getenv(howto_names[i].ev) != NULL) howto |= howto_names[i].mask; @@ -137,7 +140,7 @@ bi_copyenv(vm_offset_t addr) * used as a directory for loaded modules. * * Module data is presented in a self-describing format. Each datum - * is preceeded by a 16-bit identifier and a 16-bit size field. + * is preceeded by a 32-bit identifier and a 32-bit size field. * * Currently, the following data are saved: * @@ -177,6 +180,14 @@ bi_copyenv(vm_offset_t addr) a += mm->md_size; \ } +#define MOD_END(a) { \ + u_int32_t ident = 0; \ + vpbcopy(&ident, a, sizeof(ident)); \ + a += sizeof(ident); \ + vpbcopy(&ident, a, sizeof(ident)); \ + a += sizeof(ident); \ +} + vm_offset_t bi_copymodules(vm_offset_t addr) { @@ -186,7 +197,7 @@ bi_copymodules(vm_offset_t addr) /* start with the first module on the list, should be the kernel */ for (mp = mod_findmodule(NULL, NULL); mp != NULL; mp = mp->m_next) { - MOD_NAME(addr, mp->m_name); + MOD_NAME(addr, mp->m_name); /* this field must come first */ MOD_TYPE(addr, mp->m_type); MOD_ADDR(addr, mp->m_addr); MOD_SIZE(addr, mp->m_size); @@ -194,5 +205,6 @@ bi_copymodules(vm_offset_t addr) if (!(md->md_type & MODINFOMD_NOCOPY)) MOD_METADATA(addr, md); } + MOD_END(addr); return(addr); } diff --git a/sys/boot/i386/libi386/bootinfo64.c b/sys/boot/i386/libi386/bootinfo64.c index 041ccb8..02d217b 100644 --- a/sys/boot/i386/libi386/bootinfo64.c +++ b/sys/boot/i386/libi386/bootinfo64.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bootinfo.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ + * $Id: bootinfo.c,v 1.2 1998/09/03 02:10:09 msmith Exp $ */ #include <sys/reboot.h> @@ -57,6 +57,7 @@ bi_getboothowto(char *kargs) int active; int i; + /* Parse kargs */ howto = 0; if (kargs != NULL) { cp = kargs; @@ -94,9 +95,11 @@ bi_getboothowto(char *kargs) active = 0; break; } + active = 0; + cp++; } - cp++; } + /* get equivalents from the environment */ for (i = 0; howto_names[i].ev != NULL; i++) if (getenv(howto_names[i].ev) != NULL) howto |= howto_names[i].mask; @@ -137,7 +140,7 @@ bi_copyenv(vm_offset_t addr) * used as a directory for loaded modules. * * Module data is presented in a self-describing format. Each datum - * is preceeded by a 16-bit identifier and a 16-bit size field. + * is preceeded by a 32-bit identifier and a 32-bit size field. * * Currently, the following data are saved: * @@ -177,6 +180,14 @@ bi_copyenv(vm_offset_t addr) a += mm->md_size; \ } +#define MOD_END(a) { \ + u_int32_t ident = 0; \ + vpbcopy(&ident, a, sizeof(ident)); \ + a += sizeof(ident); \ + vpbcopy(&ident, a, sizeof(ident)); \ + a += sizeof(ident); \ +} + vm_offset_t bi_copymodules(vm_offset_t addr) { @@ -186,7 +197,7 @@ bi_copymodules(vm_offset_t addr) /* start with the first module on the list, should be the kernel */ for (mp = mod_findmodule(NULL, NULL); mp != NULL; mp = mp->m_next) { - MOD_NAME(addr, mp->m_name); + MOD_NAME(addr, mp->m_name); /* this field must come first */ MOD_TYPE(addr, mp->m_type); MOD_ADDR(addr, mp->m_addr); MOD_SIZE(addr, mp->m_size); @@ -194,5 +205,6 @@ bi_copymodules(vm_offset_t addr) if (!(md->md_type & MODINFOMD_NOCOPY)) MOD_METADATA(addr, md); } + MOD_END(addr); return(addr); } diff --git a/sys/boot/i386/libi386/crt/bootsect/bbinfo.h b/sys/boot/i386/libi386/crt/bootsect/bbinfo.h index f777acf..eb313ae 100644 --- a/sys/boot/i386/libi386/crt/bootsect/bbinfo.h +++ b/sys/boot/i386/libi386/crt/bootsect/bbinfo.h @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: bbinfo.h,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ * From: $NetBSD: bbinfo.h,v 1.3 1997/11/07 16:59:41 drochner Exp $ */ @@ -57,7 +57,7 @@ struct fraglist { /* only used by bootsect code (not by installboot) */ #ifndef MAXFLENTRIES -#define MAXFLENTRIES 10 +#define MAXFLENTRIES 20 #endif #ifndef PRIM_LOADSZ #define PRIM_LOADSZ 15 diff --git a/sys/boot/i386/libi386/i386_copy.c b/sys/boot/i386/libi386/i386_copy.c index 8f614204..53e1c79 100644 --- a/sys/boot/i386/libi386/i386_copy.c +++ b/sys/boot/i386/libi386/i386_copy.c @@ -46,8 +46,6 @@ i386_readin(int fd, vm_offset_t dest, size_t len) vpbcopy(buf, dest, chunk); } free(buf); - if (resid != 0) - printf("i386_readin: %d bytes short\n", resid); return(len - resid); } diff --git a/sys/boot/i386/libi386/libi386.h b/sys/boot/i386/libi386/libi386.h index abecb34..02168fc 100644 --- a/sys/boot/i386/libi386/libi386.h +++ b/sys/boot/i386/libi386/libi386.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: libi386.h,v 1.2 1998/08/31 21:10:43 msmith Exp $ + * $Id: libi386.h,v 1.3 1998/09/03 02:10:09 msmith Exp $ */ @@ -75,7 +75,6 @@ extern int i386_readin(int fd, vm_offset_t dest, size_t len); extern void startprog(vm_offset_t entry, int argc, u_int32_t *argv, vm_offset_t stack); -extern void delay(int delay); extern int getbasemem(void); extern int getextmem(void); diff --git a/sys/boot/i386/loader/Makefile b/sys/boot/i386/loader/Makefile index 614656e..56c9f53 100644 --- a/sys/boot/i386/loader/Makefile +++ b/sys/boot/i386/loader/Makefile @@ -1,4 +1,4 @@ -# $Id$ +# $Id: Makefile,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ # from $NetBSD: Makefile,v 1.12 1998/02/19 14:18:36 drochner Exp $ BASE= loader @@ -6,6 +6,10 @@ PROG= ${BASE}.sym NOMAN= NEWVERSWHAT= "bootstrap loader" +# Enable PnP and ISA-PnP code. +#HAVE_PNP= yes +#HAVE_ISABUS= yes + # architecture-specific loader code SRCS+= main.c conf.c diff --git a/sys/boot/i386/loader/conf.c b/sys/boot/i386/loader/conf.c index e172c7f..9fc219f 100644 --- a/sys/boot/i386/loader/conf.c +++ b/sys/boot/i386/loader/conf.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: conf.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ */ #include <stand.h> @@ -83,3 +83,12 @@ struct console *consoles[] = { &comconsole, NULL }; + +extern struct pnphandler isapnphandler; +/* extern struct pnphandler pcipnphandler;*/ + +struct pnphandler *pnphandlers[] = { +/* &isapnphandler, */ +/* &pcipnphandler, */ + NULL +}; diff --git a/sys/boot/i386/loader/main.c b/sys/boot/i386/loader/main.c index ee7d575..53f4efe 100644 --- a/sys/boot/i386/loader/main.c +++ b/sys/boot/i386/loader/main.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: main.c,v 1.2 1998/08/31 21:10:43 msmith Exp $ + * $Id: main.c,v 1.3 1998/09/03 02:10:09 msmith Exp $ */ /* @@ -54,7 +54,7 @@ main(void) { struct i386_devdesc currdev; int i; - + /* * Initialise the heap as early as possible. Once this is done, alloc() is usable. * The stack is buried inside us, so this is safe |