drm/ast: Only warn about unsupported TX chips on Gen4 and later
[drm/drm-misc.git] / tools / perf / util / pmu.y
blob198907a8a48a61fef1386a2a90fa5afcfc8a2d6f
1 %define api.pure full
2 %parse-param {void *format}
3 %parse-param {void *scanner}
4 %lex-param {void* scanner}
6 %{
8 #ifndef NDEBUG
9 #define YYDEBUG 1
10 #endif
12 #include <linux/compiler.h>
13 #include <linux/list.h>
14 #include <linux/bitmap.h>
15 #include <string.h>
16 #include "pmu.h"
17 #include "pmu-bison.h"
19 int perf_pmu_lex(YYSTYPE * yylval_param , void *yyscanner);
21 #define ABORT_ON(val) \
22 do { \
23 if (val) \
24 YYABORT; \
25 } while (0)
27 static void perf_pmu_error(void *format, void *scanner, const char *msg);
29 static void perf_pmu__set_format(unsigned long *bits, long from, long to)
31 long b;
33 if (!to)
34 to = from;
36 memset(bits, 0, BITS_TO_BYTES(PERF_PMU_FORMAT_BITS));
37 for (b = from; b <= to; b++)
38 __set_bit(b, bits);
43 %token PP_CONFIG
44 %token PP_VALUE PP_ERROR
45 %type <num> PP_VALUE
46 %type <bits> bit_term
47 %type <bits> bits
49 %union
51 unsigned long num;
52 DECLARE_BITMAP(bits, PERF_PMU_FORMAT_BITS);
57 format:
58 format format_term
60 format_term
62 format_term:
63 PP_CONFIG ':' bits
65 perf_pmu_format__set_value(format, PERF_PMU_FORMAT_VALUE_CONFIG, $3);
68 PP_CONFIG PP_VALUE ':' bits
70 perf_pmu_format__set_value(format, $2, $4);
73 bits:
74 bits ',' bit_term
76 bitmap_or($$, $1, $3, 64);
79 bit_term
81 memcpy($$, $1, sizeof($1));
84 bit_term:
85 PP_VALUE '-' PP_VALUE
87 perf_pmu__set_format($$, $1, $3);
90 PP_VALUE
92 perf_pmu__set_format($$, $1, 0);
97 static void perf_pmu_error(void *format __maybe_unused,
98 void *scanner __maybe_unused,
99 const char *msg __maybe_unused)