Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions dockers/docker-platform-monitor/start.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ if [ -e /usr/share/sonic/platform/fancontrol ]; then
supervisorctl start fancontrol
fi


# If the sonic-platform package is not installed, try to install it
pip show sonic-platform > /dev/null 2>&1
if [ $? -ne 0 ]; then
SONIC_PLATFORM_WHEEL="/usr/share/sonic/platform/sonic_platform-1.0-py2-none-any.whl"
echo "sonic-platform package not installed, attempting to install..."
if [ -e ${SONIC_PLATFORM_WHEEL} ]; then
pip install ${SONIC_PLATFORM_WHEEL}
if [ $? -eq 0 ]; then
echo "Successfully installed ${SONIC_PLATFORM_WHEEL}"
else
echo "Error: Failed to install ${SONIC_PLATFORM_WHEEL}"
fi
else
echo "Error: Unable to locate ${SONIC_PLATFORM_WHEEL}"
fi
fi

{% if not skip_ledd %}
supervisorctl start ledd
{% endif %}
Expand Down
10 changes: 10 additions & 0 deletions files/image_config/platform/rc.local
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,16 @@ if [ -f $FIRST_BOOT_FILE ]; then
touch /tmp/pending_config_initialization
fi

# Notify firstboot to Platform, to use it for reboot-cause
touch /tmp/notify_firstboot_to_platform

# create reboot-cause/platform/$platform/ directory
# /host/reboot-cause/platform/reboot-reason
# will be used to track last reboot reason
if [ ! -d /host/reboot-cause/platform ]; then
mkdir -p /host/reboot-cause/platform
fi

if [ -d /host/image-$SONIC_VERSION/platform/$platform ]; then
dpkg -i /host/image-$SONIC_VERSION/platform/$platform/*.deb
fi
Expand Down
16 changes: 13 additions & 3 deletions platform/broadcom/platform-modules-dell.mk
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
# Dell Z9100, S6100, Z9264F Platform modules
# Dell S6000, Z9100, S6100, Z9264F Platform modules

DELL_Z9264F_PLATFORM_MODULE_VERSION = 1.1
DELL_S6000_PLATFORM_MODULE_VERSION = 1.1
DELL_Z9100_PLATFORM_MODULE_VERSION = 1.1
DELL_S6100_PLATFORM_MODULE_VERSION = 1.1
DELL_Z9264F_PLATFORM_MODULE_VERSION = 1.1

export DELL_Z9264F_PLATFORM_MODULE_VERSION
export DELL_S6000_PLATFORM_MODULE_VERSION
export DELL_Z9100_PLATFORM_MODULE_VERSION
export DELL_S6100_PLATFORM_MODULE_VERSION
export DELL_Z9264F_PLATFORM_MODULE_VERSION


# Dell Z9100 Platform modules
DELL_Z9100_PLATFORM_MODULE = platform-modules-z9100_$(DELL_Z9100_PLATFORM_MODULE_VERSION)_amd64.deb
$(DELL_Z9100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-dell
$(DELL_Z9100_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
$(DELL_Z9100_PLATFORM_MODULE)_PLATFORM = x86_64-dell_z9100_c2538-r0
SONIC_DPKG_DEBS += $(DELL_Z9100_PLATFORM_MODULE)

# Dell S6100 Platform modules
DELL_S6100_PLATFORM_MODULE = platform-modules-s6100_$(DELL_S6100_PLATFORM_MODULE_VERSION)_amd64.deb
$(DELL_S6100_PLATFORM_MODULE)_PLATFORM = x86_64-dell_s6100_c2538-r0
$(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S6100_PLATFORM_MODULE)))

# Dell Z9264F Platform modules
DELL_Z9264F_PLATFORM_MODULE = platform-modules-z9264f_$(DELL_Z9264F_PLATFORM_MODULE_VERSION)_amd64.deb
$(DELL_Z9264F_PLATFORM_MODULE)_PLATFORM = x86_64-dellemc_z9264f_c3538-r0
$(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_Z9264F_PLATFORM_MODULE)))

# Dell S6000 Platform modules
DELL_S6000_PLATFORM_MODULE = platform-modules-s6000_$(DELL_S6000_PLATFORM_MODULE_VERSION)_amd64.deb
$(DELL_S6000_PLATFORM_MODULE)_PLATFORM = x86_64-dell_s6000_s1220-r0
$(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S6000_PLATFORM_MODULE)))

SONIC_STRETCH_DEBS += $(DELL_Z9100_PLATFORM_MODULE)
13 changes: 0 additions & 13 deletions platform/broadcom/platform-modules-s6000.mk

This file was deleted.

1 change: 0 additions & 1 deletion platform/broadcom/rules.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
include $(PLATFORM_PATH)/sai-modules.mk
include $(PLATFORM_PATH)/sai.mk
include $(PLATFORM_PATH)/platform-modules-s6000.mk
include $(PLATFORM_PATH)/platform-modules-dell.mk
include $(PLATFORM_PATH)/platform-modules-arista.mk
include $(PLATFORM_PATH)/platform-modules-ingrasys.mk
Expand Down
74 changes: 73 additions & 1 deletion platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@
#define IOREGION_LENGTH 0x4
#define SMF_ADDR_REG_OFFSET 0
#define SMF_READ_DATA_REG_OFFSET 2
#define SMF_WRITE_DATA_REG_OFFSET 3
#define SMF_REG_ADDR 0x200
#define SMF_PROBE_ADDR 0x210
#define SMF_POR_SRC_REG 0x209
#define SMF_RST_SRC_REG 0x20A
#define SMF_PROBE_ADDR 0x210

#define SIO_REG_DEVID 0x1
#define SIO_Z9100_ID 0x1
Expand Down Expand Up @@ -150,6 +152,8 @@
#define CPU_7_MONITOR_STATUS 0x02E8
#define CPU_8_MONITOR_STATUS 0x02E9

/* Mailbox PowerOn Reason */
#define TRACK_POWERON_REASON 0x05FF

