• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 The ChromiumOS Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5load("//config/util/component.star", "comp")
6load("//config/util/design.star", "design")
7load("//config/util/hw_features.star", "hw_feat")
8load("//config/util/hw_topology.star", "hw_topo")
9load("//config/util/program.star", program_util = "program")
10load("//config/util/sw_config.star", sc = "sw_config")
11
12_FAKE_SOC = comp.create_soc_model(
13    family = comp.create_soc_family(name = "FAKE_FAMILY"),
14    model = "FAKE_MODEL",
15    cores = 2,
16    id = "FAKE_MODEL_2",
17)
18
19_SOC_MODELS = [_FAKE_SOC]
20
21_FAKE_BT_COMP = comp.create_bt("0001", "0002", "0003")
22
23_BT_COMPS = [_FAKE_BT_COMP]
24
25_QUALIFIED_COMPS = _SOC_MODELS + _BT_COMPS
26
27_QUAL_CONSTRAINTS = comp.create_quals(
28    [comp.id for comp in _QUALIFIED_COMPS],
29    comp.qual_status.QUALIFIED,
30)
31
32_FW_MASKS = struct(
33    DB = 0x0000000F,
34    CAMERA = 0x000000F0,
35    SENSOR = 0x00000F00,
36    WIFI_SAR_ID = 0x0000F000,
37    TOUCH = 0x00010000,
38    DETACHABLE_BASE = 0x00F00000,
39)
40
41_FIRMWARE_CONFIGURATION_SEGMENTS = [
42    program_util.create_firmware_configuration_segment("Daughter board", _FW_MASKS.DB),
43    program_util.create_firmware_configuration_segment("Camera", _FW_MASKS.CAMERA),
44    program_util.create_firmware_configuration_segment("Sensor", _FW_MASKS.SENSOR),
45    program_util.create_firmware_configuration_segment("Intel wifi sar id", _FW_MASKS.WIFI_SAR_ID),
46    program_util.create_firmware_configuration_segment("Touch controller", _FW_MASKS.TOUCH),
47    program_util.create_firmware_configuration_segment("Detachable Base", _FW_MASKS.DETACHABLE_BASE),
48]
49
50_FEATURE_CONSTRAINTS = design.create_constraints([
51    hw_feat.create_features(
52        bluetooth = hw_feat.create_bluetooth(present = True),
53        camera = hw_feat.create_cameras(
54            hw_feat.create_camera(),
55        ),
56        display = hw_feat.create_display(internal = True, external = False),
57        fingerprint = hw_feat.create_fingerprint(
58            location = hw_feat.location.SIDE_LEFT,
59            board = "test_board",
60            ro_version = "ro-test",
61            present = True,
62        ),
63        form_factor = hw_feat.create_form_factor(hw_feat.form_factor.CLAMSHELL),
64        keyboard = hw_feat.create_keyboard(hw_feat.keyboard_type.INTERNAL),
65        screen = hw_feat.create_screen(touch = True),
66        storage = hw_feat.create_storage(hw_feat.storage.EMMC),
67        stylus = hw_feat.create_stylus(hw_feat.stylus_type.INTERNAL),
68        touchpad = hw_feat.create_touchpad(present = True),
69    ),
70    hw_feat.create_form_factor(hw_feat.form_factor.CLAMSHELL),
71    hw_feat.create_form_factor(hw_feat.form_factor.CONVERTIBLE),
72])
73
74# Signer config for program FAKE
75
76_SIGNER_BRAND_CONFIGS = program_util.create_signer_configs_by_brand(
77    {
78        "WLAA": "KEYD",  # White label A
79        "WLBB": "KEYE",  # White label B
80        "WLCC": "KEYF",  # White label C
81        "WLZZ": "DEFAULT",  # White label default
82    },
83)
84
85_SIGNER_DESIGN_CONFIGS = program_util.create_signer_configs_by_design(
86    {
87        "FAKE_REF_DESIGN": "DEFAULT",
88        "PROJECT_A": "KEYA",  # Follow up design A
89        "PROJECT_B": "KEYB",  # Follow up design B
90        "PROJECT_BOX": "KEYBX",  # Follow up design BOX
91        "PROJECT_C": "KEYC",  # Follow up design C
92        "PROJECT_D": "KEYD",  # Follow up design D
93        "PROJECT_E": "KEYE",  # Follow up design E
94        "PROJECT_REBRAND": "KEYRB",  # Follow up design REBRAND
95    },
96)
97
98_SIGNER_CONFIG = _SIGNER_BRAND_CONFIGS + _SIGNER_DESIGN_CONFIGS
99
100# signer config for program FAKE_A
101
102_SIGNER_DESIGN_CONFIGS_FAKE_A = program_util.create_signer_configs_by_design(
103    {
104        "FAKE_A_REF_DESIGN": "DEFAULT",
105    },
106)
107
108_SIGNER_CONFIG_FAKE_A = _SIGNER_DESIGN_CONFIGS_FAKE_A
109
110platform = program_util.platform
111_PLATFORM = program_util.create_platform(
112    soc_family = "FAKE_INTEL_PLATFORM",
113    soc_arch = platform.X86_64,
114    gpu_family = "FAKE_INTEL_GPU",
115    graphics_apis = [platform.GRAPHICS_API_OPENGL],
116    video_codecs = [
117        platform.H264_DECODE,
118        platform.H264_DECODE,
119        platform.H265_DECODE,
120    ],
121    suspend_to_idle = True,
122    dark_resume = True,
123    wake_on_dp = True,
124    boost_arcvm = 0.5,
125    boost_urgent = 20,
126    cpuset_nonurgent = "0-5",
127    input_boost = 15,
128    boost_top_app = 60,
129    arc_media_codecs_suffix = "",
130    hevc_support = True,
131    resource = sc.create_resource(
132        ac = sc.create_power_source_preference(
133            default = sc.create_power_preference(
134                governor = sc.create_powersave_governor(),
135                epp = sc.create_balance_performance_epp(),
136            ),
137            arcvm_gaming = sc.create_power_preference(
138                governor = sc.create_performance_governor(),
139                epp = sc.create_performance_epp(),
140                cpu_offline = sc.create_cpu_offline_smt(),
141            ),
142            battery_saver = sc.create_power_preference(
143                governor = sc.create_powersave_governor(),
144                epp = sc.create_balance_power_epp(),
145                cpu_offline = sc.create_cpu_offline_small_core(
146                    min_active_threads = 4,
147                ),
148                cpufreq_disable_boost = True,
149            ),
150        ),
151        dc = sc.create_power_source_preference(
152            default = sc.create_power_preference(
153                governor = sc.create_powersave_governor(),
154                epp = sc.create_balance_performance_epp(),
155            ),
156            web_rtc = sc.create_power_preference(
157                governor = sc.create_ondemand_governor(1),
158                epp = sc.create_default_epp(),
159                cpu_offline = sc.create_cpu_offline_half(),
160            ),
161            battery_saver = sc.create_power_preference(
162                governor = sc.create_powersave_governor(),
163                epp = sc.create_power_epp(),
164                cpu_offline = sc.create_cpu_offline_small_core(
165                    min_active_threads = 4,
166                ),
167                cpufreq_disable_boost = True,
168            ),
169        ),
170    ),
171    schedqos = program_util.create_schedqos(
172        default = program_util.create_schedqos_config_set(
173            normal_cpu_share = 1024,
174            background_cpu_share = 10,
175            thread_urgent_bursty = program_util.create_schedqos_thread_config(
176                rt_priority = 8,
177                nice = -8,
178                uclamp_min = 0,
179                cpuset_cgroup = program_util.schedqos_cpuset_cgroup.ALL,
180                latency_sensitive = True,
181            ),
182            thread_urgent = program_util.create_schedqos_thread_config(
183                rt_priority = -1,
184                nice = 0,
185                uclamp_min = 1,
186                cpuset_cgroup = program_util.schedqos_cpuset_cgroup.EFFICIENT,
187                latency_sensitive = False,
188            ),
189            thread_balanced = program_util.create_schedqos_thread_config(
190                rt_priority = 0,
191                nice = 8,
192                uclamp_min = 2,
193            ),
194            thread_eco = None,
195            thread_utility = program_util.create_schedqos_thread_config(),
196            thread_background = program_util.create_schedqos_thread_config(),
197            thread_urgent_bursty_server = program_util.create_schedqos_thread_config(),
198            thread_urgent_bursty_client = program_util.create_schedqos_thread_config(),
199        ),
200    ),
201    swap_config = program_util.create_swap_config(
202        size_multiplier = 1.5,
203    ),
204)
205
206_PLATFORM_A = program_util.create_platform(
207    soc_family = "FAKE_INTEL_PLATFORM_A",
208    soc_arch = platform.X86_64,
209    gpu_family = "FAKE_INTEL_GPU_A",
210    suspend_to_idle = True,
211    dark_resume = True,
212)
213
214_HDMI_AUDIO_CARD = hw_topo.create_audio_card_config(
215    card_name = "HDA ATI HDMI",
216    ucm_config = hw_topo.audio_config_structure.COMMON,
217    cras_config = hw_topo.audio_config_structure.NONE,
218    ucm_suffix = "",
219)
220
221_FAKE = program_util.create(
222    name = "FAKE_PROGRAM",
223    component_quals = _QUAL_CONSTRAINTS,
224    constraints = _FEATURE_CONSTRAINTS,
225    firmware_configuration_segments = _FIRMWARE_CONFIGURATION_SEGMENTS,
226    device_signer_configs = _SIGNER_CONFIG,
227    mosys_platform_name = "fake",
228    platform = _PLATFORM,
229    audio_config = program_util.create_audio_config(
230        has_module_file = True,
231        default_ucm_suffix = "{speaker_amp}.{headset_codec}.{mic_description}.{design}",
232        card_configs = [_HDMI_AUDIO_CARD],
233    ),
234    generate_camera_media_profiles = True,
235    launched = True,
236)
237
238# Define Program _FAKE_A, mapped to same overlay as Program _FAKE.
239_FAKE_A = program_util.create(
240    name = "FAKE_A_PROGRAM",
241    base_program = "FAKE_PROGRAM",
242    component_quals = _QUAL_CONSTRAINTS,
243    constraints = _FEATURE_CONSTRAINTS,
244    firmware_configuration_segments = _FIRMWARE_CONFIGURATION_SEGMENTS,
245    device_signer_configs = _SIGNER_CONFIG_FAKE_A,
246    mosys_platform_name = "fake_a",
247    platform = _PLATFORM_A,
248    audio_config = program_util.create_audio_config(
249        has_module_file = True,
250        default_ucm_suffix = "{speaker_amp}.{headset_codec}.{mic_description}.{design}",
251        card_configs = [_HDMI_AUDIO_CARD],
252    ),
253    generate_camera_media_profiles = True,
254    launched = True,
255)
256
257program = struct(
258    fake = _FAKE,
259    fake_a = _FAKE_A,
260    fw_masks = _FW_MASKS,
261    components = _QUALIFIED_COMPS,
262    bluetooth_component = _FAKE_BT_COMP,
263)
264