diff options
author | msmith <msmith@FreeBSD.org> | 1998-09-26 01:29:13 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1998-09-26 01:29:13 +0000 |
commit | 7e33170a26eb4e00de1118e6ad023f344f2eda57 (patch) | |
tree | 88e60ab6cafa9863d327fce7019ff2b61bd94edd /sys/boot/common | |
parent | 813a76e7c2c3faee577231049fa983dc48c7de53 (diff) | |
download | FreeBSD-src-7e33170a26eb4e00de1118e6ad023f344f2eda57.zip FreeBSD-src-7e33170a26eb4e00de1118e6ad023f344f2eda57.tar.gz |
console.c
Allow the MI code to override the preferred console (eg. so that
an RB_SERIAL flag from the i386 boot2 can override the default
first active console)
isapnp.c
Use the standard format for ISA PnP IDs.
pnp.c
Allow trailing comments on lines, be less picky about line
contents.
ls.c
Cosmetic error message fix.
panic.c
Print the right arguments.
Diffstat (limited to 'sys/boot/common')
-rw-r--r-- | sys/boot/common/console.c | 24 | ||||
-rw-r--r-- | sys/boot/common/isapnp.c | 25 | ||||
-rw-r--r-- | sys/boot/common/ls.c | 8 | ||||
-rw-r--r-- | sys/boot/common/panic.c | 6 | ||||
-rw-r--r-- | sys/boot/common/pnp.c | 13 |
5 files changed, 51 insertions, 25 deletions
diff --git a/sys/boot/common/console.c b/sys/boot/common/console.c index 5aed8b1..ffc41a9 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$ + * $Id: console.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ */ #include <stand.h> @@ -48,16 +48,28 @@ cons_probe(void) { int cons; int active; + char *prefconsole; - /* Do all console probes, make the fist fully functional console active */ + /* Do all console probes */ for (cons = 0, active = -1; consoles[cons] != NULL; cons++) { consoles[cons]->c_flags = 0; consoles[cons]->c_probe(consoles[cons]); - if ((consoles[cons]->c_flags == (C_PRESENTIN | C_PRESENTOUT)) && (active == -1)) { - consoles[cons]->c_flags |= (C_ACTIVEIN | C_ACTIVEOUT); - active = cons; - } + if ((consoles[cons]->c_flags == (C_PRESENTIN | C_PRESENTOUT)) && (active == -1)) + active = cons; /* first candidate */ } + + /* Check to see if a console preference has already been registered */ + prefconsole = strdup(getenv("console")); + if (prefconsole != NULL) { + unsetenv("console"); /* we want to replace this */ + for (cons = 0; consoles[cons] != NULL; cons++) + /* look for the nominated console, use it if it's functional */ + if (!strcmp(prefconsole, consoles[cons]->c_name) && + (consoles[cons]->c_flags == (C_PRESENTIN | C_PRESENTOUT))) + active = cons; + free(prefconsole); + } + consoles[active]->c_flags |= (C_ACTIVEIN | C_ACTIVEOUT); printf("Console: %s\n", consoles[active]->c_desc); env_setenv("console", 0, consoles[active]->c_name, cons_set, env_nounset); } diff --git a/sys/boot/common/isapnp.c b/sys/boot/common/isapnp.c index 2678222..cc28da6 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: pnp.c,v 1.5 1998/02/09 06:08:38 eivind Exp $ + * $Id: isapnp.c,v 1.1 1998/09/18 00:24:25 msmith Exp $ */ /* @@ -126,20 +126,23 @@ isapnp_get_serial(u_int8_t *data) } /* - * Format a pnp id as a string in standard ISA PnP format, 0x<hex identifier> + * 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 char * isapnp_format(u_int8_t *data) { - static char idbuf[16]; - u_int32_t i; - - i = data[3]; - i = (i << 8) + data[2]; - i = (i << 8) + data[1]; - i = (i << 8) + data[0]; - sprintf(idbuf, "0x%08x", i); - return(idbuf); + 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; } /* diff --git a/sys/boot/common/ls.c b/sys/boot/common/ls.c index 962d4f7..1596a3a 100644 --- a/sys/boot/common/ls.c +++ b/sys/boot/common/ls.c @@ -1,5 +1,5 @@ /* - * $Id: ls.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ + * $Id: ls.c,v 1.2 1998/09/03 02:10:07 msmith Exp $ * From: $NetBSD: ls.c,v 1.3 1997/06/13 13:48:47 drochner Exp $ */ @@ -107,6 +107,12 @@ command_ls(int argc, char *argv[]) result = CMD_ERROR; goto out; } +#ifdef VERBOSE_LS + /* fixup path for stat()ing files */ + if (!strcmp(path, "/")) + path = ""; +#endif + while ((size = read(fd, dirbuf, DIRBLKSIZ)) == DIRBLKSIZ) { struct direct *dp, *edp; diff --git a/sys/boot/common/panic.c b/sys/boot/common/panic.c index b531596..bee6a03 100644 --- a/sys/boot/common/panic.c +++ b/sys/boot/common/panic.c @@ -1,5 +1,5 @@ /* - * $Id: panic.c,v 1.2 1998/09/17 23:52:02 msmith Exp $ + * $Id: panic.c,v 1.3 1998/09/18 02:01:38 msmith Exp $ * From: $NetBSD: panic.c,v 1.2 1997/03/22 01:48:36 thorpej Exp $ */ @@ -46,9 +46,9 @@ panic(const char *fmt,...) printf("panic: "); va_start(ap, fmt); - printf(fmt, ap); - printf("\n"); + vprintf(fmt, ap); va_end(ap); + printf("\n"); exit(1); } diff --git a/sys/boot/common/pnp.c b/sys/boot/common/pnp.c index 84f3825..4a8ee48 100644 --- a/sys/boot/common/pnp.c +++ b/sys/boot/common/pnp.c @@ -129,6 +129,9 @@ pnp_discard(struct pnpinfo **list) * and 'module' fields are required; the 'rev' field is currently * ignored (but should be used), and the 'args' field must come * last. + * + * Comments may be appended to lines; any character including or following + * '#' on a line is ignored. */ static int pnp_readconf(char *path) @@ -153,6 +156,10 @@ pnp_readconf(char *path) /* keep/discard? */ if ((*cp == 0) || (*cp == '#')) continue; + + /* cut trailing comment? */ + if ((ep = strchr(cp, '#')) != NULL) + *ep = 0; /* bus declaration? */ if (*cp == '[') { @@ -210,11 +217,9 @@ pnp_readconf(char *path) cp = ep; } - /* we must have at least ident and module set */ - if ((ident == NULL) || (module == NULL)) { - printf("%s line %d: bad mapping\n", path, line); + /* we must have at least ident and module set to be interesting */ + if ((ident == NULL) || (module == NULL)) continue; - } /* * Loop looking for module/bus that might match this, but aren't already |