unsigned long *mmio;
static struct kobject *dell_kobj;
Expand Down Expand Up @@ -440,6 +444,18 @@ struct smf_sio_data {
enum kinds kind;
};

static int smf_write_reg(struct smf_data *data, u16 reg, u16 dev_data)
{
int res = 0;

mutex_lock(&data->lock);
outb_p(reg>> 8, data->addr + SMF_ADDR_REG_OFFSET);
outb_p(reg & 0xff, data->addr + SMF_ADDR_REG_OFFSET + 1);
outb_p(dev_data & 0xff, data->addr + SMF_WRITE_DATA_REG_OFFSET);
mutex_unlock(&data->lock);

return res;
}

static int smf_read_reg(struct smf_data *data, u16 reg)
{
Expand Down Expand Up @@ -519,6 +535,53 @@ static ssize_t show_reset_reason(struct device *dev,
return sprintf(buf, "%x\n", ret);
}

/* SMF Power ON Reason */
static ssize_t show_power_on_reason(struct device *dev,
struct device_attribute *devattr, char *buf)
{
unsigned int ret = 0;

ret = inb(SMF_POR_SRC_REG);

if(ret < 0)
return ret;

return sprintf(buf, "%x\n", ret);
}

/* SMF Mailbox Power ON Reason */
static ssize_t set_mb_poweron_reason(struct device *dev,
struct device_attribute *devattr, const char *buf, size_t count)
{
int err = 0;
unsigned int dev_data = 0;
struct smf_data *data = dev_get_drvdata(dev);

err = kstrtouint(buf, 16, &dev_data);
if (err)
return err;

err = smf_write_reg(data, TRACK_POWERON_REASON, dev_data);

if(err < 0)
return err;

return count;
}

static ssize_t show_mb_poweron_reason(struct device *dev,
struct device_attribute *devattr, char *buf)
{
unsigned int ret = 0;
struct smf_data *data = dev_get_drvdata(dev);

ret = smf_read_reg(data, TRACK_POWERON_REASON);

if(ret < 0)
return ret;

return sprintf(buf, "0x%x\n", ret);
}

/* FANIN ATTR */
static ssize_t
Expand Down Expand Up @@ -1800,11 +1863,20 @@ static SENSOR_DEVICE_ATTR(smf_firmware_ver, S_IRUGO, show_smf_version, NULL, 1);
/* SMF Reset Reason */
static SENSOR_DEVICE_ATTR(smf_reset_reason, S_IRUGO, show_reset_reason, NULL, 1);

/* SMF PowerOn Reason */
static SENSOR_DEVICE_ATTR(smf_poweron_reason, S_IRUGO,
show_power_on_reason, NULL, 1);

/* Mailbox Power tracking Reason */
static SENSOR_DEVICE_ATTR(mb_poweron_reason, S_IRUGO|S_IWUSR,
show_mb_poweron_reason, set_mb_poweron_reason, 0);

static struct attribute *smf_dell_attrs[] = {
&sensor_dev_attr_smf_version.dev_attr.attr,
&sensor_dev_attr_smf_firmware_ver.dev_attr.attr,
&sensor_dev_attr_smf_reset_reason.dev_attr.attr,
&sensor_dev_attr_smf_poweron_reason.dev_attr.attr,
&sensor_dev_attr_mb_poweron_reason.dev_attr.attr,
&sensor_dev_attr_fan_tray_presence.dev_attr.attr,
&sensor_dev_attr_fan1_airflow.dev_attr.attr,
&sensor_dev_attr_fan3_airflow.dev_attr.attr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
import sys
import os
import struct
import subprocess

PORT_RES = '/dev/port'

def track_reboot():
# Run plugin script which will track the cli triggered reboot, fastboot, warmboot
res = subprocess.check_output(['/usr/local/bin/fastboot_plugin'])
return

def portio_reg_write(resource, offset, val):
fd = os.open(resource, os.O_RDWR)
Expand All @@ -21,5 +26,6 @@ def portio_reg_write(resource, offset, val):
os.close(fd)

if __name__ == "__main__":
track_reboot()
portio_reg_write(PORT_RES, 0xcf9, 0xe)

6 changes: 5 additions & 1 deletion platform/broadcom/sonic-platform-modules-dell/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Maintainer: Dell Team <[email protected]>
Build-Depends: debhelper (>= 8.0.0), bzip2
Standards-Version: 3.9.3

Package: platform-modules-z9264f
Package: platform-modules-s6000
Architecture: amd64
Depends: linux-image-4.9.0-9-2-amd64
Description: kernel modules for platform devices such as fan, led, sfp
Expand All @@ -20,3 +20,7 @@ Architecture: amd64
Depends: linux-image-4.9.0-9-2-amd64
Description: kernel modules for platform devices such as fan, led, sfp

Package: platform-modules-z9264f
Architecture: amd64
Depends: linux-image-4.9.0-9-2-amd64
Description: kernel modules for platform devices such as fan, led, sfp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

### BEGIN INIT INFO
# Provides: setup-board
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Setup S6000 board.
### END INIT INFO

case "$1" in
start)
echo -n "Setting up board... "

/usr/local/bin/s6000_platform.sh init

echo "done."
;;

stop)
/usr/local/bin/s6000_platform.sh deinit
echo "done."

