From: Matthew Garrett <mjg@redhat.com>
To: matt.fleming@intel.com
Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
x86@kernel.org, linux-pci@vger.kernel.org, bhelgaas@google.com,
Matthew Garrett <mjg@redhat.com>
Subject: [PATCH 3/4] PCI: Add support for non-BAR ROMs
Date: Thu, 26 Jul 2012 18:02:48 -0400 [thread overview]
Message-ID: <1343340169-7772-4-git-send-email-mjg@redhat.com> (raw)
In-Reply-To: <1343340169-7772-1-git-send-email-mjg@redhat.com>
Platforms may provide their own mechanisms for obtaining ROMs. Add support
for using data provided by the platform in that case.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
---
drivers/pci/rom.c | 9 ++++++++-
include/linux/pci.h | 2 ++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 48ebdb2..7ebaab6 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -126,6 +126,12 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
/* primary video rom always starts here */
start = (loff_t)0xC0000;
*size = 0x20000; /* cover C000:0 through E000:0 */
+ /*
+ * Some devices may provide ROMs via a source other than the BAR
+ */
+ } else if (pdev->rom && pdev->romlen) {
+ *size = pdev->romlen;
+ return phys_to_virt(pdev->rom);
} else {
if (res->flags &
(IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY)) {
@@ -219,7 +225,8 @@ void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom)
if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY))
return;
- iounmap(rom);
+ if (!pdev->rom || !pdev->romlen)
+ iounmap(rom);
/* Disable again before continuing, leave enabled if pci=rom */
if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW)))
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 6a2625c..2668bb9 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -355,6 +355,8 @@ struct pci_dev {
};
struct pci_ats *ats; /* Address Translation Service */
#endif
+ void *rom; /* Physical pointer to ROM if it's not from the BAR */
+ size_t romlen; /* Length of ROM if it's not from the BAR */
};
static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
--
1.7.10.4
next prev parent reply other threads:[~2012-07-26 22:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-26 22:02 efi, x86, pci: Improve graphics support on some Apple hardware Matthew Garrett
2012-07-26 22:02 ` [PATCH 1/4] EFI: Stash ROMs if they're not in the PCI BAR Matthew Garrett
2012-07-27 15:10 ` Seth Forshee
2012-07-26 22:02 ` [PATCH 2/4] PCI: Add pcibios_add_device Matthew Garrett
2012-07-26 22:02 ` Matthew Garrett [this message]
2012-07-27 15:11 ` [PATCH 3/4] PCI: Add support for non-BAR ROMs Seth Forshee
2012-07-26 22:02 ` [PATCH 4/4] X86: Use PCI setup data Matthew Garrett
2012-07-27 3:59 ` efi, x86, pci: Improve graphics support on some Apple hardware Seth Forshee
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=1343340169-7772-4-git-send-email-mjg@redhat.com \
--to=mjg@redhat.com \
--cc=bhelgaas@google.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=matt.fleming@intel.com \
--cc=x86@kernel.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).