Re: [SeaBIOS] [PATCH 2/4] pci: add foreachcap() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Given the usage of 3/4, u32 pci_find_capability(bdf, cap) would be more direct.
Maybe this is a matter of taste, though.

On Sat, Aug 28, 2010 at 06:02:56PM +0300, Eduard - Gabriel Munteanu wrote:
> 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@xxxxxxxxxxx>
> ---
>  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
> 
> 
> _______________________________________________
> SeaBIOS mailing list
> SeaBIOS@xxxxxxxxxxx
> http://www.seabios.org/mailman/listinfo/seabios
> 

-- 
yamahata
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux