aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamon Fried <ramon.fried@gmail.com>2018-05-30 23:09:58 +0300
committerTom Rini <trini@konsulko.com>2018-06-07 17:08:06 -0400
commita74440b27b3f12d2cce54d7910953af19f1ac051 (patch)
tree3ba514ce64e860097787783dcc52410705e97cf6
parentb559c4af803fe22bef09a4e879fd8605391767f3 (diff)
downloadu-boot-a74440b27b3f12d2cce54d7910953af19f1ac051.tar.gz
iotrace: add IO region limit
When dealing with a lot of IO regions, sometimes it makes sense only to trace a specific one. This patch adds support for region limits. If region is not set, the iotrace works the same as it was. If region is set, the iotrace only logs io operation that falls in the defined region. Signed-off-by: Ramon Fried <ramon.fried@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--common/iotrace.c27
-rw-r--r--include/iotrace.h24
2 files changed, 51 insertions, 0 deletions
diff --git a/common/iotrace.c b/common/iotrace.c
index b16b0d612dd..f39885663a3 100644
--- a/common/iotrace.c
+++ b/common/iotrace.c
@@ -42,6 +42,8 @@ struct iotrace_record {
* @start: Start address of iotrace buffer
* @size: Size of iotrace buffer in bytes
* @offset: Current write offset into iotrace buffer
+ * @region_start: Address of IO region to trace
+ * @region_size: Size of region to trace. if 0 will trace all address space
* @crc32: Current value of CRC chceksum of trace records
* @enabled: true if enabled, false if disabled
*/
@@ -49,6 +51,8 @@ static struct iotrace {
ulong start;
ulong size;
ulong offset;
+ ulong region_start;
+ ulong region_size;
u32 crc32;
bool enabled;
} iotrace;
@@ -66,6 +70,11 @@ static void add_record(int flags, const void *ptr, ulong value)
if (!(gd->flags & GD_FLG_RELOC) || !iotrace.enabled)
return;
+ if (iotrace.region_size)
+ if ((ulong)ptr < iotrace.region_start ||
+ (ulong)ptr > iotrace.region_start + iotrace.region_size)
+ return;
+
/* Store it if there is room */
if (iotrace.offset + sizeof(*rec) < iotrace.size) {
rec = (struct iotrace_record *)map_sysmem(
@@ -142,6 +151,24 @@ u32 iotrace_get_checksum(void)
return iotrace.crc32;
}
+void iotrace_set_region(ulong start, ulong size)
+{
+ iotrace.region_start = start;
+ iotrace.region_size = size;
+}
+
+void iotrace_reset_region(void)
+{
+ iotrace.region_start = 0;
+ iotrace.region_size = 0;
+}
+
+void iotrace_get_region(ulong *start, ulong *size)
+{
+ *start = iotrace.region_start;
+ *size = iotrace.region_size;
+}
+
void iotrace_set_enabled(int enable)
{
iotrace.enabled = enable;
diff --git a/include/iotrace.h b/include/iotrace.h
index 9fe5733f877..1efb117343a 100644
--- a/include/iotrace.h
+++ b/include/iotrace.h
@@ -59,6 +59,30 @@ void iotrace_reset_checksum(void);
u32 iotrace_get_checksum(void);
/**
+ * iotrace_set_region() - Set whether iotrace is limited to a specific
+ * io region.
+ *
+ * Defines the address and size of the limited region.
+ *
+ * @start: address of the beginning of the region
+ * @size: size of the region in bytes.
+ */
+void iotrace_set_region(ulong start, ulong size);
+
+/**
+ * iotrace_reset_region() - Reset the region limit
+ */
+void iotrace_reset_region(void);
+
+/**
+ * iotrace_get_region() - Get region information
+ *
+ * @start: Returns start address of region
+ * @size: Returns size of region in bytes
+ */
+void iotrace_get_region(ulong *start, ulong *size);
+
+/**
* iotrace_set_enabled() - Set whether iotracing is enabled or not
*
* This controls whether the checksum is updated and a trace record added