From: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
To: seabios@seabios.org
Cc: kvm@vger.kernel.org, mst@redhat.com, joro@8bytes.org,
qemu-devel@nongnu.org, blauwirbel@gmail.com,
yamahata@valinux.co.jp, kevin@koconnor.net, avi@redhat.com,
Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>,
paul@codesourcery.com
Subject: [Qemu-devel] [PATCH 2/4] pci: add foreachcap() helper
Date: Sat, 28 Aug 2010 18:02:56 +0300 [thread overview]
Message-ID: <1283007778-11012-2-git-send-email-eduard.munteanu@linux360.ro> (raw)
In-Reply-To: <1283007778-11012-1-git-send-email-eduard.munteanu@linux360.ro>
This iterates over capabilities exposed by PCI devices. It's needed by
IOMMU initialization code to discover the Secure Device capability.
Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
---
src/pci.h | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/pci.h b/src/pci.h
index 9c3108c..60e0359 100644
--- a/src/pci.h
+++ b/src/pci.h
@@ -2,6 +2,7 @@
#define __PCI_H
#include "types.h" // u32
+#include "pci_regs.h" // PCI_CAPABILITY_LIST et al.
static inline u8 pci_bdf_to_bus(u16 bdf) {
return bdf >> 8;
@@ -52,6 +53,10 @@ int pci_next(int bdf, int *pmax);
for (MAX=0x0100, BDF=pci_next(0, &MAX) \
; BDF >= 0 \
; BDF=pci_next(BDF+1, &MAX))
+#define foreachcap(BDF, PTR, CAP) \
+ for (PTR = PCI_CAPABILITY_LIST, CAP = pci_config_readb(BDF, PTR); \
+ CAP; \
+ PTR = CAP + PCI_CAP_LIST_NEXT, CAP = pci_config_readb(BDF, PTR))
#define foreachpci_in_bus(BDF, MAX, BUS) \
for (MAX = pci_bus_devfn_to_bdf(BUS, 0) + 0x0100, \
--
1.7.1
next parent reply other threads:[~2010-08-28 15:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1283007778-11012-1-git-send-email-eduard.munteanu@linux360.ro>
2010-08-28 15:02 ` Eduard - Gabriel Munteanu [this message]
2010-09-03 2:48 ` [Qemu-devel] Re: [SeaBIOS] [PATCH 2/4] pci: add foreachcap() helper Isaku Yamahata
2010-08-28 15:02 ` [Qemu-devel] [PATCH 3/4] iommu: introduce AMD IOMMU support, initialize it Eduard - Gabriel Munteanu
2010-09-03 2:58 ` [Qemu-devel] Re: [SeaBIOS] " Isaku Yamahata
2010-08-28 15:02 ` [Qemu-devel] [PATCH 4/4] iommu: provide ACPI tables Eduard - Gabriel Munteanu
2010-09-03 2:57 ` [Qemu-devel] Re: [SeaBIOS] " Isaku Yamahata
2010-09-03 2:11 ` [Qemu-devel] Re: [PATCH 1/4] pci: expand tabs to spaces in pci_ids.h and pci_regs.h Kevin O'Connor
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=1283007778-11012-2-git-send-email-eduard.munteanu@linux360.ro \
--to=eduard.munteanu@linux360.ro \
--cc=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=joro@8bytes.org \
--cc=kevin@koconnor.net \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
--cc=seabios@seabios.org \
--cc=yamahata@valinux.co.jp \
/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).