2023-04-06 14:52:23 +08:00
|
|
|
%define api.pure full
|
2012-03-16 03:09:17 +08:00
|
|
|
%parse-param {struct list_head *format}
|
|
|
|
%parse-param {char *name}
|
2023-04-06 14:52:23 +08:00
|
|
|
%parse-param {void *scanner}
|
|
|
|
%lex-param {void* scanner}
|
2012-03-16 03:09:17 +08:00
|
|
|
|
|
|
|
%{
|
|
|
|
|
|
|
|
#include <linux/compiler.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/bitmap.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "pmu.h"
|
|
|
|
|
|
|
|
#define ABORT_ON(val) \
|
|
|
|
do { \
|
|
|
|
if (val) \
|
|
|
|
YYABORT; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
%}
|
|
|
|
|
2022-10-05 03:12:35 +08:00
|
|
|
%token PP_CONFIG
|
2012-03-16 03:09:17 +08:00
|
|
|
%token PP_VALUE PP_ERROR
|
|
|
|
%type <num> PP_VALUE
|
|
|
|
%type <bits> bit_term
|
|
|
|
%type <bits> bits
|
|
|
|
|
|
|
|
%union
|
|
|
|
{
|
|
|
|
unsigned long num;
|
|
|
|
DECLARE_BITMAP(bits, PERF_PMU_FORMAT_BITS);
|
|
|
|
}
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
format:
|
|
|
|
format format_term
|
|
|
|
|
|
|
|
|
format_term
|
|
|
|
|
|
|
|
format_term:
|
|
|
|
PP_CONFIG ':' bits
|
|
|
|
{
|
|
|
|
ABORT_ON(perf_pmu__new_format(format, name,
|
|
|
|
PERF_PMU_FORMAT_VALUE_CONFIG,
|
|
|
|
$3));
|
|
|
|
}
|
|
|
|
|
|
2022-10-05 03:12:35 +08:00
|
|
|
PP_CONFIG PP_VALUE ':' bits
|
2012-03-16 03:09:17 +08:00
|
|
|
{
|
|
|
|
ABORT_ON(perf_pmu__new_format(format, name,
|
2022-10-05 03:12:35 +08:00
|
|
|
$2,
|
|
|
|
$4));
|
2012-03-16 03:09:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bits:
|
|
|
|
bits ',' bit_term
|
|
|
|
{
|
|
|
|
bitmap_or($$, $1, $3, 64);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
bit_term
|
|
|
|
{
|
|
|
|
memcpy($$, $1, sizeof($1));
|
|
|
|
}
|
|
|
|
|
|
|
|
bit_term:
|
|
|
|
PP_VALUE '-' PP_VALUE
|
|
|
|
{
|
|
|
|
perf_pmu__set_format($$, $1, $3);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
PP_VALUE
|
|
|
|
{
|
|
|
|
perf_pmu__set_format($$, $1, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
2012-09-11 06:15:03 +08:00
|
|
|
void perf_pmu_error(struct list_head *list __maybe_unused,
|
|
|
|
char *name __maybe_unused,
|
2023-04-06 14:52:23 +08:00
|
|
|
void *scanner __maybe_unused,
|
2012-09-11 06:15:03 +08:00
|
|
|
char const *msg __maybe_unused)
|
2012-03-16 03:09:17 +08:00
|
|
|
{
|
|
|
|
}
|