summaryrefslogtreecommitdiffstats
path: root/qemu-objects.h
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2012-02-21 15:41:30 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2012-02-22 09:02:18 -0600
commitc9f50cea70a15967daec9bf48fed37eafefdd584 (patch)
tree3d14f1e549df1454dcaf6eab695e40c3387d4fb3 /qemu-objects.h
parent358b54654aa85f97402aca4be3b1a7b7d08bab70 (diff)
downloadhqemu-c9f50cea70a15967daec9bf48fed37eafefdd584.zip
hqemu-c9f50cea70a15967daec9bf48fed37eafefdd584.tar.gz
pci: add accessors to get/set registers by mask
pci_regs.h specifies many registers by mask + shifted register values. There's always some duplication when using such: for example to override device type, we would need: pci_word_test_and_clear_mask(cap + PCI_EXP_FLAGS, PCI_EXP_FLAGS_TYPE); pci_word_test_and_set_mask(cap + PCI_EXP_FLAGS, PCI_EXP_TYPE_ENDPOINT << (ffs(PCI_EXP_FLAGS_TYPE) - 1)); Getting such registers also uses some duplication: word = pci_get_word(cap + PCI_EXP_FLAGS) & PCI_EXP_FLAGS_TYPE; if ((word >> ffs((PCI_EXP_FLAGS_TYPE) - 1)) == PCI_EXP_TYPE_ENDPOINT) Add API to access such registers in one line: pci_set_word_by_mask(cap + PCI_EXP_FLAGS, PCI_EXP_FLAGS_TYPE, PCI_EXP_TYPE_ENDPOINT) and word = pci_get_word_by_mask(cap + PCI_EXP_FLAGS, PCI_EXP_FLAGS_TYPE) if (word == PCI_EXP_TYPE_ENDPOINT) Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qemu-objects.h')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud