cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

i2c_slave.h (1888B)


      1/* SPDX-License-Identifier: GPL-2.0-or-later */
      2/*
      3 * I2C slave tracepoints
      4 *
      5 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
      6 */
      7#undef TRACE_SYSTEM
      8#define TRACE_SYSTEM i2c_slave
      9
     10#if !defined(_TRACE_I2C_SLAVE_H) || defined(TRACE_HEADER_MULTI_READ)
     11#define _TRACE_I2C_SLAVE_H
     12
     13#include <linux/i2c.h>
     14#include <linux/tracepoint.h>
     15
     16TRACE_DEFINE_ENUM(I2C_SLAVE_READ_REQUESTED);
     17TRACE_DEFINE_ENUM(I2C_SLAVE_WRITE_REQUESTED);
     18TRACE_DEFINE_ENUM(I2C_SLAVE_READ_PROCESSED);
     19TRACE_DEFINE_ENUM(I2C_SLAVE_WRITE_RECEIVED);
     20TRACE_DEFINE_ENUM(I2C_SLAVE_STOP);
     21
     22#define show_event_type(type)						\
     23	__print_symbolic(type,						\
     24		{ I2C_SLAVE_READ_REQUESTED,	"RD_REQ" },		\
     25		{ I2C_SLAVE_WRITE_REQUESTED,	"WR_REQ" },		\
     26		{ I2C_SLAVE_READ_PROCESSED,	"RD_PRO" },		\
     27		{ I2C_SLAVE_WRITE_RECEIVED,	"WR_RCV" },		\
     28		{ I2C_SLAVE_STOP,		"  STOP" })
     29
     30TRACE_EVENT(i2c_slave,
     31	TP_PROTO(const struct i2c_client *client, enum i2c_slave_event event,
     32		 __u8 *val, int cb_ret),
     33	TP_ARGS(client, event, val, cb_ret),
     34	TP_STRUCT__entry(
     35		__field(int,				adapter_nr	)
     36		__field(int,				ret		)
     37		__field(__u16,				addr		)
     38		__field(__u16,				len		)
     39		__field(enum i2c_slave_event,		event		)
     40		__array(__u8,				buf,	1)	),
     41
     42	TP_fast_assign(
     43		__entry->adapter_nr = client->adapter->nr;
     44		__entry->addr = client->addr;
     45		__entry->event = event;
     46		__entry->ret = cb_ret;
     47		switch (event) {
     48		case I2C_SLAVE_READ_REQUESTED:
     49		case I2C_SLAVE_READ_PROCESSED:
     50		case I2C_SLAVE_WRITE_RECEIVED:
     51			__entry->len = 1;
     52			memcpy(__entry->buf, val, __entry->len);
     53			break;
     54		default:
     55			__entry->len = 0;
     56			break;
     57		}
     58		),
     59	TP_printk("i2c-%d a=%03x ret=%d %s [%*phD]",
     60		__entry->adapter_nr, __entry->addr, __entry->ret,
     61		show_event_type(__entry->event), __entry->len, __entry->buf
     62		));
     63
     64#endif /* _TRACE_I2C_SLAVE_H */
     65
     66/* This part must be outside protection */
     67#include <trace/define_trace.h>