| 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', | 
|  | 7 | 'cpp_std=c++17' | 
|  | 8 | ], | 
|  | 9 | license: 'Apache-2.0', | 
|  | 10 | version: '1.0', | 
|  | 11 | ) | 
|  | 12 | add_project_arguments('-Wno-psabi', language: 'cpp') | 
|  | 13 |  | 
|  | 14 | cxx = meson.get_compiler('cpp') | 
|  | 15 |  | 
|  | 16 | extra_sources = [] | 
|  | 17 | extra_dependencies = [] | 
|  | 18 | extra_unit_files = [] | 
|  | 19 |  | 
|  | 20 | unit_subs = configuration_data() | 
| Brad Bishop | a5b4b1b | 2020-11-08 12:14:03 -0500 | [diff] [blame^] | 21 | unit_subs.set('bindir', join_paths(get_option('prefix'), get_option('bindir'))) | 
|  | 22 | unit_subs.set('ENABLE_PHAL_TRUE', '#') | 
| Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 23 |  | 
|  | 24 | if get_option('phal').enabled() and get_option('p9').enabled() | 
|  | 25 | error('phal and p9 cannot be selected at the same time') | 
|  | 26 | endif | 
|  | 27 |  | 
|  | 28 | build_p9 = not get_option('p9').disabled() | 
|  | 29 | build_openfsi = not get_option('openfsi').disabled() | 
|  | 30 | build_phal = get_option('phal').enabled() | 
|  | 31 |  | 
|  | 32 | if get_option('phal').enabled() and not get_option('p9').disabled() | 
|  | 33 | build_p9 = false | 
|  | 34 | endif | 
|  | 35 |  | 
|  | 36 | summary('building p9', build_p9) | 
|  | 37 | summary('building openfsi', build_openfsi) | 
|  | 38 | summary('building phal', build_phal) | 
|  | 39 |  | 
|  | 40 | if build_p9 | 
|  | 41 | extra_sources += [ | 
|  | 42 | 'procedures/p9/cleanup_pcie.cpp', | 
|  | 43 | 'procedures/p9/set_sync_fsi_clock_mode.cpp', | 
|  | 44 | 'procedures/p9/start_host.cpp', | 
|  | 45 | 'procedures/p9/start_host_mpreboot.cpp', | 
|  | 46 | ] | 
|  | 47 | endif | 
|  | 48 | if build_openfsi | 
|  | 49 | extra_sources += [ | 
|  | 50 | 'procedures/openfsi/scan.cpp', | 
|  | 51 | ] | 
|  | 52 | endif | 
|  | 53 | if build_phal | 
|  | 54 | extra_sources += [ | 
|  | 55 | 'procedures/phal/start_host.cpp', | 
|  | 56 | 'procedures/phal/set_SPI_mux.cpp', | 
|  | 57 | 'phalerror/create_pel.cpp', | 
|  | 58 | 'phalerror/phal_error.cpp', | 
|  | 59 | ] | 
|  | 60 | extra_dependencies += [ | 
|  | 61 | dependency('libdt-api'), | 
|  | 62 | dependency('fmt'), | 
|  | 63 | cxx.find_library('ekb'), | 
|  | 64 | cxx.find_library('ipl'), | 
|  | 65 | ] | 
|  | 66 | extra_unit_files = [ | 
|  | 67 | 'set-spi-mux.service', | 
|  | 68 | 'phal-reinit-devtree.service', | 
|  | 69 | ] | 
| Brad Bishop | a5b4b1b | 2020-11-08 12:14:03 -0500 | [diff] [blame^] | 70 | unit_subs.set('ENABLE_PHAL_TRUE', '') | 
| Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 71 | endif | 
|  | 72 |  | 
|  | 73 | executable( | 
|  | 74 | 'openpower-proc-control', | 
|  | 75 | [ | 
|  | 76 | 'cfam_access.cpp', | 
|  | 77 | 'ext_interface.cpp', | 
|  | 78 | 'filedescriptor.cpp', | 
|  | 79 | 'proc_control.cpp', | 
|  | 80 | 'registration.cpp', | 
|  | 81 | 'targeting.cpp', | 
|  | 82 | 'procedures/common/cfam_overrides.cpp', | 
|  | 83 | 'procedures/common/cfam_reset.cpp', | 
|  | 84 | 'procedures/common/enter_mpreboot.cpp', | 
|  | 85 | 'procedures/common/collect_sbe_hb_data.cpp', | 
|  | 86 | ] + extra_sources, | 
|  | 87 | dependencies: [ | 
|  | 88 | dependency('libgpiodcxx'), | 
|  | 89 | cxx.find_library('pdbg'), | 
|  | 90 | dependency('phosphor-dbus-interfaces'), | 
|  | 91 | dependency('phosphor-logging'), | 
|  | 92 | dependency('sdbusplus'), | 
|  | 93 | dependency('threads'), | 
| Brad Bishop | ce08fb9 | 2020-11-08 09:50:48 -0500 | [diff] [blame] | 94 | ] + extra_dependencies, | 
|  | 95 | install: true | 
| Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 96 | ) | 
|  | 97 |  | 
|  | 98 | executable( | 
|  | 99 | 'openpower-proc-nmi', | 
|  | 100 | [ | 
|  | 101 | 'nmi_main.cpp', | 
|  | 102 | 'nmi_interface.cpp', | 
|  | 103 | ], | 
|  | 104 | dependencies: [ | 
|  | 105 | cxx.find_library('pdbg'), | 
|  | 106 | dependency('phosphor-dbus-interfaces'), | 
|  | 107 | dependency('phosphor-logging'), | 
|  | 108 | dependency('sdbusplus'), | 
| Brad Bishop | ce08fb9 | 2020-11-08 09:50:48 -0500 | [diff] [blame] | 109 | ], | 
|  | 110 | install: true | 
| Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 111 | ) | 
|  | 112 |  | 
|  | 113 | unit_files = [ | 
|  | 114 | 'pcie-poweroff@.service', | 
|  | 115 | 'xyz.openbmc_project.Control.Host.NMI.service', | 
|  | 116 | 'op-stop-instructions@.service', | 
|  | 117 | 'op-cfam-reset.service', | 
|  | 118 | 'op-continue-mpreboot@.service', | 
|  | 119 | 'op-enter-mpreboot@.service', | 
|  | 120 | ] + extra_unit_files | 
|  | 121 |  | 
|  | 122 | systemd_system_unit_dir = dependency('systemd').get_pkgconfig_variable( | 
|  | 123 | 'systemdsystemunitdir', | 
|  | 124 | define_variable: ['prefix', get_option('prefix')]) | 
|  | 125 | foreach u : unit_files | 
|  | 126 | configure_file( | 
|  | 127 | configuration: unit_subs, | 
|  | 128 | input: u + '.in', | 
|  | 129 | install: true, | 
|  | 130 | install_dir: systemd_system_unit_dir, | 
|  | 131 | output: u | 
|  | 132 | ) | 
|  | 133 | endforeach | 
|  | 134 |  | 
|  | 135 | if not get_option('tests').disabled() | 
| Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 136 | test( | 
|  | 137 | 'utest', | 
|  | 138 | executable( | 
|  | 139 | 'utest', | 
|  | 140 | 'test/utest.cpp', | 
|  | 141 | 'targeting.cpp', | 
|  | 142 | 'filedescriptor.cpp', | 
|  | 143 | dependencies: [ | 
| Brad Bishop | 5d482d9 | 2020-11-08 09:45:18 -0500 | [diff] [blame] | 144 | dependency('gtest', main: true), | 
| Brad Bishop | 919e408 | 2020-10-27 18:55:19 -0400 | [diff] [blame] | 145 | dependency('phosphor-logging'), | 
|  | 146 | ], | 
|  | 147 | implicit_include_directories: false, | 
|  | 148 | include_directories: '.', | 
|  | 149 | ) | 
|  | 150 | ) | 
|  | 151 | endif |