diff options
Diffstat (limited to 'tests/libqos')
-rw-r--r-- | tests/libqos/ahci.c | 18 | ||||
-rw-r--r-- | tests/libqos/ahci.h | 1 | ||||
-rw-r--r-- | tests/libqos/malloc.c | 5 | ||||
-rw-r--r-- | tests/libqos/malloc.h | 1 |
4 files changed, 25 insertions, 0 deletions
diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c index 8522224..a6105c7 100644 --- a/tests/libqos/ahci.c +++ b/tests/libqos/ahci.c @@ -130,6 +130,24 @@ void free_ahci_device(QPCIDevice *dev) qpci_free_pc(pcibus); } +/* Free all memory in-use by the AHCI device. */ +void ahci_clean_mem(AHCIQState *ahci) +{ + uint8_t port, slot; + + for (port = 0; port < 32; ++port) { + if (ahci->port[port].fb) { + ahci_free(ahci, ahci->port[port].fb); + } + if (ahci->port[port].clb) { + for (slot = 0; slot < 32; slot++) { + ahci_destroy_command(ahci, port, slot); + } + ahci_free(ahci, ahci->port[port].clb); + } + } +} + /*** Logical Device Initialization ***/ /** diff --git a/tests/libqos/ahci.h b/tests/libqos/ahci.h index 9133033..39b99d3 100644 --- a/tests/libqos/ahci.h +++ b/tests/libqos/ahci.h @@ -499,6 +499,7 @@ uint64_t ahci_alloc(AHCIQState *ahci, size_t bytes); void ahci_free(AHCIQState *ahci, uint64_t addr); QPCIDevice *get_ahci_device(uint32_t *fingerprint); void free_ahci_device(QPCIDevice *dev); +void ahci_clean_mem(AHCIQState *ahci); void ahci_pci_enable(AHCIQState *ahci); void start_ahci_device(AHCIQState *ahci); void ahci_hba_enable(AHCIQState *ahci); diff --git a/tests/libqos/malloc.c b/tests/libqos/malloc.c index 42e3434..67f3190 100644 --- a/tests/libqos/malloc.c +++ b/tests/libqos/malloc.c @@ -324,3 +324,8 @@ void alloc_set_page_size(QGuestAllocator *allocator, size_t page_size) g_assert(is_power_of_2(page_size)); allocator->page_size = page_size; } + +void alloc_set_flags(QGuestAllocator *allocator, QAllocOpts opts) +{ + allocator->opts |= opts; +} diff --git a/tests/libqos/malloc.h b/tests/libqos/malloc.h index a39dba4..71ac407 100644 --- a/tests/libqos/malloc.h +++ b/tests/libqos/malloc.h @@ -36,5 +36,6 @@ QGuestAllocator *alloc_init(uint64_t start, uint64_t end); QGuestAllocator *alloc_init_flags(QAllocOpts flags, uint64_t start, uint64_t end); void alloc_set_page_size(QGuestAllocator *allocator, size_t page_size); +void alloc_set_flags(QGuestAllocator *allocator, QAllocOpts opts); #endif |