linux-kernel.vger.kernel.org archive mirror
 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 2/3] nouveau: Attempt to use platform-provided ROM image
Date: Tue, 26 Mar 2013 17:25:55 -0400	[thread overview]
Message-ID: <1364333156-4530-2-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/nouveau/core/subdev/bios/base.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
index e816f06..0e2c1a4 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
@@ -248,6 +248,22 @@ nouveau_bios_shadow_pci(struct nouveau_bios *bios)
 	}
 }
 
+static void
+nouveau_bios_shadow_platform(struct nouveau_bios *bios)
+{
+	struct pci_dev *pdev = nv_device(bios)->pdev;
+	size_t size;
+
+	void __iomem *rom = pci_platform_rom(pdev, &size);
+	if (rom && size) {
+		bios->data = kmalloc(size, GFP_KERNEL);
+		if (bios->data) {
+			memcpy_fromio(bios->data, rom, size);
+			bios->size = size;
+		}
+	}
+}
+
 static int
 nouveau_bios_score(struct nouveau_bios *bios, const bool writeable)
 {
@@ -288,6 +304,7 @@ nouveau_bios_shadow(struct nouveau_bios *bios)
 		{ "PROM", nouveau_bios_shadow_prom, false, 0, 0, NULL },
 		{ "ACPI", nouveau_bios_shadow_acpi, true, 0, 0, NULL },
 		{ "PCIROM", nouveau_bios_shadow_pci, true, 0, 0, NULL },
+		{ "PLATFORM", nouveau_bios_shadow_platform, true, 0, 0, NULL },
 		{}
 	};
 	struct methods *mthd, *best;
-- 
1.8.1.2


  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                   ` Matthew Garrett [this message]
2013-03-26 21:25                   ` [PATCH 3/3] radeon: Attempt to use platform-provided ROM image Matthew Garrett
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-2-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 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).