public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ben Widawsky <ben@bwidawsk.net>
To: intel-gfx@lists.freedesktop.org
Cc: Ben Widawsky <ben@bwidawsk.net>,
	Ben Widawsky <benjamin.widawsky@intel.com>
Subject: [PATCH 9/9] drm/i915: [sparse] __iomem fixes for intel_bios
Date: Mon, 16 Apr 2012 14:07:48 -0700	[thread overview]
Message-ID: <1334610468-9274-10-git-send-email-ben@bwidawsk.net> (raw)
In-Reply-To: <1334610468-9274-1-git-send-email-ben@bwidawsk.net>

This is only the first part of the patch which does the correct types.
The fix for dereferencing stuff was taking too long, so I've stopped.

Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
---
 drivers/gpu/drm/i915/intel_bios.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 3534593..7233e72 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -697,24 +697,27 @@ intel_parse_bios(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct pci_dev *pdev = dev->pdev;
-	struct bdb_header *bdb = NULL;
+	struct bdb_header __iomem *bdb = NULL;
 	u8 __iomem *bios = NULL;
 
 	init_vbt_defaults(dev_priv);
 
 	/* XXX Should this validation be moved to intel_opregion.c? */
 	if (!dmi_check_system(intel_no_opregion_vbt) && dev_priv->opregion.vbt) {
-		struct vbt_header *vbt = dev_priv->opregion.vbt;
-		if (memcmp(vbt->signature, "$VBT", 4) == 0) {
+		char sig[20];
+		struct vbt_header __iomem *vbt = dev_priv->opregion.vbt;
+		memcpy_fromio(sig, &vbt->signature, sizeof(sig));
+		if (memcmp(sig, "$VBT", 4) == 0) {
 			DRM_DEBUG_KMS("Using VBT from OpRegion: %20s\n",
 					 vbt->signature);
-			bdb = (struct bdb_header *)((char *)vbt + vbt->bdb_offset);
+			bdb = (struct bdb_header __iomem *)((char __iomem *)vbt +
+				ioread32(&vbt->bdb_offset));
 		} else
 			dev_priv->opregion.vbt = NULL;
 	}
 
 	if (bdb == NULL) {
-		struct vbt_header *vbt = NULL;
+		struct vbt_header __iomem *vbt = NULL;
 		size_t size;
 		int i;
 
@@ -724,8 +727,9 @@ intel_parse_bios(struct drm_device *dev)
 
 		/* Scour memory looking for the VBT signature */
 		for (i = 0; i + 4 < size; i++) {
-			if (!memcmp(bios + i, "$VBT", 4)) {
-				vbt = (struct vbt_header *)(bios + i);
+			u32 temp = ioread32(bios + i);
+			if (!memcmp(&temp, "$VBT", 4)) {
+				vbt = (struct vbt_header __iomem *)(bios + i);
 				break;
 			}
 		}
@@ -736,7 +740,7 @@ intel_parse_bios(struct drm_device *dev)
 			return -1;
 		}
 
-		bdb = (struct bdb_header *)(bios + i + vbt->bdb_offset);
+		bdb = (struct bdb_header __iomem *)(bios + i + vbt->bdb_offset);
 	}
 
 	/* Grab useful general definitions */
-- 
1.7.10

  parent reply	other threads:[~2012-04-16 21:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-16 21:07 [PATCH 0/9] i915 fixes for sparse warnings Ben Widawsky
2012-04-16 21:07 ` [PATCH 1/9] drm/i915: [sparse] trivial sparse fixes Ben Widawsky
2012-04-16 21:13   ` Chris Wilson
2012-04-16 21:07 ` [PATCH 2/9] drm/i915: [sparse] don't use variable size arrays Ben Widawsky
2012-04-18  1:39   ` Paulo Zanoni
2012-04-18  2:20     ` Ben Widawsky
2012-04-18  9:05       ` Daniel Vetter
2012-04-16 21:07 ` [PATCH 3/9] drm/i915: [sparse] __iomem fixes for opregion Ben Widawsky
2012-04-16 21:07 ` [PATCH 4/9] drm/i915: [sparse] __iomem fixes for overlay Ben Widawsky
2012-04-16 21:07 ` [PATCH 5/9] drm/i915: [sparse] __iomem fixes for debugfs Ben Widawsky
2012-04-16 21:07 ` [PATCH 6/9] drm/i915: [sparse] __iomem fixes for ringbuffer Ben Widawsky
2012-04-16 21:28   ` Chris Wilson
2012-04-16 21:07 ` [PATCH 7/9] drm/i915: [sparse] forced __iomem ringbuffer fixes Ben Widawsky
2012-04-16 21:07 ` [PATCH 8/9] drm/i915: [sparse] __iomem fixes for gem Ben Widawsky
2012-04-16 21:07 ` Ben Widawsky [this message]
2012-04-21 20:59 ` [PATCH 0/9] i915 fixes for sparse warnings Daniel Vetter

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=1334610468-9274-10-git-send-email-ben@bwidawsk.net \
    --to=ben@bwidawsk.net \
    --cc=benjamin.widawsky@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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