#include <linux/bitfield.h>
#include <linux/init.h>
#include <linux/irqreturn.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/perf_event.h>
#include <linux/platform_device.h>
#include <linux/printk.h>
#include <linux/sysfs.h>
#include <linux/types.h>
#include <soc/amlogic/meson_ddr_pmu.h>
struct ddr_pmu { … };
#define DDR_PERF_DEV_NAME …
#define MAX_AXI_PORTS_OF_CHANNEL …
#define to_ddr_pmu(p) …
#define dmc_info_to_pmu(p) …
static void dmc_pmu_enable(struct ddr_pmu *pmu)
{ … }
static void dmc_pmu_disable(struct ddr_pmu *pmu)
{ … }
static void meson_ddr_set_axi_filter(struct perf_event *event, u8 axi_id)
{ … }
static void ddr_cnt_addition(struct dmc_counter *sum,
struct dmc_counter *add1,
struct dmc_counter *add2,
int chann_nr)
{ … }
static void meson_ddr_perf_event_update(struct perf_event *event)
{ … }
static int meson_ddr_perf_event_init(struct perf_event *event)
{ … }
static void meson_ddr_perf_event_start(struct perf_event *event, int flags)
{ … }
static int meson_ddr_perf_event_add(struct perf_event *event, int flags)
{ … }
static void meson_ddr_perf_event_stop(struct perf_event *event, int flags)
{ … }
static void meson_ddr_perf_event_del(struct perf_event *event, int flags)
{ … }
static ssize_t meson_ddr_perf_cpumask_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static struct device_attribute meson_ddr_perf_cpumask_attr = …;
static struct attribute *meson_ddr_perf_cpumask_attrs[] = …;
static const struct attribute_group ddr_perf_cpumask_attr_group = …;
static ssize_t
pmu_event_show(struct device *dev, struct device_attribute *attr,
char *page)
{ … }
static ssize_t
event_show_unit(struct device *dev, struct device_attribute *attr,
char *page)
{ … }
static ssize_t
event_show_scale(struct device *dev, struct device_attribute *attr,
char *page)
{ … }
#define AML_DDR_PMU_EVENT_ATTR(_name, _id) …
#define AML_DDR_PMU_EVENT_UNIT_ATTR(_name) …
#define AML_DDR_PMU_EVENT_SCALE_ATTR(_name) …
static struct device_attribute event_unit_attrs[] = …;
static struct device_attribute event_scale_attrs[] = …;
static struct perf_pmu_events_attr event_attrs[] = …;
static struct attribute *ddr_perf_events_attrs[COUNTER_MAX_ID * 3];
static struct attribute_group ddr_perf_events_attr_group = …;
static umode_t meson_ddr_perf_format_attr_visible(struct kobject *kobj,
struct attribute *attr,
int n)
{ … }
static struct attribute_group ddr_perf_format_attr_group = …;
static ssize_t meson_ddr_perf_identifier_show(struct device *dev,
struct device_attribute *attr,
char *page)
{ … }
static struct device_attribute meson_ddr_perf_identifier_attr = …;
static struct attribute *meson_ddr_perf_identifier_attrs[] = …;
static const struct attribute_group ddr_perf_identifier_attr_group = …;
static const struct attribute_group *attr_groups[] = …;
static irqreturn_t dmc_irq_handler(int irq, void *dev_id)
{ … }
static int ddr_perf_offline_cpu(unsigned int cpu, struct hlist_node *node)
{ … }
static void fill_event_attr(struct ddr_pmu *pmu)
{ … }
static void fmt_attr_fill(struct attribute **fmt_attr)
{ … }
static int ddr_pmu_parse_dt(struct platform_device *pdev,
struct dmc_info *info)
{ … }
int meson_ddr_pmu_create(struct platform_device *pdev)
{ … }
int meson_ddr_pmu_remove(struct platform_device *pdev)
{ … }