Searched refs:pmc (Results 1 - 128 of 128) sorted by relevance

/linux-4.1.27/drivers/clk/at91/
H A Dpmc.h2 * drivers/clk/at91/pmc.h
39 static inline void pmc_lock(struct at91_pmc *pmc) pmc_lock() argument
41 spin_lock(&pmc->lock); pmc_lock()
44 static inline void pmc_unlock(struct at91_pmc *pmc) pmc_unlock() argument
46 spin_unlock(&pmc->lock); pmc_unlock()
49 static inline u32 pmc_read(struct at91_pmc *pmc, int offset) pmc_read() argument
51 return readl(pmc->regbase + offset); pmc_read()
54 static inline void pmc_write(struct at91_pmc *pmc, int offset, u32 value) pmc_write() argument
56 writel(value, pmc->regbase + offset); pmc_write()
63 struct at91_pmc *pmc);
66 struct at91_pmc *pmc);
68 struct at91_pmc *pmc);
70 struct at91_pmc *pmc);
72 struct at91_pmc *pmc);
75 struct at91_pmc *pmc);
77 struct at91_pmc *pmc);
79 struct at91_pmc *pmc);
81 struct at91_pmc *pmc);
83 struct at91_pmc *pmc);
86 struct at91_pmc *pmc);
88 struct at91_pmc *pmc);
91 struct at91_pmc *pmc);
94 struct at91_pmc *pmc);
96 struct at91_pmc *pmc);
99 struct at91_pmc *pmc);
101 struct at91_pmc *pmc);
103 struct at91_pmc *pmc);
107 struct at91_pmc *pmc);
112 struct at91_pmc *pmc);
114 struct at91_pmc *pmc);
116 struct at91_pmc *pmc);
121 struct at91_pmc *pmc);
126 struct at91_pmc *pmc);
H A Dpmc.c25 #include "pmc.h"
70 struct at91_pmc *pmc = irq_data_get_irq_chip_data(d); pmc_irq_mask() local
72 pmc_write(pmc, AT91_PMC_IDR, 1 << d->hwirq); pmc_irq_mask()
77 struct at91_pmc *pmc = irq_data_get_irq_chip_data(d); pmc_irq_unmask() local
79 pmc_write(pmc, AT91_PMC_IER, 1 << d->hwirq); pmc_irq_unmask()
94 struct at91_pmc *pmc = irq_data_get_irq_chip_data(d); pmc_irq_suspend() local
96 pmc->imr = pmc_read(pmc, AT91_PMC_IMR); pmc_irq_suspend()
97 pmc_write(pmc, AT91_PMC_IDR, pmc->imr); pmc_irq_suspend()
102 struct at91_pmc *pmc = irq_data_get_irq_chip_data(d); pmc_irq_resume() local
104 pmc_write(pmc, AT91_PMC_IER, pmc->imr); pmc_irq_resume()
122 struct at91_pmc *pmc = h->host_data; pmc_irq_map() local
129 irq_set_chip_data(virq, pmc); pmc_irq_map()
140 struct at91_pmc *pmc = d->host_data; pmc_irq_domain_xlate() local
141 const struct at91_pmc_caps *caps = pmc->caps; pmc_irq_domain_xlate()
163 struct at91_pmc *pmc = (struct at91_pmc *)data; pmc_irq_handler() local
167 sr = pmc_read(pmc, AT91_PMC_SR) & pmc_read(pmc, AT91_PMC_IMR); pmc_irq_handler()
172 generic_handle_irq(irq_find_mapping(pmc->irqdomain, n)); pmc_irq_handler()
222 struct at91_pmc *pmc; at91_pmc_init() local
229 pmc = kzalloc(sizeof(*pmc), GFP_KERNEL); at91_pmc_init()
230 if (!pmc) at91_pmc_init()
233 spin_lock_init(&pmc->lock); at91_pmc_init()
234 pmc->regbase = regbase; at91_pmc_init()
235 pmc->virq = virq; at91_pmc_init()
236 pmc->caps = caps; at91_pmc_init()
238 pmc->irqdomain = irq_domain_add_linear(np, 32, &pmc_irq_ops, pmc); at91_pmc_init()
240 if (!pmc->irqdomain) at91_pmc_init()
243 pmc_write(pmc, AT91_PMC_IDR, 0xffffffff); at91_pmc_init()
244 if (request_irq(pmc->virq, pmc_irq_handler, at91_pmc_init()
245 IRQF_SHARED | IRQF_COND_SUSPEND, "pmc", pmc)) at91_pmc_init()
248 return pmc; at91_pmc_init()
251 irq_domain_remove(pmc->irqdomain); at91_pmc_init()
253 kfree(pmc); at91_pmc_init()
379 struct at91_pmc *pmc; of_at91_pmc_setup() local
393 pmc = at91_pmc_init(np, regbase, virq, caps); of_at91_pmc_setup()
394 if (!pmc) of_at91_pmc_setup()
401 clk_setup(childnp, pmc); for_each_child_of_node()
409 CLK_OF_DECLARE(at91rm9200_clk_pmc, "atmel,at91rm9200-pmc",
416 CLK_OF_DECLARE(at91sam9260_clk_pmc, "atmel,at91sam9260-pmc",
423 CLK_OF_DECLARE(at91sam9g45_clk_pmc, "atmel,at91sam9g45-pmc",
430 CLK_OF_DECLARE(at91sam9n12_clk_pmc, "atmel,at91sam9n12-pmc",
437 CLK_OF_DECLARE(at91sam9x5_clk_pmc, "atmel,at91sam9x5-pmc",
444 CLK_OF_DECLARE(sama5d3_clk_pmc, "atmel,sama5d3-pmc",
H A Dclk-smd.c18 #include "pmc.h"
27 struct at91_pmc *pmc; member in struct:at91sam9x5_clk_smd
39 struct at91_pmc *pmc = smd->pmc; at91sam9x5_clk_smd_recalc_rate() local
41 tmp = pmc_read(pmc, AT91_PMC_SMD); at91sam9x5_clk_smd_recalc_rate()
72 struct at91_pmc *pmc = smd->pmc; at91sam9x5_clk_smd_set_parent() local
76 tmp = pmc_read(pmc, AT91_PMC_SMD) & ~AT91_PMC_SMDS; at91sam9x5_clk_smd_set_parent()
79 pmc_write(pmc, AT91_PMC_SMD, tmp); at91sam9x5_clk_smd_set_parent()
86 struct at91_pmc *pmc = smd->pmc; at91sam9x5_clk_smd_get_parent() local
88 return pmc_read(pmc, AT91_PMC_SMD) & AT91_PMC_SMDS; at91sam9x5_clk_smd_get_parent()
96 struct at91_pmc *pmc = smd->pmc; at91sam9x5_clk_smd_set_rate() local
101 tmp = pmc_read(pmc, AT91_PMC_SMD) & ~AT91_PMC_SMD_DIV; at91sam9x5_clk_smd_set_rate()
103 pmc_write(pmc, AT91_PMC_SMD, tmp); at91sam9x5_clk_smd_set_rate()
117 at91sam9x5_clk_register_smd(struct at91_pmc *pmc, const char *name, at91sam9x5_clk_register_smd() argument
135 smd->pmc = pmc; at91sam9x5_clk_register_smd()
145 struct at91_pmc *pmc) of_at91sam9x5_clk_smd_setup()
165 clk = at91sam9x5_clk_register_smd(pmc, name, parent_names, of_at91sam9x5_clk_smd_setup()
144 of_at91sam9x5_clk_smd_setup(struct device_node *np, struct at91_pmc *pmc) of_at91sam9x5_clk_smd_setup() argument
H A Dclk-system.c23 #include "pmc.h"
32 struct at91_pmc *pmc; member in struct:clk_system
55 struct at91_pmc *pmc = sys->pmc; clk_system_prepare() local
58 pmc_write(pmc, AT91_PMC_SCER, mask); clk_system_prepare()
63 while (!(pmc_read(pmc, AT91_PMC_SR) & mask)) { clk_system_prepare()
67 pmc_read(pmc, AT91_PMC_SR) & mask); clk_system_prepare()
77 struct at91_pmc *pmc = sys->pmc; clk_system_unprepare() local
79 pmc_write(pmc, AT91_PMC_SCDR, 1 << sys->id); clk_system_unprepare()
85 struct at91_pmc *pmc = sys->pmc; clk_system_is_prepared() local
87 if (!(pmc_read(pmc, AT91_PMC_SCSR) & (1 << sys->id))) clk_system_is_prepared()
93 return !!(pmc_read(pmc, AT91_PMC_SR) & (1 << sys->id)); clk_system_is_prepared()
103 at91_clk_register_system(struct at91_pmc *pmc, const char *name, at91_clk_register_system() argument
126 sys->pmc = pmc; at91_clk_register_system()
145 of_at91_clk_sys_setup(struct device_node *np, struct at91_pmc *pmc) of_at91_clk_sys_setup() argument
171 clk = at91_clk_register_system(pmc, name, parent_name, id, irq); for_each_child_of_node()
180 struct at91_pmc *pmc) of_at91rm9200_clk_sys_setup()
182 of_at91_clk_sys_setup(np, pmc); of_at91rm9200_clk_sys_setup()
179 of_at91rm9200_clk_sys_setup(struct device_node *np, struct at91_pmc *pmc) of_at91rm9200_clk_sys_setup() argument
H A Dclk-main.c24 #include "pmc.h"
37 struct at91_pmc *pmc; member in struct:clk_main_osc
46 struct at91_pmc *pmc; member in struct:clk_main_rc_osc
57 struct at91_pmc *pmc; member in struct:clk_rm9200_main
64 struct at91_pmc *pmc; member in struct:clk_sam9x5_main
85 struct at91_pmc *pmc = osc->pmc; clk_main_osc_prepare() local
88 tmp = pmc_read(pmc, AT91_CKGR_MOR) & ~MOR_KEY_MASK; clk_main_osc_prepare()
94 pmc_write(pmc, AT91_CKGR_MOR, tmp); clk_main_osc_prepare()
97 while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCS)) { clk_main_osc_prepare()
100 pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCS); clk_main_osc_prepare()
109 struct at91_pmc *pmc = osc->pmc; clk_main_osc_unprepare() local
110 u32 tmp = pmc_read(pmc, AT91_CKGR_MOR); clk_main_osc_unprepare()
119 pmc_write(pmc, AT91_CKGR_MOR, tmp | AT91_PMC_KEY); clk_main_osc_unprepare()
125 struct at91_pmc *pmc = osc->pmc; clk_main_osc_is_prepared() local
126 u32 tmp = pmc_read(pmc, AT91_CKGR_MOR); clk_main_osc_is_prepared()
131 return !!((pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCS) && clk_main_osc_is_prepared()
132 (pmc_read(pmc, AT91_CKGR_MOR) & AT91_PMC_MOSCEN)); clk_main_osc_is_prepared()
142 at91_clk_register_main_osc(struct at91_pmc *pmc, at91_clk_register_main_osc() argument
153 if (!pmc || !irq || !name || !parent_name) at91_clk_register_main_osc()
167 osc->pmc = pmc; at91_clk_register_main_osc()
178 pmc_write(pmc, AT91_CKGR_MOR, at91_clk_register_main_osc()
179 (pmc_read(pmc, AT91_CKGR_MOR) & at91_clk_register_main_osc()
193 struct at91_pmc *pmc) of_at91rm9200_clk_main_osc_setup()
209 clk = at91_clk_register_main_osc(pmc, irq, name, parent_name, bypass); of_at91rm9200_clk_main_osc_setup()
229 struct at91_pmc *pmc = osc->pmc; clk_main_rc_osc_prepare() local
232 tmp = pmc_read(pmc, AT91_CKGR_MOR) & ~MOR_KEY_MASK; clk_main_rc_osc_prepare()
236 pmc_write(pmc, AT91_CKGR_MOR, tmp); clk_main_rc_osc_prepare()
239 while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCRCS)) { clk_main_rc_osc_prepare()
242 pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCRCS); clk_main_rc_osc_prepare()
251 struct at91_pmc *pmc = osc->pmc; clk_main_rc_osc_unprepare() local
252 u32 tmp = pmc_read(pmc, AT91_CKGR_MOR); clk_main_rc_osc_unprepare()
258 pmc_write(pmc, AT91_CKGR_MOR, tmp | AT91_PMC_KEY); clk_main_rc_osc_unprepare()
264 struct at91_pmc *pmc = osc->pmc; clk_main_rc_osc_is_prepared() local
266 return !!((pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCRCS) && clk_main_rc_osc_is_prepared()
267 (pmc_read(pmc, AT91_CKGR_MOR) & AT91_PMC_MOSCRCEN)); clk_main_rc_osc_is_prepared()
295 at91_clk_register_main_rc_osc(struct at91_pmc *pmc, at91_clk_register_main_rc_osc() argument
305 if (!pmc || !irq || !name || !frequency) at91_clk_register_main_rc_osc()
319 osc->pmc = pmc; at91_clk_register_main_rc_osc()
341 struct at91_pmc *pmc) of_at91sam9x5_clk_main_rc_osc_setup()
357 clk = at91_clk_register_main_rc_osc(pmc, irq, name, frequency, of_at91sam9x5_clk_main_rc_osc_setup()
366 static int clk_main_probe_frequency(struct at91_pmc *pmc) clk_main_probe_frequency() argument
374 tmp = pmc_read(pmc, AT91_CKGR_MCFR); clk_main_probe_frequency()
383 static unsigned long clk_main_recalc_rate(struct at91_pmc *pmc, clk_main_recalc_rate() argument
392 tmp = pmc_read(pmc, AT91_CKGR_MCFR); clk_main_recalc_rate()
403 return clk_main_probe_frequency(clkmain->pmc); clk_rm9200_main_prepare()
410 return !!(pmc_read(clkmain->pmc, AT91_CKGR_MCFR) & AT91_PMC_MAINRDY); clk_rm9200_main_is_prepared()
418 return clk_main_recalc_rate(clkmain->pmc, parent_rate); clk_rm9200_main_recalc_rate()
428 at91_clk_register_rm9200_main(struct at91_pmc *pmc, at91_clk_register_rm9200_main() argument
436 if (!pmc || !name) at91_clk_register_rm9200_main()
453 clkmain->pmc = pmc; at91_clk_register_rm9200_main()
463 struct at91_pmc *pmc) of_at91rm9200_clk_main_setup()
472 clk = at91_clk_register_rm9200_main(pmc, name, parent_name); of_at91rm9200_clk_main_setup()
492 struct at91_pmc *pmc = clkmain->pmc; clk_sam9x5_main_prepare() local
494 while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCSELS)) { clk_sam9x5_main_prepare()
497 pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCSELS); clk_sam9x5_main_prepare()
500 return clk_main_probe_frequency(pmc); clk_sam9x5_main_prepare()
507 return !!(pmc_read(clkmain->pmc, AT91_PMC_SR) & AT91_PMC_MOSCSELS); clk_sam9x5_main_is_prepared()
515 return clk_main_recalc_rate(clkmain->pmc, parent_rate); clk_sam9x5_main_recalc_rate()
521 struct at91_pmc *pmc = clkmain->pmc; clk_sam9x5_main_set_parent() local
527 tmp = pmc_read(pmc, AT91_CKGR_MOR) & ~MOR_KEY_MASK; clk_sam9x5_main_set_parent()
530 pmc_write(pmc, AT91_CKGR_MOR, tmp | AT91_PMC_MOSCSEL); clk_sam9x5_main_set_parent()
532 pmc_write(pmc, AT91_CKGR_MOR, tmp & ~AT91_PMC_MOSCSEL); clk_sam9x5_main_set_parent()
534 while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCSELS)) { clk_sam9x5_main_set_parent()
537 pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCSELS); clk_sam9x5_main_set_parent()
547 return !!(pmc_read(clkmain->pmc, AT91_CKGR_MOR) & AT91_PMC_MOSCEN); clk_sam9x5_main_get_parent()
559 at91_clk_register_sam9x5_main(struct at91_pmc *pmc, at91_clk_register_sam9x5_main() argument
570 if (!pmc || !irq || !name) at91_clk_register_sam9x5_main()
587 clkmain->pmc = pmc; at91_clk_register_sam9x5_main()
589 clkmain->parent = !!(pmc_read(clkmain->pmc, AT91_CKGR_MOR) & at91_clk_register_sam9x5_main()
608 struct at91_pmc *pmc) of_at91sam9x5_clk_main_setup()
633 clk = at91_clk_register_sam9x5_main(pmc, irq, name, parent_names, of_at91sam9x5_clk_main_setup()
192 of_at91rm9200_clk_main_osc_setup(struct device_node *np, struct at91_pmc *pmc) of_at91rm9200_clk_main_osc_setup() argument
340 of_at91sam9x5_clk_main_rc_osc_setup(struct device_node *np, struct at91_pmc *pmc) of_at91sam9x5_clk_main_rc_osc_setup() argument
462 of_at91rm9200_clk_main_setup(struct device_node *np, struct at91_pmc *pmc) of_at91rm9200_clk_main_setup() argument
607 of_at91sam9x5_clk_main_setup(struct device_node *np, struct at91_pmc *pmc) of_at91sam9x5_clk_main_setup() argument
H A Dclk-peripheral.c18 #include "pmc.h"
36 struct at91_pmc *pmc; member in struct:clk_peripheral
44 struct at91_pmc *pmc; member in struct:clk_sam9x5_peripheral
57 struct at91_pmc *pmc = periph->pmc; clk_peripheral_enable() local
65 pmc_write(pmc, offset, PERIPHERAL_MASK(id)); clk_peripheral_enable()
72 struct at91_pmc *pmc = periph->pmc; clk_peripheral_disable() local
80 pmc_write(pmc, offset, PERIPHERAL_MASK(id)); clk_peripheral_disable()
86 struct at91_pmc *pmc = periph->pmc; clk_peripheral_is_enabled() local
94 return !!(pmc_read(pmc, offset) & PERIPHERAL_MASK(id)); clk_peripheral_is_enabled()
104 at91_clk_register_peripheral(struct at91_pmc *pmc, const char *name, at91_clk_register_peripheral() argument
111 if (!pmc || !name || !parent_name || id > PERIPHERAL_ID_MAX) at91_clk_register_peripheral()
126 periph->pmc = pmc; at91_clk_register_peripheral()
163 struct at91_pmc *pmc = periph->pmc; clk_sam9x5_peripheral_enable() local
168 pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID) | clk_sam9x5_peripheral_enable()
178 struct at91_pmc *pmc = periph->pmc; clk_sam9x5_peripheral_disable() local
183 pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID) | clk_sam9x5_peripheral_disable()
190 struct at91_pmc *pmc = periph->pmc; clk_sam9x5_peripheral_is_enabled() local
196 pmc_lock(pmc); clk_sam9x5_peripheral_is_enabled()
197 pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID)); clk_sam9x5_peripheral_is_enabled()
198 ret = !!(pmc_read(pmc, AT91_PMC_PCR) & AT91_PMC_PCR_EN); clk_sam9x5_peripheral_is_enabled()
199 pmc_unlock(pmc); clk_sam9x5_peripheral_is_enabled()
209 struct at91_pmc *pmc = periph->pmc; clk_sam9x5_peripheral_recalc_rate() local
215 pmc_lock(pmc); clk_sam9x5_peripheral_recalc_rate()
216 pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID)); clk_sam9x5_peripheral_recalc_rate()
217 tmp = pmc_read(pmc, AT91_PMC_PCR); clk_sam9x5_peripheral_recalc_rate()
218 pmc_unlock(pmc); clk_sam9x5_peripheral_recalc_rate()
313 at91_clk_register_sam9x5_peripheral(struct at91_pmc *pmc, const char *name, at91_clk_register_sam9x5_peripheral() argument
321 if (!pmc || !name || !parent_name) at91_clk_register_sam9x5_peripheral()
337 periph->pmc = pmc; at91_clk_register_sam9x5_peripheral()
351 of_at91_clk_periph_setup(struct device_node *np, struct at91_pmc *pmc, u8 type) of_at91_clk_periph_setup() argument
379 clk = at91_clk_register_peripheral(pmc, name, for_each_child_of_node()
388 clk = at91_clk_register_sam9x5_peripheral(pmc, name, for_each_child_of_node()
401 struct at91_pmc *pmc) of_at91rm9200_clk_periph_setup()
403 of_at91_clk_periph_setup(np, pmc, PERIPHERAL_AT91RM9200); of_at91rm9200_clk_periph_setup()
407 struct at91_pmc *pmc) of_at91sam9x5_clk_periph_setup()
409 of_at91_clk_periph_setup(np, pmc, PERIPHERAL_AT91SAM9X5); of_at91sam9x5_clk_periph_setup()
400 of_at91rm9200_clk_periph_setup(struct device_node *np, struct at91_pmc *pmc) of_at91rm9200_clk_periph_setup() argument
406 of_at91sam9x5_clk_periph_setup(struct device_node *np, struct at91_pmc *pmc) of_at91sam9x5_clk_periph_setup() argument
H A Dclk-utmi.c23 #include "pmc.h"
29 struct at91_pmc *pmc; member in struct:clk_utmi
49 struct at91_pmc *pmc = utmi->pmc; clk_utmi_prepare() local
53 pmc_write(pmc, AT91_CKGR_UCKR, tmp); clk_utmi_prepare()
55 while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU)) { clk_utmi_prepare()
58 pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU); clk_utmi_prepare()
67 struct at91_pmc *pmc = utmi->pmc; clk_utmi_is_prepared() local
69 return !!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU); clk_utmi_is_prepared()
75 struct at91_pmc *pmc = utmi->pmc; clk_utmi_unprepare() local
78 pmc_write(pmc, AT91_CKGR_UCKR, tmp); clk_utmi_unprepare()
96 at91_clk_register_utmi(struct at91_pmc *pmc, unsigned int irq, at91_clk_register_utmi() argument
115 utmi->pmc = pmc; at91_clk_register_utmi()
132 of_at91_clk_utmi_setup(struct device_node *np, struct at91_pmc *pmc) of_at91_clk_utmi_setup() argument
147 clk = at91_clk_register_utmi(pmc, irq, name, parent_name); of_at91_clk_utmi_setup()
156 struct at91_pmc *pmc) of_at91sam9x5_clk_utmi_setup()
158 of_at91_clk_utmi_setup(np, pmc); of_at91sam9x5_clk_utmi_setup()
155 of_at91sam9x5_clk_utmi_setup(struct device_node *np, struct at91_pmc *pmc) of_at91sam9x5_clk_utmi_setup() argument
H A Dclk-plldiv.c18 #include "pmc.h"
24 struct at91_pmc *pmc; member in struct:clk_plldiv
31 struct at91_pmc *pmc = plldiv->pmc; clk_plldiv_recalc_rate() local
33 if (pmc_read(pmc, AT91_PMC_MCKR) & AT91_PMC_PLLADIV2) clk_plldiv_recalc_rate()
60 struct at91_pmc *pmc = plldiv->pmc; clk_plldiv_set_rate() local
66 pmc_lock(pmc); clk_plldiv_set_rate()
67 tmp = pmc_read(pmc, AT91_PMC_MCKR) & ~AT91_PMC_PLLADIV2; clk_plldiv_set_rate()
70 pmc_write(pmc, AT91_PMC_MCKR, tmp); clk_plldiv_set_rate()
71 pmc_unlock(pmc); clk_plldiv_set_rate()
83 at91_clk_register_plldiv(struct at91_pmc *pmc, const char *name, at91_clk_register_plldiv() argument
101 plldiv->pmc = pmc; at91_clk_register_plldiv()
112 of_at91_clk_plldiv_setup(struct device_node *np, struct at91_pmc *pmc) of_at91_clk_plldiv_setup() argument
122 clk = at91_clk_register_plldiv(pmc, name, parent_name); of_at91_clk_plldiv_setup()
132 struct at91_pmc *pmc) of_at91sam9x5_clk_plldiv_setup()
134 of_at91_clk_plldiv_setup(np, pmc); of_at91sam9x5_clk_plldiv_setup()
131 of_at91sam9x5_clk_plldiv_setup(struct device_node *np, struct at91_pmc *pmc) of_at91sam9x5_clk_plldiv_setup() argument
H A Dclk-master.c23 #include "pmc.h"
47 struct at91_pmc *pmc; member in struct:clk_master
66 struct at91_pmc *pmc = master->pmc; clk_master_prepare() local
68 while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MCKRDY)) { clk_master_prepare()
71 pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MCKRDY); clk_master_prepare()
81 return !!(pmc_read(master->pmc, AT91_PMC_SR) & AT91_PMC_MCKRDY); clk_master_is_prepared()
91 struct at91_pmc *pmc = master->pmc; clk_master_recalc_rate() local
97 pmc_lock(pmc); clk_master_recalc_rate()
98 tmp = pmc_read(pmc, AT91_PMC_MCKR) & layout->mask; clk_master_recalc_rate()
99 pmc_unlock(pmc); clk_master_recalc_rate()
122 struct at91_pmc *pmc = master->pmc; clk_master_get_parent() local
124 return pmc_read(pmc, AT91_PMC_MCKR) & AT91_PMC_CSS; clk_master_get_parent()
135 at91_clk_register_master(struct at91_pmc *pmc, unsigned int irq, at91_clk_register_master() argument
146 if (!pmc || !irq || !name || !num_parents || !parent_names) at91_clk_register_master()
162 master->pmc = pmc; at91_clk_register_master()
216 of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc, of_at91_clk_master_setup() argument
247 clk = at91_clk_register_master(pmc, irq, name, num_parents, of_at91_clk_master_setup()
261 struct at91_pmc *pmc) of_at91rm9200_clk_master_setup()
263 of_at91_clk_master_setup(np, pmc, &at91rm9200_master_layout); of_at91rm9200_clk_master_setup()
267 struct at91_pmc *pmc) of_at91sam9x5_clk_master_setup()
269 of_at91_clk_master_setup(np, pmc, &at91sam9x5_master_layout); of_at91sam9x5_clk_master_setup()
260 of_at91rm9200_clk_master_setup(struct device_node *np, struct at91_pmc *pmc) of_at91rm9200_clk_master_setup() argument
266 of_at91sam9x5_clk_master_setup(struct device_node *np, struct at91_pmc *pmc) of_at91sam9x5_clk_master_setup() argument
H A Dclk-usb.c18 #include "pmc.h"
30 struct at91_pmc *pmc; member in struct:at91sam9x5_clk_usb
38 struct at91_pmc *pmc; member in struct:at91rm9200_clk_usb
51 struct at91_pmc *pmc = usb->pmc; at91sam9x5_clk_usb_recalc_rate() local
53 tmp = pmc_read(pmc, AT91_PMC_USB); at91sam9x5_clk_usb_recalc_rate()
114 struct at91_pmc *pmc = usb->pmc; at91sam9x5_clk_usb_set_parent() local
118 tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_USBS; at91sam9x5_clk_usb_set_parent()
121 pmc_write(pmc, AT91_PMC_USB, tmp); at91sam9x5_clk_usb_set_parent()
128 struct at91_pmc *pmc = usb->pmc; at91sam9x5_clk_usb_get_parent() local
130 return pmc_read(pmc, AT91_PMC_USB) & AT91_PMC_USBS; at91sam9x5_clk_usb_get_parent()
138 struct at91_pmc *pmc = usb->pmc; at91sam9x5_clk_usb_set_rate() local
148 tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_OHCIUSBDIV; at91sam9x5_clk_usb_set_rate()
150 pmc_write(pmc, AT91_PMC_USB, tmp); at91sam9x5_clk_usb_set_rate()
166 struct at91_pmc *pmc = usb->pmc; at91sam9n12_clk_usb_enable() local
168 pmc_write(pmc, AT91_PMC_USB, at91sam9n12_clk_usb_enable()
169 pmc_read(pmc, AT91_PMC_USB) | AT91_PMC_USBS); at91sam9n12_clk_usb_enable()
176 struct at91_pmc *pmc = usb->pmc; at91sam9n12_clk_usb_disable() local
178 pmc_write(pmc, AT91_PMC_USB, at91sam9n12_clk_usb_disable()
179 pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_USBS); at91sam9n12_clk_usb_disable()
185 struct at91_pmc *pmc = usb->pmc; at91sam9n12_clk_usb_is_enabled() local
187 return !!(pmc_read(pmc, AT91_PMC_USB) & AT91_PMC_USBS); at91sam9n12_clk_usb_is_enabled()
200 at91sam9x5_clk_register_usb(struct at91_pmc *pmc, const char *name, at91sam9x5_clk_register_usb() argument
219 usb->pmc = pmc; at91sam9x5_clk_register_usb()
229 at91sam9n12_clk_register_usb(struct at91_pmc *pmc, const char *name, at91sam9n12_clk_register_usb() argument
247 usb->pmc = pmc; at91sam9n12_clk_register_usb()
260 struct at91_pmc *pmc = usb->pmc; at91rm9200_clk_usb_recalc_rate() local
264 tmp = pmc_read(pmc, AT91_CKGR_PLLBR); at91rm9200_clk_usb_recalc_rate()
316 struct at91_pmc *pmc = usb->pmc; at91rm9200_clk_usb_set_rate() local
326 tmp = pmc_read(pmc, AT91_CKGR_PLLBR) & at91rm9200_clk_usb_set_rate()
329 pmc_write(pmc, AT91_CKGR_PLLBR, tmp); at91rm9200_clk_usb_set_rate()
344 at91rm9200_clk_register_usb(struct at91_pmc *pmc, const char *name, at91rm9200_clk_register_usb() argument
362 usb->pmc = pmc; at91rm9200_clk_register_usb()
373 struct at91_pmc *pmc) of_at91sam9x5_clk_usb_setup()
393 clk = at91sam9x5_clk_register_usb(pmc, name, parent_names, num_parents); of_at91sam9x5_clk_usb_setup()
401 struct at91_pmc *pmc) of_at91sam9n12_clk_usb_setup()
413 clk = at91sam9n12_clk_register_usb(pmc, name, parent_name); of_at91sam9n12_clk_usb_setup()
421 struct at91_pmc *pmc) of_at91rm9200_clk_usb_setup()
438 clk = at91rm9200_clk_register_usb(pmc, name, parent_name, divisors); of_at91rm9200_clk_usb_setup()
372 of_at91sam9x5_clk_usb_setup(struct device_node *np, struct at91_pmc *pmc) of_at91sam9x5_clk_usb_setup() argument
400 of_at91sam9n12_clk_usb_setup(struct device_node *np, struct at91_pmc *pmc) of_at91sam9n12_clk_usb_setup() argument
420 of_at91rm9200_clk_usb_setup(struct device_node *np, struct at91_pmc *pmc) of_at91rm9200_clk_usb_setup() argument
H A Dclk-h32mx.c28 #include "pmc.h"
34 struct at91_pmc *pmc; member in struct:clk_sama5d4_h32mx
44 if (pmc_read(h32mxclk->pmc, AT91_PMC_MCKR) & AT91_PMC_H32MXDIV) clk_sama5d4_h32mx_recalc_rate()
73 struct at91_pmc *pmc = h32mxclk->pmc; clk_sama5d4_h32mx_set_rate() local
79 pmc_lock(pmc); clk_sama5d4_h32mx_set_rate()
80 tmp = pmc_read(pmc, AT91_PMC_MCKR) & ~AT91_PMC_H32MXDIV; clk_sama5d4_h32mx_set_rate()
83 pmc_write(pmc, AT91_PMC_MCKR, tmp); clk_sama5d4_h32mx_set_rate()
84 pmc_unlock(pmc); clk_sama5d4_h32mx_set_rate()
96 struct at91_pmc *pmc) of_sama5d4_clk_h32mx_setup()
116 h32mxclk->pmc = pmc; of_sama5d4_clk_h32mx_setup()
95 of_sama5d4_clk_h32mx_setup(struct device_node *np, struct at91_pmc *pmc) of_sama5d4_clk_h32mx_setup() argument
H A Dclk-programmable.c20 #include "pmc.h"
37 struct at91_pmc *pmc; member in struct:clk_programmable
49 struct at91_pmc *pmc = prog->pmc; clk_programmable_recalc_rate() local
52 pres = (pmc_read(pmc, AT91_PMC_PCKR(prog->id)) >> layout->pres_shift) & clk_programmable_recalc_rate()
103 struct at91_pmc *pmc = prog->pmc; clk_programmable_set_parent() local
104 u32 tmp = pmc_read(pmc, AT91_PMC_PCKR(prog->id)) & ~layout->css_mask; clk_programmable_set_parent()
118 pmc_write(pmc, AT91_PMC_PCKR(prog->id), tmp | index); clk_programmable_set_parent()
127 struct at91_pmc *pmc = prog->pmc; clk_programmable_get_parent() local
130 tmp = pmc_read(pmc, AT91_PMC_PCKR(prog->id)); clk_programmable_get_parent()
142 struct at91_pmc *pmc = prog->pmc; clk_programmable_set_rate() local
146 u32 tmp = pmc_read(pmc, AT91_PMC_PCKR(prog->id)) & clk_programmable_set_rate()
160 pmc_write(pmc, AT91_PMC_PCKR(prog->id), clk_programmable_set_rate()
175 at91_clk_register_programmable(struct at91_pmc *pmc, at91_clk_register_programmable() argument
200 prog->pmc = pmc; at91_clk_register_programmable()
228 of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc, of_at91_clk_prog_setup() argument
261 clk = at91_clk_register_programmable(pmc, name, for_each_child_of_node()
273 struct at91_pmc *pmc) of_at91rm9200_clk_prog_setup()
275 of_at91_clk_prog_setup(np, pmc, &at91rm9200_programmable_layout); of_at91rm9200_clk_prog_setup()
279 struct at91_pmc *pmc) of_at91sam9g45_clk_prog_setup()
281 of_at91_clk_prog_setup(np, pmc, &at91sam9g45_programmable_layout); of_at91sam9g45_clk_prog_setup()
285 struct at91_pmc *pmc) of_at91sam9x5_clk_prog_setup()
287 of_at91_clk_prog_setup(np, pmc, &at91sam9x5_programmable_layout); of_at91sam9x5_clk_prog_setup()
272 of_at91rm9200_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc) of_at91rm9200_clk_prog_setup() argument
278 of_at91sam9g45_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc) of_at91sam9g45_clk_prog_setup() argument
284 of_at91sam9x5_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc) of_at91sam9x5_clk_prog_setup() argument
H A Dclk-pll.c24 #include "pmc.h"
61 struct at91_pmc *pmc; member in struct:clk_pll
85 struct at91_pmc *pmc = pll->pmc; clk_pll_prepare() local
97 pllr = pmc_read(pmc, offset); clk_pll_prepare()
101 if ((pmc_read(pmc, AT91_PMC_SR) & mask) && clk_pll_prepare()
108 icpr = pmc_read(pmc, AT91_PMC_PLLICPR) & ~PLL_ICPR_MASK(id); clk_pll_prepare()
111 pmc_write(pmc, AT91_PMC_PLLICPR, icpr); clk_pll_prepare()
119 pmc_write(pmc, offset, pllr); clk_pll_prepare()
121 while (!(pmc_read(pmc, AT91_PMC_SR) & mask)) { clk_pll_prepare()
124 pmc_read(pmc, AT91_PMC_SR) & mask); clk_pll_prepare()
133 struct at91_pmc *pmc = pll->pmc; clk_pll_is_prepared() local
135 return !!(pmc_read(pmc, AT91_PMC_SR) & clk_pll_is_prepared()
142 struct at91_pmc *pmc = pll->pmc; clk_pll_unprepare() local
145 u32 tmp = pmc_read(pmc, offset) & ~(layout->pllr_mask); clk_pll_unprepare()
147 pmc_write(pmc, offset, tmp); clk_pll_unprepare()
311 at91_clk_register_pll(struct at91_pmc *pmc, unsigned int irq, const char *name, at91_clk_register_pll() argument
340 pll->pmc = pmc; at91_clk_register_pll()
342 tmp = pmc_read(pmc, offset) & layout->pllr_mask; at91_clk_register_pll()
482 of_at91_clk_pll_setup(struct device_node *np, struct at91_pmc *pmc, of_at91_clk_pll_setup() argument
507 clk = at91_clk_register_pll(pmc, irq, name, parent_name, id, layout, of_at91_clk_pll_setup()
520 struct at91_pmc *pmc) of_at91rm9200_clk_pll_setup()
522 of_at91_clk_pll_setup(np, pmc, &at91rm9200_pll_layout); of_at91rm9200_clk_pll_setup()
526 struct at91_pmc *pmc) of_at91sam9g45_clk_pll_setup()
528 of_at91_clk_pll_setup(np, pmc, &at91sam9g45_pll_layout); of_at91sam9g45_clk_pll_setup()
532 struct at91_pmc *pmc) of_at91sam9g20_clk_pllb_setup()
534 of_at91_clk_pll_setup(np, pmc, &at91sam9g20_pllb_layout); of_at91sam9g20_clk_pllb_setup()
538 struct at91_pmc *pmc) of_sama5d3_clk_pll_setup()
540 of_at91_clk_pll_setup(np, pmc, &sama5d3_pll_layout); of_sama5d3_clk_pll_setup()
519 of_at91rm9200_clk_pll_setup(struct device_node *np, struct at91_pmc *pmc) of_at91rm9200_clk_pll_setup() argument
525 of_at91sam9g45_clk_pll_setup(struct device_node *np, struct at91_pmc *pmc) of_at91sam9g45_clk_pll_setup() argument
531 of_at91sam9g20_clk_pllb_setup(struct device_node *np, struct at91_pmc *pmc) of_at91sam9g20_clk_pllb_setup() argument
537 of_sama5d3_clk_pll_setup(struct device_node *np, struct at91_pmc *pmc) of_sama5d3_clk_pll_setup() argument
H A Dclk-slow.c26 #include "pmc.h"
60 struct at91_pmc *pmc; member in struct:clk_sam9260_slow
400 return !!(pmc_read(slowck->pmc, AT91_PMC_SR) & AT91_PMC_OSCSEL); clk_sam9260_slow_get_parent()
408 at91_clk_register_sam9260_slow(struct at91_pmc *pmc, at91_clk_register_sam9260_slow() argument
417 if (!pmc || !name) at91_clk_register_sam9260_slow()
434 slowck->pmc = pmc; at91_clk_register_sam9260_slow()
446 struct at91_pmc *pmc) of_at91sam9260_clk_slow_setup()
466 clk = at91_clk_register_sam9260_slow(pmc, name, parent_names, of_at91sam9260_clk_slow_setup()
445 of_at91sam9260_clk_slow_setup(struct device_node *np, struct at91_pmc *pmc) of_at91sam9260_clk_slow_setup() argument
/linux-4.1.27/drivers/gpu/drm/nouveau/nvkm/subdev/mc/
H A Dbase.c30 nvkm_mc_unk260(struct nvkm_mc *pmc, u32 data) nvkm_mc_unk260() argument
32 const struct nvkm_mc_oclass *impl = (void *)nv_oclass(pmc); nvkm_mc_unk260()
34 impl->unk260(pmc, data); nvkm_mc_unk260()
38 nvkm_mc_intr_mask(struct nvkm_mc *pmc) nvkm_mc_intr_mask() argument
40 u32 intr = nv_rd32(pmc, 0x000100); nvkm_mc_intr_mask()
49 struct nvkm_mc *pmc = arg; nvkm_mc_intr() local
50 const struct nvkm_mc_oclass *oclass = (void *)nv_object(pmc)->oclass; nvkm_mc_intr()
55 nv_wr32(pmc, 0x000140, 0x00000000); nvkm_mc_intr()
56 nv_rd32(pmc, 0x000140); nvkm_mc_intr()
57 intr = nvkm_mc_intr_mask(pmc); nvkm_mc_intr()
58 if (pmc->use_msi) nvkm_mc_intr()
59 oclass->msi_rearm(pmc); nvkm_mc_intr()
62 u32 stat = intr = nvkm_mc_intr_mask(pmc); nvkm_mc_intr()
65 unit = nvkm_subdev(pmc, map->unit); nvkm_mc_intr()
74 nv_error(pmc, "unknown intr 0x%08x\n", stat); nvkm_mc_intr()
77 nv_wr32(pmc, 0x000140, 0x00000001); nvkm_mc_intr()
84 struct nvkm_mc *pmc = (void *)object; _nvkm_mc_fini() local
85 nv_wr32(pmc, 0x000140, 0x00000000); _nvkm_mc_fini()
86 return nvkm_subdev_fini(&pmc->base, suspend); _nvkm_mc_fini()
92 struct nvkm_mc *pmc = (void *)object; _nvkm_mc_init() local
93 int ret = nvkm_subdev_init(&pmc->base); _nvkm_mc_init()
96 nv_wr32(pmc, 0x000140, 0x00000001); _nvkm_mc_init()
104 struct nvkm_mc *pmc = (void *)object; _nvkm_mc_dtor() local
105 free_irq(pmc->irq, pmc); _nvkm_mc_dtor()
106 if (pmc->use_msi) _nvkm_mc_dtor()
108 nvkm_subdev_destroy(&pmc->base); _nvkm_mc_dtor()
117 struct nvkm_mc *pmc; nvkm_mc_create_() local
122 pmc = *pobject; nvkm_mc_create_()
126 pmc->unk260 = nvkm_mc_unk260; nvkm_mc_create_()
140 pmc->use_msi = true; nvkm_mc_create_()
145 pmc->use_msi = nvkm_boolopt(device->cfgopt, "NvMSI", nvkm_mc_create_()
146 pmc->use_msi); nvkm_mc_create_()
148 if (pmc->use_msi && oclass->msi_rearm) { nvkm_mc_create_()
149 pmc->use_msi = pci_enable_msi(device->pdev) == 0; nvkm_mc_create_()
150 if (pmc->use_msi) { nvkm_mc_create_()
151 nv_info(pmc, "MSI interrupts enabled\n"); nvkm_mc_create_()
152 oclass->msi_rearm(pmc); nvkm_mc_create_()
155 pmc->use_msi = false; nvkm_mc_create_()
162 pmc->irq = ret; nvkm_mc_create_()
164 ret = request_irq(pmc->irq, nvkm_mc_intr, IRQF_SHARED, "nvkm", pmc); nvkm_mc_create_()
H A Dpriv.h8 struct nvkm_mc *pmc = (p); _nvkm_mc_dtor(nv_object(pmc)); \
11 struct nvkm_mc *pmc = (p); _nvkm_mc_init(nv_object(pmc)); \
14 struct nvkm_mc *pmc = (p); _nvkm_mc_fini(nv_object(pmc), (s)); \
H A Dgf100.c52 gf100_mc_msi_rearm(struct nvkm_mc *pmc) gf100_mc_msi_rearm() argument
54 struct nv04_mc_priv *priv = (void *)pmc; gf100_mc_msi_rearm()
59 gf100_mc_unk260(struct nvkm_mc *pmc, u32 data) gf100_mc_unk260() argument
61 nv_wr32(pmc, 0x000260, data); gf100_mc_unk260()
H A Dnv40.c27 nv40_mc_msi_rearm(struct nvkm_mc *pmc) nv40_mc_msi_rearm() argument
29 struct nv04_mc_priv *priv = (void *)pmc; nv40_mc_msi_rearm()
H A Dnv50.c47 nv50_mc_msi_rearm(struct nvkm_mc *pmc) nv50_mc_msi_rearm() argument
49 struct nvkm_device *device = nv_device(pmc); nv50_mc_msi_rearm()
/linux-4.1.27/arch/x86/kvm/
H A Dpmu.c40 /* mapping between fixed pmc index and arch_events array */
43 static bool pmc_is_gp(struct kvm_pmc *pmc) pmc_is_gp() argument
45 return pmc->type == KVM_PMC_GP; pmc_is_gp()
48 static inline u64 pmc_bitmask(struct kvm_pmc *pmc) pmc_bitmask() argument
50 struct kvm_pmu *pmu = &pmc->vcpu->arch.pmu; pmc_bitmask()
52 return pmu->counter_bitmask[pmc->type]; pmc_bitmask()
55 static inline bool pmc_enabled(struct kvm_pmc *pmc) pmc_enabled() argument
57 struct kvm_pmu *pmu = &pmc->vcpu->arch.pmu; pmc_enabled()
58 return test_bit(pmc->idx, (unsigned long *)&pmu->global_ctrl); pmc_enabled()
110 struct kvm_pmc *pmc = perf_event->overflow_handler_context; kvm_perf_overflow() local
111 struct kvm_pmu *pmu = &pmc->vcpu->arch.pmu; kvm_perf_overflow()
112 if (!test_and_set_bit(pmc->idx, (unsigned long *)&pmu->reprogram_pmi)) { kvm_perf_overflow()
113 __set_bit(pmc->idx, (unsigned long *)&pmu->global_status); kvm_perf_overflow()
114 kvm_make_request(KVM_REQ_PMU, pmc->vcpu); kvm_perf_overflow()
121 struct kvm_pmc *pmc = perf_event->overflow_handler_context; kvm_perf_overflow_intr() local
122 struct kvm_pmu *pmu = &pmc->vcpu->arch.pmu; kvm_perf_overflow_intr()
123 if (!test_and_set_bit(pmc->idx, (unsigned long *)&pmu->reprogram_pmi)) { kvm_perf_overflow_intr()
124 __set_bit(pmc->idx, (unsigned long *)&pmu->global_status); kvm_perf_overflow_intr()
125 kvm_make_request(KVM_REQ_PMU, pmc->vcpu); kvm_perf_overflow_intr()
135 irq_work_queue(&pmc->vcpu->arch.pmu.irq_work); kvm_perf_overflow_intr()
137 kvm_make_request(KVM_REQ_PMI, pmc->vcpu); kvm_perf_overflow_intr()
141 static u64 read_pmc(struct kvm_pmc *pmc) read_pmc() argument
145 counter = pmc->counter; read_pmc()
147 if (pmc->perf_event) read_pmc()
148 counter += perf_event_read_value(pmc->perf_event, read_pmc()
153 return counter & pmc_bitmask(pmc); read_pmc()
156 static void stop_counter(struct kvm_pmc *pmc) stop_counter() argument
158 if (pmc->perf_event) { stop_counter()
159 pmc->counter = read_pmc(pmc); stop_counter()
160 perf_event_release_kernel(pmc->perf_event); stop_counter()
161 pmc->perf_event = NULL; stop_counter()
165 static void reprogram_counter(struct kvm_pmc *pmc, u32 type, reprogram_counter() argument
185 attr.sample_period = (-pmc->counter) & pmc_bitmask(pmc); reprogram_counter()
189 kvm_perf_overflow, pmc); reprogram_counter()
196 pmc->perf_event = event; reprogram_counter()
197 clear_bit(pmc->idx, (unsigned long*)&pmc->vcpu->arch.pmu.reprogram_pmi); reprogram_counter()
217 static void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel) reprogram_gp_counter() argument
225 pmc->eventsel = eventsel; reprogram_gp_counter()
227 stop_counter(pmc); reprogram_gp_counter()
229 if (!(eventsel & ARCH_PERFMON_EVENTSEL_ENABLE) || !pmc_enabled(pmc)) reprogram_gp_counter()
240 config = find_arch_event(&pmc->vcpu->arch.pmu, event_select, reprogram_gp_counter()
249 reprogram_counter(pmc, type, config, reprogram_gp_counter()
257 static void reprogram_fixed_counter(struct kvm_pmc *pmc, u8 en_pmi, int idx) reprogram_fixed_counter() argument
262 stop_counter(pmc); reprogram_fixed_counter()
264 if (!en || !pmc_enabled(pmc)) reprogram_fixed_counter()
267 reprogram_counter(pmc, PERF_TYPE_HARDWARE, reprogram_fixed_counter()
285 struct kvm_pmc *pmc = get_fixed_pmc_idx(pmu, i); reprogram_fixed_counters() local
290 reprogram_fixed_counter(pmc, en_pmi, i); reprogram_fixed_counters()
298 struct kvm_pmc *pmc = global_idx_to_pmc(pmu, idx); reprogram_idx() local
300 if (!pmc) reprogram_idx()
303 if (pmc_is_gp(pmc)) reprogram_idx()
304 reprogram_gp_counter(pmc, pmc->eventsel); reprogram_idx()
307 reprogram_fixed_counter(pmc, reprogram_idx()
347 struct kvm_pmc *pmc; kvm_pmu_get_msr() local
363 if ((pmc = get_gp_pmc(pmu, index, MSR_IA32_PERFCTR0)) || kvm_pmu_get_msr()
364 (pmc = get_fixed_pmc(pmu, index))) { kvm_pmu_get_msr()
365 *data = read_pmc(pmc); kvm_pmu_get_msr()
367 } else if ((pmc = get_gp_pmc(pmu, index, MSR_P6_EVNTSEL0))) { kvm_pmu_get_msr()
368 *data = pmc->eventsel; kvm_pmu_get_msr()
378 struct kvm_pmc *pmc; kvm_pmu_set_msr() local
414 if ((pmc = get_gp_pmc(pmu, index, MSR_IA32_PERFCTR0)) || kvm_pmu_set_msr()
415 (pmc = get_fixed_pmc(pmu, index))) { kvm_pmu_set_msr()
418 pmc->counter += data - read_pmc(pmc); kvm_pmu_set_msr()
420 } else if ((pmc = get_gp_pmc(pmu, index, MSR_P6_EVNTSEL0))) { kvm_pmu_set_msr()
421 if (data == pmc->eventsel) kvm_pmu_set_msr()
424 reprogram_gp_counter(pmc, data); kvm_pmu_set_msr()
432 int kvm_pmu_check_pmc(struct kvm_vcpu *vcpu, unsigned pmc) kvm_pmu_check_pmc() argument
435 bool fixed = pmc & (1u << 30); kvm_pmu_check_pmc()
436 pmc &= ~(3u << 30); kvm_pmu_check_pmc()
437 return (!fixed && pmc >= pmu->nr_arch_gp_counters) || kvm_pmu_check_pmc()
438 (fixed && pmc >= pmu->nr_arch_fixed_counters); kvm_pmu_check_pmc()
441 int kvm_pmu_read_pmc(struct kvm_vcpu *vcpu, unsigned pmc, u64 *data) kvm_pmu_read_pmc() argument
444 bool fast_mode = pmc & (1u << 31); kvm_pmu_read_pmc()
445 bool fixed = pmc & (1u << 30); kvm_pmu_read_pmc()
449 pmc &= ~(3u << 30); kvm_pmu_read_pmc()
450 if (!fixed && pmc >= pmu->nr_arch_gp_counters) kvm_pmu_read_pmc()
452 if (fixed && pmc >= pmu->nr_arch_fixed_counters) kvm_pmu_read_pmc()
455 ctr = read_pmc(&counters[pmc]); kvm_pmu_read_pmc()
541 struct kvm_pmc *pmc = &pmu->gp_counters[i]; kvm_pmu_reset() local
542 stop_counter(pmc); kvm_pmu_reset()
543 pmc->counter = pmc->eventsel = 0; kvm_pmu_reset()
567 struct kvm_pmc *pmc = global_idx_to_pmc(pmu, bit); kvm_handle_pmu_event() local
569 if (unlikely(!pmc || !pmc->perf_event)) { kvm_handle_pmu_event()
H A Demulate.c3159 u64 pmc; em_rdpmc() local
3161 if (ctxt->ops->read_pmc(ctxt, reg_read(ctxt, VCPU_REGS_RCX), &pmc)) em_rdpmc()
3163 *reg_write(ctxt, VCPU_REGS_RAX) = (u32)pmc; em_rdpmc()
3164 *reg_write(ctxt, VCPU_REGS_RDX) = pmc >> 32; em_rdpmc()
H A Dx86.c4966 u32 pmc) emulator_check_pmc()
4968 return kvm_pmu_check_pmc(emul_to_vcpu(ctxt), pmc); emulator_check_pmc()
4972 u32 pmc, u64 *pdata) emulator_read_pmc()
4974 return kvm_pmu_read_pmc(emul_to_vcpu(ctxt), pmc, pdata); emulator_read_pmc()
4965 emulator_check_pmc(struct x86_emulate_ctxt *ctxt, u32 pmc) emulator_check_pmc() argument
4971 emulator_read_pmc(struct x86_emulate_ctxt *ctxt, u32 pmc, u64 *pdata) emulator_read_pmc() argument
/linux-4.1.27/net/ipv4/
H A Digmp.c170 static int sf_setstate(struct ip_mc_list *pmc);
171 static void sf_markstate(struct ip_mc_list *pmc);
173 static void ip_mc_clear_src(struct ip_mc_list *pmc);
185 #define for_each_pmc_rcu(in_dev, pmc) \
186 for (pmc = rcu_dereference(in_dev->mc_list); \
187 pmc != NULL; \
188 pmc = rcu_dereference(pmc->next_rcu))
190 #define for_each_pmc_rtnl(in_dev, pmc) \
191 for (pmc = rtnl_dereference(in_dev->mc_list); \
192 pmc != NULL; \
193 pmc = rtnl_dereference(pmc->next_rcu))
264 static int is_in(struct ip_mc_list *pmc, struct ip_sf_list *psf, int type, is_in() argument
272 if (!(pmc->gsquery && !psf->sf_gsresp)) { is_in()
273 if (pmc->sfmode == MCAST_INCLUDE) is_in()
280 return pmc->sfcount[MCAST_EXCLUDE] == is_in()
291 if (pmc->sfcount[MCAST_EXCLUDE] == 0 || is_in()
294 return pmc->sfcount[MCAST_EXCLUDE] == is_in()
299 return (pmc->sfmode == MCAST_INCLUDE) ^ sdeleted; is_in()
301 if (pmc->sfmode == MCAST_INCLUDE) is_in()
309 igmp_scount(struct ip_mc_list *pmc, int type, int gdeleted, int sdeleted) igmp_scount() argument
314 for (psf = pmc->sources; psf; psf = psf->sf_next) { igmp_scount()
315 if (!is_in(pmc, psf, type, gdeleted, sdeleted)) igmp_scount()
400 static int grec_size(struct ip_mc_list *pmc, int type, int gdel, int sdel) grec_size() argument
402 return sizeof(struct igmpv3_grec) + 4*igmp_scount(pmc, type, gdel, sdel); grec_size()
405 static struct sk_buff *add_grhead(struct sk_buff *skb, struct ip_mc_list *pmc, add_grhead() argument
408 struct net_device *dev = pmc->interface->dev; add_grhead()
420 pgr->grec_mca = pmc->multiaddr; add_grhead()
429 static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, add_grec() argument
432 struct net_device *dev = pmc->interface->dev; add_grec()
438 if (pmc->multiaddr == IGMP_ALL_HOSTS) add_grec()
448 psf_list = sdeleted ? &pmc->tomb : &pmc->sources; add_grec()
458 AVAILABLE(skb) < grec_size(pmc, type, gdeleted, sdeleted)) { add_grec()
471 if (!is_in(pmc, psf, type, gdeleted, sdeleted)) { add_grec()
493 skb = add_grhead(skb, pmc, type, &pgr); add_grec()
521 if (pmc->crcount || isquery) { add_grec()
527 skb = add_grhead(skb, pmc, type, &pgr); add_grec()
534 pmc->gsquery = 0; /* clear query state on report */ add_grec()
538 static int igmpv3_send_report(struct in_device *in_dev, struct ip_mc_list *pmc) igmpv3_send_report() argument
543 if (!pmc) { igmpv3_send_report()
545 for_each_pmc_rcu(in_dev, pmc) { for_each_pmc_rcu()
546 if (pmc->multiaddr == IGMP_ALL_HOSTS) for_each_pmc_rcu()
548 spin_lock_bh(&pmc->lock); for_each_pmc_rcu()
549 if (pmc->sfcount[MCAST_EXCLUDE]) for_each_pmc_rcu()
553 skb = add_grec(skb, pmc, type, 0, 0); for_each_pmc_rcu()
554 spin_unlock_bh(&pmc->lock); for_each_pmc_rcu()
558 spin_lock_bh(&pmc->lock);
559 if (pmc->sfcount[MCAST_EXCLUDE])
563 skb = add_grec(skb, pmc, type, 0, 0);
564 spin_unlock_bh(&pmc->lock);
594 struct ip_mc_list *pmc, *pmc_prev, *pmc_next; igmpv3_send_cr() local
603 for (pmc = in_dev->mc_tomb; pmc; pmc = pmc_next) { igmpv3_send_cr()
604 pmc_next = pmc->next; igmpv3_send_cr()
605 if (pmc->sfmode == MCAST_INCLUDE) { igmpv3_send_cr()
608 skb = add_grec(skb, pmc, type, 1, 0); igmpv3_send_cr()
609 skb = add_grec(skb, pmc, dtype, 1, 1); igmpv3_send_cr()
611 if (pmc->crcount) { igmpv3_send_cr()
612 if (pmc->sfmode == MCAST_EXCLUDE) { igmpv3_send_cr()
614 skb = add_grec(skb, pmc, type, 1, 0); igmpv3_send_cr()
616 pmc->crcount--; igmpv3_send_cr()
617 if (pmc->crcount == 0) { igmpv3_send_cr()
618 igmpv3_clear_zeros(&pmc->tomb); igmpv3_send_cr()
619 igmpv3_clear_zeros(&pmc->sources); igmpv3_send_cr()
622 if (pmc->crcount == 0 && !pmc->tomb && !pmc->sources) { igmpv3_send_cr()
627 in_dev_put(pmc->interface); igmpv3_send_cr()
628 kfree(pmc); igmpv3_send_cr()
630 pmc_prev = pmc; igmpv3_send_cr()
635 for_each_pmc_rcu(in_dev, pmc) { for_each_pmc_rcu()
636 spin_lock_bh(&pmc->lock); for_each_pmc_rcu()
637 if (pmc->sfcount[MCAST_EXCLUDE]) { for_each_pmc_rcu()
644 skb = add_grec(skb, pmc, type, 0, 0); for_each_pmc_rcu()
645 skb = add_grec(skb, pmc, dtype, 0, 1); /* deleted sources */ for_each_pmc_rcu()
648 if (pmc->crcount) { for_each_pmc_rcu()
649 if (pmc->sfmode == MCAST_EXCLUDE) for_each_pmc_rcu()
653 skb = add_grec(skb, pmc, type, 0, 0); for_each_pmc_rcu()
654 pmc->crcount--; for_each_pmc_rcu()
656 spin_unlock_bh(&pmc->lock); for_each_pmc_rcu()
665 static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc, igmp_send_report() argument
674 __be32 group = pmc ? pmc->multiaddr : 0; igmp_send_report()
680 return igmpv3_send_report(in_dev, pmc); igmp_send_report()
790 static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __be32 *srcs) igmp_xmarksources() argument
796 for (psf = pmc->sources; psf; psf = psf->sf_next) { igmp_xmarksources()
802 pmc->sfcount[MCAST_EXCLUDE] != igmp_xmarksources()
811 pmc->gsquery = 0; igmp_xmarksources()
817 static int igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __be32 *srcs) igmp_marksources() argument
822 if (pmc->sfmode == MCAST_EXCLUDE) igmp_marksources()
823 return igmp_xmarksources(pmc, nsrcs, srcs); igmp_marksources()
827 for (psf = pmc->sources; psf; psf = psf->sf_next) { igmp_marksources()
838 pmc->gsquery = 0; igmp_marksources()
841 pmc->gsquery = 1; igmp_marksources()
1073 struct ip_mc_list *pmc; igmpv3_add_delrec() local
1081 pmc = kzalloc(sizeof(*pmc), GFP_KERNEL); igmpv3_add_delrec()
1082 if (!pmc) igmpv3_add_delrec()
1085 pmc->interface = im->interface; igmpv3_add_delrec()
1087 pmc->multiaddr = im->multiaddr; igmpv3_add_delrec()
1088 pmc->crcount = in_dev->mr_qrv ?: sysctl_igmp_qrv; igmpv3_add_delrec()
1089 pmc->sfmode = im->sfmode; igmpv3_add_delrec()
1090 if (pmc->sfmode == MCAST_INCLUDE) { igmpv3_add_delrec()
1093 pmc->tomb = im->tomb; igmpv3_add_delrec()
1094 pmc->sources = im->sources; igmpv3_add_delrec()
1096 for (psf = pmc->sources; psf; psf = psf->sf_next) igmpv3_add_delrec()
1097 psf->sf_crcount = pmc->crcount; igmpv3_add_delrec()
1102 pmc->next = in_dev->mc_tomb; igmpv3_add_delrec()
1103 in_dev->mc_tomb = pmc; igmpv3_add_delrec()
1109 struct ip_mc_list *pmc, *pmc_prev; igmpv3_del_delrec() local
1114 for (pmc = in_dev->mc_tomb; pmc; pmc = pmc->next) { igmpv3_del_delrec()
1115 if (pmc->multiaddr == multiaddr) igmpv3_del_delrec()
1117 pmc_prev = pmc; igmpv3_del_delrec()
1119 if (pmc) { igmpv3_del_delrec()
1121 pmc_prev->next = pmc->next; igmpv3_del_delrec()
1123 in_dev->mc_tomb = pmc->next; igmpv3_del_delrec()
1126 if (pmc) { igmpv3_del_delrec()
1127 for (psf = pmc->tomb; psf; psf = psf_next) { igmpv3_del_delrec()
1131 in_dev_put(pmc->interface); igmpv3_del_delrec()
1132 kfree(pmc); igmpv3_del_delrec()
1138 struct ip_mc_list *pmc, *nextpmc; igmpv3_clear_delrec() local
1141 pmc = in_dev->mc_tomb; igmpv3_clear_delrec()
1145 for (; pmc; pmc = nextpmc) { igmpv3_clear_delrec()
1146 nextpmc = pmc->next; igmpv3_clear_delrec()
1147 ip_mc_clear_src(pmc); igmpv3_clear_delrec()
1148 in_dev_put(pmc->interface); igmpv3_clear_delrec()
1149 kfree(pmc); igmpv3_clear_delrec()
1153 for_each_pmc_rcu(in_dev, pmc) { for_each_pmc_rcu()
1156 spin_lock_bh(&pmc->lock); for_each_pmc_rcu()
1157 psf = pmc->tomb; for_each_pmc_rcu()
1158 pmc->tomb = NULL; for_each_pmc_rcu()
1159 spin_unlock_bh(&pmc->lock); for_each_pmc_rcu()
1409 struct ip_mc_list *pmc; ip_mc_unmap() local
1413 for_each_pmc_rtnl(in_dev, pmc) ip_mc_unmap()
1414 igmp_group_dropped(pmc); ip_mc_unmap()
1419 struct ip_mc_list *pmc; ip_mc_remap() local
1423 for_each_pmc_rtnl(in_dev, pmc) ip_mc_remap()
1424 igmp_group_added(pmc); ip_mc_remap()
1431 struct ip_mc_list *pmc; ip_mc_down() local
1435 for_each_pmc_rtnl(in_dev, pmc) ip_mc_down()
1436 igmp_group_dropped(pmc); ip_mc_down()
1470 struct ip_mc_list *pmc; ip_mc_up() local
1479 for_each_pmc_rtnl(in_dev, pmc) ip_mc_up()
1480 igmp_group_added(pmc); ip_mc_up()
1547 static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode, ip_mc_del1_src() argument
1554 for (psf = pmc->sources; psf; psf = psf->sf_next) { ip_mc_del1_src()
1565 ip_rt_multicast_event(pmc->interface); ip_mc_del1_src()
1569 struct in_device *in_dev = pmc->interface; ip_mc_del1_src()
1576 pmc->sources = psf->sf_next; ip_mc_del1_src()
1581 psf->sf_next = pmc->tomb; ip_mc_del1_src()
1582 pmc->tomb = psf; ip_mc_del1_src()
1598 struct ip_mc_list *pmc; ip_mc_del_src() local
1605 for_each_pmc_rcu(in_dev, pmc) { for_each_pmc_rcu()
1606 if (*pmca == pmc->multiaddr) for_each_pmc_rcu()
1609 if (!pmc) {
1614 spin_lock_bh(&pmc->lock);
1617 sf_markstate(pmc);
1621 if (!pmc->sfcount[sfmode])
1623 pmc->sfcount[sfmode]--;
1627 int rv = ip_mc_del1_src(pmc, sfmode, &psfsrc[i]);
1633 if (pmc->sfmode == MCAST_EXCLUDE &&
1634 pmc->sfcount[MCAST_EXCLUDE] == 0 &&
1635 pmc->sfcount[MCAST_INCLUDE]) {
1641 pmc->sfmode = MCAST_INCLUDE;
1643 pmc->crcount = in_dev->mr_qrv ?: sysctl_igmp_qrv;
1644 in_dev->mr_ifc_count = pmc->crcount;
1645 for (psf = pmc->sources; psf; psf = psf->sf_next)
1647 igmp_ifc_event(pmc->interface);
1648 } else if (sf_setstate(pmc) || changerec) {
1649 igmp_ifc_event(pmc->interface);
1653 spin_unlock_bh(&pmc->lock);
1660 static int ip_mc_add1_src(struct ip_mc_list *pmc, int sfmode, ip_mc_add1_src() argument
1666 for (psf = pmc->sources; psf; psf = psf->sf_next) { ip_mc_add1_src()
1679 pmc->sources = psf; ip_mc_add1_src()
1683 ip_rt_multicast_event(pmc->interface); ip_mc_add1_src()
1689 static void sf_markstate(struct ip_mc_list *pmc) sf_markstate() argument
1692 int mca_xcount = pmc->sfcount[MCAST_EXCLUDE]; sf_markstate()
1694 for (psf = pmc->sources; psf; psf = psf->sf_next) sf_markstate()
1695 if (pmc->sfcount[MCAST_EXCLUDE]) { sf_markstate()
1703 static int sf_setstate(struct ip_mc_list *pmc) sf_setstate() argument
1706 int mca_xcount = pmc->sfcount[MCAST_EXCLUDE]; sf_setstate()
1707 int qrv = pmc->interface->mr_qrv; sf_setstate()
1711 for (psf = pmc->sources; psf; psf = psf->sf_next) { sf_setstate()
1712 if (pmc->sfcount[MCAST_EXCLUDE]) { sf_setstate()
1721 for (dpsf = pmc->tomb; dpsf; dpsf = dpsf->sf_next) { sf_setstate()
1730 pmc->tomb = dpsf->sf_next; sf_setstate()
1743 for (dpsf = pmc->tomb; dpsf; dpsf = dpsf->sf_next) sf_setstate()
1751 /* pmc->lock held by callers */ sf_setstate()
1752 dpsf->sf_next = pmc->tomb; sf_setstate()
1753 pmc->tomb = dpsf; sf_setstate()
1769 struct ip_mc_list *pmc; ip_mc_add_src() local
1776 for_each_pmc_rcu(in_dev, pmc) { for_each_pmc_rcu()
1777 if (*pmca == pmc->multiaddr) for_each_pmc_rcu()
1780 if (!pmc) {
1785 spin_lock_bh(&pmc->lock);
1789 sf_markstate(pmc);
1791 isexclude = pmc->sfmode == MCAST_EXCLUDE;
1793 pmc->sfcount[sfmode]++;
1796 err = ip_mc_add1_src(pmc, sfmode, &psfsrc[i]);
1804 pmc->sfcount[sfmode]--;
1806 (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[j]);
1807 } else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) {
1810 in_dev = pmc->interface;
1814 if (pmc->sfcount[MCAST_EXCLUDE])
1815 pmc->sfmode = MCAST_EXCLUDE;
1816 else if (pmc->sfcount[MCAST_INCLUDE])
1817 pmc->sfmode = MCAST_INCLUDE;
1821 pmc->crcount = in_dev->mr_qrv ?: sysctl_igmp_qrv;
1822 in_dev->mr_ifc_count = pmc->crcount;
1823 for (psf = pmc->sources; psf; psf = psf->sf_next)
1826 } else if (sf_setstate(pmc)) {
1830 spin_unlock_bh(&pmc->lock);
1834 static void ip_mc_clear_src(struct ip_mc_list *pmc) ip_mc_clear_src() argument
1838 for (psf = pmc->tomb; psf; psf = nextpsf) { ip_mc_clear_src()
1842 pmc->tomb = NULL; ip_mc_clear_src()
1843 for (psf = pmc->sources; psf; psf = nextpsf) { ip_mc_clear_src()
1847 pmc->sources = NULL; ip_mc_clear_src()
1848 pmc->sfmode = MCAST_EXCLUDE; ip_mc_clear_src()
1849 pmc->sfcount[MCAST_INCLUDE] = 0; ip_mc_clear_src()
1850 pmc->sfcount[MCAST_EXCLUDE] = 1; ip_mc_clear_src()
1979 struct ip_mc_socklist *pmc; ip_mc_source() local
2003 for_each_pmc_rtnl(inet, pmc) { for_each_pmc_rtnl()
2004 if ((pmc->multi.imr_multiaddr.s_addr == for_each_pmc_rtnl()
2006 (pmc->multi.imr_ifindex == imr.imr_ifindex)) for_each_pmc_rtnl()
2009 if (!pmc) { /* must have a prior join */
2014 if (pmc->sflist) {
2015 if (pmc->sfmode != omode) {
2019 } else if (pmc->sfmode != omode) {
2022 ip_mc_del_src(in_dev, &mreqs->imr_multiaddr, pmc->sfmode, 0,
2024 pmc->sfmode = omode;
2027 psl = rtnl_dereference(pmc->sflist);
2083 rcu_assign_pointer(pmc->sflist, newpsl);
2114 struct ip_mc_socklist *pmc; ip_mc_msfilter() local
2145 for_each_pmc_rtnl(inet, pmc) { for_each_pmc_rtnl()
2146 if (pmc->multi.imr_multiaddr.s_addr == msf->imsf_multiaddr && for_each_pmc_rtnl()
2147 pmc->multi.imr_ifindex == imr.imr_ifindex) for_each_pmc_rtnl()
2150 if (!pmc) { /* must have a prior join */
2175 psl = rtnl_dereference(pmc->sflist);
2177 (void) ip_mc_del_src(in_dev, &msf->imsf_multiaddr, pmc->sfmode,
2183 (void) ip_mc_del_src(in_dev, &msf->imsf_multiaddr, pmc->sfmode,
2185 rcu_assign_pointer(pmc->sflist, newpsl);
2186 pmc->sfmode = msf->imsf_fmode;
2200 struct ip_mc_socklist *pmc; ip_mc_msfget() local
2222 for_each_pmc_rtnl(inet, pmc) { for_each_pmc_rtnl()
2223 if (pmc->multi.imr_multiaddr.s_addr == msf->imsf_multiaddr && for_each_pmc_rtnl()
2224 pmc->multi.imr_ifindex == imr.imr_ifindex) for_each_pmc_rtnl()
2227 if (!pmc) /* must have a prior join */
2229 msf->imsf_fmode = pmc->sfmode;
2230 psl = rtnl_dereference(pmc->sflist);
2260 struct ip_mc_socklist *pmc; ip_mc_gsfget() local
2275 for_each_pmc_rtnl(inet, pmc) { for_each_pmc_rtnl()
2276 if (pmc->multi.imr_multiaddr.s_addr == addr && for_each_pmc_rtnl()
2277 pmc->multi.imr_ifindex == gsf->gf_interface) for_each_pmc_rtnl()
2280 if (!pmc) /* must have a prior join */
2282 gsf->gf_fmode = pmc->sfmode;
2283 psl = rtnl_dereference(pmc->sflist);
2314 struct ip_mc_socklist *pmc; ip_mc_sf_allow() local
2324 for_each_pmc_rcu(inet, pmc) { for_each_pmc_rcu()
2325 if (pmc->multi.imr_multiaddr.s_addr == loc_addr && for_each_pmc_rcu()
2326 pmc->multi.imr_ifindex == dif) for_each_pmc_rcu()
2330 if (!pmc)
2332 psl = rcu_dereference(pmc->sflist);
2333 ret = (pmc->sfmode == MCAST_EXCLUDE);
2342 if (pmc->sfmode == MCAST_INCLUDE && i >= psl->sl_count)
2344 if (pmc->sfmode == MCAST_EXCLUDE && i < psl->sl_count)
/linux-4.1.27/arch/x86/kernel/
H A Dpmc_atom.c104 static inline u32 pmc_reg_read(struct pmc_dev *pmc, int reg_offset) pmc_reg_read() argument
106 return readl(pmc->regmap + reg_offset); pmc_reg_read()
109 static inline void pmc_reg_write(struct pmc_dev *pmc, int reg_offset, u32 val) pmc_reg_write() argument
111 writel(val, pmc->regmap + reg_offset); pmc_reg_write()
131 static void pmc_hw_reg_setup(struct pmc_dev *pmc) pmc_hw_reg_setup() argument
141 pmc_reg_write(pmc, PMC_S0IX_WAKE_EN, (u32)PMC_WAKE_EN_SETTING); pmc_hw_reg_setup()
147 struct pmc_dev *pmc = s->private; pmc_dev_state_show() local
152 func_dis = pmc_reg_read(pmc, PMC_FUNC_DIS); pmc_dev_state_show()
153 func_dis_2 = pmc_reg_read(pmc, PMC_FUNC_DIS_2); pmc_dev_state_show()
154 d3_sts_0 = pmc_reg_read(pmc, PMC_D3_STS_0); pmc_dev_state_show()
155 d3_sts_1 = pmc_reg_read(pmc, PMC_D3_STS_1); pmc_dev_state_show()
193 struct pmc_dev *pmc = s->private; pmc_pss_state_show() local
194 u32 pss = pmc_reg_read(pmc, PMC_PSS); pmc_pss_state_show()
219 struct pmc_dev *pmc = s->private; pmc_sleep_tmr_show() local
222 s0ir_tmr = (u64)pmc_reg_read(pmc, PMC_S0IR_TMR) << PMC_TMR_SHIFT; pmc_sleep_tmr_show()
223 s0i1_tmr = (u64)pmc_reg_read(pmc, PMC_S0I1_TMR) << PMC_TMR_SHIFT; pmc_sleep_tmr_show()
224 s0i2_tmr = (u64)pmc_reg_read(pmc, PMC_S0I2_TMR) << PMC_TMR_SHIFT; pmc_sleep_tmr_show()
225 s0i3_tmr = (u64)pmc_reg_read(pmc, PMC_S0I3_TMR) << PMC_TMR_SHIFT; pmc_sleep_tmr_show()
226 s0_tmr = (u64)pmc_reg_read(pmc, PMC_S0_TMR) << PMC_TMR_SHIFT; pmc_sleep_tmr_show()
248 static void pmc_dbgfs_unregister(struct pmc_dev *pmc) pmc_dbgfs_unregister() argument
250 debugfs_remove_recursive(pmc->dbgfs_dir); pmc_dbgfs_unregister()
253 static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) pmc_dbgfs_register() argument
261 pmc->dbgfs_dir = dir; pmc_dbgfs_register()
264 dir, pmc, &pmc_dev_state_ops); pmc_dbgfs_register()
271 dir, pmc, &pmc_pss_state_ops); pmc_dbgfs_register()
278 dir, pmc, &pmc_sleep_tmr_ops); pmc_dbgfs_register()
286 pmc_dbgfs_unregister(pmc); pmc_dbgfs_register()
290 static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) pmc_dbgfs_register() argument
298 struct pmc_dev *pmc = &pmc_device; pmc_setup_dev() local
309 pci_read_config_dword(pdev, PMC_BASE_ADDR_OFFSET, &pmc->base_addr); pmc_setup_dev()
310 pmc->base_addr &= PMC_BASE_ADDR_MASK; pmc_setup_dev()
312 pmc->regmap = ioremap_nocache(pmc->base_addr, PMC_MMIO_REG_LEN); pmc_setup_dev()
313 if (!pmc->regmap) { pmc_setup_dev()
319 pmc_hw_reg_setup(pmc); pmc_setup_dev()
321 ret = pmc_dbgfs_register(pmc, pdev); pmc_setup_dev()
323 iounmap(pmc->regmap); pmc_setup_dev()
/linux-4.1.27/arch/powerpc/perf/
H A Dppc970-pmu.c149 int pmc, psel, unit, byte, bit; p970_marked_instr_event() local
152 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; p970_marked_instr_event()
154 if (pmc) { p970_marked_instr_event()
155 if (direct_marked_event[pmc - 1] & (1 << psel)) p970_marked_instr_event()
158 bit = (pmc <= 4)? pmc - 1: 8 - pmc; p970_marked_instr_event()
197 int pmc, byte, unit, sh, spcsel; p970_get_constraint() local
201 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; p970_get_constraint()
202 if (pmc) { p970_get_constraint()
203 if (pmc > 8) p970_get_constraint()
205 sh = (pmc - 1) * 2; p970_get_constraint()
208 grp = ((pmc - 1) >> 1) & 1; p970_get_constraint()
221 if (!pmc) p970_get_constraint()
263 unsigned int pmc, unit, byte, psel; p970_compute_mmcr() local
283 pmc = (event[i] >> PM_PMC_SH) & PM_PMC_MSK; p970_compute_mmcr()
284 if (pmc) { p970_compute_mmcr()
285 if (pmc_inuse & (1 << (pmc - 1))) p970_compute_mmcr()
287 pmc_inuse |= 1 << (pmc - 1); p970_compute_mmcr()
289 ++pmc_grp_use[((pmc - 1) >> 1) & 1]; p970_compute_mmcr()
296 if (!pmc) p970_compute_mmcr()
350 pmc = (event[i] >> PM_PMC_SH) & PM_PMC_MSK; p970_compute_mmcr()
354 if (!pmc) { p970_compute_mmcr()
360 for (pmc = 0; pmc < 8; ++pmc) { p970_compute_mmcr()
361 if (pmc_inuse & (1 << pmc)) p970_compute_mmcr()
363 grp = (pmc >> 1) & 1; p970_compute_mmcr()
372 pmc_inuse |= 1 << pmc; p970_compute_mmcr()
375 --pmc; p970_compute_mmcr()
378 mmcr1 |= 1ull << mmcr1_adder_bits[pmc]; p970_compute_mmcr()
380 pmcsel[pmc] = psel; p970_compute_mmcr()
381 hwc[i] = pmc; p970_compute_mmcr()
387 for (pmc = 0; pmc < 2; ++pmc) p970_compute_mmcr()
388 mmcr0 |= pmcsel[pmc] << (MMCR0_PMC1SEL_SH - 7 * pmc); p970_compute_mmcr()
389 for (; pmc < 8; ++pmc) p970_compute_mmcr()
390 mmcr1 |= (unsigned long)pmcsel[pmc] p970_compute_mmcr()
391 << (MMCR1_PMC3SEL_SH - 5 * (pmc - 2)); p970_compute_mmcr()
406 static void p970_disable_pmc(unsigned int pmc, unsigned long mmcr[]) p970_disable_pmc() argument
410 if (pmc <= 1) { p970_disable_pmc()
411 shift = MMCR0_PMC1SEL_SH - 7 * pmc; p970_disable_pmc()
414 shift = MMCR1_PMC3SEL_SH - 5 * (pmc - 2); p970_disable_pmc()
H A Dpower7-pmu.c88 int pmc, sh, unit; power7_get_constraint() local
91 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; power7_get_constraint()
92 if (pmc) { power7_get_constraint()
93 if (pmc > 6) power7_get_constraint()
95 sh = (pmc - 1) * 2; power7_get_constraint()
98 if (pmc >= 5 && !(event == 0x500fa || event == 0x600f4)) power7_get_constraint()
101 if (pmc < 5) { power7_get_constraint()
148 int pmc, psel; find_alternative_decode() local
151 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; find_alternative_decode()
153 if ((pmc == 2 || pmc == 4) && (psel & ~7) == 0x40) find_alternative_decode()
155 if ((pmc == 1 || pmc == 3) && (psel & ~7) == 0x48) find_alternative_decode()
217 int pmc, psel; power7_marked_instr_event() local
220 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; power7_marked_instr_event()
223 if (pmc >= 5) power7_marked_instr_event()
228 return pmc == 2 || pmc == 4; power7_marked_instr_event()
231 return pmc == 1; power7_marked_instr_event()
233 return pmc != 2; power7_marked_instr_event()
240 return pmc >= 3; power7_marked_instr_event()
252 unsigned int pmc, unit, combine, l2sel, psel; power7_compute_mmcr() local
258 pmc = (event[i] >> PM_PMC_SH) & PM_PMC_MSK; power7_compute_mmcr()
259 if (pmc) { power7_compute_mmcr()
260 if (pmc > 6) power7_compute_mmcr()
262 if (pmc_inuse & (1 << (pmc - 1))) power7_compute_mmcr()
264 pmc_inuse |= 1 << (pmc - 1); power7_compute_mmcr()
270 pmc = (event[i] >> PM_PMC_SH) & PM_PMC_MSK; power7_compute_mmcr()
275 if (!pmc) { power7_compute_mmcr()
277 for (pmc = 0; pmc < 4; ++pmc) { power7_compute_mmcr()
278 if (!(pmc_inuse & (1 << pmc))) power7_compute_mmcr()
281 if (pmc >= 4) power7_compute_mmcr()
283 pmc_inuse |= 1 << pmc; power7_compute_mmcr()
286 --pmc; power7_compute_mmcr()
288 if (pmc <= 3) { power7_compute_mmcr()
290 << (MMCR1_TTM0SEL_SH - 4 * pmc); power7_compute_mmcr()
292 << (MMCR1_PMC1_COMBINE_SH - pmc); power7_compute_mmcr()
293 mmcr1 |= psel << MMCR1_PMCSEL_SH(pmc); power7_compute_mmcr()
300 hwc[i] = pmc; power7_compute_mmcr()
314 static void power7_disable_pmc(unsigned int pmc, unsigned long mmcr[]) power7_disable_pmc() argument
316 if (pmc <= 3) power7_disable_pmc()
317 mmcr[1] &= ~(0xffUL << MMCR1_PMCSEL_SH(pmc)); power7_disable_pmc()
H A Dpower5+-pmu.c139 int pmc, byte, unit, sh; power5p_get_constraint() local
143 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; power5p_get_constraint()
144 if (pmc) { power5p_get_constraint()
145 if (pmc > 6) power5p_get_constraint()
147 sh = (pmc - 1) * 2; power5p_get_constraint()
150 if (pmc >= 5 && !(event == 0x500009 || event == 0x600005)) power5p_get_constraint()
181 if (pmc < 5) { power5p_get_constraint()
193 int pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; power5p_limited_pmc_event() local
195 return pmc == 5 || pmc == 6; power5p_limited_pmc_event()
247 int pmc, altpmc, pp, j; find_alternative_bdecode() local
249 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; find_alternative_bdecode()
250 if (pmc == 0 || pmc > 4) find_alternative_bdecode()
252 altpmc = 5 - pmc; /* 1 <-> 4, 2 <-> 3 */ find_alternative_bdecode()
255 if (bytedecode_alternatives[pmc - 1][j] == pp) { find_alternative_bdecode()
263 if (pmc == 1 && (pp == 0x0d || pp == 0x0e)) find_alternative_bdecode()
265 if (pmc == 3 && (pp == 0x2e || pp == 0x2f)) find_alternative_bdecode()
407 int pmc, psel; power5p_marked_instr_event() local
411 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; power5p_marked_instr_event()
413 if (pmc >= 5) power5p_marked_instr_event()
418 if (direct_event_is_marked[psel] & (1 << pmc)) power5p_marked_instr_event()
423 bit = pmc - 1; power5p_marked_instr_event()
425 bit = 4 - pmc; power5p_marked_instr_event()
426 else if (psel == 0x1b && (pmc == 1 || pmc == 3)) power5p_marked_instr_event()
431 bit = pmc - 1; power5p_marked_instr_event()
432 } else if (pmc == 3 && (psel == 0x2e || psel == 0x2f)) { power5p_marked_instr_event()
459 unsigned int pmc, unit, byte, psel; power5p_compute_mmcr() local
474 pmc = (event[i] >> PM_PMC_SH) & PM_PMC_MSK; power5p_compute_mmcr()
475 if (pmc) { power5p_compute_mmcr()
476 if (pmc > 6) power5p_compute_mmcr()
478 if (pmc_inuse & (1 << (pmc - 1))) power5p_compute_mmcr()
480 pmc_inuse |= 1 << (pmc - 1); power5p_compute_mmcr()
552 pmc = (event[i] >> PM_PMC_SH) & PM_PMC_MSK; power5p_compute_mmcr()
557 if (!pmc) { power5p_compute_mmcr()
559 for (pmc = 0; pmc < 4; ++pmc) { power5p_compute_mmcr()
560 if (!(pmc_inuse & (1 << pmc))) power5p_compute_mmcr()
563 if (pmc >= 4) power5p_compute_mmcr()
565 pmc_inuse |= 1 << pmc; power5p_compute_mmcr()
566 } else if (pmc <= 4) { power5p_compute_mmcr()
568 --pmc; power5p_compute_mmcr()
572 mmcr1 |= 1ul << (MMCR1_PMC1_ADDER_SEL_SH - pmc); power5p_compute_mmcr()
575 --pmc; power5p_compute_mmcr()
584 if ((psel & 0x58) == 0x40 && (byte & 1) != ((pmc >> 1) & 1)) power5p_compute_mmcr()
587 if (pmc <= 3) power5p_compute_mmcr()
588 mmcr1 |= psel << MMCR1_PMCSEL_SH(pmc); power5p_compute_mmcr()
589 hwc[i] = pmc; power5p_compute_mmcr()
603 static void power5p_disable_pmc(unsigned int pmc, unsigned long mmcr[]) power5p_disable_pmc() argument
605 if (pmc <= 3) power5p_disable_pmc()
606 mmcr[1] &= ~(0x7fUL << MMCR1_PMCSEL_SH(pmc)); power5p_disable_pmc()
H A Dpower5-pmu.c143 int pmc, byte, unit, sh; power5_get_constraint() local
148 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; power5_get_constraint()
149 if (pmc) { power5_get_constraint()
150 if (pmc > 6) power5_get_constraint()
152 sh = (pmc - 1) * 2; power5_get_constraint()
155 if (pmc <= 4) power5_get_constraint()
156 grp = (pmc - 1) >> 1; power5_get_constraint()
188 if (!pmc) power5_get_constraint()
203 if (pmc < 5) { power5_get_constraint()
255 int pmc, altpmc, pp, j; find_alternative_bdecode() local
257 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; find_alternative_bdecode()
258 if (pmc == 0 || pmc > 4) find_alternative_bdecode()
260 altpmc = 5 - pmc; /* 1 <-> 4, 2 <-> 3 */ find_alternative_bdecode()
263 if (bytedecode_alternatives[pmc - 1][j] == pp) { find_alternative_bdecode()
343 int pmc, psel; power5_marked_instr_event() local
347 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; power5_marked_instr_event()
349 if (pmc >= 5) power5_marked_instr_event()
354 if (direct_event_is_marked[psel] & (1 << pmc)) power5_marked_instr_event()
359 bit = pmc - 1; power5_marked_instr_event()
361 bit = 4 - pmc; power5_marked_instr_event()
362 else if (psel == 0x1b && (pmc == 1 || pmc == 3)) power5_marked_instr_event()
390 unsigned int pmc, unit, byte, psel; power5_compute_mmcr() local
407 pmc = (event[i] >> PM_PMC_SH) & PM_PMC_MSK; power5_compute_mmcr()
408 if (pmc) { power5_compute_mmcr()
409 if (pmc > 6) power5_compute_mmcr()
411 if (pmc_inuse & (1 << (pmc - 1))) power5_compute_mmcr()
413 pmc_inuse |= 1 << (pmc - 1); power5_compute_mmcr()
415 if (pmc <= 4) power5_compute_mmcr()
416 ++pmc_grp_use[(pmc - 1) >> 1]; power5_compute_mmcr()
431 if (!pmc) power5_compute_mmcr()
492 pmc = (event[i] >> PM_PMC_SH) & PM_PMC_MSK; power5_compute_mmcr()
497 if (!pmc) { power5_compute_mmcr()
499 for (pmc = 0; pmc < 4; ++pmc) { power5_compute_mmcr()
500 if (pmc_inuse & (1 << pmc)) power5_compute_mmcr()
502 grp = (pmc >> 1) & 1; power5_compute_mmcr()
511 pmc_inuse |= 1 << pmc; power5_compute_mmcr()
512 } else if (pmc <= 4) { power5_compute_mmcr()
514 --pmc; power5_compute_mmcr()
517 mmcr1 |= 1ul << (MMCR1_PMC1_ADDER_SEL_SH - pmc); power5_compute_mmcr()
520 --pmc; power5_compute_mmcr()
529 if (pmc <= 3) power5_compute_mmcr()
530 mmcr1 |= psel << MMCR1_PMCSEL_SH(pmc); power5_compute_mmcr()
531 hwc[i] = pmc; power5_compute_mmcr()
545 static void power5_disable_pmc(unsigned int pmc, unsigned long mmcr[]) power5_disable_pmc() argument
547 if (pmc <= 3) power5_disable_pmc()
548 mmcr[1] &= ~(0x7fUL << MMCR1_PMCSEL_SH(pmc)); power5_disable_pmc()
H A Dmpc7450-pmu.c43 int pmc; mpc7450_classify_event() local
45 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; mpc7450_classify_event()
46 if (pmc) { mpc7450_classify_event()
47 if (pmc > N_COUNTER) mpc7450_classify_event()
83 int pmc, sel; mpc7450_threshold_use() local
85 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; mpc7450_threshold_use()
87 switch (pmc) { mpc7450_threshold_use()
157 int pmc, class; mpc7450_get_constraint() local
165 pmc = ((unsigned int)event >> PM_PMC_SH) & PM_PMC_MSK; mpc7450_get_constraint()
166 mask = pmcbits[pmc - 1][0]; mpc7450_get_constraint()
167 value = pmcbits[pmc - 1][1]; mpc7450_get_constraint()
272 u32 ev, pmc, thresh; mpc7450_compute_mmcr() local
293 pmc = (ev >> PM_PMC_SH) & PM_PMC_MSK; mpc7450_compute_mmcr()
294 if (pmc_inuse & (1 << (pmc - 1))) mpc7450_compute_mmcr()
301 pmc = ffs(pmc_avail); mpc7450_compute_mmcr()
303 pmc_inuse |= 1 << (pmc - 1); mpc7450_compute_mmcr()
312 ev &= pmcsel_mask[pmc - 1]; mpc7450_compute_mmcr()
313 ev <<= pmcsel_shift[pmc - 1]; mpc7450_compute_mmcr()
314 if (pmc <= 2) mpc7450_compute_mmcr()
318 hwc[event_index[class][i]] = pmc - 1; mpc7450_compute_mmcr()
336 * Note that the pmc argument is 0-based here, not 1-based.
338 static void mpc7450_disable_pmc(unsigned int pmc, unsigned long mmcr[]) mpc7450_disable_pmc() argument
340 if (pmc <= 1) mpc7450_disable_pmc()
341 mmcr[0] &= ~(pmcsel_mask[pmc] << pmcsel_shift[pmc]); mpc7450_disable_pmc()
343 mmcr[1] &= ~(pmcsel_mask[pmc] << pmcsel_shift[pmc]); mpc7450_disable_pmc()
H A Dpower6-pmu.c141 int pmc, psel, ptype; power6_marked_instr_event() local
145 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; power6_marked_instr_event()
147 if (pmc >= 5) power6_marked_instr_event()
153 if (pmc == 0 || !(ptype & (1 << (pmc - 1)))) power6_marked_instr_event()
161 bit = ptype ^ (pmc - 1); power6_marked_instr_event()
183 unsigned int pmc, ev, b, u, s, psel; p6_compute_mmcr() local
190 pmc = (event[i] >> PM_PMC_SH) & PM_PMC_MSK; p6_compute_mmcr()
191 if (pmc) { p6_compute_mmcr()
192 if (pmc_inuse & (1 << (pmc - 1))) p6_compute_mmcr()
194 pmc_inuse |= 1 << (pmc - 1); p6_compute_mmcr()
199 pmc = (ev >> PM_PMC_SH) & PM_PMC_MSK; p6_compute_mmcr()
200 if (pmc) { p6_compute_mmcr()
201 --pmc; p6_compute_mmcr()
204 for (pmc = 0; pmc < 4; ++pmc) p6_compute_mmcr()
205 if (!(pmc_inuse & (1 << pmc))) p6_compute_mmcr()
207 if (pmc >= 4) p6_compute_mmcr()
209 pmc_inuse |= 1 << pmc; p6_compute_mmcr()
211 hwc[i] = pmc; p6_compute_mmcr()
234 mmcr1 |= MMCR1_PMC1_ADDR_SEL >> pmc; p6_compute_mmcr()
237 if (pmc >= 2 && (psel & 0x90) == 0x80) p6_compute_mmcr()
241 mmcr1 |= MMCR1_PMC1_LLA >> pmc; p6_compute_mmcr()
243 mmcr1 |= MMCR1_PMC1_LLA_VALUE >> pmc; p6_compute_mmcr()
247 if (pmc < 4) p6_compute_mmcr()
248 mmcr1 |= (unsigned long)psel << MMCR1_PMCSEL_SH(pmc); p6_compute_mmcr()
273 int pmc, byte, sh, subunit; p6_get_constraint() local
276 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; p6_get_constraint()
277 if (pmc) { p6_get_constraint()
278 if (pmc > 4 && !(event == 0x500009 || event == 0x600005)) p6_get_constraint()
280 sh = (pmc - 1) * 2; p6_get_constraint()
295 if (pmc <= 4) { p6_get_constraint()
306 int pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; p6_limited_pmc_event() local
308 return pmc == 5 || pmc == 6; p6_limited_pmc_event()
365 unsigned int psel, pmc; p6_get_alternatives() local
389 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; p6_get_alternatives()
390 if (pmc && (psel == 0x32 || psel == 0x34)) p6_get_alternatives()
392 ((5 - pmc) << PM_PMC_SH); p6_get_alternatives()
395 if (pmc && (psel == 0x38 || psel == 0x3a)) p6_get_alternatives()
397 ((pmc > 2? pmc - 2: pmc + 2) << PM_PMC_SH); p6_get_alternatives()
464 static void p6_disable_pmc(unsigned int pmc, unsigned long mmcr[]) p6_disable_pmc() argument
467 if (pmc <= 3) p6_disable_pmc()
468 mmcr[1] &= ~(0xffUL << MMCR1_PMCSEL_SH(pmc)); p6_disable_pmc()
H A Dpower4-pmu.c220 int pmc, psel, unit, byte, bit; p4_marked_instr_event() local
223 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; p4_marked_instr_event()
225 if (pmc) { p4_marked_instr_event()
226 if (direct_marked_event[pmc - 1] & (1 << psel)) p4_marked_instr_event()
229 bit = (pmc <= 4)? pmc - 1: 8 - pmc; p4_marked_instr_event()
257 int pmc, byte, unit, lower, sh; p4_get_constraint() local
261 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; p4_get_constraint()
262 if (pmc) { p4_get_constraint()
263 if (pmc > 8) p4_get_constraint()
265 sh = (pmc - 1) * 2; p4_get_constraint()
268 grp = ((pmc - 1) >> 1) & 1; p4_get_constraint()
279 if (!pmc) p4_get_constraint()
314 if (pmc && (event & PM_PMCSEL_MSK) == 6 && byte == 2) p4_get_constraint()
362 unsigned int pmc, unit, byte, psel, lower; p4_compute_mmcr() local
379 pmc = (event[i] >> PM_PMC_SH) & PM_PMC_MSK; p4_compute_mmcr()
380 if (pmc) { p4_compute_mmcr()
381 if (pmc_inuse & (1 << (pmc - 1))) p4_compute_mmcr()
383 pmc_inuse |= 1 << (pmc - 1); p4_compute_mmcr()
385 ++pmc_grp_use[((pmc - 1) >> 1) & 1]; p4_compute_mmcr()
391 if (!pmc) p4_compute_mmcr()
471 pmc = (event[i] >> PM_PMC_SH) & PM_PMC_MSK; p4_compute_mmcr()
475 if (!pmc) { p4_compute_mmcr()
479 for (pmc = 0; pmc < 8; ++pmc) { p4_compute_mmcr()
480 if (pmc_inuse & (1 << pmc)) p4_compute_mmcr()
482 grp = (pmc >> 1) & 1; p4_compute_mmcr()
491 pmc_inuse |= 1 << pmc; p4_compute_mmcr()
494 --pmc; p4_compute_mmcr()
497 mmcr1 |= 1ull << mmcr1_adder_bits[pmc]; p4_compute_mmcr()
503 if (pmc <= 1) p4_compute_mmcr()
504 mmcr0 |= psel << (MMCR0_PMC1SEL_SH - 7 * pmc); p4_compute_mmcr()
506 mmcr1 |= psel << (MMCR1_PMC3SEL_SH - 5 * (pmc - 2)); p4_compute_mmcr()
507 if (pmc == 7) /* PMC8 */ p4_compute_mmcr()
509 hwc[i] = pmc; p4_compute_mmcr()
528 static void p4_disable_pmc(unsigned int pmc, unsigned long mmcr[]) p4_disable_pmc() argument
532 * (Note that pmc is 0-based here, not 1-based.) p4_disable_pmc()
534 if (pmc <= 1) { p4_disable_pmc()
535 mmcr[0] &= ~(0x1fUL << (MMCR0_PMC1SEL_SH - 7 * pmc)); p4_disable_pmc()
537 mmcr[1] &= ~(0x1fUL << (MMCR1_PMC3SEL_SH - 5 * (pmc - 2))); p4_disable_pmc()
538 if (pmc == 7) p4_disable_pmc()
H A Dpower8-pmu.c76 * [ ] [ sample ] [cache] [ pmc ] [unit ] c m [ pmcxsel ]
90 * if pmc == 3 and unit == 0 and pmcxsel[0:6] == 0b0101011
93 * else if pmc == 4 and unit == 0xf and pmcxsel[0:6] == 0b0101001
243 #define CNST_PMC_SHIFT(pmc) ((pmc - 1) * 2)
244 #define CNST_PMC_VAL(pmc) (1 << CNST_PMC_SHIFT(pmc))
245 #define CNST_PMC_MASK(pmc) (2 << CNST_PMC_SHIFT(pmc))
254 #define MMCR1_UNIT_SHIFT(pmc) (60 - (4 * ((pmc) - 1)))
255 #define MMCR1_COMBINE_SHIFT(pmc) (35 - ((pmc) - 1))
256 #define MMCR1_PMCSEL_SHIFT(pmc) (24 - (((pmc) - 1)) * 8)
271 #define MMCR2_FCS(pmc) (1ull << (63 - (((pmc) - 1) * 9)))
272 #define MMCR2_FCP(pmc) (1ull << (62 - (((pmc) - 1) * 9)))
273 #define MMCR2_FCH(pmc) (1ull << (57 - (((pmc) - 1) * 9)))
278 /* Only check pmc, unit and pmcxsel, ignore the edge bit (0) */ event_is_fab_match()
287 unsigned int unit, pmc, cache, ebb; power8_get_constraint() local
295 pmc = (event >> EVENT_PMC_SHIFT) & EVENT_PMC_MASK; power8_get_constraint()
300 if (pmc) { power8_get_constraint()
303 if (pmc > 6) power8_get_constraint()
309 if (pmc >= 5 && base_event != 0x500fa && base_event != 0x600f4) power8_get_constraint()
312 mask |= CNST_PMC_MASK(pmc); power8_get_constraint()
313 value |= CNST_PMC_VAL(pmc); power8_get_constraint()
316 if (pmc <= 4) { power8_get_constraint()
374 if (!pmc && ebb) power8_get_constraint()
406 unsigned int pmc, pmc_inuse; power8_compute_mmcr() local
413 pmc = (event[i] >> EVENT_PMC_SHIFT) & EVENT_PMC_MASK; power8_compute_mmcr()
414 if (pmc) power8_compute_mmcr()
415 pmc_inuse |= 1 << pmc; power8_compute_mmcr()
424 pmc = (event[i] >> EVENT_PMC_SHIFT) & EVENT_PMC_MASK; power8_compute_mmcr()
429 if (!pmc) { power8_compute_mmcr()
430 for (pmc = 1; pmc <= 4; ++pmc) { power8_compute_mmcr()
431 if (!(pmc_inuse & (1 << pmc))) power8_compute_mmcr()
435 pmc_inuse |= 1 << pmc; power8_compute_mmcr()
438 if (pmc <= 4) { power8_compute_mmcr()
439 mmcr1 |= unit << MMCR1_UNIT_SHIFT(pmc); power8_compute_mmcr()
440 mmcr1 |= combine << MMCR1_COMBINE_SHIFT(pmc); power8_compute_mmcr()
441 mmcr1 |= psel << MMCR1_PMCSEL_SHIFT(pmc); power8_compute_mmcr()
483 mmcr2 |= MMCR2_FCP(pmc); power8_compute_mmcr()
486 mmcr2 |= MMCR2_FCH(pmc); power8_compute_mmcr()
490 mmcr2 |= MMCR2_FCH(pmc); power8_compute_mmcr()
492 mmcr2 |= MMCR2_FCS(pmc); power8_compute_mmcr()
495 hwc[i] = pmc - 1; power8_compute_mmcr()
601 static void power8_disable_pmc(unsigned int pmc, unsigned long mmcr[]) power8_disable_pmc() argument
603 if (pmc <= 3) power8_disable_pmc()
604 mmcr[1] &= ~(0xffUL << MMCR1_PMCSEL_SHIFT(pmc + 1)); power8_disable_pmc()
612 PMU_FORMAT_ATTR(pmc, "config:16-19");
H A Dcore-fsl-emb.c18 #include <asm/pmc.h>
H A Dcore-book3s.c18 #include <asm/pmc.h>
/linux-4.1.27/tools/testing/selftests/powerpc/pmu/ebb/
H A Debb.h14 #define PMC_INDEX(pmc) ((pmc)-1)
41 static inline void ebb_enable_pmc_counting(int pmc) ebb_enable_pmc_counting() argument
43 ebb_state.pmc_enable[PMC_INDEX(pmc)] = true; ebb_enable_pmc_counting()
46 bool ebb_check_count(int pmc, u64 sample_period, int fudge);
59 int count_pmc(int pmc, uint32_t sample_period);
64 void write_pmc(int pmc, u64 value);
65 u64 read_pmc(int pmc);
H A Debb.c72 bool ebb_check_count(int pmc, u64 sample_period, int fudge) ebb_check_count() argument
76 count = ebb_state.stats.pmc_count[PMC_INDEX(pmc)]; ebb_check_count()
82 pmc, count, lower, lower - count); ebb_check_count()
90 pmc, count, upper, count - upper); ebb_check_count()
95 pmc, count, lower, upper, count - lower, upper - count); ebb_check_count()
172 " pmc[1] count = 0x%llx\n" \ dump_summary_ebb_state()
173 " pmc[2] count = 0x%llx\n" \ dump_summary_ebb_state()
174 " pmc[3] count = 0x%llx\n" \ dump_summary_ebb_state()
175 " pmc[4] count = 0x%llx\n" \ dump_summary_ebb_state()
176 " pmc[5] count = 0x%llx\n" \ dump_summary_ebb_state()
177 " pmc[6] count = 0x%llx\n", dump_summary_ebb_state()
253 int count_pmc(int pmc, uint32_t sample_period) count_pmc() argument
261 val = read_pmc(pmc); count_pmc()
265 ebb_state.stats.pmc_count[PMC_INDEX(pmc)] += val - start_value; count_pmc()
267 trace_log_reg(ebb_state.trace, SPRN_PMC1 + pmc - 1, val); count_pmc()
270 write_pmc(pmc, start_value); count_pmc()
433 void write_pmc(int pmc, u64 value) write_pmc() argument
435 switch (pmc) { write_pmc()
445 u64 read_pmc(int pmc) read_pmc() argument
447 switch (pmc) { read_pmc()
/linux-4.1.27/drivers/soc/tegra/
H A Dpmc.c2 * drivers/soc/tegra/pmc.c
39 #include <soc/tegra/pmc.h>
156 static struct tegra_pmc *pmc = &(struct tegra_pmc) { variable in typeref:struct:tegra_pmc
163 return readl(pmc->base + offset); tegra_pmc_readl()
168 writel(value, pmc->base + offset); tegra_pmc_writel()
180 mutex_lock(&pmc->powergates_lock); tegra_powergate_set()
185 mutex_unlock(&pmc->powergates_lock); tegra_powergate_set()
191 mutex_unlock(&pmc->powergates_lock); tegra_powergate_set()
202 if (!pmc->soc || id < 0 || id >= pmc->soc->num_powergates) tegra_powergate_power_on()
214 if (!pmc->soc || id < 0 || id >= pmc->soc->num_powergates) tegra_powergate_power_off()
229 if (!pmc->soc || id < 0 || id >= pmc->soc->num_powergates) tegra_powergate_is_powered()
244 if (!pmc->soc || id < 0 || id >= pmc->soc->num_powergates) tegra_powergate_remove_clamping()
252 if (pmc->soc->has_gpu_clamps) { tegra_powergate_remove_clamping()
328 if (pmc->soc && cpuid > 0 && cpuid < pmc->soc->num_cpu_powergates) tegra_get_cpu_powergate_id()
329 return pmc->soc->cpu_powergates[cpuid]; tegra_get_cpu_powergate_id()
417 for (i = 0; i < pmc->soc->num_powergates; i++) { powergate_show()
418 if (!pmc->soc->powergates[i]) powergate_show()
421 seq_printf(s, " %9s %7s\n", pmc->soc->powergates[i], powergate_show()
574 return pmc->suspend_mode; tegra_pmc_get_suspend_mode()
582 pmc->suspend_mode = mode; tegra_pmc_set_suspend_mode()
596 rate = clk_get_rate(pmc->clk); tegra_pmc_enter_suspend_mode()
606 if (rate != pmc->rate) { tegra_pmc_enter_suspend_mode()
609 ticks = pmc->cpu_good_time * rate + USEC_PER_SEC - 1; tegra_pmc_enter_suspend_mode()
613 ticks = pmc->cpu_off_time * rate + USEC_PER_SEC - 1; tegra_pmc_enter_suspend_mode()
619 pmc->rate = rate; tegra_pmc_enter_suspend_mode()
629 static int tegra_pmc_parse_dt(struct tegra_pmc *pmc, struct device_node *np) tegra_pmc_parse_dt() argument
637 pmc->suspend_mode = TEGRA_SUSPEND_LP0; tegra_pmc_parse_dt()
641 pmc->suspend_mode = TEGRA_SUSPEND_LP1; tegra_pmc_parse_dt()
645 pmc->suspend_mode = TEGRA_SUSPEND_LP2; tegra_pmc_parse_dt()
649 pmc->suspend_mode = TEGRA_SUSPEND_NONE; tegra_pmc_parse_dt()
654 pmc->suspend_mode = tegra_pm_validate_suspend_mode(pmc->suspend_mode); tegra_pmc_parse_dt()
657 pmc->suspend_mode = TEGRA_SUSPEND_NONE; tegra_pmc_parse_dt()
659 pmc->cpu_good_time = value; tegra_pmc_parse_dt()
662 pmc->suspend_mode = TEGRA_SUSPEND_NONE; tegra_pmc_parse_dt()
664 pmc->cpu_off_time = value; tegra_pmc_parse_dt()
668 pmc->suspend_mode = TEGRA_SUSPEND_NONE; tegra_pmc_parse_dt()
670 pmc->core_osc_time = values[0]; tegra_pmc_parse_dt()
671 pmc->core_pmu_time = values[1]; tegra_pmc_parse_dt()
674 pmc->suspend_mode = TEGRA_SUSPEND_NONE; tegra_pmc_parse_dt()
676 pmc->core_off_time = value; tegra_pmc_parse_dt()
678 pmc->corereq_high = of_property_read_bool(np, tegra_pmc_parse_dt()
681 pmc->sysclkreq_high = of_property_read_bool(np, tegra_pmc_parse_dt()
684 pmc->combined_req = of_property_read_bool(np, tegra_pmc_parse_dt()
687 pmc->cpu_pwr_good_en = of_property_read_bool(np, tegra_pmc_parse_dt()
692 if (pmc->suspend_mode == TEGRA_SUSPEND_LP0) tegra_pmc_parse_dt()
693 pmc->suspend_mode = TEGRA_SUSPEND_LP1; tegra_pmc_parse_dt()
695 pmc->lp0_vec_phys = values[0]; tegra_pmc_parse_dt()
696 pmc->lp0_vec_size = values[1]; tegra_pmc_parse_dt()
701 static void tegra_pmc_init(struct tegra_pmc *pmc) tegra_pmc_init() argument
712 if (pmc->sysclkreq_high) tegra_pmc_init()
726 void tegra_pmc_init_tsense_reset(struct tegra_pmc *pmc) tegra_pmc_init_tsense_reset() argument
730 struct device *dev = pmc->dev; tegra_pmc_init_tsense_reset()
734 if (!pmc->soc->has_tsense_reset) tegra_pmc_init_tsense_reset()
737 np = of_find_node_by_name(pmc->dev->of_node, "i2c-thermtrip"); tegra_pmc_init_tsense_reset()
796 dev_info(pmc->dev, "emergency thermal reset enabled\n"); tegra_pmc_init_tsense_reset()
805 void __iomem *base = pmc->base; tegra_pmc_probe()
809 err = tegra_pmc_parse_dt(pmc, pdev->dev.of_node); tegra_pmc_probe()
815 pmc->base = devm_ioremap_resource(&pdev->dev, res); tegra_pmc_probe()
816 if (IS_ERR(pmc->base)) tegra_pmc_probe()
817 return PTR_ERR(pmc->base); tegra_pmc_probe()
821 pmc->clk = devm_clk_get(&pdev->dev, "pclk"); tegra_pmc_probe()
822 if (IS_ERR(pmc->clk)) { tegra_pmc_probe()
823 err = PTR_ERR(pmc->clk); tegra_pmc_probe()
828 pmc->dev = &pdev->dev; tegra_pmc_probe()
830 tegra_pmc_init(pmc); tegra_pmc_probe()
832 tegra_pmc_init_tsense_reset(pmc); tegra_pmc_probe()
995 { .compatible = "nvidia,tegra124-pmc", .data = &tegra124_pmc_soc },
996 { .compatible = "nvidia,tegra114-pmc", .data = &tegra114_pmc_soc },
997 { .compatible = "nvidia,tegra30-pmc", .data = &tegra30_pmc_soc },
998 { .compatible = "nvidia,tegra20-pmc", .data = &tegra20_pmc_soc },
1004 .name = "tegra-pmc",
1040 pmc->soc = match->data; tegra_pmc_early_init()
1048 pmc->base = ioremap_nocache(regs.start, resource_size(&regs)); tegra_pmc_early_init()
1049 if (!pmc->base) { tegra_pmc_early_init()
1054 mutex_init(&pmc->powergates_lock); tegra_pmc_early_init()
/linux-4.1.27/net/ipv6/
H A Dmcast.c83 static void mld_add_delrec(struct inet6_dev *idev, struct ifmcaddr6 *pmc);
87 static int sf_setstate(struct ifmcaddr6 *pmc);
88 static void sf_markstate(struct ifmcaddr6 *pmc);
89 static void ip6_mc_clear_src(struct ifmcaddr6 *pmc);
118 #define for_each_pmc_rcu(np, pmc) \
119 for (pmc = rcu_dereference(np->ipv6_mc_list); \
120 pmc != NULL; \
121 pmc = rcu_dereference(pmc->next))
315 struct ipv6_mc_socklist *pmc; ip6_mc_source() local
340 for_each_pmc_rcu(inet6, pmc) { for_each_pmc_rcu()
341 if (pgsr->gsr_interface && pmc->ifindex != pgsr->gsr_interface) for_each_pmc_rcu()
343 if (ipv6_addr_equal(&pmc->addr, group)) for_each_pmc_rcu()
346 if (!pmc) { /* must have a prior join */
351 if (pmc->sflist) {
352 if (pmc->sfmode != omode) {
356 } else if (pmc->sfmode != omode) {
359 ip6_mc_del_src(idev, group, pmc->sfmode, 0, NULL, 0);
360 pmc->sfmode = omode;
363 write_lock(&pmc->sflock);
366 psl = pmc->sflist;
418 pmc->sflist = psl = newpsl;
435 write_unlock(&pmc->sflock);
446 struct ipv6_mc_socklist *pmc; ip6_mc_msfilter() local
477 for_each_pmc_rcu(inet6, pmc) { for_each_pmc_rcu()
478 if (pmc->ifindex != gsf->gf_interface) for_each_pmc_rcu()
480 if (ipv6_addr_equal(&pmc->addr, group)) for_each_pmc_rcu()
483 if (!pmc) { /* must have a prior join */
512 write_lock(&pmc->sflock);
513 psl = pmc->sflist;
515 (void) ip6_mc_del_src(idev, group, pmc->sfmode,
519 (void) ip6_mc_del_src(idev, group, pmc->sfmode, 0, NULL, 0);
520 pmc->sflist = newpsl;
521 pmc->sfmode = gsf->gf_fmode;
522 write_unlock(&pmc->sflock);
537 struct ipv6_mc_socklist *pmc; ip6_mc_msfget() local
562 for_each_pmc_rcu(inet6, pmc) { for_each_pmc_rcu()
563 if (pmc->ifindex != gsf->gf_interface) for_each_pmc_rcu()
565 if (ipv6_addr_equal(group, &pmc->addr)) for_each_pmc_rcu()
568 if (!pmc) /* must have a prior join */
570 gsf->gf_fmode = pmc->sfmode;
571 psl = pmc->sflist;
583 * on pmc->sflock. We have the socket lock so reading here is safe.
708 struct ifmcaddr6 *pmc; mld_add_delrec() local
716 pmc = kzalloc(sizeof(*pmc), GFP_ATOMIC); mld_add_delrec()
717 if (!pmc) mld_add_delrec()
721 spin_lock_init(&pmc->mca_lock); mld_add_delrec()
722 pmc->idev = im->idev; mld_add_delrec()
724 pmc->mca_addr = im->mca_addr; mld_add_delrec()
725 pmc->mca_crcount = idev->mc_qrv; mld_add_delrec()
726 pmc->mca_sfmode = im->mca_sfmode; mld_add_delrec()
727 if (pmc->mca_sfmode == MCAST_INCLUDE) { mld_add_delrec()
730 pmc->mca_tomb = im->mca_tomb; mld_add_delrec()
731 pmc->mca_sources = im->mca_sources; mld_add_delrec()
733 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) mld_add_delrec()
734 psf->sf_crcount = pmc->mca_crcount; mld_add_delrec()
739 pmc->next = idev->mc_tomb; mld_add_delrec()
740 idev->mc_tomb = pmc; mld_add_delrec()
746 struct ifmcaddr6 *pmc, *pmc_prev; mld_del_delrec() local
751 for (pmc = idev->mc_tomb; pmc; pmc = pmc->next) { mld_del_delrec()
752 if (ipv6_addr_equal(&pmc->mca_addr, pmca)) mld_del_delrec()
754 pmc_prev = pmc; mld_del_delrec()
756 if (pmc) { mld_del_delrec()
758 pmc_prev->next = pmc->next; mld_del_delrec()
760 idev->mc_tomb = pmc->next; mld_del_delrec()
764 if (pmc) { mld_del_delrec()
765 for (psf = pmc->mca_tomb; psf; psf = psf_next) { mld_del_delrec()
769 in6_dev_put(pmc->idev); mld_del_delrec()
770 kfree(pmc); mld_del_delrec()
776 struct ifmcaddr6 *pmc, *nextpmc; mld_clear_delrec() local
779 pmc = idev->mc_tomb; mld_clear_delrec()
783 for (; pmc; pmc = nextpmc) { mld_clear_delrec()
784 nextpmc = pmc->next; mld_clear_delrec()
785 ip6_mc_clear_src(pmc); mld_clear_delrec()
786 in6_dev_put(pmc->idev); mld_clear_delrec()
787 kfree(pmc); mld_clear_delrec()
792 for (pmc = idev->mc_list; pmc; pmc = pmc->next) { mld_clear_delrec()
795 spin_lock_bh(&pmc->mca_lock); mld_clear_delrec()
796 psf = pmc->mca_tomb; mld_clear_delrec()
797 pmc->mca_tomb = NULL; mld_clear_delrec()
798 spin_unlock_bh(&pmc->mca_lock); mld_clear_delrec()
1068 static bool mld_xmarksources(struct ifmcaddr6 *pmc, int nsrcs, mld_xmarksources() argument
1075 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) { mld_xmarksources()
1081 pmc->mca_sfcount[MCAST_EXCLUDE] != mld_xmarksources()
1090 pmc->mca_flags &= ~MAF_GSQUERY; mld_xmarksources()
1096 static bool mld_marksources(struct ifmcaddr6 *pmc, int nsrcs, mld_marksources() argument
1102 if (pmc->mca_sfmode == MCAST_EXCLUDE) mld_marksources()
1103 return mld_xmarksources(pmc, nsrcs, srcs); mld_marksources()
1108 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) { mld_marksources()
1120 pmc->mca_flags &= ~MAF_GSQUERY; mld_marksources()
1123 pmc->mca_flags |= MAF_GSQUERY; mld_marksources()
1468 static bool is_in(struct ifmcaddr6 *pmc, struct ip6_sf_list *psf, int type, is_in() argument
1476 if (!((pmc->mca_flags & MAF_GSQUERY) && !psf->sf_gsresp)) { is_in()
1477 if (pmc->mca_sfmode == MCAST_INCLUDE) is_in()
1484 return pmc->mca_sfcount[MCAST_EXCLUDE] == is_in()
1495 if (pmc->mca_sfcount[MCAST_EXCLUDE] == 0 || is_in()
1498 return pmc->mca_sfcount[MCAST_EXCLUDE] == is_in()
1503 return (pmc->mca_sfmode == MCAST_INCLUDE) ^ sdeleted; is_in()
1505 if (pmc->mca_sfmode == MCAST_INCLUDE) is_in()
1513 mld_scount(struct ifmcaddr6 *pmc, int type, int gdeleted, int sdeleted) mld_scount() argument
1518 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) { mld_scount()
1519 if (!is_in(pmc, psf, type, gdeleted, sdeleted)) mld_scount()
1666 static int grec_size(struct ifmcaddr6 *pmc, int type, int gdel, int sdel) grec_size() argument
1668 return sizeof(struct mld2_grec) + 16 * mld_scount(pmc,type,gdel,sdel); grec_size()
1671 static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc, add_grhead() argument
1674 struct net_device *dev = pmc->idev->dev; add_grhead()
1679 skb = mld_newpack(pmc->idev, dev->mtu); add_grhead()
1686 pgr->grec_mca = pmc->mca_addr; /* structure copy */ add_grhead()
1695 static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, add_grec() argument
1698 struct inet6_dev *idev = pmc->idev; add_grec()
1705 if (pmc->mca_flags & MAF_NOREPORT) add_grec()
1715 psf_list = sdeleted ? &pmc->mca_tomb : &pmc->mca_sources; add_grec()
1725 AVAILABLE(skb) < grec_size(pmc, type, gdeleted, sdeleted)) { add_grec()
1738 if (!is_in(pmc, psf, type, gdeleted, sdeleted)) { add_grec()
1760 skb = add_grhead(skb, pmc, type, &pgr); add_grec()
1788 if (pmc->mca_crcount || isquery || crsend) { add_grec()
1794 skb = add_grhead(skb, pmc, type, &pgr); add_grec()
1801 pmc->mca_flags &= ~MAF_GSQUERY; /* clear query state */ add_grec()
1805 static void mld_send_report(struct inet6_dev *idev, struct ifmcaddr6 *pmc) mld_send_report() argument
1811 if (!pmc) { mld_send_report()
1812 for (pmc = idev->mc_list; pmc; pmc = pmc->next) { mld_send_report()
1813 if (pmc->mca_flags & MAF_NOREPORT) mld_send_report()
1815 spin_lock_bh(&pmc->mca_lock); mld_send_report()
1816 if (pmc->mca_sfcount[MCAST_EXCLUDE]) mld_send_report()
1820 skb = add_grec(skb, pmc, type, 0, 0, 0); mld_send_report()
1821 spin_unlock_bh(&pmc->mca_lock); mld_send_report()
1824 spin_lock_bh(&pmc->mca_lock); mld_send_report()
1825 if (pmc->mca_sfcount[MCAST_EXCLUDE]) mld_send_report()
1829 skb = add_grec(skb, pmc, type, 0, 0, 0); mld_send_report()
1830 spin_unlock_bh(&pmc->mca_lock); mld_send_report()
1860 struct ifmcaddr6 *pmc, *pmc_prev, *pmc_next; mld_send_cr() local
1869 for (pmc = idev->mc_tomb; pmc; pmc = pmc_next) { mld_send_cr()
1870 pmc_next = pmc->next; mld_send_cr()
1871 if (pmc->mca_sfmode == MCAST_INCLUDE) { mld_send_cr()
1874 skb = add_grec(skb, pmc, type, 1, 0, 0); mld_send_cr()
1875 skb = add_grec(skb, pmc, dtype, 1, 1, 0); mld_send_cr()
1877 if (pmc->mca_crcount) { mld_send_cr()
1878 if (pmc->mca_sfmode == MCAST_EXCLUDE) { mld_send_cr()
1880 skb = add_grec(skb, pmc, type, 1, 0, 0); mld_send_cr()
1882 pmc->mca_crcount--; mld_send_cr()
1883 if (pmc->mca_crcount == 0) { mld_send_cr()
1884 mld_clear_zeros(&pmc->mca_tomb); mld_send_cr()
1885 mld_clear_zeros(&pmc->mca_sources); mld_send_cr()
1888 if (pmc->mca_crcount == 0 && !pmc->mca_tomb && mld_send_cr()
1889 !pmc->mca_sources) { mld_send_cr()
1894 in6_dev_put(pmc->idev); mld_send_cr()
1895 kfree(pmc); mld_send_cr()
1897 pmc_prev = pmc; mld_send_cr()
1902 for (pmc = idev->mc_list; pmc; pmc = pmc->next) { mld_send_cr()
1903 spin_lock_bh(&pmc->mca_lock); mld_send_cr()
1904 if (pmc->mca_sfcount[MCAST_EXCLUDE]) { mld_send_cr()
1911 skb = add_grec(skb, pmc, type, 0, 0, 0); mld_send_cr()
1912 skb = add_grec(skb, pmc, dtype, 0, 1, 0); /* deleted sources */ mld_send_cr()
1915 if (pmc->mca_crcount) { mld_send_cr()
1916 if (pmc->mca_sfmode == MCAST_EXCLUDE) mld_send_cr()
1920 skb = add_grec(skb, pmc, type, 0, 0, 0); mld_send_cr()
1921 pmc->mca_crcount--; mld_send_cr()
1923 spin_unlock_bh(&pmc->mca_lock); mld_send_cr()
2030 struct ifmcaddr6 *pmc; mld_send_initial_cr() local
2038 for (pmc = idev->mc_list; pmc; pmc = pmc->next) { mld_send_initial_cr()
2039 spin_lock_bh(&pmc->mca_lock); mld_send_initial_cr()
2040 if (pmc->mca_sfcount[MCAST_EXCLUDE]) mld_send_initial_cr()
2044 skb = add_grec(skb, pmc, type, 0, 0, 1); mld_send_initial_cr()
2045 spin_unlock_bh(&pmc->mca_lock); mld_send_initial_cr()
2076 static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode, ip6_mc_del1_src() argument
2083 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) { ip6_mc_del1_src()
2094 struct inet6_dev *idev = pmc->idev; ip6_mc_del1_src()
2100 pmc->mca_sources = psf->sf_next; ip6_mc_del1_src()
2101 if (psf->sf_oldin && !(pmc->mca_flags & MAF_NOREPORT) && ip6_mc_del1_src()
2104 psf->sf_next = pmc->mca_tomb; ip6_mc_del1_src()
2105 pmc->mca_tomb = psf; ip6_mc_del1_src()
2117 struct ifmcaddr6 *pmc; ip6_mc_del_src() local
2124 for (pmc = idev->mc_list; pmc; pmc = pmc->next) { ip6_mc_del_src()
2125 if (ipv6_addr_equal(pmca, &pmc->mca_addr)) ip6_mc_del_src()
2128 if (!pmc) { ip6_mc_del_src()
2133 spin_lock_bh(&pmc->mca_lock); ip6_mc_del_src()
2134 sf_markstate(pmc); ip6_mc_del_src()
2136 if (!pmc->mca_sfcount[sfmode]) { ip6_mc_del_src()
2137 spin_unlock_bh(&pmc->mca_lock); ip6_mc_del_src()
2141 pmc->mca_sfcount[sfmode]--; ip6_mc_del_src()
2145 int rv = ip6_mc_del1_src(pmc, sfmode, &psfsrc[i]); ip6_mc_del_src()
2151 if (pmc->mca_sfmode == MCAST_EXCLUDE && ip6_mc_del_src()
2152 pmc->mca_sfcount[MCAST_EXCLUDE] == 0 && ip6_mc_del_src()
2153 pmc->mca_sfcount[MCAST_INCLUDE]) { ip6_mc_del_src()
2157 pmc->mca_sfmode = MCAST_INCLUDE; ip6_mc_del_src()
2158 pmc->mca_crcount = idev->mc_qrv; ip6_mc_del_src()
2159 idev->mc_ifc_count = pmc->mca_crcount; ip6_mc_del_src()
2160 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) ip6_mc_del_src()
2162 mld_ifc_event(pmc->idev); ip6_mc_del_src()
2163 } else if (sf_setstate(pmc) || changerec) ip6_mc_del_src()
2164 mld_ifc_event(pmc->idev); ip6_mc_del_src()
2165 spin_unlock_bh(&pmc->mca_lock); ip6_mc_del_src()
2173 static int ip6_mc_add1_src(struct ifmcaddr6 *pmc, int sfmode, ip6_mc_add1_src() argument
2179 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) { ip6_mc_add1_src()
2193 pmc->mca_sources = psf; ip6_mc_add1_src()
2199 static void sf_markstate(struct ifmcaddr6 *pmc) sf_markstate() argument
2202 int mca_xcount = pmc->mca_sfcount[MCAST_EXCLUDE]; sf_markstate()
2204 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) sf_markstate()
2205 if (pmc->mca_sfcount[MCAST_EXCLUDE]) { sf_markstate()
2213 static int sf_setstate(struct ifmcaddr6 *pmc) sf_setstate() argument
2216 int mca_xcount = pmc->mca_sfcount[MCAST_EXCLUDE]; sf_setstate()
2217 int qrv = pmc->idev->mc_qrv; sf_setstate()
2221 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) { sf_setstate()
2222 if (pmc->mca_sfcount[MCAST_EXCLUDE]) { sf_setstate()
2231 for (dpsf = pmc->mca_tomb; dpsf; sf_setstate()
2242 pmc->mca_tomb = dpsf->sf_next; sf_setstate()
2254 for (dpsf = pmc->mca_tomb; dpsf; dpsf = dpsf->sf_next) sf_setstate()
2263 /* pmc->mca_lock held by callers */ sf_setstate()
2264 dpsf->sf_next = pmc->mca_tomb; sf_setstate()
2265 pmc->mca_tomb = dpsf; sf_setstate()
2281 struct ifmcaddr6 *pmc; ip6_mc_add_src() local
2288 for (pmc = idev->mc_list; pmc; pmc = pmc->next) { ip6_mc_add_src()
2289 if (ipv6_addr_equal(pmca, &pmc->mca_addr)) ip6_mc_add_src()
2292 if (!pmc) { ip6_mc_add_src()
2297 spin_lock_bh(&pmc->mca_lock); ip6_mc_add_src()
2299 sf_markstate(pmc); ip6_mc_add_src()
2300 isexclude = pmc->mca_sfmode == MCAST_EXCLUDE; ip6_mc_add_src()
2302 pmc->mca_sfcount[sfmode]++; ip6_mc_add_src()
2305 err = ip6_mc_add1_src(pmc, sfmode, &psfsrc[i]); ip6_mc_add_src()
2313 pmc->mca_sfcount[sfmode]--; ip6_mc_add_src()
2315 ip6_mc_del1_src(pmc, sfmode, &psfsrc[j]); ip6_mc_add_src()
2316 } else if (isexclude != (pmc->mca_sfcount[MCAST_EXCLUDE] != 0)) { ip6_mc_add_src()
2320 if (pmc->mca_sfcount[MCAST_EXCLUDE]) ip6_mc_add_src()
2321 pmc->mca_sfmode = MCAST_EXCLUDE; ip6_mc_add_src()
2322 else if (pmc->mca_sfcount[MCAST_INCLUDE]) ip6_mc_add_src()
2323 pmc->mca_sfmode = MCAST_INCLUDE; ip6_mc_add_src()
2326 pmc->mca_crcount = idev->mc_qrv; ip6_mc_add_src()
2327 idev->mc_ifc_count = pmc->mca_crcount; ip6_mc_add_src()
2328 for (psf = pmc->mca_sources; psf; psf = psf->sf_next) ip6_mc_add_src()
2331 } else if (sf_setstate(pmc)) ip6_mc_add_src()
2333 spin_unlock_bh(&pmc->mca_lock); ip6_mc_add_src()
2338 static void ip6_mc_clear_src(struct ifmcaddr6 *pmc) ip6_mc_clear_src() argument
2342 for (psf = pmc->mca_tomb; psf; psf = nextpsf) { ip6_mc_clear_src()
2346 pmc->mca_tomb = NULL; ip6_mc_clear_src()
2347 for (psf = pmc->mca_sources; psf; psf = nextpsf) { ip6_mc_clear_src()
2351 pmc->mca_sources = NULL; ip6_mc_clear_src()
2352 pmc->mca_sfmode = MCAST_EXCLUDE; ip6_mc_clear_src()
2353 pmc->mca_sfcount[MCAST_INCLUDE] = 0; ip6_mc_clear_src()
2354 pmc->mca_sfcount[MCAST_EXCLUDE] = 1; ip6_mc_clear_src()
/linux-4.1.27/arch/arm/mach-at91/
H A Dpm_suspend.S22 pmc .req r0 label
30 1: ldr tmp1, [pmc, #AT91_PMC_SR]
39 1: ldr tmp1, [pmc, #AT91_PMC_SR]
48 1: ldr tmp1, [pmc, #AT91_PMC_SR]
60 str tmp1, [pmc, #AT91_PMC_SCDR]
76 * void at91_pm_suspend_in_sram(void __iomem *pmc, void __iomem *sdramc,
113 ldr pmc, .pmc_base
116 ldr tmp1, [pmc, #AT91_PMC_MCKR]
123 str tmp1, [pmc, #AT91_PMC_MCKR]
128 ldr tmp1, [pmc, #AT91_CKGR_PLLAR]
133 str tmp1, [pmc, #AT91_CKGR_PLLAR]
136 ldr tmp1, [pmc, #AT91_CKGR_MOR]
139 str tmp1, [pmc, #AT91_CKGR_MOR]
142 ldr pmc, .pmc_base
151 ldr pmc, .pmc_base
154 ldr tmp1, [pmc, #AT91_CKGR_MOR]
157 str tmp1, [pmc, #AT91_CKGR_MOR]
163 str tmp1, [pmc, #AT91_CKGR_PLLAR]
177 str tmp1, [pmc, #AT91_PMC_MCKR]
H A Dpm.c129 static void (*at91_suspend_sram_fn)(void __iomem *pmc, void __iomem *ramc0,
132 extern void at91_pm_suspend_in_sram(void __iomem *pmc, void __iomem *ramc0,
/linux-4.1.27/arch/sparc/kernel/
H A Dpmc.c0 /* pmc - Driver implementation for power management functions
28 #define PMC_OBPNAME "SUNW,pmc"
29 #define PMC_DEVNAME "pmc"
84 .name = "pmc",
H A DMakefile85 obj-$(CONFIG_SUN_PM) += apc.o pmc.o
H A Dprocess_32.c47 * Set in pm platform drivers (apc.c and pmc.c)
/linux-4.1.27/arch/powerpc/oprofile/
H A Dop_model_pa6t.c95 int pmc; pa6t_reg_setup() local
104 for (pmc = 0; pmc < cur_cpu_spec->num_pmcs; pmc++) pa6t_reg_setup()
105 if (!ctr[pmc].enabled) { pa6t_reg_setup()
106 sys->mmcr0 &= ~(0x1UL << pmc); pa6t_reg_setup()
107 sys->mmcr0 &= ~(0x1UL << (pmc+12)); pa6t_reg_setup()
108 pr_debug("turned off counter %u\n", pmc); pa6t_reg_setup()
131 for (pmc = 0; pmc < cur_cpu_spec->num_pmcs; pmc++) { pa6t_reg_setup()
133 reset_value[pmc] = (0x1UL << 39) - ctr[pmc].count; pa6t_reg_setup()
134 pr_debug("reset_value for pmc%u inited to 0x%llx\n", pa6t_reg_setup()
135 pmc, reset_value[pmc]); pa6t_reg_setup()
H A Dop_model_power4.c45 int pmc, cntr_marked_events = 0; power7_marked_instr_event() local
51 for (pmc = 0; pmc < 4; pmc++) { power7_marked_instr_event()
53 << (OPROFILE_MAX_PMC_NUM - pmc) power7_marked_instr_event()
55 psel = (psel >> ((OPROFILE_MAX_PMC_NUM - pmc) power7_marked_instr_event()
59 - (pmc * OPROFILE_PMSEL_FIELD_WIDTH ))); power7_marked_instr_event()
61 - (pmc * OPROFILE_PMSEL_FIELD_WIDTH)); power7_marked_instr_event()
65 cntr_marked_events |= (pmc == 1 || pmc == 3) << pmc; power7_marked_instr_event()
69 cntr_marked_events |= (pmc == 0) << pmc; power7_marked_instr_event()
74 cntr_marked_events |= (pmc != 1) << pmc; power7_marked_instr_event()
78 cntr_marked_events |= 1 << pmc; power7_marked_instr_event()
82 cntr_marked_events |= (unit == 0xd) << pmc; power7_marked_instr_event()
86 cntr_marked_events |= (pmc >= 2) << pmc; power7_marked_instr_event()
89 cntr_marked_events |= (unit == 0xd) << pmc; power7_marked_instr_event()
H A Dop_model_7450.c24 #include <asm/pmc.h>
H A Dcommon.c21 #include <asm/pmc.h>
H A Dop_model_fsl_emb.c23 #include <asm/pmc.h>
H A Dop_model_cell.c448 * pmc values for a given node.
/linux-4.1.27/arch/mips/boot/dts/include/dt-bindings/clock/
H A Dat91.h2 * This header provides constants for AT91 pmc status.
/linux-4.1.27/arch/powerpc/boot/dts/include/dt-bindings/clock/
H A Dat91.h2 * This header provides constants for AT91 pmc status.
/linux-4.1.27/arch/arm64/boot/dts/include/dt-bindings/clock/
H A Dat91.h2 * This header provides constants for AT91 pmc status.
/linux-4.1.27/arch/metag/boot/dts/include/dt-bindings/clock/
H A Dat91.h2 * This header provides constants for AT91 pmc status.
/linux-4.1.27/arch/arm/boot/dts/include/dt-bindings/clock/
H A Dat91.h2 * This header provides constants for AT91 pmc status.
/linux-4.1.27/include/dt-bindings/clock/
H A Dat91.h2 * This header provides constants for AT91 pmc status.
/linux-4.1.27/arch/powerpc/sysdev/
H A Dfsl_pmc.c75 { .compatible = "fsl,mpc8548-pmc", },
76 { .compatible = "fsl,mpc8641d-pmc", },
82 .name = "fsl-pmc",
/linux-4.1.27/arch/tile/kernel/
H A DMakefile29 obj-$(CONFIG_USE_PMC) += pmc.o
H A Dpmc.c22 #include <asm/pmc.h>
H A Dperf_event.c40 #include <asm/pmc.h>
/linux-4.1.27/arch/powerpc/kernel/
H A Dpmc.c2 * arch/powerpc/kernel/pmc.c
22 #include <asm/pmc.h>
H A DMakefile31 irq.o align.o signal_32.o pmc.o vdso.o \
H A Dsysfs.c19 #include <asm/pmc.h>
H A Dasm-offsets.c539 DEFINE(VCPU_PMC, offsetof(struct kvm_vcpu, arch.pmc)); main()
H A Dtraps.c46 #include <asm/pmc.h>
/linux-4.1.27/drivers/video/fbdev/
H A Dvalkyriefb.h24 * pmc-valkyrie.h: Console support for PowerMac "control" display adaptor.
27 * pmc-valkyrie.c: Console support for PowerMac "control" display adaptor.
32 * pmc-control.h: Console support for PowerMac "control" display adaptor.
35 * pmc-control.c: Console support for PowerMac "control" display adaptor.
H A Dvalkyriefb.c17 * pmc-valkyrie.c -- Console support for PowerMac "valkyrie" display adaptor.
/linux-4.1.27/drivers/clk/tegra/
H A Dclk-pll.c189 #define pll_override_readl(offset, p) readl_relaxed(p->pmc + offset)
194 #define pll_override_writel(val, offset, p) writel(val, p->pmc + offset)
278 val = readl_relaxed(pll->pmc + PMC_PLLP_WB0_OVERRIDE); clk_pll_is_enabled()
302 val = readl_relaxed(pll->pmc + PMC_PLLP_WB0_OVERRIDE); _clk_pll_enable()
304 writel_relaxed(val, pll->pmc + PMC_PLLP_WB0_OVERRIDE); _clk_pll_enable()
320 val = readl_relaxed(pll->pmc + PMC_PLLP_WB0_OVERRIDE); _clk_pll_disable()
322 writel_relaxed(val, pll->pmc + PMC_PLLP_WB0_OVERRIDE); _clk_pll_disable()
693 if (!pll->pmc) clk_plle_training()
700 val = readl(pll->pmc + PMC_SATA_PWRGT); clk_plle_training()
702 writel(val, pll->pmc + PMC_SATA_PWRGT); clk_plle_training()
704 val = readl(pll->pmc + PMC_SATA_PWRGT); clk_plle_training()
706 writel(val, pll->pmc + PMC_SATA_PWRGT); clk_plle_training()
708 val = readl(pll->pmc + PMC_SATA_PWRGT); clk_plle_training()
710 writel(val, pll->pmc + PMC_SATA_PWRGT); clk_plle_training()
1415 void __iomem *pmc, struct tegra_clk_pll_params *pll_params, _tegra_init_pll()
1425 pll->pmc = pmc; _tegra_init_pll()
1455 void __iomem *clk_base, void __iomem *pmc, tegra_clk_register_pll()
1464 pll = _tegra_init_pll(clk_base, pmc, pll_params, lock); tegra_clk_register_pll()
1486 void __iomem *clk_base, void __iomem *pmc, tegra_clk_register_plle()
1499 pll = _tegra_init_pll(clk_base, pmc, pll_params, lock); tegra_clk_register_plle()
1559 void __iomem *clk_base, void __iomem *pmc, tegra_clk_register_pllxc()
1599 pll = _tegra_init_pll(clk_base, pmc, pll_params, lock); tegra_clk_register_pllxc()
1612 void __iomem *clk_base, void __iomem *pmc, tegra_clk_register_pllre()
1625 pll = _tegra_init_pll(clk_base, pmc, pll_params, lock); tegra_clk_register_pllre()
1658 void __iomem *clk_base, void __iomem *pmc, tegra_clk_register_pllm()
1684 pll = _tegra_init_pll(clk_base, pmc, pll_params, lock); tegra_clk_register_pllm()
1697 void __iomem *clk_base, void __iomem *pmc, tegra_clk_register_pllc()
1723 pll = _tegra_init_pll(clk_base, pmc, pll_params, lock); tegra_clk_register_pllc()
1414 _tegra_init_pll(void __iomem *clk_base, void __iomem *pmc, struct tegra_clk_pll_params *pll_params, spinlock_t *lock) _tegra_init_pll() argument
1454 tegra_clk_register_pll(const char *name, const char *parent_name, void __iomem *clk_base, void __iomem *pmc, unsigned long flags, struct tegra_clk_pll_params *pll_params, spinlock_t *lock) tegra_clk_register_pll() argument
1485 tegra_clk_register_plle(const char *name, const char *parent_name, void __iomem *clk_base, void __iomem *pmc, unsigned long flags, struct tegra_clk_pll_params *pll_params, spinlock_t *lock) tegra_clk_register_plle() argument
1558 tegra_clk_register_pllxc(const char *name, const char *parent_name, void __iomem *clk_base, void __iomem *pmc, unsigned long flags, struct tegra_clk_pll_params *pll_params, spinlock_t *lock) tegra_clk_register_pllxc() argument
1611 tegra_clk_register_pllre(const char *name, const char *parent_name, void __iomem *clk_base, void __iomem *pmc, unsigned long flags, struct tegra_clk_pll_params *pll_params, spinlock_t *lock, unsigned long parent_rate) tegra_clk_register_pllre() argument
1657 tegra_clk_register_pllm(const char *name, const char *parent_name, void __iomem *clk_base, void __iomem *pmc, unsigned long flags, struct tegra_clk_pll_params *pll_params, spinlock_t *lock) tegra_clk_register_pllm() argument
1696 tegra_clk_register_pllc(const char *name, const char *parent_name, void __iomem *clk_base, void __iomem *pmc, unsigned long flags, struct tegra_clk_pll_params *pll_params, spinlock_t *lock) tegra_clk_register_pllc() argument
H A Dclk.h211 * @pmc: address of PMC, required to read override bits
242 void __iomem *pmc; member in struct:tegra_clk_pll
264 void __iomem *clk_base, void __iomem *pmc,
269 void __iomem *clk_base, void __iomem *pmc,
274 void __iomem *clk_base, void __iomem *pmc,
280 void __iomem *clk_base, void __iomem *pmc,
286 void __iomem *clk_base, void __iomem *pmc,
292 void __iomem *clk_base, void __iomem *pmc,
H A Dclk-tegra114.c1047 void __iomem *pmc) tegra114_pll_init()
1054 pmc, 0, &pll_c_params, NULL); tegra114_pll_init()
1067 clk = tegra_clk_register_pllc("pll_c2", "pll_ref", clk_base, pmc, 0, tegra114_pll_init()
1072 clk = tegra_clk_register_pllc("pll_c3", "pll_ref", clk_base, pmc, 0, tegra114_pll_init()
1077 clk = tegra_clk_register_pllm("pll_m", "pll_ref", clk_base, pmc, tegra114_pll_init()
1100 clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, pmc, 0, tegra114_pll_init()
1128 clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, pmc, 0, tegra114_pll_init()
1138 clk = tegra_clk_register_pll("pll_d2", "pll_ref", clk_base, pmc, 0, tegra114_pll_init()
1148 clk = tegra_clk_register_pllre("pll_re_vco", "pll_ref", clk_base, pmc, tegra114_pll_init()
1278 { .compatible = "nvidia,tegra114-pmc" },
1461 pr_err("Failed to find pmc node\n"); tegra114_clock_init()
1468 pr_err("Can't map pmc registers\n"); tegra114_clock_init()
1046 tegra114_pll_init(void __iomem *clk_base, void __iomem *pmc) tegra114_pll_init() argument
H A Dclk-tegra124.c1156 void __iomem *pmc) tegra124_pll_init()
1163 pmc, 0, &pll_c_params, NULL); tegra124_pll_init()
1184 clk = tegra_clk_register_pllc("pll_c2", "pll_ref", clk_base, pmc, 0, tegra124_pll_init()
1190 clk = tegra_clk_register_pllc("pll_c3", "pll_ref", clk_base, pmc, 0, tegra124_pll_init()
1196 clk = tegra_clk_register_pllm("pll_m", "pll_ref", clk_base, pmc, tegra124_pll_init()
1223 clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, pmc, 0, tegra124_pll_init()
1256 clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, pmc, 0, tegra124_pll_init()
1268 clk = tegra_clk_register_pllre("pll_re_vco", "pll_ref", clk_base, pmc, tegra124_pll_init()
1353 { .compatible = "nvidia,tegra124-pmc" },
1467 pr_err("Failed to find pmc node\n"); tegra124_132_clock_init_pre()
1474 pr_err("Can't map pmc registers\n"); tegra124_132_clock_init_pre()
1155 tegra124_pll_init(void __iomem *clk_base, void __iomem *pmc) tegra124_pll_init() argument
H A Dclk-tegra30.c26 #include <soc/tegra/pmc.h>
1405 { .compatible = "nvidia,tegra30-pmc" },
1421 pr_err("Failed to find pmc node\n"); tegra30_clock_init()
1427 pr_err("Can't map pmc registers\n"); tegra30_clock_init()
H A Dclk-tegra20.c1088 { .compatible = "nvidia,tegra20-pmc" },
1104 pr_err("Failed to find pmc node\n"); tegra20_clock_init()
1110 pr_err("Can't map pmc registers\n"); tegra20_clock_init()
/linux-4.1.27/arch/mn10300/include/asm/
H A Dmmu_context.h65 unsigned long *pmc = &mmu_context_cache[smp_processor_id()]; allocate_mmu_context() local
66 unsigned long mc = ++(*pmc); allocate_mmu_context()
76 *pmc = mc = MMU_CONTEXT_FIRST_VERSION; allocate_mmu_context()
/linux-4.1.27/arch/mips/include/asm/mach-pmcs-msp71xx/
H A Dmsp_int.h5 * Author: Andrew Hughes, Andrew_Hughes@pmc-sierra.com
H A Dmsp_regs.h12 * Author: Andrew Hughes, Andrew_Hughes@pmc-sierra.com
/linux-4.1.27/arch/powerpc/platforms/83xx/
H A Dsuspend.c357 "pmc", ofdev); pmc_probe()
425 .compatible = "fsl,mpc8313-pmc",
429 .compatible = "fsl,mpc8349-pmc",
437 .name = "mpc83xx-pmc",
/linux-4.1.27/arch/mips/pmcs-msp71xx/
H A Dmsp_elb.c6 * Author: Marc St-Jean, Marc_St-Jean@pmc-sierra.com
H A Dmsp_irq_slp.c5 * Author: Andrew Hughes, Andrew_Hughes@pmc-sierra.com
H A Dmsp_setup.c223 * link order in arch/mips/pmc-sierra/msp71xx/Makefile. prom_init()
/linux-4.1.27/arch/powerpc/include/asm/
H A Dpmc.h2 * pmc.h
H A Dperf_event_server.h43 void (*disable_pmc)(unsigned int pmc, unsigned long mmcr[]);
H A Dkvm_host.h524 u32 pmc[8]; member in struct:kvmppc_slb::kvm_vcpu_arch
/linux-4.1.27/arch/arm/mach-vt8500/
H A Dvt8500.c144 np = of_find_compatible_node(NULL, NULL, "via,vt8500-pmc"); vt8500_init()
149 pr_err("%s:of_iomap(pmc) failed\n", __func__); vt8500_init()
/linux-4.1.27/drivers/scsi/aacraid/
H A Dnark.c8 * 2010 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
H A Drkt.c9 * 2010 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
H A Ddpcsup.c9 * 2010 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
H A Dsa.c9 * 2010 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
H A Dcomminit.c9 * 2010 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
H A Drx.c9 * 2010 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
H A Dcommctrl.c9 * 2010 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
H A Dsrc.c9 * 2010 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
H A Dlinit.c9 * 2010 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
H A Dcommsup.c9 * 2010 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
H A Daachba.c9 * 2010 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
/linux-4.1.27/arch/ia64/kernel/
H A Dperfmon_generic.h3 * and pmc checker used by perfmon.c.
H A Dperfmon_mckinley.h3 * and pmc checker used by perfmon.c.
68 DPRINT(("pmc[%d]=0x%lx, mask=0x%lx, reset=0x%lx, val=0x%lx\n", pfm_mck_reserved()
106 DPRINT(("pmc[%d]=0x%lx has active pmc13 settings, clearing dbr\n", cnum, *val)); pfm_mck_pmc_check()
124 DPRINT(("pmc[%d]=0x%lx has active pmc14 settings, clearing ibr\n", cnum, *val)); pfm_mck_pmc_check()
H A Dperfmon_itanium.h3 * and pmc checker used by perfmon.c.
67 DPRINT(("pmc[%d]=0x%lx has active pmc13.ta cleared, clearing ibr\n", cnum, *val)); pfm_ita_pmc_check()
86 DPRINT(("pmc[%d]=0x%lx has active pmc11.pt cleared, clearing dbr\n", cnum, *val)); pfm_ita_pmc_check()
H A Dperfmon_montecito.h3 * and pmc checker used by perfmon.c.
146 DPRINT(("pmc[%d]=0x%lx, mask=0x%lx, reset=0x%lx, val=0x%lx\n", pfm_mont_reserved()
190 DPRINT(("pmc[%d]=0x%lx has active pmc41 settings, clearing dbr\n", cnum, tmpval)); pfm_mont_pmc_check()
H A Dperfmon.c82 * bit4 : pmc has pmc.pm
83 * bit5 : pmc controls a counter (has pmc.oi), pmd is used as counter
90 #define PFM_REG_MONITOR (0x1<<4|PFM_REG_IMPL) /* a PMC with a pmc.pm field only */
91 #define PFM_REG_COUNTING (0x2<<4|PFM_REG_MONITOR) /* a monitor + pmc.oi+ PMD used as a counter */
123 #define PMU_PMC_OI 5 /* position of pmc.oi bit */
981 DPRINT_ovfl(("pmc[%d]=0x%lx\n", i, ctx->th_pmcs[i])); pfm_mask_monitoring()
1065 DPRINT(("[%d] pmc[%d]=0x%lx\n", pfm_restore_monitoring()
1169 DPRINT(("pmc[%d]=0x%lx\n", i, ctx->th_pmcs[i])); pfm_copy_pmcs()
2481 DPRINT(("pmc[%d]=0x%lx\n", i, ctx->ctx_pmcs[i])); pfm_reset_pmu_state()
2488 * On context switched restore, we must restore ALL pmc and ALL pmd even pfm_reset_pmu_state()
2867 DPRINT(("pmc%u is invalid\n", cnum)); pfm_write_pmcs()
2882 DPRINT(("pmc%u is unimplemented or no-access pmc_type=%x\n", cnum, pmc_type)); pfm_write_pmcs()
2892 DPRINT(("pmc%u pmc_pm=%lu is_system=%d\n", pfm_write_pmcs()
2914 DPRINT(("invalid smpl_pmds 0x%lx for pmc%u\n", smpl_pmds, cnum)); pfm_write_pmcs()
2920 DPRINT(("invalid reset_pmds 0x%lx for pmc%u\n", reset_pmds, cnum)); pfm_write_pmcs()
2925 DPRINT(("cannot set ovfl_notify or random on pmc%u\n", cnum)); pfm_write_pmcs()
2990 * we save the value of the pmc in ctx_pmcs[] and if pfm_write_pmcs()
3033 DPRINT(("pmc[%u]=0x%lx ld=%d apmu=%d flags=0x%x all_pmcs=0x%lx used_pmds=0x%lx eventid=%ld smpl_pmds=0x%lx reset_pmds=0x%lx reloads_pmcs=0x%lx used_monitors=0x%lx ovfl_regs=0x%lx\n", pfm_write_pmcs()
4128 DPRINT(("pmc_reset_val pmc[%u]=0x%lx\n", cnum, req->reg_value)); pfm_get_pmc_reset()
5701 "CPU%-2d pmc%u : 0x%lx\n" pfm_proc_show()
6616 printk(KERN_ERR "perfmon: not enough pmc/pmd, perfmon disabled\n"); pfm_init()
6732 printk("->CPU%d pmc[%d]=0x%lx thread_pmc[%d]=0x%lx\n", this_cpu, i, ia64_get_pmc(i), i, ctx->th_pmcs[i]); dump_pmu_state()
/linux-4.1.27/arch/arm/mach-tegra/
H A Dtegra.c39 #include <soc/tegra/pmc.h>
H A Dplatsmp.c25 #include <soc/tegra/pmc.h>
H A Dpm.c32 #include <soc/tegra/pmc.h>
/linux-4.1.27/arch/ia64/include/uapi/asm/
H A Dperfmon.h89 unsigned long reg_value; /* initial pmc/pmd value */
90 unsigned long reg_flags; /* input: pmc/pmd flags, return: reg error */
H A Dgcc_intrin.h434 asm volatile ("mov pmc[%0]=%1" :: "r"(index), "r"(val) : "memory")
473 asm volatile ("mov %0=pmc[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
/linux-4.1.27/include/uapi/linux/
H A Dperf_event.h410 * s64 pmc = 0;
430 * pmc = rdpmc(index - 1);
462 * pmc <<= 64 - width;
463 * pmc >>= 64 - width; // signed shift right
464 * count += pmc;
/linux-4.1.27/drivers/net/wireless/ath/wcn36xx/
H A Ddebug.c23 #include "pmc.h"
H A Dwcn36xx.h29 #include "pmc.h"
/linux-4.1.27/drivers/watchdog/
H A Driowd.c231 .name = "pmc",
/linux-4.1.27/arch/x86/include/asm/
H A Dkvm_emulate.h198 int (*check_pmc)(struct x86_emulate_ctxt *ctxt, u32 pmc);
199 int (*read_pmc)(struct x86_emulate_ctxt *ctxt, u32 pmc, u64 *pdata);
H A Dkvm_host.h1180 int kvm_pmu_check_pmc(struct kvm_vcpu *vcpu, unsigned pmc);
1181 int kvm_pmu_read_pmc(struct kvm_vcpu *vcpu, unsigned pmc, u64 *data);
/linux-4.1.27/drivers/gpu/drm/nouveau/
H A Dnouveau_platform.c32 #include <soc/tegra/pmc.h>
/linux-4.1.27/drivers/ata/
H A Dahci_tegra.c30 #include <soc/tegra/pmc.h>
/linux-4.1.27/drivers/gpu/drm/tegra/
H A Dgr3d.c16 #include <soc/tegra/pmc.h>
H A Dsor.c16 #include <soc/tegra/pmc.h>
H A Ddc.c15 #include <soc/tegra/pmc.h>
/linux-4.1.27/arch/powerpc/platforms/cell/
H A Dpmu.c31 #include <asm/pmc.h>
/linux-4.1.27/drivers/pci/
H A Dpci.c2073 u16 pmc; pci_pm_init() local
2089 pci_read_config_word(dev, pm + PCI_PM_PMC, &pmc); pci_pm_init()
2091 if ((pmc & PCI_PM_CAP_VER_MASK) > 3) { pci_pm_init()
2093 pmc & PCI_PM_CAP_VER_MASK); pci_pm_init()
2105 if (pmc & PCI_PM_CAP_D1) pci_pm_init()
2107 if (pmc & PCI_PM_CAP_D2) pci_pm_init()
2116 pmc &= PCI_PM_CAP_PME_MASK; pci_pm_init()
2117 if (pmc) { pci_pm_init()
2120 (pmc & PCI_PM_CAP_PME_D0) ? " D0" : "", pci_pm_init()
2121 (pmc & PCI_PM_CAP_PME_D1) ? " D1" : "", pci_pm_init()
2122 (pmc & PCI_PM_CAP_PME_D2) ? " D2" : "", pci_pm_init()
2123 (pmc & PCI_PM_CAP_PME_D3) ? " D3hot" : "", pci_pm_init()
2124 (pmc & PCI_PM_CAP_PME_D3cold) ? " D3cold" : ""); pci_pm_init()
2125 dev->pme_support = pmc >> PCI_PM_CAP_PME_SHIFT; pci_pm_init()
/linux-4.1.27/drivers/clk/
H A Dclk-vt8500.c62 of_find_compatible_node(NULL, NULL, "via,vt8500-pmc"); vtwm_set_pmc_base()
71 pr_err("%s:of_iomap(pmc) failed\n", __func__); vtwm_set_pmc_base()
/linux-4.1.27/drivers/mfd/
H A Dsm501.c139 unsigned long pmc = smc501_readl(sm->regs + SM501_POWER_MODE_CONTROL); sm501_dump_clk() local
175 (pmc & 3 ) == 0 ? '*' : '-', sm501_dump_clk()
184 (pmc & 3 ) == 1 ? '*' : '-', sm501_dump_clk()
/linux-4.1.27/arch/powerpc/platforms/powermac/
H A Dsetup.c74 #include <asm/pmc.h>
/linux-4.1.27/drivers/net/wireless/iwlegacy/
H A D3945.h339 u16 pmc; /* abs.ofs: 20 */ member in struct:il3945_eeprom
/linux-4.1.27/arch/powerpc/platforms/pseries/
H A Dsetup.c58 #include <asm/pmc.h>
/linux-4.1.27/drivers/scsi/
H A Dpmcraid.h4 * Written By: Anil Ravindranath<anil_ravindranath@pmc-sierra.com>
H A Dpmcraid.c4 * Written By: Anil Ravindranath<anil_ravindranath@pmc-sierra.com>
84 MODULE_AUTHOR("Anil Ravindranath<anil_ravindranath@pmc-sierra.com>");
/linux-4.1.27/arch/powerpc/kvm/
H A Dbook3s_hv.c1064 *val = get_reg_val(id, vcpu->arch.pmc[i]); kvmppc_get_one_reg_hv()
1256 vcpu->arch.pmc[i] = set_reg_val(id, *val); kvmppc_set_one_reg_hv()
/linux-4.1.27/drivers/pinctrl/
H A Dpinctrl-tegra20.c2130 MUX_PG(pmc, PWR_ON, PWR_INTR, RSVD3, RSVD4, 0x14, 23, 0x98, 18, -1, -1),
/linux-4.1.27/drivers/net/ethernet/broadcom/bnx2x/
H A Dbnx2x_main.c9030 u16 pmc; bnx2x_send_unload_req() local
9045 pci_read_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, &pmc); bnx2x_send_unload_req()
9046 pmc |= PCI_PM_CTRL_PME_ENABLE | PCI_PM_CTRL_PME_STATUS; bnx2x_send_unload_req()
9047 pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, pmc); bnx2x_send_unload_req()
10691 u16 pmc; bnx2x_get_common_hwinfo() local
10859 pci_read_config_word(bp->pdev, bp->pdev->pm_cap + PCI_PM_PMC, &pmc); bnx2x_get_common_hwinfo()
10860 bp->flags |= (pmc & PCI_PM_CAP_PME_D3cold) ? 0 : NO_WOL_FLAG; bnx2x_get_common_hwinfo()
/linux-4.1.27/drivers/pci/host/
H A Dpci-tegra.c50 #include <soc/tegra/pmc.h>

Completed in 3251 milliseconds