diff options
author | Geoff Levand <geoffrey.levand@am.sony.com> | 2008-03-26 20:39:04 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-04-01 05:43:08 -0400 |
commit | 1c43d265f462bc714da67aa8113b3846bb9943e3 (patch) | |
tree | 5bb7d2f1bef9dca7ee917a986e505cedde9b6039 /drivers/ps3/ps3-sys-manager.c | |
parent | ca052f7924141f34998ab440bb4d908dc021a46b (diff) |
[POWERPC] PS3: Sys-manager Wake-on-LAN support
Add Wake-on-LAN support to the PS3 system-manager. Other OS WOL
support was introduced in PS3 system firmware 2.20.
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/ps3/ps3-sys-manager.c')
-rw-r--r-- | drivers/ps3/ps3-sys-manager.c | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/drivers/ps3/ps3-sys-manager.c b/drivers/ps3/ps3-sys-manager.c index 1260b01a5361..7605453b74fd 100644 --- a/drivers/ps3/ps3-sys-manager.c +++ b/drivers/ps3/ps3-sys-manager.c | |||
@@ -188,6 +188,7 @@ enum ps3_sys_manager_next_op { | |||
188 | * controller, and bluetooth controller. | 188 | * controller, and bluetooth controller. |
189 | * @PS3_SM_WAKE_RTC: | 189 | * @PS3_SM_WAKE_RTC: |
190 | * @PS3_SM_WAKE_RTC_ERROR: | 190 | * @PS3_SM_WAKE_RTC_ERROR: |
191 | * @PS3_SM_WAKE_W_O_L: Ether or wireless LAN. | ||
191 | * @PS3_SM_WAKE_P_O_R: Power on reset. | 192 | * @PS3_SM_WAKE_P_O_R: Power on reset. |
192 | * | 193 | * |
193 | * Additional wakeup sources when specifying PS3_SM_NEXT_OP_SYS_SHUTDOWN. | 194 | * Additional wakeup sources when specifying PS3_SM_NEXT_OP_SYS_SHUTDOWN. |
@@ -201,10 +202,19 @@ enum ps3_sys_manager_wake_source { | |||
201 | PS3_SM_WAKE_DEFAULT = 0, | 202 | PS3_SM_WAKE_DEFAULT = 0, |
202 | PS3_SM_WAKE_RTC = 0x00000040, | 203 | PS3_SM_WAKE_RTC = 0x00000040, |
203 | PS3_SM_WAKE_RTC_ERROR = 0x00000080, | 204 | PS3_SM_WAKE_RTC_ERROR = 0x00000080, |
205 | PS3_SM_WAKE_W_O_L = 0x00000400, | ||
204 | PS3_SM_WAKE_P_O_R = 0x80000000, | 206 | PS3_SM_WAKE_P_O_R = 0x80000000, |
205 | }; | 207 | }; |
206 | 208 | ||
207 | /** | 209 | /** |
210 | * user_wake_sources - User specified wakeup sources. | ||
211 | * | ||
212 | * Logical OR of enum ps3_sys_manager_wake_source types. | ||
213 | */ | ||
214 | |||
215 | static u32 user_wake_sources = PS3_SM_WAKE_DEFAULT; | ||
216 | |||
217 | /** | ||
208 | * enum ps3_sys_manager_cmd - Command from system manager to guest. | 218 | * enum ps3_sys_manager_cmd - Command from system manager to guest. |
209 | * | 219 | * |
210 | * The guest completes the actions needed, then acks or naks the command via | 220 | * The guest completes the actions needed, then acks or naks the command via |
@@ -619,7 +629,7 @@ static void ps3_sys_manager_final_power_off(struct ps3_system_bus_device *dev) | |||
619 | ps3_vuart_cancel_async(dev); | 629 | ps3_vuart_cancel_async(dev); |
620 | 630 | ||
621 | ps3_sys_manager_send_next_op(dev, PS3_SM_NEXT_OP_SYS_SHUTDOWN, | 631 | ps3_sys_manager_send_next_op(dev, PS3_SM_NEXT_OP_SYS_SHUTDOWN, |
622 | PS3_SM_WAKE_DEFAULT); | 632 | user_wake_sources); |
623 | 633 | ||
624 | ps3_sys_manager_fin(dev); | 634 | ps3_sys_manager_fin(dev); |
625 | } | 635 | } |
@@ -652,12 +662,44 @@ static void ps3_sys_manager_final_restart(struct ps3_system_bus_device *dev) | |||
652 | 662 | ||
653 | ps3_sys_manager_send_attr(dev, 0); | 663 | ps3_sys_manager_send_attr(dev, 0); |
654 | ps3_sys_manager_send_next_op(dev, PS3_SM_NEXT_OP_SYS_REBOOT, | 664 | ps3_sys_manager_send_next_op(dev, PS3_SM_NEXT_OP_SYS_REBOOT, |
655 | PS3_SM_WAKE_DEFAULT); | 665 | user_wake_sources); |
656 | 666 | ||
657 | ps3_sys_manager_fin(dev); | 667 | ps3_sys_manager_fin(dev); |
658 | } | 668 | } |
659 | 669 | ||
660 | /** | 670 | /** |
671 | * ps3_sys_manager_get_wol - Get wake-on-lan setting. | ||
672 | */ | ||
673 | |||
674 | int ps3_sys_manager_get_wol(void) | ||
675 | { | ||
676 | pr_debug("%s:%d\n", __func__, __LINE__); | ||
677 | |||
678 | return (user_wake_sources & PS3_SM_WAKE_W_O_L) != 0; | ||
679 | } | ||
680 | EXPORT_SYMBOL_GPL(ps3_sys_manager_get_wol); | ||
681 | |||
682 | /** | ||
683 | * ps3_sys_manager_set_wol - Set wake-on-lan setting. | ||
684 | */ | ||
685 | |||
686 | void ps3_sys_manager_set_wol(int state) | ||
687 | { | ||
688 | static DEFINE_MUTEX(mutex); | ||
689 | |||
690 | mutex_lock(&mutex); | ||
691 | |||
692 | pr_debug("%s:%d: %d\n", __func__, __LINE__, state); | ||
693 | |||
694 | if (state) | ||
695 | user_wake_sources |= PS3_SM_WAKE_W_O_L; | ||
696 | else | ||
697 | user_wake_sources &= ~PS3_SM_WAKE_W_O_L; | ||
698 | mutex_unlock(&mutex); | ||
699 | } | ||
700 | EXPORT_SYMBOL_GPL(ps3_sys_manager_set_wol); | ||
701 | |||
702 | /** | ||
661 | * ps3_sys_manager_work - Asynchronous read handler. | 703 | * ps3_sys_manager_work - Asynchronous read handler. |
662 | * | 704 | * |
663 | * Signaled when PS3_SM_RX_MSG_LEN_MIN bytes arrive at the vuart port. | 705 | * Signaled when PS3_SM_RX_MSG_LEN_MIN bytes arrive at the vuart port. |