Initial commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,175 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
@@ -0,0 +1,12 @@
|
||||
Different components of meta-facebook are under different licenses (a mix
|
||||
of MIT and Apache-2.0). Please see:
|
||||
|
||||
COPYING.Apache-2.0
|
||||
COPYING.MIT (MIT)
|
||||
|
||||
All metadata is MIT licensed unless otherwise stated. Source code
|
||||
included in tree for individual recipes is under the LICENSE stated in
|
||||
the associated recipe (.bb file) unless otherwise stated.
|
||||
|
||||
License information for any other files is either explicitly stated
|
||||
or defaults to Apache-2.0.
|
||||
@@ -0,0 +1,3 @@
|
||||
owners:
|
||||
- amithash@fb.com
|
||||
- patrick@stwcx.xyz
|
||||
@@ -0,0 +1,10 @@
|
||||
# We have a conf and classes directory, add to BBPATH
|
||||
BBPATH .= ":${LAYERDIR}"
|
||||
|
||||
# We have recipes-* directories, add to BBFILES
|
||||
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
|
||||
${LAYERDIR}/recipes-*/*/*.bbappend"
|
||||
|
||||
BBFILE_COLLECTIONS += "facebook-layer"
|
||||
BBFILE_PATTERN_facebook-layer := "^${LAYERDIR}/"
|
||||
LAYERSERIES_COMPAT_facebook-layer := "langdale mickledore"
|
||||
@@ -0,0 +1,3 @@
|
||||
MACHINEOVERRIDES =. "fb-compute-multihost:"
|
||||
|
||||
require conf/machine/include/facebook-compute.inc
|
||||
@@ -0,0 +1,3 @@
|
||||
MACHINEOVERRIDES =. "fb-compute-singlehost:"
|
||||
|
||||
require conf/machine/include/facebook-compute.inc
|
||||
@@ -0,0 +1,3 @@
|
||||
MACHINEOVERRIDES =. "fb-compute:"
|
||||
|
||||
require conf/machine/include/facebook-withhost.inc
|
||||
@@ -0,0 +1,3 @@
|
||||
MACHINEOVERRIDES =. "fb-nohost:"
|
||||
|
||||
require conf/machine/include/facebook.inc
|
||||
@@ -0,0 +1,2 @@
|
||||
MACHINE_FEATURES:append = " fb-secondary-emmc"
|
||||
MACHINEOVERRIDES:append = ":mf-fb-secondary-emmc"
|
||||
@@ -0,0 +1,2 @@
|
||||
MACHINE_FEATURES:append = " tpm2"
|
||||
DISTRO_FEATURES:append = " tpm"
|
||||
@@ -0,0 +1,15 @@
|
||||
MACHINEOVERRIDES =. "fb-withhost:"
|
||||
|
||||
require conf/machine/include/facebook.inc
|
||||
|
||||
MACHINE_FEATURES += "\
|
||||
obmc-chassis-state-mgmt \
|
||||
obmc-host-ipmi \
|
||||
obmc-host-state-mgmt \
|
||||
obmc-phosphor-chassis-mgmt \
|
||||
"
|
||||
|
||||
VIRTUAL-RUNTIME_obmc-host-state-manager ?= "x86-power-control"
|
||||
VIRTUAL-RUNTIME_obmc-chassis-state-manager ?= "x86-power-control"
|
||||
|
||||
PREFERRED_PROVIDER_virtual/obmc-host-ipmi-hw ?= "phosphor-ipmi-kcs"
|
||||
@@ -0,0 +1,23 @@
|
||||
DISTROOVERRIDES .= ":facebook"
|
||||
|
||||
MACHINE_FEATURES += "\
|
||||
obmc-bmc-state-mgmt \
|
||||
obmc-phosphor-fan-mgmt \
|
||||
obmc-phosphor-flash-mgmt \
|
||||
"
|
||||
|
||||
VIRTUAL-RUNTIME_skeleton_workbook = "${MACHINE}-config"
|
||||
|
||||
PREFERRED_PROVIDER_virtual/obmc-chassis-mgmt = "packagegroup-fb-apps"
|
||||
PREFERRED_PROVIDER_virtual/obmc-fan-mgmt = "packagegroup-fb-apps"
|
||||
PREFERRED_PROVIDER_virtual/obmc-flash-mgmt = "packagegroup-fb-apps"
|
||||
PREFERRED_PROVIDER_virtual/obmc-inventory-data ?= "${VIRTUAL-RUNTIME_skeleton_workbook}"
|
||||
PREFERRED_PROVIDER_virtual/obmc-system-mgmt = "packagegroup-fb-apps"
|
||||
|
||||
IMAGE_FEATURES:remove = "obmc-ikvm"
|
||||
IMAGE_FEATURES:append = " allow-root-login"
|
||||
|
||||
# Most of our hardware uses the default ttyS4 but at 57600.
|
||||
SERIAL_CONSOLES:facebook = "57600;ttyS4"
|
||||
|
||||
OBMC_ORG_YAML_SUBDIRS:append:facebook = " com/meta"
|
||||
@@ -0,0 +1,11 @@
|
||||
# We have a conf and classes directory, add to BBPATH
|
||||
BBPATH .= ":${LAYERDIR}"
|
||||
|
||||
# We have recipes-* directories, add to BBFILES
|
||||
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
|
||||
${LAYERDIR}/recipes-*/*/*.bbappend"
|
||||
|
||||
BBFILE_COLLECTIONS += "bletchley-layer"
|
||||
BBFILE_PATTERN_bletchley-layer := "^${LAYERDIR}/"
|
||||
|
||||
LAYERSERIES_COMPAT_bletchley-layer := "langdale mickledore"
|
||||
@@ -0,0 +1,24 @@
|
||||
KMACHINE = "aspeed"
|
||||
KERNEL_DEVICETREE = "${KMACHINE}-bmc-facebook-${MACHINE}.dtb"
|
||||
|
||||
UBOOT_MACHINE = "ast2600_openbmc_spl_defconfig"
|
||||
UBOOT_DEVICETREE = "ast2600-bletchley"
|
||||
SPL_BINARY = "spl/u-boot-spl.bin"
|
||||
SOCSEC_SIGN_ENABLE = "0"
|
||||
|
||||
OBMC_COMPATIBLE_NAMES = "com.meta.Hardware.BMC.Model.Bletchley"
|
||||
|
||||
require conf/distro/include/phosphor-static-norootfs.inc
|
||||
require conf/machine/include/facebook-nohost.inc
|
||||
require conf/machine/include/ast2600.inc
|
||||
require conf/machine/include/obmc-bsp-common.inc
|
||||
require conf/machine/include/facebook-tpm2.inc
|
||||
require conf/machine/include/facebook-secondary-emmc.inc
|
||||
|
||||
FLASH_SIZE = "131072"
|
||||
|
||||
PREFERRED_PROVIDER_virtual/phosphor-led-manager-config-native = "bletchley-led-manager-config-native"
|
||||
|
||||
OBMC_HOST_INSTANCES = "1 2 3 4 5 6"
|
||||
# Primary chassis as Sled plus secondary chassis in N slots.
|
||||
OBMC_CHASSIS_INSTANCES = "0 ${OBMC_HOST_INSTANCES}"
|
||||
@@ -0,0 +1,19 @@
|
||||
# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
|
||||
# changes incompatibly
|
||||
LCONF_VERSION = "8"
|
||||
|
||||
BBPATH = "${TOPDIR}"
|
||||
BBFILES ?= ""
|
||||
|
||||
BBLAYERS ?= " \
|
||||
##OEROOT##/meta \
|
||||
##OEROOT##/meta-poky \
|
||||
##OEROOT##/meta-openembedded/meta-oe \
|
||||
##OEROOT##/meta-openembedded/meta-networking \
|
||||
##OEROOT##/meta-openembedded/meta-python \
|
||||
##OEROOT##/meta-security/meta-tpm \
|
||||
##OEROOT##/meta-phosphor \
|
||||
##OEROOT##/meta-aspeed \
|
||||
##OEROOT##/meta-facebook \
|
||||
##OEROOT##/meta-facebook/meta-bletchley \
|
||||
"
|
||||
@@ -0,0 +1,2 @@
|
||||
Common targets are:
|
||||
obmc-phosphor-image
|
||||
@@ -0,0 +1,258 @@
|
||||
#
|
||||
# This file is your local configuration file and is where all local user settings
|
||||
# are placed. The comments in this file give some guide to the options a new user
|
||||
# to the system might want to change but pretty much any configuration option can
|
||||
# be set in this file. More adventurous users can look at local.conf.extended
|
||||
# which contains other examples of configuration which can be placed in this file
|
||||
# but new users likely won't need any of them initially.
|
||||
#
|
||||
# Lines starting with the '#' character are commented out and in some cases the
|
||||
# default values are provided as comments to show people example syntax. Enabling
|
||||
# the option is a question of removing the # character and making any change to the
|
||||
# variable as required.
|
||||
|
||||
#
|
||||
# Machine Selection
|
||||
#
|
||||
MACHINE ??= "bletchley"
|
||||
|
||||
#
|
||||
# Where to place downloads
|
||||
#
|
||||
# During a first build the system will download many different source code tarballs
|
||||
# from various upstream projects. This can take a while, particularly if your network
|
||||
# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you
|
||||
# can preserve this directory to speed up this part of subsequent builds. This directory
|
||||
# is safe to share between multiple builds on the same machine too.
|
||||
#
|
||||
# The default is a downloads directory under TOPDIR which is the build directory.
|
||||
#
|
||||
#DL_DIR ?= "${TOPDIR}/downloads"
|
||||
|
||||
#
|
||||
# Where to place shared-state files
|
||||
#
|
||||
# BitBake has the capability to accelerate builds based on previously built output.
|
||||
# This is done using "shared state" files which can be thought of as cache objects
|
||||
# and this option determines where those files are placed.
|
||||
#
|
||||
# You can wipe out TMPDIR leaving this directory intact and the build would regenerate
|
||||
# from these files if no changes were made to the configuration. If changes were made
|
||||
# to the configuration, only shared state files where the state was still valid would
|
||||
# be used (done using checksums).
|
||||
#
|
||||
# The default is a sstate-cache directory under TOPDIR.
|
||||
#
|
||||
#SSTATE_DIR ?= "${TOPDIR}/sstate-cache"
|
||||
|
||||
#
|
||||
# Where to place the build output
|
||||
#
|
||||
# This option specifies where the bulk of the building work should be done and
|
||||
# where BitBake should place its temporary files and output. Keep in mind that
|
||||
# this includes the extraction and compilation of many applications and the toolchain
|
||||
# which can use Gigabytes of hard disk space.
|
||||
#
|
||||
# The default is a tmp directory under TOPDIR.
|
||||
#
|
||||
#TMPDIR = "${TOPDIR}/tmp"
|
||||
|
||||
#
|
||||
# Default policy config
|
||||
#
|
||||
# The distribution setting controls which policy settings are used as defaults.
|
||||
# The default value is fine for general Yocto project use, at least initially.
|
||||
# Ultimately when creating custom policy, people will likely end up subclassing
|
||||
# these defaults.
|
||||
#
|
||||
DISTRO ?= "openbmc-phosphor"
|
||||
# As an example of a subclass there is a "bleeding" edge policy configuration
|
||||
# where many versions are set to the absolute latest code from the upstream
|
||||
# source control systems. This is just mentioned here as an example, its not
|
||||
# useful to most new users.
|
||||
# DISTRO ?= "poky-bleeding"
|
||||
|
||||
#
|
||||
# Package Management configuration
|
||||
#
|
||||
# This variable lists which packaging formats to enable. Multiple package backends
|
||||
# can be enabled at once and the first item listed in the variable will be used
|
||||
# to generate the root filesystems.
|
||||
# Options are:
|
||||
# - 'package_deb' for debian style deb files
|
||||
# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager)
|
||||
# - 'package_rpm' for rpm style packages
|
||||
# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk"
|
||||
# We default to ipk:
|
||||
PACKAGE_CLASSES ?= "package_ipk"
|
||||
|
||||
#
|
||||
# SDK target architecture
|
||||
#
|
||||
# This variable specifies the architecture to build SDK items for and means
|
||||
# you can build the SDK packages for architectures other than the machine you are
|
||||
# running the build on (i.e. building i686 packages on an x86_64 host).
|
||||
# Supported values are i686, x86_64, aarch64
|
||||
#SDKMACHINE ?= "i686"
|
||||
|
||||
SANITY_TESTED_DISTROS:append ?= " *"
|
||||
|
||||
#
|
||||
# Extra image configuration defaults
|
||||
#
|
||||
# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated
|
||||
# images. Some of these options are added to certain image types automatically. The
|
||||
# variable can contain the following options:
|
||||
# "dbg-pkgs" - add -dbg packages for all installed packages
|
||||
# (adds symbol information for debugging/profiling)
|
||||
# "src-pkgs" - add -src packages for all installed packages
|
||||
# (adds source code for debugging)
|
||||
# "dev-pkgs" - add -dev packages for all installed packages
|
||||
# (useful if you want to develop against libs in the image)
|
||||
# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages
|
||||
# (useful if you want to run the package test suites)
|
||||
# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.)
|
||||
# "tools-debug" - add debugging tools (gdb, strace)
|
||||
# "eclipse-debug" - add Eclipse remote debugging support
|
||||
# "tools-profile" - add profiling tools (oprofile, lttng, valgrind)
|
||||
# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.)
|
||||
# "debug-tweaks" - make an image suitable for development
|
||||
# e.g. ssh root access has a blank password
|
||||
# There are other application targets that can be used here too, see
|
||||
# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details.
|
||||
# We default to enabling the debugging tweaks.
|
||||
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
|
||||
|
||||
#
|
||||
# Additional image features
|
||||
#
|
||||
# The following is a list of additional classes to use when building images which
|
||||
# enable extra features. Some available options which can be included in this variable
|
||||
# are:
|
||||
# - 'buildstats' collect build statistics
|
||||
USER_CLASSES ?= "buildstats"
|
||||
|
||||
#
|
||||
# Runtime testing of images
|
||||
#
|
||||
# The build system can test booting virtual machine images under qemu (an emulator)
|
||||
# after any root filesystems are created and run tests against those images. It can also
|
||||
# run tests against any SDK that are built. To enable this uncomment these lines.
|
||||
# See classes/test{image,sdk}.bbclass for further details.
|
||||
#IMAGE_CLASSES += "testimage testsdk"
|
||||
#TESTIMAGE_AUTO_qemuall = "1"
|
||||
|
||||
#
|
||||
# Interactive shell configuration
|
||||
#
|
||||
# Under certain circumstances the system may need input from you and to do this it
|
||||
# can launch an interactive shell. It needs to do this since the build is
|
||||
# multithreaded and needs to be able to handle the case where more than one parallel
|
||||
# process may require the user's attention. The default is iterate over the available
|
||||
# terminal types to find one that works.
|
||||
#
|
||||
# Examples of the occasions this may happen are when resolving patches which cannot
|
||||
# be applied, to use the devshell or the kernel menuconfig
|
||||
#
|
||||
# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none
|
||||
# Note: currently, Konsole support only works for KDE 3.x due to the way
|
||||
# newer Konsole versions behave
|
||||
#OE_TERMINAL = "auto"
|
||||
# By default disable interactive patch resolution (tasks will just fail instead):
|
||||
PATCHRESOLVE = "noop"
|
||||
|
||||
#
|
||||
# Disk Space Monitoring during the build
|
||||
#
|
||||
# Monitor the disk space during the build. If there is less that 1GB of space or less
|
||||
# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully
|
||||
# shutdown the build. If there is less than 100MB or 1K inodes, perform a hard abort
|
||||
# of the build. The reason for this is that running completely out of space can corrupt
|
||||
# files and damages the build in ways which may not be easily recoverable.
|
||||
# It's necessary to monitor /tmp, if there is no space left the build will fail
|
||||
# with very exotic errors.
|
||||
BB_DISKMON_DIRS ??= "\
|
||||
STOPTASKS,${TMPDIR},1G,100K \
|
||||
STOPTASKS,${DL_DIR},1G,100K \
|
||||
STOPTASKS,${SSTATE_DIR},1G,100K \
|
||||
STOPTASKS,/tmp,100M,100K \
|
||||
HALT,${TMPDIR},100M,1K \
|
||||
HALT,${DL_DIR},100M,1K \
|
||||
HALT,${SSTATE_DIR},100M,1K \
|
||||
HALT,/tmp,10M,1K"
|
||||
|
||||
#
|
||||
# Shared-state files from other locations
|
||||
#
|
||||
# As mentioned above, shared state files are prebuilt cache data objects which can be
|
||||
# used to accelerate build time. This variable can be used to configure the system
|
||||
# to search other mirror locations for these objects before it builds the data itself.
|
||||
#
|
||||
# This can be a filesystem directory, or a remote url such as http or ftp. These
|
||||
# would contain the sstate-cache results from previous builds (possibly from other
|
||||
# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the
|
||||
# cache locations to check for the shared objects.
|
||||
# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH
|
||||
# at the end as shown in the examples below. This will be substituted with the
|
||||
# correct path within the directory structure.
|
||||
#SSTATE_MIRRORS ?= "\
|
||||
#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \
|
||||
#file://.* file:///some/local/dir/sstate/PATH"
|
||||
|
||||
#
|
||||
# Yocto Project SState Mirror
|
||||
#
|
||||
# The Yocto Project has prebuilt artefacts available for its releases, you can enable
|
||||
# use of these by uncommenting the following line. This will mean the build uses
|
||||
# the network to check for artefacts at the start of builds, which does slow it down
|
||||
# equally, it will also speed up the builds by not having to build things if they are
|
||||
# present in the cache. It assumes you can download something faster than you can build it
|
||||
# which will depend on your network.
|
||||
#
|
||||
#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH"
|
||||
|
||||
#
|
||||
# Qemu configuration
|
||||
#
|
||||
# By default native qemu will build with a builtin VNC server where graphical output can be
|
||||
# seen. The line below enables the SDL UI frontend too.
|
||||
PACKAGECONFIG:append:pn-qemu-system-native = " sdl"
|
||||
# By default libsdl2-native will be built, if you want to use your host's libSDL instead of
|
||||
# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below.
|
||||
#ASSUME_PROVIDED += "libsdl2-native"
|
||||
|
||||
# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds
|
||||
# a handy set of menus for controlling the emulator.
|
||||
#PACKAGECONFIG:append:pn-qemu-system-native = " gtk+"
|
||||
|
||||
#
|
||||
# Hash Equivalence
|
||||
#
|
||||
# Enable support for automatically running a local hash equivalence server and
|
||||
# instruct bitbake to use a hash equivalence aware signature generator. Hash
|
||||
# equivalence improves reuse of sstate by detecting when a given sstate
|
||||
# artifact can be reused as equivalent, even if the current task hash doesn't
|
||||
# match the one that generated the artifact.
|
||||
#
|
||||
# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format
|
||||
#
|
||||
#BB_HASHSERVE = "auto"
|
||||
#BB_SIGNATURE_HANDLER = "OEEquivHash"
|
||||
|
||||
#
|
||||
# Memory Resident Bitbake
|
||||
#
|
||||
# Bitbake's server component can stay in memory after the UI for the current command
|
||||
# has completed. This means subsequent commands can run faster since there is no need
|
||||
# for bitbake to reload cache files and so on. Number is in seconds, after which the
|
||||
# server will shut down.
|
||||
#
|
||||
#BB_SERVER_TIMEOUT = "60"
|
||||
|
||||
# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to
|
||||
# track the version of this file when it was generated. This can safely be ignored if
|
||||
# this doesn't mean anything to you.
|
||||
CONF_VERSION = "2"
|
||||
|
||||
# Set the root password to '0penBmc'
|
||||
# Defaults from meta-phosphor/conf/distro/include/phosphor-defaults.inc
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
SUMMARY = "Bletchley board type checker"
|
||||
DESCRIPTION = "Bletchley board type checker to probe i2c device with correct driver in user-space"
|
||||
PR = "r1"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
inherit allarch systemd obmc-phosphor-systemd
|
||||
|
||||
RDEPENDS:${PN} += " bash i2c-tools"
|
||||
|
||||
SRC_URI = " file://board-type-checker-fpb \
|
||||
file://board-type-checker-fpb.service \
|
||||
"
|
||||
|
||||
SYSTEMD_PACKAGES = "${PN}"
|
||||
SYSTEMD_SERVICE:${PN}:append = " board-type-checker-fpb.service"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${libexecdir}
|
||||
install -m 0755 ${WORKDIR}/board-type-checker-fpb ${D}${libexecdir}/
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
is_valid_hdc1080()
|
||||
{
|
||||
local I2C_BUS=$1
|
||||
local DEV_ADDR=$2
|
||||
|
||||
MFR_ID=$(i2ctransfer -y -f "${I2C_BUS}" w1@"${DEV_ADDR}" 0xfe r2)
|
||||
if [ "$MFR_ID" != "0x54 0x49" ]; then
|
||||
return 1;
|
||||
fi
|
||||
|
||||
DEV_ID=$(i2ctransfer -y -f "${I2C_BUS}" w1@"${DEV_ADDR}" 0xff r2)
|
||||
if [ "$DEV_ID" != "0x10 0x50" ]; then
|
||||
return 1;
|
||||
fi
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
set_frontpanel_model()
|
||||
{
|
||||
busctl set-property xyz.openbmc_project.Settings /xyz/openbmc_project/inventory/system/chassis0/frontpanel xyz.openbmc_project.Inventory.Decorator.Asset Model s "Bletchley_FPB_${1}"
|
||||
}
|
||||
|
||||
I2C_BUS=10
|
||||
DEV_ADDR=0x40
|
||||
|
||||
VIRT_SNR_CONF="/var/lib/phosphor-virtual-sensor/virtual_sensor_config.json"
|
||||
HDC1080_VIRT_SNR_CONF="/usr/share/phosphor-virtual-sensor/virtual_sensor_config_hdc1080.json"
|
||||
SI7021_VIRT_SNR_CONF="/usr/share/phosphor-virtual-sensor/virtual_sensor_config_si7021.json"
|
||||
|
||||
# Check chip type
|
||||
if is_valid_hdc1080 "$I2C_BUS" "$DEV_ADDR"; then
|
||||
CHIP_TYPE="HDC1080"
|
||||
else
|
||||
CHIP_TYPE="SI7021"
|
||||
fi
|
||||
|
||||
# Set Frontpanel board model
|
||||
set_frontpanel_model "$CHIP_TYPE"
|
||||
|
||||
# Setup virtual_sensor_config.json for phosphor-virtual-sensor
|
||||
case "$CHIP_TYPE" in
|
||||
"HDC1080")
|
||||
REQUIRED_CONF_PATH="$HDC1080_VIRT_SNR_CONF"
|
||||
;;
|
||||
"SI7021")
|
||||
REQUIRED_CONF_PATH="$SI7021_VIRT_SNR_CONF"
|
||||
;;
|
||||
*)
|
||||
REQUIRED_CONF_PATH="$HDC1080_VIRT_SNR_CONF"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ! -d "$(dirname $VIRT_SNR_CONF)" ]; then
|
||||
mkdir -p "$(dirname $VIRT_SNR_CONF)"
|
||||
fi
|
||||
|
||||
if [ ! -e "$VIRT_SNR_CONF" ]; then
|
||||
ln -s "$REQUIRED_CONF_PATH" "$VIRT_SNR_CONF"
|
||||
else
|
||||
REAL_CONF_PATH="$(realpath $VIRT_SNR_CONF)"
|
||||
if [ "$REAL_CONF_PATH" != "$REQUIRED_CONF_PATH" ]; then
|
||||
rm "$VIRT_SNR_CONF"
|
||||
ln -s "$REQUIRED_CONF_PATH" "$VIRT_SNR_CONF"
|
||||
fi
|
||||
fi
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
[Unit]
|
||||
Description=Front Panel Board Checker
|
||||
StartLimitIntervalSec=90
|
||||
StartLimitBurst=5
|
||||
Before=phosphor-virtual-sensor.service
|
||||
Before=xyz.openbmc_project.EntityManager.service
|
||||
Wants=mapper-wait@-xyz-openbmc_project-inventory-system-chassis0-frontpanel.service
|
||||
After=mapper-wait@-xyz-openbmc_project-inventory-system-chassis0-frontpanel.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/libexec/board-type-checker-fpb
|
||||
SyslogIdentifier=Front Panel Board Checker
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
Restart=on-failure
|
||||
RestartSec=1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
SUMMARY = "Bletchley SLED Present Service"
|
||||
DESCRIPTION = "OpenBMC Quanta Detect Present Daemon."
|
||||
PR = "r1"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
inherit obmc-phosphor-systemd
|
||||
|
||||
DEPENDS += "systemd"
|
||||
RDEPENDS:${PN} += " bash phosphor-gpio-monitor-presence"
|
||||
|
||||
SRC_URI = " file://detect-sled-present \
|
||||
file://detect-sled-present@.service \
|
||||
file://bletchley-sled-insertion@.target \
|
||||
file://bletchley-sled-removal@.target \
|
||||
"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${bindir}
|
||||
install -m 0755 ${WORKDIR}/detect-sled-present ${D}${bindir}/
|
||||
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${WORKDIR}/detect-sled-present@.service ${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${WORKDIR}/bletchley-sled-insertion@.target ${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${WORKDIR}/bletchley-sled-removal@.target ${D}${systemd_system_unitdir}
|
||||
}
|
||||
|
||||
TGT = "${SYSTEMD_DEFAULT_TARGET}"
|
||||
|
||||
SLED_PRESENT_INSTFMT="../detect-sled-present@.service:${TGT}.wants/detect-sled-present@{0}.service"
|
||||
SYSTEMD_SERVICE:${PN} += "detect-sled-present@.service"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list(d, 'SLED_PRESENT_INSTFMT', 'OBMC_HOST_INSTANCES')}"
|
||||
|
||||
SLED_INSERT_INSTFMT="../bletchley-sled-insertion@.target:${TGT}.wants/bletchley-sled-insertion@{0}.target"
|
||||
SYSTEMD_SERVICE:${PN} += "bletchley-sled-insertion@.target"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list(d, 'SLED_INSERT_INSTFMT', 'OBMC_HOST_INSTANCES')}"
|
||||
|
||||
SLED_REMOVE_INSTFMT="bletchley-sled-removal@.target:bletchley-sled-removal@{0}.target"
|
||||
SYSTEMD_SERVICE:${PN} += "bletchley-sled-removal@.target"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list(d, 'SLED_REMOVE_INSTFMT', 'OBMC_HOST_INSTANCES')}"
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Bletchlet SLED%i insertion target
|
||||
|
||||
Requires=chassis-poweron@%i.service
|
||||
After=chassis-poweron@%i.service
|
||||
Requires=motor-init-calibration@%i.service
|
||||
After=motor-init-calibration@%i.service
|
||||
Conflicts=bletchley-sled-removed@%i.target
|
||||
|
||||
RefuseManualStop=yes
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Bletchlet SLED%i removal target
|
||||
|
||||
Conflicts=motor-init-calibration@%i.service
|
||||
Conflicts=chassis-poweron@%i.service
|
||||
Conflicts=bletchley-sled-insertion@%i.target
|
||||
|
||||
RefuseManualStop=yes
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
#!/bin/bash
|
||||
|
||||
SLED_ID=$1
|
||||
SERVICE_NAME="xyz.openbmc_project.Inventory.Manager"
|
||||
PRESENT_OBJPATH="/xyz/openbmc_project/inventory/system/chassis/presence/presence_sled${SLED_ID}"
|
||||
DBUS_PROPERTY_INTF="org.freedesktop.DBus.Properties"
|
||||
|
||||
bind_i2c_driver()
|
||||
{
|
||||
I2C_BUS_ADDR=$1
|
||||
DRIVER_NAME=$2
|
||||
DRIVER_DIR="/sys/bus/i2c/drivers/${DRIVER_NAME}"
|
||||
if [ ! -e "${DRIVER_DIR}/${I2C_BUS_ADDR}" ]; then
|
||||
echo "${I2C_BUS_ADDR}" > "${DRIVER_DIR}"/bind
|
||||
fi
|
||||
}
|
||||
|
||||
unbind_i2c_driver()
|
||||
{
|
||||
I2C_BUS_ADDR=$1
|
||||
DRIVER_NAME=$2
|
||||
DRIVER_DIR="/sys/bus/i2c/drivers/${DRIVER_NAME}"
|
||||
if [ -e "${DRIVER_DIR}/${I2C_BUS_ADDR}" ]; then
|
||||
echo "${I2C_BUS_ADDR}" > "${DRIVER_DIR}"/unbind
|
||||
fi
|
||||
}
|
||||
|
||||
sled_insert_action()
|
||||
{
|
||||
SLED_ID=$1
|
||||
I2C_BUS_NUM=$((SLED_ID-1))
|
||||
|
||||
# 0022: fusb302
|
||||
bind_i2c_driver "${I2C_BUS_NUM}-0022" "typec_fusb302"
|
||||
|
||||
# 0045: ina230
|
||||
bind_i2c_driver "${I2C_BUS_NUM}-0045" "ina2xx"
|
||||
|
||||
# 0040: mp5023
|
||||
bind_i2c_driver "${I2C_BUS_NUM}-0040" "mp5023"
|
||||
|
||||
# 0041: pca9536
|
||||
bind_i2c_driver "${I2C_BUS_NUM}-0041" "pca953x"
|
||||
|
||||
# 0076: pca9539
|
||||
bind_i2c_driver "${I2C_BUS_NUM}-0076" "pca953x"
|
||||
|
||||
# 004f: tmp421
|
||||
bind_i2c_driver "${I2C_BUS_NUM}-004f" "tmp421"
|
||||
|
||||
# 0067: pca9552
|
||||
bind_i2c_driver "${I2C_BUS_NUM}-0067" "leds-pca955x"
|
||||
|
||||
# 0054: 24c64
|
||||
bind_i2c_driver "${I2C_BUS_NUM}-0054" "at24"
|
||||
|
||||
# start bletchley-sled-insertion target
|
||||
/bin/systemctl start bletchley-sled-insertion@"${SLED_ID}".target
|
||||
}
|
||||
|
||||
sled_remove_action()
|
||||
{
|
||||
SLED_ID=$1
|
||||
I2C_BUS_NUM=$((SLED_ID-1))
|
||||
|
||||
# 0022: fusb302
|
||||
unbind_i2c_driver "${I2C_BUS_NUM}-0022" "typec_fusb302"
|
||||
|
||||
# # 0045: ina230
|
||||
# unbind_i2c_driver "${I2C_BUS_NUM}-0045" "ina2xx"
|
||||
|
||||
# # 0040: mp5023
|
||||
# unbind_i2c_driver "${I2C_BUS_NUM}-0040" "mp5023"
|
||||
|
||||
# # 0041: pca9536
|
||||
# unbind_i2c_driver "${I2C_BUS_NUM}-0041" "pca953x"
|
||||
|
||||
# # 0076: pca9539
|
||||
# unbind_i2c_driver "${I2C_BUS_NUM}-0076" "pca953x"
|
||||
|
||||
# # 004f: tmp421
|
||||
# unbind_i2c_driver "${I2C_BUS_NUM}-004f" "tmp421"
|
||||
|
||||
# # 0067: pca9552
|
||||
# unbind_i2c_driver "${I2C_BUS_NUM}-0067" "leds-pca955x"
|
||||
|
||||
# # 0054: 24c64
|
||||
# unbind_i2c_driver "${I2C_BUS_NUM}-0054" "at24"
|
||||
|
||||
# start bletchley-sled-removal target
|
||||
/bin/systemctl start bletchley-sled-removal@"${SLED_ID}".target
|
||||
}
|
||||
|
||||
|
||||
dbus-monitor --system "type=signal,interface=${DBUS_PROPERTY_INTF},sender=${SERVICE_NAME},path=${PRESENT_OBJPATH}" |
|
||||
while read -r line; do
|
||||
case "$line" in
|
||||
*"boolean false"*)
|
||||
echo "SLED${SLED_ID} Removal"
|
||||
sled_remove_action "$SLED_ID"
|
||||
;;
|
||||
*"boolean true"*)
|
||||
echo "SLED${SLED_ID} Insertion"
|
||||
sled_insert_action "$SLED_ID"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
exit 0
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=SLED%i Present Manager
|
||||
After=phosphor-gpio-presence@presence-sled%i.service
|
||||
Wants=phosphor-gpio-presence@presence-sled%i.service
|
||||
After=mapper-wait@-xyz-openbmc_project-inventory-system-chassis-presence-presence_sled%i.service
|
||||
Wants=mapper-wait@-xyz-openbmc_project-inventory-system-chassis-presence-presence_sled%i.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/detect-sled-present %i
|
||||
Type=simple
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=Flash usb controller image on SLED %i
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=no
|
||||
ExecStart=/usr/sbin/usb-controller-update %i
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
#!/bin/bash
|
||||
|
||||
is_valid_sled_num()
|
||||
{
|
||||
var=$1
|
||||
if [[ $var =~ ^-?[0-9]+$ ]]; then
|
||||
if [ "$var" -ge 1 ] && [ "$var" -le 6 ]; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
set_gpio()
|
||||
{
|
||||
local pin_info
|
||||
read -r -a pin_info < <(gpiofind "$1")
|
||||
gpioset "${pin_info[0]}" "${pin_info[1]}"="$2"
|
||||
}
|
||||
|
||||
bind_flash()
|
||||
{
|
||||
local sled_index=$1
|
||||
|
||||
if [ "$sled_index" -eq 1 ]; then
|
||||
set_gpio SEL_SPI2_MUX 0
|
||||
set_gpio SPI2_MUX1 0
|
||||
set_gpio SPI2_MUX2 1
|
||||
set_gpio SPI2_MUX3 1
|
||||
elif [ "$sled_index" -eq 2 ]; then
|
||||
set_gpio SEL_SPI2_MUX 1
|
||||
set_gpio SPI2_MUX1 0
|
||||
set_gpio SPI2_MUX2 1
|
||||
set_gpio SPI2_MUX3 1
|
||||
elif [ "$sled_index" -eq 3 ]; then
|
||||
set_gpio SEL_SPI2_MUX 0
|
||||
set_gpio SPI2_MUX1 1
|
||||
set_gpio SPI2_MUX2 0
|
||||
set_gpio SPI2_MUX3 1
|
||||
elif [ "$sled_index" -eq 4 ]; then
|
||||
set_gpio SEL_SPI2_MUX 1
|
||||
set_gpio SPI2_MUX1 1
|
||||
set_gpio SPI2_MUX2 0
|
||||
set_gpio SPI2_MUX3 1
|
||||
elif [ "$sled_index" -eq 5 ]; then
|
||||
set_gpio SEL_SPI2_MUX 0
|
||||
set_gpio SPI2_MUX1 1
|
||||
set_gpio SPI2_MUX2 1
|
||||
set_gpio SPI2_MUX3 0
|
||||
elif [ "$sled_index" -eq 6 ]; then
|
||||
set_gpio SEL_SPI2_MUX 1
|
||||
set_gpio SPI2_MUX1 1
|
||||
set_gpio SPI2_MUX2 1
|
||||
set_gpio SPI2_MUX3 0
|
||||
else
|
||||
echo "Error: Invalid sled index $sled_index"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! echo -n spi1.0 > /sys/bus/spi/drivers/spi-nor/bind; then
|
||||
echo "Error: flash bind failed"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
unbind_flash()
|
||||
{
|
||||
echo -n spi1.0 > /sys/bus/spi/drivers/spi-nor/unbind
|
||||
set_gpio SEL_SPI2_MUX 1
|
||||
set_gpio SPI2_MUX1 1
|
||||
set_gpio SPI2_MUX2 1
|
||||
set_gpio SPI2_MUX3 1
|
||||
return 0
|
||||
}
|
||||
|
||||
findmtd()
|
||||
{
|
||||
m=$(grep -xl "$1" /sys/class/mtd/*/name)
|
||||
m=${m%/name}
|
||||
m=${m##*/}
|
||||
echo "$m"
|
||||
}
|
||||
|
||||
error_cleanup()
|
||||
{
|
||||
unbind_flash
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
SLED_INDEX=$1
|
||||
IMAGE_FILE="/run/initramfs/image-usb"
|
||||
MTD_NAME="pnor"
|
||||
FLASH_CP_CMD="/usr/sbin/flashcp"
|
||||
FLASH_ERASEALL_CMD="/usr/sbin/flash_eraseall"
|
||||
|
||||
if ! is_valid_sled_num "$SLED_INDEX"; then
|
||||
echo "Invalid sled number: $SLED_INDEX"
|
||||
echo "Usage: usb-controller-update <SLED_NUM>"
|
||||
echo ""
|
||||
echo " SLED_NUM [1-6]"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! bind_flash "$SLED_INDEX"; then
|
||||
error_cleanup
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
|
||||
pnormtd="$(findmtd $MTD_NAME)"
|
||||
if test -z "$pnormtd"; then
|
||||
echo "Error: can not find pnor mtd device"
|
||||
error_cleanup
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
|
||||
MTD_NODE_PATH="/dev/$pnormtd"
|
||||
if [ ! -c "$MTD_NODE_PATH" ]; then
|
||||
echo "Error: /dev/$pnormtd device node not exist"
|
||||
error_cleanup
|
||||
fi
|
||||
|
||||
echo "Bind mtd node success, path: $MTD_NODE_PATH"
|
||||
sleep 1
|
||||
|
||||
$FLASH_ERASEALL_CMD "$MTD_NODE_PATH" || error_cleanup
|
||||
echo "Erase flash block done"
|
||||
sleep 1
|
||||
|
||||
$FLASH_CP_CMD -v $IMAGE_FILE "$MTD_NODE_PATH" || error_cleanup
|
||||
echo "Write firmware image done"
|
||||
sync
|
||||
sleep 1
|
||||
|
||||
unbind_flash
|
||||
exit 0
|
||||
@@ -0,0 +1,23 @@
|
||||
SUMMARY = "Firmware update tools"
|
||||
PR = "r1"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
inherit obmc-phosphor-systemd
|
||||
|
||||
RDEPENDS:${PN} += "bash"
|
||||
RDEPENDS:${PN} += "libgpiod-tools"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
SRC_URI += " \
|
||||
file://usb-controller-update \
|
||||
"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${sbindir}
|
||||
install -m 0755 ${WORKDIR}/usb-controller-update ${D}${sbindir}
|
||||
}
|
||||
|
||||
FLASH_USB_CONTROLLER_INSTFMT="flash-usb-controller@.service:flash-usb-controller@{0}.service"
|
||||
SYSTEMD_SERVICE:${PN} += "flash-usb-controller@.service"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list(d, 'FLASH_USB_CONTROLLER_INSTFMT', 'OBMC_HOST_INSTANCES')}"
|
||||
@@ -0,0 +1,214 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# mdio-util - MDIO Utility for AST2600
|
||||
#
|
||||
# This shell script provides the ability to access MDIO bus over devmem
|
||||
#
|
||||
# TODO: A read/write action contains multiple MDIO operations, it needs a
|
||||
# lock to protect entire action.
|
||||
|
||||
|
||||
RETRY_CNT=30
|
||||
RETRY_DEALY_SEC="0.1"
|
||||
|
||||
MDIO_BASE_REG=$((16#1e650000))
|
||||
C22_READ_CMD=$((16#98000000))
|
||||
C22_WRITE_CMD=$((16#94000000))
|
||||
|
||||
C45_ADDR_CMD=$((16#80000000))
|
||||
C45_WRITE_CMD=$((16#84000000))
|
||||
C45_PREAD_CMD=$((16#88000000))
|
||||
C45_READ_CMD=$((16#8C000000))
|
||||
|
||||
PHY_ADDR_STEP=$((16#200000))
|
||||
DEV_ADDR_STEP=$((16#10000))
|
||||
REG_ADDR_STEP=$((16#10000))
|
||||
|
||||
aspeed_mdio_c22_read() {
|
||||
BUS=$1
|
||||
PHY_ADDR=$2
|
||||
REG_ADDR=$3
|
||||
|
||||
MDIO_CTRL_REG=$((MDIO_BASE_REG+BUS*8))
|
||||
MDIO_DATA_REG=$((MDIO_CTRL_REG+4))
|
||||
|
||||
CMD=$((C22_READ_CMD+PHY_ADDR*PHY_ADDR_STEP+REG_ADDR*REG_ADDR_STEP))
|
||||
|
||||
# write control register
|
||||
devmem $MDIO_CTRL_REG 32 $CMD
|
||||
for i in $(seq 1 1 $RETRY_CNT)
|
||||
do
|
||||
CHECK_STR=$(devmem $MDIO_CTRL_REG)
|
||||
CHECK_VAL=$((16#${CHECK_STR#"0x"}))
|
||||
if [ $((CHECK_VAL&16#80000000)) -eq 0 ]; then
|
||||
break
|
||||
elif [ "$i" -eq "${RETRY_CNT}" ]; then
|
||||
echo "[c22] read operation timeout"
|
||||
return 1
|
||||
fi
|
||||
sleep "$RETRY_DEALY_SEC"
|
||||
done
|
||||
|
||||
# read data register
|
||||
for i in $(seq 1 1 $RETRY_CNT)
|
||||
do
|
||||
DATA_STR=$(devmem $MDIO_DATA_REG)
|
||||
DATA_VAL=$((16#${DATA_STR#"0x"}))
|
||||
if [ $((DATA_VAL&16#00010000)) -ne 0 ]; then
|
||||
DATA_VAL=$((DATA_VAL&16#0000FFFF))
|
||||
echo "0x$(printf %04x $DATA_VAL)"
|
||||
break
|
||||
elif [ "$i" -eq "$RETRY_CNT" ]; then
|
||||
echo "[c22] read data timeout"
|
||||
return 1
|
||||
fi
|
||||
sleep "$RETRY_DEALY_SEC"
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
aspeed_mdio_c22_write() {
|
||||
BUS=$1
|
||||
PHY_ADDR=$2
|
||||
REG_ADDR=$3
|
||||
WR_DATA=$4
|
||||
|
||||
MDIO_CTRL_REG=$((MDIO_BASE_REG+BUS*8))
|
||||
MDIO_DATA_REG=$((MDIO_CTRL_REG+4))
|
||||
CMD=$((C22_WRITE_CMD+PHY_ADDR*PHY_ADDR_STEP+REG_ADDR*REG_ADDR_STEP+WR_DATA))
|
||||
|
||||
# write control register
|
||||
devmem $MDIO_CTRL_REG 32 $CMD
|
||||
for i in $(seq 1 1 $RETRY_CNT)
|
||||
do
|
||||
CHECK_STR=$(devmem $MDIO_CTRL_REG)
|
||||
CHECK_VAL=$((16#${CHECK_STR#"0x"}))
|
||||
if [ $((CHECK_VAL&16#80000000)) -eq 0 ]; then
|
||||
break
|
||||
elif [ "$i" -eq "$RETRY_CNT" ]; then
|
||||
echo "[c22] write operation timeout"
|
||||
return 1
|
||||
fi
|
||||
sleep "$RETRY_DEALY_SEC"
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
aspeed_mdio_c45_ctrl() {
|
||||
BUS=$1
|
||||
C45_OP=$2
|
||||
PHY_ADDR=$3
|
||||
DEV_ADDR=$4
|
||||
CMD_DATA=$5
|
||||
|
||||
MDIO_CTRL_REG=$((MDIO_BASE_REG+BUS*8))
|
||||
|
||||
case "$C45_OP" in
|
||||
0)
|
||||
CMD=$C45_ADDR_CMD
|
||||
;;
|
||||
1)
|
||||
CMD=$C45_WRITE_CMD
|
||||
;;
|
||||
2)
|
||||
CMD=$C45_PREAD_CMD
|
||||
;;
|
||||
3)
|
||||
CMD=$C45_READ_CMD
|
||||
;;
|
||||
*)
|
||||
echo "[c45] unknow operator $C45_OP"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
CMD=$((CMD+PHY_ADDR*PHY_ADDR_STEP+DEV_ADDR*DEV_ADDR_STEP+CMD_DATA))
|
||||
|
||||
# write control register
|
||||
devmem $MDIO_CTRL_REG 32 $CMD
|
||||
for i in $(seq 1 1 $RETRY_CNT)
|
||||
do
|
||||
CHECK_STR=$(devmem $MDIO_CTRL_REG)
|
||||
CHECK_VAL=$((16#${CHECK_STR#"0x"}))
|
||||
if [ $((CHECK_VAL&16#80000000)) -eq 0 ]; then
|
||||
break
|
||||
elif [ "$i" -eq "$RETRY_CNT" ]; then
|
||||
echo "[c45] operation timeout, op: $C45_OP"
|
||||
return 1
|
||||
fi
|
||||
sleep "$RETRY_DEALY_SEC"
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
aspeed_mdio_c45_data() {
|
||||
BUS=$1
|
||||
PHY_ADDR=$2
|
||||
DEV_ADDR=$3
|
||||
|
||||
MDIO_CTRL_REG=$((MDIO_BASE_REG+BUS*8))
|
||||
MDIO_DATA_REG=$((MDIO_CTRL_REG+4))
|
||||
|
||||
# read data register
|
||||
for i in $(seq 1 1 $RETRY_CNT)
|
||||
do
|
||||
DATA_STR=$(devmem $MDIO_DATA_REG)
|
||||
DATA_VAL=$((16#${DATA_STR#"0x"}))
|
||||
if [ $((DATA_VAL&16#00010000)) -ne 0 ]; then
|
||||
DATA_VAL=$((DATA_VAL&16#0000FFFF))
|
||||
echo "0x$(printf %04x $DATA_VAL)"
|
||||
break
|
||||
elif [ "$i" -eq "$RETRY_CNT" ]; then
|
||||
echo "[c45] read data timeout"
|
||||
return 1
|
||||
fi
|
||||
sleep "$RETRY_DEALY_SEC"
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
print_usage() {
|
||||
echo "Usage:"
|
||||
echo " [clause 22]"
|
||||
echo " $0 c22 r <BUS> <PHY_ADDR> <REG_ADDR>"
|
||||
echo " $0 c22 w <BUS> <PHY_ADDR> <REG_ADDR> <DATA>"
|
||||
echo " [clause 45]"
|
||||
echo " $0 c45 r <BUS> <PHY_ADDR> <DEV_ADDR> <REG_ADDR>"
|
||||
echo " $0 c45 w <BUS> <PHY_ADDR> <DEV_ADDR> <REG_ADDR> <DATA>"
|
||||
}
|
||||
|
||||
CLAUSE_VER=${1}
|
||||
CMD_TYPE=${2}
|
||||
BUS=$3
|
||||
PHY_ADDR=$4
|
||||
|
||||
if [ ! -c /dev/mem ]; then
|
||||
mknod /dev/mem c 1 1
|
||||
fi
|
||||
|
||||
if [ "$CLAUSE_VER" == "c22" ] && [ "$CMD_TYPE" == "r" ] && [ "$#" -eq 5 ]; then
|
||||
REG_ADDR=${5}
|
||||
aspeed_mdio_c22_read "$BUS" "$PHY_ADDR" "$REG_ADDR" || exit 1
|
||||
elif [ "$CLAUSE_VER" == "c22" ] && [ "$CMD_TYPE" == "w" ] && [ "$#" -eq 6 ]; then
|
||||
REG_ADDR=${5}
|
||||
DATA=${6}
|
||||
aspeed_mdio_c22_write "$BUS" "$PHY_ADDR" "$REG_ADDR" "$DATA" || exit 1
|
||||
elif [ "$CLAUSE_VER" == "c45" ] && [ "$CMD_TYPE" == "r" ] && [ "$#" -eq 6 ]; then
|
||||
DEV_ADDR=${5}
|
||||
REG_ADDR=${6}
|
||||
aspeed_mdio_c45_ctrl "$BUS" 0 "$PHY_ADDR" "$DEV_ADDR" "$REG_ADDR" || exit 1
|
||||
aspeed_mdio_c45_ctrl "$BUS" 3 "$PHY_ADDR" "$DEV_ADDR" "$REG_ADDR" || exit 1
|
||||
aspeed_mdio_c45_data "$BUS" "$PHY_ADDR" "$DEV_ADDR" || exit 1
|
||||
elif [ "$CLAUSE_VER" == "c45" ] && [ "$CMD_TYPE" == "w" ] && [ "$#" -eq 7 ]; then
|
||||
DEV_ADDR=${5}
|
||||
REG_ADDR=${6}
|
||||
DATA=${7}
|
||||
aspeed_mdio_c45_ctrl "$BUS" 0 "$PHY_ADDR" "$DEV_ADDR" "$REG_ADDR" || exit 1
|
||||
aspeed_mdio_c45_ctrl "$BUS" 1 "$PHY_ADDR" "$DEV_ADDR" "$DATA" || exit 1
|
||||
else
|
||||
print_usage
|
||||
fi
|
||||
@@ -0,0 +1,16 @@
|
||||
SUMMARY = "MDIO utility for AST2600"
|
||||
PR = "r1"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
RDEPENDS:${PN} += "bash"
|
||||
|
||||
SRC_URI += " \
|
||||
file://mdio-util \
|
||||
"
|
||||
S = "${WORKDIR}"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${sbindir}
|
||||
install -m 0755 ${S}/mdio-util ${D}${sbindir}/
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash -e
|
||||
#
|
||||
# Control step motor rotate of sled
|
||||
|
||||
# shellcheck source=meta-facebook/meta-bletchley/recipes-bletchley/plat-tools/files/bletchley-common-functions
|
||||
source /usr/libexec/bletchley-common-functions
|
||||
|
||||
#######################################
|
||||
# Setting step motor control pins to start/stop motor
|
||||
# Arguments:
|
||||
# 1. SLED NUMBER
|
||||
# 2. Value of STBY RESET PIN
|
||||
# 3. Value of ENABLE PIN
|
||||
# 4. Value of DIRECTION PIN
|
||||
# 5. Value of Motor Driver VREF PIN
|
||||
#######################################
|
||||
function set_motor() {
|
||||
STBY_PIN="SLED${1}_MD_STBY_RESET"
|
||||
EN_PIN="SLED${1}_MD_IOEXP_EN_FAULT"
|
||||
DIR_PIN="SLED${1}_MD_DIR"
|
||||
VREF_PIN="SLED${1}_MD_REF_PWM"
|
||||
set_gpio "$STBY_PIN" "$2"
|
||||
set_gpio "$EN_PIN" "$3"
|
||||
set_gpio "$DIR_PIN" "$4"
|
||||
set_gpio "$VREF_PIN" "$5"
|
||||
}
|
||||
|
||||
function show_usage(){
|
||||
echo "Usage: motor-ctrl [sled1 | sled2 | sled3 | sled4 | sled5 | sled6] [f r s]"
|
||||
echo " f : Step Motor go forward"
|
||||
echo " r : Step Motor go reverse"
|
||||
echo " s : Step Motor stop "
|
||||
}
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
show_usage
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [[ "$1" =~ ^(sled[1-6]{1})$ ]]; then
|
||||
SLED=$1
|
||||
SLED_NUM=${SLED:4}
|
||||
ACTION=$2
|
||||
else
|
||||
echo "invalid sled name: $1"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
#Check if sled is present
|
||||
if ! is_sled_present "${SLED_NUM}"; then
|
||||
echo "${SLED} is not present!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$ACTION" == "s" ]]; then
|
||||
echo "stop motor"
|
||||
set_motor "$SLED_NUM" 1 0 0 1
|
||||
elif [[ "$ACTION" == "f" ]];then
|
||||
echo "start motor, direction:forward"
|
||||
set_motor "$SLED_NUM" 1 1 0 0
|
||||
elif [[ "$ACTION" == "r" ]];then
|
||||
echo "start motor, direction:reverse"
|
||||
set_motor "$SLED_NUM" 1 1 1 0
|
||||
else
|
||||
echo "Error: Unknown action!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# Initialize for step motor of sled:
|
||||
# Enable pwm and setup pwm duty
|
||||
# Setup gpio pins for step motor control
|
||||
# Moving step motor back to initial position
|
||||
|
||||
export PATH=$PATH:/usr/libexec
|
||||
|
||||
# shellcheck source=meta-facebook/meta-bletchley/recipes-bletchley/plat-tools/files/bletchley-common-functions
|
||||
source /usr/libexec/bletchley-common-functions
|
||||
|
||||
PWM_CLASS_PATH="/sys/class/pwm/pwmchip0"
|
||||
#Sleld 1~6 using bmc pwm8~13 as motor driver stick
|
||||
PWM_NUM_OFFSET=7
|
||||
PWM_PERIOD=2500000 #400HZ
|
||||
PWM_DUTY=250000 #PWM_PERIOD X 10%
|
||||
CALIBRATE_TIMEOUT=120
|
||||
|
||||
#Enable pwm for sledN
|
||||
function open_pwm() {
|
||||
local SLED_NUM="$1"
|
||||
echo "Open pwm of sled$SLED_NUM"
|
||||
PWM_NUM=$(( SLED_NUM + PWM_NUM_OFFSET ))
|
||||
PWM_PATH="${PWM_CLASS_PATH}/pwm${PWM_NUM}"
|
||||
if [ ! -d "$PWM_PATH" ];then
|
||||
echo "$PWM_NUM" > "${PWM_CLASS_PATH}/export"
|
||||
fi
|
||||
if [ -d "$PWM_PATH" ];then
|
||||
echo "set pwm period to $PWM_PERIOD ns"
|
||||
if ! echo "$PWM_PERIOD" > "${PWM_PATH}/period"; then
|
||||
echo "Error: set pwm period fail"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! echo 1 > "${PWM_PATH}/enable"; then
|
||||
echo "Error: set pwm enable fail"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! echo "$PWM_DUTY" > "${PWM_PATH}/duty_cycle"; then
|
||||
echo "Error: set pwm duty_cycle fail"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
echo "Error: ${PWM_PATH} not exist, export pwm${PWM_NUM} fail"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
#Init gpio pins for step motor control
|
||||
function init_gpios() {
|
||||
echo "Init GPIOs:"
|
||||
motor_ctrl_gpio_pins_names=( "SLED${1}_MD_STBY_RESET"
|
||||
"SLED${1}_MD_IOEXP_EN_FAULT"
|
||||
"SLED${1}_MD_DIR"
|
||||
"SLED${1}_MD_DECAY"
|
||||
"SLED${1}_MD_MODE1"
|
||||
"SLED${1}_MD_MODE2"
|
||||
"SLED${1}_MD_MODE3" )
|
||||
|
||||
for gpio_name in "${motor_ctrl_gpio_pins_names[@]}"; do
|
||||
set_gpio "$gpio_name" 0
|
||||
done
|
||||
}
|
||||
|
||||
if [[ "$1" =~ ^(sled[1-6]{1})$ ]]; then
|
||||
SLED=$1
|
||||
SLED_NUM=${SLED:4}
|
||||
else
|
||||
#show_usage
|
||||
echo "invalid sled name: ${1}"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
#Check if sled is present
|
||||
if ! is_sled_present "${SLED_NUM}"; then
|
||||
echo "${SLED} is not present, skip motor initialize"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Init gpios
|
||||
init_gpios "$SLED_NUM"
|
||||
|
||||
#enable pwm
|
||||
open_pwm "$SLED_NUM"
|
||||
|
||||
#SLED{N}_MS_DETECT1 (initial position)
|
||||
DETECT_PIN1="SLED${SLED_NUM}_MS_DETECT1"
|
||||
INIT_POS=$(get_gpio "$DETECT_PIN1")
|
||||
|
||||
if [ "$INIT_POS" -eq 1 ];then
|
||||
echo "Making motor back to initial position..."
|
||||
motor-ctrl "$SLED" r >/dev/null
|
||||
wait_gpio_falling "$DETECT_PIN1" "$CALIBRATE_TIMEOUT"
|
||||
motor-ctrl "$SLED" s >/dev/null
|
||||
fi
|
||||
|
||||
INIT_POS=$(get_gpio "$DETECT_PIN1")
|
||||
if [ "$INIT_POS" -eq 0 ];then
|
||||
echo "Motor calibrated to initial position."
|
||||
exit 0
|
||||
else
|
||||
echo "Error: Step motor run over 1 cycle but switch never triggered"
|
||||
echo "Find motor initial position failed"
|
||||
exit 1
|
||||
fi
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
[Unit]
|
||||
Description=Motor Initialize for sled%i
|
||||
StartLimitIntervalSec=90
|
||||
StartLimitBurst=2
|
||||
Requires=phosphor-gpio-presence@presence-sled%i.service
|
||||
After=phosphor-gpio-presence@presence-sled%i.service
|
||||
Wants=mapper-wait@-xyz-openbmc_project-inventory-system-chassis-presence-presence_sled%i.service
|
||||
After=mapper-wait@-xyz-openbmc_project-inventory-system-chassis-presence-presence_sled%i.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/libexec/motor-init sled%i
|
||||
SyslogIdentifier=Motor Initialize sled%i
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStopPost=/usr/libexec/motor-ctrl sled%i s
|
||||
Restart=on-failure
|
||||
RestartSec=1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
+739
@@ -0,0 +1,739 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Power Control tool
|
||||
# Enable/disable AC relay
|
||||
# On/off System by step moter to press power key
|
||||
|
||||
export PATH=$PATH:/usr/sbin:/usr/libexec
|
||||
|
||||
# shellcheck source=meta-facebook/meta-bletchley/recipes-bletchley/plat-tools/files/bletchley-common-functions
|
||||
source /usr/libexec/bletchley-common-functions
|
||||
|
||||
DELAY_POWER_ON="0.5"
|
||||
DELAY_POWER_OFF="10"
|
||||
DELAY_POWER_RECOVERY_MODE="10"
|
||||
POWER_BTN_TIMEOUT_SEC=10
|
||||
|
||||
REV_EVT="EVT"
|
||||
REV_DVT="DVT"
|
||||
REV_UNKNOW="UNKNOW"
|
||||
|
||||
DBUS_HOST_ST_ON="xyz.openbmc_project.State.Host.HostState.Running"
|
||||
DBUS_HOST_ST_OFF="xyz.openbmc_project.State.Host.HostState.Off"
|
||||
|
||||
HOST_ST_UNKNOW="Unknow"
|
||||
HOST_ST_ON="On"
|
||||
HOST_ST_OFF="Off"
|
||||
HOST_ST_SLEEP="Sleep"
|
||||
HOST_ST_DFU="DFU"
|
||||
HOST_ST_RECOVERY="Recovery"
|
||||
HOST_AC_ON="AC On"
|
||||
HOST_AC_OFF="AC Off"
|
||||
|
||||
ACTION_ON="on"
|
||||
ACTION_OFF="off"
|
||||
ACTION_DFU="dfu"
|
||||
ACTION_RECOVERY="recovery"
|
||||
ACTION_CYCLE="cycle"
|
||||
ACTION_RESET="reset"
|
||||
ACTION_AC_ON="ac-on"
|
||||
ACTION_AC_OFF="ac-off"
|
||||
ACTION_STATUS="status"
|
||||
ACTION_BOOT_MODE="boot-from-bootmode"
|
||||
|
||||
VALID_SLED_ACTIONS="
|
||||
$ACTION_ON
|
||||
$ACTION_OFF
|
||||
$ACTION_AC_ON
|
||||
$ACTION_AC_OFF
|
||||
$ACTION_STATUS
|
||||
$ACTION_DFU
|
||||
$ACTION_RECOVERY
|
||||
$ACTION_CYCLE
|
||||
$ACTION_RESET
|
||||
$ACTION_BOOT_MODE
|
||||
"
|
||||
|
||||
BOOT_MODE_REGULAR="\"xyz.openbmc_project.Control.Boot.Mode.Modes.Regular\""
|
||||
BOOT_MODE_SAFE="\"xyz.openbmc_project.Control.Boot.Mode.Modes.Safe\""
|
||||
BOOT_MODE_SETUP="\"xyz.openbmc_project.Control.Boot.Mode.Modes.Setup\""
|
||||
|
||||
function is_valid_sled_action()
|
||||
{
|
||||
local ACTION=$1
|
||||
for i in $VALID_SLED_ACTIONS
|
||||
do
|
||||
if [ "$i" = "$ACTION" ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
function get_board_rev()
|
||||
{
|
||||
local rev_id0
|
||||
local rev_id1
|
||||
local rev_id2
|
||||
local rev_val
|
||||
|
||||
rev_id0=$(get_gpio "REV_ID0")
|
||||
rev_id1=$(get_gpio "REV_ID1")
|
||||
rev_id2=$(get_gpio "REV_ID2")
|
||||
rev_val=$((rev_id0+(rev_id1<<1)+(rev_id2<<2)))
|
||||
|
||||
case $rev_val in
|
||||
0)
|
||||
echo "$REV_EVT"
|
||||
;;
|
||||
1)
|
||||
echo "$REV_DVT"
|
||||
;;
|
||||
*)
|
||||
echo "$REV_UNKNOW"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function trigger_power_button()
|
||||
{
|
||||
local sled_num=$1
|
||||
local delay_time=$2
|
||||
|
||||
#SLED{N}_MS_DETECT1 (initial position)
|
||||
GPIO_DETECT_PIN1="SLED${sled_num}_MS_DETECT1"
|
||||
#SLED{N}_MS_DETECT0 (MAC position)
|
||||
GPIO_DETECT_PIN0="SLED${sled_num}_MS_DETECT0"
|
||||
|
||||
echo "Motor go forward to press Power key"
|
||||
motor-ctrl "sled${sled_num}" f >/dev/null
|
||||
wait_gpio_falling "${GPIO_DETECT_PIN0}" "$POWER_BTN_TIMEOUT_SEC"
|
||||
motor-ctrl "sled${sled_num}" s >/dev/null
|
||||
|
||||
if [ "$(get_gpio "$GPIO_DETECT_PIN0")" -eq 0 ];then
|
||||
echo "Power key switch triggered"
|
||||
echo "Press power key for Sled${1} ${delay_time} seconds..."
|
||||
sleep "$delay_time"
|
||||
else
|
||||
echo "Power key switch not trigger, back motor to initial position"
|
||||
fi
|
||||
|
||||
motor-ctrl "sled${sled_num}" r >/dev/null
|
||||
wait_gpio_falling "${GPIO_DETECT_PIN1}" "$POWER_BTN_TIMEOUT_SEC"
|
||||
motor-ctrl "sled${sled_num}" s >/dev/null
|
||||
if [ "$(get_gpio "$GPIO_DETECT_PIN1")" -eq 0 ];then
|
||||
echo "Motor reverse to initial position successful"
|
||||
else
|
||||
echo "Initial position switch not trigger, force stop motor"
|
||||
fi
|
||||
}
|
||||
|
||||
function release_power_button()
|
||||
{
|
||||
local sled_num=$1
|
||||
GPIO_DETECT_PIN1="SLED${sled_num}_MS_DETECT1"
|
||||
|
||||
if [ "$(get_gpio "$GPIO_DETECT_PIN1")" -eq 0 ]; then
|
||||
echo "Motor at initial position already"
|
||||
return 0
|
||||
fi
|
||||
|
||||
motor-ctrl "sled${sled_num}" r >/dev/null
|
||||
wait_gpio_falling "${GPIO_DETECT_PIN1}" "$POWER_BTN_TIMEOUT_SEC"
|
||||
motor-ctrl "sled${sled_num}" s >/dev/null
|
||||
if [ "$(get_gpio "$GPIO_DETECT_PIN1")" -eq 0 ];then
|
||||
echo "Motor reverse to initial position successful"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Error: Initial position switch not trigger"
|
||||
return 1
|
||||
}
|
||||
|
||||
function press_power_button()
|
||||
{
|
||||
local sled_num=$1
|
||||
|
||||
GPIO_DETECT_PIN0="SLED${sled_num}_MS_DETECT0"
|
||||
|
||||
echo "Motor go forward to press Power button"
|
||||
motor-ctrl "sled${sled_num}" f >/dev/null
|
||||
wait_gpio_falling "${GPIO_DETECT_PIN0}" "$POWER_BTN_TIMEOUT_SEC"
|
||||
motor-ctrl "sled${sled_num}" s >/dev/null
|
||||
|
||||
if [ "$(get_gpio "$GPIO_DETECT_PIN0")" -eq 0 ];then
|
||||
echo "Power button switch triggered"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Error: Power button switch not trigger"
|
||||
return 1
|
||||
}
|
||||
|
||||
#Get i2c bus number for sledN
|
||||
function get_bus_num()
|
||||
{
|
||||
SLED_NUM=$1
|
||||
local bus=0
|
||||
#Mapping Sled number 1~6 to i2c bus number 0~5
|
||||
if [[ "$SLED_NUM" = [1-6] ]]; then
|
||||
bus=$(( SLED_NUM - 1 ))
|
||||
fi
|
||||
echo "$bus"
|
||||
}
|
||||
|
||||
function get_ac_status()
|
||||
{
|
||||
i2c_bus=$(get_bus_num "$1")
|
||||
p1_output_reg=$(i2cget -f -y "$i2c_bus" 0x76 0x03)
|
||||
p1_config_reg=$(i2cget -f -y "$i2c_bus" 0x76 0x07)
|
||||
host_pwr="$(( (p1_output_reg & 0x80)>>7 ))"
|
||||
is_output="$(( (~p1_config_reg & 0x80)>>7 ))"
|
||||
|
||||
if [ "$(( host_pwr & is_output ))" -eq 1 ];then
|
||||
echo "$HOST_AC_ON"
|
||||
else
|
||||
echo "$HOST_AC_OFF"
|
||||
fi
|
||||
}
|
||||
|
||||
function get_host_status_dbus()
|
||||
{
|
||||
local sled_num=$1
|
||||
local object="/xyz/openbmc_project/state/host${sled_num}"
|
||||
local service="xyz.openbmc_project.State.Host${sled_num}"
|
||||
local interface="xyz.openbmc_project.State.Host"
|
||||
local property="CurrentHostState"
|
||||
local host_state
|
||||
|
||||
host_state=$(busctl get-property "$service" "$object" "$interface" "$property" | cut -d '"' -f2)
|
||||
|
||||
if [ "$host_state" = "$DBUS_HOST_ST_ON" ]; then
|
||||
echo "$HOST_ST_ON"
|
||||
elif [ "$host_state" = "$DBUS_HOST_ST_OFF" ]; then
|
||||
echo "$HOST_ST_OFF"
|
||||
else
|
||||
echo "$HOST_ST_UNKNOW"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function get_addr_from_dts_aliases()
|
||||
{
|
||||
local node_address
|
||||
node_address=$(awk -F '@' '{printf $2}' /sys/firmware/devicetree/base/aliases/"$1")
|
||||
echo "$node_address"
|
||||
}
|
||||
|
||||
function get_host_status_mdio()
|
||||
{
|
||||
local SLED_NUM=$1
|
||||
local MDIO_BUS
|
||||
|
||||
MDIO_BUS="$(get_addr_from_dts_aliases mdio0).mdio-1"
|
||||
|
||||
declare -a PORT_MAP=(0 3 2 1 7 6 5)
|
||||
|
||||
# check /dev/mem
|
||||
if ! create_dev_mem; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
local CHECK_CNT=0
|
||||
local MDIO_ERR_CNT=0
|
||||
local CUR_HOST_ST=$HOST_ST_UNKNOW
|
||||
local SLED_LAST_ACTION
|
||||
|
||||
if [ -f /tmp/sled"${SLED_NUM}"-last-action ]; then
|
||||
SLED_LAST_ACTION=$(cat /tmp/sled"${SLED_NUM}"-last-action)
|
||||
fi
|
||||
|
||||
while true
|
||||
do
|
||||
if POST_ST_VAL=$(mdio "$MDIO_BUS" phy "${PORT_MAP[SLED_NUM]}" 0); then
|
||||
if [ $((POST_ST_VAL&16#0800)) -eq $((16#0000)) ]; then
|
||||
case $SLED_LAST_ACTION in
|
||||
"$ACTION_DFU")
|
||||
TMP_HOST_ST="$HOST_ST_DFU"
|
||||
;;
|
||||
*)
|
||||
TMP_HOST_ST="$HOST_ST_OFF"
|
||||
;;
|
||||
esac
|
||||
elif [ $((POST_ST_VAL&16#0A00)) -eq $((16#0A00)) ]; then
|
||||
TMP_HOST_ST="$HOST_ST_ON"
|
||||
case $SLED_LAST_ACTION in
|
||||
"$ACTION_RECOVERY")
|
||||
TMP_HOST_ST="$HOST_ST_RECOVERY"
|
||||
;;
|
||||
*)
|
||||
TMP_HOST_ST="$HOST_ST_ON"
|
||||
;;
|
||||
esac
|
||||
elif [ $((POST_ST_VAL&16#0900)) -eq $((16#0900)) ]; then
|
||||
TMP_HOST_ST="$HOST_ST_SLEEP"
|
||||
else
|
||||
TMP_HOST_ST="$HOST_ST_UNKNOW"
|
||||
fi
|
||||
|
||||
if [ "$CUR_HOST_ST" == "$TMP_HOST_ST" ]; then
|
||||
CHECK_CNT=$((CHECK_CNT+1))
|
||||
else
|
||||
CUR_HOST_ST=$TMP_HOST_ST
|
||||
CHECK_CNT=0
|
||||
fi
|
||||
|
||||
if [ "$CHECK_CNT" -ge 5 ]; then
|
||||
echo "$CUR_HOST_ST"
|
||||
break
|
||||
fi
|
||||
else
|
||||
MDIO_ERR_CNT=$((MDIO_ERR_CNT+1))
|
||||
if [ "$MDIO_ERR_CNT" -ge 5 ]; then
|
||||
echo "$HOST_ST_UNKNOW"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function get_host_status()
|
||||
{
|
||||
local sled_num=$1
|
||||
|
||||
if [ "$(get_ac_status "$SLED_NUM")" == "$HOST_AC_OFF" ];then
|
||||
echo "$HOST_AC_OFF"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$(get_board_rev)" = "$REV_EVT" ]; then
|
||||
get_host_status_dbus "$sled_num"
|
||||
else
|
||||
get_host_status_mdio "$sled_num"
|
||||
fi
|
||||
return $?
|
||||
}
|
||||
|
||||
function get_host_bootmode()
|
||||
{
|
||||
local BUS_NAME="xyz.openbmc_project.Settings"
|
||||
local OBJ_PATH="/xyz/openbmc_project/control/host${1}/boot"
|
||||
local INTF_NAME="xyz.openbmc_project.Control.Boot.Mode"
|
||||
busctl get-property "${BUS_NAME}" "${OBJ_PATH}" "${INTF_NAME}" BootMode | awk '{print $2}'
|
||||
}
|
||||
|
||||
function do_action_reset()
|
||||
{
|
||||
# 1. Power off
|
||||
# 2. Power on
|
||||
|
||||
local SLED_NUM=$1
|
||||
local CUR_ST=$2
|
||||
|
||||
if [ "$CUR_ST" != "$HOST_ST_OFF" ]; then
|
||||
do_action_off "$SLED_NUM"
|
||||
else
|
||||
echo "sled${SLED_NUM}: already powered off"
|
||||
fi
|
||||
|
||||
sleep 3
|
||||
do_action_on "$SLED_NUM"
|
||||
}
|
||||
|
||||
function do_action_cycle()
|
||||
{
|
||||
# 1. AC off
|
||||
# 2. AC on
|
||||
# 3. Power on
|
||||
|
||||
local SLED_NUM=$1
|
||||
|
||||
do_action_ac_off "$SLED_NUM"
|
||||
sleep 3
|
||||
do_action_ac_on "$SLED_NUM"
|
||||
sleep 3
|
||||
do_action_on "$SLED_NUM"
|
||||
}
|
||||
|
||||
function do_action_ac_on()
|
||||
{
|
||||
local SLED_NUM=$1
|
||||
echo "sled${SLED_NUM}: turn on AC"
|
||||
set_gpio "power-host${SLED_NUM}" 1
|
||||
echo "$ACTION_AC_ON" > "/tmp/sled${SLED_NUM}-last-action"
|
||||
}
|
||||
|
||||
function do_action_ac_off()
|
||||
{
|
||||
local SLED_NUM=$1
|
||||
echo "sled${SLED_NUM}: turn off AC"
|
||||
set_gpio "power-host${SLED_NUM}" 0
|
||||
echo "$ACTION_AC_OFF" > "/tmp/sled${SLED_NUM}-last-action"
|
||||
}
|
||||
|
||||
function do_action_on()
|
||||
{
|
||||
local SLED_NUM=$1
|
||||
echo "sled${SLED_NUM}: power on host"
|
||||
trigger_power_button "$SLED_NUM" "$DELAY_POWER_ON"
|
||||
sleep 10 # Mac mini need about 10 second to stable link status
|
||||
echo "$ACTION_ON" > "/tmp/sled${SLED_NUM}-last-action"
|
||||
}
|
||||
|
||||
function do_action_off()
|
||||
{
|
||||
local SLED_NUM=$1
|
||||
echo "sled${SLED_NUM}: power off host"
|
||||
trigger_power_button "$SLED_NUM" "$DELAY_POWER_OFF"
|
||||
echo "$ACTION_OFF" > "/tmp/sled${SLED_NUM}-last-action"
|
||||
}
|
||||
|
||||
function do_action_recovery()
|
||||
{
|
||||
local SLED_NUM=$1
|
||||
echo "sled${SLED_NUM}: trigger host recovery mode"
|
||||
trigger_power_button "$SLED_NUM" "$DELAY_POWER_RECOVERY_MODE"
|
||||
echo "$ACTION_RECOVERY" > "/tmp/sled${SLED_NUM}-last-action"
|
||||
}
|
||||
|
||||
function do_action_dfu()
|
||||
{
|
||||
local SLED_NUM=$1
|
||||
echo "sled${SLED_NUM}: trigger host dfu mode"
|
||||
|
||||
# turn ac off, and hold for 25 seconds
|
||||
do_action_ac_off "$SLED_NUM"
|
||||
sleep 25
|
||||
|
||||
# press power button
|
||||
echo "SLED$SLED_NUM: pressing power button"
|
||||
if ! press_power_button "$SLED_NUM"; then
|
||||
echo "SLED$SLED_NUM: press power button failed"
|
||||
echo "SLED$SLED_NUM: releasing power button"
|
||||
release_power_button "$SLED_NUM"
|
||||
return 1
|
||||
fi
|
||||
sleep 1
|
||||
|
||||
# turn ac on
|
||||
echo "SLED$SLED_NUM: turn ac-on"
|
||||
do_action_ac_on "$SLED_NUM"
|
||||
sleep 3
|
||||
|
||||
# release power button
|
||||
echo "SLED$SLED_NUM: releasing host power button"
|
||||
if ! release_power_button "$SLED_NUM"; then
|
||||
echo "SLED$SLED_NUM: release power button failed"
|
||||
return 1
|
||||
fi
|
||||
echo "$ACTION_DFU" > "/tmp/sled${SLED_NUM}-last-action"
|
||||
}
|
||||
|
||||
function host_state_on_action_handler()
|
||||
{
|
||||
local SLED_NUM=$1
|
||||
local ACTION=$2
|
||||
|
||||
case $ACTION in
|
||||
"$ACTION_OFF")
|
||||
do_action_off "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_AC_OFF")
|
||||
do_action_ac_off "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_RESET")
|
||||
do_action_reset "$SLED_NUM" "$HOST_ST_ON"
|
||||
;;
|
||||
"$ACTION_CYCLE")
|
||||
do_action_cycle "$SLED_NUM"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid action ($ACTION) for current host state (On)"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function host_state_sleep_action_handler()
|
||||
{
|
||||
local SLED_NUM=$1
|
||||
local ACTION=$2
|
||||
|
||||
case $ACTION in
|
||||
"$ACTION_ON")
|
||||
do_action_on "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_OFF")
|
||||
do_action_off "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_AC_OFF")
|
||||
do_action_ac_off "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_RESET")
|
||||
do_action_reset "$SLED_NUM" "$HOST_ST_ON"
|
||||
;;
|
||||
"$ACTION_CYCLE")
|
||||
do_action_cycle "$SLED_NUM"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid action ($ACTION) for current host state (Sleep)"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function host_state_off_action_handler()
|
||||
{
|
||||
local SLED_NUM=$1
|
||||
local ACTION=$2
|
||||
|
||||
case $ACTION in
|
||||
"$ACTION_ON")
|
||||
do_action_on "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_RECOVERY")
|
||||
do_action_recovery "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_DFU")
|
||||
do_action_dfu "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_AC_OFF")
|
||||
do_action_ac_off "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_RESET")
|
||||
do_action_reset "$SLED_NUM" "$HOST_ST_ON"
|
||||
;;
|
||||
"$ACTION_CYCLE")
|
||||
do_action_cycle "$SLED_NUM"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid action ($ACTION) for current host state (Off)"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function host_state_ac_off_action_handler()
|
||||
{
|
||||
local SLED_NUM=$1
|
||||
local ACTION=$2
|
||||
|
||||
case $ACTION in
|
||||
"$ACTION_AC_ON")
|
||||
do_action_ac_on "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_DFU")
|
||||
do_action_dfu "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_AC_OFF")
|
||||
echo "sled${SLED_NUM}: already ac off"
|
||||
return 1
|
||||
;;
|
||||
"$ACTION_CYCLE")
|
||||
do_action_reset "$SLED_NUM"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid action ($ACTION) for current host state (AC Off)"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function host_state_ac_on_action_handler()
|
||||
{
|
||||
local SLED_NUM=$1
|
||||
local ACTION=$2
|
||||
|
||||
case $ACTION in
|
||||
"$ACTION_AC_OFF")
|
||||
do_action_ac_off "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_DFU")
|
||||
do_action_dfu "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_CYCLE")
|
||||
do_action_cycle "$SLED_NUM"
|
||||
;;
|
||||
*)
|
||||
echo "sled${SLED_NUM}: already ac on"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function host_state_recovery_action_handler()
|
||||
{
|
||||
local SLED_NUM=$1
|
||||
local ACTION=$2
|
||||
|
||||
case $ACTION in
|
||||
"$ACTION_OFF")
|
||||
do_action_off "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_AC_OFF")
|
||||
do_action_ac_off "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_RESET")
|
||||
do_action_reset "$SLED_NUM" "$HOST_ST_ON"
|
||||
;;
|
||||
"$ACTION_CYCLE")
|
||||
do_action_cycle "$SLED_NUM"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid action ($ACTION) for current host state (Recovery)"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function host_state_dfu_action_handler()
|
||||
{
|
||||
local SLED_NUM=$1
|
||||
local ACTION=$2
|
||||
|
||||
case $ACTION in
|
||||
"$ACTION_AC_OFF")
|
||||
do_action_ac_off "$SLED_NUM"
|
||||
;;
|
||||
"$ACTION_CYCLE")
|
||||
do_action_cycle "$SLED_NUM"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid action ($ACTION) for current host state (DFU)"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function create_dev_mem()
|
||||
{
|
||||
CHECK_CNT=0
|
||||
while true
|
||||
do
|
||||
CHECK_CNT=$((CHECK_CNT+1))
|
||||
if [ -c /dev/mem ]; then
|
||||
# /dev/mem already exist
|
||||
return 0
|
||||
elif mknod /dev/mem c 1 1; then
|
||||
# mknod success
|
||||
return 0
|
||||
elif [ "$CHECK_CNT" -ge 5 ]; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "create /dev/mem failed"
|
||||
return 1
|
||||
}
|
||||
|
||||
function show_usage(){
|
||||
echo "Usage: power-ctrl [sled1 | sled2 | sled3 | sled4 | sled5 | sled6] [$VALID_SLED_ACTIONS]"
|
||||
echo " power-ctrl chassis-cycle"
|
||||
}
|
||||
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
if [ "$1" = "chassis-cycle" ];then
|
||||
echo "chassis cycle...."
|
||||
i2cset -y -f 12 0x11 0xd9 c
|
||||
exit 0
|
||||
else
|
||||
echo "Invalid argument: [ $1 ]"
|
||||
show_usage
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $# -gt 2 ]; then
|
||||
echo "Too many arguments"
|
||||
show_usage
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [[ "$1" =~ ^(sled[1-6]{1})$ ]]; then
|
||||
SLED=$1
|
||||
ACTION=$2
|
||||
SLED_NUM=${SLED:4}
|
||||
else
|
||||
echo "invalid sled name: ${1}"
|
||||
show_usage
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
#Check if sled is present
|
||||
if ! is_sled_present "${SLED_NUM}"; then
|
||||
echo "${SLED} is not present!"
|
||||
exit 1
|
||||
elif ! is_valid_sled_action "$ACTION"; then
|
||||
echo "Unknown action: $ACTION"
|
||||
show_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$ACTION" = "$ACTION_AC_ON" ]; then
|
||||
if [ "$(get_ac_status "$SLED_NUM")" = "$HOST_AC_OFF" ]; then
|
||||
do_action_ac_on "$SLED_NUM"
|
||||
fi
|
||||
elif [ "$ACTION" = "$ACTION_AC_OFF" ]; then
|
||||
if [ "$(get_ac_status "$SLED_NUM")" != "$HOST_AC_OFF" ]; then
|
||||
do_action_ac_off "$SLED_NUM"
|
||||
fi
|
||||
elif [ "$ACTION" = "$ACTION_STATUS" ];then
|
||||
HOST_CURR_STATUS=$(get_host_status "$SLED_NUM")
|
||||
echo "$HOST_CURR_STATUS"
|
||||
else
|
||||
HOST_CURR_STATUS=$(get_host_status "$SLED_NUM")
|
||||
|
||||
if [ "$ACTION" = "$ACTION_BOOT_MODE" ]; then
|
||||
BOOT_MODE=$(get_host_bootmode "$SLED_NUM")
|
||||
case "$BOOT_MODE" in
|
||||
"$BOOT_MODE_REGULAR")
|
||||
echo "Boot mode: on (regular)"
|
||||
ACTION="$ACTION_ON"
|
||||
;;
|
||||
"$BOOT_MODE_SAFE")
|
||||
echo "Boot mode: recovery (safe)"
|
||||
ACTION="$ACTION_RECOVERY"
|
||||
;;
|
||||
"$BOOT_MODE_SETUP")
|
||||
echo "Boot mode: dfu (setup)"
|
||||
ACTION="$ACTION_DFU"
|
||||
;;
|
||||
*)
|
||||
echo "Boot mode: unknow"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case $HOST_CURR_STATUS in
|
||||
"$HOST_AC_OFF")
|
||||
host_state_ac_off_action_handler "$SLED_NUM" "$ACTION"
|
||||
;;
|
||||
"$HOST_AC_ON")
|
||||
host_state_ac_on_action_handler "$SLED_NUM" "$ACTION"
|
||||
;;
|
||||
"$HOST_ST_OFF")
|
||||
host_state_off_action_handler "$SLED_NUM" "$ACTION"
|
||||
;;
|
||||
"$HOST_ST_ON")
|
||||
host_state_on_action_handler "$SLED_NUM" "$ACTION"
|
||||
;;
|
||||
"$HOST_ST_SLEEP")
|
||||
host_state_sleep_action_handler "$SLED_NUM" "$ACTION"
|
||||
;;
|
||||
"$HOST_ST_DFU")
|
||||
host_state_dfu_action_handler "$SLED_NUM" "$ACTION"
|
||||
;;
|
||||
"$HOST_ST_RECOVERY")
|
||||
host_state_recovery_action_handler "$SLED_NUM" "$ACTION"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
@@ -0,0 +1,33 @@
|
||||
SUMMARY = "Bletchley Motor control"
|
||||
PR = "r1"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
inherit obmc-phosphor-systemd
|
||||
|
||||
RDEPENDS:${PN} += "bash"
|
||||
RDEPENDS:${PN} += "i2c-tools"
|
||||
RDEPENDS:${PN} += "libgpiod-tools"
|
||||
RDEPENDS:${PN} += "mdio-tools"
|
||||
RDEPENDS:${PN} += "bletchley-common-functions"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
SRC_URI += " \
|
||||
file://motor-ctrl \
|
||||
file://motor-init \
|
||||
file://power-ctrl \
|
||||
"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${sbindir}
|
||||
install -m 0755 ${WORKDIR}/power-ctrl ${D}${sbindir}
|
||||
|
||||
install -d ${D}${libexecdir}
|
||||
install -m 0755 ${WORKDIR}/motor-ctrl ${D}${libexecdir}
|
||||
install -m 0755 ${WORKDIR}/motor-init ${D}${libexecdir}
|
||||
}
|
||||
|
||||
TGT = "${SYSTEMD_DEFAULT_TARGET}"
|
||||
MOTOR_INIT_INSTFMT="../motor-init-calibration@.service:${TGT}.wants/motor-init-calibration@{0}.service"
|
||||
SYSTEMD_SERVICE:${PN} += "motor-init-calibration@.service"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list(d, 'MOTOR_INIT_INSTFMT', 'OBMC_HOST_INSTANCES')}"
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# shellcheck source=meta-facebook/meta-bletchley/recipes-bletchley/plat-tools/files/bletchley-common-functions
|
||||
source /usr/libexec/bletchley-common-functions
|
||||
|
||||
# set initial value for GPIO output pins
|
||||
set_gpio SEL_SPI2_MUX 1
|
||||
set_gpio SPI2_MUX1 1
|
||||
set_gpio SPI2_MUX2 1
|
||||
set_gpio SPI2_MUX3 1
|
||||
set_gpio SWITCH_FRU_MUX 1
|
||||
set_gpio BAT_DETECT 1
|
||||
set_gpio BMC_BT_WP0_N 1
|
||||
set_gpio BMC_BT_WP1_N 1
|
||||
set_gpio USB2_SEL0_A 1
|
||||
set_gpio USB2_SEL1_A 1
|
||||
set_gpio USB2_SEL0_B 1
|
||||
set_gpio USB2_SEL1_B 1
|
||||
set_gpio RST_FRONT_IOEXP_N 1
|
||||
set_gpio BSM_FLASH_LATCH_N 1
|
||||
|
||||
# set initial duty value for each fan
|
||||
set_fan 0 70
|
||||
set_fan 1 70
|
||||
set_fan 2 70
|
||||
set_fan 3 70
|
||||
|
||||
exit 0;
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
#!/bin/bash
|
||||
|
||||
export PATH=$PATH:/usr/sbin:/usr/libexec
|
||||
|
||||
# shellcheck source=meta-facebook/meta-bletchley/recipes-bletchley/plat-tools/files/bletchley-common-functions
|
||||
source /usr/libexec/bletchley-common-functions
|
||||
|
||||
MDIO_TOOL="/usr/sbin/mdio"
|
||||
SWITCH_MDIO_BUS="1e650000.mdio-1"
|
||||
|
||||
declare -a PORT_NUM_MAP=(10 3 2 1 7 6 5)
|
||||
|
||||
declare -a HOST_PREVIOUS_STATE=("" "" "" "" "" "" "")
|
||||
declare -a HOST_STATE_CHANGE_CHECK=(0 0 0 0 0 0 0)
|
||||
HOST_STATE_CHANGE_CHECH_CNT=5
|
||||
|
||||
declare -A HOST_ACPI_ST_MAP
|
||||
HOST_ACPI_ST_MAP["UNKNOW"]="Unknow"
|
||||
HOST_ACPI_ST_MAP["NOT_PRESENT"]="G3"
|
||||
HOST_ACPI_ST_MAP["AC_OFF"]="G3"
|
||||
HOST_ACPI_ST_MAP["OFF"]="G3"
|
||||
HOST_ACPI_ST_MAP["SLEEP"]="SLEEP"
|
||||
HOST_ACPI_ST_MAP["ON"]="S0_G0_D0"
|
||||
|
||||
declare -A HOST_STATE_MAP
|
||||
HOST_STATE_MAP["UNKNOW"]="Quiesced"
|
||||
HOST_STATE_MAP["NOT_PRESENT"]="Off"
|
||||
HOST_STATE_MAP["AC_OFF"]="Off"
|
||||
HOST_STATE_MAP["OFF"]="Off"
|
||||
HOST_STATE_MAP["SLEEP"]="Standby"
|
||||
HOST_STATE_MAP["ON"]="Running"
|
||||
|
||||
declare -A CHASSIS_PWR_STATE_MAP
|
||||
CHASSIS_PWR_STATE_MAP["UNKNOW"]="On"
|
||||
CHASSIS_PWR_STATE_MAP["NOT_PRESENT"]="Off"
|
||||
CHASSIS_PWR_STATE_MAP["AC_OFF"]="Off"
|
||||
CHASSIS_PWR_STATE_MAP["OFF"]="On"
|
||||
CHASSIS_PWR_STATE_MAP["SLEEP"]="On"
|
||||
CHASSIS_PWR_STATE_MAP["ON"]="On"
|
||||
|
||||
is_host_ac_on()
|
||||
{
|
||||
local HOST_ID=$1
|
||||
local I2C_BUS
|
||||
local P1_OUTPUT_REG
|
||||
local P1_CONFIG_REG
|
||||
local HOST_PWR
|
||||
local IS_OUTPUT
|
||||
|
||||
I2C_BUS=$((HOST_ID-1))
|
||||
P1_OUTPUT_REG=$(i2cget -f -y "$I2C_BUS" 0x76 0x03)
|
||||
P1_CONFIG_REG=$(i2cget -f -y "$I2C_BUS" 0x76 0x07)
|
||||
HOST_PWR="$(( (P1_OUTPUT_REG & 0x80)>>7 ))"
|
||||
IS_OUTPUT="$(( (~P1_CONFIG_REG & 0x80)>>7 ))"
|
||||
|
||||
if [ "$((HOST_PWR & IS_OUTPUT))" -eq 1 ];then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
update_host_acpi_power_state()
|
||||
{
|
||||
local BUS_NAME="xyz.openbmc_project.Settings"
|
||||
local OBJ_PATH="/xyz/openbmc_project/control/host$1/acpi_power_state"
|
||||
local DBUS_PROPERTIES_INTF_NAME="org.freedesktop.DBus.Properties"
|
||||
local INTF_NAME="xyz.openbmc_project.Control.Power.ACPIPowerState"
|
||||
local PROPERTY_NAME="SysACPIStatus"
|
||||
local PROPERTY_VAL="xyz.openbmc_project.Control.Power.ACPIPowerState.ACPI.$2"
|
||||
busctl call "$BUS_NAME" "$OBJ_PATH" "$DBUS_PROPERTIES_INTF_NAME" Set ssv "$INTF_NAME" "$PROPERTY_NAME" s "$PROPERTY_VAL"
|
||||
}
|
||||
|
||||
update_host_state()
|
||||
{
|
||||
local BUS_NAME="xyz.openbmc_project.State.Host$1"
|
||||
local OBJ_PATH="/xyz/openbmc_project/state/host$1"
|
||||
local DBUS_PROPERTIES_INTF_NAME="org.freedesktop.DBus.Properties"
|
||||
local INTF_NAME="xyz.openbmc_project.State.Host"
|
||||
local PROPERTY_NAME="CurrentHostState"
|
||||
local PROPERTY_VAL="xyz.openbmc_project.State.Host.HostState.$2"
|
||||
busctl call "$BUS_NAME" "$OBJ_PATH" "$DBUS_PROPERTIES_INTF_NAME" Set ssv "$INTF_NAME" "$PROPERTY_NAME" s "$PROPERTY_VAL"
|
||||
}
|
||||
|
||||
update_chassis_power_state()
|
||||
{
|
||||
local BUS_NAME="xyz.openbmc_project.State.Chassis$1"
|
||||
local OBJ_PATH="/xyz/openbmc_project/state/chassis$1"
|
||||
local DBUS_PROPERTIES_INTF_NAME="org.freedesktop.DBus.Properties"
|
||||
local INTF_NAME="xyz.openbmc_project.State.Chassis"
|
||||
local PROPERTY_NAME="CurrentPowerState"
|
||||
local PROPERTY_VAL="xyz.openbmc_project.State.Chassis.PowerState.$2"
|
||||
busctl call "$BUS_NAME" "$OBJ_PATH" "$DBUS_PROPERTIES_INTF_NAME" Set ssv "$INTF_NAME" "$PROPERTY_NAME" s "$PROPERTY_VAL"
|
||||
}
|
||||
|
||||
update_sled_led_state()
|
||||
{
|
||||
local HOST_ID=$1
|
||||
local HOST_STATE=$2
|
||||
case "$HOST_STATE" in
|
||||
ON|SLEEP)
|
||||
systemctl start obmc-led-group-start@sled"$i"_good.service
|
||||
;;
|
||||
AC_OFF|OFF)
|
||||
systemctl start obmc-led-group-stop@sled"$i"_good.service
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
check_host_state()
|
||||
{
|
||||
if ! PORT_ST_VAL=$("$MDIO_TOOL" "$SWITCH_MDIO_BUS" phy "${PORT_NUM_MAP[$1]}" 0x00); then
|
||||
# failed to get port status via mdio
|
||||
echo "UNKNOW"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $((PORT_ST_VAL&16#0800)) -eq $((16#0000)) ]; then
|
||||
echo "OFF"
|
||||
elif [ $((PORT_ST_VAL&16#0A00)) -eq $((16#0A00)) ]; then
|
||||
echo "ON"
|
||||
elif [ $((PORT_ST_VAL&16#0900)) -eq $((16#0900)) ]; then
|
||||
echo "SLEEP"
|
||||
else
|
||||
echo "UNKNOW"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
while true
|
||||
do
|
||||
for i in {1..6}
|
||||
do
|
||||
HOST_STATE=""
|
||||
if ! is_sled_present "$i"; then
|
||||
HOST_STATE="NOT_PRESENT"
|
||||
elif ! is_host_ac_on "$i"; then
|
||||
HOST_STATE="AC_OFF"
|
||||
else
|
||||
HOST_STATE=$(check_host_state "$i")
|
||||
fi
|
||||
|
||||
if [ "$HOST_STATE" = "${HOST_PREVIOUS_STATE[$i]}" ]; then
|
||||
HOST_STATE_CHANGE_CHECK[i]="$HOST_STATE_CHANGE_CHECH_CNT"
|
||||
elif [ "${HOST_STATE_CHANGE_CHECK[$i]}" -gt "0" ]; then
|
||||
echo "SLED$i: detected state changed (previous:${HOST_PREVIOUS_STATE[$i]}, current:$HOST_STATE), check count: ${HOST_STATE_CHANGE_CHECK[$i]}"
|
||||
HOST_STATE_CHANGE_CHECK[i]=$((HOST_STATE_CHANGE_CHECK[i]-1))
|
||||
else
|
||||
echo "SLED$i: detected state changed, update host state to $HOST_STATE"
|
||||
update_host_acpi_power_state "$i" "${HOST_ACPI_ST_MAP[$HOST_STATE]}"
|
||||
update_host_state "$i" "${HOST_STATE_MAP[$HOST_STATE]}"
|
||||
update_chassis_power_state "$i" "${CHASSIS_PWR_STATE_MAP[$HOST_STATE]}"
|
||||
update_sled_led_state "$i" "$HOST_STATE"
|
||||
HOST_STATE_CHANGE_CHECK[i]="$HOST_STATE_CHANGE_CHECH_CNT"
|
||||
HOST_PREVIOUS_STATE[i]="$HOST_STATE"
|
||||
fi
|
||||
done
|
||||
sleep 1
|
||||
done
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
[Unit]
|
||||
Description=Bletchley host state monitoring
|
||||
Wants=xyz.openbmc_project.State.Chassis@1.service
|
||||
After=xyz.openbmc_project.State.Chassis@1.service
|
||||
Wants=xyz.openbmc_project.State.Chassis@2.service
|
||||
After=xyz.openbmc_project.State.Chassis@2.service
|
||||
Wants=xyz.openbmc_project.State.Chassis@3.service
|
||||
After=xyz.openbmc_project.State.Chassis@3.service
|
||||
Wants=xyz.openbmc_project.State.Chassis@4.service
|
||||
After=xyz.openbmc_project.State.Chassis@4.service
|
||||
Wants=xyz.openbmc_project.State.Chassis@5.service
|
||||
After=xyz.openbmc_project.State.Chassis@5.service
|
||||
Wants=xyz.openbmc_project.State.Chassis@6.service
|
||||
After=xyz.openbmc_project.State.Chassis@6.service
|
||||
Wants=xyz.openbmc_project.State.Host@1.service
|
||||
After=xyz.openbmc_project.State.Host@1.service
|
||||
Wants=xyz.openbmc_project.State.Host@2.service
|
||||
After=xyz.openbmc_project.State.Host@2.service
|
||||
Wants=xyz.openbmc_project.State.Host@3.service
|
||||
After=xyz.openbmc_project.State.Host@3.service
|
||||
Wants=xyz.openbmc_project.State.Host@4.service
|
||||
After=xyz.openbmc_project.State.Host@4.service
|
||||
Wants=xyz.openbmc_project.State.Host@5.service
|
||||
After=xyz.openbmc_project.State.Host@5.service
|
||||
Wants=xyz.openbmc_project.State.Host@6.service
|
||||
After=xyz.openbmc_project.State.Host@6.service
|
||||
Wants=xyz.openbmc_project.Settings.service
|
||||
After=xyz.openbmc_project.Settings.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/libexec/bletchley-host-state-monitor
|
||||
SyslogIdentifier=bletchley-host-state-monitor
|
||||
Type=simple
|
||||
Restart=on-failure
|
||||
RestartSec=1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Wants=xyz.openbmc_project.LED.GroupManager.service
|
||||
After=xyz.openbmc_project.LED.GroupManager.service
|
||||
Wants=obmc-led-group-start@fan0_good.service
|
||||
After=obmc-led-group-start@fan0_good.service
|
||||
Wants=obmc-led-group-start@fan1_good.service
|
||||
After=obmc-led-group-start@fan1_good.service
|
||||
Wants=obmc-led-group-start@fan2_good.service
|
||||
After=obmc-led-group-start@fan2_good.service
|
||||
Wants=obmc-led-group-start@fan3_good.service
|
||||
After=obmc-led-group-start@fan3_good.service
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Bletchley Early System Init
|
||||
Before=phosphor-pid-control.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/bletchley-early-sys-init
|
||||
SyslogIdentifier=Bletchley Early Init
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,30 @@
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
inherit allarch systemd obmc-phosphor-systemd
|
||||
|
||||
RDEPENDS:${PN} += "bash"
|
||||
RDEPENDS:${PN} += "libgpiod-tools"
|
||||
RDEPENDS:${PN} += "bletchley-common-functions"
|
||||
RDEPENDS:${PN} += "mdio-tools"
|
||||
|
||||
SRC_URI += " \
|
||||
file://bletchley-early-sys-init \
|
||||
file://bletchley-sys-init.service \
|
||||
file://bletchley-host-state-monitor \
|
||||
file://bletchley-host-state-monitor.service \
|
||||
"
|
||||
|
||||
SYSTEMD_PACKAGES = "${PN}"
|
||||
SYSTEMD_SERVICE:${PN}:append = " \
|
||||
bletchley-sys-init.service \
|
||||
bletchley-host-state-monitor.service \
|
||||
"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${libexecdir}
|
||||
install -m 0755 ${WORKDIR}/bletchley-early-sys-init ${D}${libexecdir}
|
||||
install -m 0755 ${WORKDIR}/bletchley-host-state-monitor ${D}${libexecdir}
|
||||
}
|
||||
|
||||
SYSTEMD_OVERRIDE:${PN}:bletchley += "bletchley-sys-init.conf:bletchley-sys-init.service.d/bletchley-sys-init.conf"
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
RDEPENDS:${PN} += " bash libgpiod-tools"
|
||||
|
||||
SRC_URI += " \
|
||||
file://bletchley-common-functions \
|
||||
"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${libexecdir}
|
||||
install -m 0755 ${WORKDIR}/bletchley-common-functions ${D}${libexecdir}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
inherit obmc-phosphor-systemd
|
||||
|
||||
RDEPENDS:${PN} += " bash motor-ctrl"
|
||||
RDEPENDS:${PN} += " mdio-tools"
|
||||
|
||||
SRC_URI += " \
|
||||
file://bletchley-system-state-init \
|
||||
file://bletchley-system-state-init@.service \
|
||||
file://bletchley-usbmux-util \
|
||||
file://bletchley-net-util \
|
||||
"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${libexecdir}
|
||||
install -m 0755 ${WORKDIR}/bletchley-system-state-init ${D}${libexecdir}
|
||||
|
||||
install -d ${D}${bindir}
|
||||
install -m 0755 ${WORKDIR}/bletchley-usbmux-util ${D}${bindir}
|
||||
install -m 0755 ${WORKDIR}/bletchley-net-util ${D}${bindir}
|
||||
}
|
||||
|
||||
|
||||
TGT = "${SYSTEMD_DEFAULT_TARGET}"
|
||||
BLETCHLEY_SYS_ST_INIT_INSTFMT="../bletchley-system-state-init@.service:${TGT}.wants/bletchley-system-state-init@{0}.service"
|
||||
|
||||
SYSTEMD_SERVICE:${PN} += "bletchley-system-state-init@.service"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list(d, 'BLETCHLEY_SYS_ST_INIT_INSTFMT', 'OBMC_HOST_INSTANCES')}"
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
#!/bin/bash
|
||||
|
||||
get_gpio()
|
||||
{
|
||||
local NET_NAME=$1
|
||||
local RET_VAL
|
||||
|
||||
mapfile -t -d " " GPIO_INFO < <(gpiofind "$NET_NAME")
|
||||
if [ "${#GPIO_INFO[@]}" -ne 2 ]; then
|
||||
echo "get_gpio: can not find gpio, $NET_NAME" >&2
|
||||
return 1
|
||||
fi
|
||||
if ! RET_VAL=$(gpioget "${GPIO_INFO[0]}" "${GPIO_INFO[1]%$'\n'}") ; then
|
||||
echo "get_gpio: get ${NET_NAME} failed" >&2
|
||||
return 1
|
||||
fi
|
||||
echo "${RET_VAL}"
|
||||
return 0
|
||||
}
|
||||
|
||||
set_gpio()
|
||||
{
|
||||
local NET_NAME=$1
|
||||
local OUT_VAL=$2
|
||||
mapfile -t -d " " GPIO_INFO < <(gpiofind "$NET_NAME")
|
||||
if [ "${#GPIO_INFO[@]}" -ne 2 ]; then
|
||||
echo "set_gpio: can not find gpio, $NET_NAME"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -n "set_gpio: set $NET_NAME = $OUT_VAL"
|
||||
if ! gpioset "${GPIO_INFO[0]}" "${GPIO_INFO[1]%$'\n'}"="$OUT_VAL"; then
|
||||
echo " failed"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo " success"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_gpio_falling()
|
||||
{
|
||||
local NET_NAME=$1
|
||||
local TIMEOUT_SEC=$2
|
||||
|
||||
mapfile -t -d " " GPIO_INFO < <(gpiofind "$NET_NAME")
|
||||
if [ "${#GPIO_INFO[@]}" -ne 2 ]; then
|
||||
echo "wait_gpio_falling: can not find gpio, $NET_NAME"
|
||||
return 1
|
||||
fi
|
||||
|
||||
timeout "$TIMEOUT_SEC" gpiomon --silent --falling-edge --num-events=1 "${GPIO_INFO[0]}" "${GPIO_INFO[1]%$'\n'}"
|
||||
}
|
||||
|
||||
set_fan()
|
||||
{
|
||||
FAN_ID=$1
|
||||
FAN_DUTY=$2
|
||||
SYSFA_PWM_PATH=""
|
||||
|
||||
for file in /sys/devices/platform/pwm-fan"$FAN_ID"/hwmon/hwmon*/pwm1
|
||||
do
|
||||
if [ -e "$file" ]; then
|
||||
SYSFA_PWM_PATH="$file"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$SYSFA_PWM_PATH" ]; then
|
||||
echo "set_fan: pwm file not found, chekc fan id ($FAN_ID)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$FAN_DUTY" -lt 0 ] || [ "$FAN_DUTY" -gt 100 ]; then
|
||||
echo "set_fan: incorrect fan duty, $FAN_DUTY"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# convert duty (0-100) to pwm value (0-255)
|
||||
PWM_VAL=$(printf "%.0f" $((FAN_DUTY*255/100)))
|
||||
|
||||
echo -n "set_fan: set fan$FAN_ID = $FAN_DUTY"
|
||||
if ! echo "$PWM_VAL" > "$SYSFA_PWM_PATH"; then
|
||||
echo " failed"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo " success"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
is_sled_present()
|
||||
{
|
||||
local SLED_ID=$1
|
||||
local SRV_NAME="xyz.openbmc_project.Inventory.Manager"
|
||||
local OBJ_PATH="/xyz/openbmc_project/inventory/system/chassis/presence/presence_sled${SLED_ID}"
|
||||
local INTF_NAME="xyz.openbmc_project.Inventory.Item"
|
||||
local PRST_VAL
|
||||
|
||||
PRST_VAL=$(busctl get-property "${SRV_NAME}" "${OBJ_PATH}" "${INTF_NAME}" Present | awk '{print $2}')
|
||||
if [ "$PRST_VAL" != "true" ]; then
|
||||
# not present
|
||||
return 1
|
||||
fi
|
||||
|
||||
# present
|
||||
return 0
|
||||
}
|
||||
|
||||
spi2_mux_select()
|
||||
{
|
||||
local SLED_INDEX="$1"
|
||||
if [ "$SLED_INDEX" = "0" ]; then
|
||||
set_gpio SEL_SPI2_MUX 1
|
||||
set_gpio SPI2_MUX1 1
|
||||
set_gpio SPI2_MUX2 1
|
||||
set_gpio SPI2_MUX3 1
|
||||
elif [ "$SLED_INDEX" = "1" ]; then
|
||||
set_gpio SEL_SPI2_MUX 0
|
||||
set_gpio SPI2_MUX1 0
|
||||
set_gpio SPI2_MUX2 1
|
||||
set_gpio SPI2_MUX3 1
|
||||
elif [ "$SLED_INDEX" = "2" ]; then
|
||||
set_gpio SEL_SPI2_MUX 1
|
||||
set_gpio SPI2_MUX1 0
|
||||
set_gpio SPI2_MUX2 1
|
||||
set_gpio SPI2_MUX3 1
|
||||
elif [ "$SLED_INDEX" = "3" ]; then
|
||||
set_gpio SEL_SPI2_MUX 0
|
||||
set_gpio SPI2_MUX1 1
|
||||
set_gpio SPI2_MUX2 0
|
||||
set_gpio SPI2_MUX3 1
|
||||
elif [ "$SLED_INDEX" = "4" ]; then
|
||||
set_gpio SEL_SPI2_MUX 1
|
||||
set_gpio SPI2_MUX1 1
|
||||
set_gpio SPI2_MUX2 0
|
||||
set_gpio SPI2_MUX3 1
|
||||
elif [ "$SLED_INDEX" = "5" ]; then
|
||||
set_gpio SEL_SPI2_MUX 0
|
||||
set_gpio SPI2_MUX1 1
|
||||
set_gpio SPI2_MUX2 1
|
||||
set_gpio SPI2_MUX3 0
|
||||
elif [ "$SLED_INDEX" = "6" ]; then
|
||||
set_gpio SEL_SPI2_MUX 1
|
||||
set_gpio SPI2_MUX1 1
|
||||
set_gpio SPI2_MUX2 1
|
||||
set_gpio SPI2_MUX3 0
|
||||
else
|
||||
echo "set_spi2_mux: unknow sled index ($SLED_INDEX)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
bind_spi2_pnor()
|
||||
{
|
||||
local SLED_INDEX="$1"
|
||||
|
||||
if ! spi2_mux_select "$SLED_INDEX"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! echo -n spi1.0 > /sys/bus/spi/drivers/spi-nor/bind; then
|
||||
echo "Error: flash bind failed"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
unbind_spi2_pnor()
|
||||
{
|
||||
echo -n spi1.0 > /sys/bus/spi/drivers/spi-nor/unbind
|
||||
spi2_mux_select 0
|
||||
return 0
|
||||
}
|
||||
|
||||
find_mtd()
|
||||
{
|
||||
m=$(grep -xl "$1" /sys/class/mtd/*/name)
|
||||
m=${m%/name}
|
||||
m=${m##*/}
|
||||
echo "$m"
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare -a PORT_NUM_MAP=(10 3 2 1 7 6 5)
|
||||
declare -a PORT_NAME_MAP=(BMC SLED1 SLED2 SLED3 SLED4 SLED5 SLED6)
|
||||
SWITCH_MDIO_BUS="1e650000.mdio-1"
|
||||
|
||||
INNER_PORT_DEV_ID="4"
|
||||
OUTER_PORT_DEV_ID="3"
|
||||
RETIMER_MDIO_BUS="1e650018.mdio-1"
|
||||
|
||||
get_switch_port_link_st()
|
||||
{
|
||||
local port_phy_id=$1
|
||||
|
||||
if PORT_ST_VAL="$(mdio "$SWITCH_MDIO_BUS" phy "$port_phy_id" 0x00)"; then
|
||||
PORT_ST_VAL="${PORT_ST_VAL:2}"
|
||||
if [ "$((16#$PORT_ST_VAL & 16#0800))" -eq "0" ]; then
|
||||
PORT_ST="down"
|
||||
else
|
||||
PORT_ST="up"
|
||||
fi
|
||||
else
|
||||
PORT_ST="mdio failed"
|
||||
fi
|
||||
echo "${PORT_ST}"
|
||||
}
|
||||
|
||||
get_retimer_port_link_st()
|
||||
{
|
||||
local port_dev_id=$1
|
||||
|
||||
if PORT_ST_VAL="$(mdio "$RETIMER_MDIO_BUS" mmd 0:"$port_dev_id" 0x9002)"; then
|
||||
PORT_ST_VAL="${PORT_ST_VAL:2}"
|
||||
if [ "$((16#$PORT_ST_VAL & 16#0004))" -eq "0" ]; then
|
||||
PORT_ST="down"
|
||||
else
|
||||
PORT_ST="up"
|
||||
fi
|
||||
else
|
||||
PORT_ST="mdio failed"
|
||||
fi
|
||||
echo "${PORT_ST}"
|
||||
}
|
||||
|
||||
get_port_link_st()
|
||||
{
|
||||
printf "========================================\n"
|
||||
printf "Link Status\n"
|
||||
printf "========================================\n"
|
||||
printf "Switch:\n"
|
||||
for port_phy in {0..6}
|
||||
do
|
||||
printf " Port %d (%s): %s\n" "${PORT_NUM_MAP[port_phy]}" "${PORT_NAME_MAP[port_phy]}" "$(get_switch_port_link_st "${PORT_NUM_MAP[port_phy]}")"
|
||||
done
|
||||
printf "\n"
|
||||
printf "Retimer:\n"
|
||||
printf " Inner Port (XFI): %s\n" "$(get_retimer_port_link_st "${INNER_PORT_DEV_ID}")"
|
||||
printf " Outer Port (SFI): %s\n" "$(get_retimer_port_link_st "${OUTER_PORT_DEV_ID}")"
|
||||
printf "========================================\n\n"
|
||||
}
|
||||
|
||||
get_switch_port_reg_dump()
|
||||
{
|
||||
for port_phy in {0..6}
|
||||
do
|
||||
printf "========================================\n"
|
||||
printf "Port %d (%s)\n" "${PORT_NUM_MAP[port_phy]}" "${PORT_NAME_MAP[port_phy]}"
|
||||
printf "****************************************\n"
|
||||
for reg_offset in {0..31}
|
||||
do
|
||||
printf "[%02X]: %04X\n" "$reg_offset" "$(mdio "$SWITCH_MDIO_BUS" phy "${PORT_NUM_MAP[port_phy]}" "$reg_offset")"
|
||||
done
|
||||
printf "========================================\n\n"
|
||||
done
|
||||
}
|
||||
|
||||
print_help()
|
||||
{
|
||||
echo "Usage:"
|
||||
echo " $0 <COMMAND>"
|
||||
echo ""
|
||||
echo "COMMAND:"
|
||||
echo " --link-st"
|
||||
echo " show link status"
|
||||
echo ""
|
||||
echo " --port-reg-dump"
|
||||
echo " port registers dump"
|
||||
echo ""
|
||||
}
|
||||
|
||||
ACTION_CMD="$1"
|
||||
|
||||
if [[ ${ACTION_CMD} =~ -h|--help ]]; then
|
||||
print_help
|
||||
elif [ "${ACTION_CMD}" = "--link-st" ]; then
|
||||
get_port_link_st
|
||||
elif [ "${ACTION_CMD}" = "--port-reg-dump" ]; then
|
||||
get_switch_port_reg_dump
|
||||
else
|
||||
echo "Unknow command: $ACTION_CMD"
|
||||
print_help
|
||||
fi
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
DBUS_PROPERTIES_INTF_NAME="org.freedesktop.DBus.Properties"
|
||||
|
||||
set_host_state()
|
||||
{
|
||||
BUS_NAME="xyz.openbmc_project.State.Host$1"
|
||||
OBJ_PATH="/xyz/openbmc_project/state/host$1"
|
||||
INTF_NAME="xyz.openbmc_project.State.Host"
|
||||
PROPERTY_NAME="CurrentHostState"
|
||||
PROPERTY_VAL="xyz.openbmc_project.State.Host.HostState.$2"
|
||||
|
||||
busctl call "$BUS_NAME" "$OBJ_PATH" "$DBUS_PROPERTIES_INTF_NAME" Set ssv "$INTF_NAME" "$PROPERTY_NAME" s "$PROPERTY_VAL"
|
||||
}
|
||||
|
||||
set_chassis_state()
|
||||
{
|
||||
BUS_NAME="xyz.openbmc_project.State.Chassis$1"
|
||||
OBJ_PATH="/xyz/openbmc_project/state/chassis$1"
|
||||
INTF_NAME="xyz.openbmc_project.State.Chassis"
|
||||
PROPERTY_NAME="CurrentPowerState"
|
||||
PROPERTY_VAL="xyz.openbmc_project.State.Chassis.PowerState.$2"
|
||||
|
||||
busctl call "$BUS_NAME" "$OBJ_PATH" "$DBUS_PROPERTIES_INTF_NAME" Set ssv "$INTF_NAME" "$PROPERTY_NAME" s "$PROPERTY_VAL"
|
||||
}
|
||||
|
||||
INSTENCE_ID="$1"
|
||||
HOST_PWR_STATUS=$(/usr/sbin/power-ctrl sled"$1" status)
|
||||
|
||||
CHASSIS_STATE_VAL="Off"
|
||||
HOST_STATE_VAL="Off"
|
||||
|
||||
if [ "$HOST_PWR_STATUS" != "AC Off" ]; then
|
||||
CHASSIS_STATE_VAL="On"
|
||||
if [ "$HOST_PWR_STATUS" != "Off" ]; then
|
||||
HOST_STATE_VAL="Running"
|
||||
fi
|
||||
fi
|
||||
|
||||
set_chassis_state "$INSTENCE_ID" "$CHASSIS_STATE_VAL"
|
||||
set_host_state "$INSTENCE_ID" "$HOST_STATE_VAL"
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=Bletchley host state and chassis power state initialize for sled%i
|
||||
Wants=xyz.openbmc_project.State.Chassis@%i.service
|
||||
After=xyz.openbmc_project.State.Chassis@%i.service
|
||||
Wants=xyz.openbmc_project.State.Host@%i.service
|
||||
After=xyz.openbmc_project.State.Host@%i.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/libexec/bletchley-system-state-init %i
|
||||
SyslogIdentifier=bletchley-system-state-init sled%i
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
Restart=on-failure
|
||||
RestartSec=1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
#!/bin/bash
|
||||
|
||||
CMD=$1
|
||||
SLED_INDEX=$2
|
||||
|
||||
CHIP_NUM=0
|
||||
USB2_SEL0_A_PIN_OFFSET=0
|
||||
USB2_SEL1_A_PIN_OFFSET=0
|
||||
USB2_SEL0_B_PIN_OFFSET=0
|
||||
USB2_SEL1_B_PIN_OFFSET=0
|
||||
|
||||
init_gpio_pin_info()
|
||||
{
|
||||
local pin_info
|
||||
|
||||
read -r -a pin_info < <(gpiofind USB2_SEL0_A)
|
||||
CHIP_NUM="${pin_info[0]}"
|
||||
USB2_SEL0_A_PIN_OFFSET="${pin_info[1]}"
|
||||
read -r -a pin_info < <(gpiofind USB2_SEL1_A)
|
||||
USB2_SEL1_A_PIN_OFFSET="${pin_info[1]}"
|
||||
read -r -a pin_info < <(gpiofind USB2_SEL0_B)
|
||||
USB2_SEL0_B_PIN_OFFSET="${pin_info[1]}"
|
||||
read -r -a pin_info < <(gpiofind USB2_SEL1_B)
|
||||
USB2_SEL1_B_PIN_OFFSET="${pin_info[1]}"
|
||||
}
|
||||
|
||||
set_usbmux_gpio()
|
||||
{
|
||||
gpioset "$CHIP_NUM" \
|
||||
"$USB2_SEL0_A_PIN_OFFSET"="$1" \
|
||||
"$USB2_SEL1_A_PIN_OFFSET"="$2" \
|
||||
"$USB2_SEL0_B_PIN_OFFSET"="$3" \
|
||||
"$USB2_SEL1_B_PIN_OFFSET"="$4"
|
||||
}
|
||||
|
||||
print_help()
|
||||
{
|
||||
echo "Usage:"
|
||||
echo " bletchley-usbmux-util off"
|
||||
echo " bletchley-usbmux-util on <SLED_INDEX>"
|
||||
echo ""
|
||||
echo "SLED_INDEX: 1 - 6"
|
||||
echo ""
|
||||
}
|
||||
|
||||
usb_mux_off()
|
||||
{
|
||||
set_usbmux_gpio 1 1 1 1
|
||||
}
|
||||
|
||||
usb_mux_sled1()
|
||||
{
|
||||
usb_mux_off
|
||||
sleep 2
|
||||
set_usbmux_gpio 0 0 1 1
|
||||
}
|
||||
|
||||
usb_mux_sled2()
|
||||
{
|
||||
usb_mux_off
|
||||
sleep 2
|
||||
set_usbmux_gpio 1 0 1 1
|
||||
}
|
||||
|
||||
usb_mux_sled3()
|
||||
{
|
||||
usb_mux_off
|
||||
sleep 2
|
||||
set_usbmux_gpio 0 1 1 1
|
||||
}
|
||||
|
||||
usb_mux_sled4()
|
||||
{
|
||||
usb_mux_off
|
||||
sleep 2
|
||||
set_usbmux_gpio 1 1 0 0
|
||||
}
|
||||
|
||||
usb_mux_sled5()
|
||||
{
|
||||
usb_mux_off
|
||||
sleep 2
|
||||
set_usbmux_gpio 1 1 1 0
|
||||
}
|
||||
|
||||
usb_mux_sled6()
|
||||
{
|
||||
usb_mux_off
|
||||
sleep 2
|
||||
set_usbmux_gpio 1 1 0 1
|
||||
}
|
||||
|
||||
init_gpio_pin_info
|
||||
|
||||
if [ "$CMD" == "off" ]; then
|
||||
usb_mux_off
|
||||
elif [ "$CMD" == "on" ]; then
|
||||
if [ "$SLED_INDEX" -eq 1 ]; then
|
||||
usb_mux_sled1
|
||||
elif [ "$SLED_INDEX" -eq 2 ]; then
|
||||
usb_mux_sled2
|
||||
elif [ "$SLED_INDEX" -eq 3 ]; then
|
||||
usb_mux_sled3
|
||||
elif [ "$SLED_INDEX" -eq 4 ]; then
|
||||
usb_mux_sled4
|
||||
elif [ "$SLED_INDEX" -eq 5 ]; then
|
||||
usb_mux_sled5
|
||||
elif [ "$SLED_INDEX" -eq 6 ]; then
|
||||
usb_mux_sled6
|
||||
else
|
||||
echo "Invalid SLED index: $SLED_INDEX"
|
||||
print_help
|
||||
exit 1
|
||||
fi
|
||||
sleep 1
|
||||
else
|
||||
echo "Invalid command: $CMD"
|
||||
print_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,3 @@
|
||||
CONFIG_USE_BOOTARGS=y
|
||||
CONFIG_BOOTARGS="console=ttyS4,57600n8 root=/dev/ram rw vmalloc=768M"
|
||||
CONFIG_BAUDRATE=57600
|
||||
@@ -0,0 +1,2 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
SRC_URI +="file://bletchley.cfg"
|
||||
@@ -0,0 +1,2 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/u-boot-aspeed-sdk:"
|
||||
SRC_URI +="file://bletchley.cfg"
|
||||
@@ -0,0 +1,5 @@
|
||||
do_install:append() {
|
||||
sed -i "s/--user usbmux//" ${D}${systemd_system_unitdir}/usbmuxd.service
|
||||
sed -i "s#/var/run#/run#" ${D}${systemd_system_unitdir}/usbmuxd.service
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
CFLAGS += " -D_FILE_OFFSET_BITS=64"
|
||||
@@ -0,0 +1 @@
|
||||
EXTRA_OEMESON:append:bletchley=" -Dme_support=false"
|
||||
@@ -0,0 +1,50 @@
|
||||
# large memory support
|
||||
CONFIG_VMSPLIT_3G_OPT=y
|
||||
# aspeed-pwm driver
|
||||
CONFIG_HAVE_CLK=y
|
||||
CONFIG_PWM=y
|
||||
CONFIG_OF=y
|
||||
CONFIG_PWM_ASPEED_AST2600=y
|
||||
# pwm-fan driver
|
||||
CONFIG_SENSORS_PWM_FAN=y
|
||||
# aspeed-tach driver
|
||||
CONFIG_SENSORS_TACH_ASPEED_AST2600=y
|
||||
# aspeed-adc driver
|
||||
CONFIG_COMMON_CLK=y
|
||||
CONFIG_ASPEED_ADC=y
|
||||
# devmem
|
||||
CONFIG_DEVMEM=y
|
||||
# fixed-link feature
|
||||
CONFIG_PHYLIB=y
|
||||
CONFIG_FIXED_PHY=y
|
||||
# humidity and temperature sensor
|
||||
CONFIG_HDC100X=y
|
||||
# interposer HSC driver
|
||||
CONFIG_SENSORS_MP5023=y
|
||||
# RTC
|
||||
CONFIG_RTC_DRV_PCF85363=y
|
||||
# FUSB302 driver
|
||||
CONFIG_TYPEC=y
|
||||
CONFIG_TYPEC_TCPM=y
|
||||
CONFIG_TYPEC_FUSB302=y
|
||||
# SPI GPIO
|
||||
CONFIG_SPI_GPIO=y
|
||||
CONFIG_SPI_BITBANG=y
|
||||
# INA230
|
||||
CONFIG_SENSORS_INA2XX=y
|
||||
# USB EHCI
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
CONFIG_USB_EHCI_HCD_PLATFORM=y
|
||||
# REGULATOR
|
||||
CONFIG_REGULATOR=y
|
||||
CONFIG_REGULATOR_FIXED_VOLTAGE=y
|
||||
# si7020
|
||||
CONFIG_SI7020=y
|
||||
# IPMI & IPMB
|
||||
CONFIG_IPMI_HANDLER=y
|
||||
CONFIG_IPMI_DEVICE_INTERFACE=y
|
||||
CONFIG_IPMB_DEVICE_INTERFACE=y
|
||||
# Enable loadable module
|
||||
CONFIG_MODULES=y
|
||||
# Aspeed OTP
|
||||
CONFIG_ASPEED_OTP=y
|
||||
@@ -0,0 +1,2 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/linux-aspeed:"
|
||||
SRC_URI += "file://bletchley.cfg"
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"gpio_definitions": [
|
||||
{
|
||||
"name": "POWER_BUTTON",
|
||||
"pin": "M7",
|
||||
"direction": "both"
|
||||
},
|
||||
{
|
||||
"name": "DEBUG_SELECTOR_BUTTON",
|
||||
"pin": "G3",
|
||||
"direction": "both"
|
||||
},
|
||||
{
|
||||
"name": "HOST_SELECTOR",
|
||||
"group_gpio_config" : [],
|
||||
"max_position" : 6,
|
||||
"host_selector_map" : {}
|
||||
}
|
||||
]
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
FILESEXTRAPATHS:append:bletchley := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI += "file://gpio_defs.json"
|
||||
|
||||
do_install:append:bletchley() {
|
||||
install -d ${D}${sysconfdir}/default/obmc/gpio/
|
||||
install -m 0644 ${WORKDIR}/gpio_defs.json ${D}/${sysconfdir}/default/obmc/gpio/
|
||||
}
|
||||
|
||||
FILES:${PN}-signals:append = " ${sysconfdir}/default/obmc/gpio/gpio_defs.json"
|
||||
@@ -0,0 +1,23 @@
|
||||
SUMMARY = "YAML configuration for bletchley"
|
||||
PR = "r1"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
inherit allarch
|
||||
|
||||
SRC_URI = " \
|
||||
file://bletchley-ipmi-fru.yaml \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
||||
do_install() {
|
||||
install -m 0644 -D bletchley-ipmi-fru.yaml \
|
||||
${D}${datadir}/${BPN}/ipmi-fru-read.yaml
|
||||
}
|
||||
|
||||
FILES:${PN}-dev = " \
|
||||
${datadir}/${BPN}/ipmi-fru-read.yaml \
|
||||
"
|
||||
|
||||
ALLOW_EMPTY:${PN} = "1"
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
0:
|
||||
/system/chassis/bmc:
|
||||
entityID: 7
|
||||
entityInstance: 1
|
||||
interfaces:
|
||||
xyz.openbmc_project.Inventory.Decorator.Asset:
|
||||
BuildDate:
|
||||
IPMIFruProperty: Mfg Date
|
||||
IPMIFruSection: Board
|
||||
SerialNumber:
|
||||
IPMIFruProperty: Serial Number
|
||||
IPMIFruSection: Board
|
||||
PartNumber:
|
||||
IPMIFruProperty: Part Number
|
||||
IPMIFruSection: Board
|
||||
Manufacturer:
|
||||
IPMIFruProperty: Manufacturer
|
||||
IPMIFruSection: Board
|
||||
xyz.openbmc_project.Inventory.Item:
|
||||
PrettyName:
|
||||
IPMIFruProperty: Name
|
||||
IPMIFruSection: Board
|
||||
xyz.openbmc_project.Inventory.Decorator.Revision:
|
||||
Version:
|
||||
IPMIFruProperty: FRU File ID
|
||||
IPMIFruSection: Board
|
||||
xyz.openbmc_project.Inventory.Item.Board:
|
||||
xyz.openbmc_project.Inventory.Item.Bmc:
|
||||
xyz.openbmc_project.Inventory.Item.Panel:
|
||||
|
||||
/system/chassis/bmc/ethernet:
|
||||
entityID: 7
|
||||
entityInstance: 1
|
||||
interfaces:
|
||||
xyz.openbmc_project.Inventory.Item.NetworkInterface:
|
||||
MACAddress:
|
||||
IPMIFruProperty: Custom Field 3
|
||||
IPMIFruSection: Board
|
||||
xyz.openbmc_project.Inventory.Item.Ethernet:
|
||||
@@ -0,0 +1,16 @@
|
||||
FILESEXTRAPATHS:prepend:bletchley := "${THISDIR}/${PN}:"
|
||||
|
||||
FILES:${PN}:append:bletchley = " ${datadir}/swampd"
|
||||
FILES:${PN}:append:bletchley = " ${systemd_system_unitdir}/phosphor-pid-control.service.d/*.conf"
|
||||
|
||||
do_install:append:bletchley() {
|
||||
|
||||
override_dir="${D}${systemd_system_unitdir}/phosphor-pid-control.service.d"
|
||||
override_file="${override_dir}/10-bletchley.conf"
|
||||
mkdir -p ${D}${systemd_system_unitdir}/phosphor-pid-control.service.d
|
||||
echo "[Unit]" > ${override_file}
|
||||
echo "After=xyz.openbmc_project.hwmontempsensor.service" >> ${override_file}
|
||||
echo "After=phosphor-virtual-sensor.service" >> ${override_file}
|
||||
|
||||
install -d ${D}${datadir}/swampd
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
INVENTORY=/system/chassis/presence/presence_sled1
|
||||
DEVPATH=/dev/input/event0
|
||||
KEY=58
|
||||
NAME=presence_sled1
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
INVENTORY=/system/chassis/presence/presence_sled2
|
||||
DEVPATH=/dev/input/event0
|
||||
KEY=59
|
||||
NAME=presence_sled2
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
INVENTORY=/system/chassis/presence/presence_sled3
|
||||
DEVPATH=/dev/input/event0
|
||||
KEY=60
|
||||
NAME=presence_sled3
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
INVENTORY=/system/chassis/presence/presence_sled4
|
||||
DEVPATH=/dev/input/event0
|
||||
KEY=61
|
||||
NAME=presence_sled4
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
INVENTORY=/system/chassis/presence/presence_sled5
|
||||
DEVPATH=/dev/input/event0
|
||||
KEY=62
|
||||
NAME=presence_sled5
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
INVENTORY=/system/chassis/presence/presence_sled6
|
||||
DEVPATH=/dev/input/event0
|
||||
KEY=63
|
||||
NAME=presence_sled6
|
||||
@@ -0,0 +1,22 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
inherit obmc-phosphor-systemd
|
||||
|
||||
# Add service file link
|
||||
TMPL_PRESENT = "phosphor-gpio-presence@.service"
|
||||
INSTFMT_PRESENT = "phosphor-gpio-presence@presence-sled{0}.service"
|
||||
PRESENT_TGT = "multi-user.target"
|
||||
FMT_PRESENT = "../${TMPL_PRESENT}:${PRESENT_TGT}.requires/${INSTFMT_PRESENT}"
|
||||
SYSTEMD_LINK:${PN}-presence:append:bletchley = " ${@compose_list(d, 'FMT_PRESENT', 'OBMC_HOST_INSTANCES')}"
|
||||
|
||||
# Add environment file
|
||||
SLED_PRESENT_ENV_FMT = "obmc/gpio/presence-sled{0}.conf"
|
||||
SYSTEMD_ENVIRONMENT_FILE:${PN}-presence:bletchley = " ${@compose_list(d, 'SLED_PRESENT_ENV_FMT', 'OBMC_HOST_INSTANCES')}"
|
||||
|
||||
GPIO_PRESENCE_SLED_CONF="/etc/default/obmc/gpio/%i.conf"
|
||||
|
||||
do_install:append:bletchley(){
|
||||
# modify ConditionPathExists and EnvironmentFile to correct filepath
|
||||
sed -i -e "s,ConditionPathExists=.*,ConditionPathExists=${GPIO_PRESENCE_SLED_CONF},g" ${D}${systemd_system_unitdir}/phosphor-gpio-presence@.service
|
||||
sed -i -e "s,EnvironmentFile=.*,EnvironmentFile=${GPIO_PRESENCE_SLED_CONF},g" ${D}${systemd_system_unitdir}/phosphor-gpio-presence@.service
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
CPU_CRIT_TGT = ""
|
||||
@@ -0,0 +1,18 @@
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append = " \
|
||||
phosphor-nvme \
|
||||
plat-svc \
|
||||
motor-ctrl \
|
||||
phosphor-virtual-sensor \
|
||||
usbutils \
|
||||
idevicerestore \
|
||||
fw-update \
|
||||
phosphor-sel-logger \
|
||||
phosphor-gpio-monitor-presence \
|
||||
detect-sled-present \
|
||||
phosphor-ipmi-ipmb \
|
||||
fb-ipmi-oem \
|
||||
board-type-checker \
|
||||
obmc-phosphor-buttons-signals \
|
||||
obmc-phosphor-buttons-handler \
|
||||
phosphor-state-manager \
|
||||
"
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
FILESEXTRAPATHS:append := ":${THISDIR}/${PN}"
|
||||
SOURCE_FILES:append = " 99-platform-init"
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#bin/sh
|
||||
|
||||
# Create /dev/mem
|
||||
if [ ! -c /dev/mem ]; then
|
||||
/bin/mknod /dev/mem c 1 1
|
||||
fi
|
||||
|
||||
# Disable FMC_WDT2
|
||||
FMC_WDT2_CTRL_VAL=$(/sbin/devmem 0x1e620064)
|
||||
FMC_WDT2_CTRL_VAL=$((16#${FMC_WDT2_CTRL_VAL#"0x"}))
|
||||
SET_VAL=$((FMC_WDT2_CTRL_VAL & 0xFFFFFFFE))
|
||||
/sbin/devmem 0x1e620064 32 "$SET_VAL"
|
||||
|
||||
# Detect boot flash source
|
||||
SLOT_FILE="/run/media/slot"
|
||||
mkdir -p "$(dirname "${SLOT_FILE}")"
|
||||
if [ "$((FMC_WDT2_CTRL_VAL & 0x00000010))" != "0" ]; then
|
||||
echo "1" > "$SLOT_FILE"
|
||||
else
|
||||
echo "0" > "$SLOT_FILE"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
SYSFS_PATH=/sys/bus/i2c/devices/7-0054/eeprom
|
||||
FRUID=0
|
||||
@@ -0,0 +1,24 @@
|
||||
inherit obmc-phosphor-systemd
|
||||
|
||||
FILESEXTRAPATHS:prepend:bletchley := "${THISDIR}/${PN}:"
|
||||
|
||||
DEPENDS:append:bletchley = " bletchley-yaml-config"
|
||||
|
||||
IPMI_FRU_YAML:bletchley = "${STAGING_DIR_HOST}${datadir}/bletchley-yaml-config/ipmi-fru-read.yaml"
|
||||
|
||||
EEPROM_NAMES = "bmc"
|
||||
|
||||
EEPROMFMT = "system/chassis/{0}"
|
||||
EEPROM_ESCAPEDFMT = "system-chassis-{0}"
|
||||
EEPROMS = "${@compose_list(d, 'EEPROMFMT', 'EEPROM_NAMES')}"
|
||||
EEPROMS_ESCAPED = "${@compose_list(d, 'EEPROM_ESCAPEDFMT', 'EEPROM_NAMES')}"
|
||||
|
||||
ENVFMT = "obmc/eeproms/{0}"
|
||||
SYSTEMD_ENVIRONMENT_FILE:${PN}:append:bletchley := " ${@compose_list(d, 'ENVFMT', 'EEPROMS')}"
|
||||
|
||||
TMPL = "obmc-read-eeprom@.service"
|
||||
TGT = "${SYSTEMD_DEFAULT_TARGET}"
|
||||
INSTFMT = "obmc-read-eeprom@{0}.service"
|
||||
FMT = "../${TMPL}:${TGT}.wants/${INSTFMT}"
|
||||
|
||||
SYSTEMD_LINK:${PN}:append:bletchley := " ${@compose_list(d, 'FMT', 'EEPROMS_ESCAPED')}"
|
||||
@@ -0,0 +1,13 @@
|
||||
DEPENDS:append:bletchley = " bletchley-yaml-config"
|
||||
|
||||
EXTRA_OEMESON:bletchley = " \
|
||||
-Dfru-yaml-gen=${STAGING_DIR_HOST}${datadir}/bletchley-yaml-config/ipmi-fru-read.yaml \
|
||||
"
|
||||
|
||||
# host watchdog does not support on bletchley
|
||||
RDEPENDS:${PN}:remove:bletchley = "phosphor-watchdog"
|
||||
|
||||
# bletchley doesn't have IPMI support, skip xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service
|
||||
SOFT_SVC = ""
|
||||
SOFT_TGTFMT = ""
|
||||
SOFT_FMT = ""
|
||||
@@ -0,0 +1 @@
|
||||
IPMB_CHANNELS:bletchley = "/dev/ipmb-13"
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
SUMMARY = "Phosphor LED Group Management for Bletchley"
|
||||
PR = "r1"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
inherit native
|
||||
|
||||
PROVIDES += "virtual/phosphor-led-manager-config-native"
|
||||
|
||||
SRC_URI += "file://led.yaml"
|
||||
S = "${WORKDIR}"
|
||||
|
||||
# Copies example led layout yaml file
|
||||
do_install() {
|
||||
SRC=${S}
|
||||
DEST=${D}${datadir}/phosphor-led-manager
|
||||
install -D ${SRC}/led.yaml ${DEST}/led.yaml
|
||||
}
|
||||
+222
@@ -0,0 +1,222 @@
|
||||
#====================
|
||||
# Chassis LED
|
||||
#====================
|
||||
bmc_booted:
|
||||
sys_log_id:
|
||||
Action: 'On'
|
||||
|
||||
enclosure_fault:
|
||||
sys_log_id:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 1000
|
||||
|
||||
enclosure_identify:
|
||||
sys_log_id:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 400
|
||||
|
||||
enclosure_identify_blink:
|
||||
sys_log_id:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 400
|
||||
|
||||
#====================
|
||||
# Fan 0
|
||||
#====================
|
||||
fan0_fault:
|
||||
fan0_amber:
|
||||
Action: 'On'
|
||||
fan0_blue:
|
||||
Action: 'Off'
|
||||
|
||||
fan0_good:
|
||||
fan0_amber:
|
||||
Action: 'Off'
|
||||
fan0_blue:
|
||||
Action: 'On'
|
||||
|
||||
#====================
|
||||
# Fan 1
|
||||
#====================
|
||||
fan1_fault:
|
||||
fan1_amber:
|
||||
Action: 'On'
|
||||
fan1_blue:
|
||||
Action: 'Off'
|
||||
|
||||
fan1_good:
|
||||
fan1_amber:
|
||||
Action: 'Off'
|
||||
fan1_blue:
|
||||
Action: 'On'
|
||||
|
||||
#====================
|
||||
# Fan 2
|
||||
#====================
|
||||
fan2_fault:
|
||||
fan2_amber:
|
||||
Action: 'On'
|
||||
fan2_blue:
|
||||
Action: 'Off'
|
||||
|
||||
fan2_good:
|
||||
fan2_amber:
|
||||
Action: 'Off'
|
||||
fan2_blue:
|
||||
Action: 'On'
|
||||
|
||||
#====================
|
||||
# Fan 3
|
||||
#====================
|
||||
fan3_fault:
|
||||
fan3_amber:
|
||||
Action: 'On'
|
||||
fan3_blue:
|
||||
Action: 'Off'
|
||||
|
||||
fan3_good:
|
||||
fan3_amber:
|
||||
Action: 'Off'
|
||||
fan3_blue:
|
||||
Action: 'On'
|
||||
|
||||
#====================
|
||||
# Sled 1
|
||||
#====================
|
||||
sled1_fault:
|
||||
sled1_amber:
|
||||
Action: 'On'
|
||||
|
||||
sled1_good:
|
||||
sled1_blue:
|
||||
Action: 'On'
|
||||
|
||||
sled1_identify:
|
||||
sled1_amber:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 400
|
||||
|
||||
sled1_identify_blink:
|
||||
sled1_amber:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 400
|
||||
|
||||
#====================
|
||||
# Sled 2
|
||||
#====================
|
||||
sled2_fault:
|
||||
sled2_amber:
|
||||
Action: 'On'
|
||||
|
||||
sled2_good:
|
||||
sled2_blue:
|
||||
Action: 'On'
|
||||
|
||||
sled2_identify:
|
||||
sled2_amber:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 400
|
||||
|
||||
sled2_identify_blink:
|
||||
sled2_amber:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 400
|
||||
|
||||
#====================
|
||||
# Sled 3
|
||||
#====================
|
||||
sled3_fault:
|
||||
sled3_amber:
|
||||
Action: 'On'
|
||||
|
||||
sled3_good:
|
||||
sled3_blue:
|
||||
Action: 'On'
|
||||
|
||||
sled3_identify:
|
||||
sled3_amber:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 400
|
||||
|
||||
sled3_identify_blink:
|
||||
sled3_amber:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 400
|
||||
|
||||
#====================
|
||||
# Sled 4
|
||||
#====================
|
||||
sled4_fault:
|
||||
sled4_amber:
|
||||
Action: 'On'
|
||||
|
||||
sled4_good:
|
||||
sled4_blue:
|
||||
Action: 'On'
|
||||
|
||||
sled4_identify:
|
||||
sled4_amber:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 400
|
||||
|
||||
sled4_identify_blink:
|
||||
sled4_amber:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 400
|
||||
|
||||
#====================
|
||||
# Sled 5
|
||||
#====================
|
||||
sled5_fault:
|
||||
sled5_amber:
|
||||
Action: 'On'
|
||||
|
||||
sled5_good:
|
||||
sled5_blue:
|
||||
Action: 'On'
|
||||
|
||||
sled5_identify:
|
||||
sled5_amber:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 400
|
||||
|
||||
sled5_identify_blink:
|
||||
sled5_amber:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 400
|
||||
|
||||
#====================
|
||||
# Sled 6
|
||||
#====================
|
||||
sled6_fault:
|
||||
sled6_amber:
|
||||
Action: 'On'
|
||||
|
||||
sled6_good:
|
||||
sled6_blue:
|
||||
Action: 'On'
|
||||
|
||||
sled6_identify:
|
||||
sled6_amber:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 400
|
||||
|
||||
sled6_identify_blink:
|
||||
sled6_amber:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 400
|
||||
@@ -0,0 +1,9 @@
|
||||
FAN_INSTANCES="0 1 2 3"
|
||||
FAN_INSTFMT="obmc-led-group-start@.service:obmc-led-group-start@fan{0}_good.service"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'FAN_INSTFMT', 'FAN_INSTANCES')}"
|
||||
|
||||
HOST_START_INSTFMT="obmc-led-group-start@.service:obmc-led-group-start@sled{0}_good.service"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_START_INSTFMT', 'OBMC_HOST_INSTANCES')}"
|
||||
|
||||
HOST_STOP_INSTFMT="obmc-led-group-stop@.service:obmc-led-group-stop@sled{0}_good.service"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_STOP_INSTFMT', 'OBMC_HOST_INSTANCES')}"
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"eth0":"ethernet"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
PACKAGECONFIG:append = " sync-mac"
|
||||
|
||||
EXTRA_OEMESON = "-Dforce-sync-mac=true"
|
||||
|
||||
SRC_URI += " \
|
||||
file://config.json \
|
||||
"
|
||||
FILES:${PN} += "${datadir}/network/*.json"
|
||||
|
||||
do_install:append() {
|
||||
install -d ${D}${datadir}/network/
|
||||
install -m 0644 ${WORKDIR}/config.json ${D}${datadir}/network/
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
PACKAGECONFIG:bletchley = " \
|
||||
adcsensor \
|
||||
fansensor \
|
||||
hwmontempsensor \
|
||||
psusensor \
|
||||
"
|
||||
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
|
||||
TARGET_FILE_NAME="/etc/nvme/nvme_config.json"
|
||||
|
||||
export_gpio() {
|
||||
if [ ! -d "/sys/class/gpio/gpio$1" ]; then
|
||||
echo "$1" >/sys/class/gpio/export
|
||||
fi
|
||||
}
|
||||
|
||||
for i in {0..5}
|
||||
do
|
||||
SLED_NVME_PCIE_EN[i]=0
|
||||
for file in /sys/bus/i2c/drivers/pca953x/"$i"-0041/gpio/gpiochip*/base
|
||||
do
|
||||
if [ -f "$file" ]; then
|
||||
GPIOCHIP_BASE="$(cat /sys/bus/i2c/drivers/pca953x/"$i"-0041/gpio/gpiochip*/base)"
|
||||
SLED_NVME_PCIE_EN[i]=$((GPIOCHIP_BASE+3))
|
||||
export_gpio "${SLED_NVME_PCIE_EN[i]}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
cat > $TARGET_FILE_NAME << EOF1
|
||||
{
|
||||
"maxSmbusErrorRetry": 3,
|
||||
"config": [
|
||||
{
|
||||
"NVMeDriveIndex": 1,
|
||||
"NVMeDriveBusID": 0,
|
||||
"NVMeDrivePwrGoodPin": ${SLED_NVME_PCIE_EN[0]}
|
||||
},
|
||||
{
|
||||
"NVMeDriveIndex": 2,
|
||||
"NVMeDriveBusID": 1,
|
||||
"NVMeDrivePwrGoodPin": ${SLED_NVME_PCIE_EN[1]}
|
||||
},
|
||||
{
|
||||
"NVMeDriveIndex": 3,
|
||||
"NVMeDriveBusID": 2,
|
||||
"NVMeDrivePwrGoodPin": ${SLED_NVME_PCIE_EN[2]}
|
||||
},
|
||||
{
|
||||
"NVMeDriveIndex": 4,
|
||||
"NVMeDriveBusID": 3,
|
||||
"NVMeDrivePwrGoodPin": ${SLED_NVME_PCIE_EN[3]}
|
||||
},
|
||||
{
|
||||
"NVMeDriveIndex": 5,
|
||||
"NVMeDriveBusID": 4,
|
||||
"NVMeDrivePwrGoodPin": ${SLED_NVME_PCIE_EN[4]}
|
||||
},
|
||||
{
|
||||
"NVMeDriveIndex": 6,
|
||||
"NVMeDriveBusID": 5,
|
||||
"NVMeDrivePwrGoodPin": ${SLED_NVME_PCIE_EN[5]}
|
||||
}
|
||||
],
|
||||
"threshold": [
|
||||
{
|
||||
"criticalHigh": 68,
|
||||
"criticalLow": 0,
|
||||
"warningHigh": 67,
|
||||
"warningLow": 1,
|
||||
"maxValue": 127,
|
||||
"minValue": -127
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
EOF1
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
[Service]
|
||||
ExecStartPre=/usr/libexec/phosphor-nvme/nvme-json-rewrite
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"maxSmbusErrorRetry": 3,
|
||||
"config": [
|
||||
{
|
||||
"NVMeDriveIndex": 1,
|
||||
"NVMeDriveBusID": 0
|
||||
},
|
||||
{
|
||||
"NVMeDriveIndex": 2,
|
||||
"NVMeDriveBusID": 1
|
||||
},
|
||||
{
|
||||
"NVMeDriveIndex": 3,
|
||||
"NVMeDriveBusID": 2
|
||||
},
|
||||
{
|
||||
"NVMeDriveIndex": 4,
|
||||
"NVMeDriveBusID": 3
|
||||
},
|
||||
{
|
||||
"NVMeDriveIndex": 5,
|
||||
"NVMeDriveBusID": 4
|
||||
},
|
||||
{
|
||||
"NVMeDriveIndex": 6,
|
||||
"NVMeDriveBusID": 5
|
||||
}
|
||||
],
|
||||
"threshold": [
|
||||
{
|
||||
"criticalHigh": 68,
|
||||
"criticalLow": 0,
|
||||
"warningHigh": 67,
|
||||
"warningLow": 1,
|
||||
"maxValue": 127,
|
||||
"minValue": -127
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
inherit obmc-phosphor-systemd
|
||||
|
||||
SRC_URI:append:bletchley = " \
|
||||
file://nvme-json-rewrite \
|
||||
file://nvme-json-rewrite.conf \
|
||||
file://nvme_config.json \
|
||||
"
|
||||
|
||||
RDEPENDS:${PN}:bletchley += "bash"
|
||||
|
||||
do_install:append:bletchley() {
|
||||
install -d ${D}${libexecdir}/${PN}/
|
||||
install -m 0755 ${WORKDIR}/nvme-json-rewrite ${D}${libexecdir}/${PN}/
|
||||
|
||||
install -d ${D}${sysconfdir}/nvme
|
||||
install -m 0644 -D ${WORKDIR}/nvme_config.json ${D}${sysconfdir}/nvme
|
||||
}
|
||||
|
||||
SYSTEMD_OVERRIDE:${PN}:append:bletchley = " \
|
||||
nvme-json-rewrite.conf:xyz.openbmc_project.nvme.manager.service.d/nvme-json-rewrite.conf \
|
||||
"
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
[
|
||||
{
|
||||
"Desc": {
|
||||
"Name": "Virtual_CFM_Sensor",
|
||||
"SensorType": "airflow"
|
||||
},
|
||||
"Params": {
|
||||
"DbusParam": [
|
||||
{
|
||||
"ParamName": "fan0",
|
||||
"Desc": {
|
||||
"Name": "FAN0_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ParamName": "fan1",
|
||||
"Desc": {
|
||||
"Name": "FAN1_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ParamName": "fan2",
|
||||
"Desc": {
|
||||
"Name": "FAN2_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ParamName": "fan3",
|
||||
"Desc": {
|
||||
"Name": "FAN3_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Expression": "max(0, (avg(fan0, fan1, fan2, fan3) * 0.0448) - 9.5042)"
|
||||
},
|
||||
{
|
||||
"Desc": {
|
||||
"Name": "Virtual_Inlet_Temp",
|
||||
"SensorType": "temperature"
|
||||
},
|
||||
"Threshold": {
|
||||
"CriticalHigh": 40,
|
||||
"CriticalLow": 0
|
||||
},
|
||||
"Params": {
|
||||
"DbusParam": [
|
||||
{
|
||||
"ParamName": "inlet_temp",
|
||||
"Desc": {
|
||||
"Name": "FRONT_PANEL_TEMP",
|
||||
"SensorType": "temperature"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ParamName": "fan0",
|
||||
"Desc": {
|
||||
"Name": "FAN0_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ParamName": "fan1",
|
||||
"Desc": {
|
||||
"Name": "FAN1_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ParamName": "fan2",
|
||||
"Desc": {
|
||||
"Name": "FAN2_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ParamName": "fan3",
|
||||
"Desc": {
|
||||
"Name": "FAN3_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Expression": [
|
||||
"if(",
|
||||
" avg(fan0, fan1, fan2, fan3) > 0,",
|
||||
" inlet_temp - (((avg(fan0, fan1, fan2, fan3)^2) * (5e-8)) -",
|
||||
" (avg(fan0, fan1, fan2, fan3) * (6e-4)) + 1.5841),",
|
||||
" inlet_temp)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Desc": {
|
||||
"Name": "Virtual_P12V_AUX_HSC_Input_Power",
|
||||
"SensorType": "power"
|
||||
},
|
||||
"Params": {
|
||||
"DbusParam": [
|
||||
{
|
||||
"ParamName": "HSC_PWR",
|
||||
"Desc": {
|
||||
"Name": "P12V_AUX_HSC_Input_Power",
|
||||
"SensorType": "power"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Expression": [
|
||||
"var PWR[9]:={",
|
||||
" 68.082, 131.899, 194.753, 256.391, 316.721, 376.108, 433.569,",
|
||||
" 490.850, 546.187 };",
|
||||
"var ERR[9]:={",
|
||||
" 0.0425, 0.0497, 0.0537, 0.0555, 0.0565, 0.0577, 0.0587, 0.0597,",
|
||||
" 0.0603 };",
|
||||
"switch {",
|
||||
" case HSC_PWR<PWR[0]:",
|
||||
" HSC_PWR/(1+ERR[0]);",
|
||||
" case inrange(PWR[0],HSC_PWR,PWR[1]):",
|
||||
" HSC_PWR/(1+ERR[0]+(HSC_PWR-PWR[0])*(ERR[1]-ERR[0])/(PWR[1]-PWR[0]));",
|
||||
" case inrange(PWR[1],HSC_PWR,PWR[2]):",
|
||||
" HSC_PWR/(1+ERR[1]+(HSC_PWR-PWR[1])*(ERR[2]-ERR[1])/(PWR[2]-PWR[1]));",
|
||||
" case inrange(PWR[2],HSC_PWR,PWR[3]):",
|
||||
" HSC_PWR/(1+ERR[2]+(HSC_PWR-PWR[2])*(ERR[3]-ERR[2])/(PWR[3]-PWR[2]));",
|
||||
" case inrange(PWR[3],HSC_PWR,PWR[4]):",
|
||||
" HSC_PWR/(1+ERR[3]+(HSC_PWR-PWR[3])*(ERR[4]-ERR[3])/(PWR[4]-PWR[3]));",
|
||||
" case inrange(PWR[4],HSC_PWR,PWR[5]):",
|
||||
" HSC_PWR/(1+ERR[4]+(HSC_PWR-PWR[4])*(ERR[5]-ERR[4])/(PWR[5]-PWR[4]));",
|
||||
" case inrange(PWR[5],HSC_PWR,PWR[6]):",
|
||||
" HSC_PWR/(1+ERR[5]+(HSC_PWR-PWR[5])*(ERR[6]-ERR[5])/(PWR[6]-PWR[5]));",
|
||||
" case inrange(PWR[6],HSC_PWR,PWR[7]):",
|
||||
" HSC_PWR/(1+ERR[6]+(HSC_PWR-PWR[6])*(ERR[7]-ERR[6])/(PWR[7]-PWR[6]));",
|
||||
" case inrange(PWR[7],HSC_PWR,PWR[8]):",
|
||||
" HSC_PWR/(1+ERR[7]+(HSC_PWR-PWR[7])*(ERR[8]-ERR[7])/(PWR[8]-PWR[7]));",
|
||||
" default : HSC_PWR/(1+ERR[8]);",
|
||||
"}"
|
||||
]
|
||||
}
|
||||
]
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
[
|
||||
{
|
||||
"Desc": {
|
||||
"Name": "Virtual_CFM_Sensor",
|
||||
"SensorType": "airflow"
|
||||
},
|
||||
"Params": {
|
||||
"DbusParam": [
|
||||
{
|
||||
"ParamName": "fan0",
|
||||
"Desc": {
|
||||
"Name": "FAN0_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ParamName": "fan1",
|
||||
"Desc": {
|
||||
"Name": "FAN1_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ParamName": "fan2",
|
||||
"Desc": {
|
||||
"Name": "FAN2_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ParamName": "fan3",
|
||||
"Desc": {
|
||||
"Name": "FAN3_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Expression": "max(0, (avg(fan0, fan1, fan2, fan3) * 0.0448) - 9.5042)"
|
||||
},
|
||||
{
|
||||
"Desc": {
|
||||
"Name": "Virtual_Inlet_Temp",
|
||||
"SensorType": "temperature"
|
||||
},
|
||||
"Threshold": {
|
||||
"CriticalHigh": 40,
|
||||
"CriticalLow": 0
|
||||
},
|
||||
"Params": {
|
||||
"DbusParam": [
|
||||
{
|
||||
"ParamName": "inlet_temp",
|
||||
"Desc": {
|
||||
"Name": "FRONT_PANEL_TEMP",
|
||||
"SensorType": "temperature"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ParamName": "fan0",
|
||||
"Desc": {
|
||||
"Name": "FAN0_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ParamName": "fan1",
|
||||
"Desc": {
|
||||
"Name": "FAN1_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ParamName": "fan2",
|
||||
"Desc": {
|
||||
"Name": "FAN2_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ParamName": "fan3",
|
||||
"Desc": {
|
||||
"Name": "FAN3_TACH_IL",
|
||||
"SensorType": "fan_tach"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Expression": [
|
||||
"if(",
|
||||
" avg(fan0, fan1, fan2, fan3) > 0,",
|
||||
" inlet_temp - (((avg(fan0, fan1, fan2, fan3)^2) * (9e-8)) -",
|
||||
" (avg(fan0, fan1, fan2, fan3) * (8e-4)) + 2.37),",
|
||||
" inlet_temp)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Desc": {
|
||||
"Name": "Virtual_P12V_AUX_HSC_Input_Power",
|
||||
"SensorType": "power"
|
||||
},
|
||||
"Params": {
|
||||
"DbusParam": [
|
||||
{
|
||||
"ParamName": "HSC_PWR",
|
||||
"Desc": {
|
||||
"Name": "P12V_AUX_HSC_Input_Power",
|
||||
"SensorType": "power"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Expression": [
|
||||
"var PWR[9]:={",
|
||||
" 68.082, 131.899, 194.753, 256.391, 316.721, 376.108, 433.569,",
|
||||
" 490.850, 546.187 };",
|
||||
"var ERR[9]:={",
|
||||
" 0.0425, 0.0497, 0.0537, 0.0555, 0.0565, 0.0577, 0.0587, 0.0597,",
|
||||
" 0.0603 };",
|
||||
"switch {",
|
||||
" case HSC_PWR<PWR[0]:",
|
||||
" HSC_PWR/(1+ERR[0]);",
|
||||
" case inrange(PWR[0],HSC_PWR,PWR[1]):",
|
||||
" HSC_PWR/(1+ERR[0]+(HSC_PWR-PWR[0])*(ERR[1]-ERR[0])/(PWR[1]-PWR[0]));",
|
||||
" case inrange(PWR[1],HSC_PWR,PWR[2]):",
|
||||
" HSC_PWR/(1+ERR[1]+(HSC_PWR-PWR[1])*(ERR[2]-ERR[1])/(PWR[2]-PWR[1]));",
|
||||
" case inrange(PWR[2],HSC_PWR,PWR[3]):",
|
||||
" HSC_PWR/(1+ERR[2]+(HSC_PWR-PWR[2])*(ERR[3]-ERR[2])/(PWR[3]-PWR[2]));",
|
||||
" case inrange(PWR[3],HSC_PWR,PWR[4]):",
|
||||
" HSC_PWR/(1+ERR[3]+(HSC_PWR-PWR[3])*(ERR[4]-ERR[3])/(PWR[4]-PWR[3]));",
|
||||
" case inrange(PWR[4],HSC_PWR,PWR[5]):",
|
||||
" HSC_PWR/(1+ERR[4]+(HSC_PWR-PWR[4])*(ERR[5]-ERR[4])/(PWR[5]-PWR[4]));",
|
||||
" case inrange(PWR[5],HSC_PWR,PWR[6]):",
|
||||
" HSC_PWR/(1+ERR[5]+(HSC_PWR-PWR[5])*(ERR[6]-ERR[5])/(PWR[6]-PWR[5]));",
|
||||
" case inrange(PWR[6],HSC_PWR,PWR[7]):",
|
||||
" HSC_PWR/(1+ERR[6]+(HSC_PWR-PWR[6])*(ERR[7]-ERR[6])/(PWR[7]-PWR[6]));",
|
||||
" case inrange(PWR[7],HSC_PWR,PWR[8]):",
|
||||
" HSC_PWR/(1+ERR[7]+(HSC_PWR-PWR[7])*(ERR[8]-ERR[7])/(PWR[8]-PWR[7]));",
|
||||
" default : HSC_PWR/(1+ERR[8]);",
|
||||
"}"
|
||||
]
|
||||
}
|
||||
]
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
SENSOR_CONFIGS = " \
|
||||
virtual_sensor_config_hdc1080.json \
|
||||
virtual_sensor_config_si7021.json \
|
||||
"
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI:append = " \
|
||||
file://bletchley-host-acpi-power-state.yaml \
|
||||
file://bletchley-frontpanel.yaml \
|
||||
"
|
||||
SETTINGS_HOST_TEMPLATES:append = " bletchley-host-acpi-power-state.yaml"
|
||||
SETTINGS_CHASSIS_TEMPLATES_ZERO_ONLY:append = " bletchley-frontpanel.yaml"
|
||||
|
||||
OBMC_CHASSIS_ZERO_ONLY="0"
|
||||
|
||||
do_install:append() {
|
||||
DEST=${D}${settings_datadir}
|
||||
|
||||
for i in ${OBMC_CHASSIS_ZERO_ONLY};
|
||||
do
|
||||
for f in ${SETTINGS_CHASSIS_TEMPLATES_ZERO_ONLY};
|
||||
do
|
||||
sed "s/{}/${i}/g" ${f} >> ${DEST}/defaults.yaml
|
||||
done
|
||||
done
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/xyz/openbmc_project/inventory/system/chassis{}/frontpanel:
|
||||
- Interface: xyz.openbmc_project.Inventory.Decorator.Asset
|
||||
Properties:
|
||||
Model:
|
||||
Default: '"Bletchley_FPB_HDC1080"'
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/xyz/openbmc_project/control/host{}/acpi_power_state:
|
||||
- Interface: "xyz.openbmc_project.Control.Power.ACPIPowerState"
|
||||
Properties:
|
||||
SysACPIStatus:
|
||||
Default: ACPIPowerState::ACPI::Unknown
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
[Unit]
|
||||
Requires=bletchley-system-state-init@%i.service
|
||||
After=bletchley-system-state-init@%i.service
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$1" == "0" ]; then
|
||||
echo "Enter chassis-cycle"
|
||||
/usr/sbin/power-ctrl chassis-cycle
|
||||
else
|
||||
echo "Enter sled$1 cycle"
|
||||
/usr/sbin/power-ctrl "sled$1" cycle
|
||||
fi
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Chassis Power Cycle: %i
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/phosphor-state-manager/chassis-powercycle %i
|
||||
|
||||
[Install]
|
||||
WantedBy=obmc-chassis-powercycle@%i.target
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Turn off AC at Sled%i
|
||||
Conflicts=chassis-poweron@%i.service
|
||||
After=host-poweroff@%i.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/power-ctrl sled%i ac-off
|
||||
SyslogIdentifier=power-ctrl
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Turn on AC at Sled%i
|
||||
Requires=motor-init-calibration@%i.service
|
||||
After=motor-init-calibration@%i.service
|
||||
Conflicts=chassis-poweroff@%i.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/power-ctrl sled%i ac-on
|
||||
SyslogIdentifier=power-ctrl
|
||||
ExecStartPost=/bin/systemctl restart phosphor-discover-system-state@%i.service
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Sled%i Host Power Cycle
|
||||
Requires=motor-init-calibration@%i.service
|
||||
After=motor-init-calibration@%i.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/power-ctrl sled%i cycle
|
||||
SyslogIdentifier=power-ctrl
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Power off System in Sled%i by Step Motor
|
||||
Requires=motor-init-calibration@%i.service
|
||||
After=motor-init-calibration@%i.service
|
||||
Conflicts=host-poweron@%i.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/power-ctrl sled%i off
|
||||
SyslogIdentifier=power-ctrl
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user