summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-09-19 20:18:04 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-09-19 20:18:04 +0000
commita4b32db7231f7683bfcc4785e97e680c02f32275 (patch)
tree55061748915de7f855fc2c95dbc9bde16f3a789d
parent2c29860f0efdf260bc7dc1092af442d39c40beb3 (diff)
Perform the mvme197 latency timer reprogramming in the boot blocks, in
addition to the kernel, and unconditionnaly handle all busswitch revision 1 based boards as horribly broken, even with 50MHz clocks. Based on an report of an early 50MHz 197LE board being unable to boot, due to memory corruption.
-rw-r--r--sys/arch/mvme88k/include/param.h6
-rw-r--r--sys/arch/mvme88k/mvme88k/m197_machdep.c20
-rw-r--r--sys/arch/mvme88k/stand/bootxx/Makefile4
-rw-r--r--sys/arch/mvme88k/stand/bootxx/bootxx.c7
-rw-r--r--sys/arch/mvme88k/stand/bootxx/version.c7
-rw-r--r--sys/arch/mvme88k/stand/libsa/Makefile9
-rw-r--r--sys/arch/mvme88k/stand/libsa/board.c60
-rw-r--r--sys/arch/mvme88k/stand/libsa/libsa.h5
-rw-r--r--sys/arch/mvme88k/stand/netboot/boot.c4
-rw-r--r--sys/arch/mvme88k/stand/netboot/version.c5
-rw-r--r--sys/arch/mvme88k/stand/tftpboot/boot.c4
-rw-r--r--sys/arch/mvme88k/stand/tftpboot/version.c5
12 files changed, 100 insertions, 36 deletions
diff --git a/sys/arch/mvme88k/include/param.h b/sys/arch/mvme88k/include/param.h
index 25cc5185756..bd2cac3cdaf 100644
--- a/sys/arch/mvme88k/include/param.h
+++ b/sys/arch/mvme88k/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.39 2008/01/13 20:18:54 miod Exp $ */
+/* $OpenBSD: param.h,v 1.40 2008/09/19 20:18:01 miod Exp $ */
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* Copyright (c) 1988 University of Utah.
@@ -53,7 +53,7 @@
#define KERNBASE 0x00000000 /* start of kernel virtual */
#define KERNTEXTOFF 0x00010000 /* start of kernel text */
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_STANDALONE)
#if !defined(_LOCORE)
extern int brdtyp;
#endif
@@ -66,5 +66,5 @@ extern int brdtyp;
#define BRD_197 0x197
#define BRD_8120 0x8120
-#endif /* _KERNEL */
+#endif /* _KERNEL || _STANDALONE */
#endif /* !_MACHINE_PARAM_H_ */
diff --git a/sys/arch/mvme88k/mvme88k/m197_machdep.c b/sys/arch/mvme88k/mvme88k/m197_machdep.c
index 12d0bd928bb..e7cf6b7d774 100644
--- a/sys/arch/mvme88k/mvme88k/m197_machdep.c
+++ b/sys/arch/mvme88k/mvme88k/m197_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m197_machdep.c,v 1.26 2007/12/27 23:20:31 miod Exp $ */
+/* $OpenBSD: m197_machdep.c,v 1.27 2008/09/19 20:18:03 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -329,9 +329,7 @@ m197_bootstrap()
extern struct cmmu_p cmmu88410;
extern int cpuspeed;
u_int16_t cpu;
-#ifndef MULTIPROCESSOR
- u_int8_t btimer, pbt;
-#endif
+ u_int8_t version, btimer, pbt;
if (mc88410_present()) {
cmmu = &cmmu88410; /* 197SP/197DP */
@@ -355,23 +353,28 @@ m197_bootstrap()
*/
cpuspeed = 256 - *(volatile u_int8_t *)(BS_BASE + BS_PADJUST);
-#ifndef MULTIPROCESSOR
/*
* Kernels running without snooping enabled (i.e. without
* CACHE_GLOBAL set in the apr in pmap.c) need increased processor
* bus timeout limits, or the instruction cache might not be able
- * to fill or answer fast enough.
+ * to fill or answer fast enough. It does not hurt to increase
+ * them unconditionnaly, though.
*
* Do this as soon as possible (i.e. now...), since this is
* especially critical on 40MHz boards, while some 50MHz boards can
* run without this timeout change... but better be safe than sorry.
+ *
+ * Boot blocks do this for us now, but again, better stay on the
+ * safe side. Be sure to update the boot blocks code if the logic
+ * below changes.
*/
+ version = *(volatile u_int8_t *)(BS_BASE + BS_CHIPREV);
btimer = *(volatile u_int8_t *)(BS_BASE + BS_BTIMER);
pbt = btimer & BS_BTIMER_PBT_MASK;
btimer = (btimer & ~BS_BTIMER_PBT_MASK);
- /* PBT256 only be necessary for busswitch rev1? */
- if (cpuspeed < 50) {
+ /* XXX PBT256 might only be necessary for busswitch rev1? */
+ if (cpuspeed < 50 || version <= 0x01) {
if (pbt < BS_BTIMER_PBT256)
pbt = BS_BTIMER_PBT256;
} else {
@@ -380,7 +383,6 @@ m197_bootstrap()
}
*(volatile u_int8_t *)(BS_BASE + BS_BTIMER) = btimer | pbt;
-#endif
md_interrupt_func_ptr = m197_ext_int;
md_getipl = m197_getipl;
diff --git a/sys/arch/mvme88k/stand/bootxx/Makefile b/sys/arch/mvme88k/stand/bootxx/Makefile
index b6b4f3e2be9..7537fd4569c 100644
--- a/sys/arch/mvme88k/stand/bootxx/Makefile
+++ b/sys/arch/mvme88k/stand/bootxx/Makefile
@@ -1,5 +1,5 @@
# from: @(#)Makefile 8.1 (Berkeley) 6/10/93
-# $OpenBSD: Makefile,v 1.12 2008/04/02 21:53:17 miod Exp $
+# $OpenBSD: Makefile,v 1.13 2008/09/19 20:18:03 miod Exp $
S= ${.CURDIR}/../../../..
DEFS=-DSTAGE2_RELOC=${STAGE2_RELOC}
@@ -13,7 +13,7 @@ CLEANFILES+=bootxx
.include "${S}/arch/mvme88k/stand/libsa/Makefile.inc"
.include "${S}/arch/mvme88k/stand/libz/Makefile.inc"
-SRCS= bootxx.c conf.c version.c
+SRCS= bootxx.c conf.c
LIBS= ${LIBSA} ${LIBBUG} ${LIBZ}
diff --git a/sys/arch/mvme88k/stand/bootxx/bootxx.c b/sys/arch/mvme88k/stand/bootxx/bootxx.c
index 1006efa0731..b18943c6e64 100644
--- a/sys/arch/mvme88k/stand/bootxx/bootxx.c
+++ b/sys/arch/mvme88k/stand/bootxx/bootxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bootxx.c,v 1.7 2008/04/02 21:53:17 miod Exp $ */
+/* $OpenBSD: bootxx.c,v 1.8 2008/09/19 20:18:03 miod Exp $ */
/*
* Copyright (c) 1994 Paul Kranenburg
@@ -65,8 +65,6 @@ size_t block_size = 512; /* default */
int block_count = MAXBLOCKNUM; /* length of table */
daddr_t block_table[MAXBLOCKNUM] = { 0 };
-extern char *version;
-
void bugexec(void (*)());
int copyboot(struct open_file *, char *);
@@ -77,7 +75,8 @@ main()
char *addr;
int error;
- printf("\nbootxx: first level bootstrap program [%s]\n", version);
+ board_setup();
+
#ifdef DEBUG
printf("boot device: ctrl=%d, dev=%d\n",
bugargs.ctrl_lun, bugargs.dev_lun);
diff --git a/sys/arch/mvme88k/stand/bootxx/version.c b/sys/arch/mvme88k/stand/bootxx/version.c
deleted file mode 100644
index 242d1e86a58..00000000000
--- a/sys/arch/mvme88k/stand/bootxx/version.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/* $OpenBSD: version.c,v 1.3 2008/04/02 21:53:17 miod Exp $ */
-
-/*
- * 1.3 rewritten crt code, self-relocatable
- * 1.2 rewritten startup code and general cleanup
- */
-char *version = "1.2";
diff --git a/sys/arch/mvme88k/stand/libsa/Makefile b/sys/arch/mvme88k/stand/libsa/Makefile
index dca00c437a3..6bcefbb145c 100644
--- a/sys/arch/mvme88k/stand/libsa/Makefile
+++ b/sys/arch/mvme88k/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.12 2008/04/02 21:53:18 miod Exp $
+# $OpenBSD: Makefile,v 1.13 2008/09/19 20:18:03 miod Exp $
LIB=sa
@@ -8,7 +8,7 @@ NOPROFILE=noprofile
# Logically src/sys
S=${.CURDIR}/../../../..
-SRCS= bugdev.c clock.c parse_args.c exec_mvme.c
+SRCS= board.c bugdev.c clock.c parse_args.c exec_mvme.c
.PATH: ${S}/lib/libsa
SRCS+= alloc.c memcpy.c exit.c getfile.c gets.c globals.c \
@@ -41,8 +41,9 @@ install:
.if !make(obj)
.BEGIN:
+ @([ -h dev ] || ln -s ${.CURDIR}/../../../${MACHINE}/dev dev)
@([ -h machine ] || ln -s ${.CURDIR}/../../../${MACHINE}/include machine)
@([ -h m88k ] || ln -s ${.CURDIR}/../../../m88k/include m88k)
-.NOPATH: machine m88k
-CLEANFILES+= machine m88k
+.NOPATH: dev machine m88k
+CLEANFILES+= dev machine m88k
.endif
diff --git a/sys/arch/mvme88k/stand/libsa/board.c b/sys/arch/mvme88k/stand/libsa/board.c
new file mode 100644
index 00000000000..d5033994492
--- /dev/null
+++ b/sys/arch/mvme88k/stand/libsa/board.c
@@ -0,0 +1,60 @@
+/* $OpenBSD: board.c,v 1.1 2008/09/19 20:18:03 miod Exp $ */
+
+/*
+ * Copyright (c) 2008 Miodrag Vallat.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/param.h>
+#include <machine/prom.h>
+
+#include "stand.h"
+#include "libsa.h"
+
+#include <dev/busswreg.h>
+
+void
+board_setup()
+{
+ int board;
+ u_int8_t cpuspeed, version, btimer, pbt;
+
+ board = mvmeprom_brdid()->model;
+
+ switch (board) {
+ case BRD_197:
+ /*
+ * The following is similar to what m197_bootstrap()
+ * in mvme88k/m197_machdep.c does.
+ * Please refer to the comments in there for details.
+ */
+ cpuspeed = 256 - *(volatile u_int8_t *)(BS_BASE + BS_PADJUST);
+ version = *(volatile u_int8_t *)(BS_BASE + BS_CHIPREV);
+ btimer = *(volatile u_int8_t *)(BS_BASE + BS_BTIMER);
+ pbt = btimer & BS_BTIMER_PBT_MASK;
+ btimer = (btimer & ~BS_BTIMER_PBT_MASK);
+
+ if (cpuspeed < 50 || version <= 0x01) {
+ if (pbt < BS_BTIMER_PBT256)
+ pbt = BS_BTIMER_PBT256;
+ } else {
+ if (pbt < BS_BTIMER_PBT64)
+ pbt = BS_BTIMER_PBT64;
+ }
+
+ *(volatile u_int8_t *)(BS_BASE + BS_BTIMER) = btimer | pbt;
+
+ break;
+ }
+}
diff --git a/sys/arch/mvme88k/stand/libsa/libsa.h b/sys/arch/mvme88k/stand/libsa/libsa.h
index e844d483870..97ceb024443 100644
--- a/sys/arch/mvme88k/stand/libsa/libsa.h
+++ b/sys/arch/mvme88k/stand/libsa/libsa.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: libsa.h,v 1.4 2006/05/16 22:52:26 miod Exp $ */
+/* $OpenBSD: libsa.h,v 1.5 2008/09/19 20:18:03 miod Exp $ */
/*
* libsa prototypes
@@ -6,6 +6,9 @@
#include "libbug.h"
+/* board.c */
+void board_setup();
+
/* bugdev.c */
int bugscopen(struct open_file *, ...);
int bugscclose(struct open_file *);
diff --git a/sys/arch/mvme88k/stand/netboot/boot.c b/sys/arch/mvme88k/stand/netboot/boot.c
index a9ac1e883c1..6682757dee8 100644
--- a/sys/arch/mvme88k/stand/netboot/boot.c
+++ b/sys/arch/mvme88k/stand/netboot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.8 2008/04/02 21:53:18 miod Exp $ */
+/* $OpenBSD: boot.c,v 1.9 2008/09/19 20:18:03 miod Exp $ */
/*-
* Copyright (c) 1995 Theo de Raadt
@@ -71,6 +71,8 @@ main()
char *cp, *file;
int ask = 0, howto, ret;
+ board_setup();
+
printf("\n>> OpenBSD/mvme88k netboot [%s]\n", version);
ret = parse_args(&file, &howto);
diff --git a/sys/arch/mvme88k/stand/netboot/version.c b/sys/arch/mvme88k/stand/netboot/version.c
index 80260dfc39b..a6063045052 100644
--- a/sys/arch/mvme88k/stand/netboot/version.c
+++ b/sys/arch/mvme88k/stand/netboot/version.c
@@ -1,8 +1,9 @@
-/* $OpenBSD: version.c,v 1.5 2008/04/02 21:53:18 miod Exp $ */
+/* $OpenBSD: version.c,v 1.6 2008/09/19 20:18:03 miod Exp $ */
/*
+ * 1.6 perform MVME197 busswitch initialization
* 1.5 rewritten crt code, self-relocatable
* 1.4 kernel loaded with loadfile, a.out and ELF formats
* 1.3 rewritten startup code and general cleanup
*/
-char *version = "1.5";
+char *version = "1.6";
diff --git a/sys/arch/mvme88k/stand/tftpboot/boot.c b/sys/arch/mvme88k/stand/tftpboot/boot.c
index 7d39954221a..fdfdd717b2e 100644
--- a/sys/arch/mvme88k/stand/tftpboot/boot.c
+++ b/sys/arch/mvme88k/stand/tftpboot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.3 2008/04/02 21:53:18 miod Exp $ */
+/* $OpenBSD: boot.c,v 1.4 2008/09/19 20:18:03 miod Exp $ */
/* $NetBSD: boot.c,v 1.2 1995/09/23 03:42:52 gwr Exp $ */
/*-
@@ -50,6 +50,8 @@ main()
int flag, ret;
int ask = 0;
+ board_setup();
+
printf("\n>> OpenBSD/mvme88k tftpboot [%s]\n", version);
ret = parse_args(&file, &flag);
diff --git a/sys/arch/mvme88k/stand/tftpboot/version.c b/sys/arch/mvme88k/stand/tftpboot/version.c
index 0bb6fffb0b5..719513615c6 100644
--- a/sys/arch/mvme88k/stand/tftpboot/version.c
+++ b/sys/arch/mvme88k/stand/tftpboot/version.c
@@ -1,9 +1,10 @@
-/* $OpenBSD: version.c,v 1.4 2008/04/02 21:53:18 miod Exp $ */
+/* $OpenBSD: version.c,v 1.5 2008/09/19 20:18:03 miod Exp $ */
/*
+ * 1.5 perform MVME197 busswitch initialization
* 1.4 rewritten crt code, self-relocatable
* 1.3 kernel loaded with loadfile, a.out and ELF formats
* 1.2 rewritten startup code and general cleanup
* 1.1 initial revision
*/
-char *version = "1.4";
+char *version = "1.5";