[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 02/15] pci: introduce helper functions to clear/s
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH v4 02/15] pci: introduce helper functions to clear/set bits in configuration space |
Date: |
Mon, 18 Oct 2010 12:17:43 +0900 |
This patch introduces helper functions to clear/set bits in configuration
space. pci_{clear_set, clear, set}_bit_{byte, word, long, quad}().
They will be used later.
Signed-off-by: Isaku Yamahata <address@hidden>
---
hw/pci.h | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 72 insertions(+), 0 deletions(-)
diff --git a/hw/pci.h b/hw/pci.h
index d8b399f..eafa9f3 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -323,6 +323,78 @@ pci_config_set_interrupt_pin(uint8_t *pci_config, uint8_t
val)
pci_set_byte(&pci_config[PCI_INTERRUPT_PIN], val);
}
+static inline void
+pci_clear_set_bit_byte(uint8_t *config, uint8_t clear, uint8_t set)
+{
+ pci_set_byte(config, (pci_get_byte(config) & ~clear) | set);
+}
+
+static inline void
+pci_clear_bit_byte(uint8_t *config, uint8_t clear)
+{
+ pci_clear_set_bit_byte(config, clear, 0);
+}
+
+static inline void
+pci_set_bit_byte(uint8_t *config, uint8_t set)
+{
+ pci_clear_set_bit_byte(config, 0, set);
+}
+
+static inline void
+pci_clear_set_bit_word(uint8_t *config, uint16_t clear, uint16_t set)
+{
+ pci_set_word(config, (pci_get_word(config) & ~clear) | set);
+}
+
+static inline void
+pci_clear_bit_word(uint8_t *config, uint16_t clear)
+{
+ pci_clear_set_bit_word(config, clear, 0);
+}
+
+static inline void
+pci_set_bit_word(uint8_t *config, uint16_t set)
+{
+ pci_clear_set_bit_word(config, 0, set);
+}
+
+static inline void
+pci_clear_set_bit_long(uint8_t *config, uint32_t clear, uint32_t set)
+{
+ pci_set_long(config, (pci_get_long(config) & ~clear) | set);
+}
+
+static inline void
+pci_clear_bit_long(uint8_t *config, uint32_t clear)
+{
+ pci_clear_set_bit_long(config, clear, 0);
+}
+
+static inline void
+pci_set_bit_long(uint8_t *config, uint32_t set)
+{
+ pci_clear_set_bit_long(config, 0, set);
+}
+
+static inline void
+pci_clear_set_bit_quad(uint8_t *config, uint64_t clear, uint64_t set)
+{
+ pci_set_quad(config, (pci_get_quad(config) & ~clear) | set);
+}
+
+static inline void
+pci_clear_bit_quad(uint8_t *config, uint64_t clear)
+{
+ pci_clear_set_bit_quad(config, clear, 0);
+}
+
+static inline void
+pci_set_bit_quad(uint8_t *config, uint64_t set)
+{
+ pci_clear_set_bit_quad(config, 0, set);
+}
+
typedef int (*pci_qdev_initfn)(PCIDevice *dev);
typedef struct {
DeviceInfo qdev;
--
1.7.1.1
- [Qemu-devel] Re: [PATCH v4 01/15] pci: make pci_del_capability() update for w1cmask, (continued)
[Qemu-devel] [PATCH v4 02/15] pci: introduce helper functions to clear/set bits in configuration space,
Isaku Yamahata <=
[Qemu-devel] [PATCH v4 07/15] pcie: add pcie constants to pcie_regs.h, Isaku Yamahata, 2010/10/17
[Qemu-devel] [PATCH v4 11/15] ioh3420: pcie root port in X58 ioh, Isaku Yamahata, 2010/10/17
[Qemu-devel] [PATCH v4 04/15] pci: record which is written into pci configuration space, Isaku Yamahata, 2010/10/17
[Qemu-devel] [PATCH v4 13/15] x3130: pcie downstream port, Isaku Yamahata, 2010/10/17
[Qemu-devel] [PATCH v4 03/15] pci: use pci_clear_bit_word() in pci_device_reset(), Isaku Yamahata, 2010/10/17