-/* $OpenBSD: autoconf.c,v 1.27 2022/09/23 02:35:46 aoyama Exp $ */
+/* $OpenBSD: autoconf.c,v 1.28 2022/10/14 20:53:18 aoyama Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
void get_autoboot_device(void);
int cold = 1; /* 1 if still booting */
+dev_t bootdev; /* set by bootloader, retrieved in locore0.S */
struct device *bootdv; /* set by device drivers (if found) */
/*
int i, len, part;
extern char *nvram_by_symbol(char *); /* machdep.c */
+ if ((bootdev & B_MAGICMASK) == B_DEVMAGIC) {
+#ifdef DEBUG
+ printf("bootdev = 0x%08x (t:%d, a:%d, c:%d, u:%d, p:%d)\n",
+ bootdev, B_TYPE(bootdev), B_ADAPTOR(bootdev),
+ B_CONTROLLER(bootdev), B_UNIT(bootdev),
+ B_PARTITION(bootdev));
+#endif
+ switch (B_TYPE(bootdev)) {
+ case 0:
+ snprintf(autoboot.cont, sizeof(autoboot.cont),
+ "spc%d", B_CONTROLLER(bootdev));
+ break;
+#if 0 /* not yet */
+ case 1:
+ snprintf(autoboot.cont, sizeof(autoboot.cont),
+ "le%d", B_CONTROLLER(bootdev));
+ break;
+#endif
+ default:
+ goto use_nvram_info;
+ }
+ autoboot.targ = B_UNIT(bootdev);
+ autoboot.part = B_PARTITION(bootdev);
+ return;
+ }
+
+use_nvram_info:
+ /*
+ * Use old method if we can not get bootdev information from boot loader
+ */
+ printf("%s: no bootdev information, use NVRAM setting\n", __func__);
+
/* Assume default controller is internal spc (spc0) */
strlcpy(autoboot.cont, "spc0", sizeof(autoboot.cont));
-/* $OpenBSD: locore0.S,v 1.4 2022/08/08 11:27:18 aoyama Exp $ */
+/* $OpenBSD: locore0.S,v 1.5 2022/10/14 20:53:18 aoyama Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
cmp %r11, %r2, %r10
bb1 ne, %r11, 1f
- or.u %r4, %r0, %hi16(_C_LABEL(esym))
- st %r3, %r4, %lo16(_C_LABEL(esym))
+ or.u %r10, %r0, %hi16(_C_LABEL(esym))
+ st %r3, %r10, %lo16(_C_LABEL(esym))
1:
#endif
+ or %r24, %r0, %r4 /* save bootdev */
+ or %r25, %r0, %r5 /* save boothowto */
bsr _ASM_LABEL(setup_psr)
or.u %r5, %r0, %hi16(_C_LABEL(first_addr))
st %r4, %r5, %lo16(_C_LABEL(first_addr))
+ or.u %r5, %r0, %hi16(_C_LABEL(bootdev))
+ st %r24, %r5, %lo16(_C_LABEL(bootdev))
+ or.u %r5, %r0, %hi16(_C_LABEL(boothowto))
+ st %r25, %r5, %lo16(_C_LABEL(boothowto))
+
/*
* Have curcpu() point to a valid cpuinfo structure,
* and initialize cr17.
-/* $OpenBSD: machdep.c,v 1.138 2022/08/10 03:18:19 jsg Exp $ */
+/* $OpenBSD: machdep.c,v 1.139 2022/10/14 20:53:18 aoyama Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
int machtype = LUNA_88K; /* may be overwritten in cpu_startup() */
int cputyp = CPU_88100;
-int bootdev; /* XXX: should be set in boot loader and locore.S */
int cpuspeed = 33; /* safe guess */
int sysconsole = 0; /* 0 = ttya, may be overwritten in locore0.S */
u_int16_t dipswitch = 0; /* set in locore.S */
-/* $OpenBSD: boot.c,v 1.10 2020/05/26 13:47:29 deraadt Exp $ */
+/* $OpenBSD: boot.c,v 1.11 2022/10/14 20:53:18 aoyama Exp $ */
/* $NetBSD: boot.c,v 1.3 2013/03/05 15:34:53 tsutsui Exp $ */
/*
static int get_boot_device(const char *, int *, int *, int *);
#endif
-void (*cpu_boot)(uint32_t, uint32_t);
+void (*cpu_boot)(uint32_t, uint32_t, uint32_t, uint32_t);
uint32_t cpu_bootarg1;
uint32_t cpu_bootarg2;
+uint32_t cpu_bootarg3;
+uint32_t cpu_bootarg4;
char rnddata[BOOTRANDOM_MAX];
struct rc4_ctx randomctx;
cpu_bootarg1 = BOOT_MAGIC;
cpu_bootarg2 = (uint32_t)marks[MARK_END];
- cpu_boot = (void (*)(uint32_t, uint32_t))
+ /* cpu_bootarg3 is set in devopen() */
+ cpu_bootarg4 = RB_AUTOBOOT;
+#ifdef DEBUG
+ printf("bootarg: 0x%08x, 0x%08x, 0x%08x, 0x%08x\n",
+ cpu_bootarg1, cpu_bootarg2, cpu_bootarg3, cpu_bootarg4);
+#endif
+ cpu_boot = (void (*)(uint32_t, uint32_t, uint32_t, uint32_t))
(uint32_t)marks[MARK_ENTRY];
- (*cpu_boot)(cpu_bootarg1, cpu_bootarg2);
+ (*cpu_boot)(cpu_bootarg1, cpu_bootarg2, cpu_bootarg3,
+ cpu_bootarg4);
}
printf("Booting kernel failed. (%s)\n", strerror(errno));
-/* $OpenBSD: devopen.c,v 1.2 2013/10/29 21:49:07 miod Exp $ */
+/* $OpenBSD: devopen.c,v 1.3 2022/10/14 20:53:18 aoyama Exp $ */
/* $NetBSD: devopen.c,v 1.3 2013/01/16 15:46:20 tsutsui Exp $ */
/*
* @(#)conf.c 8.1 (Berkeley) 6/10/93
*/
+#include <sys/reboot.h>
#include <lib/libkern/libkern.h>
#include <luna88k/stand/boot/samachdep.h>
#include <machine/disklabel.h>
f->f_dev = dp;
+ /* Save boot device information to pass to the kernel */
+ cpu_bootarg3 = MAKEBOOTDEV(dev, 0, unit / 10, 6 - unit % 10, part);
+
return 0;
}
-/* $OpenBSD: init_main.c,v 1.8 2019/04/09 14:21:32 aoyama Exp $ */
+/* $OpenBSD: init_main.c,v 1.9 2022/10/14 20:53:19 aoyama Exp $ */
/* $NetBSD: init_main.c,v 1.6 2013/03/05 15:34:53 tsutsui Exp $ */
/*
nplane = get_plane_numbers();
cninit();
- printf("\nOpenBSD/" MACHINE " (%s) boot 0.6\n\n", machstr);
+ printf("\nOpenBSD/" MACHINE " (%s) boot 0.7\n\n", machstr);
#ifdef SUPPORT_ETHERNET
try_bootp = 1;
-/* $OpenBSD: locore.S,v 1.2 2013/10/29 21:49:07 miod Exp $ */
+/* $OpenBSD: locore.S,v 1.3 2022/10/14 20:53:19 aoyama Exp $ */
/*
* Copyright (c) 2013 Miodrag Vallat.
ld %r2, %r2, %lo16(_C_LABEL(cpu_bootarg1))
or.u %r3, %r0, %hi16(_C_LABEL(cpu_bootarg2))
ld %r3, %r3, %lo16(_C_LABEL(cpu_bootarg2))
+ or.u %r4, %r0, %hi16(_C_LABEL(cpu_bootarg3))
+ ld %r4, %r4, %lo16(_C_LABEL(cpu_bootarg3))
+ or.u %r5, %r0, %hi16(_C_LABEL(cpu_bootarg4))
+ ld %r5, %r5, %lo16(_C_LABEL(cpu_bootarg4))
jmp %r1
-/* $OpenBSD: samachdep.h,v 1.4 2020/12/09 18:10:19 krw Exp $ */
+/* $OpenBSD: samachdep.h,v 1.5 2022/10/14 20:53:19 aoyama Exp $ */
/* $NetBSD: samachdep.h,v 1.10 2013/03/05 15:34:53 tsutsui Exp $ */
/*
int boot(int, char **);
int bootunix(char *);
-extern void (*cpu_boot)(uint32_t, uint32_t);
+extern void (*cpu_boot)(uint32_t, uint32_t, uint32_t, uint32_t);
extern uint32_t cpu_bootarg1;
extern uint32_t cpu_bootarg2;
+extern uint32_t cpu_bootarg3;
+extern uint32_t cpu_bootarg4;
#define BOOT_MAGIC 0xf1abde3f
/* cons.c */