Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 1 | project( |
| 2 | 'openpower-proc-control', |
| 3 | 'cpp', |
| 4 | default_options: [ |
| 5 | 'warning_level=3', |
| 6 | 'werror=true', |
Patrick Williams | 6529d78 | 2023-07-12 11:27:39 -0500 | [diff] [blame] | 7 | 'cpp_std=c++23', |
Brad Bishop | f38b35e | 2020-11-08 10:42:34 -0500 | [diff] [blame] | 8 | 'buildtype=debugoptimized', |
| 9 | 'b_ndebug=if-release', |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 10 | ], |
| 11 | license: 'Apache-2.0', |
| 12 | version: '1.0', |
Patrick Williams | 6529d78 | 2023-07-12 11:27:39 -0500 | [diff] [blame] | 13 | meson_version: '>=1.1.1', |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 14 | ) |
| 15 | add_project_arguments('-Wno-psabi', language: 'cpp') |
| 16 | |
Patrick Williams | 6529d78 | 2023-07-12 11:27:39 -0500 | [diff] [blame] | 17 | if get_option('cpp_std') != 'c++23' |
| 18 | error('This project requires c++23') |
Brad Bishop | f38b35e | 2020-11-08 10:42:34 -0500 | [diff] [blame] | 19 | endif |
| 20 | |
| 21 | if(get_option('buildtype') == 'minsize') |
| 22 | add_project_arguments('-DNDEBUG', language : 'cpp') |
| 23 | endif |
| 24 | |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 25 | cxx = meson.get_compiler('cpp') |
| 26 | |
| 27 | extra_sources = [] |
| 28 | extra_dependencies = [] |
| 29 | extra_unit_files = [] |
| 30 | |
Jayanth Othayoth | 3840547 | 2021-07-26 06:16:44 -0500 | [diff] [blame] | 31 | # Configuration header file(config.h) generation |
| 32 | conf_data = configuration_data() |
| 33 | |
| 34 | conf_data.set_quoted('DEVTREE_EXPORT_FILTER_FILE', get_option('DEVTREE_EXPORT_FILTER_FILE'), |
| 35 | description : 'Path to the phal devtree export filter file' |
| 36 | ) |
| 37 | |
| 38 | conf_data.set_quoted('DEVTREE_EXP_FILE', get_option('DEVTREE_EXP_FILE'), |
| 39 | description : 'Path to the devtree export copy file' |
| 40 | ) |
| 41 | |
Jayanth Othayoth | 94fc70c | 2021-11-25 08:18:03 -0600 | [diff] [blame] | 42 | conf_data.set_quoted('CEC_DEVTREE_RW_PATH', get_option('CEC_DEVTREE_RW_PATH'), |
| 43 | description : 'Path to the devtree file r/w version' |
| 44 | ) |
| 45 | |
Marri Devender Rao | 90166c1 | 2022-01-07 02:22:53 -0600 | [diff] [blame] | 46 | conf_data.set_quoted('CEC_DEVTREE_RO_BASE_PATH', get_option('CEC_DEVTREE_RO_BASE_PATH'), |
| 47 | description : 'Base path to the devtree file read only version' |
Jayanth Othayoth | 94fc70c | 2021-11-25 08:18:03 -0600 | [diff] [blame] | 48 | ) |
Jayanth Othayoth | 94fc70c | 2021-11-25 08:18:03 -0600 | [diff] [blame] | 49 | conf_data.set_quoted('CEC_INFODB_PATH', get_option('CEC_INFODB_PATH'), |
| 50 | description : 'Path to the devtree attributes based database path' |
| 51 | ) |
| 52 | |
| 53 | conf_data.set_quoted('DEVTREE_REINIT_ATTRS_LIST', get_option('DEVTREE_REINIT_ATTRS_LIST'), |
| 54 | description : 'Path to the phal devtree reinit attribute list file' |
| 55 | ) |
| 56 | |
Dhruvaraj Subhashchandran | 5235dba | 2024-06-01 11:01:49 -0500 | [diff] [blame] | 57 | conf_data.set_quoted('OP_DUMP_OBJ_PATH', get_option('op_dump_obj_path'), |
| 58 | description : 'Object path requesting OpenPOWER dumps' |
| 59 | ) |
| 60 | |
Jayanth Othayoth | 3840547 | 2021-07-26 06:16:44 -0500 | [diff] [blame] | 61 | configure_file(configuration : conf_data, |
| 62 | output : 'config.h' |
| 63 | ) |
| 64 | |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 65 | unit_subs = configuration_data() |
Brad Bishop | a5b4b1b | 2020-11-08 12:14:03 -0500 | [diff] [blame] | 66 | unit_subs.set('bindir', join_paths(get_option('prefix'), get_option('bindir'))) |
| 67 | unit_subs.set('ENABLE_PHAL_TRUE', '#') |
Adriana Kobylak | bbb5339 | 2022-02-14 21:15:48 +0000 | [diff] [blame] | 68 | unit_subs.set('CEC_DEVTREE_RW_PATH', get_option('CEC_DEVTREE_RW_PATH'), |
| 69 | description : 'Path to the devtree file r/w version' |
| 70 | ) |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 71 | |
| 72 | if get_option('phal').enabled() and get_option('p9').enabled() |
| 73 | error('phal and p9 cannot be selected at the same time') |
| 74 | endif |
| 75 | |
| 76 | build_p9 = not get_option('p9').disabled() |
| 77 | build_openfsi = not get_option('openfsi').disabled() |
| 78 | build_phal = get_option('phal').enabled() |
| 79 | |
| 80 | if get_option('phal').enabled() and not get_option('p9').disabled() |
| 81 | build_p9 = false |
| 82 | endif |
| 83 | |
| 84 | summary('building p9', build_p9) |
| 85 | summary('building openfsi', build_openfsi) |
| 86 | summary('building phal', build_phal) |
| 87 | |
| 88 | if build_p9 |
| 89 | extra_sources += [ |
| 90 | 'procedures/p9/cleanup_pcie.cpp', |
| 91 | 'procedures/p9/set_sync_fsi_clock_mode.cpp', |
| 92 | 'procedures/p9/start_host.cpp', |
| 93 | 'procedures/p9/start_host_mpreboot.cpp', |
Jayanth Othayoth | db8d46c | 2021-10-09 02:19:57 -0500 | [diff] [blame] | 94 | 'procedures/p9/enter_mpreboot.cpp', |
Jayanth Othayoth | ee10ead | 2021-12-05 22:54:06 -0600 | [diff] [blame] | 95 | 'procedures/p9/thread_stopall.cpp', |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 96 | ] |
| 97 | endif |
| 98 | if build_openfsi |
| 99 | extra_sources += [ |
| 100 | 'procedures/openfsi/scan.cpp', |
| 101 | ] |
| 102 | endif |
| 103 | if build_phal |
| 104 | extra_sources += [ |
| 105 | 'procedures/phal/start_host.cpp', |
| 106 | 'procedures/phal/set_SPI_mux.cpp', |
Chirag Sharma | a257693 | 2020-12-05 23:17:41 -0600 | [diff] [blame] | 107 | 'procedures/phal/proc_pre_poweroff.cpp', |
Jayanth Othayoth | cf2da1b | 2021-07-29 03:15:20 -0500 | [diff] [blame] | 108 | 'procedures/phal/check_host_running.cpp', |
| 109 | 'procedures/phal/import_devtree.cpp', |
Jayanth Othayoth | db8d46c | 2021-10-09 02:19:57 -0500 | [diff] [blame] | 110 | 'procedures/phal/enter_mpreboot.cpp', |
Jayanth Othayoth | 94fc70c | 2021-11-25 08:18:03 -0600 | [diff] [blame] | 111 | 'procedures/phal/reinit_devtree.cpp', |
Jayanth Othayoth | 5f2eaf1 | 2021-11-30 11:08:51 -0600 | [diff] [blame] | 112 | 'procedures/phal/thread_stopall.cpp', |
Jayanth Othayoth | 25e39c8 | 2021-07-12 01:00:17 -0500 | [diff] [blame] | 113 | 'extensions/phal/common_utils.cpp', |
Jayanth Othayoth | c3d6b87 | 2021-07-28 05:07:25 -0500 | [diff] [blame] | 114 | 'extensions/phal/pdbg_utils.cpp', |
Jayanth Othayoth | 6552de0 | 2021-07-12 00:55:57 -0500 | [diff] [blame] | 115 | 'extensions/phal/create_pel.cpp', |
| 116 | 'extensions/phal/phal_error.cpp', |
Jayanth Othayoth | 21a889f | 2021-10-07 06:53:40 -0500 | [diff] [blame] | 117 | 'extensions/phal/dump_utils.cpp', |
Jayanth Othayoth | 4f7b9bd | 2021-11-25 08:11:12 -0600 | [diff] [blame] | 118 | 'temporary_file.cpp', |
Marri Devender Rao | 4d5b5bf | 2022-05-23 09:23:31 -0500 | [diff] [blame] | 119 | 'util.cpp', |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 120 | ] |
| 121 | extra_dependencies += [ |
| 122 | dependency('libdt-api'), |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 123 | cxx.find_library('ekb'), |
| 124 | cxx.find_library('ipl'), |
Jayanth Othayoth | 4079f09 | 2021-09-20 07:36:54 -0500 | [diff] [blame] | 125 | cxx.find_library('phal'), |
Jayanth Othayoth | 94fc70c | 2021-11-25 08:18:03 -0600 | [diff] [blame] | 126 | cxx.find_library('dtree'), |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 127 | ] |
| 128 | extra_unit_files = [ |
Andrew Geissler | 1dc0829 | 2021-06-22 17:14:54 -0500 | [diff] [blame] | 129 | 'service_files/set-spi-mux.service', |
| 130 | 'service_files/phal-reinit-devtree.service', |
| 131 | 'service_files/proc-pre-poweroff@.service', |
Andrew Geissler | 9ca8a11 | 2022-04-07 16:18:47 -0500 | [diff] [blame] | 132 | 'service_files/op-clear-sys-dump-active@.service', |
Andrew Geissler | 8e73da0 | 2021-06-23 15:43:21 -0500 | [diff] [blame] | 133 | 'service_files/op-reset-host-check@.service', |
Andrew Geissler | 3292c06 | 2021-06-23 21:11:10 -0500 | [diff] [blame] | 134 | 'service_files/op-reset-host-clear.service', |
Jayanth Othayoth | a089bd2 | 2021-07-30 01:32:31 -0500 | [diff] [blame] | 135 | 'service_files/phal-import-devtree@.service', |
Jayanth Othayoth | 07e9a6a | 2021-07-30 03:52:13 -0500 | [diff] [blame] | 136 | 'service_files/phal-export-devtree@.service', |
Ramesh Iyyar | 482a887 | 2022-02-24 01:42:52 -0600 | [diff] [blame] | 137 | 'service_files/phal-create-boottime-guard-indicator.service', |
Jayanth Othayoth | 1af1443 | 2022-09-12 01:19:10 -0500 | [diff] [blame] | 138 | 'service_files/op-clock-data-logger@.service', |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 139 | ] |
Brad Bishop | a5b4b1b | 2020-11-08 12:14:03 -0500 | [diff] [blame] | 140 | unit_subs.set('ENABLE_PHAL_TRUE', '') |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 141 | endif |
| 142 | |
| 143 | executable( |
| 144 | 'openpower-proc-control', |
| 145 | [ |
| 146 | 'cfam_access.cpp', |
| 147 | 'ext_interface.cpp', |
| 148 | 'filedescriptor.cpp', |
| 149 | 'proc_control.cpp', |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 150 | 'targeting.cpp', |
| 151 | 'procedures/common/cfam_overrides.cpp', |
| 152 | 'procedures/common/cfam_reset.cpp', |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 153 | 'procedures/common/collect_sbe_hb_data.cpp', |
Jayanth Othayoth | c483181 | 2021-06-08 01:33:40 -0500 | [diff] [blame] | 154 | 'util.cpp', |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 155 | ] + extra_sources, |
| 156 | dependencies: [ |
| 157 | dependency('libgpiodcxx'), |
| 158 | cxx.find_library('pdbg'), |
| 159 | dependency('phosphor-dbus-interfaces'), |
| 160 | dependency('phosphor-logging'), |
| 161 | dependency('sdbusplus'), |
| 162 | dependency('threads'), |
Jayanth Othayoth | c483181 | 2021-06-08 01:33:40 -0500 | [diff] [blame] | 163 | dependency('fmt'), |
Brad Bishop | ce08fb9 | 2020-11-08 09:50:48 -0500 | [diff] [blame] | 164 | ] + extra_dependencies, |
| 165 | install: true |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 166 | ) |
| 167 | |
| 168 | executable( |
| 169 | 'openpower-proc-nmi', |
| 170 | [ |
| 171 | 'nmi_main.cpp', |
| 172 | 'nmi_interface.cpp', |
| 173 | ], |
| 174 | dependencies: [ |
| 175 | cxx.find_library('pdbg'), |
| 176 | dependency('phosphor-dbus-interfaces'), |
| 177 | dependency('phosphor-logging'), |
| 178 | dependency('sdbusplus'), |
Brad Bishop | ce08fb9 | 2020-11-08 09:50:48 -0500 | [diff] [blame] | 179 | ], |
| 180 | install: true |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 181 | ) |
| 182 | |
Jayanth Othayoth | 13c57ad | 2021-07-16 06:02:21 -0500 | [diff] [blame] | 183 | if build_phal |
| 184 | executable( |
| 185 | 'phal-export-devtree', |
| 186 | [ |
| 187 | 'extensions/phal/devtree_export.cpp', |
| 188 | 'extensions/phal/fw_update_watch.cpp', |
Jayanth Othayoth | 3840547 | 2021-07-26 06:16:44 -0500 | [diff] [blame] | 189 | 'extensions/phal/pdbg_utils.cpp', |
| 190 | 'extensions/phal/create_pel.cpp', |
| 191 | 'util.cpp', |
Jayanth Othayoth | 13c57ad | 2021-07-16 06:02:21 -0500 | [diff] [blame] | 192 | ], |
| 193 | dependencies: [ |
| 194 | dependency('phosphor-logging'), |
| 195 | dependency('sdbusplus'), |
| 196 | dependency('sdeventplus'), |
| 197 | dependency('fmt'), |
Jayanth Othayoth | 3840547 | 2021-07-26 06:16:44 -0500 | [diff] [blame] | 198 | dependency('phosphor-dbus-interfaces'), |
| 199 | cxx.find_library('pdbg'), |
Jayanth Othayoth | e5ba5fd | 2022-01-27 09:29:01 -0600 | [diff] [blame] | 200 | cxx.find_library('phal'), |
Jayanth Othayoth | 13c57ad | 2021-07-16 06:02:21 -0500 | [diff] [blame] | 201 | ], |
| 202 | install: true |
| 203 | ) |
Jayanth Othayoth | ed7fb7a | 2022-09-09 00:07:41 -0500 | [diff] [blame] | 204 | |
| 205 | executable( |
| 206 | 'openpower-clock-data-logger', |
| 207 | [ |
| 208 | 'extensions/phal/clock_logger_main.cpp', |
| 209 | 'extensions/phal/clock_logger.cpp', |
| 210 | 'extensions/phal/create_pel.cpp', |
| 211 | 'util.cpp', |
| 212 | ], |
| 213 | dependencies: [ |
| 214 | cxx.find_library('dtree'), |
| 215 | cxx.find_library('pdbg'), |
| 216 | cxx.find_library('phal'), |
| 217 | dependency('libdt-api'), |
| 218 | dependency('phosphor-logging'), |
| 219 | dependency('sdbusplus'), |
| 220 | dependency('sdeventplus'), |
| 221 | ], |
| 222 | install: true |
| 223 | ) |
Jayanth Othayoth | 13c57ad | 2021-07-16 06:02:21 -0500 | [diff] [blame] | 224 | endif |
| 225 | |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 226 | unit_files = [ |
Andrew Geissler | 1dc0829 | 2021-06-22 17:14:54 -0500 | [diff] [blame] | 227 | 'service_files/pcie-poweroff@.service', |
| 228 | 'service_files/xyz.openbmc_project.Control.Host.NMI.service', |
| 229 | 'service_files/op-stop-instructions@.service', |
| 230 | 'service_files/op-cfam-reset.service', |
| 231 | 'service_files/op-continue-mpreboot@.service', |
| 232 | 'service_files/op-enter-mpreboot@.service', |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 233 | ] + extra_unit_files |
| 234 | |
Patrick Williams | 0029987 | 2023-04-12 08:05:17 -0500 | [diff] [blame] | 235 | systemd_system_unit_dir = dependency('systemd').get_variable( |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 236 | 'systemdsystemunitdir', |
Patrick Williams | 0029987 | 2023-04-12 08:05:17 -0500 | [diff] [blame] | 237 | pkgconfig_define: ['prefix', get_option('prefix')]) |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 238 | foreach u : unit_files |
| 239 | configure_file( |
| 240 | configuration: unit_subs, |
| 241 | input: u + '.in', |
| 242 | install: true, |
| 243 | install_dir: systemd_system_unit_dir, |
Andrew Geissler | 1dc0829 | 2021-06-22 17:14:54 -0500 | [diff] [blame] | 244 | output: '@BASENAME@' |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 245 | ) |
| 246 | endforeach |
| 247 | |
| 248 | if not get_option('tests').disabled() |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 249 | test( |
| 250 | 'utest', |
| 251 | executable( |
| 252 | 'utest', |
| 253 | 'test/utest.cpp', |
| 254 | 'targeting.cpp', |
| 255 | 'filedescriptor.cpp', |
| 256 | dependencies: [ |
Brad Bishop | 5d482d9 | 2020-11-08 09:45:18 -0500 | [diff] [blame] | 257 | dependency('gtest', main: true), |
Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 258 | dependency('phosphor-logging'), |
| 259 | ], |
| 260 | implicit_include_directories: false, |
| 261 | include_directories: '.', |
| 262 | ) |
| 263 | ) |
| 264 | endif |