linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Romanick <idr@us.ibm.com>
To: linux-fbdev-devel@lists.sourceforge.net
Subject: Re: [PATCH] Read MGA PInS data on PowerPC
Date: Thu, 25 Aug 2005 10:39:20 -0700	[thread overview]
Message-ID: <430E0248.8000403@us.ibm.com> (raw)
In-Reply-To: <430CF861.7060208@us.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1115 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.

fa76838aa195ee448d788ba65d73fa30  matroxfb_PInS-01.patch

Signed-off-by: Ian Romanick <idr@us.ibm.com>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFDDgJIX1gOwKyEAw8RAp3pAJ0djJUY6XsURmuofK/c8u0cf8w/fwCfafo6
tCfdbEK4qB5q/JY0ywk04N0=
=+XtZ
-----END PGP SIGNATURE-----

[-- Attachment #2: matroxfb_PInS-01.patch --]
[-- Type: text/x-patch, Size: 2099 bytes --]

diff -rud --exclude='*~' linux-2.6.11.8/drivers/video/matrox/matroxfb_misc.c linux-2.6.11.8.matroxfb/drivers/video/matrox/matroxfb_misc.c
--- linux-2.6.11.8/drivers/video/matrox/matroxfb_misc.c	2005-04-29 18:29:20.000000000 -0700
+++ linux-2.6.11.8.matroxfb/drivers/video/matrox/matroxfb_misc.c	2005-06-20 11:44:49.647889368 -0700
@@ -67,6 +67,9 @@
  *
  *               "David C. Hansen" <haveblue@us.ibm.com>
  *                     Fixes
+ * 
+ *               "Ian Romanick" <idr@us.ibm.com>
+ *                     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)
@@ -499,10 +502,35 @@
 	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))))
@@ -758,6 +786,8 @@
 	}
 #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);

      reply	other threads:[~2005-08-25 17:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-24 22:44 [PATCH] Read MGA PInS data on PowerPC Ian Romanick
2005-08-25 17:39 ` Ian Romanick [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=430E0248.8000403@us.ibm.com \
    --to=idr@us.ibm.com \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).