summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGabe Black <gabeblack@chromium.org>2012-01-18 15:44:49 -0800
committerGabe Black (Do Not Use) <gabeblack@google.com>2012-01-18 21:51:18 -0800
commit9c15747348aa2aed0c0192b6c85b65b464b448d5 (patch)
tree4e4c928cf818baa60cbd1784f1b2969ab582d2cd /include
parent29538919a8c0206c320162c061ce2511ea86e1e6 (diff)
Introduce arch_phys_memset which works like memset but on physical memory
The default implementation of this function is just memset, but other implementations will be needed when physical memory isn't accessible by U-Boot using normal addressing mechanisms. BUG=chrome-os-partner:7579 TEST=From the original, larger patch: Built and booted on Lumpy, Stumpy, and Kaen. Looked at the log to see that the regions in high memory are listed as cleared. Artificially injected a range to "clear" with 0xA5 and then 0x5A which was over the framebuffer and covered part or all of the screen on Lumpy. Verified that the screen was partially or completely filled with an appropriate looking color. Had U-Boot print the PDTs it was generating to verify that the high address bits were preserved. Identity mapped only some of memory and verified that things that should be mapped were accessible and things that shouldn't be weren't. Signed-off-by: Gabe Black <gabeblack@google.com> Change-Id: Ie1ba5bbb8ee2847f450d0057611deee397c316cf Reviewed-on: https://gerrit.chromium.org/gerrit/14417 Reviewed-by: Gabe Black (Do Not Use) <gabeblack@google.com> Tested-by: Gabe Black (Do Not Use) <gabeblack@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/physmem.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/physmem.h b/include/physmem.h
new file mode 100644
index 00000000000..03d3a78b741
--- /dev/null
+++ b/include/physmem.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ */
+
+/*
+ * These functions work like memset but operate on physical memory which may
+ * not be accessible directly.
+ *
+ * @param s The physical address to start setting memory at.
+ * @param c The character to set each byte of the region to.
+ * @param n The number of bytes to set.
+ *
+ * @return The physical address of the memory which was set.
+ */
+phys_addr_t arch_phys_memset(phys_addr_t s, int c, phys_size_t n);