@ -42,6 +42,8 @@ struct iotrace_record {
* @ start : Start address of iotrace buffer
* @ start : Start address of iotrace buffer
* @ size : Size of iotrace buffer in bytes
* @ size : Size of iotrace buffer in bytes
* @ offset : Current write offset into iotrace buffer
* @ 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
* @ crc32 : Current value of CRC chceksum of trace records
* @ enabled : true if enabled , false if disabled
* @ enabled : true if enabled , false if disabled
*/
*/
@ -49,6 +51,8 @@ static struct iotrace {
ulong start ;
ulong start ;
ulong size ;
ulong size ;
ulong offset ;
ulong offset ;
ulong region_start ;
ulong region_size ;
u32 crc32 ;
u32 crc32 ;
bool enabled ;
bool enabled ;
} iotrace ;
} iotrace ;
@ -66,6 +70,11 @@ static void add_record(int flags, const void *ptr, ulong value)
if ( ! ( gd - > flags & GD_FLG_RELOC ) | | ! iotrace . enabled )
if ( ! ( gd - > flags & GD_FLG_RELOC ) | | ! iotrace . enabled )
return ;
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 */
/* Store it if there is room */
if ( iotrace . offset + sizeof ( * rec ) < iotrace . size ) {
if ( iotrace . offset + sizeof ( * rec ) < iotrace . size ) {
rec = ( struct iotrace_record * ) map_sysmem (
rec = ( struct iotrace_record * ) map_sysmem (
@ -142,6 +151,24 @@ u32 iotrace_get_checksum(void)
return iotrace . crc32 ;
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 )
void iotrace_set_enabled ( int enable )
{
{
iotrace . enabled = enable ;
iotrace . enabled = enable ;