Add MEMSIZE and ETHADDR options, so that they can be set in

the kernel config file, in case you have a buggy PMON which
doesn't provide the environment variables to the kernel.
This commit is contained in:
thorpej 2001-06-14 16:14:37 +00:00
parent 8f6cff260d
commit 4c73c770ce
2 changed files with 27 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.8 2001/06/14 15:29:23 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.9 2001/06/14 16:14:37 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -85,6 +85,9 @@
#include "opt_ddb.h"
#include "opt_kgdb.h"
#include "opt_memsize.h"
#include "opt_ethaddr.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -322,7 +325,12 @@ mach_init(int argc, char *argv[], char *envp[])
/*
* Get the Ethernet address of the on-board Ethernet.
*/
if ((cp = pmon_getenv("ethaddr")) != NULL) {
#if defined(ETHADDR)
cp = ETHADDR;
#else
cp = pmon_getenv("ethaddr");
#endif
if (cp != NULL) {
for (i = 0; i < ETHER_ADDR_LEN; i++) {
algor_ethaddr[i] = strtoul(cp, &cp0, 16);
cp = cp0 + 1;
@ -385,17 +393,23 @@ mach_init(int argc, char *argv[], char *envp[])
* Note: Reserve the first page! That's where the trap
* vectors are located.
*/
mem_clusters[mem_cluster_cnt].start = NBPG;
if ((cp = pmon_getenv("memsize")) != NULL) {
#if defined(MEMSIZE)
size = MEMSIZE * 1024 * 1024;
#else
if ((cp = pmon_getenv("memsize")) != NULL)
size = strtoul(cp, NULL, 10) * 1024 * 1024;
mem_clusters[mem_cluster_cnt].size =
size - mem_clusters[mem_cluster_cnt].start;
mem_cluster_cnt++;
} else {
else {
printf("FATAL: `memsize' PMON variable not set. Set it to\n");
printf(" the amount of memory (in MB) and try again.\n");
printf(" Or, build a kernel with the `MEMSIZE' "
"option.\n");
panic("algor_init");
}
#endif /* MEMSIZE */
mem_clusters[mem_cluster_cnt].start = NBPG;
mem_clusters[mem_cluster_cnt].size =
size - mem_clusters[mem_cluster_cnt].start;
mem_cluster_cnt++;
/*
* Copy the exception-dispatch code down to the exception vector.

View File

@ -1,4 +1,4 @@
# $NetBSD: files.algor,v 1.3 2001/06/10 08:45:09 thorpej Exp $
# $NetBSD: files.algor,v 1.4 2001/06/14 16:14:37 thorpej Exp $
# Algorithmics evaluation board specific configuration info.
@ -12,6 +12,10 @@ defopt ALGOR_P4032 # Algorithmics P-4032
defopt ALGOR_P5064 # Algorithmics P-5064
defopt ALGOR_P6032 # Algorithmics P-6032
# Various items that a buggy PMON might not provide us.
defopt MEMSIZE
defopt ETHADDR
# Platform support files
file arch/algor/algor/algor_p4032_bus_io.c algor_p4032
file arch/algor/algor/algor_p4032_bus_locio.c algor_p4032