Linux Perf
arm-spe-pkt-decoder.c File Reference
#include <stdio.h>
#include <string.h>
#include <endian.h>
#include <byteswap.h>
#include "arm-spe-pkt-decoder.h"
Include dependency graph for arm-spe-pkt-decoder.c:

Go to the source code of this file.

Macros

#define BIT(n)   (1ULL << (n))
 
#define NS_FLAG   BIT(63)
 
#define EL_FLAG   (BIT(62) | BIT(61))
 
#define SPE_HEADER0_PAD   0x0
 
#define SPE_HEADER0_END   0x1
 
#define SPE_HEADER0_ADDRESS   0x30 /* address packet (short) */
 
#define SPE_HEADER0_ADDRESS_MASK   0x38
 
#define SPE_HEADER0_COUNTER   0x18 /* counter packet (short) */
 
#define SPE_HEADER0_COUNTER_MASK   0x38
 
#define SPE_HEADER0_TIMESTAMP   0x71
 
#define SPE_HEADER0_TIMESTAMP   0x71
 
#define SPE_HEADER0_EVENTS   0x2
 
#define SPE_HEADER0_EVENTS_MASK   0xf
 
#define SPE_HEADER0_SOURCE   0x3
 
#define SPE_HEADER0_SOURCE_MASK   0xf
 
#define SPE_HEADER0_CONTEXT   0x24
 
#define SPE_HEADER0_CONTEXT_MASK   0x3c
 
#define SPE_HEADER0_OP_TYPE   0x8
 
#define SPE_HEADER0_OP_TYPE_MASK   0x3c
 
#define SPE_HEADER1_ALIGNMENT   0x0
 
#define SPE_HEADER1_ADDRESS   0xb0 /* address packet (extended) */
 
#define SPE_HEADER1_ADDRESS_MASK   0xf8
 
#define SPE_HEADER1_COUNTER   0x98 /* counter packet (extended) */
 
#define SPE_HEADER1_COUNTER_MASK   0xf8
 
#define le16_to_cpu   bswap_16
 
#define le32_to_cpu   bswap_32
 
#define le64_to_cpu   bswap_64
 
#define memcpy_le64(d, s, n)
 

Functions

const char * arm_spe_pkt_name (enum arm_spe_pkt_type type)
 
static int payloadlen (unsigned char byte)
 
static int arm_spe_get_payload (const unsigned char *buf, size_t len, struct arm_spe_pkt *packet)
 
static int arm_spe_get_pad (struct arm_spe_pkt *packet)
 
static int arm_spe_get_alignment (const unsigned char *buf, size_t len, struct arm_spe_pkt *packet)
 
static int arm_spe_get_end (struct arm_spe_pkt *packet)
 
static int arm_spe_get_timestamp (const unsigned char *buf, size_t len, struct arm_spe_pkt *packet)
 
static int arm_spe_get_events (const unsigned char *buf, size_t len, struct arm_spe_pkt *packet)
 
static int arm_spe_get_data_source (const unsigned char *buf, size_t len, struct arm_spe_pkt *packet)
 
static int arm_spe_get_context (const unsigned char *buf, size_t len, struct arm_spe_pkt *packet)
 
static int arm_spe_get_op_type (const unsigned char *buf, size_t len, struct arm_spe_pkt *packet)
 
static int arm_spe_get_counter (const unsigned char *buf, size_t len, const unsigned char ext_hdr, struct arm_spe_pkt *packet)
 
static int arm_spe_get_addr (const unsigned char *buf, size_t len, const unsigned char ext_hdr, struct arm_spe_pkt *packet)
 
static int arm_spe_do_get_packet (const unsigned char *buf, size_t len, struct arm_spe_pkt *packet)
 
int arm_spe_get_packet (const unsigned char *buf, size_t len, struct arm_spe_pkt *packet)
 
int arm_spe_pkt_desc (const struct arm_spe_pkt *packet, char *buf, size_t buf_len)
 

