bootprop.c revision 56f33205c9ed776c3c909e07d52e94610a675740
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/bootconf.h>
#include "boot_plat.h"
char *my_own_name = "boot";
char v2args_buf[V2ARGS_BUF_SZ];
char *v2args = v2args_buf;
char *mfg_name;
char *impl_arch_name;
char *bootp_response;
char *module_path;
int cache_state;
/* These are the various memory lists */
*vfreelistp, /* virtmem available */
*pinstalledp; /* physmem installed */
char *boot_message;
char *netdev_path;
/*
* Support new boot properties "boot-start" and "boot-end" for
*/
#define BOOT_BADPROP -1
#define BOOT_SUCCESS 0
#define BOOT_FAILURE -1
#define NIL 0
/*
* default filename, and by bootflags() if a default filename is specified in
* the boot arguments.
*/
void
set_default_filename(char *filename)
{
}
static const struct bplist {
char *name;
void *val;
} bprop_tab[] = {
"boot-args", &v2args, 0,
"boot-path", &v2path, 0,
"fstype", &systype, 0,
"whoami", &my_own_name, 0,
"mfg-name", &mfg_name, 0,
"impl-arch-name", &impl_arch_name, 0,
"module-path", &module_path, 0,
"virt-avail", &vfreelistp, 0,
"phys-avail", &pfreelistp, 0,
"phys-installed", &pinstalledp, 0,
"default-name", &kernname, 0,
"cache-on?", &cache_state, sizeof (int),
"memory-update", 0, 0,
"boot-message", &boot_message, 0,
"bootp-response", &bootp_response, 0,
"netdev-path", &netdev_path, 0,
0, 0, 0
};
/*
* These routines implement the boot getprop interface.
* They are designed to mimic the corresponding devr_{getprop,getproplen}
* functions.
* The assumptions is that the basic property is an unsigned int. Other
* types (including lists) are special cases.
*/
/*ARGSUSED*/
int
{
int size = 0;
struct bplist *p;
/* this prop has side effects only. No length. */
return (BOOT_SUCCESS);
/* got a linked list? */
/*
* subtract out the ptrs for our local
* linked list. The application will
* only see an array.
*/
2*sizeof (struct memlist *));
return (size);
/* if we already know the size, return it */
if (p->size != 0)
return (p->size);
else {
return (0); /* NULL is allowed */
/* don't forget the null termination */
}
}
}
return (BOOT_BADPROP);
}
/*ARGSUSED*/
int
{
struct bplist *p;
/*
* dprintf("bgetprop: updating memlists.\n");
*/
return (BOOT_SUCCESS);
}
return (BOOT_SUCCESS);
}
/*
* The true end of boot should be scratchmemp,
* boot gets its dynamic memory from the scratchmem
* which is the first 4M of the physical memory,
* and they are mapped 1:1.
*/
return (BOOT_SUCCESS);
}
/* gotta linked list? */
u_longlong_t *t = buf;
/* copy out into an array */
*t++ = ml->ml_address;
}
return (BOOT_SUCCESS);
if (p->size != 0) {
} else {
}
return (BOOT_SUCCESS);
}
}
return (BOOT_FAILURE);
}
/*
* If the user wants the first property in the list, he passes in a
* null string. The routine will always return a ptr to the name of the
* next prop, except when there are no more props. In that case, it will
* return a null string.
*/
/*ARGSUSED*/
char *
{
struct bplist *p;
/* user wants the firstprop */
if (*prev == 0)
/*
* if prev is the last valid prop,
* we will return our terminator (0).
*/
return ((++p)->name);
}
return ((char *)0);
}