summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-04-29 11:05:29 +0200
committerMarcelo Tosatti <mtosatti@redhat.com>2011-05-03 16:13:58 -0300
commit8b24dce045c96f1b4e22c948697d6ccfd7152147 (patch)
tree33f94c09d1f20cdd917612b0ba0c4bc5adf9a9d4
parent350bafd50e3d89002dbc6af3d1f2d32b687930a5 (diff)
pci-assign: Move merge_bits
We will need it earlier in the file, so move it unmodified to the top. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--hw/device-assignment.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 0bf93b19d..ea1d7f1e5 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -71,6 +71,28 @@ static void assigned_device_pci_cap_write_config(PCIDevice *pci_dev,
static uint32_t assigned_device_pci_cap_read_config(PCIDevice *pci_dev,
uint32_t address, int len);
+/* Merge the bits set in mask from mval into val. Both val and mval are
+ * at the same addr offset, pos is the starting offset of the mask. */
+static uint32_t merge_bits(uint32_t val, uint32_t mval, uint8_t addr,
+ int len, uint8_t pos, uint32_t mask)
+{
+ if (!ranges_overlap(addr, len, pos, 4)) {
+ return val;
+ }
+
+ if (addr >= pos) {
+ mask >>= (addr - pos) * 8;
+ } else {
+ mask <<= (pos - addr) * 8;
+ }
+ mask &= 0xffffffffU >> (4 - len) * 8;
+
+ val &= ~mask;
+ val |= (mval & mask);
+
+ return val;
+}
+
static uint32_t assigned_dev_ioport_rw(AssignedDevRegion *dev_region,
uint32_t addr, int len, uint32_t *val)
{
@@ -1278,28 +1300,6 @@ static uint8_t find_vndr_start(PCIDevice *pci_dev, uint32_t address)
return cap;
}
-/* Merge the bits set in mask from mval into val. Both val and mval are
- * at the same addr offset, pos is the starting offset of the mask. */
-static uint32_t merge_bits(uint32_t val, uint32_t mval, uint8_t addr,
- int len, uint8_t pos, uint32_t mask)
-{
- if (!ranges_overlap(addr, len, pos, 4)) {
- return val;
- }
-
- if (addr >= pos) {
- mask >>= (addr - pos) * 8;
- } else {
- mask <<= (pos - addr) * 8;
- }
- mask &= 0xffffffffU >> (4 - len) * 8;
-
- val &= ~mask;
- val |= (mval & mask);
-
- return val;
-}
-
static uint32_t assigned_device_pci_cap_read_config(PCIDevice *pci_dev,
uint32_t address, int len)
{