All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Garrett <matthew.garrett@nebula.com>
To: airlied@gmail.com
Cc: alexander.deucher@amd.com, skeggsb@gmail.com,
	linux-kernel@vger.kernel.org, seth.forshee@canonical.com,
	bhelgaas@google.com, grawity@gmail.com,
	torvalds@linux-foundation.org,
	Matthew Garrett <matthew.garrett@nebula.com>
Subject: [PATCH 3/3] radeon: Attempt to use platform-provided ROM image
Date: Tue, 26 Mar 2013 17:25:56 -0400	[thread overview]
Message-ID: <1364333156-4530-3-git-send-email-matthew.garrett@nebula.com> (raw)
In-Reply-To: <1364333156-4530-1-git-send-email-matthew.garrett@nebula.com>

Some platforms only provide their PCI ROM via a platform-specific interface.
Fall back to attempting that if all other sources fail.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
---
 drivers/gpu/drm/radeon/radeon_bios.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index b801591..fa3c56f 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -99,6 +99,29 @@ static bool radeon_read_bios(struct radeon_device *rdev)
 	return true;
 }
 
+static bool radeon_read_platform_bios(struct radeon_device *rdev)
+{
+	uint8_t __iomem *bios;
+	size_t size;
+
+	rdev->bios = NULL;
+
+	bios = pci_platform_rom(rdev->pdev, &size);
+	if (!bios) {
+		return false;
+	}
+
+	if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
+		return false;
+	}
+	rdev->bios = kmemdup(bios, size, GFP_KERNEL);
+	if (rdev->bios == NULL) {
+		return false;
+	}
+
+	return true;
+}
+
 #ifdef CONFIG_ACPI
 /* ATRM is used to get the BIOS on the discrete cards in
  * dual-gpu systems.
@@ -620,6 +643,9 @@ bool radeon_get_bios(struct radeon_device *rdev)
 	if (r == false) {
 		r = radeon_read_disabled_bios(rdev);
 	}
+	if (r == false) {
+		r = radeon_read_platform_bios(rdev);
+	}
 	if (r == false || rdev->bios == NULL) {
 		DRM_ERROR("Unable to locate a BIOS ROM\n");
 		rdev->bios = NULL;
-- 
1.8.1.2


  parent reply	other threads:[~2013-03-26 21:26 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-21 23:09 Regression: Screen turns off when booting in EFI mode Mantas Mikulėnas
2013-02-21 23:54 ` Dave Airlie
2013-02-22  1:03   ` Mantas Mikulėnas
2013-03-09 21:42     ` Mantas Mikulėnas
2013-03-19 17:09       ` Linus Torvalds
2013-03-19 17:58         ` Linus Torvalds
2013-03-19 19:31         ` Mantas Mikulėnas
2013-03-19 19:59         ` Matthew Garrett
2013-03-19 20:20           ` Linus Torvalds
2013-03-19 21:16             ` Mantas Mikulėnas
2013-03-19 21:26               ` [PATCH] PCI: Use ROM images from firmware only if no other ROM source available Matthew Garrett
2013-03-25 23:52               ` Regression: Screen turns off when booting in EFI mode Dave Airlie
2013-03-25 23:55                 ` Matthew Garrett
2013-03-27 19:29                   ` Bjorn Helgaas
2013-03-27 20:02                     ` Dave Airlie
2013-03-27 20:28                       ` Bjorn Helgaas
2013-03-26 21:25                 ` [PATCH 1/3] pci: Add PCI ROM helper for platform-provided ROM images Matthew Garrett
2013-03-26 21:25                   ` [PATCH 2/3] nouveau: Attempt to use platform-provided ROM image Matthew Garrett
2013-03-26 21:25                   ` Matthew Garrett [this message]
2013-03-26 22:53                   ` [PATCH 1/3] pci: Add PCI ROM helper for platform-provided ROM images Bjorn Helgaas
2013-03-26 22:55                     ` Matthew Garrett
2013-03-27 20:33                       ` Bjorn Helgaas
2013-03-27 20:34                         ` Bjorn Helgaas
2013-03-28  8:48                         ` Mantas Mikulėnas
2013-04-01 17:39                           ` Bjorn Helgaas
2013-04-01 17:47                             ` Matthew Garrett
2013-04-02 20:10                               ` Bjorn Helgaas
2013-04-05 20:31                                 ` Chris Murphy
2013-04-05 20:35                                   ` Bjorn Helgaas
2013-04-05 22:28                                     ` Chris Murphy

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=1364333156-4530-3-git-send-email-matthew.garrett@nebula.com \
    --to=matthew.garrett@nebula.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=bhelgaas@google.com \
    --cc=grawity@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seth.forshee@canonical.com \
    --cc=skeggsb@gmail.com \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.