summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Wilson <wilsonan@us.ibm.com>2018-11-01 13:38:50 -0500
committerAnthony Wilson <wilsonan@us.ibm.com>2018-11-09 14:33:52 -0600
commit171fbdf683976ee54d1aa13745523b355d751ff5 (patch)
tree27b466d9d3ecf5e7330bd333a04395dcadba910c
parent5970484133ac208bd3675697ac120901ea6654a7 (diff)
downloadopenpower-proc-control-171fbdf683976ee54d1aa13745523b355d751ff5.zip
openpower-proc-control-171fbdf683976ee54d1aa13745523b355d751ff5.tar.gz
p9: pcie-workaround: Add service file to repo
systemd unit file distribution is typically done by the application build process. Testing: Verified service runs after obmc-power-stop-pre and before op-power-stop. Change-Id: I1c4eb81430a3bcd7784011f5f8fe50aa058384f7 Signed-off-by: Anthony Wilson <wilsonan@us.ibm.com>
-rw-r--r--Makefile.am3
-rw-r--r--configure.ac17
-rw-r--r--pcie-poweroff@.service.in11
3 files changed, 31 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 54dc22e..9efb6d4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,8 @@
AM_DEFAULT_SOURCE_EXT = .cpp
+systemdsystemunit_DATA = \
+ pcie-poweroff@.service
+
sbin_PROGRAMS = \
openpower-proc-control
diff --git a/configure.ac b/configure.ac
index 743b210..7477a9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,9 +45,26 @@ AC_CONFIG_FILES([Makefile.generated],
[${srcdir}/gen_makefile.sh ${srcdir} "$myChips" > Makefile.generated],
[myChips="$CHIPS"])
+PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found"])])
PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],, [AC_MSG_ERROR([Could not find phosphor-logging...openbmc/phosphor-logging package required])])
PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces], [], [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])])
PKG_CHECK_MODULES([OPENPOWER_DBUS_INTERFACES], [openpower-dbus-interfaces], [], [AC_MSG_ERROR(["openpower-dbus-interfaces required and not found."])])
+PKG_PROG_PKG_CONFIG
+AC_ARG_WITH([systemdsystemunitdir],
+ [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
+ [with_systemdsystemunitdir=auto])
+AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
+ def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
+
+ AS_IF([test "x$def_systemdsystemunitdir" = "x"],
+ [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
+ [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
+ with_systemdsystemunitdir=no],
+ [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
+AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
+ [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
+
AC_CONFIG_FILES([Makefile test/Makefile])
+AC_CONFIG_FILES([pcie-poweroff@.service])
AC_OUTPUT
diff --git a/pcie-poweroff@.service.in b/pcie-poweroff@.service.in
new file mode 100644
index 0000000..f1d6bbc
--- /dev/null
+++ b/pcie-poweroff@.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=POWER9 PCIe Power-off Workaround
+Before=op-power-stop@%i.service
+After=obmc-power-stop-pre@%i.target
+
+[Service]
+Type=oneshot
+ExecStart=@sbindir@/openpower-proc-control cleanupPcie
+
+[Install]
+WantedBy=obmc-chassis-poweroff@%i.target
OpenPOWER on IntegriCloud