Add initial meson.build and empty code
Add initial meson.build and make sure it generates the shared library.
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: If04fcbeb4bcfeb67bb3654e15c17eb99352e97a3
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..84e0c9c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+# Repo Specific Items
+build/
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..3edce7d
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,21 @@
+project(
+ 'inspur-ipmi-oem',
+ 'cpp',
+ default_options: [
+ 'warning_level=3',
+ 'werror=true',
+ 'cpp_std=c++17',
+ 'prefix=/usr',
+ 'b_lundef=false',
+ 'buildtype=debugoptimized',
+ ],
+ license: 'Apache-2.0',
+ version: '1.0',
+ meson_version: '>=0.49.0',
+)
+
+phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
+phosphor_logging = dependency('phosphor-logging')
+libipmid = dependency('libipmid')
+
+subdir('src')
diff --git a/src/inspur_oem.cpp b/src/inspur_oem.cpp
new file mode 100644
index 0000000..657f13b
--- /dev/null
+++ b/src/inspur_oem.cpp
@@ -0,0 +1,31 @@
+#include "inspur_oem.hpp"
+
+#include <ipmid/api.h>
+
+namespace ipmi
+{
+
+static void registerOEMFunctions() __attribute__((constructor));
+
+ipmi_ret_t ipmiOemInspurAssetInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
+ ipmi_request_t request,
+ ipmi_response_t response,
+ ipmi_data_len_t data_len,
+ ipmi_context_t context)
+{
+ // TODO: handle the oem command
+ fprintf(stderr,
+ "netfn 0x%02x, cmd 0x%02x, request %p, response %p, data_len %p, "
+ "context %p\n",
+ netfn, cmd, request, response, static_cast<void*>(data_len),
+ context);
+ return {};
+}
+
+void registerOEMFunctions(void)
+{
+ ipmi_register_callback(NETFN_OEM_INSPUR, CMD_OEM_ASSET_INFO, nullptr,
+ ipmiOemInspurAssetInfo, SYSTEM_INTERFACE);
+}
+
+} // namespace ipmi
diff --git a/src/inspur_oem.hpp b/src/inspur_oem.hpp
new file mode 100644
index 0000000..c52d891
--- /dev/null
+++ b/src/inspur_oem.hpp
@@ -0,0 +1,11 @@
+#pragma once
+
+enum ipmi_inspur_net_fns
+{
+ NETFN_OEM_INSPUR = 0x3c,
+};
+
+enum inspur_oem_cmds
+{
+ CMD_OEM_ASSET_INFO = 0x01,
+};
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..2a6010a
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,13 @@
+src_inc = include_directories('.')
+
+shared_library(
+ 'inspur-ipmi-oem',
+ 'inspur_oem.cpp',
+ dependencies: [
+ phosphor_dbus_interfaces,
+ phosphor_logging,
+ libipmid,
+ ],
+ install: true,
+ install_dir: get_option('libdir') / 'ipmid-providers'
+ )