pcie_bifurcation: Fetch bifurcation at a PCIe slot with hardcoded values
This will read a json config and return the bifurcation based on that.
It will read the configure file in a persistent file to see if it is
valid machine config and return the bifurcation information
accordingly.
For example,
If it is valid config, it will return 8x8 for PE1,3,4,6.
Tested:
Unit tests passed.
Physical Tests.
PE0 -> no bifurcation
PE1 -> x8x8
```
$ ipmitool raw 0x2e 0x32 0x79 0x2b 0x00 0x0f 0
79 2b 00 0b 00
$ ipmitool raw 0x2e 0x32 0x79 0x2b 0x00 0x0f 1
79 2b 00 0b 02 08 08
```
Change-Id: I44aefbfb26372f8bc0069343c8a6d07d3cf6f42d
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/meson.build b/meson.build
index d561fdc..a2e8d1b 100644
--- a/meson.build
+++ b/meson.build
@@ -9,6 +9,14 @@
'werror=true',
])
+root_inc = include_directories('.')
+
+conf_data = configuration_data()
+conf_data.set_quoted('STATIC_BIFURCATION_CONFIG', get_option('static-bifurcation'))
+conf_h = configure_file(
+ output: 'config.h',
+ configuration: conf_data)
+
meson.get_compiler('cpp').has_header_symbol(
'ipmid/api.h',
'ipmid_get_sd_bus_connection')
@@ -19,13 +27,30 @@
'nlohmann::json',
dependencies: json_dep)
+fmt_dep = dependency('fmt', required: false)
+if not fmt_dep.found()
+ fmt_proj = import('cmake').subproject(
+ 'fmt',
+ cmake_options: [
+ '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
+ '-DMASTER_PROJECT=OFF'
+ ],
+ required: false)
+ assert(fmt_proj.found(), 'fmtlib is required')
+ fmt_dep = fmt_proj.dependency('fmt')
+endif
+
+subdir('bifurcation')
+
sys_pre = declare_dependency(
- include_directories: include_directories('.'),
+ include_directories: root_inc,
dependencies: [
json_dep,
+ fmt_dep,
dependency('phosphor-dbus-interfaces'),
dependency('phosphor-logging'),
dependency('sdbusplus'),
+ bifurcation_dep,
])
sys_lib = static_library(
@@ -41,6 +66,7 @@
'machine_name.cpp',
'pcie_i2c.cpp',
'google_accel_oob.cpp',
+ 'pcie_bifurcation.cpp',
'psu.cpp',
'util.cpp',
implicit_include_directories: false,