ia64/xen-unstable

changeset 809:79012ba592c9

bitkeeper revision 1.498 (3f852b5cCUvtapSFnyCRbI57fF2ilQ)

kernel.c, process.c, README.CD:
Add 'noreboot' option, and auto-detection of display adaptors.
author kaf24@scramble.cl.cam.ac.uk
date Thu Oct 09 09:33:16 2003 +0000 (2003-10-09)
parents 3f26e93f5e01
children 3f44ecdcb631 0247e417838a
files README.CD xen/arch/i386/process.c xen/common/kernel.c
line diff
     1.1 --- a/README.CD	Thu Oct 09 08:44:10 2003 +0000
     1.2 +++ b/README.CD	Thu Oct 09 09:33:16 2003 +0000
     1.3 @@ -275,6 +275,10 @@ that may be able to help diagnose proble
     1.4                    by Xen. If you specify this option then ACPI tables are
     1.5                    also ignored, and SMP support is disabled.
     1.6  
     1.7 + noreboot         Don't reboot the machine automatically on errors.
     1.8 +                  This is useful to catch debug output if you aren't
     1.9 +                  catching console messages via the serial line.
    1.10 +
    1.11   nosmp		  Disable SMP support.
    1.12                    This option is implied by 'ignorebiostables'.
    1.13  
     2.1 --- a/xen/arch/i386/process.c	Thu Oct 09 08:44:10 2003 +0000
     2.2 +++ b/xen/arch/i386/process.c	Thu Oct 09 09:33:16 2003 +0000
     2.3 @@ -112,9 +112,18 @@ static inline void kb_wait(void)
     2.4  
     2.5  void machine_restart(char * __unused)
     2.6  {
     2.7 +    extern int opt_noreboot;
     2.8  #if CONFIG_SMP
     2.9      int cpuid;
    2.10 +#endif
    2.11  	
    2.12 +    if ( opt_noreboot )
    2.13 +    {
    2.14 +        printk("Reboot disabled on cmdline: require manual reset\n");
    2.15 +        for ( ; ; ) __asm__ __volatile__ ("hlt");
    2.16 +    }
    2.17 +
    2.18 +#ifdef CONFIG_SMP
    2.19      cpuid = GET_APIC_ID(apic_read(APIC_ID));
    2.20  
    2.21      if (reboot_smp) {
     3.1 --- a/xen/common/kernel.c	Thu Oct 09 08:44:10 2003 +0000
     3.2 +++ b/xen/common/kernel.c	Thu Oct 09 09:33:16 2003 +0000
     3.3 @@ -62,6 +62,8 @@ int opt_noht=0;
     3.4  int opt_noacpi=0;
     3.5  /* opt_nosmp: If true, secondary processors are ignored. */
     3.6  int opt_nosmp=0;
     3.7 +/* opt_noreboot: If true, machine will need manual reset on error. */
     3.8 +int opt_noreboot=0;
     3.9  /* opt_ignorebiostables: If true, ACPI and MP tables are ignored. */
    3.10  /* NB. This flag implies 'nosmp' and 'noacpi'. */
    3.11  int opt_ignorebiostables=0;
    3.12 @@ -80,6 +82,7 @@ static struct {
    3.13      { "noht",             OPT_BOOL, &opt_noht },
    3.14      { "noacpi",           OPT_BOOL, &opt_noacpi },
    3.15      { "nosmp",            OPT_BOOL, &opt_nosmp },
    3.16 +    { "noreboot",         OPT_BOOL, &opt_noreboot },
    3.17      { "ignorebiostables", OPT_BOOL, &opt_ignorebiostables },
    3.18      { "watchdog",         OPT_BOOL, &opt_watchdog },
    3.19      { NULL,               0,        NULL     }
    3.20 @@ -284,6 +287,44 @@ void putchar_serial(unsigned char c) {}
    3.21  #define ATTRIBUTE    7
    3.22  #define VIDEO	    __va(0xB8000)
    3.23  
    3.24 +int detect_video(void *video_base)
    3.25 +{
    3.26 +    volatile u16 *p = (volatile u16 *)video_base;
    3.27 +    u16 saved1 = p[0], saved2 = p[1];
    3.28 +    int video_found = 1;
    3.29 +
    3.30 +    p[0] = 0xAA55;
    3.31 +    p[1] = 0x55AA;
    3.32 +    if ( (p[0] != 0xAA55) || (p[1] != 0x55AA) )
    3.33 +        video_found = 0;
    3.34 +
    3.35 +    p[0] = 0x55AA;
    3.36 +    p[1] = 0xAA55;
    3.37 +    if ( (p[0] != 0x55AA) || (p[1] != 0xAA55) )
    3.38 +        video_found = 0;
    3.39 +
    3.40 +    p[0] = saved1;
    3.41 +    p[1] = saved2;
    3.42 +
    3.43 +    return video_found;
    3.44 +}
    3.45 +
    3.46 +int detect_vga(void)
    3.47 +{
    3.48 +    /*
    3.49 +     * Look at a number of well-known locations. Even if video is not at
    3.50 +     * 0xB8000 right now, it will appear there when we set up text mode 3.
    3.51 +     * 
    3.52 +     * We assume if there is any sign of a video adaptor then it is at least
    3.53 +     * VGA-compatible (surely noone runs CGA, EGA, .... these days?).
    3.54 +     * 
    3.55 +     * These checks are basically to detect headless server boxes.
    3.56 +     */
    3.57 +    return (detect_video(__va(0xA0000)) || 
    3.58 +            detect_video(__va(0xB0000)) || 
    3.59 +            detect_video(__va(0xB8000)));
    3.60 +}
    3.61 +
    3.62  /* This is actually code from vgaHWRestore in an old version of XFree86 :-) */
    3.63  void init_vga(void)
    3.64  {
    3.65 @@ -308,6 +349,13 @@ void init_vga(void)
    3.66      if ( !opt_console )
    3.67          return;
    3.68  
    3.69 +    if ( !detect_vga() )
    3.70 +    {
    3.71 +        printk("No VGA adaptor detected!\n");
    3.72 +        opt_console = 0;
    3.73 +        return;
    3.74 +    }
    3.75 +
    3.76      tmp = inb(0x3da);
    3.77      outb(0x00, 0x3c0);
    3.78