[OpenBIOS] r330 - openbios-devel/drivers
svn at openbios.org
svn at openbios.org
Sun Dec 28 17:35:39 CET 2008
Author: blueswirl
Date: 2008-12-28 17:35:39 +0100 (Sun, 28 Dec 2008)
New Revision: 330
Modified:
openbios-devel/drivers/cuda.c
Log:
Enable reset-all and add poweroff
Modified: openbios-devel/drivers/cuda.c
===================================================================
--- openbios-devel/drivers/cuda.c 2008-12-28 15:27:19 UTC (rev 329)
+++ openbios-devel/drivers/cuda.c 2008-12-28 16:35:39 UTC (rev 330)
@@ -58,6 +58,10 @@
#define ADB_PACKET 0
#define CUDA_PACKET 1
+/* CUDA commands (2nd byte) */
+#define CUDA_POWERDOWN 0xa
+#define CUDA_RESET_SYSTEM 0x11
+
static uint8_t cuda_readb (cuda_t *dev, int reg)
{
return *(volatile uint8_t *)(dev->base + reg);
@@ -153,7 +157,27 @@
DECLARE_UNNAMED_NODE(ob_cuda, INSTALL_OPEN, sizeof(int));
+static cuda_t *main_cuda;
+
static void
+ppc32_reset_all(void)
+{
+ uint8_t cmdbuf[2], obuf[64];
+
+ cmdbuf[0] = CUDA_RESET_SYSTEM;
+ cuda_request(main_cuda, CUDA_PACKET, cmdbuf, sizeof(cmdbuf), obuf);
+}
+
+static void
+ppc32_poweroff(void)
+{
+ uint8_t cmdbuf[2], obuf[64];
+
+ cmdbuf[0] = CUDA_POWERDOWN;
+ cuda_request(main_cuda, CUDA_PACKET, cmdbuf, sizeof(cmdbuf), obuf);
+}
+
+static void
ob_cuda_initialize (int *idx)
{
phandle_t ph=get_cur_dev();
@@ -174,6 +198,14 @@
set_int_property(ph, "interrupt-parent", pic_handle);
// HEATHROW
set_int_property(ph, "interrupts", 0x12);
+
+ bind_func("ppc32-reset-all", ppc32_reset_all);
+ push_str("' ppc32-reset-all to reset-all");
+ fword("eval");
+
+ PUSH(0);
+ fword("active-package!");
+ bind_func("poweroff", ppc32_poweroff);
}
static void
@@ -269,6 +301,8 @@
rtc_init(buf);
+ main_cuda = cuda;
+
return cuda;
}
More information about the OpenBIOS
mailing list