meta-ampere: mtjade: unify gpio handling service
Instead of having many bitbake recipes for Altra GPIO handling,
combining them into a single recipe so that the code look cleaner.
Tested:
1. Check ID button still works.
2. Check hightemp and overtemp handing still works.
3. Check Fault LED works correctly.
4. Check graceful shutdown and Host reboot still work.
Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com>
Change-Id: Ic6eef75702cf0353ae2d84a3cda0ffb84d10f4cc
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere-host-shutdown-ack@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere-host-shutdown-ack@.service
new file mode 100644
index 0000000..6588191
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere-host-shutdown-ack@.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Ampere Computing LLC host shutdown ACK
+Conflicts=obmc-chassis-poweron@0.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/env ampere_power_util.sh mb shutdown_ack
+SyslogIdentifier=ampere_host_shutdown_ack
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_fault_led_start@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_fault_led_start@.service
new file mode 100644
index 0000000..18ee1be
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_fault_led_start@.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Ampere Computing LLC fault event condition service
+Wants=mapper-wait@-xyz-openbmc_project-led-groups.service
+After=mapper-wait@-xyz-openbmc_project-led-groups.service
+StartLimitIntervalSec=0
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/env toggle_fault_led.sh %i on
+SyslogIdentifier=fault-led
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_fault_led_stop@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_fault_led_stop@.service
new file mode 100644
index 0000000..83f442c
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_fault_led_stop@.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Ampere Computing LLC fault event condition service
+Wants=mapper-wait@-xyz-openbmc_project-led-groups.service
+After=mapper-wait@-xyz-openbmc_project-led-groups.service
+StartLimitIntervalSec=0
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/env toggle_fault_led.sh %i off
+SyslogIdentifier=fault-led
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_hightemp_start@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_hightemp_start@.service
new file mode 100644
index 0000000..5f26194
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_hightemp_start@.service
@@ -0,0 +1,6 @@
+[Unit]
+Description=Ampere Computing LLC HighTempt event
+
+[Service]
+Restart=no
+ExecStart=/usr/bin/env ampere_add_redfishevent.sh OpenBMC.0.1.AmpereEvent.Warning "CPU%i HighTemp asserted"
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_hightemp_stop@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_hightemp_stop@.service
new file mode 100644
index 0000000..012b0dd
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_hightemp_stop@.service
@@ -0,0 +1,6 @@
+[Unit]
+Description=Ampere Computing LLC HighTempt event
+
+[Service]
+Restart=no
+ExecStart=/usr/bin/env ampere_add_redfishevent.sh OpenBMC.0.1.AmpereEvent.OK "CPU%i HighTemp deasserted"
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_overtemp@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_overtemp@.service
new file mode 100644
index 0000000..587cba1
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_overtemp@.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Ampere Computing LLC Overtemp event
+
+[Service]
+Restart=no
+ExecStart=/usr/bin/env obmcutil chassisoff
+ExecStartPost=/usr/bin/env ampere_add_redfishevent.sh OpenBMC.0.1.CPUThermalTrip.Critical %i
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_psu_reset_hotswap.sh b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_psu_reset_hotswap.sh
new file mode 100755
index 0000000..3ff3e1f
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_psu_reset_hotswap.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+# When system only use single PSU ( ex : PSU1 ) to power ON normal 12V,
+# HSC2 will be trigged Fault event (FET health).
+# At this time, to plug-in PSU2 in system, PSU2 won't deliver power to
+# +12V_MB because HSC2 is protected by Fault event.
+# Due to HSC2 protected, the PSU redundancy mechanism can't be created.
+# Once PSU1 is plugged out at this moment, system will crash ( reset )
+# because +12V_MB dropped.
+
+# BMC SW work-around solution:
+# - When BMC detect event PSU is plugged in system, BMC will reset HSC
+# by disbale HOT SWAP and then enable HOT SWAP through pmbus command to clear
+# Fault event.
+
+# Note:
+# In case hot swap occurs during BMC reset, BMC still not in operation state,
+# BMC can't detect PSU plug/unplug, then the work-around won't be executed
+
+# Author: Chanh Nguyen <chnguyen@amperecomputing.com>
+
+HSC1_PMBUS_NUM=10
+HSC2_PMBUS_NUM=10
+HSC1_SLAVE_ADDR=0x10
+HSC2_SLAVE_ADDR=0x11
+OPERATION=0x01
+STATUS_MFR_SPECIFIC=0x80
+
+# $1 will be the name of the psu
+PSU=$1
+
+if [ "$PSU" = 0 ]; then
+ HSC_PMBUS_NUM=$HSC1_PMBUS_NUM
+ HSC_SLAVE_ADDR=$HSC1_SLAVE_ADDR
+elif [ "$PSU" = 1 ]; then
+ HSC_PMBUS_NUM=$HSC2_PMBUS_NUM
+ HSC_SLAVE_ADDR=$HSC2_SLAVE_ADDR
+else
+ echo "Please choose PSU1 (0) or PSU2 (1)"
+ echo "Ex: ampere_psu_reset_hotswap.sh 0"
+ exit 0
+fi
+
+# Check HOST state
+chassisstate=$(obmcutil chassisstate | awk -F. '{print $NF}')
+if [ "$chassisstate" = 'Off' ]; then
+ echo "HOST is being OFF, so can't access the i2c $HSC_PMBUS_NUM. Please Turn ON HOST !"
+ exit 1
+fi
+
+# Check FET health problems
+if ! data=$(i2cget -f -y $HSC_PMBUS_NUM $HSC_SLAVE_ADDR $STATUS_MFR_SPECIFIC); then
+ echo "ERROR: Can't access the i2c. Please check /dev/i2c-$HSC_PMBUS_NUM"
+ exit 1
+fi
+
+psu_sts=$(((data & 0x80) != 0))
+
+if [ $psu_sts = 1 ]; then
+ echo "PSU $PSU: FET health problems have been detected"
+ echo "Reset Hot swap output on PSU $PSU"
+ # Disable Hot swap output
+ write_data=0x00
+ i2cset -f -y $HSC_PMBUS_NUM $HSC_SLAVE_ADDR $OPERATION $write_data b
+
+ # Enable Hot swap output
+ write_data=0x80;
+ i2cset -f -y $HSC_PMBUS_NUM $HSC_SLAVE_ADDR $OPERATION $write_data b
+
+else
+ echo "PSU $PSU: FET health problems have not been detected"
+fi
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_scp_failover.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_scp_failover.service
new file mode 100644
index 0000000..ff4dec5
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_scp_failover.service
@@ -0,0 +1,6 @@
+[Unit]
+Description=Ampere Computing LLC Ampere failover event service
+
+[Service]
+Restart=no
+ExecStart=/usr/bin/env ampere_scp_failover.sh
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_scp_failover.sh b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_scp_failover.sh
new file mode 100644
index 0000000..56319a3
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/ampere_scp_failover.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+# Handle the SCP Failover feature in which:
+# - If the BMC receives the SCP_AUTH_FAILURE signal from Socket0,
+# attempts to boot from the failover boot EEPROM.
+# - If the second boot fails, treats this as a permanent boot failure
+# and logs an event in SEL.
+
+# shellcheck disable=SC1091
+source /usr/sbin/gpio-lib.sh
+source /usr/sbin/gpio-defs.sh
+
+# Check the I2C_BACKUP_SEL
+I2C_BACKUP_SEL=$(gpio_get_val "$BMC_I2C_BACKUP_SEL")
+if [ "${I2C_BACKUP_SEL}" == "1" ]; then
+ # If it is HIGH, set it LOW. Then reset the Host to boot from
+ # the failover Boot EEPROM.
+ echo "scp-failover: switch HOST to failover boot EEPROM"
+ gpioset "$(gpiofind BMC_SELECT_EEPROM)"=0
+
+ # Reset the Host to boot on the failover EEPROM
+ ampere_power_util.sh mb force_reset
+else
+ # Turn OFF Host as SCP firmware on both Boot EEPROM fail
+ obmcutil chassisoff
+
+ echo "scp-failover: switch HOST back to the main Boot EEPROM"
+ gpioset "$(gpiofind BMC_SELECT_EEPROM)"=1
+
+ # Log event
+ ampere_add_redfishevent.sh OpenBMC.0.1.GeneralFirmwareSecurityViolation.Critical "SCP Authentication failure"
+fi
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/id-button-pressed.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/id-button-pressed.service
new file mode 100644
index 0000000..f633fc3
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/id-button-pressed.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=ID Button Pressed Service
+Wants=mapper-wait@-xyz-openbmc_project-led-groups.service
+After=mapper-wait@-xyz-openbmc_project-led-groups.service
+StartLimitIntervalSec=0
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/env toggle_identify_led.sh
+SyslogIdentifier=id-button
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/PSU1_VIN_GOOD b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/PSU1_VIN_GOOD
new file mode 100644
index 0000000..cf13085
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/PSU1_VIN_GOOD
@@ -0,0 +1,4 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=60
+POLARITY=0
+TARGET=psu_hotswap_reset@0.service
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/PSU2_VIN_GOOD b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/PSU2_VIN_GOOD
new file mode 100644
index 0000000..7588c25
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/PSU2_VIN_GOOD
@@ -0,0 +1,4 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=61
+POLARITY=0
+TARGET=psu_hotswap_reset@1.service
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_fault_alert_start b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_fault_alert_start
new file mode 100644
index 0000000..c13da44
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_fault_alert_start
@@ -0,0 +1,5 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=73
+POLARITY=1
+TARGET=ampere_fault_led_start@0.service
+EXTRA_ARGS=--continue
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_fault_alert_stop b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_fault_alert_stop
new file mode 100644
index 0000000..7233f88
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_fault_alert_stop
@@ -0,0 +1,5 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=73
+POLARITY=0
+TARGET=ampere_fault_led_stop@0.service
+EXTRA_ARGS=--continue
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_hightemp_start b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_hightemp_start
new file mode 100644
index 0000000..44dc221
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_hightemp_start
@@ -0,0 +1,4 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=72
+POLARITY=1
+TARGET=ampere_hightemp_start@0.service
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_hightemp_stop b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_hightemp_stop
new file mode 100644
index 0000000..ccd0519
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_hightemp_stop
@@ -0,0 +1,4 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=72
+POLARITY=0
+TARGET=ampere_hightemp_stop@0.service
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_overtemp b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_overtemp
new file mode 100644
index 0000000..e39e196
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_overtemp
@@ -0,0 +1,4 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=51
+POLARITY=1
+TARGET=ampere_overtemp@0.service
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_scp_auth_failure b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_scp_auth_failure
new file mode 100644
index 0000000..e8e975f
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S0_scp_auth_failure
@@ -0,0 +1,4 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=74
+POLARITY=1
+TARGET=ampere_scp_failover.service
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_fault_alert_start b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_fault_alert_start
new file mode 100644
index 0000000..6fa4785
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_fault_alert_start
@@ -0,0 +1,5 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=201
+POLARITY=1
+TARGET=ampere_fault_led_start@1.service
+EXTRA_ARGS=--continue
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_fault_alert_stop b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_fault_alert_stop
new file mode 100644
index 0000000..36b29ec
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_fault_alert_stop
@@ -0,0 +1,5 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=201
+POLARITY=0
+TARGET=ampere_fault_led_stop@1.service
+EXTRA_ARGS=--continue
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_hightemp_start b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_hightemp_start
new file mode 100644
index 0000000..901eb00
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_hightemp_start
@@ -0,0 +1,4 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=216
+POLARITY=1
+TARGET=ampere_hightemp_start@1.service
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_hightemp_stop b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_hightemp_stop
new file mode 100644
index 0000000..f1b4cc1
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_hightemp_stop
@@ -0,0 +1,4 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=216
+POLARITY=0
+TARGET=ampere_hightemp_start@1.service
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_overtemp b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_overtemp
new file mode 100644
index 0000000..c7bb8c1
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/S1_overtemp
@@ -0,0 +1,4 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=206
+POLARITY=1
+TARGET=ampere_overtemp@1.service
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/id_button b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/id_button
new file mode 100644
index 0000000..70e2b58
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/id_button
@@ -0,0 +1,5 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=133
+POLARITY=1
+TARGET=id-button-pressed.service
+EXTRA_ARGS=--continue
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/reboot_ack b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/reboot_ack
new file mode 100644
index 0000000..a8ad98e
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/reboot_ack
@@ -0,0 +1,4 @@
+DEVPATH=/dev/input/event0
+KEY=75
+POLARITY=1
+TARGET=obmc-host-force-warm-reboot@0.target
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/shutdown_ack b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/shutdown_ack
new file mode 100644
index 0000000..18cc872
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/obmc/gpio/shutdown_ack
@@ -0,0 +1,4 @@
+DEVPATH=/dev/input/event0
+KEY=50
+POLARITY=1
+TARGET=ampere-host-shutdown-ack@0.service
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/psu_hotswap_reset@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/psu_hotswap_reset@.service
new file mode 100644
index 0000000..357cc05
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/psu_hotswap_reset@.service
@@ -0,0 +1,6 @@
+[Unit]
+Description=Ampere Computing LLC PSU1 reset hotswap
+
+[Service]
+Restart=no
+ExecStart=/usr/sbin/ampere_psu_reset_hotswap.sh %i
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/toggle_fault_led.sh b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/toggle_fault_led.sh
new file mode 100644
index 0000000..58aa47f
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/toggle_fault_led.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# Toggle the state of identify LED Group
+
+socket=$1
+isOn=$2
+
+# Create /tmp/fault* file
+if [ "$isOn" == "on" ]; then
+ touch /tmp/fault"$socket"
+else
+ rm /tmp/fault"$socket"
+fi
+
+# Set Fault Led state
+if [[ -f /tmp/fault0 ]] || [[ -f /tmp/fault1 ]]; then
+ target='true'
+else
+ target='false'
+fi
+
+SERVICE="xyz.openbmc_project.LED.GroupManager"
+INTERFACE="xyz.openbmc_project.Led.Group"
+PROPERTY="Asserted"
+
+# Get current state
+object=$(busctl tree $SERVICE --list | grep system_fault)
+
+# Set target state
+busctl set-property $SERVICE "$object" $INTERFACE $PROPERTY b $target
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/toggle_identify_led.sh b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/toggle_identify_led.sh
new file mode 100755
index 0000000..f6eae0e
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/ampere-gpio-handling/toggle_identify_led.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# Toggle the state of identify LED Group
+
+SERVICE="xyz.openbmc_project.LED.GroupManager"
+INTERFACE="xyz.openbmc_project.Led.Group"
+PROPERTY="Asserted"
+
+# Get enclosure_identify state
+identify_object=$(busctl tree $SERVICE --list | grep -m 1 identify)
+identify_state=$(busctl get-property $SERVICE "$identify_object" $INTERFACE $PROPERTY \
+ | awk '{print $NF;}')
+
+# Get enclosure_identify_blink state
+identify_blink_object=$(busctl tree $SERVICE --list | grep identify_blink)
+identify_blink_state=$(busctl get-property $SERVICE "$identify_blink_object" $INTERFACE $PROPERTY \
+ | awk '{print $NF;}')
+
+# Set state
+if [ "$identify_state" = "false" ] && [ "$identify_blink_state" = "false" ]; then
+ # Turn on the UID LED
+ busctl set-property $SERVICE "$identify_object" $INTERFACE $PROPERTY b true
+elif [ "$identify_state" = "false" ] && [ "$identify_blink_state" = "true" ]; then
+ # Turn off the UID LED when LED is blinking state
+ busctl set-property $SERVICE "$identify_blink_object" $INTERFACE $PROPERTY b false
+elif [ "$identify_state" = "true" ] && [ "$identify_blink_state" = "false" ]; then
+ # Turn off the UID LED
+ busctl set-property $SERVICE "$identify_object" $INTERFACE $PROPERTY b false
+else
+ echo "Invalid case! When identify_blink_state is true, the identify_state will set to false"
+fi