1 // © 2021 Qualcomm Innovation Center, Inc. All rights reserved. 2 // 3 // SPDX-License-Identifier: BSD-3-Clause 4 5 // FIXME: replace with a selector event 6 typedef error_t (*memdb_fnptr)(paddr_t, size_t, void *); 7 8 // Populate the memory database. If any entry from the range already has an 9 // owner, return error and do not update the database. 10 // 11 // The partition argument is the partition to use for memdb node allocations, 12 // and must always be the hypervisor private partition. 13 error_t 14 memdb_insert(partition_t *partition, paddr_t start_addr, paddr_t end_addr, 15 uintptr_t object, memdb_type_t obj_type); 16 17 // Change the ownership of the input address range. Checks if all entries of 18 // range were pointing to previous object. If so, update all entries to point to 19 // the new object. If not, return error. 20 // 21 // The partition argument is the partition to use for memdb node allocations, 22 // and must always be the hypervisor private partition. 23 error_t 24 memdb_update(partition_t *partition, paddr_t start_addr, paddr_t end_addr, 25 uintptr_t object, memdb_type_t obj_type, uintptr_t prev_object, 26 memdb_type_t prev_type); 27 28 // Find the entry corresponding to the input address and return the object and 29 // type the entry is pointing to. 30 // 31 // This function returns an RCU-protected reference and therefore, it needs to 32 // be called in a RCU critical section and maintain it until we finish using the 33 // returned object. 34 memdb_obj_type_result_t 35 memdb_lookup(paddr_t addr) REQUIRE_RCU_READ; 36 37 // Check if all the entries from the input address range point to the object 38 // passed as an argument 39 bool 40 memdb_is_ownership_contiguous(paddr_t start_addr, paddr_t end_addr, 41 uintptr_t object, memdb_type_t type); 42 43 // Walk through the entire database and add the address ranges that are owned 44 // by the object passed as argument. 45 error_t 46 memdb_walk(uintptr_t object, memdb_type_t type, memdb_fnptr fn, void *arg); 47 48 // Walk through a range of the database and add the address ranges that are 49 // owned by the object passed as argument. 50 error_t 51 memdb_range_walk(uintptr_t object, memdb_type_t type, paddr_t start, 52 paddr_t end, memdb_fnptr fn, void *arg); 53