Incorporate new phosphor-bmc-state-manager into appropriate image

Change-Id: I4c013d98e03703b1328d85ae00cebb8500ffa205
Signed-off-by: Josh King <jdking@us.ibm.com>
diff --git a/meta-openbmc-machines/meta-openpower/conf/machine/include/openpower.inc b/meta-openbmc-machines/meta-openpower/conf/machine/include/openpower.inc
index 21b9547..d6efd6c 100644
--- a/meta-openbmc-machines/meta-openpower/conf/machine/include/openpower.inc
+++ b/meta-openbmc-machines/meta-openpower/conf/machine/include/openpower.inc
@@ -8,6 +8,7 @@
         openpower-pflash \
         obmc-host-state-mgmt \
         obmc-chassis-state-mgmt \
+        obmc-bmc-state-mgmt \
         "
 
 VIRTUAL-RUNTIME_skeleton_workbook = "${MACHINE}-config"
diff --git a/meta-phosphor/classes/obmc-phosphor-image.bbclass b/meta-phosphor/classes/obmc-phosphor-image.bbclass
index 4082b9d..c2455b8 100644
--- a/meta-phosphor/classes/obmc-phosphor-image.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-image.bbclass
@@ -14,6 +14,7 @@
 # - obmc-logging                      - OpenBMC logging management
 # - obmc-host-state-mgmt              - OpenBMC Host State Management
 # - obmc-chassis-state-mgmt           - OpenBMC Chassis State Management
+# - obmc-bmc-state-mgmt               - OpenBMC BMC State Management
 
 inherit core-image
 inherit obmc-phosphor-license
@@ -32,6 +33,7 @@
 FEATURE_PACKAGES_obmc-host-ctl ?= "${@cf_enabled('obmc-host-ctl', 'virtual-obmc-host-ctl', d)}"
 FEATURE_PACKAGES_obmc-host-state-mgmt ?= "${@cf_enabled('obmc-host-state-mgmt', 'virtual-obmc-host-state-mgmt', d)}"
 FEATURE_PACKAGES_obmc-chassis-state-mgmt ?= "${@cf_enabled('obmc-chassis-state-mgmt', 'virtual-obmc-chassis-state-mgmt', d)}"
+FEATURE_PACKAGES_obmc-bmc-state-mgmt ?= "${@cf_enabled('obmc-bmc-state-mgmt', 'virtual-obmc-bmc-state-mgmt', d)}"
 
 # Install entire Phosphor application stack by default
 IMAGE_FEATURES += " \
@@ -49,6 +51,7 @@
         ssh-server-dropbear \
         obmc-host-state-mgmt \
         obmc-chassis-state-mgmt \
+        obmc-bmc-state-mgmt \
         "
 
 CORE_IMAGE_EXTRA_INSTALL_append = " bash \
diff --git a/meta-phosphor/common/recipes-phosphor/state/files/xyz.openbmc_project.State.BMC.service b/meta-phosphor/common/recipes-phosphor/state/files/xyz.openbmc_project.State.BMC.service
new file mode 100644
index 0000000..e3034e3
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/state/files/xyz.openbmc_project.State.BMC.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Phosphor BMC State Manager
+Wants=mapper-wait@-org-openbmc-managers-System.service
+After=mapper-wait@-org-openbmc-managers-System.service
+Before=mapper-wait@-xyz-openbmc_project-state-bmc.service
+
+[Service]
+ExecStart={sbindir}/phosphor-bmc-state-manager
+Restart=always
+Type=dbus
+BusName={BUSNAME}
+
+[Install]
+WantedBy={SYSTEMD_DEFAULT_TARGET}
diff --git a/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb b/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb
index 176c42b..390ad49 100644
--- a/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb
+++ b/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb
@@ -10,6 +10,7 @@
 STATE_MGR_PACKAGES = " \
     ${PN}-host \
     ${PN}-chassis \
+    ${PN}-bmc \
 "
 PACKAGES =+ "${STATE_MGR_PACKAGES}"
 DBUS_PACKAGES = "${STATE_MGR_PACKAGES}"
@@ -27,6 +28,7 @@
 
 RDEPENDS_${PN}-host += "libsystemd"
 RDEPENDS_${PN}-chassis += "libsystemd"
+RDEPENDS_${PN}-bmc += "libsystemd"
 
 PROVIDES += "virtual/obmc-host-state-mgmt"
 RPROVIDES_${PN}-host += "virtual-obmc-host-state-mgmt"
@@ -38,6 +40,11 @@
 FILES_${PN}-chassis = "${sbindir}/phosphor-chassis-state-manager"
 DBUS_SERVICE_${PN}-chassis += "xyz.openbmc_project.State.Chassis.service"
 
+PROVIDES += "virtual/obmc-bmc-state-mgmt"
+RPROVIDES_${PN}-bmc += "virtual-obmc-bmc-state-mgmt"
+FILES_${PN}-bmc = "${sbindir}/phosphor-bmc-state-manager"
+DBUS_SERVICE_${PN}-bmc += "xyz.openbmc_project.State.BMC.service"
+
 SRC_URI += "git://github.com/openbmc/phosphor-state-manager"
 SRCREV = "d613b8166a3c3dc652badf8d8c52e74492941f28"
 
diff --git a/meta-phosphor/conf/distro/include/phosphor-defaults.inc b/meta-phosphor/conf/distro/include/phosphor-defaults.inc
index f5263bb..5bada92 100644
--- a/meta-phosphor/conf/distro/include/phosphor-defaults.inc
+++ b/meta-phosphor/conf/distro/include/phosphor-defaults.inc
@@ -21,6 +21,7 @@
 PREFERRED_PROVIDER_virtual/obmc-logging-mgmt ?= "phosphor-logging"
 PREFERRED_PROVIDER_virtual/obmc-host-state-mgmt ?= "phosphor-state-manager"
 PREFERRED_PROVIDER_virtual/obmc-chassis-state-mgmt ?= "phosphor-state-manager"
+PREFERRED_PROVIDER_virtual/obmc-bmc-state-mgmt ?= "phosphor-state-manager"
 
 # virtual/phosphor-ipmi-fru-config
 #
diff --git a/meta-phosphor/conf/distro/openbmc-phosphor.conf b/meta-phosphor/conf/distro/openbmc-phosphor.conf
index 06df823..b177b9e 100644
--- a/meta-phosphor/conf/distro/openbmc-phosphor.conf
+++ b/meta-phosphor/conf/distro/openbmc-phosphor.conf
@@ -36,6 +36,7 @@
         avahi \
         obmc-host-state-mgmt \
         obmc-chassis-state-mgmt \
+        obmc-bmc-state-mgmt \
         ${DISTRO_FEATURES_LIBC} \
         "