[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 32/61] pci: helper functions to access PCIDevice
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] Re: [PATCH 32/61] pci: helper functions to access PCIDevice::config |
Date: |
Wed, 30 Sep 2009 12:47:04 +0200 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
On Wed, Sep 30, 2009 at 07:18:08PM +0900, Isaku Yamahata wrote:
> add helper functions to get/set PCIDevice::config
> Those will be used later.
>
> Signed-off-by: Isaku Yamahata <address@hidden>
> ---
> hw/pci.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 60 insertions(+), 0 deletions(-)
>
> diff --git a/hw/pci.h b/hw/pci.h
> index 460a2b5..e3f5df8 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> @@ -325,6 +325,18 @@ pci_get_long(uint8_t *config)
> }
>
> static inline void
> +pci_set_quad(uint8_t *config, uint64_t val)
> +{
> + cpu_to_le64w((uint64_t *)config, val);
> +}
> +
> +static inline uint64_t
> +pci_get_quad(uint8_t *config)
> +{
> + return le64_to_cpup((uint64_t *)config);
> +}
> +
> +static inline void
> pci_config_set_vendor_id(uint8_t *pci_config, uint16_t val)
> {
> pci_set_word(&pci_config[PCI_VENDOR_ID], val);
These look good, provided they are used.
> @@ -342,6 +354,54 @@ pci_config_set_class(uint8_t *pci_config, uint16_t val)
> pci_set_word(&pci_config[PCI_CLASS_DEVICE], val);
> }
>
> +static inline void
> +pci_config_set_byte(PCIDevice *d, uint32_t addr, uint8_t val)
> +{
> + pci_set_byte(&d->config[addr], val);
> +}
> +
> +static inline void
> +pci_config_set_word(PCIDevice *d, uint32_t addr, uint16_t val)
> +{
> + pci_set_word(&d->config[addr], val);
> +}
> +
> +static inline void
> +pci_config_set_long(PCIDevice *d, uint32_t addr, uint32_t val)
> +{
> + pci_set_long(&d->config[addr], val);
> +}
> +
> +static inline void
> +pci_config_set_quad(PCIDevice *d, uint32_t addr, uint64_t val)
> +{
> + pci_set_quad(&d->config[addr], val);
> +}
> +
> +static inline uint8_t
> +pci_config_get_byte(PCIDevice *d, uint32_t addr)
> +{
> + return pci_get_byte(&d->config[addr]);
> +}
> +
> +static inline uint16_t
> +pci_config_get_word(PCIDevice *d, uint32_t addr)
> +{
> + return pci_get_word(&d->config[addr]);
> +}
> +
> +static inline uint32_t
> +pci_config_get_long(PCIDevice *d, uint32_t addr)
> +{
> + return pci_get_long(&d->config[addr]);
> +}
> +
> +static inline uint64_t
> +pci_config_get_quad(PCIDevice *d, uint32_t addr)
> +{
> + return pci_get_quad(&d->config[addr]);
> +}
> +
These seem like unnecessary wrappers. PCI is all little
endian: both memory and configuration.
> typedef int (*pci_qdev_initfn)(PCIDevice *dev);
> typedef struct {
> DeviceInfo qdev;
> --
> 1.6.0.2
>
>
- [Qemu-devel] [PATCH 00/61] Q35 chip set and stuff., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 07/61] pc, i440fx: Make smm enable/disable function i440fx independent., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 05/61] acpi_piix4: remove unused variable in get_pmsts()., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 32/61] pci: helper functions to access PCIDevice::config, Isaku Yamahata, 2009/09/30
- [Qemu-devel] Re: [PATCH 32/61] pci: helper functions to access PCIDevice::config,
Michael S. Tsirkin <=
- [Qemu-devel] [PATCH 50/61] pci hotadd, acpi_piix4: remove global variables., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 27/61] pci: clean up of pci_update_mappings(), Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 06/61] pc: fix file stream leak in multiboot loader., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 20/61] pci: fix PCI_DPRINTF() wrt variadic macro., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 19/61] pc_piix: initialize ioapic before use., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 31/61] pci: pcie host and mmcfg support., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 02/61] acpi: split out apm register emulation from acpi.c, Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 26/61] pci: 64bit bar support., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 04/61] acpi: split acpi.c into the common part and the piix4 part., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 28/61] pci: factor out while(bus) bus->next loop logic into pci_find_bus_from()., Isaku Yamahata, 2009/09/30