1#
2# Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
3#
4# SPDX-License-Identifier: GPL-2.0-only
5#
6
7cmake_minimum_required(VERSION 3.7.2)
8
9register_driver(
10    compatibility_strings "ti,am335x-timer"
11    PREFIX src/drivers/timer
12    CFILES "am335x-timer.c"
13)
14register_driver(
15    compatibility_strings "qcom,kpss-timer"
16    PREFIX src/drivers/timer
17    CFILES "kpss-timer.c"
18)
19register_driver(
20    compatibility_strings "samsung,exynos4210-mct"
21    PREFIX src/drivers/timer
22    CFILES "exynos4210-mct.c"
23)
24register_driver(
25    compatibility_strings "samsung,exynos4412-mct"
26    PREFIX src/drivers/timer
27    CFILES "exynos4412-mct.c"
28)
29register_driver(
30    compatibility_strings "ti,omap3430-timer"
31    PREFIX src/drivers/timer
32    CFILES "omap3430-timer.c"
33)
34register_driver(
35    compatibility_strings "arm,cortex-a9-twd-timer"
36    PREFIX src/drivers/timer
37    CFILES "priv_timer.c"
38)
39register_driver(
40    compatibility_strings "arm,cortex-a9-global-timer"
41    PREFIX src/drivers/timer
42    CFILES "global_timer.c"
43)
44register_driver(
45    compatibility_strings "arm,armv7-timer"
46    PREFIX src/drivers/timer
47    CFILES "generic_timer.c"
48)
49register_driver(
50    compatibility_strings "arm,armv8-timer"
51    PREFIX src/drivers/timer
52    CFILES "generic_timer.c"
53)
54
55set(KernelArmHaveGenericTimer OFF)
56
57foreach(match_string IN ITEMS "arm,armv7-timer" "arm,armv8-timer")
58    if(${match_string} IN_LIST compatibility_strings)
59        set(KernelArmHaveGenericTimer ON)
60        break()
61    endif()
62endforeach()
63
64config_option(
65    KernelArmExportPCNTUser EXPORT_PCNT_USER "PL0 access to generic timer CNTPCT and CNTFRQ. \
66    Grant user access to physical counter and counter \
67    frequency registers of the generic timer. \
68    WARNING: selecting this option opens a timing \
69    channel"
70    DEFAULT OFF
71    DEPENDS "KernelArmHaveGenericTimer"
72)
73
74config_option(
75    KernelArmExportVCNTUser EXPORT_VCNT_USER "PL0 access to generic timer CNTVCT and CNTFRQ. \
76    Grant user access to virtual counter and counter \
77    frequency registers of the generic timer. \
78    WARNING: selecting this option opens a timing \
79    channel"
80    DEFAULT OFF
81    DEPENDS "KernelArmHaveGenericTimer"
82)
83
84config_option(
85    KernelArmExportPTMRUser EXPORT_PTMR_USER "PL0 access to generic timer CNTP_CTL and CNTP_CVAL. \
86    Grant user access to physical timer registers of the generic timer. \
87    WARNING: selecting this option opens a storage channel and allows threads to easily \
88    corrupt these registers for each other, this should only be used for \
89    debugging / development purposes"
90    DEFAULT OFF
91    DEPENDS "KernelArmHaveGenericTimer"
92)
93
94config_option(
95    KernelArmExportVTMRUser EXPORT_VTMR_USER "PL0 access to generic timer CNTV_CTL and CNTV_CVAL. \
96    Grant user access to virtual timer registers of the generic timer. \
97    WARNING: selecting this option opens a storage channel and allows threads to easily \
98    corrupt these registers for each other, this should only be used for \
99    debugging / development purposes"
100    DEFAULT OFF
101    DEPENDS "KernelArmHaveGenericTimer"
102)
103
104config_option(
105    KernelArmVtimerUpdateVOffset VTIMER_UPDATE_VOFFSET
106    "When set the kernel will update the VOFFSET \
107    register of a VCPU when restoring it so that its view of Virtual time hasn't increased while it \
108    was suspended.  When unset the VOFFSET won't be updated other than by the read and write register api."
109    DEFAULT ON
110    DEPENDS "KernelArmHypervisorSupport"
111)
112