21 #include <linux/export.h>
24 #include <linux/rtc.h>
27 #include <linux/reboot.h>
31 #include <asm/machdep.h>
38 static int beat_pm_poweroff_flag;
42 beat_shutdown_logical_partition(!beat_pm_poweroff_flag);
47 beat_shutdown_logical_partition(0);
64 if (beat_rtc_write(tim))
73 if (beat_rtc_read(&tim))
80 #define BEAT_NVRAM_SIZE 4096
94 for (; count != 0; count -= len) {
98 if (beat_eeprom_read(i, len, p))
120 for (; count != 0; count -= len) {
124 if (beat_eeprom_write(i, len, p))
141 if (beat_set_dabr(dabr, dabrx))
151 ret = beat_get_characters_from_console(vterm, len, (
u8 *)db);
166 return beat_put_characters_to_console(vterm, len, (
u8 *)db);
185 beat_pm_poweroff_flag = 1;
193 beat_pm_poweroff_flag = 0;
198 static struct beat_event_list {
199 const char *typecode;
202 } beat_event_list[] = {
203 {
"power", beat_power_event, 0 },
204 {
"reset", beat_reset_event, 0 },
207 static int __init beat_register_event(
void)
213 for (i = 0; i <
ARRAY_SIZE(beat_event_list); i++) {
214 struct beat_event_list *ev = &beat_event_list[
i];
216 if (beat_construct_event_receive_port(data) != 0) {
218 "cannot construct event receive port for %s\n",
226 " for event receive port for %s\n",
228 beat_destruct_event_receive_port(data[0]);
237 " for event receive port for %s\n",
239 beat_destruct_event_receive_port(data[0]);
243 path[0] = 0x1000000065780000ul;
244 path[1] = 0x627574746f6e0000ul;
246 strncpy((
char *)&path[2], ev->typecode, 8);
250 beat_create_repository_node(path, data);
255 static int __init beat_event_init(
void)
257 if (!firmware_has_feature(FW_FEATURE_BEAT))
260 beat_pm_poweroff_flag = 0;
261 return beat_register_event();