Module Name: src
Committed By: martin
Date: Tue May 13 05:30:38 UTC 2014
Modified Files:
src/sys/dev/sbus: tcx.c
Log Message:
Do not attach if the STIP register is way too small (this happens in qemu
due to buggy emulation and causes crashes).
To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/sbus/tcx.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/sbus/tcx.c
diff -u src/sys/dev/sbus/tcx.c:1.47 src/sys/dev/sbus/tcx.c:1.48
--- src/sys/dev/sbus/tcx.c:1.47 Fri May 9 11:51:49 2014
+++ src/sys/dev/sbus/tcx.c Tue May 13 05:30:38 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: tcx.c,v 1.47 2014/05/09 11:51:49 jdc Exp $ */
+/* $NetBSD: tcx.c,v 1.48 2014/05/13 05:30:38 martin Exp $ */
/*
* Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcx.c,v 1.47 2014/05/09 11:51:49 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcx.c,v 1.48 2014/05/13 05:30:38 martin Exp $");
/*
* define for cg8 emulation on S24 (24-bit version of tcx) for the SS5;
@@ -273,9 +273,6 @@ tcxattach(device_t parent, device_t self
if (sc->sc_8bit) {
printf(" (8-bit only TCX)\n");
ramsize = 1024 * 1024;
- /* XXX - fix THC and TEC offsets */
- sc->sc_physaddr[TCX_REG_TEC].oa_base += 0x1000;
- sc->sc_physaddr[TCX_REG_THC].oa_base += 0x1000;
} else {
printf(" (S24)\n");
ramsize = 4 * 1024 * 1024;
@@ -289,12 +286,19 @@ tcxattach(device_t parent, device_t self
fb->fb_type.fb_type = FBTYPE_TCXCOLOR;
-
if (sa->sa_nreg != TCX_NREG) {
- printf("%s: only %d register sets\n",
- device_xname(self), sa->sa_nreg);
+ aprint_error("\n");
+ aprint_error_dev(self, "only %d register sets\n",
+ sa->sa_nreg);
+ return;
+ }
+ if (sa->sa_reg[TCX_REG_STIP].oa_size < 0x1000) {
+ aprint_error("\n");
+ aprint_error_dev(self, "STIP register too small (0x%x)\n",
+ sa->sa_reg[TCX_REG_STIP].oa_size);
return;
}
+
memcpy(sc->sc_physaddr, sa->sa_reg,
sa->sa_nreg * sizeof(struct openprom_addr));