parlib: Fix the use-after-func issue
[akaros.git] / user / perfmon / pfmlib_amd64_fam14h.c
1 /*
2  * pfmlib_amd64_fam14h.c : AMD64 Family 14h
3  *
4  * Copyright (c) 2011 Google, Inc
5  * Contributed by Stephane Eranian <eranian@gmail.com>
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy
8  * of this software and associated documentation files (the "Software"), to deal
9  * in the Software without restriction, including without limitation the rights
10  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11  * of the Software, and to permit persons to whom the Software is furnished to do so,
12  * subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
19  * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
22  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  */
25
26 /* private headers */
27 #include "pfmlib_priv.h"
28 #include "pfmlib_amd64_priv.h"
29 #include "events/amd64_events_fam14h.h"
30
31 #define DEFINE_FAM14H_REV(d, n, r, pmuid) \
32 pfmlib_pmu_t amd64_fam14h_##n##_support={                       \
33         .desc                   = "AMD64 Fam14h "#d,            \
34         .name                   = "amd64_fam14h_"#n,            \
35         .pmu                    = pmuid,                        \
36         .pmu_rev                = r,                            \
37         .pme_count              = LIBPFM_ARRAY_SIZE(amd64_fam14h_pe),\
38         .type                   = PFM_PMU_TYPE_CORE,            \
39         .supported_plm          = AMD64_FAM10H_PLM,             \
40         .num_cntrs              = 4,                            \
41         .max_encoding           = 1,                            \
42         .pe                     = amd64_fam14h_pe,              \
43         .atdesc                 = amd64_mods,                   \
44         .flags                  = PFMLIB_PMU_FL_RAW_UMASK,      \
45                                                                 \
46         .cpu_family             = pmuid,                        \
47         .pmu_detect             = pfm_amd64_family_detect,      \
48         .get_event_encoding[PFM_OS_NONE] = pfm_amd64_get_encoding,\
49          PFMLIB_ENCODE_PERF(pfm_amd64_get_perf_encoding),       \
50         .get_event_first        = pfm_amd64_get_event_first,    \
51         .get_event_next         = pfm_amd64_get_event_next,     \
52         .event_is_valid         = pfm_amd64_event_is_valid,     \
53         .validate_table         = pfm_amd64_validate_table,     \
54         .get_event_info         = pfm_amd64_get_event_info,     \
55         .get_event_attr_info    = pfm_amd64_get_event_attr_info,\
56          PFMLIB_VALID_PERF_PATTRS(pfm_amd64_perf_validate_pattrs),\
57         .get_event_nattrs       = pfm_amd64_get_event_nattrs,   \
58 }
59
60 DEFINE_FAM14H_REV(Bobcat, bobcat, AMD64_FAM14H_REV_B, PFM_PMU_AMD64_FAM14H_BOBCAT);