aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2003-10-09 09:33:16 +0000
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2003-10-09 09:33:16 +0000
commit3fbfd4aa46c75af08a04570a0d8f7e3599362fcf (patch)
treede15f8d9ed98636736ca592ee1abc175d26d96a6
parent390350830625c9ea4544959df75c482af819d6d2 (diff)
downloadxen-3fbfd4aa46c75af08a04570a0d8f7e3599362fcf.tar.gz
xen-3fbfd4aa46c75af08a04570a0d8f7e3599362fcf.tar.bz2
xen-3fbfd4aa46c75af08a04570a0d8f7e3599362fcf.zip
bitkeeper revision 1.498 (3f852b5cCUvtapSFnyCRbI57fF2ilQ)
kernel.c, process.c, README.CD: Add 'noreboot' option, and auto-detection of display adaptors.
-rw-r--r--README.CD4
-rw-r--r--xen/arch/i386/process.c9
-rw-r--r--xen/common/kernel.c48
3 files changed, 61 insertions, 0 deletions
diff --git a/README.CD b/README.CD
index 919f3a44f0..cfe6790e1c 100644
--- a/README.CD
+++ b/README.CD
@@ -275,6 +275,10 @@ that may be able to help diagnose problems:
by Xen. If you specify this option then ACPI tables are
also ignored, and SMP support is disabled.
+ noreboot Don't reboot the machine automatically on errors.
+ This is useful to catch debug output if you aren't
+ catching console messages via the serial line.
+
nosmp Disable SMP support.
This option is implied by 'ignorebiostables'.
diff --git a/xen/arch/i386/process.c b/xen/arch/i386/process.c
index 49f45688c6..0adcbbf47d 100644
--- a/xen/arch/i386/process.c
+++ b/xen/arch/i386/process.c
@@ -112,9 +112,18 @@ static inline void kb_wait(void)
void machine_restart(char * __unused)
{
+ extern int opt_noreboot;
#if CONFIG_SMP
int cpuid;
+#endif
+ if ( opt_noreboot )
+ {
+ printk("Reboot disabled on cmdline: require manual reset\n");
+ for ( ; ; ) __asm__ __volatile__ ("hlt");
+ }
+
+#ifdef CONFIG_SMP
cpuid = GET_APIC_ID(apic_read(APIC_ID));
if (reboot_smp) {
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 770e21e248..a410fd1155 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -62,6 +62,8 @@ int opt_noht=0;
int opt_noacpi=0;
/* opt_nosmp: If true, secondary processors are ignored. */
int opt_nosmp=0;
+/* opt_noreboot: If true, machine will need manual reset on error. */
+int opt_noreboot=0;
/* opt_ignorebiostables: If true, ACPI and MP tables are ignored. */
/* NB. This flag implies 'nosmp' and 'noacpi'. */
int opt_ignorebiostables=0;
@@ -80,6 +82,7 @@ static struct {
{ "noht", OPT_BOOL, &opt_noht },
{ "noacpi", OPT_BOOL, &opt_noacpi },
{ "nosmp", OPT_BOOL, &opt_nosmp },
+ { "noreboot", OPT_BOOL, &opt_noreboot },
{ "ignorebiostables", OPT_BOOL, &opt_ignorebiostables },
{ "watchdog", OPT_BOOL, &opt_watchdog },
{ NULL, 0, NULL }
@@ -284,6 +287,44 @@ void putchar_serial(unsigned char c) {}
#define ATTRIBUTE 7
#define VIDEO __va(0xB8000)
+int detect_video(void *video_base)
+{
+ volatile u16 *p = (volatile u16 *)video_base;
+ u16 saved1 = p[0], saved2 = p[1];
+ int video_found = 1;
+
+ p[0] = 0xAA55;
+ p[1] = 0x55AA;
+ if ( (p[0] != 0xAA55) || (p[1] != 0x55AA) )
+ video_found = 0;
+
+ p[0] = 0x55AA;
+ p[1] = 0xAA55;
+ if ( (p[0] != 0x55AA) || (p[1] != 0xAA55) )
+ video_found = 0;
+
+ p[0] = saved1;
+ p[1] = saved2;
+
+ return video_found;
+}
+
+int detect_vga(void)
+{
+ /*
+ * Look at a number of well-known locations. Even if video is not at
+ * 0xB8000 right now, it will appear there when we set up text mode 3.
+ *
+ * We assume if there is any sign of a video adaptor then it is at least
+ * VGA-compatible (surely noone runs CGA, EGA, .... these days?).
+ *
+ * These checks are basically to detect headless server boxes.
+ */
+ return (detect_video(__va(0xA0000)) ||
+ detect_video(__va(0xB0000)) ||
+ detect_video(__va(0xB8000)));
+}
+
/* This is actually code from vgaHWRestore in an old version of XFree86 :-) */
void init_vga(void)
{
@@ -308,6 +349,13 @@ void init_vga(void)
if ( !opt_console )
return;
+ if ( !detect_vga() )
+ {
+ printk("No VGA adaptor detected!\n");
+ opt_console = 0;
+ return;
+ }
+
tmp = inb(0x3da);
outb(0x00, 0x3c0);