Merge branch 'lpc32xx/dts' of git://git.antcom.de/linux-2.6 into next/dt
[platform/adaptation/renesas_rcar/renesas_kernel.git] / tools / perf / util / pmu.y
1
2 %name-prefix "perf_pmu_"
3 %parse-param {struct list_head *format}
4 %parse-param {char *name}
5
6 %{
7
8 #include <linux/compiler.h>
9 #include <linux/list.h>
10 #include <linux/bitmap.h>
11 #include <string.h>
12 #include "pmu.h"
13
14 extern int perf_pmu_lex (void);
15
16 #define ABORT_ON(val) \
17 do { \
18         if (val) \
19                 YYABORT; \
20 } while (0)
21
22 %}
23
24 %token PP_CONFIG PP_CONFIG1 PP_CONFIG2
25 %token PP_VALUE PP_ERROR
26 %type <num> PP_VALUE
27 %type <bits> bit_term
28 %type <bits> bits
29
30 %union
31 {
32         unsigned long num;
33         DECLARE_BITMAP(bits, PERF_PMU_FORMAT_BITS);
34 }
35
36 %%
37
38 format:
39 format format_term
40 |
41 format_term
42
43 format_term:
44 PP_CONFIG ':' bits
45 {
46         ABORT_ON(perf_pmu__new_format(format, name,
47                                       PERF_PMU_FORMAT_VALUE_CONFIG,
48                                       $3));
49 }
50 |
51 PP_CONFIG1 ':' bits
52 {
53         ABORT_ON(perf_pmu__new_format(format, name,
54                                       PERF_PMU_FORMAT_VALUE_CONFIG1,
55                                       $3));
56 }
57 |
58 PP_CONFIG2 ':' bits
59 {
60         ABORT_ON(perf_pmu__new_format(format, name,
61                                       PERF_PMU_FORMAT_VALUE_CONFIG2,
62                                       $3));
63 }
64
65 bits:
66 bits ',' bit_term
67 {
68         bitmap_or($$, $1, $3, 64);
69 }
70 |
71 bit_term
72 {
73         memcpy($$, $1, sizeof($1));
74 }
75
76 bit_term:
77 PP_VALUE '-' PP_VALUE
78 {
79         perf_pmu__set_format($$, $1, $3);
80 }
81 |
82 PP_VALUE
83 {
84         perf_pmu__set_format($$, $1, 0);
85 }
86
87 %%
88
89 void perf_pmu_error(struct list_head *list __used,
90                     char *name __used,
91                     char const *msg __used)
92 {
93 }