;;

force-reload|restart)
echo "Not supported"
;;

*)
echo "Usage: /etc/init.d/platform-modules-s6000.init {start|stop}"
exit 1
;;
esac

exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
s6000/scripts/s6000_platform.sh usr/local/bin
s6000/scripts/reset-qsfp usr/local/bin
s6000/scripts/set-fan-speed usr/local/bin
s6000/systemd/platform-modules-s6000.service etc/systemd/system
common/io_rd_wr.py usr/local/bin
s6000/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_s6000_s1220-r0
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# postinst script for S6000

# Enable Dell-S6000-platform-service
depmod -a
systemctl enable platform-modules-s6000.service
systemctl start platform-modules-s6000.service
#DEBHELPER#
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ s6100/scripts/s6100_platform.sh usr/local/bin
common/dell_i2c_utils.sh usr/local/bin
common/io_rd_wr.py usr/local/bin
common/platform_reboot usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/fastboot_plugin usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/fastboot_plugin usr/local/bin
s6100/scripts/track_reboot_reason.sh usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/platform_sensors.py usr/local/bin
s6100/scripts/sensors usr/bin
s6100/systemd/platform-modules-s6100.service etc/systemd/system
s6100/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ z9100/scripts/z9100_platform.sh usr/local/bin
common/dell_i2c_utils.sh usr/local/bin
common/io_rd_wr.py usr/local/bin
common/platform_reboot usr/share/sonic/device/x86_64-dell_z9100_c2538-r0
z9100/scripts/fastboot_plugin usr/share/sonic/device/x86_64-dell_z9100_c2538-r0
z9100/scripts/fastboot_plugin usr/local/bin
z9100/scripts/track_reboot_reason.sh usr/share/sonic/device/x86_64-dell_z9100_c2538-r0
z9100/scripts/platform_sensors.py usr/local/bin
z9100/scripts/z9100_qsfp_monitor.py usr/local/bin
z9100/scripts/z9100_preemp_db.py usr/local/bin
z9100/scripts/qsfp_monitor usr/local/bin
z9100/scripts/sensors usr/bin
z9100/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_z9100_c2538-r0
z9100/cfg/z9100-modules.conf etc/modules-load.d
z9100/systemd/platform-modules-z9100.service etc/systemd/system
z9100/systemd/z9100-qsfp-monitor.service etc/systemd/system
26 changes: 25 additions & 1 deletion platform/broadcom/sonic-platform-modules-dell/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export INSTALL_MOD_DIR:=extra
KVERSION ?= $(shell uname -r)
KERNEL_SRC := /lib/modules/$(KVERSION)
MOD_SRC_DIR:= $(shell pwd)
MODULE_DIRS:= s6100 z9100 z9264f
MODULE_DIRS:= s6000 z9100 s6100 z9264f
COMMON_DIR := common

