From patchwork Fri Oct 9 06:28:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [V5,05/29] pci: helper functions to access PCIDevice::config Date: Thu, 08 Oct 2009 20:28:38 -0000 From: Isaku Yamahata X-Patchwork-Id: 35561 Message-Id: <1255069742-15724-6-git-send-email-yamahata@valinux.co.jp> To: qemu-devel@nongnu.org, mst@redhat.com Cc: yamahata@valinux.co.jp add helper functions to get/set PCIDevice::config Those will be used later. Signed-off-by: Isaku Yamahata Acked-by: Michael S. Tsirkin --- hw/pci.h | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/hw/pci.h b/hw/pci.h index bab9cab..157995c 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -312,6 +312,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);