1 /* 2 * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef __UTILS_H__ 8 #define __UTILS_H__ 9 10 #if !ERROR_DEPRECATED 11 #include <utils_def.h> 12 #endif 13 14 /* 15 * C code should be put in this part of the header to avoid breaking ASM files 16 * or linker scripts including it. 17 */ 18 #if !(defined(__LINKER__) || defined(__ASSEMBLY__)) 19 20 #include <types.h> 21 22 /* 23 * Fill a region of normal memory of size "length" in bytes with zero bytes. 24 * 25 * WARNING: This function can only operate on normal memory. This means that 26 * the MMU must be enabled when using this function. Otherwise, use 27 * zeromem. 28 */ 29 void zero_normalmem(void *mem, u_register_t length); 30 31 /* 32 * Fill a region of memory of size "length" in bytes with null bytes. 33 * 34 * Unlike zero_normalmem, this function has no restriction on the type of 35 * memory targeted and can be used for any device memory as well as normal 36 * memory. This function must be used instead of zero_normalmem when MMU is 37 * disabled. 38 * 39 * NOTE: When data cache and MMU are enabled, prefer zero_normalmem for faster 40 * zeroing. 41 */ 42 void zeromem(void *mem, u_register_t length); 43 #endif /* !(defined(__LINKER__) || defined(__ASSEMBLY__)) */ 44 45 #endif /* __UTILS_H__ */ 46