public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Li Fei <fei.li@intel.com>
Cc: hpa@zytor.com, mingo@redhat.com, tglx@linutronix.de,
	chuansheng.liu@intel.com, x86@kernel.org,
	akpm@linux-foundation.org, holt@sgi.com,
	rmk+kernel@arm.linux.org.uk, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] reboot: perform warm/cold reset correctly for CF9 type
Date: Wed, 21 Aug 2013 09:29:40 +0200	[thread overview]
Message-ID: <20130821072940.GB27495@gmail.com> (raw)
In-Reply-To: <1377049949.18357.3.camel@fli24-HP-Compaq-8100-Elite-CMT-PC>


* Li Fei <fei.li@intel.com> wrote:

> In current implementation for reboot type CF9 and CF9_COND,
> warm and cold reset are not differentiated, and both are
> performed by writing 0x06 to port 0xCF9 as warm reset. It's not
> correct.
> 
> This commit will differentiate warm and cold reset, and perform
> them correctly as below:
> For warm reset, write 0x06 to port 0xCF9;
> For cold reset, write 0x0E to port 0xCF9.
> 
> From: Liu Chuansheng <chuansheng.liu@intel.com>
> Signed-off-by: Li Fei <fei.li@intel.com>
> ---
>  arch/x86/kernel/reboot.c |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
> index 563ed91..6e06299 100644
> --- a/arch/x86/kernel/reboot.c
> +++ b/arch/x86/kernel/reboot.c
> @@ -511,10 +511,15 @@ static void native_machine_emergency_restart(void)
>  
>  		case BOOT_CF9_COND:
>  			if (port_cf9_safe) {
> -				u8 cf9 = inb(0xcf9) & ~6;
> +				u8 cf9 = inb(0xcf9) &
> +						~(reboot_mode == REBOOT_WARM ?
> +						0x06 : 0x0E);
>  				outb(cf9|2, 0xcf9); /* Request hard reset */
>  				udelay(50);
> -				outb(cf9|6, 0xcf9); /* Actually do the reset */
> +				/* Actually do the reset */
> +				outb(cf9|(reboot_mode == REBOOT_WARM ?
> +					0x06 : 0x0E),
> +					0xcf9);
>  				udelay(50);

Looks good, but please introduce a reboot_val intermediate 
variable instead of duplicating that ugly line-broken 
construct twice.

Thanks,

	Ingo

  reply	other threads:[~2013-08-21  7:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-21  1:52 [PATCH] reboot: perform warm/cold reset correctly for CF9 type Li Fei
2013-08-21  7:29 ` Ingo Molnar [this message]
2013-08-21  7:33   ` H. Peter Anvin
2013-08-21  8:08     ` Li, Fei
2013-08-21  9:07       ` H. Peter Anvin
2013-08-22  3:32         ` Li, Fei
2013-09-03 17:35           ` H. Peter Anvin
2013-09-09  1:53             ` Liu, Chuansheng
2013-09-09  2:56               ` H. Peter Anvin
2013-08-21  8:13 ` [PATCH V2] " Li Fei
2013-09-10 19:51   ` [tip:x86/reboot] reboot: Allow specifying warm/ cold reset for CF9 boot type tip-bot for Li Fei
2013-09-25 17:36   ` tip-bot for Li Fei

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=20130821072940.GB27495@gmail.com \
    --to=mingo@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=chuansheng.liu@intel.com \
    --cc=fei.li@intel.com \
    --cc=holt@sgi.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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