nvmesensor: Support the NVMe MI basic management command
The NVMe MI basic management command is an optional extension to the
NVMe specification that allows management controllers to query drive
state without needing an MCTP stack[1].
[1] https://nvmexpress.org/wp-content/uploads/NVMe_Management_-_Technical_Note_on_Basic_Management_Command.pdf
Given the current lack of support for the SMBus MCTP binding in upstream
OpenBMC, provide an NVMe MI basic management command implementation that
allows nvmesensor to function without diving into a maze of out-of-tree
patches.
As we're doing this in userspace we exploit Linux's I2C chardev
interface for talking to the drives. However, the interface is driven by
ioctl()s, which interacts poorly with the event-driven ASIO design.
Click the lego together by using an IO thread to transform ioctl()s into
read() and write() operations that we can handle asynchronously.
Change-Id: I08cca4991a2ddea23fe8fcc1cf5365d4baded11c
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/src/meson.build b/src/meson.build
index 8c398e3..3475bd5 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -137,19 +137,17 @@
endif
if get_option('nvme').enabled()
+ nvme_srcs = files('NVMeSensorMain.cpp', 'NVMeSensor.cpp')
+ nvme_srcs += files('NVMeBasicContext.cpp')
+ nvme_srcs += files('NVMeMCTPContext.cpp')
+
mctp = meson.get_compiler('cpp').find_library('libmctp')
+ nvme_deps = [ default_deps, i2c, mctp, thresholds_dep, utils_dep, threads ]
+
executable(
'nvmesensor',
- 'NVMeSensorMain.cpp',
- 'NVMeSensor.cpp',
- 'NVMeMCTPContext.cpp',
- dependencies: [
- default_deps,
- i2c,
- mctp,
- thresholds_dep,
- utils_dep,
- ],
+ sources: nvme_srcs,
+ dependencies: nvme_deps,
implicit_include_directories: false,
include_directories: '../include',
install: true,