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