%:
Expand All @@ -16,9 +16,19 @@ override_dh_auto_build:
if [ $$mod = "s6100" ]; then \
cp $(COMMON_DIR)/dell_pmc.c $(MOD_SRC_DIR)/$${mod}/modules/dell_s6100_lpc.c; \
cp $(COMMON_DIR)/dell_ich.c $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \
cd $(MOD_SRC_DIR)/$${mod}; \
python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
cd $(MOD_SRC_DIR); \
elif [ $$mod = "z9100" ]; then \
cp $(COMMON_DIR)/dell_pmc.c $(MOD_SRC_DIR)/$${mod}/modules/dell_mailbox.c; \
cp $(COMMON_DIR)/dell_ich.c $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \
cd $(MOD_SRC_DIR)/$${mod}; \
python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
cd $(MOD_SRC_DIR); \
elif [ $$mod = "s6000" ]; then \
cd $(MOD_SRC_DIR)/$${mod}; \
python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
cd $(MOD_SRC_DIR); \
fi; \
echo "making man page alias $$mod -> $$mod APIs";\
make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \
Expand All @@ -30,6 +40,10 @@ override_dh_auto_install:
$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
cp $(MOD_SRC_DIR)/$${mod}/modules/*.ko \
debian/platform-modules-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
if [ $$mod = "s6000" ]; then \
dh_installdirs -pplatform-modules-$${mod} usr/local/bin ; \
cp -r $(MOD_SRC_DIR)/$${mod}/scripts/* debian/platform-modules-$${mod}/usr/local/bin; \
fi; \
done)

override_dh_usrlocal:
Expand All @@ -40,9 +54,19 @@ override_dh_clean:
if [ $$mod = "s6100" ]; then \
rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_s6100_lpc.c; \
rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \
rm -f $(MOD_SRC_DIR)/$${mod}/modules/*.whl; \
rm -rf $(MOD_SRC_DIR)/$${mod}/build; \
rm -rf $(MOD_SRC_DIR)/$${mod}/build/*.egg-info; \
elif [ $$mod = "z9100" ]; then \
rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_mailbox.c; \
rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \
rm -f $(MOD_SRC_DIR)/$${mod}/modules/*.whl; \
rm -rf $(MOD_SRC_DIR)/$${mod}/build; \
rm -rf $(MOD_SRC_DIR)/$${mod}/build/*.egg-info; \
elif [ $$mod = "s6000" ]; then \
rm -f $(MOD_SRC_DIR)/$${mod}/modules/*.whl; \
rm -rf $(MOD_SRC_DIR)/$${mod}/build; \
rm -rf $(MOD_SRC_DIR)/$${mod}/build/*.egg-info; \
fi; \
make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \
done)
Expand Down
Loading