support.c revision 986fd29a0dc13f7608ef7f508f6e700bd7bc2720
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/promimpl.h>
#include <sys/prom_plat.h>
#include "cprboot.h"
extern int cpr_debug;
static int cpr_show_props = 0;
/*
* Read the config file and pass back the file path, filesystem
* device path.
*/
int
{
return (-1);
return (0);
}
/*
* Read the location of the state file from the root filesystem.
* Pass back to the caller the full device path of the filesystem
* and the filename relative to that fs.
*/
int
{
int fd;
int rc;
(void) cpr_fs_close(fd);
} else
rc = -1;
return (rc);
}
/*
* Open the "defaults" file in the root fs and read the values of the
* properties saved during the checkpoint. Restore the values to nvram.
*
* Note: an invalid magic number in the "defaults" file means that the
* state file is bad or obsolete so our caller should not proceed with
* the resume.
*/
int
cpr_reset_properties(void)
{
char *str, *default_path;
str = "cpr_reset_properties";
prom_printf("%s: unable to open %s\n",
str, default_path);
return (-1);
}
rc = 0;
rc = -1;
rc = -1;
}
(void) cpr_fs_close(fd);
if (rc)
return (rc);
node = prom_optionsnode();
return (-1);
}
/*
* reset nvram to the original property values
*/
if (cpr_show_props)
prom_printf("\n\ncpr_show_props:\n");
if (cpr_show_props) {
prom_printf("mod=%c, name=\"%s\",\tvalue=\"%s\"\n",
}
continue;
prom_printf("%s: error setting \"%s\" to \"%s\"\n",
prop_errors++;
}
}
return (prop_errors ? -1 : 0);
}
/*
* Read and verify cpr dump descriptor
*/
int
{
char *str;
int nread;
str = "\ncpr_read_cdump:";
return (-1);
}
prom_printf("%s bad dump magic 0x%x, expected 0x%x\n",
return (-1);
}
prom_printf("%s bad cpr version %d, expected %d\n",
return (-1);
}
prom_printf("%s bad machine type 0x%x, expected 0x%x\n",
return (-1);
}
if (cdp->cdd_bitmaprec <= 0) {
return (-1);
}
if (cdp->cdd_dumppgsize <= 0) {
return (-1);
}
return (0);
}
/*
* update cpr dump terminator
*/
void
{
/*
* Add the offset to reach the terminator in the kernel so that we
* can directly change the restored kernel image.
*/
}
/*
* simple bcopy for cprboot
*/
void
{
const char *src = s;
char *dst = d;
while (count--)
}