diff options
Diffstat (limited to 'common/iotrace.c')
-rw-r--r-- | common/iotrace.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/common/iotrace.c b/common/iotrace.c index b16b0d612d..2f03a6082e 100644 --- a/common/iotrace.c +++ b/common/iotrace.c @@ -27,11 +27,13 @@ enum iotrace_flags { * struct iotrace_record - Holds a single I/O trace record * * @flags: I/O access type + * @timestamp: Timestamp of access * @addr: Address of access * @value: Value written or read */ struct iotrace_record { enum iotrace_flags flags; + u64 timestamp; phys_addr_t addr; iovalue_t value; }; @@ -42,6 +44,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 +53,8 @@ static struct iotrace { ulong start; ulong size; ulong offset; + ulong region_start; + ulong region_size; u32 crc32; bool enabled; } iotrace; @@ -66,13 +72,18 @@ 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( iotrace.start + iotrace.offset, sizeof(value)); } - + rec->timestamp = timer_get_us(); rec->flags = flags; rec->addr = map_to_sysmem(ptr); rec->value = value; @@ -142,6 +153,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; |