All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 1/2] x86: Add efi runtime reset
Date: Thu, 31 Jan 2019 15:30:52 +0800	[thread overview]
Message-ID: <CAEUhbmXZV7ex9OENQi_VHL5N=Qt85Qf5uZu3rU9aT1QiV4b-FQ@mail.gmail.com> (raw)
In-Reply-To: <CAPnjgZ25SDALFvTgbPG-_Q6ayWK6frXhvzTOOTc0KLHYN0HvFA@mail.gmail.com>

On Thu, Jan 31, 2019 at 9:24 AM Simon Glass <sjg@chromium.org> wrote:
>
> Hi,
>
> On Wed, 30 Jan 2019 at 12:03, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >
> > On 1/30/19 11:46 AM, Alexander Graf wrote:
> > > Our selftest will soon test the actual runtime reset function rather than
> > > the boot time one. For this, we need to ensure that the runtime version
> > > actually succeeds on x86 to keep our travis tests work.
> > >
> > > So this patch implements an x86 runtime reset function. It is missing
> > > shutdown functionality today, but OSs usually implement that via ACPI
> > > and this function does more than the stub from before, so it's at least
> > > an improvement.
> > >
> > > Eventually we will want to have full DM functionality in runtime services.
> > > But this fixes a travis failure and doesn't clutter the code too heavily, so
> > > we should pull it in without the amazing new RTS DM framework.
> > >
> > > Signed-off-by: Alexander Graf <agraf@suse.de>
> > >
> > > ---
> > >
> > > v2 -> v3:
> > >
> > >   - support EFI_RESET_PLATFORM_SPECIFIC
> > >   - reuse existing x86_sysreset_request() function
> >
> > The v2->v3 update does not answer the question if the reset is correctly
> > implemented. We would not want to call a function we do not trust.
> >
> > @Simon, Bin:
> > x86_sysreset_request() loosely resembles BOOT_CF9_SAFE in
> > native_machine_emergency_restart() in Linux arch/x86/kernel/reboot.c
> > which is tried before using the keyboard controller as last resort.
> >
> > u8 reboot_code = reboot_mode == REBOOT_WARM ?  0x06 : 0x0E;
> > u8 cf9 = inb(0xcf9) & ~reboot_code;
> > outb(cf9|2, 0xcf9); /* Request hard reset */
> > udelay(50);
> > /* Actually do the reset */
> > outb(cf9|reboot_code, 0xcf9);
> > udelay(50);
> >
> > So the Kernel first switches bit 2 off and bit 1 on, waits, and then
> > switches bit 2 on, cf.
> > http://smackerelofopinion.blogspot.com/2011/02/resetting-pc-using-reset-control.html
> >
> > Shouldn't we do it the same way as the Kernel does it?
>
> I suspect so, but Bin is the expert.
>

What U-Boot does is essentially the same as Linux but a simplified
version, because bit 2 is 0 any way. If it were 0, the system should
have been reset already then there is no chance to execute the reset
sequence at all.

> As to this patch, it perpetuates the current EFI run-time approach in
> U-Boot so I'm not sure this is the right path.
>

Regards,
Bin

  parent reply	other threads:[~2019-01-31  7:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30 10:46 [U-Boot] [PATCH v3 0/2] efi_loader: Patch RTS at ExitBootServices Alexander Graf
2019-01-30 10:46 ` [U-Boot] [PATCH v3 1/2] x86: Add efi runtime reset Alexander Graf
2019-01-30 18:58   ` Heinrich Schuchardt
2019-01-31  1:24     ` Simon Glass
2019-01-31  6:44       ` Alexander Graf
2019-01-31  7:30       ` Bin Meng [this message]
2019-01-31  7:31         ` Bin Meng
2019-01-31 11:38           ` Heinrich Schuchardt
2019-01-31 13:03             ` Bin Meng
2019-01-30 10:46 ` [U-Boot] [PATCH v3 2/2] efi_loader: Patch non-runtime code out at ExitBootServices already Alexander Graf
2019-01-30 18:52   ` Heinrich Schuchardt

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='CAEUhbmXZV7ex9OENQi_VHL5N=Qt85Qf5uZu3rU9aT1QiV4b-FQ@mail.gmail.com' \
    --to=bmeng.cn@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.