162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef __PCR_H 362306a36Sopenharmony_ci#define __PCR_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_cistruct pcr_ops { 662306a36Sopenharmony_ci u64 (*read_pcr)(unsigned long); 762306a36Sopenharmony_ci void (*write_pcr)(unsigned long, u64); 862306a36Sopenharmony_ci u64 (*read_pic)(unsigned long); 962306a36Sopenharmony_ci void (*write_pic)(unsigned long, u64); 1062306a36Sopenharmony_ci u64 (*nmi_picl_value)(unsigned int nmi_hz); 1162306a36Sopenharmony_ci u64 pcr_nmi_enable; 1262306a36Sopenharmony_ci u64 pcr_nmi_disable; 1362306a36Sopenharmony_ci}; 1462306a36Sopenharmony_ciextern const struct pcr_ops *pcr_ops; 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_civoid deferred_pcr_work_irq(int irq, struct pt_regs *regs); 1762306a36Sopenharmony_civoid schedule_deferred_pcr_work(void); 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci#define PCR_PIC_PRIV 0x00000001 /* PIC access is privileged */ 2062306a36Sopenharmony_ci#define PCR_STRACE 0x00000002 /* Trace supervisor events */ 2162306a36Sopenharmony_ci#define PCR_UTRACE 0x00000004 /* Trace user events */ 2262306a36Sopenharmony_ci#define PCR_N2_HTRACE 0x00000008 /* Trace hypervisor events */ 2362306a36Sopenharmony_ci#define PCR_N2_TOE_OV0 0x00000010 /* Trap if PIC 0 overflows */ 2462306a36Sopenharmony_ci#define PCR_N2_TOE_OV1 0x00000020 /* Trap if PIC 1 overflows */ 2562306a36Sopenharmony_ci#define PCR_N2_MASK0 0x00003fc0 2662306a36Sopenharmony_ci#define PCR_N2_MASK0_SHIFT 6 2762306a36Sopenharmony_ci#define PCR_N2_SL0 0x0003c000 2862306a36Sopenharmony_ci#define PCR_N2_SL0_SHIFT 14 2962306a36Sopenharmony_ci#define PCR_N2_OV0 0x00040000 3062306a36Sopenharmony_ci#define PCR_N2_MASK1 0x07f80000 3162306a36Sopenharmony_ci#define PCR_N2_MASK1_SHIFT 19 3262306a36Sopenharmony_ci#define PCR_N2_SL1 0x78000000 3362306a36Sopenharmony_ci#define PCR_N2_SL1_SHIFT 27 3462306a36Sopenharmony_ci#define PCR_N2_OV1 0x80000000 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci#define PCR_N4_OV 0x00000001 /* PIC overflow */ 3762306a36Sopenharmony_ci#define PCR_N4_TOE 0x00000002 /* Trap On Event */ 3862306a36Sopenharmony_ci#define PCR_N4_UTRACE 0x00000004 /* Trace user events */ 3962306a36Sopenharmony_ci#define PCR_N4_STRACE 0x00000008 /* Trace supervisor events */ 4062306a36Sopenharmony_ci#define PCR_N4_HTRACE 0x00000010 /* Trace hypervisor events */ 4162306a36Sopenharmony_ci#define PCR_N4_MASK 0x000007e0 /* Event mask */ 4262306a36Sopenharmony_ci#define PCR_N4_MASK_SHIFT 5 4362306a36Sopenharmony_ci#define PCR_N4_SL 0x0000f800 /* Event Select */ 4462306a36Sopenharmony_ci#define PCR_N4_SL_SHIFT 11 4562306a36Sopenharmony_ci#define PCR_N4_PICNPT 0x00010000 /* PIC non-privileged trap */ 4662306a36Sopenharmony_ci#define PCR_N4_PICNHT 0x00020000 /* PIC non-hypervisor trap */ 4762306a36Sopenharmony_ci#define PCR_N4_NTC 0x00040000 /* Next-To-Commit wrap */ 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ciint pcr_arch_init(void); 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci#endif /* __PCR_H */ 52