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.
This commit is contained in:
Mike Smith 1998-09-26 01:29:13 +00:00
parent b9546bc180
commit e12d0ec43a
5 changed files with 51 additions and 25 deletions

View File

@ -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);
}

View File

@ -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;
}
/*

View File

@ -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;

View File

@ -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);
}

View File

@ -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