summaryrefslogtreecommitdiff
path: root/sys/boot/common
diff options
context:
space:
mode:
authorcvs2svn <cvs2svn@FreeBSD.org>1999-01-21 00:55:32 +0000
committercvs2svn <cvs2svn@FreeBSD.org>1999-01-21 00:55:32 +0000
commit76b5366091f76c9bc73570149ef5055648fc2c39 (patch)
tree590d020e0f2a5bea6e09d66d951a674443b21d67 /sys/boot/common
parent4b4d01da6f07f7754ff6a6e4f5223e9f0984d1a6 (diff)
Diffstat (limited to 'sys/boot/common')
-rw-r--r--sys/boot/common/Makefile.inc12
-rw-r--r--sys/boot/common/bcache.c262
-rw-r--r--sys/boot/common/boot.c12
-rw-r--r--sys/boot/common/bootstrap.h134
-rw-r--r--sys/boot/common/commands.c216
-rw-r--r--sys/boot/common/console.c10
-rw-r--r--sys/boot/common/help.common262
-rw-r--r--sys/boot/common/interp.c61
-rw-r--r--sys/boot/common/interp_backslash.c5
-rw-r--r--sys/boot/common/interp_forth.c142
-rw-r--r--sys/boot/common/interp_parse.c8
-rw-r--r--sys/boot/common/isapnp.c236
-rw-r--r--sys/boot/common/isapnp.h8
-rw-r--r--sys/boot/common/load_aout.c48
-rw-r--r--sys/boot/common/load_elf.c113
-rw-r--r--sys/boot/common/ls.c3
-rw-r--r--sys/boot/common/merge_help.awk101
-rw-r--r--sys/boot/common/module.c4
-rw-r--r--sys/boot/common/pnp.c173
-rw-r--r--sys/boot/common/pnpdata183
20 files changed, 318 insertions, 1675 deletions
diff --git a/sys/boot/common/Makefile.inc b/sys/boot/common/Makefile.inc
index c29494ba6aef9..805b0094eaa2e 100644
--- a/sys/boot/common/Makefile.inc
+++ b/sys/boot/common/Makefile.inc
@@ -1,8 +1,7 @@
-# $Id: Makefile.inc,v 1.7 1998/11/02 23:28:10 msmith Exp $
+# $Id: Makefile.inc,v 1.5 1998/09/14 18:27:04 msmith Exp $
-SRCS+= bcache.c boot.c commands.c console.c devopen.c interp.c
-SRCS+= interp_backslash.c interp_parse.c load_aout.c load_elf.c ls.c misc.c
-SRCS+= module.c panic.c
+SRCS+= boot.c commands.c console.c devopen.c interp.c interp_backslash.c
+SRCS+= interp_parse.c load_aout.c load_elf.c ls.c misc.c module.c panic.c
# Machine-independant ISA PnP
.if HAVE_ISABUS
@@ -11,8 +10,3 @@ SRCS+= isapnp.c
.if HAVE_PNP
SRCS+= pnp.c
.endif
-
-# Forth interpreter
-.if BOOT_FORTH
-SRCS+= interp_forth.c
-.endif
diff --git a/sys/boot/common/bcache.c b/sys/boot/common/bcache.c
deleted file mode 100644
index fc12f578f9fa6..0000000000000
--- a/sys/boot/common/bcache.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/*-
- * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Id: bcache.c,v 1.3 1998/11/04 00:29:01 msmith Exp $
- */
-
-/*
- * Simple LRU block cache
- */
-
-#include <stand.h>
-#include <string.h>
-#include <bitstring.h>
-
-#include "bootstrap.h"
-
-/* #define BCACHE_DEBUG */
-
-#ifdef BCACHE_DEBUG
-#define BCACHE_TIMEOUT 10
-# define DEBUG(fmt, args...) printf("%s: " fmt "\n" , __FUNCTION__ , ## args)
-#else
-#define BCACHE_TIMEOUT 2
-# define DEBUG(fmt, args...)
-#endif
-
-
-struct bcachectl
-{
- daddr_t bc_blkno;
- time_t bc_stamp;
- int bc_count;
-};
-
-static struct bcachectl *bcache_ctl;
-static caddr_t bcache_data;
-static bitstr_t *bcache_miss;
-static int bcache_nblks;
-static int bcache_blksize;
-static int bcache_hits, bcache_misses, bcache_ops, bcache_bypasses;
-static int bcache_bcount;
-
-static void bcache_insert(caddr_t buf, daddr_t blkno);
-static int bcache_lookup(caddr_t buf, daddr_t blkno);
-
-/*
- * Initialise the cache for (nblks) of (bsize).
- */
-int
-bcache_init(int nblks, size_t bsize)
-{
- int i;
-
- /* discard any old contents */
- if (bcache_data != NULL) {
- free(bcache_data);
- bcache_data = NULL;
- free(bcache_ctl);
- }
-
- /* Allocate control structures */
- bcache_nblks = nblks;
- bcache_blksize = bsize;
- bcache_data = malloc(bcache_nblks * bcache_blksize);
- bcache_ctl = (struct bcachectl *)malloc(bcache_nblks * sizeof(struct bcachectl));
- bcache_miss = bit_alloc((bcache_nblks + 1) / 2);
- if ((bcache_data == NULL) || (bcache_ctl == NULL) || (bcache_miss == NULL)) {
- if (bcache_miss)
- free(bcache_miss);
- if (bcache_ctl)
- free(bcache_ctl);
- if (bcache_data)
- free(bcache_data);
- bcache_data = NULL;
- return(ENOMEM);
- }
-
- /* Invalidate the cache */
- for (i = 0; i < bcache_nblks; i++) {
- bcache_ctl[i].bc_count = -1;
- bcache_ctl[i].bc_blkno = -1;
- }
-
- return(0);
-}
-
-/*
- * Handle a transfer request; fill in parts of the request that can
- * be satisfied by the cache, use the supplied strategy routine to do
- * device I/O and then use the I/O results to populate the cache.
- *
- * Requests larger than 1/2 the cache size will be bypassed and go
- * directly to the disk. XXX tune this.
- */
-int
-bcache_strategy(void *devdata, int rw, daddr_t blk, size_t size, void *buf, size_t *rsize)
-{
- struct bcache_devdata *dd = (struct bcache_devdata *)devdata;
- int nblk, p_size;
- daddr_t p_blk;
- caddr_t p_buf;
- int i, j, result;
-
- bcache_ops++;
-
- /* bypass large requests, or when the cache is inactive */
- if ((bcache_data == NULL) || ((size * 2 / bcache_blksize) > bcache_nblks)) {
- DEBUG("bypass %d from %d", size / bcache_blksize, blk);
- bcache_bypasses++;
- return(dd->dv_strategy(dd->dv_devdata, rw, blk, size, buf, rsize));
- }
-
- nblk = size / bcache_blksize;
- result = 0;
-
- /* Satisfy any cache hits up front */
- for (i = 0; i < nblk; i++) {
- if (bcache_lookup(buf + (bcache_blksize * i), blk + i)) {
- bit_set(bcache_miss, i); /* cache miss */
- bcache_misses++;
- } else {
- bit_clear(bcache_miss, i); /* cache hit */
- bcache_hits++;
- }
- }
-
- /* Go back and fill in any misses XXX optimise */
- p_blk = -1;
- p_buf = NULL;
- p_size = 0;
- for (i = 0; i < nblk; i++) {
- if (bit_test(bcache_miss, i)) {
- /* miss, add to pending transfer */
- if (p_blk == -1) {
- p_blk = blk + i;
- p_buf = buf + (bcache_blksize * i);
- p_size = 1;
- } else {
- p_size++;
- }
- } else if (p_blk != -1) {
- /* hit, complete pending transfer */
- result = dd->dv_strategy(dd->dv_devdata, rw, p_blk, p_size * bcache_blksize, p_buf, NULL);
- if (result != 0)
- goto done;
- for (j = 0; j < p_size; j++)
- bcache_insert(p_buf + (j * bcache_blksize), p_blk + j);
- p_blk = -1;
- }
- }
- if (p_blk != -1) {
- /* pending transfer left */
- result = dd->dv_strategy(dd->dv_devdata, rw, p_blk, p_size * bcache_blksize, p_buf, NULL);
- if (result != 0)
- goto done;
- for (j = 0; j < p_size; j++)
- bcache_insert(p_buf + (j * bcache_blksize), p_blk + j);
- }
-
- done:
- if ((result == 0) && (rsize != NULL))
- *rsize = size;
- return(result);
-}
-
-
-/*
- * Insert a block into the cache. Retire the oldest block to do so, if required.
- *
- * XXX the LRU algorithm will fail after 2^31 blocks have been transferred.
- */
-static void
-bcache_insert(caddr_t buf, daddr_t blkno)
-{
- time_t now;
- int i, cand, ocount;
-
- time(&now);
- cand = 0; /* assume the first block */
- ocount = bcache_ctl[0].bc_count;
-
- /* find the oldest block */
- for (i = 1; i < bcache_nblks; i++) {
- if (bcache_ctl[i].bc_blkno == blkno) {
- /* reuse old entry */
- cand = i;
- break;
- }
- if (bcache_ctl[i].bc_count < ocount) {
- ocount = bcache_ctl[i].bc_count;
- cand = i;
- }
- }
-
- DEBUG("insert blk %d -> %d @ %d # %d", blkno, cand, now, bcache_bcount);
- bcopy(buf, bcache_data + (bcache_blksize * cand), bcache_blksize);
- bcache_ctl[cand].bc_blkno = blkno;
- bcache_ctl[cand].bc_stamp = now;
- bcache_ctl[cand].bc_count = bcache_bcount++;
-}
-
-/*
- * Look for a block in the cache. Blocks more than BCACHE_TIMEOUT seconds old
- * may be stale (removable media) and thus are discarded. Copy the block out
- * if successful and return zero, or return nonzero on failure.
- */
-static int
-bcache_lookup(caddr_t buf, daddr_t blkno)
-{
- time_t now;
- int i;
-
- time(&now);
-
- for (i = 0; i < bcache_nblks; i++)
- /* cache hit? */
- if ((bcache_ctl[i].bc_blkno == blkno) && ((bcache_ctl[i].bc_stamp + BCACHE_TIMEOUT) >= now)) {
- bcopy(bcache_data + (bcache_blksize * i), buf, bcache_blksize);
- DEBUG("hit blk %d <- %d (now %d then %d)", blkno, i, now, bcache_ctl[i].bc_stamp);
- return(0);
- }
- return(ENOENT);
-}
-
-COMMAND_SET(bcachestat, "bcachestat", "get disk block cache stats", command_bcache);
-
-static int
-command_bcache(int argc, char *argv[])
-{
- int i;
-
- for (i = 0; i < bcache_nblks; i++) {
- printf("%08x %04x %04x|", bcache_ctl[i].bc_blkno, bcache_ctl[i].bc_stamp & 0xffff, bcache_ctl[i].bc_count & 0xffff);
- if (((i + 1) % 4) == 0)
- printf("\n");
- }
- printf("\n%d ops %d bypasses %d hits %d misses\n", bcache_ops, bcache_bypasses, bcache_hits, bcache_misses);
- return(CMD_OK);
-}
-
diff --git a/sys/boot/common/boot.c b/sys/boot/common/boot.c
index 2de8603e881ee..608c9d02a9213 100644
--- a/sys/boot/common/boot.c
+++ b/sys/boot/common/boot.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: boot.c,v 1.9 1998/10/31 17:12:32 dfr Exp $
+ * $Id: boot.c,v 1.6 1998/10/11 10:10:41 peter Exp $
*/
/*
@@ -38,7 +38,7 @@
static char *getbootfile(int try);
/* List of kernel names to try (may be overwritten by boot.config) XXX should move from here? */
-static char *default_bootfiles = "kernel;kernel.old";
+static char *default_bootfiles = "kernel,kernel.old";
static int autoboot_tried;
@@ -203,13 +203,11 @@ autoboot(int delay, char *prompt)
break;
}
if (ntime != otime) {
- printf("\rBooting [%s] in %d seconds... ", getbootfile(0), (int)(when - ntime));
+ printf("\rBooting [%s] in %d seconds...", getbootfile(0), (int)(when - ntime));
otime = ntime;
cr = 1;
}
}
- if (yes)
- printf("\rBooting [%s]... ", getbootfile(0));
if (cr)
putchar('\n');
if (yes) {
@@ -243,11 +241,11 @@ getbootfile(int try)
spec = default_bootfiles;
while ((try > 0) && (spec != NULL)) {
- spec = strchr(spec, ';');
+ spec = strchr(spec, ',');
try--;
}
if (spec != NULL) {
- if ((ep = strchr(spec, ';')) != NULL) {
+ if ((ep = strchr(spec, ',')) != NULL) {
len = ep - spec;
} else {
len = strlen(spec);
diff --git a/sys/boot/common/bootstrap.h b/sys/boot/common/bootstrap.h
index ed450d91602e4..84f6d48097642 100644
--- a/sys/boot/common/bootstrap.h
+++ b/sys/boot/common/bootstrap.h
@@ -23,11 +23,10 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: bootstrap.h,v 1.17 1999/01/15 00:31:45 abial Exp $
+ * $Id: bootstrap.h,v 1.12 1998/10/09 07:09:22 msmith Exp $
*/
#include <sys/types.h>
-#include <sys/queue.h>
/* XXX debugging */
extern struct console vidconsole;
@@ -56,7 +55,7 @@ extern char command_errbuf[]; /* XXX blah, length */
/* interp.c */
extern void interact(void);
-extern int source(char *filename);
+extern void source(char *filename);
/* interp_parse.c */
extern int parse(int *argc, char ***argv, char *str);
@@ -72,15 +71,6 @@ extern size_t strlenout(vm_offset_t str);
extern char *strdupout(vm_offset_t str);
/*
- * Disk block cache
- */
-struct bcache_devdata
-{
- int (*dv_strategy)(void *devdata, int rw, daddr_t blk, size_t size, void *buf, size_t *rsize);
- void *dv_devdata;
-};
-
-/*
* Modular console support.
*/
struct console
@@ -104,44 +94,33 @@ extern void cons_probe(void);
/*
* Plug-and-play enumerator/configurator interface.
*/
-struct pnphandler
+struct pnpident
{
- char *pp_name; /* handler/bus name */
- void (* pp_enumerate)(void); /* enumerate PnP devices, add to chain */
+ char *id_ident; /* ASCII identifier, actual format varies with bus/handler */
+ struct pnpident *id_next; /* the next identifier */
};
-struct pnpident
+struct pnphandler;
+struct pnpinfo
{
- char *id_ident; /* ASCII identifier, actual format varies with bus/handler */
- STAILQ_ENTRY(pnpident) id_link;
+ 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;
+ struct pnphandler *pi_handler; /* handler which detected this device */
+ struct pnpinfo *pi_next;
};
-struct pnpinfo
+struct pnphandler
{
- char *pi_desc; /* ASCII description, optional */
- 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;
- struct pnphandler *pi_handler; /* handler which detected this device */
- STAILQ_HEAD(,pnpident) pi_ident; /* list of identifiers */
- STAILQ_ENTRY(pnpinfo) pi_link;
+ 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 void pnp_addident(struct pnpinfo *pi, char *ident);
-extern struct pnpinfo *pnp_allocinfo(void);
-extern void pnp_freeinfo(struct pnpinfo *pi);
-extern void pnp_addinfo(struct pnpinfo *pi);
-extern char *pnp_eisaformat(u_int8_t *data);
-
-/*
- * < 0 - No ISA in system
- * == 0 - Maybe ISA, search for read data port
- * > 0 - ISA in system, value is read data port address
- */
-extern int isapnp_readport;
/*
* Module metadata header.
@@ -201,53 +180,58 @@ 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);
-#ifndef NEW_LINKER_SET
-#include <sys/linker_set.h>
-
-/* XXX just for conversion's sake, until we move to the new linker set code */
-
-#define SET_FOREACH(pvar, set) \
- for (pvar = set.ls_items; \
- pvar < set.ls_items + set.ls_length; \
- pvar++)
-
-#else /* NEW_LINKER_SET */
+#if defined(__ELF__)
/*
- * Private macros, not to be used outside this header file.
+ * Alpha GAS needs an align before the section change. It seems to assume
+ * that after the .previous, it is aligned, so the following .align 3 is
+ * ignored. Since the previous instructions often contain strings, this is
+ * a problem.
*/
-#define __MAKE_SET(set, sym) \
- static void *__CONCAT(__setentry,__LINE__) \
- __attribute__((__section__("set_" #set),__unused__)) = &sym
-#define __SET_BEGIN(set) \
- ({ extern void *__CONCAT(__start_set_,set); \
- &__CONCAT(__start_set_,set); })
-#define __SET_END(set) \
- ({ extern void *__CONCAT(__stop_set_,set); \
- &__CONCAT(__stop_set_,set); })
-/*
- * Public macros.
- */
+#ifdef __alpha__
+#define MAKE_SET(set, sym) \
+ static void const * const __set_##set##_sym_##sym = &sym; \
+ __asm(".align 3"); \
+ __asm(".section .set." #set ",\"aw\""); \
+ __asm(".quad " #sym); \
+ __asm(".previous")
+#else
+#define MAKE_SET(set, sym) \
+ static void const * const __set_##set##_sym_##sym = &sym; \
+ __asm(".section .set." #set ",\"aw\""); \
+ __asm(".long " #sym); \
+ __asm(".previous")
+#endif
+#define TEXT_SET(set, sym) MAKE_SET(set, sym)
+#define DATA_SET(set, sym) MAKE_SET(set, sym)
+#define BSS_SET(set, sym) MAKE_SET(set, sym)
+#define ABS_SET(set, sym) MAKE_SET(set, sym)
-/* Add an entry to a set. */
-#define TEXT_SET(set, sym) __MAKE_SET(set, sym)
-#define DATA_SET(set, sym) __MAKE_SET(set, sym)
-#define BSS_SET(set, sym) __MAKE_SET(set, sym)
-#define ABS_SET(set, sym) __MAKE_SET(set, sym)
+#else
/*
- * Iterate over all the elements of a set.
- *
- * Sets always contain addresses of things, and "pvar" points to words
- * containing those addresses. Thus is must be declared as "type **pvar",
- * and the address of each set item is obtained inside the loop by "*pvar".
+ * Linker set support, directly from <sys/kernel.h>
+ *
+ * NB: the constants defined below must match those defined in
+ * ld/ld.h. Since their calculation requires arithmetic, we
+ * can't name them symbolically (e.g., 23 is N_SETT | N_EXT).
*/
-#define SET_FOREACH(pvar, set) \
- for (pvar = (__typeof__(pvar))__SET_BEGIN(set); \
- pvar < (__typeof__(pvar))__SET_END(set); pvar++)
+#define MAKE_SET(set, sym, type) \
+ static void const * const __set_##set##_sym_##sym = &sym; \
+ __asm(".stabs \"_" #set "\", " #type ", 0, 0, _" #sym)
+#define TEXT_SET(set, sym) MAKE_SET(set, sym, 23)
+#define DATA_SET(set, sym) MAKE_SET(set, sym, 25)
+#define BSS_SET(set, sym) MAKE_SET(set, sym, 27)
+#define ABS_SET(set, sym) MAKE_SET(set, sym, 21)
+
#endif
+struct linker_set {
+ int ls_length;
+ const void *ls_items[1]; /* really ls_length of them, trailing NULL */
+};
+
/*
* Support for commands
*/
diff --git a/sys/boot/common/commands.c b/sys/boot/common/commands.c
index fe0eb54d77077..77cc43ca0e716 100644
--- a/sys/boot/common/commands.c
+++ b/sys/boot/common/commands.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: commands.c,v 1.8 1999/01/09 02:34:48 msmith Exp $
+ * $Id: commands.c,v 1.4 1998/10/07 02:38:26 msmith Exp $
*/
#include <stand.h>
@@ -34,181 +34,35 @@
char *command_errmsg;
char command_errbuf[256]; /* XXX should have procedural interface for setting, size limit? */
-
-
-/*
- * Help is read from a formatted text file.
- *
- * Entries in the file are formatted as
-
-# Ttopic [Ssubtopic] Ddescription
-help
-text
-here
-#
-
- *
- * Note that for code simplicity's sake, the above format must be followed
- * exactly.
- *
- * Subtopic entries must immediately follow the topic (this is used to
- * produce the listing of subtopics).
- *
- * If no argument(s) are supplied by the user, the help for 'help' is displayed.
- */
-COMMAND_SET(help, "help", "detailed help", command_help);
-
-static int
-help_getnext(int fd, char **topic, char **subtopic, char **desc)
-{
- char line[81], *cp, *ep;
-
- for (;;) {
- if (fgetstr(line, 80, fd) < 0)
- return(0);
-
- if ((strlen(line) < 3) || (line[0] != '#') || (line[1] != ' '))
- continue;
-
- *topic = *subtopic = *desc = NULL;
- cp = line + 2;
- while((cp != NULL) && (*cp != 0)) {
- ep = strchr(cp, ' ');
- if ((*cp == 'T') && (*topic == NULL)) {
- if (ep != NULL)
- *ep++ = 0;
- *topic = strdup(cp + 1);
- } else if ((*cp == 'S') && (*subtopic == NULL)) {
- if (ep != NULL)
- *ep++ = 0;
- *subtopic = strdup(cp + 1);
- } else if (*cp == 'D') {
- *desc = strdup(cp + 1);
- ep = NULL;
- }
- cp = ep;
- }
- if (*topic == NULL) {
- if (*subtopic != NULL)
- free(*subtopic);
- if (*desc != NULL)
- free(*desc);
- continue;
- }
- return(1);
- }
-}
-
-static void
-help_emitsummary(char *topic, char *subtopic, char *desc)
-{
- int i;
- pager_output(" ");
- pager_output(topic);
- i = strlen(topic);
- if (subtopic != NULL) {
- pager_output(" ");
- pager_output(subtopic);
- i += strlen(subtopic) + 1;
- }
- if (desc != NULL) {
- do {
- pager_output(" ");
- } while (i++ < 30);
- pager_output(desc);
- }
- pager_output("\n");
-}
+COMMAND_SET(help, "help", "detailed help", command_help);
-
static int
-command_help(int argc, char *argv[])
+command_help(int argc, char *argv[])
{
- char buf[81]; /* XXX buffer size? */
- int hfd, matched, doindex;
- char *topic, *subtopic, *t, *s, *d;
+ char helppath[80]; /* XXX buffer size? */
/* page the help text from our load path */
- sprintf(buf, "%s/boot/loader.help", getenv("loaddev"));
- if ((hfd = open(buf, O_RDONLY)) < 0) {
+ sprintf(helppath, "%s/boot/boot.help", getenv("loaddev"));
+ printf("%s\n", helppath);
+ if (pager_file(helppath) == -1)
printf("Verbose help not available, use '?' to list commands\n");
- return(CMD_OK);
- }
-
- /* pick up request from arguments */
- topic = subtopic = NULL;
- switch(argc) {
- case 3:
- subtopic = strdup(argv[2]);
- case 2:
- topic = strdup(argv[1]);
- break;
- case 1:
- topic = strdup("help");
- break;
- default:
- command_errmsg = "usage is 'help <topic> [<subtopic>]";
- return(CMD_ERROR);
- }
-
- /* magic "index" keyword */
- doindex = !strcmp(topic, "index");
- matched = doindex;
-
- /* Scan the helpfile looking for help matching the request */
- pager_open();
- while(help_getnext(hfd, &t, &s, &d)) {
-
- if (doindex) { /* dink around formatting */
- help_emitsummary(t, s, d);
-
- } else if (strcmp(topic, t)) {
- /* topic mismatch */
- if(matched) /* nothing more on this topic, stop scanning */
- break;
-
- } else {
- /* topic matched */
- matched = 1;
- if (((subtopic == NULL) && (s == NULL)) ||
- ((subtopic != NULL) && (s != NULL) && !strcmp(subtopic, s))) {
- /* exact match, print text */
- while((fgetstr(buf, 80, hfd) >= 0) && (buf[0] != '#')) {
- pager_output(buf);
- pager_output("\n");
- }
- } else if ((subtopic == NULL) && (s != NULL)) {
- /* topic match, list subtopics */
- help_emitsummary(t, s, d);
- }
- }
- free(t);
- free(s);
- free(d);
- }
- pager_close();
- close(hfd);
- if (!matched) {
- sprintf(command_errbuf, "no help available for '%s'", topic);
- return(CMD_ERROR);
- }
return(CMD_OK);
}
-
COMMAND_SET(commandlist, "?", "list commands", command_commandlist);
static int
command_commandlist(int argc, char *argv[])
{
struct bootblk_command **cmdp;
+ int i;
printf("Available commands:\n");
- SET_FOREACH(cmdp, Xcommand_set) {
- if (((*cmdp)->c_name != NULL) && ((*cmdp)->c_desc != NULL))
- printf(" %-15s %s\n", (*cmdp)->c_name, (*cmdp)->c_desc);
- }
+ cmdp = (struct bootblk_command **)Xcommand_set.ls_items;
+ for (i = 0; i < Xcommand_set.ls_length; i++)
+ if ((cmdp[i]->c_name != NULL) && (cmdp[i]->c_desc != NULL))
+ printf(" %-15s %s\n", cmdp[i]->c_name, cmdp[i]->c_desc);
return(CMD_OK);
}
@@ -299,7 +153,6 @@ command_echo(int argc, char *argv[])
nl = 0;
optind = 1;
- optreset = 1;
while ((ch = getopt(argc, argv, "n")) != -1) {
switch(ch) {
case 'n':
@@ -344,7 +197,6 @@ command_read(int argc, char *argv[])
timeout = -1;
prompt = NULL;
optind = 1;
- optreset = 1;
while ((c = getopt(argc, argv, "p:t:")) != -1) {
switch(c) {
@@ -382,47 +234,3 @@ command_read(int argc, char *argv[])
setenv(name, buf, 1);
return(CMD_OK);
}
-
-/*
- * List all disk-like devices
- */
-COMMAND_SET(lsdev, "lsdev", "list all devices", command_lsdev);
-
-static int
-command_lsdev(int argc, char *argv[])
-{
- int verbose, ch, i;
- char line[80];
-
- verbose = 0;
- optind = 1;
- optreset = 1;
- while ((ch = getopt(argc, argv, "v")) != -1) {
- switch(ch) {
- case 'v':
- verbose = 1;
- break;
- case '?':
- default:
- /* getopt has already reported an error */
- return(CMD_OK);
- }
- }
- argv += (optind);
- argc -= (optind);
-
- pager_open();
- for (i = 0; devsw[i] != NULL; i++) {
- if (devsw[i]->dv_print != NULL){
- sprintf(line, "%s @ %p\n", devsw[i]->dv_name, devsw[i]->dv_print);
- pager_output(line);
- devsw[i]->dv_print(verbose);
- } else {
- sprintf(line, "%s: (unknown)\n", devsw[i]->dv_name);
- pager_output(line);
- }
- }
- pager_close();
- return(CMD_OK);
-}
-
diff --git a/sys/boot/common/console.c b/sys/boot/common/console.c
index 8c4377f2bcd4f..b9534d304030b 100644
--- a/sys/boot/common/console.c
+++ b/sys/boot/common/console.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: console.c,v 1.3 1998/10/11 10:19:11 peter Exp $
+ * $Id: console.c,v 1.2 1998/09/26 01:29:13 msmith Exp $
*/
#include <stand.h>
@@ -150,12 +150,8 @@ cons_set(struct env_var *ev, int flags, void *value)
{
int cons, active;
- if ((value == NULL) || ((active = cons_find(value)) == -1)) {
- if (value != NULL)
- printf("no such console '%s'\n", (char *)value);
- printf("Available consoles:\n");
- for (cons = 0; consoles[cons] != NULL; cons++)
- printf(" %s\n", consoles[cons]->c_name);
+ if ((active = cons_find(value)) == -1) {
+ printf("no such console '%s'\n", (char *)value);
return(CMD_ERROR);
}
diff --git a/sys/boot/common/help.common b/sys/boot/common/help.common
deleted file mode 100644
index e467b1ca70925..0000000000000
--- a/sys/boot/common/help.common
+++ /dev/null
@@ -1,262 +0,0 @@
-################################################################################
-# Thelp DDisplay command help
-
- help [topic [subtopic]]
- ?
-
- The help command displays help on commands and their usage.
-
- In command help, a term enclosed with <...> indicates a value as
- described by the term. A term enclosed with [...] is optional,
- and may not be required by all forms of the command.
-
- Some commands may not be availalble. Use the '?' command to list
- most available commands.
-
-################################################################################
-# Tautoboot DBoot after a delay
-
- autoboot [<delay> [<prompt>]]
-
- Displays <prompt> or a default prompt, and counts down <delay> seconds
- before attempting to boot. If <delay> is not specified, the default
- value is 10.
-
-################################################################################
-# Tboot DBoot immediately
-
- boot [-<arg> ...] [<kernelname>]
-
- Boot the system. If arguments are specified, they are added to the
- arguments for the kernel. If <kernelname> is specified, and a kernel
- has not already been loaded, it will be booted instead of the default
- kernel.
-
-################################################################################
-# Techo DEcho arguments
-
- echo [-n] [<message>]
-
- Emits <message>, with no trailing newline if -n is specified. This is
- most useful in conjunction with scripts and the '@' line prefix.
-
- Variables are substituted by prefixing them with $, eg.
-
- echo Current device is $currdev
-
- will print the current device.
-
-################################################################################
-# Tload DLoad a kernel or module
-
- load [-t <type>] <filename>
-
- Loads the module contained in <filename> into memory. If no other
- modules are loaded, <filename> must be a kernel or the command will
- fail.
-
- If -t is specified, the module is loaded as raw data of <type>, for
- later use by the kernel or other modules. <type> may be any string.
-
-################################################################################
-# Tls DList files
-
- ls [-l] [<path>]
-
- Displays a listing of files in the directory <path>, or the root
- directory of the current device if <path> is not specified.
-
- The -l argument displays file sizes as well; the process of obtaining
- file sizes on some media may be very slow.
-
-################################################################################
-# Tlsdev DList devices
-
- lsdev [-v]
-
- List all of the devices from which it may be possible to load modules.
- If -v is specified, print more details.
-
-################################################################################
-# Tlsmod DList modules
-
- lsmod [-v]
-
- List loaded modules. If [-v] is specified, print more details.
-
-################################################################################
-# Tpnpscan DScan for PnP devices
-
- pnpscan [-v]
-
- Scan for Plug-and-Play devices. This command is normally automatically
- run as part of the boot process, in order to dynamically load modules
- required for system operation.
-
- If the -v argument is specified, details on the devices found will
- be printed.
-
-################################################################################
-# Tset DSet a variable
-
- set <variable name>
- set <variable name>=<value>
-
- The set command is used to set variables.
-
-################################################################################
-# Tset Sautoboot_delay DSet the default autoboot delay
-
- set autoboot_delay=<value>
-
- Sets the default delay for the autoboot command to <value> seconds.
-
-################################################################################
-# Tset Sbootfile DSet the default boot file set
-
- set bootfile=<filename>[,<filename>...]
-
- The default search path for bootable kernels is /kernel,/kernel.old.
- It may be overridden by setting the bootfile variable to a
- semicolon-separated list of paths, which will be searched for in turn.
-
-################################################################################
-# Tset Sboot_askname DPrompt for root device
-
- set boot_askname
-
- Instructs the kernel to prompt the user for the name of the root device
- when the kernel is booted.
-
-################################################################################
-# Tset Sboot_ddb DDrop to the kernel debugger (DDB)
-
- set boot_ddb
-
- Instructs the kernel to start in the DDB debugger, rather than
- proceeding to initialise when booted.
-
-################################################################################
-# Tset Sboot_gdb DSelect gdb-remote mode
-
- set boot_gdb
-
- Selects gdb-remote mode for the kernel debugger by default.
-
-################################################################################
-# Tset Sboot_single DStart system in single-user mode
-
- set boot_single
-
- Prevents the kernel from initiating a multi-user startup, single-user
- mode will be entered when the kernel has finished device probes.
-
-################################################################################
-# Tset Sboot_verbose DVerbose boot messages
-
- set boot_verbose
-
- Setting this variable causes extra debugging information to be printed
- by the kernel during the boot phase.
-
-################################################################################
-# Tset Sconsole DSet the current console
-
- set console[=<value>]
-
- Sets the current console. If <value> is omitted, a list of valid
- consoles will be displayed.
-
-################################################################################
-# Tset Scurrdev DSet the current device
-
- set currdev=<device>
-
- Selects the default device. Syntax for devices is odd.
-
-################################################################################
-# Tset Smodule_path DSet the module search path
-
- set module_path=<path>[,<path>...]
-
- Sets the list of directories which will be searched in for modules
- named in a load command or implicitly required by a dependancy.
-
-################################################################################
-# Tset Sprompt DSet the command prompt
-
- set prompt=<value>
-
- The command prompt is displayed when the loader is waiting for input.
- Variable substitution is performed on the prompt. The default
- prompt can be set with:
-
- set prompt=\$currdev>
-
-################################################################################
-# Tset Srootdev DSet the root filesystem
-
- set rootdev=<path>
-
- By default the value of $currdev is used to set the root filesystem
- when the kernel is booted. This can be overridden by setting
- $rootdev explicitly.
-
-################################################################################
-# Tshow DShow the values of variables
-
- show [<variable>]
-
- Displays the value of <variable>, or all variables if not specified.
- Multiple paths can be separated with a semicolon.
-
- See the set command for a list of some variables.
-
-################################################################################
-# Tsource DRead commands from a script file
-
- source <filename>
-
- The entire contents of <filename> are read into memory before executing
- commands, so it is safe to source a file from removable media.
-
- A number of modifiers may be prefixed to commands within a script file
- to alter their behaviour:
-
- @ Suppresses the printing of the command when executed.
-
- - Prevents the script from terminating if the command returns
- an error.
-
-################################################################################
-# Tread DRead input from the terminal
-
- read [-t <value>] [-p <prompt>] [<variable name>]
-
- The read command reads a line of input from the terminal. If the
- -t argument is specified, it will return nothing if no input has been
- received after <value> seconds. (Any keypress will cancel the
- timeout).
-
- If -p is specified, <prompt> is printed before reading input. No
- newline is emitted after the prompt.
-
- If a variable name is supplied, the variable is set to the value read,
- less any terminating newline.
-
-################################################################################
-# Tunload DRemove all modules from memory
-
- unload
-
- This command removes any kernel and all loaded modules from memory.
-
-################################################################################
-# Tunset DUnset a variable
-
- unset <variable name>
-
- If allowed, the named variable's value is discarded and the variable
- is removed.
-
-################################################################################
diff --git a/sys/boot/common/interp.c b/sys/boot/common/interp.c
index 22d2199beebcc..d24ed6e3182a6 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.11 1999/01/13 21:59:58 abial Exp $
+ * $Id: interp.c,v 1.5 1998/10/07 02:38:26 msmith Exp $
*/
/*
* Simple commandline interpreter, toplevel and misc.
@@ -35,15 +35,6 @@
#include <string.h>
#include "bootstrap.h"
-#ifdef BOOT_FORTH
-#include "ficl.h"
-#define RETURN(x) stackPushINT32(bf_vm->pStack,!x); return(x)
-
-extern FICL_VM *bf_vm;
-#else
-#define RETURN(x) return(x)
-#endif
-
#define MAXARGS 20 /* maximum number of arguments allowed */
static void prompt(void);
@@ -51,10 +42,10 @@ static void prompt(void);
/*
* Perform the command
*/
-int
+static int
perform(int argc, char *argv[])
{
- int result;
+ int i, result;
struct bootblk_command **cmdp;
bootblk_cmd_t *cmd;
@@ -67,17 +58,17 @@ perform(int argc, char *argv[])
cmd = NULL;
result = CMD_ERROR;
- /* search the command set for the command */
- SET_FOREACH(cmdp, Xcommand_set) {
- if (((*cmdp)->c_name != NULL) && !strcmp(argv[0], (*cmdp)->c_name))
- cmd = (*cmdp)->c_fn;
+ cmdp = (struct bootblk_command **)Xcommand_set.ls_items;
+ for (i = 0; i < Xcommand_set.ls_length; i++) {
+ if ((cmdp[i]->c_name != NULL) && !strcmp(argv[0], cmdp[i]->c_name))
+ cmd = cmdp[i]->c_fn;
}
if (cmd != NULL) {
result = (cmd)(argc, argv);
} else {
command_errmsg = "unknown command";
}
- RETURN(result);
+ return(result);
}
/*
@@ -87,20 +78,13 @@ void
interact(void)
{
char input[256]; /* big enough? */
-#ifndef BOOT_FORTH
int argc;
char **argv;
-#endif
-
-#ifdef BOOT_FORTH
- bf_init();
-#endif
/*
* Read our default configuration
*/
- if(source("/boot/loader.rc")!=CMD_OK)
- source("/boot/boot.conf");
+ source("/boot/boot.conf");
printf("\n");
/*
* Before interacting, we might want to autoboot.
@@ -118,9 +102,6 @@ interact(void)
input[0] = '\0';
prompt();
ngets(input, sizeof(input));
-#ifdef BOOT_FORTH
- bf_run(input);
-#else
if (!parse(&argc, &argv, input)) {
if (perform(argc, argv))
printf("%s: %s\n", argv[0], command_errmsg);
@@ -128,7 +109,6 @@ interact(void)
} else {
printf("parse error\n");
}
-#endif
}
}
@@ -147,12 +127,10 @@ static int
command_source(int argc, char *argv[])
{
int i;
- int res;
- res=CMD_OK;
- for (i = 1; (i < argc) && (res == CMD_OK); i++)
- res=source(argv[i]);
- return(res);
+ for (i = 1; i < argc; i++)
+ source(argv[i]);
+ return(CMD_OK);
}
struct sourceline
@@ -165,18 +143,18 @@ struct sourceline
struct sourceline *next;
};
-int
+void
source(char *filename)
{
struct sourceline *script, *se, *sp;
char input[256]; /* big enough? */
- int argc,res;
+ int argc;
char **argv, *cp;
int fd, flags, line;
if (((fd = open(filename, O_RDONLY)) == -1)) {
- sprintf(command_errbuf,"can't open '%s': %s\n", filename, strerror(errno));
- return(CMD_ERROR);
+ printf("can't open '%s': %s\n", filename, strerror(errno));
+ return;
}
/*
@@ -223,7 +201,6 @@ source(char *filename)
* Execute the script
*/
argv = NULL;
- res = CMD_OK;
for (sp = script; sp != NULL; sp = sp->next) {
/* print if not being quiet */
@@ -237,16 +214,13 @@ source(char *filename)
if ((argc > 0) && (perform(argc, argv) != 0)) {
/* normal command */
printf("%s: %s\n", argv[0], command_errmsg);
- if (!(sp->flags & SL_IGNOREERR)) {
- res=CMD_ERROR;
+ if (!(sp->flags & SL_IGNOREERR))
break;
- }
}
free(argv);
argv = NULL;
} else {
printf("%s line %d: parse error\n", filename, sp->line);
- res=CMD_ERROR;
break;
}
}
@@ -257,7 +231,6 @@ source(char *filename)
script = script->next;
free(se);
}
- return(res);
}
/*
diff --git a/sys/boot/common/interp_backslash.c b/sys/boot/common/interp_backslash.c
index 6de118ec63fc6..8807fdaa9645b 100644
--- a/sys/boot/common/interp_backslash.c
+++ b/sys/boot/common/interp_backslash.c
@@ -11,7 +11,7 @@
* Jordan K. Hubbard
* 29 August 1998
*
- * $Id: interp_backslash.c,v 1.2 1998/09/03 06:14:41 jkh Exp $
+ * $Id: interp_backslash.c,v 1.1 1998/09/01 00:41:24 msmith Exp $
*
* Routine for doing backslash elimination.
*/
@@ -52,10 +52,9 @@ backslash(char *str)
str++;
break;
- /* preserve backslashed quotes, dollar signs */
+ /* preserve backslashed quotes */
case '\'':
case '"':
- case '$':
new_str[i++] = '\\';
new_str[i++] = *str++;
break;
diff --git a/sys/boot/common/interp_forth.c b/sys/boot/common/interp_forth.c
deleted file mode 100644
index 68e09340b0add..0000000000000
--- a/sys/boot/common/interp_forth.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Id: interp_forth.c,v 1.8 1998/12/22 11:41:51 abial Exp $
- */
-
-#include <string.h>
-#include <stand.h>
-#include "bootstrap.h"
-#include "ficl.h"
-
-/* #define BFORTH_DEBUG */
-
-#ifdef BFORTH_DEBUG
-# define DEBUG(fmt, args...) printf("%s: " fmt "\n" , __FUNCTION__ , ## args)
-#else
-# define DEBUG(fmt, args...)
-#endif
-
-/*
- * BootForth Interface to Ficl Forth interpreter.
- */
-
-FICL_VM *bf_vm;
-
-/*
- * Shim for taking commands from BF and passing them out to 'standard'
- * argv/argc command functions.
- */
-static void
-bf_command(FICL_VM *vm)
-{
- char *name, *line, *tail, *cp;
- int len;
- struct bootblk_command **cmdp;
- bootblk_cmd_t *cmd;
- int argc, result;
- char **argv;
-
- /* Get the name of the current word */
- name = vm->runningWord->name;
-
- /* Find our command structure */
- cmd = NULL;
- SET_FOREACH(cmdp, Xcommand_set) {
- if (((*cmdp)->c_name != NULL) && !strcmp(name, (*cmdp)->c_name))
- cmd = (*cmdp)->c_fn;
- }
- if (cmd == NULL)
- panic("callout for unknown command '%s'", name);
-
- /* Get remainder of invocation */
- tail = vmGetInBuf(vm);
- for (cp = tail, len = 0; *cp != 0 && *cp != '\n'; cp++, len++)
- ;
-
- line = malloc(strlen(name) + len + 2);
- strcpy(line, name);
- if (len > 0) {
- strcat(line, " ");
- strncat(line, tail, len);
- vmUpdateTib(vm, tail + len);
- }
- DEBUG("cmd '%s'", line);
-
- command_errmsg = command_errbuf;
- command_errbuf[0] = 0;
- if (!parse(&argc, &argv, line)) {
- result = (cmd)(argc, argv);
- free(argv);
- if(result != 0) {
- vmTextOut(vm,argv[0],0);
- vmTextOut(vm,": ",0);
- vmTextOut(vm,command_errmsg,1);
- }
- } else {
- vmTextOut(vm, "parse error\n", 1);
- result=1;
- }
- free(line);
- stackPushINT32(vm->pStack,!result);
-}
-
-/*
- * Initialise the Forth interpreter, create all our commands as words.
- */
-void
-bf_init(void)
-{
- struct bootblk_command **cmdp;
- int fd;
-
- ficlInitSystem(4000); /* Default dictionary ~4000 cells */
- bf_vm = ficlNewVM();
-
- /* make all commands appear as Forth words */
- SET_FOREACH(cmdp, Xcommand_set)
- ficlBuild((*cmdp)->c_name, bf_command, FW_DEFAULT);
-
- /* try to load and run init file if present */
- if ((fd = open("/boot/boot.4th", O_RDONLY)) != -1) {
- (void)ficlExecFD(bf_vm, fd);
- close(fd);
- }
-}
-
-/*
- * Feed a line of user input to the Forth interpreter
- */
-void
-bf_run(char *line)
-{
- int result;
-
- result = ficlExec(bf_vm, line);
- DEBUG("ficlExec '%s' = %d", line, result);
-
- if (result == VM_USEREXIT)
- panic("interpreter exit");
-}
diff --git a/sys/boot/common/interp_parse.c b/sys/boot/common/interp_parse.c
index 865c8cbc05011..ef235632bd664 100644
--- a/sys/boot/common/interp_parse.c
+++ b/sys/boot/common/interp_parse.c
@@ -11,7 +11,7 @@
* Jordan K. Hubbard
* 29 August 1998
*
- * $Id: interp_parse.c,v 1.5 1999/01/10 05:08:12 msmith Exp $
+ * $Id: interp_parse.c,v 1.3 1998/09/04 02:43:26 msmith Exp $
*
* The meat of the simple parser.
*/
@@ -100,11 +100,7 @@ parse(int *argc, char ***argv, char *str)
while (*p) {
switch (state) {
case STR:
- if ((*p == '\\') && p[1]) {
- p++;
- PARSE_FAIL(i == (PARSE_BUFSIZE - 1));
- buf[i++] = *p++;
- } else if (isquote(*p)) {
+ if (isquote(*p)) {
quote = quote ? 0 : *p;
++p;
}
diff --git a/sys/boot/common/isapnp.c b/sys/boot/common/isapnp.c
index 865e8f683e153..cc28da6c954f6 100644
--- a/sys/boot/common/isapnp.c
+++ b/sys/boot/common/isapnp.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: isapnp.c,v 1.3 1998/10/21 20:07:04 msmith Exp $
+ * $Id: isapnp.c,v 1.1 1998/09/18 00:24:25 msmith Exp $
*/
/*
@@ -43,17 +43,17 @@ static void isapnp_write(int d, u_char r);
static u_char isapnp_read(int d);
static void isapnp_send_Initiation_LFSR();
static int isapnp_get_serial(u_int8_t *p);
-static int isapnp_isolation_protocol(void);
-static void isapnp_enumerate(void);
+static int isapnp_isolation_protocol(struct pnpinfo **pnplist);
+static void isapnp_enumerate(struct pnpinfo **pnplist);
/* PnP read data port */
-int isapnp_readport = 0;
+static int pnp_rd_port;
#define _PNP_ID_LEN 9
struct pnphandler isapnphandler =
{
- "ISA bus",
+ "isapnp",
isapnp_enumerate
};
@@ -68,7 +68,7 @@ static u_char
isapnp_read(int d)
{
outb (_PNP_ADDRESS, d);
- return (inb(isapnp_readport));
+ return (inb(3 | (pnp_rd_port <<2)));
}
/*
@@ -104,11 +104,11 @@ isapnp_get_serial(u_int8_t *data)
bzero(data, _PNP_ID_LEN);
outb(_PNP_ADDRESS, SERIAL_ISOLATION);
for (i = 0; i < 72; i++) {
- bit = inb(isapnp_readport) == 0x55;
+ bit = inb((pnp_rd_port << 2) | 0x3) == 0x55;
delay(250); /* Delay 250 usec */
/* Can't Short Circuit the next evaluation, so 'and' is last */
- bit = (inb(isapnp_readport) == 0xaa) && bit;
+ bit = (inb((pnp_rd_port << 2) | 0x3) == 0xaa) && bit;
delay(250); /* Delay 250 usec */
valid = valid || bit;
@@ -126,112 +126,87 @@ isapnp_get_serial(u_int8_t *data)
}
/*
- * Fills the buffer with resource info from the device.
- * Returns nonzero if the device fails to report
+ * Format a pnp id as a string in standard ISA PnP format, AAAIIRR
+ * where 'AAA' is the EISA ID, II is the product ID and RR the revision ID.
*/
-static int
-isapnp_get_resource_info(u_int8_t *buffer, int len)
+static char *
+isapnp_format(u_int8_t *data)
{
- int i, j;
- u_char temp;
-
- for (i = 0; i < len; i++) {
- outb(_PNP_ADDRESS, STATUS);
- for (j = 0; j < 100; j++) {
- if ((inb(isapnp_readport)) & 0x1)
- break;
- delay(1);
- }
- if (j == 100) {
- printf("PnP device failed to report resource data\n");
- return(1);
- }
- outb(_PNP_ADDRESS, RESOURCE_DATA);
- temp = inb(isapnp_readport);
- if (buffer != NULL)
- buffer[i] = temp;
- }
- return(0);
+ static char idbuf[8];
+ const char hextoascii[] = "0123456789abcdef";
+
+ idbuf[0] = '@' + ((data[0] & 0x7c) >> 2);
+ idbuf[1] = '@' + (((data[0] & 0x3) << 3) + ((data[1] & 0xe0) >> 5));
+ idbuf[2] = '@' + (data[1] & 0x1f);
+ idbuf[3] = hextoascii[(data[2] >> 4)];
+ idbuf[4] = hextoascii[(data[2] & 0xf)];
+ idbuf[5] = hextoascii[(data[3] >> 4)];
+ idbuf[6] = hextoascii[(data[3] & 0xf)];
+ idbuf[7] = 0;
}
/*
- * Scan Resource Data for useful information.
- *
- * We scan the resource data for compatible device IDs and
- * identifier strings; we only take the first identifier string
- * and assume it's for the card as a whole.
- *
- * Returns 0 if the scan completed OK, nonzero on error.
+ * Try to read a compatible device ID from the current device, return
+ * 1 if we found one.
*/
+#define READ_RSC(c) {while ((isapnp_read(STATUS) & 1) == 0); (c) = isapnp_read(RESOURCE_DATA);}
static int
-isapnp_scan_resdata(struct pnpinfo *pi)
+isapnp_getid(u_int8_t *data)
{
- u_char tag, resinfo[8];
- int large_len, limit;
- char *str;
-
- limit = 1000;
- while ((limit-- > 0) && !isapnp_get_resource_info(&tag, 1)) {
- if (PNP_RES_TYPE(tag) == 0) {
- /* Small resource */
- switch (PNP_SRES_NUM(tag)) {
-
- case COMP_DEVICE_ID:
- /* Got a compatible device id resource */
- if (isapnp_get_resource_info(resinfo, PNP_SRES_LEN(tag)))
- return(1);
- pnp_addident(pi, pnp_eisaformat(resinfo));
-
- case END_TAG:
- return(0);
- break;
-
- default:
- /* Skip this resource */
- if (isapnp_get_resource_info(NULL, PNP_SRES_LEN(tag)))
- return(1);
- break;
- }
- } else {
- /* Large resource */
- if (isapnp_get_resource_info(resinfo, 2))
+ int discard, pos, len;
+ u_int8_t c, t;
+
+ discard = 0;
+ len = 0;
+ pos = 0;
+
+ for (;;) {
+ READ_RSC(c);
+ /* skipping junk? */
+ if (discard > 0) {
+ discard--;
+ continue;
+ }
+ /* copying data? */
+ if (len > 0) {
+ data[pos++] = c;
+ /* got all data? */
+ if (pos >= len)
return(1);
-
- large_len = resinfo[1];
- large_len = (large_len << 8) + resinfo[0];
-
- switch(PNP_LRES_NUM(tag)) {
-
- case ID_STRING_ANSI:
- str = malloc(large_len + 1);
- if (isapnp_get_resource_info(str, large_len)) {
- free(str);
- return(1);
- }
- str[large_len] = 0;
- if (pi->pi_desc == NULL) {
- pi->pi_desc = str;
- } else {
- free(str);
- }
- break;
-
- default:
- /* Large resource, skip it */
- if (isapnp_get_resource_info(NULL, large_len))
- return(1);
- }
}
+ /* resource type */
+ if (c & 0x80) { /* large resource, throw it away */
+ if (c == 0xff)
+ return(0); /* end of resources */
+ READ_RSC(c);
+ discard = c;
+ READ_RSC(c);
+ discard += ((int)c << 8);
+ continue;
+ }
+ /* small resource */
+ t = (c >> 3) & 0xf;
+ if (t == 0xf)
+ return(0); /* end of resources */
+ if ((t == LOG_DEVICE_ID) || (t == COMP_DEVICE_ID)) {
+ len = c & 7;
+ pos = 0;
+ continue;
+ }
+ discard = c & 7; /* unwanted small resource */
}
- return(1);
+
}
+
/*
- * Run the isolation protocol. Upon exiting, all cards are aware that
- * they should use isapnp_readport as the READ_DATA port.
+ * Run the isolation protocol. Use pnp_rd_port as the READ_DATA port
+ * value (caller should try multiple READ_DATA locations before giving
+ * up). Upon exiting, all cards are aware that they should use
+ * pnp_rd_port as the READ_DATA port.
*/
static int
-isapnp_isolation_protocol(void)
+isapnp_isolation_protocol(struct pnpinfo **pilist)
{
int csn;
struct pnpinfo *pi;
@@ -246,32 +221,30 @@ isapnp_isolation_protocol(void)
for (csn = 1; ; csn++) {
/* Wake up cards without a CSN (ie. all of them) */
isapnp_write(WAKE, 0);
- isapnp_write(SET_RD_DATA, (isapnp_readport >> 2));
+ isapnp_write(SET_RD_DATA, pnp_rd_port);
outb(_PNP_ADDRESS, SERIAL_ISOLATION);
delay(1000); /* Delay 1 msec */
if (isapnp_get_serial(cardid)) {
isapnp_write(SET_CSN, csn);
- pi = pnp_allocinfo();
+ pi = malloc(sizeof(struct pnpinfo));
+ pi->pi_next = *pilist;
+ *pilist = pi;
ndevs++;
- pnp_addident(pi, pnp_eisaformat(cardid));
/* scan the card obtaining all the identifiers it holds */
- if (isapnp_scan_resdata(pi)) {
- pnp_freeinfo(pi); /* error getting data, ignore */
- } else {
- pnp_addinfo(pi);
+ while (isapnp_getid(cardid)) {
+ printf(" %s\n", isapnp_format(cardid));
+ pnp_addident(pi, isapnp_format(cardid));
}
- } else {
+ } else
break;
- }
}
/* Move all cards to wait-for-key state */
- while (--csn > 0) {
+ while (csn >= 0) {
isapnp_send_Initiation_LFSR();
isapnp_write(WAKE, csn);
isapnp_write(CONFIG_CONTROL, 0x02);
delay(1000); /* XXX is it really necessary ? */
- csn--;
}
return(ndevs);
}
@@ -280,40 +253,17 @@ isapnp_isolation_protocol(void)
* Locate ISA-PnP devices and populate the supplied list.
*/
static void
-isapnp_enumerate(void)
+isapnp_enumerate(struct pnpinfo **pnplist)
{
- int pnp_rd_port;
-
- /* Check for I/O port access */
- if ((archsw.arch_isainb == NULL) || (archsw.arch_isaoutb == NULL))
- return;
-
- /*
- * Validate a possibly-suggested read port value. If the autoscan failed
- * last time, this will return us to autoscan mode again.
- */
- if ((isapnp_readport > 0) &&
- (((isapnp_readport < 0x203) ||
- (isapnp_readport > 0x3ff) ||
- (isapnp_readport & 0x3) != 0x3)))
- /* invalid, go look for ourselves */
- isapnp_readport = 0;
-
- if (isapnp_readport < 0) {
- /* someone is telling us there is no ISA in the system */
- return;
-
- } else if (isapnp_readport > 0) {
- /* Someone has told us where the port is/should be, or we found one last time */
- isapnp_isolation_protocol();
-
- } else {
- /* No clues, look for it ourselves */
- for (pnp_rd_port = 0x80; pnp_rd_port < 0xff; pnp_rd_port += 0x10) {
- /* Look for something, quit when we find it */
- isapnp_readport = (pnp_rd_port << 2) | 0x3;
- if (isapnp_isolation_protocol() > 0)
- break;
- }
+ int devs;
+
+ for (pnp_rd_port = 0x80; pnp_rd_port < 0xff; pnp_rd_port += 0x10) {
+
+ /* Look for something, quit when we find it */
+ if ((devs = isapnp_isolation_protocol(pnplist)) > 0)
+ break;
}
+ printf("Found %d ISA PnP devices\n", devs);
}
+
+
diff --git a/sys/boot/common/isapnp.h b/sys/boot/common/isapnp.h
index 0b3b9ec885271..6c072824867eb 100644
--- a/sys/boot/common/isapnp.h
+++ b/sys/boot/common/isapnp.h
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: isapnp.h,v 1.1 1998/09/18 00:24:25 msmith Exp $
+ * $Id: pnp.h,v 1.6 1998/01/10 07:41:43 kato Exp $
*/
#ifndef _I386_ISA_PNP_H_
@@ -210,12 +210,6 @@
/*** 32-bit memory accesses are at 0x76 ***/
-/* Macros to parse Resource IDs */
-#define PNP_RES_TYPE(a) (a >> 7)
-#define PNP_SRES_NUM(a) (a >> 3)
-#define PNP_SRES_LEN(a) (a & 0x07)
-#define PNP_LRES_NUM(a) (a & 0x7f)
-
/* Small Resource Item names */
#define PNP_VERSION 0x1
#define LOG_DEVICE_ID 0x2
diff --git a/sys/boot/common/load_aout.c b/sys/boot/common/load_aout.c
index 6d33ad49f3672..3a5d34d15a6ba 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.10 1998/10/12 09:05:12 peter Exp $
+ * $Id: load_aout.c,v 1.9 1998/10/09 23:15:39 peter Exp $
*/
#include <sys/param.h>
@@ -223,34 +223,30 @@ aout_loadimage(struct loaded_module *mp, int fd, vm_offset_t loadaddr, struct ex
/* symbol table size */
ssym = addr;
- if(ehdr->a_syms!=NULL) {
- archsw.arch_copyin(&ehdr->a_syms, addr, sizeof(ehdr->a_syms));
- addr += sizeof(ehdr->a_syms);
+ archsw.arch_copyin(&ehdr->a_syms, addr, sizeof(ehdr->a_syms));
+ addr += sizeof(ehdr->a_syms);
- /* symbol table */
- printf("symbols=[0x%x+0x%lx", sizeof(ehdr->a_syms), ehdr->a_syms);
- if (archsw.arch_readin(fd, addr, ehdr->a_syms) != ehdr->a_syms)
- return(0);
- addr += ehdr->a_syms;
-
- /* string table */
- read(fd, &ss, sizeof(ss));
- archsw.arch_copyin(&ss, addr, sizeof(ss));
- addr += sizeof(ss);
- ss -= sizeof(ss);
- printf("+0x%x+0x%x]", sizeof(ss), ss);
- if (archsw.arch_readin(fd, addr, ss) != ss)
- return(0);
- addr += ss;
-
- mod_addmetadata(mp, MODINFOMD_SSYM, sizeof(ssym), &ssym);
- mod_addmetadata(mp, MODINFOMD_ESYM, sizeof(esym), &esym);
- } else {
- printf("symbols=[none]");
- }
- printf("\n");
+ /* symbol table */
+ printf("symbols=[0x%x+0x%lx", sizeof(ehdr->a_syms), ehdr->a_syms);
+ if (archsw.arch_readin(fd, addr, ehdr->a_syms) != ehdr->a_syms)
+ return(0);
+ addr += ehdr->a_syms;
+
+ /* string table */
+ read(fd, &ss, sizeof(ss));
+ archsw.arch_copyin(&ss, addr, sizeof(ss));
+ addr += sizeof(ss);
+ ss -= sizeof(ss);
+ printf("+0x%x+0x%x]", sizeof(ss), ss);
+ if (archsw.arch_readin(fd, addr, ss) != ss)
+ return(0);
+ printf(" \n");
+ addr += ss;
esym = addr;
+ mod_addmetadata(mp, MODINFOMD_SSYM, sizeof(ssym), &ssym);
+ mod_addmetadata(mp, MODINFOMD_ESYM, sizeof(esym), &esym);
+
return(addr - loadaddr);
}
diff --git a/sys/boot/common/load_elf.c b/sys/boot/common/load_elf.c
index ff1f50638ac8a..b2b38c7800b65 100644
--- a/sys/boot/common/load_elf.c
+++ b/sys/boot/common/load_elf.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: load_elf.c,v 1.9 1998/10/17 03:06:38 peter Exp $
+ * $Id: load_elf.c,v 1.7 1998/10/15 21:56:47 dfr Exp $
*/
#include <sys/param.h>
@@ -40,7 +40,7 @@
#include "bootstrap.h"
-static int elf_loadimage(struct loaded_module *mp, int fd, vm_offset_t loadaddr, Elf_Ehdr *ehdr, int kernel, caddr_t firstpage, int firstlen);
+static int elf_loadimage(struct loaded_module *mp, int fd, vm_offset_t loadaddr, Elf_Ehdr *ehdr, Elf_Phdr *phdr, int kernel);
char *elf_kerneltype = "elf kernel";
char *elf_moduletype = "elf module";
@@ -54,15 +54,15 @@ int
elf_loadmodule(char *filename, vm_offset_t dest, struct loaded_module **result)
{
struct loaded_module *mp, *kmp;
- Elf_Ehdr *ehdr;
+ Elf_Ehdr ehdr;
+ Elf_Phdr *phdr;
int fd;
int err, kernel;
u_int pad;
char *s;
- caddr_t firstpage;
- int firstlen;
mp = NULL;
+ phdr = NULL;
/*
* Open the image, read and validate the ELF header
@@ -71,26 +71,21 @@ elf_loadmodule(char *filename, vm_offset_t dest, struct loaded_module **result)
return(EFTYPE);
if ((fd = open(filename, O_RDONLY)) == -1)
return(errno);
- firstpage = malloc(PAGE_SIZE);
- if (firstpage == NULL)
- return(ENOMEM);
- firstlen = read(fd, firstpage, PAGE_SIZE);
- if (firstlen <= sizeof(ehdr)) {
+ if (read(fd, &ehdr, sizeof(ehdr)) != sizeof(ehdr)) {
err = EFTYPE; /* could be EIO, but may be small file */
goto oerr;
}
- ehdr = (Elf_Ehdr *)firstpage;
/* Is it ELF? */
- if (!IS_ELF(*ehdr)) {
+ if (!IS_ELF(ehdr)) {
err = EFTYPE;
goto oerr;
}
- if (ehdr->e_ident[EI_CLASS] != ELF_TARG_CLASS || /* Layout ? */
- ehdr->e_ident[EI_DATA] != ELF_TARG_DATA ||
- ehdr->e_ident[EI_VERSION] != EV_CURRENT || /* Version ? */
- ehdr->e_version != EV_CURRENT ||
- ehdr->e_machine != ELF_TARG_MACH) { /* Machine ? */
+ if (ehdr.e_ident[EI_CLASS] != ELF_TARG_CLASS || /* Layout ? */
+ ehdr.e_ident[EI_DATA] != ELF_TARG_DATA ||
+ ehdr.e_ident[EI_VERSION] != EV_CURRENT || /* Version ? */
+ ehdr.e_version != EV_CURRENT ||
+ ehdr.e_machine != ELF_TARG_MACH) { /* Machine ? */
err = EFTYPE;
goto oerr;
}
@@ -100,7 +95,7 @@ elf_loadmodule(char *filename, vm_offset_t dest, struct loaded_module **result)
* Check to see what sort of module we are.
*/
kmp = mod_findmodule(NULL, NULL);
- if (ehdr->e_type == ET_DYN) {
+ if (ehdr.e_type == ET_DYN) {
/* Looks like a kld module */
if (kmp == NULL) {
printf("elf_loadmodule: can't load module before kernel\n");
@@ -121,7 +116,7 @@ elf_loadmodule(char *filename, vm_offset_t dest, struct loaded_module **result)
pad = PAGE_SIZE - pad;
dest += pad;
}
- } else if (ehdr->e_type == ET_EXEC) {
+ } else if (ehdr.e_type == ET_EXEC) {
/* Looks like a kernel */
if (kmp != NULL) {
printf("elf_loadmodule: kernel already loaded\n");
@@ -131,7 +126,7 @@ elf_loadmodule(char *filename, vm_offset_t dest, struct loaded_module **result)
/*
* Calculate destination address based on kernel entrypoint
*/
- dest = (vm_offset_t) ehdr->e_entry;
+ dest = (vm_offset_t) ehdr.e_entry;
if (dest == 0) {
printf("elf_loadmodule: not a kernel (maybe static binary?)\n");
err = EPERM;
@@ -169,12 +164,36 @@ elf_loadmodule(char *filename, vm_offset_t dest, struct loaded_module **result)
printf("%s ", filename);
#endif
- mp->m_size = elf_loadimage(mp, fd, dest, ehdr, kernel, firstpage, firstlen);
+ phdr = malloc(ehdr.e_phnum * sizeof(*phdr));
+ if (phdr == NULL) {
+ err = ENOMEM;
+ goto out;
+ }
+
+ if (lseek(fd, ehdr.e_phoff, SEEK_SET) == -1) {
+ printf("elf_loadexec: lseek for phdr failed\n");
+ goto ioerr;
+ }
+ if (read(fd, phdr, ehdr.e_phnum * sizeof(*phdr)) !=
+ ehdr.e_phnum * sizeof(*phdr)) {
+ printf("elf_loadmodule: cannot read program header\n");
+ goto ioerr;
+ }
+ if (lseek(fd, 0, SEEK_SET) == -1) {
+ close(fd);
+ if ((fd = open(filename, O_RDONLY)) == -1) {
+ printf("elf_loadmodule: cannot reset file position\n");
+ mod_discard(mp);
+ return errno;
+ }
+ }
+
+ mp->m_size = elf_loadimage(mp, fd, dest, &ehdr, phdr, kernel);
if (mp->m_size == 0 || mp->m_addr == 0)
goto ioerr;
/* save exec header as metadata */
- mod_addmetadata(mp, MODINFOMD_ELFHDR, sizeof(*ehdr), ehdr);
+ mod_addmetadata(mp, MODINFOMD_ELFHDR, sizeof(ehdr), &ehdr);
/* Load OK, return module pointer */
*result = (struct loaded_module *)mp;
@@ -186,8 +205,8 @@ elf_loadmodule(char *filename, vm_offset_t dest, struct loaded_module **result)
oerr:
mod_discard(mp);
out:
- if (firstpage)
- free(firstpage);
+ if (phdr)
+ free(phdr);
close(fd);
return(err);
}
@@ -198,10 +217,9 @@ elf_loadmodule(char *filename, vm_offset_t dest, struct loaded_module **result)
*/
static int
elf_loadimage(struct loaded_module *mp, int fd, vm_offset_t off,
- Elf_Ehdr *ehdr, int kernel, caddr_t firstpage, int firstlen)
+ Elf_Ehdr *ehdr, Elf_Phdr *phdr, int kernel)
{
int i, j;
- Elf_Phdr *phdr;
Elf_Shdr *shdr;
int ret;
vm_offset_t firstaddr;
@@ -221,7 +239,6 @@ elf_loadimage(struct loaded_module *mp, int fd, vm_offset_t off,
int symstrindex;
int symtabindex;
long size;
- int fpcopy;
dp = NULL;
shdr = NULL;
@@ -235,12 +252,6 @@ elf_loadimage(struct loaded_module *mp, int fd, vm_offset_t off,
#endif
}
- if ((ehdr->e_phoff + ehdr->e_phnum * sizeof(*phdr)) > firstlen) {
- printf("elf_loadimage: program header not within first page\n");
- goto out;
- }
- phdr = (Elf_Phdr *)(firstpage + ehdr->e_phoff);
-
for (i = 0; i < ehdr->e_phnum; i++) {
/* We want to load PT_LOAD segments only.. */
if (phdr[i].p_type != PT_LOAD)
@@ -261,22 +272,15 @@ elf_loadimage(struct loaded_module *mp, int fd, vm_offset_t off,
printf(" ");
}
#endif
- fpcopy = 0;
- if (firstlen > phdr[i].p_offset) {
- fpcopy = firstlen - phdr[i].p_offset;
- archsw.arch_copyin(firstpage + phdr[i].p_offset,
- phdr[i].p_vaddr + off, fpcopy);
+
+ if (lseek(fd, phdr[i].p_offset, SEEK_SET) == -1) {
+ printf("\nelf_loadexec: cannot seek\n");
+ goto out;
}
- if (phdr[i].p_filesz > fpcopy) {
- if (lseek(fd, phdr[i].p_offset + fpcopy, SEEK_SET) == -1) {
- printf("\nelf_loadexec: cannot seek\n");
- goto out;
- }
- if (archsw.arch_readin(fd, phdr[i].p_vaddr + off + fpcopy,
- phdr[i].p_filesz - fpcopy) != phdr[i].p_filesz - fpcopy) {
- printf("\nelf_loadexec: archsw.readin failed\n");
- goto out;
- }
+ if (archsw.arch_readin(fd, phdr[i].p_vaddr + off, phdr[i].p_filesz) !=
+ phdr[i].p_filesz) {
+ printf("\nelf_loadexec: archsw.readin failed\n");
+ goto out;
}
/* clear space from oversized segments; eg: bss */
if (phdr[i].p_filesz < phdr[i].p_memsz) {
@@ -323,11 +327,11 @@ elf_loadimage(struct loaded_module *mp, int fd, vm_offset_t off,
if (shdr == NULL)
goto nosyms;
if (lseek(fd, ehdr->e_shoff, SEEK_SET) == -1) {
- printf("\nelf_loadimage: cannot lseek() to section headers");
+ printf("\nelf_loadimage: cannot lseek() to section headers\n");
goto nosyms;
}
if (read(fd, shdr, chunk) != chunk) {
- printf("\nelf_loadimage: read section headers failed");
+ printf("\nelf_loadimage: read section headers failed\n");
goto nosyms;
}
symtabindex = -1;
@@ -382,7 +386,7 @@ elf_loadimage(struct loaded_module *mp, int fd, vm_offset_t off,
lastaddr += sizeof(long);
#ifdef ELF_VERBOSE
- printf("\n%s: 0x%lx@0x%lx -> 0x%lx-0x%lx", secname,
+ printf("%s: 0x%lx@0x%lx -> 0x%lx-0x%lx\n", secname,
shdr[i].sh_size, shdr[i].sh_offset,
lastaddr, lastaddr + shdr[i].sh_size);
#else
@@ -392,14 +396,14 @@ elf_loadimage(struct loaded_module *mp, int fd, vm_offset_t off,
#endif
if (lseek(fd, shdr[i].sh_offset, SEEK_SET) == -1) {
- printf("\nelf_loadimage: could not seek for symbols - skipped!");
+ printf("\nelf_loadimage: could not seek for symbols - skipped!\n");
lastaddr = ssym;
ssym = 0;
goto nosyms;
}
if (archsw.arch_readin(fd, lastaddr, shdr[i].sh_size) !=
shdr[i].sh_size) {
- printf("\nelf_loadimage: could not read symbols - skipped!");
+ printf("\nelf_loadimage: could not read symbols - skipped!\n");
lastaddr = ssym;
ssym = 0;
goto nosyms;
@@ -414,14 +418,13 @@ elf_loadimage(struct loaded_module *mp, int fd, vm_offset_t off,
}
esym = lastaddr;
#ifndef ELF_VERBOSE
- printf("]");
+ printf("]\n");
#endif
mod_addmetadata(mp, MODINFOMD_SSYM, sizeof(ssym), &ssym);
mod_addmetadata(mp, MODINFOMD_ESYM, sizeof(esym), &esym);
nosyms:
- printf("\n");
ret = lastaddr - firstaddr;
mp->m_addr = firstaddr;
diff --git a/sys/boot/common/ls.c b/sys/boot/common/ls.c
index 73f805700bf89..493482a7b3005 100644
--- a/sys/boot/common/ls.c
+++ b/sys/boot/common/ls.c
@@ -1,5 +1,5 @@
/*
- * $Id: ls.c,v 1.6 1998/10/11 10:28:51 peter Exp $
+ * $Id: ls.c,v 1.5 1998/10/09 07:09:22 msmith Exp $
* From: $NetBSD: ls.c,v 1.3 1997/06/13 13:48:47 drochner Exp $
*/
@@ -70,7 +70,6 @@ command_ls(int argc, char *argv[])
fd = -1;
verbose = 0;
optind = 1;
- optreset = 1;
while ((ch = getopt(argc, argv, "l")) != -1) {
switch(ch) {
case 'l':
diff --git a/sys/boot/common/merge_help.awk b/sys/boot/common/merge_help.awk
deleted file mode 100644
index 1376c53aee3cf..0000000000000
--- a/sys/boot/common/merge_help.awk
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/awk -f
-#
-# $Id: mergehelp.awk,v 1.3 1999/01/13 20:06:52 jabley Exp $
-#
-# Merge two boot loader help files for FreeBSD 3.0
-# Joe Abley <jabley@patho.gen.nz>
-
-BEGIN \
-{
- state = 0;
- first = 0;
- ind = 0;
-}
-
-# beginning of first command
-/^###/ && (state == 0) \
-{
- state = 1;
- next;
-}
-
-# entry header
-/^# T[[:graph:]]+ (S[[:graph:]]+ )*D[[:graph:]][[:print:]]*$/ && (state == 1) \
-{
- match($0, " T[[:graph:]]+");
- T = substr($0, RSTART + 2, RLENGTH - 2);
- match($0, " S[[:graph:]]+");
- S = (RLENGTH == -1) ? "" : substr($0, RSTART + 2, RLENGTH - 2);
- match($0, " D[[:graph:]][[:print:]]*$");
- D = substr($0, RSTART + 2);
-
- # find a suitable place to store this one...
- ind++;
- if (ind == 1)
- {
- first = ind;
- help[ind, "T"] = T;
- help[ind, "S"] = S;
- help[ind, "link"] = -1;
- } else {
- i = first; j = -1;
- while (help[i, "T"] help[i, "S"] < T S)
- {
- j = i;
- i = help[i, "link"];
- if (i == -1) break;
- }
-
- if (i == -1)
- {
- help[j, "link"] = ind;
- help[ind, "link"] = -1;
- } else {
- help[ind, "link"] = i;
- if (j == -1)
- first = ind;
- else
- help[j, "link"] = ind;
- }
- }
- help[ind, "T"] = T;
- help[ind, "S"] = S;
- help[ind, "D"] = D;
-
- # set our state
- state = 2;
- help[ind, "text"] = 0;
- next;
-}
-
-# end of last command, beginning of next one
-/^###/ && (state == 2) \
-{
- state = 1;
-}
-
-(state == 2) \
-{
- sub("[[:blank:]]+$", "");
- if (help[ind, "text"] == 0 && $0 ~ /^[[:blank:]]*$/) next;
- help[ind, "text", help[ind, "text"]] = $0;
- help[ind, "text"]++;
- next;
-}
-
-# show them what we have (it's already sorted in help[])
-END \
-{
- node = first;
- while (node != -1)
- {
- printf "################################################################################\n";
- printf "# T%s ", help[node, "T"];
- if (help[node, "S"] != "") printf "S%s ", help[node, "S"];
- printf "D%s\n\n", help[node, "D"];
- for (i = 0; i < help[node, "text"]; i++)
- printf "%s\n", help[node, "text", i];
- node = help[node, "link"];
- }
- printf "################################################################################\n";
-}
diff --git a/sys/boot/common/module.c b/sys/boot/common/module.c
index 141a8ed32f664..5b0d547af069f 100644
--- a/sys/boot/common/module.c
+++ b/sys/boot/common/module.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: module.c,v 1.6 1998/10/09 23:12:34 peter Exp $
+ * $Id: module.c,v 1.5 1998/09/26 10:51:38 dfr Exp $
*/
/*
@@ -72,7 +72,6 @@ command_load(int argc, char *argv[])
dofile = 0;
optind = 1;
- optreset = 1;
typestr = NULL;
while ((ch = getopt(argc, argv, "t:")) != -1) {
switch(ch) {
@@ -134,7 +133,6 @@ command_lsmod(int argc, char *argv[])
verbose = 0;
optind = 1;
- optreset = 1;
while ((ch = getopt(argc, argv, "v")) != -1) {
switch(ch) {
case 'v':
diff --git a/sys/boot/common/pnp.c b/sys/boot/common/pnp.c
index 74853154ffe74..4a8ee48d5bd45 100644
--- a/sys/boot/common/pnp.c
+++ b/sys/boot/common/pnp.c
@@ -13,10 +13,9 @@
#include <string.h>
#include <bootstrap.h>
-STAILQ_HEAD(,pnpinfo) pnp_devices;
-static int pnp_devices_initted = 0;
+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);
@@ -29,56 +28,15 @@ COMMAND_SET(pnpscan, "pnpscan", "scan for PnP devices", pnp_scan);
int
pnp_scan(int argc, char *argv[])
{
- struct pnpinfo *pi;
int hdlr;
- int verbose;
- int ch;
-
- if (pnp_devices_initted == 0) {
- STAILQ_INIT(&pnp_devices);
- pnp_devices_initted = 1;
- }
-
- verbose = 0;
- optind = 1;
- optreset = 1;
- while ((ch = getopt(argc, argv, "v")) != -1) {
- switch(ch) {
- case 'v':
- verbose = 1;
- break;
- case '?':
- default:
- /* getopt has already reported an error */
- return(CMD_OK);
- }
- }
/* forget anything we think we knew */
- pnp_discard();
-
- if (verbose)
- pager_open();
+ pnp_discard(&pnp_devices);
/* iterate over all of the handlers */
for (hdlr = 0; pnphandlers[hdlr] != NULL; hdlr++) {
- if (verbose) {
- pager_output("Probing ");
- pager_output(pnphandlers[hdlr]->pp_name);
- pager_output("...\n");
- }
- pnphandlers[hdlr]->pp_enumerate();
- }
- if (verbose) {
- for (pi = pnp_devices.stqh_first; pi != NULL; pi = pi->pi_link.stqe_next) {
- pager_output(pi->pi_ident.stqh_first->id_ident); /* first ident should be canonical */
- if (pi->pi_desc != NULL) {
- pager_output(" : ");
- pager_output(pi->pi_desc);
- }
- pager_output("\n");
- }
- pager_close();
+ printf("Probing bus '%s'...\n", pnphandlers[hdlr]->pp_name);
+ pnphandlers[hdlr]->pp_enumerate(&pnp_devices);
}
return(CMD_OK);
}
@@ -93,7 +51,7 @@ pnp_reload(char *fname)
char *modfname;
/* find anything? */
- if (pnp_devices.stqh_first != NULL) {
+ if (pnp_devices != NULL) {
/* check for kernel, assign modules handled by static drivers there */
if (pnp_scankernel()) {
@@ -112,13 +70,13 @@ pnp_reload(char *fname)
}
/* try to load any modules that have been nominated */
- for (pi = pnp_devices.stqh_first; pi != NULL; pi = pi->pi_link.stqe_next) {
+ 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) + 4);
+ 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.stqh_first->id_ident);
+ printf("Could not load module '%s' for device '%s'\n", modfname, pi->pi_ident->id_ident);
free(modfname);
}
}
@@ -130,14 +88,24 @@ pnp_reload(char *fname)
* 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;
-
- while (pnp_devices.stqh_first != NULL) {
- pi = pnp_devices.stqh_first;
- STAILQ_REMOVE_HEAD(&pnp_devices, pi_link);
- pnp_freeinfo(pi);
+ struct pnpident *id;
+
+ 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)
+ free(pi->pi_argv);
+ free(pi);
}
}
@@ -258,14 +226,14 @@ pnp_readconf(char *path)
* assigned.
* XXX no revision parse/test here yet.
*/
- for (pi = pnp_devices.stqh_first; pi != NULL; pi = pi->pi_link.stqe_next) {
+ 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.stqh_first; id != NULL; id = id->id_link.stqe_next)
+ for (id = pi->pi_ident; id != NULL; id = id->id_next)
if (!strcmp(id->id_ident, ident))
break;
@@ -299,82 +267,19 @@ pnp_scankernel(void)
void
pnp_addident(struct pnpinfo *pi, char *ident)
{
- struct pnpident *id;
-
- for (id = pi->pi_ident.stqh_first; id != NULL; id = id->id_link.stqe_next)
- if (!strcmp(id->id_ident, ident))
- return; /* already have this one */
-
- id = malloc(sizeof(struct pnpident));
- id->id_ident = strdup(ident);
- STAILQ_INSERT_TAIL(&pi->pi_ident, id, id_link);
-}
-
-/*
- * Allocate a new pnpinfo struct
- */
-struct pnpinfo *
-pnp_allocinfo(void)
-{
- struct pnpinfo *pi;
+ struct pnpident *id, **idp;
- pi = malloc(sizeof(struct pnpinfo));
- bzero(pi, sizeof(struct pnpinfo));
- STAILQ_INIT(&pi->pi_ident);
- return(pi);
-}
-
-/*
- * Release storage held by a pnpinfo struct
- */
-void
-pnp_freeinfo(struct pnpinfo *pi)
-{
- struct pnpident *id;
-
- while (pi->pi_ident.stqh_first != NULL) {
- id = pi->pi_ident.stqh_first;
- STAILQ_REMOVE_HEAD(&pi->pi_ident, id_link);
- free(id->id_ident);
- free(id);
+ 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);
}
- if (pi->pi_desc)
- free(pi->pi_desc);
- if (pi->pi_module)
- free(pi->pi_module);
- if (pi->pi_argv)
- free(pi->pi_argv);
- free(pi);
-}
-
-/*
- * Add a new pnpinfo struct to the list.
- */
-void
-pnp_addinfo(struct pnpinfo *pi)
-{
- STAILQ_INSERT_TAIL(&pnp_devices, pi, pi_link);
-}
-
-
-/*
- * Format an EISA id as a string in standard ISA PnP format, AAAIIRR
- * where 'AAA' is the EISA vendor ID, II is the product ID and RR the revision ID.
- */
-char *
-pnp_eisaformat(u_int8_t *data)
-{
- static char idbuf[8];
- const char hextoascii[] = "0123456789abcdef";
-
- idbuf[0] = '@' + ((data[0] & 0x7c) >> 2);
- idbuf[1] = '@' + (((data[0] & 0x3) << 3) + ((data[1] & 0xe0) >> 5));
- idbuf[2] = '@' + (data[1] & 0x1f);
- idbuf[3] = hextoascii[(data[2] >> 4)];
- idbuf[4] = hextoascii[(data[2] & 0xf)];
- idbuf[5] = hextoascii[(data[3] >> 4)];
- idbuf[6] = hextoascii[(data[3] & 0xf)];
- idbuf[7] = 0;
- return(idbuf);
+ *idp = malloc(sizeof(struct pnpident));
+ (*idp)->id_next = NULL;
+ (*idp)->id_ident = strdup(ident);
}
diff --git a/sys/boot/common/pnpdata b/sys/boot/common/pnpdata
deleted file mode 100644
index 62d35a8193860..0000000000000
--- a/sys/boot/common/pnpdata
+++ /dev/null
@@ -1,183 +0,0 @@
-#
-# $Id$
-#
-# This file contains the system default Plug-and-Play data. It is
-# derived from a number of sources, including:
-#
-# - The Microsoft "Windows Generic Device IDs" document
-#
-
-[pci]
-######################################################################
-# PCI devices.
-#
-# Required attributes:
-#
-# ident= PCI identifier in the form 0xDDDDVVVV where
-# 'VVVV' is the 4-digit hex form of the vendor ID and
-# 'DDDD' is the 4-digit hex form of the device ID.
-# or
-#
-# vendor= 0xVVVV where 'VVVV' is above
-# name= Vendor name
-
-vendor=0x8086 name=Intel
-
-
-[isa]
-######################################################################
-# ISA PnP devices
-#
-# Required attributes:
-#
-# ident= ISA PnP identifier in the form AAAIIRR where
-# 'AAA' is the EISA vendor ID, 'II' is the device ID
-# and 'RR' is the revision ID.
-# or
-#
-# vendor= AAA to register just a vendor name.
-# name= Vendor name
-#
-# Optional attributes:
-#
-# module= Support module identifier.
-#
-# args= Arguments to pass to the support module.
-#
-
-vendor=CSC name=Crystal Semiconductor
-vendor=CTL name=Creative Labs
-vendor=PNP name=Generic
-
-# From "Windows Generic Device IDs"
-#
-# --Parallel Devices--
-ident=PNP0400 module=lpt # Standard LPT printer port
-ident=PNP0401 module=lpt # ECP printer port
-
-# --Serial Devices--
-ident=PNP0500 module=sio # Standard PC COM port
-ident=PNP0501 module=sio # 16550A-compatible COM port
-ident=PNP0502 module=sio # Multiport serial device (non-intelligent 16550)
-
-# --Disk Controllers--
-ident=PNP0600 module=wd # Generic ESDI/IDE/ATA compatible hard disk controller
-ident=PNP0603 module=wd # Generic IDE supporting Microsoft Device Bay Specification
-ident=PNP0700 module=fd # PC standard floppy disk controller
-ident=PNP0701 module=fd # Standard floppy controller supporting MS Device Bay Spec
-
-# --Peripheral Buses--
-ident=PNP0A00 module=isa # ISA Bus
-ident=PNP0A01 module=eisa # EISA Bus
-ident=PNP0A03 module=pci # PCI Bus
-ident=PNP0A04 module=isa # VESA/VL Bus
-
-# -- Real Time Clock, BIOS, System board devices--
-ident=PNP0C04 module=npx # Math Coprocessor
-ident=PNP0C05 module=apm # APM BIOS (Version independent)
-
-# --PCMCIA Controller Chipsets--
-ident=PNP0E00 module=pcic # Intel 82365-Compatible PCMCIA Controller
-ident=PNP0E01 module=pcic # Cirrus Logic CL-PD6720 PCMCIA Controller
-ident=PNP0E02 module=pcic # VLSI VL82C146 PCMCIA Controller
-ident=PNP0E03 module=pcic # Intel 82365-compatible CardBus controller
-
-# --Network Adapters--
-ident=PNP8001 module=ed # Novell/Anthem NE3200
-ident=PNP8004 # Compaq NE3200
-ident=PNP80d3 module=ed # Novell/Anthem NE1000
-ident=PNP80d4 module=ed # Novell/Anthem NE2000
-ident=PNP80d5 module=ed # NE1000 Compatible
-ident=PNP80d6 module=ed # NE2000 Compatible
-ident=PNP80d8 module=lnc # Novell/Anthem NE2100
-ident=PNP80e9 module=le # DEC (DE200) EtherWorks Turbo
-ident=PNP80eb module=le # DEC (DE201) EtherWorks Turbo/TP
-ident=PNP80ec module=le # DEC (DE202) EtherWorks Turbo/TP_BNC
-ident=PNP80f1 module=eg # 3Com EtherLink Plus
-ident=PNP80f3 module=ed # 3Com EtherLink II or IITP (8 or 16-bit)
-ident=PNP80f6 module=ed # 3Com EtherLink 16
-ident=PNP80f7 module=ep # 3Com EtherLink III
-ident=PNP80f8 module=ep # 3Com Generic Etherlink Plug and Play Device
-ident=PNP8123 module=ed # SMC StarCard PLUS (WD/8003S)
-ident=PNP8124 module=ed # SMC StarCard PLUS With On Board Hub (WD/8003SH)
-ident=PNP8125 module=ed # SMC EtherCard PLUS (WD/8003E)
-ident=PNP8126 module=ed # SMC EtherCard PLUS With Boot ROM Socket (WD/8003EBT)
-ident=PNP8127 module=ed # SMC EtherCard PLUS With Boot ROM Socket (WD/8003EB)
-ident=PNP8128 module=ed # SMC EtherCard PLUS TP (WD/8003WT)
-ident=PNP812a module=ed # SMC EtherCard PLUS 16 With Boot ROM Socket (WD/8013EBT)
-ident=PNP812d module=ie # Intel EtherExpress 16 or 16TP
-ident=PNP8137 module=ed # Artisoft AE-1
-ident=PNP8138 module=ed # Artisoft AE-2 or AE-3
-ident=PNP8158 module=ed # HP PC LAN Adapter/16 TP Plus (HP27247B)
-ident=PNP8159 module=ed # HP PC LAN Adapter/16 TL Plus (HP27252)
-ident=PNP81c3 module=ed # SMC EtherCard PLUS Elite (WD/8003EP)
-ident=PNP81c4 module=ed # SMC EtherCard PLUS 10T (WD/8003W)
-ident=PNP81c5 module=ed # SMC EtherCard PLUS Elite 16 (WD/8013EP)
-ident=PNP81c6 module=ed # SMC EtherCard PLUS Elite 16T (WD/8013W)
-ident=PNP81c7 module=ed # SMC EtherCard PLUS Elite 16 Combo (WD/8013EW or 8013EWC)
-ident=PNP81c8 module=ed # SMC EtherElite Ultra 16
-ident=PNP820a module=ed # Zenith Data Systems NE2000-Compatible
-ident=PNP8231 module=lnc # Advanced Micro Devices AM2100/AM1500T
-ident=PNP828C module=lnc # AMD PCNet Family cards
-ident=PNP828D module=lnc # AMD PCNet32 (VL version)
-ident=PNP8323 module=ed # SMC EtherCard (All Types except 8013/A)
-ident=PNP8390 module=ed # Generic network adapter
-
-# --SCSI, Proprietary CD Adapters--
-ident=PNPA003 module=matcd # Panasonic proprietary CD-ROM adapter (SBPro/SB16)
-ident=PNPA02B module=scd # Sony proprietary CD-ROM controller
-ident=PNPA030 module=mcd # Mitsumi LU-005 Single Speed CD-ROM controller + drive
-ident=PNPA031 module=mcd # Mitsumi FX-001 Single Speed CD-ROM controller + drive
-ident=PNPA032 module=mcd # Mitsumi FX-001 Double Speed CD-ROM controller + drive
-
-# --Sound/Video-capture, multimedia--
-ident=PNPB000 module=pcm # Sound Blaster 1.5 sound device
-ident=PNPB001 module=pcm # Sound Blaster 2.0 sound device
-ident=PNPB002 module=pcm # Sound Blaster Pro sound device
-ident=PNPB003 module=pcm # Sound Blaster 16 sound device
-ident=PNPB007 module=pcm # Microsoft Windows Sound System-compatible sound device
-ident=PNPB009 module=pcm # Plug and Play Microsoft Windows Sound System Device
-ident=PNPB020 module=pcm # Yamaha OPL3-compatible FM synthesizer device
-ident=PNPB02F module=joy # Joystick/Game port
-
-# --Compatibility with early device ID list--
-ident=PNP0802 module=pcm # Microsoft Sound System compatible device (obsolete, use PNPB0xx instead)
-
-# --Modems--
-ident=PNPC000 module=sio # Compaq 14400 Modem (TBD)
-ident=PNPC001 module=sio # Compaq 2400/9600 Modem (TBD)
-
-# Vendor supplied IDs.
-
-# --Parallel Devices--
-
-# --Serial Devices--
-
-# --Disk Controllers--
-
-# --Peripheral Buses--
-
-# --Real Time Clock, BIOS, System board devices--
-
-# --PCMCIA Controller Chipsets--
-
-# --Network Adapters--
-ident=CSC6040 module=cs # Crystal Semiconductor CS8920
-
-# --SCSI, Proprietary CD Adapters--
-
-# --Sound/Video-capture, multimedia--
-
-# --Modems--
-
-
-
-[com]
-######################################################################
-# COM PnP devices
-#
-
-[lpt]
-######################################################################
-# LPT PnP devices
-#