diff mbox

[07/25] pci: helper functions to access PCIDevice::config

Message ID 1254514577-11896-8-git-send-email-yamahata@valinux.co.jp
State Superseded
Headers show

Commit Message

Isaku Yamahata Oct. 2, 2009, 8:15 p.m. UTC
add helper functions to get/set PCIDevice::config
Those will be used later.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/pci.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

Comments

Michael S. Tsirkin Oct. 4, 2009, 9:48 a.m. UTC | #1
On Sat, Oct 03, 2009 at 05:15:59AM +0900, Isaku Yamahata wrote:
> add helper functions to get/set PCIDevice::config
> Those will be used later.
> 
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  hw/pci.h |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/pci.h b/hw/pci.h
> index 00c8947..e79540a 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> @@ -310,6 +310,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);
> -- 
> 1.6.0.2
> 
>
diff mbox

Patch

diff --git a/hw/pci.h b/hw/pci.h
index 00c8947..e79540a 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -310,6 +310,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);