svn commit: r230632 - in head/sys/sparc64: include sparc64

Marius Strobl marius at FreeBSD.org
Fri Jan 27 22:35:54 UTC 2012


Author: marius
Date: Fri Jan 27 22:35:53 2012
New Revision: 230632
URL: http://svn.freebsd.org/changeset/base/230632

Log:
  - Now that we have a working OF_printf() since r230631, use it for
    implementing a simple OF_panic() that may be used during the early
    cycles when panic() isn't available, yet.
  - Mark cpu_{exit,shutdown}() as __dead2 as appropriate.

Modified:
  head/sys/sparc64/include/ofw_machdep.h
  head/sys/sparc64/sparc64/ofw_machdep.c

Modified: head/sys/sparc64/include/ofw_machdep.h
==============================================================================
--- head/sys/sparc64/include/ofw_machdep.h	Fri Jan 27 22:29:29 2012	(r230631)
+++ head/sys/sparc64/include/ofw_machdep.h	Fri Jan 27 22:35:53 2012	(r230632)
@@ -37,8 +37,9 @@ typedef uint64_t cell_t;
 int  OF_decode_addr(phandle_t, int, int *, bus_addr_t *);
 void OF_getetheraddr(device_t, u_char *);
 u_int OF_getscsinitid(device_t);
-void cpu_shutdown(void *);
+void OF_panic(const char *fmt, ...) __dead2 __printflike(1, 2);
+void cpu_shutdown(void *) __dead2;
 int  ofw_entry(void *);
-void ofw_exit(void *);
+void ofw_exit(void *) __dead2;
 
 #endif /* _MACHINE_OFW_MACHDEP_H_ */

Modified: head/sys/sparc64/sparc64/ofw_machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/ofw_machdep.c	Fri Jan 27 22:29:29 2012	(r230631)
+++ head/sys/sparc64/sparc64/ofw_machdep.c	Fri Jan 27 22:35:53 2012	(r230632)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/bus.h>
 #include <machine/idprom.h>
 #include <machine/ofw_machdep.h>
+#include <machine/stdarg.h>
 
 void
 OF_getetheraddr(device_t dev, u_char *addr)
@@ -81,6 +82,19 @@ OF_getscsinitid(device_t dev)
 	return (7);
 }
 
+void
+OF_panic(const char *fmt, ...)
+{
+	char buf[256];
+	va_list ap;
+
+	va_start(ap, fmt);
+	(void)vsnprintf(buf, sizeof(buf), fmt, ap);
+	OF_printf("OF_panic: %s\n", buf);
+	va_end(ap);
+	OF_exit();
+}
+
 static __inline uint32_t
 phys_hi_mask_space(const char *bus, uint32_t phys_hi)
 {


More information about the svn-src-head mailing list