public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Denis Vlasenko <vda@ilport.com.ua>
To: "linux-os \(Dick Johnson\)" <linux-os@analogic.com>
Cc: "Linux kernel" <linux-kernel@vger.kernel.org>
Subject: Re: Compaq Presario "reboot" problems
Date: Sat, 19 Nov 2005 16:44:03 +0200	[thread overview]
Message-ID: <200511191644.03330.vda@ilport.com.ua> (raw)
In-Reply-To: <Pine.LNX.4.61.0511180904470.4215@chaos.analogic.com>

On Friday 18 November 2005 16:15, linux-os (Dick Johnson) wrote:
> On Fri, 18 Nov 2005, Denis Vlasenko wrote:
> 
> > On Thursday 17 November 2005 20:51, linux-os (Dick Johnson) wrote:
> >> It appears as though Linux is still restarting as a "warm boot",
> >> rather than a cold boot (in other words, putting magic in the
> >> shutdown byte of CMOS) so the hardware doesn't get properly
> >> initialized. Would somebody please check this out. When changing
> >> operating systems, you need a cold-boot.
> >
> > Can you check which driver does that? The test would be to
> > boot a special Linux setup which reboots immediately
> > (say, wuth init=/some/reboot_script.sh boot param).
> >
> > Then start removing drivers from kernel until you
> > can boot Win successfully after Linux reboots.
> > --
> > vda
> 
> I booted into a shell from a floppy disk. There were no drivers
> installed, not even the IDE driver. I could not reboot windows
> after linux was up and rebooted. This was Linux-2.6.13.4. Then
> I tried linux-2.4.26 which corresponds to the version when I
> first reported this problem. The same thing happens. Therefore,
> I temporarily modified linux-2.6.13.4 to force a triple-fault
> and processor reset when doing a reboot. With this temporary
> modification it is possible to boot windows after Linux was
> running.
> 
> This is the reboot patch. It is not a "solution", just something
> that shows that the current reboot code doesn't force the BIOS
> to start from scratch, which is essential when changing operating
> systems.
> 
> 
> --- linux-2.6.13.4/arch/i386/kernel/reboot.c.orig	2005-11-18 08:29:12.000000000 -0500
> +++ linux-2.6.13.4/arch/i386/kernel/reboot.c	2005-11-18 08:52:40.000000000 -0500
> @@ -337,6 +337,11 @@
> 
>   void machine_restart(char * __unused)
>   {
> +        for(;;) {
> +	__asm__ __volatile__("\tmovl %cr0, %eax\n"
> +			     "\tandl $~0x80000000,  %eax\n"
> +			     "\tmovl %eax, %cr0\n");
> +        }
>   	machine_shutdown();
>   	machine_emergency_restart();
>   }

Does reboot=cb ('cold', 'thru BIOS') work for you?

I read arch/i386/kernel/reboot.c and it looks like reboot=cb
kernel param will triple fault too:

static int reboot_mode;
static int reboot_thru_bios;

static int __init reboot_setup(char *str)
{
        while(1) {
                switch (*str) {
                case 'w': /* "warm" reboot (no memory testing etc) */
                        reboot_mode = 0x1234;
                        break;
                case 'c': /* "cold" reboot (with memory testing etc) */
                        reboot_mode = 0x0;
                        break;
                case 'b': /* "bios" reboot by jumping through the BIOS */
                        reboot_thru_bios = 1;
                        break;
                case 'h': /* "hard" reboot by toggling RESET and/or crashing the CPU */
                        reboot_thru_bios = 0;
                        break;
                }
                if((str = strchr(str,',')) != NULL)
                        str++;
                else
                        break;
        }
        return 1;
}

__setup("reboot=", reboot_setup);
...
void machine_emergency_restart(void)
{
        if (!reboot_thru_bios) {
                if (efi_enabled) {
                        efi.reset_system(EFI_RESET_COLD, EFI_SUCCESS, 0, NULL);
                        load_idt(&no_idt);
                        __asm__ __volatile__("int3");
                }
                /* rebooting needs to touch the page at absolute addr 0 */
                *((unsigned short *)__va(0x472)) = reboot_mode;
                for (;;) {
                        mach_reboot_fixups(); /* for board specific fixups */
                        mach_reboot();
                        /* That didn't work - force a triple fault.. */
                        load_idt(&no_idt);
                        __asm__ __volatile__("int3");
                }
        }
        if (efi_enabled)
                efi.reset_system(EFI_RESET_WARM, EFI_SUCCESS, 0, NULL);

        machine_real_restart(jump_to_bios, sizeof(jump_to_bios));
}

void machine_restart(char * __unused)
{
        machine_shutdown();
        machine_emergency_restart();
}


If it does not, try this reboot=tc - this is closely resembles
what you proposed in your mail (pseudo-patch):

static int __init reboot_setup(char *str)
{
        while(1) {
                switch (*str) {
+               case 't': /* "triple fault" reboot */
+                       reboot_thru_bios = 2;
+                       break;
                case 'w': /* "warm" reboot (no memory testing etc) */
                        reboot_mode = 0x1234;
                        break;
...
void machine_emergency_restart(void)
{
+       if (reboot_thru_bios == 2) {
+               *((unsigned short *)__va(0x472)) = reboot_mode;
+               load_idt(&no_idt);
+               __asm__ __volatile__("int3");
+	}
        if (!reboot_thru_bios) {
                if (efi_enabled) {
                        efi.reset_system(EFI_RESET_COLD, EFI_SUCCESS, 0, NULL);
--
vda

  reply	other threads:[~2005-11-19 14:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-17 18:51 Compaq Presario "reboot" problems linux-os (Dick Johnson)
2005-11-17 18:39 ` Jeff V. Merkey
2005-11-17 23:26 ` Ondrej Zary
2005-11-18 11:48   ` Denis Vlasenko
2005-11-19 13:39     ` Ondrej Zary
2005-11-18 11:51 ` Denis Vlasenko
2005-11-18 12:48   ` linux-os (Dick Johnson)
2005-11-18 14:15   ` linux-os (Dick Johnson)
2005-11-19 14:44     ` Denis Vlasenko [this message]
2005-11-21 17:52       ` linux-os (Dick Johnson)
2005-11-21 18:58         ` Stefan Seyfried
2005-11-22 14:09           ` linux-os (Dick Johnson)
2005-11-22 14:19             ` Denis Vlasenko
  -- strict thread matches above, loose matches on Subject: below --
2005-11-18 15:14 Nick Warne
     [not found] <59X9C-2Va-9@gated-at.bofh.it>
2005-11-19  5:05 ` Robert Hancock

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=200511191644.03330.vda@ilport.com.ua \
    --to=vda@ilport.com.ua \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-os@analogic.com \
    /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