mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 18:41:00 +07:00
[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>
This commit is contained in:
parent
ca052f7924
commit
1c43d265f4
@ -188,6 +188,7 @@ enum ps3_sys_manager_next_op {
|
||||
* controller, and bluetooth controller.
|
||||
* @PS3_SM_WAKE_RTC:
|
||||
* @PS3_SM_WAKE_RTC_ERROR:
|
||||
* @PS3_SM_WAKE_W_O_L: Ether or wireless LAN.
|
||||
* @PS3_SM_WAKE_P_O_R: Power on reset.
|
||||
*
|
||||
* Additional wakeup sources when specifying PS3_SM_NEXT_OP_SYS_SHUTDOWN.
|
||||
@ -201,9 +202,18 @@ enum ps3_sys_manager_wake_source {
|
||||
PS3_SM_WAKE_DEFAULT = 0,
|
||||
PS3_SM_WAKE_RTC = 0x00000040,
|
||||
PS3_SM_WAKE_RTC_ERROR = 0x00000080,
|
||||
PS3_SM_WAKE_W_O_L = 0x00000400,
|
||||
PS3_SM_WAKE_P_O_R = 0x80000000,
|
||||
};
|
||||
|
||||
/**
|
||||
* user_wake_sources - User specified wakeup sources.
|
||||
*
|
||||
* Logical OR of enum ps3_sys_manager_wake_source types.
|
||||
*/
|
||||
|
||||
static u32 user_wake_sources = PS3_SM_WAKE_DEFAULT;
|
||||
|
||||
/**
|
||||
* enum ps3_sys_manager_cmd - Command from system manager to guest.
|
||||
*
|
||||
@ -619,7 +629,7 @@ static void ps3_sys_manager_final_power_off(struct ps3_system_bus_device *dev)
|
||||
ps3_vuart_cancel_async(dev);
|
||||
|
||||
ps3_sys_manager_send_next_op(dev, PS3_SM_NEXT_OP_SYS_SHUTDOWN,
|
||||
PS3_SM_WAKE_DEFAULT);
|
||||
user_wake_sources);
|
||||
|
||||
ps3_sys_manager_fin(dev);
|
||||
}
|
||||
@ -652,11 +662,43 @@ static void ps3_sys_manager_final_restart(struct ps3_system_bus_device *dev)
|
||||
|
||||
ps3_sys_manager_send_attr(dev, 0);
|
||||
ps3_sys_manager_send_next_op(dev, PS3_SM_NEXT_OP_SYS_REBOOT,
|
||||
PS3_SM_WAKE_DEFAULT);
|
||||
user_wake_sources);
|
||||
|
||||
ps3_sys_manager_fin(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* ps3_sys_manager_get_wol - Get wake-on-lan setting.
|
||||
*/
|
||||
|
||||
int ps3_sys_manager_get_wol(void)
|
||||
{
|
||||
pr_debug("%s:%d\n", __func__, __LINE__);
|
||||
|
||||
return (user_wake_sources & PS3_SM_WAKE_W_O_L) != 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ps3_sys_manager_get_wol);
|
||||
|
||||
/**
|
||||
* ps3_sys_manager_set_wol - Set wake-on-lan setting.
|
||||
*/
|
||||
|
||||
void ps3_sys_manager_set_wol(int state)
|
||||
{
|
||||
static DEFINE_MUTEX(mutex);
|
||||
|
||||
mutex_lock(&mutex);
|
||||
|
||||
pr_debug("%s:%d: %d\n", __func__, __LINE__, state);
|
||||
|
||||
if (state)
|
||||
user_wake_sources |= PS3_SM_WAKE_W_O_L;
|
||||
else
|
||||
user_wake_sources &= ~PS3_SM_WAKE_W_O_L;
|
||||
mutex_unlock(&mutex);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ps3_sys_manager_set_wol);
|
||||
|
||||
/**
|
||||
* ps3_sys_manager_work - Asynchronous read handler.
|
||||
*
|
||||
|
@ -437,6 +437,8 @@ void ps3_sys_manager_register_ops(const struct ps3_sys_manager_ops *ops);
|
||||
void __noreturn ps3_sys_manager_power_off(void);
|
||||
void __noreturn ps3_sys_manager_restart(void);
|
||||
void __noreturn ps3_sys_manager_halt(void);
|
||||
int ps3_sys_manager_get_wol(void);
|
||||
void ps3_sys_manager_set_wol(int state);
|
||||
|
||||
struct ps3_prealloc {
|
||||
const char *name;
|
||||
|
Loading…
Reference in New Issue
Block a user