Variables

static const char *const arm_spe_packet_name []
 

Macro Definition Documentation

◆ BIT

#define BIT (   n)    (1ULL << (n))

Definition at line 14 of file arm-spe-pkt-decoder.c.

◆ EL_FLAG

#define EL_FLAG   (BIT(62) | BIT(61))

Definition at line 17 of file arm-spe-pkt-decoder.c.

◆ le16_to_cpu

#define le16_to_cpu   bswap_16

Definition at line 42 of file arm-spe-pkt-decoder.c.

◆ le32_to_cpu

#define le32_to_cpu   bswap_32

Definition at line 43 of file arm-spe-pkt-decoder.c.

◆ le64_to_cpu

#define le64_to_cpu   bswap_64

Definition at line 44 of file arm-spe-pkt-decoder.c.

◆ memcpy_le64

#define memcpy_le64 (   d,
  s,
 
)
Value:
do { \
memcpy((d), (s), (n)); \
*(d) = le64_to_cpu(*(d)); \
} while (0)
#define le64_to_cpu

Definition at line 45 of file arm-spe-pkt-decoder.c.

◆ NS_FLAG

#define NS_FLAG   BIT(63)

Definition at line 16 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_ADDRESS

#define SPE_HEADER0_ADDRESS   0x30 /* address packet (short) */

Definition at line 21 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_ADDRESS_MASK

#define SPE_HEADER0_ADDRESS_MASK   0x38

Definition at line 22 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_CONTEXT

#define SPE_HEADER0_CONTEXT   0x24

Definition at line 31 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_CONTEXT_MASK

#define SPE_HEADER0_CONTEXT_MASK   0x3c

Definition at line 32 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_COUNTER

#define SPE_HEADER0_COUNTER   0x18 /* counter packet (short) */

Definition at line 23 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_COUNTER_MASK

#define SPE_HEADER0_COUNTER_MASK   0x38

Definition at line 24 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_END

#define SPE_HEADER0_END   0x1

Definition at line 20 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_EVENTS

#define SPE_HEADER0_EVENTS   0x2

Definition at line 27 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_EVENTS_MASK

#define SPE_HEADER0_EVENTS_MASK   0xf

Definition at line 28 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_OP_TYPE

#define SPE_HEADER0_OP_TYPE   0x8

Definition at line 33 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_OP_TYPE_MASK

#define SPE_HEADER0_OP_TYPE_MASK   0x3c

Definition at line 34 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_PAD

#define SPE_HEADER0_PAD   0x0

Definition at line 19 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_SOURCE

#define SPE_HEADER0_SOURCE   0x3

Definition at line 29 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_SOURCE_MASK

#define SPE_HEADER0_SOURCE_MASK   0xf

Definition at line 30 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_TIMESTAMP [1/2]

#define SPE_HEADER0_TIMESTAMP   0x71

Definition at line 26 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER0_TIMESTAMP [2/2]

#define SPE_HEADER0_TIMESTAMP   0x71

Definition at line 26 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER1_ADDRESS

#define SPE_HEADER1_ADDRESS   0xb0 /* address packet (extended) */

Definition at line 36 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER1_ADDRESS_MASK

#define SPE_HEADER1_ADDRESS_MASK   0xf8

Definition at line 37 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER1_ALIGNMENT

#define SPE_HEADER1_ALIGNMENT   0x0

Definition at line 35 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER1_COUNTER

#define SPE_HEADER1_COUNTER   0x98 /* counter packet (extended) */

Definition at line 38 of file arm-spe-pkt-decoder.c.

◆ SPE_HEADER1_COUNTER_MASK

#define SPE_HEADER1_COUNTER_MASK   0xf8

Definition at line 39 of file arm-spe-pkt-decoder.c.

Function Documentation

◆ arm_spe_do_get_packet()

