summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2012-09-29 21:40:49 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2012-09-29 21:40:49 +0000
commit4a917bbf8d1d4bac5b4544a9e19a9e5a6538f77d (patch)
tree14e57f0b20fa69346a850bb6c3fe042763078b9e /sys/arch
parentfd56e2091709076ec2d752824abd0559b6c53f07 (diff)
Bring the `let decide ARCBios address at runtime' code to the SGI bootblocks,
which allows them to run on IP26 (POWER Indigo2 R8000). Crank boot blocks version.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sgi/stand/boot/arcbios.c56
-rw-r--r--sys/arch/sgi/stand/boot/boot.c9
-rw-r--r--sys/arch/sgi/stand/boot/start.S4
-rw-r--r--sys/arch/sgi/stand/boot/version7
4 files changed, 61 insertions, 15 deletions
diff --git a/sys/arch/sgi/stand/boot/arcbios.c b/sys/arch/sgi/stand/boot/arcbios.c
index 5ca93270e03..7afb71ed194 100644
--- a/sys/arch/sgi/stand/boot/arcbios.c
+++ b/sys/arch/sgi/stand/boot/arcbios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arcbios.c,v 1.17 2012/05/25 11:31:04 miod Exp $ */
+/* $OpenBSD: arcbios.c,v 1.18 2012/09/29 21:40:48 miod Exp $ */
/*-
* Copyright (c) 1996 M. Warner Losh. All rights reserved.
* Copyright (c) 1996-2004 Opsycon AB. All rights reserved.
@@ -37,8 +37,8 @@
#include <stand.h>
int bios_is_32bit;
+void *bios_base;
-u_int kl_n_shift = 32;
int arcbios_init(void);
const char *boot_get_path_component(const char *, char *, int *);
const char *boot_getnr(const char *, int *);
@@ -68,49 +68,63 @@ __asm__("\n" \
" .set noreorder\n" \
" .globl " #Name "\n" \
#Name":\n" \
-" lw $2, bios_is_32bit\n"\
-" beqz $2, 1f\n" \
+" lw $3, bios_is_32bit\n"\
+" ld $2, bios_base\n"\
+" beqz $3, 1f\n" \
" nop\n" \
-" lw $2, 0xffffffff80001020\n"\
-" lw $2," #Offset "($2)\n"\
+" lw $3, 0x20($2)\n" \
+" lw $2," #Offset "($3)\n"\
" jr $2\n" \
" nop\n" \
"1:\n" \
-" ld $2, 0xffffffff80001040\n"\
-" ld $2, 2*" #Offset "($2)\n"\
+" ld $3, 2*0x20($2)\n"\
+" ld $2, 2*" #Offset "($3)\n"\
" jr $2\n" \
" nop\n" \
" .end " #Name "\n" );
+#if 0
ARC_Call(Bios_Load, 0x00);
ARC_Call(Bios_Invoke, 0x04);
ARC_Call(Bios_Execute, 0x08);
+#endif
ARC_Call(Bios_Halt, 0x0c);
+#if 0
ARC_Call(Bios_PowerDown, 0x10);
ARC_Call(Bios_Restart, 0x14);
ARC_Call(Bios_Reboot, 0x18);
+#endif
ARC_Call(Bios_EnterInteractiveMode, 0x1c);
+#if 0
ARC_Call(Bios_Unused1, 0x20);
+#endif
ARC_Call(Bios_GetPeer, 0x24);
ARC_Call(Bios_GetChild, 0x28);
+#if 0
ARC_Call(Bios_GetParent, 0x2c);
ARC_Call(Bios_GetConfigurationData, 0x30);
ARC_Call(Bios_AddChild, 0x34);
ARC_Call(Bios_DeleteComponent, 0x38);
ARC_Call(Bios_GetComponent, 0x3c);
ARC_Call(Bios_SaveConfiguration, 0x40);
+#endif
ARC_Call(Bios_GetSystemId, 0x44);
ARC_Call(Bios_GetMemoryDescriptor, 0x48);
+#if 0
ARC_Call(Bios_Unused2, 0x4c);
ARC_Call(Bios_GetTime, 0x50);
ARC_Call(Bios_GetRelativeTime, 0x54);
ARC_Call(Bios_GetDirectoryEntry, 0x58);
+#endif
ARC_Call(Bios_Open, 0x5c);
ARC_Call(Bios_Close, 0x60);
ARC_Call(Bios_Read, 0x64);
+#if 0
ARC_Call(Bios_GetReadStatus, 0x68);
+#endif
ARC_Call(Bios_Write, 0x6c);
ARC_Call(Bios_Seek, 0x70);
+#if 0
ARC_Call(Bios_Mount, 0x74);
ARC_Call(Bios_GetEnvironmentVariable, 0x78);
ARC_Call(Bios_SetEnvironmentVariable, 0x7c);
@@ -119,11 +133,13 @@ ARC_Call(Bios_SetFileInformation, 0x84);
ARC_Call(Bios_FlushAllCaches, 0x88);
ARC_Call(Bios_TestUnicodeCharacter, 0x8c);
ARC_Call(Bios_GetDisplayStatus, 0x90);
+#endif
/*
* Simple getchar/putchar interface.
*/
+#if 0
int
getchar()
{
@@ -135,6 +151,7 @@ getchar()
return (buf[0] & 255);
}
+#endif
void
putchar(int c)
@@ -162,11 +179,34 @@ arcbios_init()
{
arc_config_t *cf;
arc_sid_t *sid;
+#ifdef __LP64__
+ register_t prid;
+#endif
char *sysid = NULL;
int sysid_len;
int i;
/*
+ * Figure out where ARCBios can be addressed. On R8000, we can not
+ * use compatibility space, but on IP27/IP35, we can not blindly
+ * use XKPHYS due to subspacing, while compatibility space works.
+ * Fortunately we can get the processor ID to tell these apart, even
+ * though 32-bit coprocessor 0 instructions are not supposed to be
+ * supported on the R8000 (they probably misbehave somehow if the
+ * register has bits sets in the upper 32 bits, which is not the
+ * case of the R8000 PrId register).
+ */
+#ifdef __LP64__
+ __asm__ __volatile__ ("mfc0 %0, $15" /* COP_0_PRID */ : "=r" (prid));
+ if ((prid & 0xff00) == (MIPS_R8000 << 8))
+ bios_base = (void *)PHYS_TO_XKPHYS(ARCBIOS_BASE, CCA_CACHED);
+ else
+ bios_base = (void *)PHYS_TO_CKSEG0(ARCBIOS_BASE);
+#else
+ bios_base = (void *)(int32_t)PHYS_TO_CKSEG0(ARCBIOS_BASE);
+#endif
+
+ /*
* Figure out if this is an ARCBios machine and if it is, see if we're
* dealing with a 32 or 64 bit version.
*/
diff --git a/sys/arch/sgi/stand/boot/boot.c b/sys/arch/sgi/stand/boot/boot.c
index 5325a6e72cd..e63816f9e72 100644
--- a/sys/arch/sgi/stand/boot/boot.c
+++ b/sys/arch/sgi/stand/boot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.21 2012/05/25 11:31:04 miod Exp $ */
+/* $OpenBSD: boot.c,v 1.22 2012/09/29 21:40:48 miod Exp $ */
/*
* Copyright (c) 2004 Opsycon AB, www.opsycon.se.
@@ -59,8 +59,8 @@ int IP;
/*
* OpenBSD/sgi Boot Loader.
*/
-int
-main(int argc, char *argv[])
+void
+boot_main(int argc, char *argv[])
{
u_long marks[MARK_MAX];
u_int64_t *esym;
@@ -230,6 +230,9 @@ check_phdr(void *v)
case 22:
addr = 0xffffffff88000000ULL >> 24;
break;
+ case 26:
+ addr = 0xa800000008000000ULL >> 24;
+ break;
case 27:
addr = 0xa800000000000000ULL >> 24;
break;
diff --git a/sys/arch/sgi/stand/boot/start.S b/sys/arch/sgi/stand/boot/start.S
index 01498b7edca..31c64793f9f 100644
--- a/sys/arch/sgi/stand/boot/start.S
+++ b/sys/arch/sgi/stand/boot/start.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: start.S,v 1.3 2009/05/14 18:57:43 miod Exp $ */
+/* $OpenBSD: start.S,v 1.4 2012/09/29 21:40:48 miod Exp $ */
/*
* Copyright (c) 2001 Opsycon AB (www.opsycon.se)
@@ -48,7 +48,7 @@ __start:
LA gp, _gp
#endif
- jal main
+ jal boot_main
1:
b 1b
diff --git a/sys/arch/sgi/stand/boot/version b/sys/arch/sgi/stand/boot/version
index a5ea550740d..deaebe73282 100644
--- a/sys/arch/sgi/stand/boot/version
+++ b/sys/arch/sgi/stand/boot/version
@@ -1,4 +1,4 @@
-/* $OpenBSD: version,v 1.2 2012/05/25 11:31:04 miod Exp $ */
+/* $OpenBSD: version,v 1.3 2012/09/29 21:40:48 miod Exp $ */
/* Public domain. Come on, it can hardly be considered as code. */
#if 0
@@ -19,6 +19,9 @@ No version strings up to 2012
IP28 support. Also, no longer refuse to run on IP26 systems, they
will hopefully run at some point in the future.
+1.3
+ IP26 support, for real.
+
#endif
-static const char version[] = "1.2";
+static const char version[] = "1.3";