From: Matthew Garrett <mjg@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-pci@vger.kernel.org, linux-efi@vger.kernel.org,
mfleming@intel.com, dwmw2@infradead.org, bhelgaas@google.com,
Matthew Garrett <mjg@redhat.com>
Subject: [PATCH V3 3/4] PCI: Add support for non-BAR ROMs
Date: Thu, 23 Aug 2012 12:36:42 -0400 [thread overview]
Message-ID: <1345739803-21017-4-git-send-email-mjg@redhat.com> (raw)
In-Reply-To: <1345739803-21017-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 | 11 +++++++++--
include/linux/pci.h | 2 ++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 48ebdb2..46026e4 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -118,11 +118,17 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
void __iomem *rom;
/*
+ * Some devices may provide ROMs via a source other than the BAR
+ */
+ if (pdev->rom && pdev->romlen) {
+ *size = pdev->romlen;
+ return phys_to_virt((phys_addr_t)pdev->rom);
+ /*
* IORESOURCE_ROM_SHADOW set on x86, x86_64 and IA64 supports legacy
* memory map if the VGA enable bit of the Bridge Control register is
* set for embedded VGA.
*/
- if (res->flags & IORESOURCE_ROM_SHADOW) {
+ } else if (res->flags & IORESOURCE_ROM_SHADOW) {
/* primary video rom always starts here */
start = (loff_t)0xC0000;
*size = 0x20000; /* cover C000:0 through E000:0 */
@@ -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.11.2
next prev parent reply other threads:[~2012-08-23 16:37 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-23 16:36 Use PCI ROMs from EFI boot services Matthew Garrett
2012-08-23 16:36 ` [PATCH V3 1/4] EFI: Stash ROMs if they're not in the PCI BAR Matthew Garrett
2012-08-23 23:44 ` Bjorn Helgaas
2012-08-24 4:09 ` Matthew Garrett
2012-09-04 13:45 ` Matthew Garrett
2012-09-06 13:59 ` Bjorn Helgaas
2012-09-06 17:36 ` [PATCH] x86: Fix build warning on 32-bit Matthew Garrett
2012-09-06 20:02 ` Bjorn Helgaas
2012-08-23 16:36 ` [PATCH V3 2/4] PCI: Add pcibios_add_device Matthew Garrett
2012-08-23 16:36 ` Matthew Garrett [this message]
2012-09-05 2:18 ` [PATCH V3 3/4] PCI: Add support for non-BAR ROMs Don Dutile
2012-09-05 2:29 ` Matthew Garrett
2012-09-05 12:46 ` Alan Cox
2012-09-05 13:20 ` Matthew Garrett
2012-09-05 13:30 ` Alan Cox
2012-09-05 13:44 ` Matthew Garrett
2012-08-23 16:36 ` [PATCH V3 4/4] X86: Use PCI setup data Matthew Garrett
2012-08-24 9:30 ` Use PCI ROMs from EFI boot services David Woodhouse
2012-08-24 12:53 ` Matthew Garrett
2012-10-25 17:35 ` Bjorn Helgaas
2012-12-03 20:02 ` Seth Forshee
2012-12-05 20:09 ` Bjorn Helgaas
2012-12-05 20:22 ` Matthew Garrett
2012-12-05 22:21 ` Bjorn Helgaas
2012-12-05 21:06 ` David Woodhouse
2012-12-06 0:15 ` Yinghai Lu
2012-12-06 0:18 ` Matthew Garrett
2012-12-06 0:21 ` H. Peter Anvin
2012-12-06 0:30 ` Yinghai Lu
2012-12-06 0:36 ` H. Peter Anvin
2012-12-06 0:57 ` Matthew Garrett
2012-12-06 1:04 ` H. Peter Anvin
2012-12-06 1:13 ` Matthew Garrett
2012-12-06 1:21 ` H. Peter Anvin
2012-12-06 6:19 ` Matthew Garrett
2012-12-06 1:00 ` Matthew Garrett
2012-12-06 0:22 ` Yinghai Lu
2012-12-06 0:23 ` Eric W. Biederman
2012-12-06 0:36 ` H. Peter Anvin
2012-12-06 0:51 ` Yinghai Lu
2012-12-06 0:52 ` Yinghai Lu
2012-12-06 18:19 ` Bjorn Helgaas
2012-12-06 18:26 ` H. Peter Anvin
2012-12-06 18:54 ` Matthew Garrett
2012-12-06 18:57 ` Yinghai Lu
2012-12-06 21:44 ` Bjorn Helgaas
2012-12-06 0:56 ` H. Peter Anvin
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=1345739803-21017-4-git-send-email-mjg@redhat.com \
--to=mjg@redhat.com \
--cc=bhelgaas@google.com \
--cc=dwmw2@infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mfleming@intel.com \
/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).