bzero_phys(src64, bytes);
}
+extern void *secure_memset(void *, int, size_t);
+
/* Zero bytes starting at a physical address */
void
bzero_phys(addr64_t src, vm_size_t bytes)
boolean_t use_copy_window = !pmap_valid_address(src);
pn = (ppnum_t)(src >> PAGE_SHIFT);
+ wimg_bits = pmap_cache_attributes(pn);
#if !defined(__ARM_COHERENT_IO__) && !__ARM_PTE_PHYSMAP__
count = PAGE_SIZE - offset;
- wimg_bits = pmap_cache_attributes(pn);
if ((wimg_bits & VM_WIMG_MASK) != VM_WIMG_DEFAULT) {
use_copy_window = TRUE;
}
#else
if (use_copy_window) {
- wimg_bits = pmap_cache_attributes(pn);
count = PAGE_SIZE - offset;
}
#endif
count = bytes;
}
- bzero(buf, count);
+ switch (wimg_bits & VM_WIMG_MASK) {
+ case VM_WIMG_DEFAULT:
+ case VM_WIMG_WCOMB:
+ case VM_WIMG_INNERWBACK:
+ case VM_WIMG_WTHRU:
+ bzero(buf, count);
+ break;
+ default:
+ /* 'dc zva' performed by bzero is not safe for device memory */
+ secure_memset((void*)buf, 0, count);
+ }
if (use_copy_window) {
pmap_unmap_cpu_windows_copy(index);