Re: [PATCH RFC 05/15] pci/x86: Rename pci_config_read() to pci_config_readl()

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

 



On Wed, Apr 13, 2016 at 02:55:39PM +0200, Thomas Huth wrote:
> On 11.04.2016 13:04, Alexander Gordeev wrote:
> > This is needed to facilitate other-sized PCI configuration
> > space accessors, not just 32 bit one.
> > 
> > Cc: Thomas Huth <thuth@xxxxxxxxxx>
> > Cc: Andrew Jones <drjones@xxxxxxxxxx>
> > Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx>
> > ---
> >  lib/pci.c         | 8 ++++----
> >  lib/x86/asm/pci.h | 2 +-
> >  2 files changed, 5 insertions(+), 5 deletions(-)
> ...
> > diff --git a/lib/x86/asm/pci.h b/lib/x86/asm/pci.h
> > index 4ec20e17d25b..d10a32c38dd5 100644
> > --- a/lib/x86/asm/pci.h
> > +++ b/lib/x86/asm/pci.h
> > @@ -9,7 +9,7 @@
> >  #include "pci.h"
> >  #include "x86/io.h"
> >  
> > -static inline uint32_t pci_config_read(pcidevaddr_t dev, uint8_t reg)
> > +static inline uint32_t pci_config_readl(pcidevaddr_t dev, uint8_t reg)
> >  {
> >      uint32_t index = reg | (dev << 8) | (0x1 << 31);
> >      outl(index, 0xCF8);
> 
> Did you consider "pci_config_read32" instead? ... that would be even
> more clear about the size. Anyway, I'm also fine with "readl", so:

Actually, yes. I considered mimicking Linux ones:

int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val);
int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val);
int pci_read_config_dword(const struct pci_dev *dev, int where, u32 *val);
int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val);
int pci_write_config_word(const struct pci_dev *dev, int where, u16 val);
int pci_write_config_dword(const struct pci_dev *dev, int where, u32 val);

But these are (a) take 'struct pci_dev *' as a parameter and (b) can
report a failure. So I was indecisive wrt naming - at least until the
trade-off between 'struct pci_dev *' vs pcidevaddr_t is finalized.

For now, the PCI accessor names mimick "seabios" ones and kind of
correlate vs IO accessors: pci_config_readl <-> readl etc.

> Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx>
> 
--
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