char bootdevice[BOOTDEVSZ];
char bootoncelabel[1024];
char bootargs[1024];
+char bootlastlabel[BOOTLASTSZ] = {0};
+char fw_nbr_reboots[FW_NBR_REBOOTSZ] = {0};
+long fw_reboot_cnt = 0;
char *password = NULL;
struct boot_fspec_t boot;
int _machine = _MACH_Pmac;
{
int result;
void* malloc_base = NULL;
+ unsigned long addr;
prom_handle root;
/* OF seems to do it, but I'm not very confident */
prom_init ((prom_entry) r5);
/* Allocate some memory for malloc'ator */
- malloc_base = prom_claim((void *)MALLOCADDR, MALLOCSIZE, 0);
+ for (addr = MALLOCADDR; addr <= MALLOCADDR * 16 ;addr+=0x100000) {
+ malloc_base = prom_claim((void *)addr, MALLOCSIZE, 0);
+ if (malloc_base != (void *)-1) break;
+ }
if (malloc_base == (void *)-1) {
prom_printf("Can't claim malloc buffer (%d bytes at 0x%08x)\n",
MALLOCSIZE, MALLOCADDR);
root = prom_finddevice("/");
if (root != 0) {
static char model[256];
- if (prom_getprop(root, "device_type", model, 256 ) > 0 &&
+ if (prom_getprop(root, "CODEGEN,vendor", model, 256) > 0 &&
+ !strncmp("bplan", model, 5))
+ _machine = _MACH_bplan;
+ else if (prom_getprop(root, "device_type", model, 256 ) > 0 &&
!strncmp("chrp", model, 4))
_machine = _MACH_chrp;
else {
struct bootp_packet *packet;
int rc = 0;
struct boot_fspec_t fspec = *orig_fspec;
- char *cfgpath = (_machine == _MACH_chrp) ? "/etc/" : "";
+ char *cfgpath = (_machine == _MACH_chrp || _machine == _MACH_bplan) ? "/etc/" : "";
int flen;
int minlen;
cmdinit();
- if (first) {
+ if (first && !fw_reboot_cnt) {
first = 0;
imagename = bootargs;
word_split(&imagename, ¶ms->args);
timeout = simple_strtol(q, NULL, 0);
}
+ /* If this is a reboot due to FW detecting CAS changes then
+ * set timeout to 1. The last kernel booted will be booted
+ * again automatically. It should seem seamless to the user
+ */
+ if (fw_reboot_cnt)
+ timeout = 1;
+
prom_printf("boot: ");
c = -1;
if (timeout != -1) {
if (!imagename) {
if (bootoncelabel[0] != 0)
imagename = bootoncelabel;
- else
+ else if (bootlastlabel[0] != 0)
+ imagename = bootlastlabel;
+ else
imagename = cfg_get_default();
}
if (imagename)
if ( useconf && (!imagename || imagename[0] == 0 ))
imagename = cfg_get_default();
+ /* write the imagename out so it can be reused on reboot if necessary */
+ prom_set_options("boot-last-label", imagename, strlen(imagename));
+
label = 0;
defdevice = boot.dev;
e->e_ident[EI_MAG3] == ELFMAG3 &&
e->e_ident[EI_CLASS] == ELFCLASS64 &&
e->e_ident[EI_DATA] == ELFDATA2MSB &&
- e->e_type == ET_EXEC &&
+ (e->e_type == ET_EXEC || e->e_type == ET_DYN) &&
e->e_machine == EM_PPC64);
}
yaboot_main(void)
{
char *ptype;
+ char *endp;
int conf_given = 0;
char conf_path[1024];
DEBUG_F("/chosen/bootargs = %s\n", bootargs);
prom_get_chosen("bootpath", bootdevice, BOOTDEVSZ);
DEBUG_F("/chosen/bootpath = %s\n", bootdevice);
+ if (prom_get_options("ibm,client-architecture-support-reboot",fw_nbr_reboots, FW_NBR_REBOOTSZ) == -1 )
+ prom_get_options("ibm,fw-nbr-reboots",fw_nbr_reboots, FW_NBR_REBOOTSZ);
+ fw_reboot_cnt = simple_strtol(fw_nbr_reboots,&endp,10);
+ if (fw_reboot_cnt > 0L)
+ prom_get_options("boot-last-label", bootlastlabel, BOOTLASTSZ);
/* If conf= specified on command line, it overrides
Usage: conf=device:partition,/path/to/conffile
prom_printf("%s: Unable to parse\n", bootdevice);
return -1;
}
+ if (_machine == _MACH_bplan && !conf_given)
+ boot.part++;
DEBUG_F("After parse_device_path: dev=%s, part=%d, file=%s\n",
boot.dev, boot.part, boot.file);
if (!conf_given) {
- if (_machine == _MACH_chrp)
+ if (_machine == _MACH_chrp || _machine == _MACH_bplan)
boot.file = "/etc/";
else if (strlen(boot.file)) {
if (!strncmp(boot.file, "\\\\", 2))