From 171fbdf683976ee54d1aa13745523b355d751ff5 Mon Sep 17 00:00:00 2001 From: Anthony Wilson Date: Thu, 1 Nov 2018 13:38:50 -0500 Subject: 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 --- Makefile.am | 3 +++ configure.ac | 17 +++++++++++++++++ pcie-poweroff@.service.in | 11 +++++++++++ 3 files changed, 31 insertions(+) create mode 100644 pcie-poweroff@.service.in 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 -- cgit v1.2.1