tree 13a3b008a6a64f051b75f59d194d32e290be5fbc
parent f510a3c3d48fd5aaa7757aebbc37e9ee417913a3
author Ian Romanick <[EMAIL PROTECTED]> Sat, 10 Sep 2005 03:04:42 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Sat, 10 Sep 2005 03:58:01 -0700

[PATCH] matroxfb: read MGA PInS data on PowerPC

This updates the matroxfb code so that it can find the PInS data embedded
in the BIOS on PowerPC cards.  The process for finding the data is
different on OpenFirmware cards than on x86 cards, and the code for doing
so was missing.

After patching, building, installing, and booting a kernel, you should grep
for "PInS" in /var/log/messages.  You should see two messages in the log:

PInS data found at offset XXXXX
PInS memtype = X

On the GXT135p card I get "31168" and "5".  The first value is irrelevant,
but it's presence lets me know that the PInS data was actually found.  On a
GXT130p, the second value should be 3.  Since I don't have access to that
hardware, if someone can verify that, I will submit a follow-on patch that
rips out all the memtype parameter stuff.

Signed-off-by: Ian Romanick <[EMAIL PROTECTED]>
Signed-off-by: Petr Vandrovec <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 drivers/video/matrox/matroxfb_misc.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+)

diff --git a/drivers/video/matrox/matroxfb_misc.c 
b/drivers/video/matrox/matroxfb_misc.c
--- a/drivers/video/matrox/matroxfb_misc.c
+++ b/drivers/video/matrox/matroxfb_misc.c
@@ -68,6 +68,9 @@
  *               "David C. Hansen" <[EMAIL PROTECTED]>
  *                     Fixes
  *
+ *               "Ian Romanick" <[EMAIL PROTECTED]>
+ *                     Find PInS data in BIOS on PowerPC systems.
+ *
  * (following author is not in any relation with this code, but his code
  *  is included in this driver)
  *
@@ -496,10 +499,35 @@ static void parse_bios(unsigned char __i
        get_bios_version(vbios, bd);
        get_bios_output(vbios, bd);
        get_bios_tvout(vbios, bd);
+#if defined(__powerpc__)
+       /* On PowerPC cards, the PInS offset isn't stored at the end of the
+        * BIOS image.  Instead, you must search the entire BIOS image for
+        * the magic PInS signature.
+        *
+        * This actually applies to all OpenFirmware base cards.  Since these
+        * cards could be put in a MIPS or SPARC system, should the condition
+        * be something different?
+        */
+       for ( pins_offset = 0 ; pins_offset <= 0xFF80 ; pins_offset++ ) {
+               unsigned char header[3];
+
+               header[0] = readb(vbios + pins_offset);
+               header[1] = readb(vbios + pins_offset + 1);
+               header[2] = readb(vbios + pins_offset + 2);
+               if ( (header[0] == 0x2E) && (header[1] == 0x41)
+                    && ((header[2] == 0x40) || (header[2] == 0x80)) ) {
+                       printk(KERN_INFO "PInS data found at offset %u\n",
+                              pins_offset);
+                       get_pins(vbios + pins_offset, bd);
+                       break;
+               }
+       }
+#else
        pins_offset = readb(vbios + 0x7FFC) | (readb(vbios + 0x7FFD) << 8);
        if (pins_offset <= 0xFF80) {
                get_pins(vbios + pins_offset, bd);
        }
+#endif
 }
 
 #define get_u16(x) (le16_to_cpu(get_unaligned((__u16*)(x))))
@@ -755,6 +783,8 @@ void matroxfb_read_pins(WPMINFO2) {
        }
 #endif
        matroxfb_set_limits(PMINFO &ACCESS_FBINFO(bios));
+       printk(KERN_INFO "PInS memtype = %u\n",
+              (ACCESS_FBINFO(values).reg.opt & 0x1C00) >> 10);
 }
 
 EXPORT_SYMBOL(matroxfb_DAC_in);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to