summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/macppc/dev/adb.c34
-rw-r--r--sys/arch/macppc/dev/pm_direct.c24
-rw-r--r--sys/arch/macppc/dev/pm_direct.h11
3 files changed, 62 insertions, 7 deletions
diff --git a/sys/arch/macppc/dev/adb.c b/sys/arch/macppc/dev/adb.c
index cfc5bd8ca7b..3dc6552ff39 100644
--- a/sys/arch/macppc/dev/adb.c
+++ b/sys/arch/macppc/dev/adb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb.c,v 1.19 2006/03/07 20:00:18 miod Exp $ */
+/* $OpenBSD: adb.c,v 1.20 2007/02/12 21:01:11 gwk Exp $ */
/* $NetBSD: adb.c,v 1.6 1999/08/16 06:28:09 tsubai Exp $ */
/* $NetBSD: adb_direct.c,v 1.14 2000/06/08 22:10:45 tsubai Exp $ */
@@ -278,6 +278,7 @@ void setsoftadb(void);
int adb_intr(void *arg);
void adb_cuda_autopoll(void);
+void adb_cuda_fileserver_mode(void);
#ifdef ADB_DEBUG
/*
@@ -1524,7 +1525,7 @@ adb_poweroff(void)
case ADB_HW_CUDA:
output[0] = 0x02; /* 2 byte message */
output[1] = 0x01; /* to pram/rtc/soft-power device */
- output[2] = 0x0a; /* set date/time */
+ output[2] = 0x0a; /* set poweroff */
result = send_adb_cuda((u_char *)output, (u_char *)0,
(void *)0, (void *)0, (int)0);
if (result != 0) /* exit if not sent */
@@ -1555,11 +1556,11 @@ adb_cuda_autopoll()
u_char output[16];
output[0] = 0x03; /* 3-byte message */
- output[1] = 0x01; /* to pram/rtc device */
+ output[1] = 0x01; /* to pram/rtc/soft-power device */
output[2] = 0x01; /* cuda autopoll */
output[3] = 0x01;
result = send_adb_cuda(output, output, adb_op_comprout,
- (void *)&flag, 0);
+ (void *)&flag, 0);
if (result != 0) /* exit if not sent */
return;
@@ -1567,6 +1568,26 @@ adb_cuda_autopoll()
}
void
+adb_cuda_fileserver_mode()
+{
+ volatile int flag = 0;
+ int result;
+ u_char output[16];
+
+ output[0] = 0x03; /* 3-byte message */
+ output[1] = 0x01; /* to pram/rtc device/soft-power device */
+ output[2] = 0x13; /* cuda file server mode */
+ output[3] = 0x01; /* True */
+
+ result = send_adb_cuda(output, output, adb_op_comprout,
+ (void *)&flag, 0);
+ if (result != 0)
+ return;
+
+ while (flag == 0);
+}
+
+void
adb_restart()
{
int result;
@@ -1716,4 +1737,9 @@ adbattach(struct device *parent, struct device *self, void *aux)
config_found(self, &nca, NULL);
}
}
+
+ if (adbHardware == ADB_HW_CUDA)
+ adb_cuda_fileserver_mode();
+ if (adbHardware == ADB_HW_PMU)
+ pmu_fileserver_mode();
}
diff --git a/sys/arch/macppc/dev/pm_direct.c b/sys/arch/macppc/dev/pm_direct.c
index f683585261e..21dadafacd3 100644
--- a/sys/arch/macppc/dev/pm_direct.c
+++ b/sys/arch/macppc/dev/pm_direct.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pm_direct.c,v 1.20 2006/03/07 20:00:18 miod Exp $ */
+/* $OpenBSD: pm_direct.c,v 1.21 2007/02/12 21:01:11 gwk Exp $ */
/* $NetBSD: pm_direct.c,v 1.9 2000/06/08 22:10:46 tsubai Exp $ */
/*
@@ -558,7 +558,7 @@ pm_adb_op(u_char *buffer, void *compRout, void *data, int command)
s = splhigh();
write_via_reg(VIA1, vIER, 0x10);
- adbBuffer = buffer;
+ adbBuffer = buffer;
adbCompRout = compRout;
adbCompData = data;
@@ -837,3 +837,23 @@ pm_battery_info(int battery, struct pmu_battery_info *info)
return 1;
}
+
+void
+pmu_fileserver_mode()
+{
+ PMData p;
+
+ p.command = PMU_POWER_EVENTS;
+ p.num_data = 1;
+ p.s_buf = p.r_buf = p.data;
+ p.data[0] = PMU_PWR_GET_POWERUP_EVENTS;
+ pmgrop(&p);
+
+ p.command = PMU_POWER_EVENTS;
+ p.num_data = 3;
+ p.s_buf = p.r_buf = p.data;
+ p.data[1] = p.data[0]; /* result from the get */
+ p.data[0] = PMU_PWR_SET_POWERUP_EVENTS;
+ p.data[2] |= PMU_WAKE_AC_LOSS;
+ pmgrop(&p);
+}
diff --git a/sys/arch/macppc/dev/pm_direct.h b/sys/arch/macppc/dev/pm_direct.h
index 41d7a57628c..8213ffe9a0c 100644
--- a/sys/arch/macppc/dev/pm_direct.h
+++ b/sys/arch/macppc/dev/pm_direct.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pm_direct.h,v 1.9 2005/12/22 22:55:25 miod Exp $ */
+/* $OpenBSD: pm_direct.h,v 1.10 2007/02/12 21:01:11 gwk Exp $ */
/* $NetBSD: pm_direct.h,v 1.5 1999/07/12 15:54:55 tsubai Exp $ */
/*
@@ -68,6 +68,7 @@ struct pmu_battery_info
int pm_battery_info(int, struct pmu_battery_info *);
void pm_eject_pcmcia(int);
+void pmu_fileserver_mode(void);
/* PMU commands */
#define PMU_RESET_ADB 0x00 /* Reset ADB */
@@ -127,6 +128,14 @@ enum {
PMU_PWR_CLR_WAKEUP_EVENTS = 0x05,
};
+/* PMU WAKE ON EVENTS */
+
+#define PMU_WAKE_KEYB 0x01
+#define PMU_WAKE_AC_LOSS 0x02
+#define PMU_WAKE_AC_CHG 0x04
+#define PMU_WAKE_LID 0x08
+#define PMU_WAKE_RING 0x10
+
/* PMU Power Information */
#define PMU_PWR_AC_PRESENT (1 << 0)