static int arm_spe_do_get_packet ( const unsigned char *  buf,
size_t  len,
struct arm_spe_pkt packet 
)
static

Definition at line 212 of file arm-spe-pkt-decoder.c.

Here is the call graph for this function:

◆ arm_spe_get_addr()

static int arm_spe_get_addr ( const unsigned char *  buf,
size_t  len,
const unsigned char  ext_hdr,
struct arm_spe_pkt packet 
)
static

Definition at line 195 of file arm-spe-pkt-decoder.c.

◆ arm_spe_get_alignment()

static int arm_spe_get_alignment ( const unsigned char *  buf,
size_t  len,
struct arm_spe_pkt packet 
)
static

Definition at line 112 of file arm-spe-pkt-decoder.c.

◆ arm_spe_get_context()

static int arm_spe_get_context ( const unsigned char *  buf,
size_t  len,
struct arm_spe_pkt packet 
)
static

Definition at line 161 of file arm-spe-pkt-decoder.c.

Here is the call graph for this function:

◆ arm_spe_get_counter()

static int arm_spe_get_counter ( const unsigned char *  buf,
size_t  len,
const unsigned char  ext_hdr,
struct arm_spe_pkt packet 
)
static

Definition at line 178 of file arm-spe-pkt-decoder.c.

◆ arm_spe_get_data_source()

static int arm_spe_get_data_source ( const unsigned char *  buf,
size_t  len,
struct arm_spe_pkt packet 
)
static

Definition at line 154 of file arm-spe-pkt-decoder.c.

Here is the call graph for this function:

◆ arm_spe_get_end()

static int arm_spe_get_end ( struct arm_spe_pkt packet)
static

Definition at line 124 of file arm-spe-pkt-decoder.c.

◆ arm_spe_get_events()

static int arm_spe_get_events ( const unsigned char *  buf,
size_t  len,
struct arm_spe_pkt packet 
)
static

Definition at line 137 of file arm-spe-pkt-decoder.c.

Here is the call graph for this function:

◆ arm_spe_get_op_type()

static int arm_spe_get_op_type ( const unsigned char *  buf,
size_t  len,
struct arm_spe_pkt packet 
)
static

Definition at line 170 of file arm-spe-pkt-decoder.c.

Here is the call graph for this function:

◆ arm_spe_get_packet()

int arm_spe_get_packet ( const unsigned char *  buf,
size_t  len,
struct arm_spe_pkt packet 
)

Definition at line 258 of file arm-spe-pkt-decoder.c.

Here is the call graph for this function:

◆ arm_spe_get_pad()

static int arm_spe_get_pad ( struct arm_spe_pkt packet)
static

Definition at line 106 of file arm-spe-pkt-decoder.c.

◆ arm_spe_get_payload()

static int arm_spe_get_payload ( const unsigned char *  buf,
size_t  len,
struct arm_spe_pkt packet 
)
static

Definition at line 85 of file arm-spe-pkt-decoder.c.

Here is the call graph for this function:

◆ arm_spe_get_timestamp()

static int arm_spe_get_timestamp ( const unsigned char *  buf,
size_t  len,
struct arm_spe_pkt packet 
)
static

Definition at line 130 of file arm-spe-pkt-decoder.c.

Here is the call graph for this function:

◆ arm_spe_pkt_desc()

int arm_spe_pkt_desc ( const struct arm_spe_pkt packet,
char *  buf,
size_t  buf_len 
)

Definition at line 274 of file arm-spe-pkt-decoder.c.

Here is the call graph for this function:

◆ arm_spe_pkt_name()

const char* arm_spe_pkt_name ( enum arm_spe_pkt_type  type)

Definition at line 68 of file arm-spe-pkt-decoder.c.

◆ payloadlen()

static int payloadlen ( unsigned char  byte)
static

Definition at line 80 of file arm-spe-pkt-decoder.c.

Variable Documentation

◆ arm_spe_packet_name

const char* const arm_spe_packet_name[]
static