~ressu/+junk/xen-debian

« back to all changes in this revision

Viewing changes to xen/arch/x86/shutdown.c

  • Committer: sami at haahtinen
  • Author(s): Bastian Blank
  • Date: 2011-03-17 14:12:45 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: sami@haahtinen.name-20110317141245-owgqox0l0p3g5857
Tags: 4.1.0~rc6-1
* New upstream release candidate.
* Build documentation using pdflatex.
* Use python 2.6. (closes: #596545)
* Fix lintian override.
* Install new tools: xl, xenpaging.
* Enable blktap2.
  - Use own md5 implementation.
  - Fix includes.
  - Fix linking of blktap2 binaries.
  - Remove optimization setting.
* Temporarily disable hvmloader, wants to download ipxe.
* Remove xenstored pid check from xl.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <asm/processor.h>
24
24
#include <asm/mpspec.h>
25
25
#include <asm/tboot.h>
 
26
#include <asm/apic.h>
26
27
 
27
28
enum reboot_type {
28
29
        BOOT_TRIPLE = 't',
35
36
static int reboot_mode;
36
37
 
37
38
/*
38
 
 * reboot=b[ios] | t[riple] | k[bd] | [, [w]arm | [c]old]
 
39
 * reboot=b[ios] | t[riple] | k[bd] | n[o] [, [w]arm | [c]old]
39
40
 * warm   Don't set the cold reboot flag
40
41
 * cold   Set the cold reboot flag
41
42
 * bios   Reboot by jumping through the BIOS (only for X86_32)
50
51
    {
51
52
        switch ( *str )
52
53
        {
 
54
        case 'n': /* no reboot */
 
55
            opt_noreboot = 1;
 
56
            break;
53
57
        case 'w': /* "warm" reboot (no memory testing etc) */
54
58
            reboot_mode = 0x1234;
55
59
            break;
298
302
 
299
303
void machine_restart(unsigned int delay_millisecs)
300
304
{
301
 
    int i;
 
305
    unsigned int i, attempt;
 
306
    enum reboot_type orig_reboot_type = reboot_type;
302
307
 
303
308
    watchdog_disable();
304
309
    console_start_sync();
335
340
    /* Rebooting needs to touch the page at absolute address 0. */
336
341
    *((unsigned short *)__va(0x472)) = reboot_mode;
337
342
 
338
 
    for ( ; ; )
 
343
    for ( attempt = 0; ; attempt++ )
339
344
    {
340
345
        switch ( reboot_type )
341
346
        {
348
353
                outb(0xfe,0x64); /* pulse reset low */
349
354
                udelay(50);
350
355
            }
351
 
            /* fall through */
 
356
            /*
 
357
             * If this platform supports ACPI reset, we follow a Windows-style
 
358
             * reboot attempt sequence:
 
359
             *   ACPI -> KBD -> ACPI -> KBD
 
360
             * After this we revert to our usual sequence:
 
361
             *   KBD -> TRIPLE -> KBD -> TRIPLE -> KBD -> ...
 
362
             */
 
363
            reboot_type = (((attempt == 1) && (orig_reboot_type == BOOT_ACPI))
 
364
                           ? BOOT_ACPI : BOOT_TRIPLE);
 
365
            break;
352
366
        case BOOT_TRIPLE:
353
367
            asm volatile ( "lidt %0 ; int3" : "=m" (no_idt) );
 
368
            reboot_type = BOOT_KBD;
354
369
            break;
355
370
        case BOOT_BIOS:
356
371
            machine_real_restart(jump_to_bios, sizeof(jump_to_bios));
 
372
            reboot_type = BOOT_KBD;
357
373
            break;
358
374
        case BOOT_ACPI:
359
375
            acpi_reboot();
 
376
            reboot_type = BOOT_KBD;
360
377
            break;
361
378
        }
362
 
 
363
 
        reboot_type = BOOT_KBD;
364
379
    }
365
380
}
366
381