linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Geoff Levand <geoffrey.levand@am.sony.com>
Cc: linuxppc-dev@ozlabs.org, paulus@samba.org, jgarzik@pobox.com
Subject: Re: [patch 5/6] PS3: Sys-manager Wake-on-LAN support
Date: Thu, 27 Mar 2008 11:53:46 +1100	[thread overview]
Message-ID: <1206579226.6926.64.camel@pasglop> (raw)
In-Reply-To: <47EAECA8.5030707@am.sony.com>


On Wed, 2008-03-26 at 17:39 -0700, Geoff Levand wrote:
> Add Wake-on-LAN support to the PS3 system-manager.  Other OS WOL
> support was introduced in PS3 system firmware 2.20.

There is no sleep in the first place tho :-) Or does this power it up /
boot it using WoL packets ?

Cheers,
Ben.

> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
> ---
>  drivers/ps3/ps3-sys-manager.c |   46 ++++++++++++++++++++++++++++++++++++++++--
>  include/asm-powerpc/ps3.h     |    2 +
>  2 files changed, 46 insertions(+), 2 deletions(-)
> 
> --- a/drivers/ps3/ps3-sys-manager.c
> +++ b/drivers/ps3/ps3-sys-manager.c
> @@ -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,10 +202,19 @@ 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.
>   *
>   * The guest completes the actions needed, then acks or naks the command via
> @@ -619,7 +629,7 @@ static void ps3_sys_manager_final_power_
>  	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,12 +662,44 @@ static void ps3_sys_manager_final_restar
>  
>  	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.
>   *
>   * Signaled when PS3_SM_RX_MSG_LEN_MIN bytes arrive at the vuart port.
> --- a/include/asm-powerpc/ps3.h
> +++ b/include/asm-powerpc/ps3.h
> @@ -437,6 +437,8 @@ void ps3_sys_manager_register_ops(const 
>  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;
> 

  reply	other threads:[~2008-03-27  0:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080327001821.827672589@am.sony.com>
2008-03-27  0:37 ` [patch 1/6] PS3: Fix unlikely typo in ps3_get_irq Geoff Levand
2008-03-27  0:37 ` [patch 2/6] PS3: Add ps3_get_speid routine Geoff Levand
2008-03-27  0:38 ` [patch 3/6] PS3: Bootwrapper improvements Geoff Levand
2008-03-27  8:13   ` Geert Uytterhoeven
2008-03-27 20:41   ` [patch 3/6 v2] " Geoff Levand
2008-03-27  0:38 ` [patch 4/6] PS3: Save power in busy loops on halt Geoff Levand
2008-03-27  0:39 ` [patch 5/6] PS3: Sys-manager Wake-on-LAN support Geoff Levand
2008-03-27  0:53   ` Benjamin Herrenschmidt [this message]
2008-03-27  1:04     ` Geoff Levand
2008-03-27  0:39 ` [patch 6/6] PS3: Gelic network driver " Geoff Levand
2008-03-28 21:59   ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1206579226.6926.64.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=geoffrey.levand@am.sony.com \
    --cc=jgarzik@pobox.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).