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 4/4] X86: Use PCI setup data
Date: Thu, 26 Jul 2012 18:02:49 -0400 [thread overview]
Message-ID: <1343340169-7772-5-git-send-email-mjg@redhat.com> (raw)
In-Reply-To: <1343340169-7772-1-git-send-email-mjg@redhat.com>
EFI can provide PCI ROMs out of band via boot services, which may not be
available after boot. Add support for using the data handed off to us by
the boot stub or bootloader.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
---
arch/x86/pci/common.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 720e973f..3d2752f 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -17,6 +17,7 @@
#include <asm/io.h>
#include <asm/smp.h>
#include <asm/pci_x86.h>
+#include <asm/setup.h>
unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 |
PCI_PROBE_MMCONF;
@@ -608,6 +609,38 @@ unsigned int pcibios_assign_all_busses(void)
return (pci_probe & PCI_ASSIGN_ALL_BUSSES) ? 1 : 0;
}
+int pcibios_add_device(struct pci_dev *dev)
+{
+ struct setup_data *data;
+ struct pci_setup_rom *rom;
+ u64 pa_data;
+
+ if (boot_params.hdr.version < 0x0209)
+ return 0;
+
+ pa_data = boot_params.hdr.setup_data;
+ while (pa_data) {
+ data = phys_to_virt(pa_data);
+
+ if (data->type == SETUP_PCI) {
+ rom = (struct pci_setup_rom *)data;
+
+ if ((pci_domain_nr(dev->bus) == rom->segment) &&
+ (dev->bus->number == rom->bus) &&
+ (PCI_SLOT(dev->devfn) == rom->device) &&
+ (PCI_FUNC(dev->devfn) == rom->function) &&
+ (dev->vendor == rom->vendor) &&
+ (dev->device == rom->devid)) {
+ dev->rom = (void *)(pa_data +
+ offsetof(struct pci_setup_rom, romdata));
+ dev->romlen = rom->pcilen;
+ }
+ }
+ pa_data = data->next;
+ }
+ return 0;
+}
+
int pcibios_enable_device(struct pci_dev *dev, int mask)
{
int err;
--
1.7.10.4
next prev parent reply other threads:[~2012-07-26 22:02 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 ` [PATCH 3/4] PCI: Add support for non-BAR ROMs Matthew Garrett
2012-07-27 15:11 ` Seth Forshee
2012-07-26 22:02 ` Matthew Garrett [this message]
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-5-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).