bootprop.c revision f2be51489e45daeb2c91d227fa1691c74cc3ea97
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/bootconf.h>
#include <sys/bootprops.h>
#include "debug.h"
#include "multiboot.h"
int efi_boot; /* booted from EFI firmware */
extern int bios_free; /* firmware is not bios */
extern void install_memlistptrs();
struct pseudoprop {
char *pp_name;
void (*pp_func)();
} pp_list[] = {
{ "memory_update", install_memlistptrs },
};
struct bootprop {
char *bp_name;
void *bp_val;
int bp_len;
};
static int find_pseudo(char *);
static struct bootprop *alloc_prop(char *);
static void set_propval(struct bootprop *, void *, int);
static void setup_rarp_props(struct sol_netinfo *);
/*
* Return the length of the "name"d property's value.
*/
/*ARGSUSED*/
int
{
}
/*ARGSUSED*/
int
{
return (BOOT_SUCCESS);
if (!bp)
return (BOOT_FAILURE);
/* Found the property in question; return its value */
return (BOOT_SUCCESS);
}
/*ARGSUSED*/
char *
{
return (NULL);
}
/*ARGSUSED*/
int
{
return (BOOT_SUCCESS);
}
int
find_pseudo(char *name)
{
return (BOOT_SUCCESS);
}
pp++;
}
return (BOOT_FAILURE);
}
struct bootprop *
{
return (bp);
while (bp) {
break;
}
return (bp);
}
static struct bootprop *
alloc_prop(char *name)
{
return (bp);
}
static void
{
}
void
setup_bootprop(void)
{
extern char *bootprog;
int stdout_val = 0; /* for a dummy property */
if (verbosemode)
printf("setup boot properties.\n");
val = "true";
if (*val == ',') {
val = "";
} else {
}
} else {
/* look for closing single or double quote */
++cp;
printf("missing %c in property %s.\n",
} else {
*cp++ = '\0';
if (*cp == ',')
cp++;
else if (*cp != '\0') {
printf("syntax error in GRUB -B option:"
" ignore %s\n", cp);
}
}
val++;
}
}
sizeof (ramdisk_start));
sizeof (ramdisk_end));
/* a bunch of fixed properties */
/* dummy properties needed by Install miniroot */
}
void
setup_bootdev_props(void)
{
extern multiboot_info_t *mbi;
int netboot = 0;
if (verbosemode)
printf("setup boot device properties.\n");
/* If booted from EFI, setup acpi-root-tab and efi-systab */
if (efi_boot) {
(char *)&mbi->acpi_root_tab,
sizeof (mbi->acpi_root_tab));
sizeof (mbi->efi_systab));
}
if (bios_free) {
return;
}
/* figure out the boot device */
char str[3];
if (boot_device == MB_NETWORK_DRIVE)
netboot++;
} else { /* assume netboot? */
netboot++;
}
/*
* In the netboot case, drives_info is overloaded with
* the dhcp ack. This is not multiboot compliant and
* requires special pxegrub!
*/
if (!netboot)
return;
if (verbosemode)
printf("booting from network\n");
if (mbi->drives_length == 0) {
if (verbosemode) {
printf("no network info, "
"need a GRUB with Solaris enhancements\n");
}
} else {
struct sol_netinfo *sip =
switch (sip->sn_infotype) {
case SN_TYPE_BOOTP:
(void *)mbi->drives_addr,
mbi->drives_length);
break;
case SN_TYPE_RARP:
break;
default:
printf("invalid network info: type %d\n",
sip->sn_infotype);
break;
};
}
}
#define BUFLEN 64
static void
{
}
if (sip->sn_netmask != 0) {
}
printf("unsupported mac type %d, mac len %d\n",
return;
}
}