#include <linux/hrtimer.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/perf_event.h>
#include <linux/platform_device.h>
#define CCN_NUM_XP_PORTS 2
#define CCN_NUM_REGIONS 256
#define CCN_REGION_SIZE 0x10000
#define CCN_ALL_OLY_ID 0xff00
#define CCN_ALL_OLY_ID__OLY_ID__SHIFT 0
#define CCN_ALL_OLY_ID__OLY_ID__MASK 0x1f
#define CCN_ALL_OLY_ID__NODE_ID__SHIFT 8
#define CCN_ALL_OLY_ID__NODE_ID__MASK 0x3f
#define CCN_MN_ERRINT_STATUS 0x0008
#define CCN_MN_ERRINT_STATUS__INTREQ__DESSERT 0x11
#define CCN_MN_ERRINT_STATUS__ALL_ERRORS__ENABLE 0x02
#define CCN_MN_ERRINT_STATUS__ALL_ERRORS__DISABLED 0x20
#define CCN_MN_ERRINT_STATUS__ALL_ERRORS__DISABLE 0x22
#define CCN_MN_ERRINT_STATUS__CORRECTED_ERRORS_ENABLE 0x04
#define CCN_MN_ERRINT_STATUS__CORRECTED_ERRORS_DISABLED 0x40
#define CCN_MN_ERRINT_STATUS__CORRECTED_ERRORS_DISABLE 0x44
#define CCN_MN_ERRINT_STATUS__PMU_EVENTS__ENABLE 0x08
#define CCN_MN_ERRINT_STATUS__PMU_EVENTS__DISABLED 0x80
#define CCN_MN_ERRINT_STATUS__PMU_EVENTS__DISABLE 0x88
#define CCN_MN_OLY_COMP_LIST_63_0 0x01e0
#define CCN_MN_ERR_SIG_VAL_63_0 0x0300
#define CCN_MN_ERR_SIG_VAL_63_0__DT (1 << 1)
#define CCN_DT_ACTIVE_DSM 0x0000
#define CCN_DT_ACTIVE_DSM__DSM_ID__SHIFT(n) ((n) * 8)
#define CCN_DT_ACTIVE_DSM__DSM_ID__MASK 0xff
#define CCN_DT_CTL 0x0028
#define CCN_DT_CTL__DT_EN (1 << 0)
#define CCN_DT_PMEVCNT(n) (0x0100 + (n) * 0x8)
#define CCN_DT_PMCCNTR 0x0140
#define CCN_DT_PMCCNTRSR 0x0190
#define CCN_DT_PMOVSR 0x0198
#define CCN_DT_PMOVSR_CLR 0x01a0
#define CCN_DT_PMOVSR_CLR__MASK 0x1f
#define CCN_DT_PMCR 0x01a8
#define CCN_DT_PMCR__OVFL_INTR_EN (1 << 6)
#define CCN_DT_PMCR__PMU_EN (1 << 0)
#define CCN_DT_PMSR 0x01b0
#define CCN_DT_PMSR_REQ 0x01b8
#define CCN_DT_PMSR_CLR 0x01c0
#define CCN_HNF_PMU_EVENT_SEL 0x0600
#define CCN_HNF_PMU_EVENT_SEL__ID__SHIFT(n) ((n) * 4)
#define CCN_HNF_PMU_EVENT_SEL__ID__MASK 0xf
#define CCN_XP_DT_CONFIG 0x0300
#define CCN_XP_DT_CONFIG__DT_CFG__SHIFT(n) ((n) * 4)
#define CCN_XP_DT_CONFIG__DT_CFG__MASK 0xf
#define CCN_XP_DT_CONFIG__DT_CFG__PASS_THROUGH 0x0
#define CCN_XP_DT_CONFIG__DT_CFG__WATCHPOINT_0_OR_1 0x1
#define CCN_XP_DT_CONFIG__DT_CFG__WATCHPOINT(n) (0x2 + (n))
#define CCN_XP_DT_CONFIG__DT_CFG__XP_PMU_EVENT(n) (0x4 + (n))
#define CCN_XP_DT_CONFIG__DT_CFG__DEVICE_PMU_EVENT(d, n) (0x8 + (d) * 4 + (n))
#define CCN_XP_DT_INTERFACE_SEL 0x0308
#define CCN_XP_DT_INTERFACE_SEL__DT_IO_SEL__SHIFT(n) (0 + (n) * 8)
#define CCN_XP_DT_INTERFACE_SEL__DT_IO_SEL__MASK 0x1
#define CCN_XP_DT_INTERFACE_SEL__DT_DEV_SEL__SHIFT(n) (1 + (n) * 8)
#define CCN_XP_DT_INTERFACE_SEL__DT_DEV_SEL__MASK 0x1
#define CCN_XP_DT_INTERFACE_SEL__DT_VC_SEL__SHIFT(n) (2 + (n) * 8)
#define CCN_XP_DT_INTERFACE_SEL__DT_VC_SEL__MASK 0x3
#define CCN_XP_DT_CMP_VAL_L(n) (0x0310 + (n) * 0x40)
#define CCN_XP_DT_CMP_VAL_H(n) (0x0318 + (n) * 0x40)
#define CCN_XP_DT_CMP_MASK_L(n) (0x0320 + (n) * 0x40)
#define CCN_XP_DT_CMP_MASK_H(n) (0x0328 + (n) * 0x40)
#define CCN_XP_DT_CONTROL 0x0370