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
9declare_platform(hikey KernelPlatformHikey PLAT_HIKEY KernelArchARM)
10
11if(KernelPlatformHikey)
12    if("${KernelSel4Arch}" STREQUAL aarch32)
13        declare_seL4_arch(aarch32)
14    elseif("${KernelSel4Arch}" STREQUAL aarch64)
15        declare_seL4_arch(aarch64)
16    else()
17        fallback_declare_seL4_arch_default(aarch32)
18    endif()
19    set(KernelArmCortexA53 ON)
20    set(KernelArchArmV8a ON)
21    config_set(KernelARMPlatform ARM_PLAT hikey)
22    set(KernelArmMachFeatureModifiers "+crc" CACHE INTERNAL "")
23    list(APPEND KernelDTSList "tools/dts/hikey.dts")
24    list(APPEND KernelDTSList "src/plat/hikey/overlay-hikey.dts")
25    declare_default_headers(
26        TIMER_FREQUENCY 1200000
27        MAX_IRQ 159
28        TIMER drivers/timer/arm_generic.h
29        INTERRUPT_CONTROLLER arch/machine/gic_v2.h
30        CLK_MAGIC 458129845llu
31        CLK_SHIFT 39u
32        KERNEL_WCET 10u
33    )
34endif()
35
36config_string(
37    KernelArmHikeyOutstandingPrefetchers ARM_HIKEY_OUTSTANDING_PREFETCHERS
38    "Number of outstanding prefetch allowed \
39    Cortex A53 has an L1 Data prefetcher. This config options allows \
40    the number of outstanding prefetcher to be set from a number from \
41    1 to 7. Note that a setting of 7 maps to 8 and 5 is the reset value."
42    DEFAULT 5
43    DEPENDS "KernelPlatformHikey;NOT KernelDebugDisablePrefetchers" DEFAULT_DISABLED 0
44    UNQUOTE
45)
46set_property(CACHE KernelArmHikeyOutstandingPrefetchers PROPERTY STRINGS "1;2;3;4;5;6;7")
47
48config_string(
49    KernelArmHikeyPrefetcherStride ARM_HIKEY_PREFETCHER_STRIDE
50    "Number of strides before prefetcher is triggered \
51    Number of strides before prefetcher is triggered. \
52    Allowed values are 2 and 3. 2 is the reset value"
53    DEFAULT 2
54    DEPENDS "KernelPlatformHikey;NOT KernelDebugDisablePrefetchers" DEFAULT_DISABLED 0
55    UNQUOTE
56)
57set_property(CACHE KernelArmHikeyPrefetcherStride PROPERTY STRINGS "2;3")
58
59config_string(
60    KernelArmHikeyPrefetcherNPFSTRM ARM_HIKEY_PREFETCHER_NPFSTRM
61    "Number of indepedent prefetch streams \
62    Number of indepedent prefetch streams. Allowed values are 1 to 4.\
63    2 is the reset value"
64    DEFAULT 2
65    DEPENDS "KernelPlatformHikey;NOT KernelDebugDisablePrefetchers" DEFAULT_DISABLED 0
66    UNQUOTE
67)
68set_property(CACHE KernelArmHikeyPrefetcherNPFSTRM PROPERTY STRINGS "1;2;3;4")
69
70config_option(
71    KernelArmHikeyPrefetcherSTBPFDIS ARM_HIKEY_PREFETCHER_STBPFDIS
72    "Enable prefetch streams initated by STB access \
73    Enable prefetch streams initated by STB access. Enabled is the reset value"
74    DEFAULT ON
75    DEPENDS "KernelPlatformHikey; NOT KernelDebugDisablePrefetchers"
76    DEFAULT_DISABLED OFF
77)
78
79config_option(
80    KernelArmHikeyPrefetcherSTBPFRS ARM_HIKEY_PREFETCHER_STBPFRS
81    "Prefetcher to initated on a ReadUnique or ReadShared \
82    Sets prefetcher to initated on a ReadUnique (n) or ReadShared (y) \
83    ReadUnique is the reset value"
84    DEFAULT OFF
85    DEPENDS "KernelPlatformHikey;NOT KernelDebugDisablePrefetchers"
86)
87
88add_sources(
89    DEP "KernelPlatformHikey"
90    CFILES src/arch/arm/machine/gic_v2.c src/arch/arm/machine/l2c_nop.c
91)
92