Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,20 @@
SUMMARY = "Enable Host Boot"
PR = "r1"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${HPEBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658"
inherit obmc-phosphor-systemd
HOST_BOOT_SERVICE = "host-boot-enable.service"
SYSTEMD_SERVICE:${PN} += "${HOST_BOOT_SERVICE}"
HOST_BOOT_FMT = "../${HOST_BOOT_SERVICE}:multi-user.target.wants/${HOST_BOOT_SERVICE}"
SYSTEMD_LINK_${PN} += "${HOST_BOOT_FMT}"
SRC_URI += "file://host-boot-enable.service"
SRC_URI += "file://host-boot-enable.sh"
do_install() {
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/host-boot-enable.sh ${D}${bindir}
}
@@ -0,0 +1,15 @@
[Unit]
Description=Enable Host Boot
Wants=phosphor-ipmi-host.service
After=phosphor-ipmi-host.service
[Service]
Type=simple
ExecStart=/bin/sh -c "host-boot-enable.sh"
SyslogIdentifier=host-boot-enable
Restart=always
RestartSec=5
StartLimitInterval=0
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,38 @@
#!/bin/sh
findmtd() {
m=$(grep -xl "$1" /sys/class/mtd/*/name)
m=${m%/name}
m=${m##*/}
echo "$m"
}
set -- host-prime host-second vrom-prime vrom-second
for f in "$@"
do
image=$(findmtd "${f}")
if test -z "$image"
then
echo "Unable to find mtd partition for ${f}"
exit 1
fi
done
#enable vrom
# host-prime to vrom-prime
dd if="/dev/$(findmtd host-prime)" of="/dev/$(findmtd vrom-prime)"
# host-second to vrom-second
dd if="/dev/$(findmtd host-second)" of="/dev/$(findmtd vrom-second)"
echo 0x1800008a > /sys/class/soc/srom/vromoff
val=$(( ("$(devmem 0xd1000006 8)" && 0xff) | 0x04 ))
devmem 0xd1000006 8 $val
devmem 0xd1000018 8 0xff
while true
do
devmem 0xd100000f 8 0x14
sleep 1
done
@@ -0,0 +1,8 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
# platform configuration files
SRC_URI += "file://hpe-publish-uefi-version.sh"
do_install:append() {
install -D ${WORKDIR}/hpe-publish-uefi-version ${D}/usr/bin/hpe-publish-uefi-version
}
@@ -0,0 +1,43 @@
#!/bin/sh
#
# Copyright (c) 2021 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# RL300 doesn't support VROM, so we will be reading directly from
# SPI-NOR. The whole process is a little bit slow but works
# Find an MTD /dev file by name
findmtd() {
echo "parameter $1"
m=$(grep -xl "$1" /sys/class/mtd/*/name)
m=${m%/name}
m=${m##*/}
echo "$m"
}
rom=uefi-master
echo "Checking for mtd partition ${rom}"
image=$(findmtd ${rom})
if test -z "$image"
then
echo "Unable to find mtd partition for ${rom}"
exit 1
fi
rom_mtd=${image}
uefi_version="hpe-uefi-version /dev/${rom_mtd}"
busctl set-property xyz.openbmc_project.Software.BMC.Updater /xyz/openbmc_project/software/bios_active xyz.openbmc_project.Software.Version Version s "$uefi_version"
busctl get-property xyz.openbmc_project.Software.BMC.Updater /xyz/openbmc_project/software/bios_active xyz.openbmc_project.Software.Version Version
@@ -0,0 +1,44 @@
SUMMARY = "GXP EHCI Owner Reset"
PR = "r1"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${HPEBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658"
inherit obmc-phosphor-systemd
DEPENDS += "phosphor-gpio-monitor"
RDEPENDS:${PN} += "phosphor-gpio-monitor-monitor"
SYSTEMD_ENVIRONMENT_FILE:${PN} += "obmc/gpio/port_owner_udc0"
SYSTEMD_ENVIRONMENT_FILE:${PN} += "obmc/gpio/port_owner_udc1"
SYSTEMD_ENVIRONMENT_FILE:${PN} += "obmc/gpio/port_owner_udc2"
UDC0_GPIO = "port_owner_udc0"
UDC1_GPIO = "port_owner_udc1"
UDC2_GPIO = "port_owner_udc2"
TMPL_GPIO = "phosphor-gpio-monitor@.service"
INSTFMT_GPIO = "phosphor-gpio-monitor@{0}.service"
TGT_GPIO = "multi-user.target.requires"
FMT_GPIO = "../${TMPL_GPIO}:${TGT_GPIO}/${INSTFMT_GPIO}"
SYSTEMD_LINK:${PN} += "${@compose_list(d, 'FMT_GPIO', 'UDC0_GPIO')}"
SYSTEMD_LINK:${PN} += "${@compose_list(d, 'FMT_GPIO', 'UDC1_GPIO')}"
SYSTEMD_LINK:${PN} += "${@compose_list(d, 'FMT_GPIO', 'UDC2_GPIO')}"
UDC0_VEHCI = "udc0"
UDC1_VEHCI = "udc1"
UDC2_VEHCI = "udc2"
TMPL_VEHCI = "host-ehci-owner-reset@.service"
INSTFMT_VEHCI = "host-ehci-owner-reset@{0}.service"
FMT_VEHCI = "${TMPL_VEHCI}:${INSTFMT_VEHCI}"
SYSTEMD_LINK:${PN} += "${@compose_list(d, 'FMT_VEHCI', 'UDC0_VEHCI')}"
SYSTEMD_LINK:${PN} += "${@compose_list(d, 'FMT_VEHCI', 'UDC1_VEHCI')}"
SYSTEMD_LINK:${PN} += "${@compose_list(d, 'FMT_VEHCI', 'UDC2_VEHCI')}"
SYSTEMD_SERVICE:${PN} += "host-ehci-owner-reset@.service"
SRC_URI += "file://udc-reconnect.sh"
SRC_URI += "file://host-ehci-owner-reset@.service"
do_install() {
install -d ${D}${bindir}
install -m 755 ${WORKDIR}/udc-reconnect.sh ${D}${bindir}
}
@@ -0,0 +1,11 @@
[Unit]
Description=GXP EHCI Owner Reset Service
Wants=start-ipkvm.service
After=start-ipkvm.service
StartLimitIntervalSec=0
[Service]
Type=oneshot
ExecStart=/bin/sh -c "udc-reconnect.sh %i"
SyslogIdentifier=host-ehci-owner-reset@%i
@@ -0,0 +1,5 @@
DEVPATH=/dev/input/by-path/platform-ahb@80000000:vuhc-event
KEY=200
POLARITY=1
TARGET=host-ehci-owner-reset@udc0.service
EXTRA_ARGS=--continue
@@ -0,0 +1,5 @@
DEVPATH=/dev/input/by-path/platform-ahb@80000000:vuhc-event
KEY=201
POLARITY=1
TARGET=host-ehci-owner-reset@udc1.service
EXTRA_ARGS=--continue
@@ -0,0 +1,5 @@
DEVPATH=/dev/input/by-path/platform-ahb@80000000:vuhc-event
KEY=202
POLARITY=1
TARGET=host-ehci-owner-reset@udc2.service
EXTRA_ARGS=--continue
@@ -0,0 +1,37 @@
#!/bin/sh
if [ "$1" = "udc0" ]; then
function=$(cat /sys/class/udc/80401000.udc/function)
if [ "func-$function" != "func-" ]; then
echo "UDC0 owner is changed"
echo disconnect > /sys/class/udc/80401000.udc/soft_connect
sleep 3
echo connect > /sys/class/udc/80401000.udc/soft_connect
else
echo "UDC0 is not attached"
fi
else
if [ "$1" = "udc1" ]; then
function=$(cat /sys/class/udc/80402000.udc/function)
if [ "func-$function" != "func-" ]; then
echo "UDC1 owner is changed"
echo disconnect > /sys/class/udc/80402000.udc/soft_connect
sleep 3
echo connect > /sys/class/udc/80402000.udc/soft_connect
else
echo "UDC1 is not attached"
fi
else
if [ "$1" = "udc2" ]; then
function=$(cat /sys/class/udc/80403000.udc/function)
if [ "func-$function" != "func-" ]; then
echo "UDC2 owner is changed"
echo disconnect > /sys/class/udc/80403000.udc/soft_connect
sleep 3
echo connect > /sys/class/udc/80403000.udc/soft_connect
else
echo "UDC2 is not attached"
fi
fi
fi
fi