boot_plat.c revision ae115bc77f6fcde83175c75b4206dc2e50747966
/*
* 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 "console.h"
#include "util.h"
#include "bootprop.h"
#include "biosint.h"
#include "debug.h"
char filename[MAXPATHLEN];
char *impl_arch_name = "i86pc";
int pagesize = 0x1000;
/*
* Open the given filename, expanding to its
* platform-dependent location if necessary.
*/
int
{
int fd;
/*
* If the caller -specifies- an absolute pathname, then we just try to
* open it.
*/
if (*fname == '/') {
}
if (kern)
return (fd);
/* try / */
if (kern)
}
/*
* Is path "/platform/"dir"/" ?
*/
static int
{
static char prefix[] = "/platform/";
static char suffix[] = "/kernel";
int len;
return (0);
return (0);
return (0);
return (1);
}
void
{
/*
* If we found the kernel in the default "i86pc" dir, prepend the
* unless ia_name is the same as the default dir.
*
* If we found the kernel in the ia_name dir, append the default
* directory to the modpath.
*
* If neither of the above are true, we were given a specific kernel
* to boot, so we leave things well enough alone.
*/
char tmp[MAXPATHLEN];
}
}
void
setup_aux(void)
{
extern char *mmulist;
static char mmubuf[16];
int plen;
else
}
/* Print panic string, then blow up! */
/*PRINTFLIKE1*/
void
{
extern int efi_boot;
/* turn on output */
verbosemode = 1;
printf("panic: ");
printf("Press any key to reboot\n");
(void) getchar();
printf("rebooting...\n");
if (efi_boot)
efi_reset();
reset();
}
void
prom_panic(char *str)
{
}
/*
* stubs for heap_kmem (assuming they're actually even needed there)
*/
int
splimp()
{
return (0);
}
/*ARGSUSED*/
void
{
}
int
splnet()
{
return (0);
}
static uint_t
gettime(void)
{
/*
* Read system timer:
*
* Return milliseconds since last time counter was reset.
* The timer ticks 18.2 times per second or approximately
* 55 milliseconds per tick.
*
* The counter will be reset to zero by the bios after 24 hours
* or 1,573,040 ticks. The first read after a counter
* reset will flag this condition in the %al register.
* Unfortunately, it is hard to take advantage of this
* fact because some broken bioses will return bogus
* counter values if the counter is in the process of
* updating. We protect against this race by reading the
* counter until we get consecutive identical readings.
* By doing so, we lose the counter reset bit. To make this
* highly unlikely, we reset the counter to zero on the
* first call and assume 24 hours is enough time to get this
* machine booted.
*
* An attempt is made to provide a unique number on each
* call by adding 1 millisecond if the 55 millisecond counter
* hasn't changed. If this happens more than 54 times, we
* return the same value until the next real tick.
*/
if (lasttime == 0) {
/*
* initialize counter to zero so we don't have to
* worry about 24 hour wrap.
*/
}
tries = 0;
do {
/*
* Loop until we trust the counter value.
*/
if (tries == 10)
printf("gettime: BAD BIOS TIMER\n");
fudge = 0;
} else {
}
return (mills);
}
void
{
/* spin, we can't do anything else */
;
}