Re: [Xen-devel] Re: [XenPPC] [PATCH] [POWERPC] fix vga.c compilation

2006-08-16 Thread Alex Williamson
On Wed, 2006-08-16 at 15:24 +0100, Keir Fraser wrote:

> Actually I'm not sure this is particularly necessary for headless x86
> either. I could move the test to the end of setup_vga(), and only probe
> 0xb8000?

Hi Keir,

   Yeah, I think something like the below change to your previous patch
would be fine.  Thanks!

Alex

Signed-off-by: Alex Williamson <[EMAIL PROTECTED]>
---

diff -r aa9ed07f34a5 xen/drivers/video/vga.c
--- a/xen/drivers/video/vga.c   Wed Aug 16 08:38:18 2006 -0600
+++ b/xen/drivers/video/vga.c   Wed Aug 16 08:46:30 2006 -0600
@@ -321,45 +321,6 @@ static int detect_video(void *video_base
 return video_found;
 }
 
-static int detect_vga(void)
-{
-int detected;
-void *p;
-
-if ( memory_is_conventional_ram(0xA) )
-return 0;
-
-/*
- * 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.
- */
-
-p = ioremap(0xA, 0x1000);
-detected = detect_video(p);
-iounmap(p);
-if ( detected )
-return 1;
-
-p = ioremap(0xB, 0x1000);
-detected = detect_video(p);
-iounmap(p);
-if ( detected )
-return 1;
-
-p = ioremap(0xB8000, 0x1000);
-detected = detect_video(p);
-iounmap(p);
-if ( detected )
-return 1;
-
-return 0;
-}
-
 /* This is actually code from vgaHWRestore in an old version of XFree86 :-) */
 void *setup_vga(void)
 {
@@ -378,9 +339,10 @@ void *setup_vga(void)
 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x0c, 0x00, 0x0f, 0x08, 0x00
 };
 
-int i, j;
-
-if ( !detect_vga() )
+int i, j, detected;
+void *p;
+
+if ( memory_is_conventional_ram(0xA) )
 {
 printk("No VGA adaptor detected!\n");
 return NULL;
@@ -407,6 +369,12 @@ void *setup_vga(void)
 
 inb(VGA_IS1_RC);
 outb(0x20, VGA_ATT_IW);
+
+p = ioremap(0xB8000, 0x1000);
+detected = detect_video(p);
+iounmap(p);
+if ( !detected )
+return NULL;
 
 return ioremap(0xB8000, 0x8000);
 }



___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


Re: [Xen-devel] Re: [XenPPC] [PATCH] [POWERPC] fix vga.c compilation

2006-08-16 Thread Keir Fraser



On 16/8/06 2:59 pm, "Alex Williamson" <[EMAIL PROTECTED]> wrote:

>In general this looks a lot better, but I think ia64 is still going
> to have trouble with the chunk below.  It seems that a VGA card
> operating in a standard text mode doesn't necessarily respond to all of
> these addresses.  On some ia64 platforms that causes a hard fail
> response (the bus goes fatal and a reboot follows).  On my system, the
> 0xB8000 test looks like it will probably work, but we never get there
> because either the 0xA or the 0xB test will cause the hardfail.
> Do we need to poke the card through I/O port space to get it into the
> right mode before probing it in MMIO space?  I don't know enough about
> the VGA programming model to be able to do that.  The card works once we
> start talking to it correctly, but this probe is a little too brute
> force.  Thanks,

Actually I'm not sure this is particularly necessary for headless x86
either. I could move the test to the end of setup_vga(), and only probe
0xb8000? x86 is more 'resilient' to random memory and port accesses. I don't
think it'll matter that we do lots of port accesses even if a vga adapter
isn't present. If we keep the conventional-ram test as well, then that'll be
the same level of checking that Linux does on ia64.

 -- Keir



___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


Re: [Xen-devel] Re: [XenPPC] [PATCH] [POWERPC] fix vga.c compilation

2006-08-16 Thread Alex Williamson
On Wed, 2006-08-16 at 11:49 +0100, Keir Fraser wrote:
> Here you go. Arch/powerpc/vga.c isn't great but I assume it's
> temporary
> until vga support is fixed properly.
> 
> If you think it looks okay I'll apply it. Also Sign-off or Ack if you
> like.

Hi Keir,

   In general this looks a lot better, but I think ia64 is still going
to have trouble with the chunk below.  It seems that a VGA card
operating in a standard text mode doesn't necessarily respond to all of
these addresses.  On some ia64 platforms that causes a hard fail
response (the bus goes fatal and a reboot follows).  On my system, the
0xB8000 test looks like it will probably work, but we never get there
because either the 0xA or the 0xB test will cause the hardfail.
Do we need to poke the card through I/O port space to get it into the
right mode before probing it in MMIO space?  I don't know enough about
the VGA programming model to be able to do that.  The card works once we
start talking to it correctly, but this probe is a little too brute
force.  Thanks,

Alex

> +
> +p = ioremap(0xA, 0x1000);
> +detected = detect_video(p);
> +iounmap(p);
> +if ( detected )
> +return 1;
> +
> +p = ioremap(0xB, 0x1000);
> +detected = detect_video(p);
> +iounmap(p);
> +if ( detected )
> +return 1;
> +
> +p = ioremap(0xB8000, 0x1000);
> +detected = detect_video(p);
> +iounmap(p);
> +if ( detected )
> +return 1;
> + 
-- 
Alex Williamson HP Open Source & Linux Org.


___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


Re: [Xen-devel] Re: [XenPPC] [PATCH] [POWERPC] fix vga.c compilation

2006-08-16 Thread Keir Fraser

On 16/8/06 10:15 am, "Keir Fraser" <[EMAIL PROTECTED]> wrote:

>> Looks like I bungled this whitespace; could you fix when you commit
>> please?
>> 
>> It would probably be best to combine this patch with the ia64 patch and
>> put both our signed-off lines on it. (I'll sign off on Alex's changes,
>> FWIW.)
> 
> I don't think the diffs between the arches should be sufficient to warrant
> whole new header files. I'll cook up a combined patch and post it,.

Here you go. Arch/powerpc/vga.c isn't great but I assume it's temporary
until vga support is fixed properly.

If you think it looks okay I'll apply it. Also Sign-off or Ack if you like.

 -- Keir




vga-fix.patch
Description: Binary data
___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel