summaryrefslogtreecommitdiffstats
path: root/server/memslot.h
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2013-09-30 15:00:01 +0200
committerFabiano Fidêncio <fidencio@redhat.com>2015-02-23 23:00:40 +0100
commit286a570895c04c3624c403120c20dd54b627fb58 (patch)
tree57adc8d905f3e7b4ea55a61c3286cd5ac4611c1f /server/memslot.h
parentc261e99df0257014c9ec16c76245bffa0fc73ca8 (diff)
downloadspice-286a570895c04c3624c403120c20dd54b627fb58.tar.gz
spice-286a570895c04c3624c403120c20dd54b627fb58.tar.xz
spice-286a570895c04c3624c403120c20dd54b627fb58.zip
server: rename files
Diffstat (limited to 'server/memslot.h')
-rw-r--r--server/memslot.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/server/memslot.h b/server/memslot.h
new file mode 100644
index 00000000..57e2b31f
--- /dev/null
+++ b/server/memslot.h
@@ -0,0 +1,71 @@
+/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+ Copyright (C) 2009,2010 Red Hat, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _H_MEMSLOT
+#define _H_MEMSLOT
+
+#include "common.h"
+
+#include <spice/qxl_dev.h>
+
+typedef struct MemSlot {
+ int generation;
+ unsigned long virt_start_addr;
+ unsigned long virt_end_addr;
+ long address_delta;
+} MemSlot;
+
+typedef struct RedMemSlotInfo {
+ MemSlot **mem_slots;
+ uint32_t num_memslots_groups;
+ uint32_t num_memslots;
+ uint8_t mem_slot_bits;
+ uint8_t generation_bits;
+ uint8_t memslot_id_shift;
+ uint8_t memslot_gen_shift;
+ uint8_t internal_groupslot_id;
+ unsigned long memslot_gen_mask;
+ unsigned long memslot_clean_virt_mask;
+} RedMemSlotInfo;
+
+static inline int memslot_get_id (RedMemSlotInfo *info, uint64_t addr)
+{
+ return addr >> info->memslot_id_shift;
+}
+
+static inline int memslot_get_generation (RedMemSlotInfo *info, uint64_t addr)
+{
+ return (addr >> info->memslot_gen_shift) & info->memslot_gen_mask;
+}
+
+int memslot_validate_virt (RedMemSlotInfo *info, unsigned long virt, int slot_id,
+ uint32_t add_size, uint32_t group_id);
+unsigned long memslot_get_virt (RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size,
+ int group_id, int *error);
+void memslot_info_init (RedMemSlotInfo *info,
+ uint32_t num_groups, uint32_t num_slots,
+ uint8_t generation_bits,
+ uint8_t id_bits,
+ uint8_t internal_groupslot_id);
+void memslot_info_add_slot (RedMemSlotInfo *info, uint32_t slot_group_id, uint32_t slot_id,
+ uint64_t addr_delta, unsigned long virt_start, unsigned long virt_end,
+ uint32_t generation);
+void memslot_info_del_slot (RedMemSlotInfo *info, uint32_t slot_group_id, uint32_t slot_id);
+void memslot_info_reset (RedMemSlotInfo *info);
+
+#endif /* MEMSLOT_H_ */