Merge branch 'master' of github.com:opencomputeproject/OpenNetworkLinux into roth_uefi

This commit is contained in:
Carl D. Roth
2017-08-24 17:31:25 -07:00
57 changed files with 1329 additions and 459 deletions

3
.gitmodules vendored
View File

@@ -16,3 +16,6 @@
[submodule "packages/platforms-closed"]
path = packages/platforms-closed
url = git@github.com:opennetworklinux/platforms-closed
[submodule "sm/build-artifacts"]
path = sm/build-artifacts
url = git@github.com:opennetworklinux/build-artifacts

View File

@@ -26,6 +26,7 @@ $(foreach a,$(ALL_ARCHES),$(eval $(call build_arch_template,$(a))))
# Available build architectures based on the current suite
BUILD_ARCHES_wheezy := amd64 powerpc
BUILD_ARCHES_jessie := $(ALL_ARCHES)
BUILD_ARCHES_stretch := amd64
# Build available architectures by default.
.DEFAULT_GOAL := all

1
REPO/stretch/Makefile Normal file
View File

@@ -0,0 +1 @@
include $(ONL)/make/repo-suite.mk

View File

@@ -0,0 +1 @@
include $(ONL)/make/repo.mk

View File

@@ -0,0 +1 @@
include $(ONL)/make/repo.mk

View File

@@ -0,0 +1 @@
include $(ONL)/make/repo.mk

View File

@@ -0,0 +1 @@
include $(ONL)/make/repo.mk

View File

@@ -0,0 +1 @@
include $(ONL)/make/repo.mk

View File

@@ -0,0 +1,79 @@
############################################################
#
# Common Release Packages for all systems.
#
############################################################
- base-files
- sysvinit-core
- locales
- python
- apt
- apt-utils
- procps
- net-tools
- iputils-ping
- less
- sudo
- openssh-server
- iproute
- resolvconf
- vim-tiny
- zile
- nano
- lsof
- mingetty
- traceroute
- realpath
- rsyslog
- nfs-common
- netbase
- bsdmainutils
- ifupdown
- psmisc
- make
- python-cherrypy3
- python-tz
- scapy
- python-pypcap
- snmpd
- snmp
- pciutils
- usbutils
- mtd-utils
- i2c-tools
- isc-dhcp-client
- ntp
- wget
- ethtool
- localepurge
- telnetd
- python-pyinotify
- cpio
- util-linux
- dosfstools
- rssh
- u-boot-tools
- ntpdate
- onlp
- parted
- watchdog
- netplug
- binutils
- file
- smartmontools
- realpath
- iptables
- onl-faultd
- onlp-snmpd
- oom-shim
- python-parted
- python-yaml
- bzip2
- xz-utils
- unzip
- onl-mibs
- openssl
- gdb
- tcpdump
- strace
- sysstat

View File

@@ -0,0 +1,13 @@
############################################################
#
# Common packages for all amd64 systems.
#
############################################################
- dmidecode
- parted
- smartmontools
- grub2
- onl-upgrade
- hw-management
- sx-kernel
- onl-kernel-3.16-lts-x86-64-all-modules

View File

@@ -0,0 +1,11 @@
############################################################
#
# These packages are specific to the ONL root filesystem build.
#
############################################################
- onl-upgrade

View File

@@ -0,0 +1 @@
- u-boot-tools

View File

@@ -0,0 +1,9 @@
############################################################
#
# These packages are specific to the ONL root filesystem build.
#
############################################################
- onl-loader-fit

View File

@@ -0,0 +1 @@
- u-boot-tools

View File

@@ -0,0 +1,9 @@
############################################################
#
# These packages are specific to the ONL root filesystem build.
#
############################################################
- onl-loader-fit

View File

@@ -0,0 +1 @@
0.0 0 0.0

View File

@@ -0,0 +1,6 @@
jffs2
ubifs
vfat
ext4
ext3
ext2

View File

@@ -0,0 +1,3 @@
telnet stream tcp nowait telnetd /usr/sbin/tcpd /usr/sbin/in.telnetd
qotd stream tcp nowait telnetd /usr/sbin/tcpd /sbin/versiond

View File

@@ -0,0 +1,67 @@
# The default runlevel.
id:2:initdefault:
# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si0::sysinit:/etc/boot.d/boot
si1::sysinit:/etc/init.d/rcS
# What to do in single-user mode.
~~:S:wait:/sbin/sulogin
# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
# Action on special keypress (ALT-UpArrow).
#kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work."
# What to do when the power fails/returns.
pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
# <id>:<runlevels>:<action>:<process>
#
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6
# Example how to put a getty on a serial line (for a terminal)
#
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
# Example how to put a getty on a modem line.
#
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3

View File

@@ -0,0 +1,19 @@
mounts:
ONL-IMAGES:
mount: ro
dir: /mnt/onl/images
fsck: true
ONL-DATA:
mount: rw
dir: /mnt/onl/data
ONL-CONFIG:
mount: ro
dir: /mnt/onl/config
fsck: true
ONL-BOOT:
mount: ro
dir: /mnt/onl/boot
fsck: false

View File

@@ -0,0 +1,7 @@
############################################################
#
# Add platform specific directories to path.
#
############################################################
dir=/lib/platform-config/current/onl
export PATH="$PATH:$dir/bin:$dir/sbin:$dir/lib/bin:$dir/lib/sbin"

View File

@@ -0,0 +1,4 @@
logfacility = LOG_USER
allowsftp
allowscp
umask = 022

View File

@@ -0,0 +1,195 @@
###############################################################################
#
# EXAMPLE.conf:
# An example configuration file for configuring the Net-SNMP agent ('snmpd')
# See the 'snmpd.conf(5)' man page for details
#
# Some entries are deliberately commented out, and will need to be explicitly activated
#
###############################################################################
#
# AGENT BEHAVIOUR
#
# Listen for connections from the local system only
# agentAddress udp:127.0.0.1:161
# Listen for connections on all interfaces (both IPv4 *and* IPv6)
agentAddress udp:161,udp6:[::1]:161
###############################################################################
#
# SNMPv3 AUTHENTICATION
#
# Note that these particular settings don't actually belong here.
# They should be copied to the file /var/lib/snmp/snmpd.conf
# and the passwords changed, before being uncommented in that file *only*.
# Then restart the agent
# createUser authOnlyUser MD5 "remember to change this password"
# createUser authPrivUser SHA "remember to change this one too" DES
# createUser internalUser MD5 "this is only ever used internally, but still change the password"
# If you also change the usernames (which might be sensible),
# then remember to update the other occurances in this example config file to match.
###############################################################################
#
# ACCESS CONTROL
#
# system + hrSystem groups only
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
view systemonly included .1.3.6.1.4.1.42623
# Full access from the local host
rocommunity public localhost
# Default access to basic system info
rocommunity public default -V systemonly
# rocommunity6 is for IPv6
rocommunity6 public default -V systemonly
# Full access from an example network
# Adjust this network address to match your local
# settings, change the community string,
# and check the 'agentAddress' setting above
#rocommunity secret 10.0.0.0/16
# Full read-only access for SNMPv3
rouser authOnlyUser
# Full write access for encrypted requests
# Remember to activate the 'createUser' lines above
#rwuser authPrivUser priv
# It's no longer typically necessary to use the full 'com2sec/group/access' configuration
# r[ow]user and r[ow]community, together with suitable views, should cover most requirements
###############################################################################
#
# SYSTEM INFORMATION
#
# Note that setting these values here, results in the corresponding MIB objects being 'read-only'
# See snmpd.conf(5) for more details
sysLocation Sitting on the Dock of the Bay
sysContact Me <me@example.org>
# Application + End-to-End layers
sysServices 72
#
# Process Monitoring
#
# At least one 'mountd' process
proc mountd
# No more than 4 'ntalkd' processes - 0 is OK
proc ntalkd 4
# At least one 'sendmail' process, but no more than 10
proc sendmail 10 1
# Walk the UCD-SNMP-MIB::prTable to see the resulting output
# Note that this table will be empty if there are no "proc" entries in the snmpd.conf file
#
# Disk Monitoring
#
# 10MBs required on root disk, 5% free on /var, 10% free on all other disks
disk / 10000
disk /var 5%
includeAllDisks 10%
# Walk the UCD-SNMP-MIB::dskTable to see the resulting output
# Note that this table will be empty if there are no "disk" entries in the snmpd.conf file
#
# System Load
#
# Unacceptable 1-, 5-, and 15-minute load averages
load 12 10 5
# Walk the UCD-SNMP-MIB::laTable to see the resulting output
# Note that this table *will* be populated, even without a "load" entry in the snmpd.conf file
###############################################################################
#
# ACTIVE MONITORING
#
# send SNMPv1 traps
trapsink localhost public
# send SNMPv2c traps
#trap2sink localhost public
# send SNMPv2c INFORMs
#informsink localhost public
# Note that you typically only want *one* of these three lines
# Uncommenting two (or all three) will result in multiple copies of each notification.
#
# Event MIB - automatically generate alerts
#
# Remember to activate the 'createUser' lines above
iquerySecName internalUser
rouser internalUser
# generate traps on UCD error conditions
defaultMonitors yes
# generate traps on linkUp/Down
linkUpDownNotifications yes
###############################################################################
#
# EXTENDING THE AGENT
#
#
# Arbitrary extension commands
#
extend test1 /bin/echo Hello, world!
extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35
#extend-sh test3 /bin/sh /tmp/shtest
# Note that this last entry requires the script '/tmp/shtest' to be created first,
# containing the same three shell commands, before the line is uncommented
# Walk the NET-SNMP-EXTEND-MIB tables (nsExtendConfigTable, nsExtendOutput1Table
# and nsExtendOutput2Table) to see the resulting output
# Note that the "extend" directive supercedes the previous "exec" and "sh" directives
# However, walking the UCD-SNMP-MIB::extTable should still returns the same output,
# as well as the fuller results in the above tables.
#
# "Pass-through" MIB extension command
#
#pass .1.3.6.1.4.1.8072.2.255 /bin/sh PREFIX/local/passtest
#pass .1.3.6.1.4.1.8072.2.255 /usr/bin/perl PREFIX/local/passtest.pl
# Note that this requires one of the two 'passtest' scripts to be installed first,
# before the appropriate line is uncommented.
# These scripts can be found in the 'local' directory of the source distribution,
# and are not installed automatically.
# Walk the NET-SNMP-PASS-MIB::netSnmpPassExamples subtree to see the resulting output
#
# AgentX Sub-agents
#
# Run as an AgentX master agent
master agentx
# Listen for network connections (from localhost)
# rather than the default named socket /var/agentx/master
#agentXSocket tcp:localhost:705

View File

@@ -0,0 +1 @@
SUBSYSTEM=="block", RUN+="/sbin/initblockdev $kernel $env{ACTION}"

View File

@@ -0,0 +1 @@
SUBSYSTEM=="net", RUN+="/sbin/initnetdev $kernel $env{ACTION}"

View File

@@ -0,0 +1,23 @@
#!/bin/sh
t=/dev/$1
# if $1 is not set, use linux cmdline console as default tty
[ -z "$1" ] && {
tty=$(/bin/sed 's/.*console=\([^,]*\).*/\1/' /proc/cmdline)
t=/dev/$tty
}
# Reset the console tty to standard settings
/bin/stty -F $t sane pass8 -ixon -cstopb clocal
# Kill any processes with the console tty open before starting a new
# login session (login tries to do this, but vhangup() spares processes
# that ignore SIGHUP)
#/usr/bin/lsof -p ^$$ -t $t 0<&- 1>&- 2>&- | /usr/bin/xargs -r /bin/kill -9
# Flush tty input and output queues
#/sbin/flushtty <$t
# We use mingetty instead of agetty, as the latter messes up the tty
# settings if it receives junk characters at the wrong speed
exec /sbin/mingetty --noclear $t

View File

@@ -0,0 +1,71 @@
#!/usr/bin/python
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.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.eclipse.org/legal/epl-v10.html
#
# 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.
#
# </bsn.cl>
############################################################
#
# watchdir
#
############################################################
import optparse, os.path, sys
import pyinotify
#pyinotify.log.setLevel(pyinotify.logging.DEBUG)
op = optparse.OptionParser( usage="%prog [OPTIONS] command")
op.add_option("-w", "--watchdir", action="append",
help="monitor watchdir for changes (may be used multiple times)")
op.add_option("--period", action="store", type="float",
help="run command at most every period sec (default=%default)")
op.add_option("-d", "--daemon", action="store_true",
help="run in background")
op.add_option("--logfile", action="store",
help="send output to logfile when running in background")
op.add_option("--pidfile", action="store",
help="write pid to pidfile when running in background")
op.set_defaults(period=0, logfile="/dev/stdout", pidfile=False)
opts, args = op.parse_args()
if not opts.watchdir:
op.error("need at least one watchdir")
os.close(0)
os.open("/dev/null", os.O_RDONLY)
wm = pyinotify.WatchManager()
n = pyinotify.Notifier(wm, read_freq=opts.period)
def handle(event):
dir = None
for d in opts.watchdir:
if os.path.commonprefix([d, event.pathname]) == d:
dir = d
sys.stdout.write("%s: %s %s\n" % (dir, event.pathname, event))
sys.stdout.flush()
if args:
os.spawnvp(os.P_WAIT, args[0],
args + [dir, event.pathname, event.maskname])
wm.add_watch(
opts.watchdir,
pyinotify.IN_ATTRIB | pyinotify.IN_CREATE | pyinotify.IN_DELETE |
pyinotify.IN_MODIFY | pyinotify.IN_MOVED_FROM | pyinotify.IN_MOVED_TO,
handle,
rec=True,
auto_add=True)
n.loop(daemonize=opts.daemon, stdout=opts.logfile, stderr=opts.logfile,
pid_file=opts.pidfile)

View File

@@ -0,0 +1,11 @@
############################################################
#
# Common packages for all PowerPC systems.
#
############################################################
- u-boot-tools

View File

@@ -0,0 +1,9 @@
############################################################
#
# These packages are specific to the ONL root filesystem build.
#
############################################################
- onl-loader-fit

View File

@@ -0,0 +1,105 @@
############################################################
#
# Standard ONL Debian 9 Root Filesystem Configuration.
#
# Requires:
# ARCH, PLATFORM_LIST
#
#
############################################################
variables:
!include $ONL/make/versions/version-onl.yml
Packages: &Packages
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/all-base-packages.yml
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/${ARCH}-base-packages.yml
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/${ARCH}-onl-packages.yml
- !script $ONL/tools/onl-platform-pkgs.py ${PLATFORM_LIST}
Multistrap:
General:
arch: ${ARCH}
cleanup: true
noauth: true
explicitsuite: false
unpack: true
debootstrap: Debian-Local Local-All Local-Arch ONL
aptsources: Debian ONL
Debian:
packages: *Packages
source: http://${DEBIAN_MIRROR}
suite: ${ONL_DEBIAN_SUITE}
keyring: debian-archive-keyring
omitdebsrc: true
Debian-Local:
packages: *Packages
source: http://${APT_CACHE}${DEBIAN_MIRROR}
suite: ${ONL_DEBIAN_SUITE}
keyring: debian-archive-keyring
omitdebsrc: true
ONL:
packages: *Packages
source: http://apt.opennetlinux.org/debian
suite: unstable
omitdebsrc: true
Local-All:
source: ${ONLPM_OPTION_REPO}/${ONL_DEBIAN_SUITE}/packages/binary-all
omitdebsrc: true
Local-Arch:
source: ${ONLPM_OPTION_REPO}/${ONL_DEBIAN_SUITE}/packages/binary-${ARCH}
omitdebsrc: true
Configure:
overlays:
- ${ONL}/builds/any/rootfs/${ONL_DEBIAN_SUITE}/common/overlay
update-rc.d:
- 'faultd defaults'
- 'onlpd defaults'
- 'snmpd defaults'
- 'onlp-snmpd defaults'
- 'ssh defaults'
- 'openbsd-inetd remove'
- 'ntp remove'
- 'nfs-common remove'
- 'rpcbind remove'
- 'motd remove'
- 'mountall-bootclean.sh remove'
- 'mountall.sh remove'
- 'checkfs.sh remove'
- 'mtab.sh remove'
- 'checkroot-bootclean.sh remove'
- 'checkroot.sh remove'
- 'mountnfs-bootclean.sh remove'
- 'mountnfs.sh remove'
- 'lm-sensors remove'
- 'netplug defaults'
- 'watchdog defaults'
- 'wd_keepalive remove'
options:
clean: True
securetty: False
ttys: False
console: True
PermitRootLogin: 'yes'
users:
root:
password: onl
manifests:
'/etc/onl/rootfs/manifest.json' :
version : $ONL/make/versions/version-onl.json
platforms : $PLATFORM_LIST
issue: $VERSION_STRING
files:
remove:
- /etc/motd

View File

@@ -0,0 +1,137 @@
FROM debian:9.1
MAINTAINER Jeff Townsend <jeffrey.townsend@bigswitch.com>
# First round of dependences
RUN apt-get update && apt-get install -y \
apt \
apt-cacher-ng \
apt-file \
apt-utils \
autoconf \
automake \
autotools-dev \
bash-completion \
bc \
bind9-host \
binfmt-support \
binfmt-support \
bison \
bsdmainutils \
build-essential \
ccache \
cdbs \
cpio \
cryptsetup-bin \
debhelper \
debhelper \
debhelper \
device-tree-compiler \
devscripts \
devscripts \
dialog \
dosfstools \
doxygen \
dpkg-sig \
emacs \
file \
flex \
gawk \
gcc \
gdb \
genisoimage \
git \
gperf \
ifupdown \
iproute \
iputils-ping \
isolinux \
kmod \
less \
libc6-dev \
libcurl4-nss-dev \
libdouble-conversion-dev \
libedit-dev \
libevent-dev \
libexpat1-dev \
libgoogle-glog-dev \
libi2c-dev \
libkrb5-dev \
libnuma-dev \
libsasl2-dev \
libsnappy-dev \
libpam-dev \
libpcap-dev \
libsnmp-dev \
libssl-dev \
libtool \
libtool-bin \
locales \
lsof \
make \
mingetty \
mtd-utils \
mtools \
multistrap \
nano \
ncurses-dev \
netbase \
net-tools \
nfs-common \
openssh-server \
pkg-config \
pkg-config \
procps \
psmisc \
python \
python-debian \
python-dnspython \
python-yaml \
qemu \
qemu-user-static \
realpath \
realpath \
rsyslog \
ruby \
ruby-dev \
rubygems \
screen \
squashfs-tools \
sshpass \
stgit \
sudo \
syslinux-utils \
telnet \
texinfo \
traceroute \
u-boot-tools \
vim-tiny \
wget \
xorriso \
zile \
zip
RUN apt-get install -y \
chrpath devscripts dh-autoreconf dh-systemd flex \
libcap-dev libc-ares-dev libjson-c-dev libpam0g-dev libpcre3-dev \
libreadline-dev libsystemd-dev pkg-config \
texlive-generic-recommended texinfo texlive-latex-base
RUN gem install --version 1.3.3 fpm
#
# The i2c-dev.h user/kernel header conflict is a nightmare.
#
# The ONLP implementation expects a new file called <linux/i2c-device.h> to be in place which contains the correct user-space driver definitions.
# This should be manually populated here after the toolchains have been installed.
#
RUN cp /usr/include/linux/i2c-dev.h /usr/include/linux/i2c-devices.h
RUN rm /etc/apt/apt.conf.d/docker-* && \
wget "https://launchpad.net/ubuntu/+source/qemu/1.4.0+dfsg-1expubuntu3/+build/4336762/+files/qemu-user-static_1.4.0%2Bdfsg-1expubuntu3_amd64.deb" && \
dpkg -i qemu-user-static_1.4.0+dfsg-1expubuntu3_amd64.deb
#
# Copy the docker shell init script to /bin
#
COPY docker_shell /bin/docker_shell
COPY container-id /bin/container-id

View File

@@ -0,0 +1,19 @@
VERSION=1.0
USER=opennetworklinux
REPO=builder9
TOOLS=../../../tools/docker_shell ../../../tools/container-id
build: check_version
cp $(TOOLS) .
docker build -t $(USER)/$(REPO):$(VERSION) .
rm -rf $(notdir $(TOOLS))
#
# Todo: Query remote repository to see if the request version already exists to avoid accidental overwrites
# when a new image is built but the VERSION variable is not updated.
#
check_version:
push:
docker push $(USER)/$(REPO):$(VERSION)

View File

@@ -19,6 +19,7 @@ g_timestamp = datetime.datetime.now().strftime("%Y-%m-%d.%H%M%S")
g_builder7_image_name="opennetworklinux/builder7:1.2"
g_builder8_image_name="opennetworklinux/builder8:1.7"
g_builder9_image_name="opennetworklinux/builder9:1.0"
g_default_image_name=g_builder8_image_name
g_default_container_name = "%s_%s" % (g_current_user, g_timestamp)
@@ -26,6 +27,9 @@ g_default_user="%s:%s" % (g_current_user, g_current_uid)
ap = argparse.ArgumentParser("ONL Docker Build")
ap.add_argument('--9', '-9',
help="Run the Debian 9 version.",
action='store_true', dest='debian9')
ap.add_argument('--8', '-8',
help="Run the Debian 8 version.",
action='store_true', dest='debian8')
@@ -117,6 +121,8 @@ if ops.debian7:
if ops.debian8:
ops.image = g_builder8_image_name
if ops.debian9:
ops.image = g_builder9_image_name
if ops.verbose or ops.dry:
logger.setLevel(logging.DEBUG)

View File

@@ -141,4 +141,7 @@ wait_link_up()
return 1
}
wait_link_up $NETDEV 100
if [ -n "${NETAUTO}" ]; then
wait_link_up $NETDEV 100
fi
return 0

View File

@@ -1,6 +1,5 @@
prerequisites:
packages:
- onl-kernel-3.2-lts-x86-64-all:amd64
- onl-kernel-3.16-lts-x86-64-all:amd64
- onl-kernel-4.9-lts-x86-64-all:amd64
- onl-loader-initrd:amd64

View File

@@ -1,8 +1,7 @@
include $(ONL)/make/config.amd64.mk
# All amd64 kernels
KERNELS := $(shell $(ONLPM) --find-file onl-kernel-3.2-lts-x86-64-all:amd64 kernel-3.2-lts-x86_64-all) \
$(shell $(ONLPM) --find-file onl-kernel-3.16-lts-x86-64-all:amd64 kernel-3.16-lts-x86_64-all) \
KERNELS := $(shell $(ONLPM) --find-file onl-kernel-3.16-lts-x86-64-all:amd64 kernel-3.16-lts-x86_64-all) \
$(shell $(ONLPM) --find-file onl-kernel-4.9-lts-x86-64-all:amd64 kernel-4.9-lts-x86_64-all)

View File

@@ -1,21 +1,21 @@
/**************************************************************************//**
* <bsn.cl fy=2013 v=onl>
*
* Copyright 2013, 2014 BigSwitch Networks, Inc.
*
*
* Copyright 2013, 2014 BigSwitch Networks, Inc.
*
* Licensed under the Eclipse Public License, Version 1.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.eclipse.org/legal/epl-v10.html
*
*
* 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.
*
*
* </bsn.cl>
*****************************************************************************/
#include <faultd/faultd_config.h>
@@ -46,157 +46,151 @@
static pthread_spinlock_t thread_lock__;
static faultd_client_t* faultd_client__ = NULL;
static faultd_client_t* faultd_client__ = NULL;
static faultd_info_t faultd_info__;
static int localfd__ = -1;
static int localfd__ = -1;
inline int signal_backtrace__(void** buffer, int size, ucontext_t* context,
int signal_backtrace__(void** buffer, int size, ucontext_t* context,
int distance)
{
#define IP_STACK_FRAME_NUMBER 3
int rv;
int rv;
rv = backtrace(buffer, size);
if(context) {
distance += IP_STACK_FRAME_NUMBER;
if(context) {
distance += IP_STACK_FRAME_NUMBER;
#ifdef __i386__
buffer[distance] = (void*)(context->uc_mcontext.gregs[REG_EIP]);
buffer[distance] = (void*)(context->uc_mcontext.gregs[REG_EIP]);
#endif
#ifdef __PPC__
buffer[distance] = (void*)(context->uc_mcontext.regs->nip);
buffer[distance] = (void*)(context->uc_mcontext.regs->nip);
#endif
/* Note -- 64bit does not require require modifications */
}
return rv;
}
#include <AIM/aim_pvs.h>
static void
}
return rv;
}
#include <AIM/aim_pvs.h>
static void
faultd_signal_handler__(int signal, siginfo_t* siginfo, void* context)
{
int rv;
int rv;
/*
* Make sure we syncronize properly with other threads that
* may *also* be faulting
*/
rv = pthread_spin_trylock(&thread_lock__);
rv = pthread_spin_trylock(&thread_lock__);
if (rv == EBUSY) {
sigset_t mask;
sigemptyset(&mask);
pselect(0, NULL, NULL, NULL, NULL, &mask);
if (rv == EBUSY) {
sigset_t mask;
sigemptyset(&mask);
pselect(0, NULL, NULL, NULL, NULL, &mask);
}
/*
* Generate our fault information.
*/
faultd_info__.pid = getpid();
faultd_info__.tid = 0;
faultd_info__.signal = signal;
faultd_info__.signal_code = siginfo->si_code;
faultd_info__.fault_address = siginfo->si_addr;
faultd_info__.last_errno = errno;
* Generate our fault information.
*/
faultd_info__.pid = getpid();
faultd_info__.tid = 0;
faultd_info__.signal = signal;
faultd_info__.signal_code = siginfo->si_code;
faultd_info__.fault_address = siginfo->si_addr;
faultd_info__.last_errno = errno;
faultd_info__.backtrace_size = signal_backtrace__(faultd_info__.backtrace,
faultd_info__.backtrace_size = signal_backtrace__(faultd_info__.backtrace,
AIM_ARRAYSIZE(faultd_info__.backtrace),
context, 0);
faultd_info__.backtrace_symbols = (void*)1;
if(faultd_client__) {
faultd_client_write(faultd_client__, &faultd_info__);
context, 0);
faultd_info__.backtrace_symbols = (void*)1;
if(faultd_client__) {
faultd_client_write(faultd_client__, &faultd_info__);
}
if(localfd__ >= 0) {
char* signame = strsignal(faultd_info__.signal);
char* nl = "\n";
write(localfd__, signame, strlen(signame)+1);
write(localfd__, nl, 2);
backtrace_symbols_fd(faultd_info__.backtrace,
faultd_info__.backtrace_size,
localfd__);
if(localfd__ >= 0) {
char* signame = strsignal(faultd_info__.signal);
char* nl = "\n";
write(localfd__, signame, strlen(signame)+1);
write(localfd__, nl, 2);
backtrace_symbols_fd(faultd_info__.backtrace,
faultd_info__.backtrace_size,
localfd__);
}
/*
/*
* Unlock spinlock, in case this signal wasn't fatal
*/
pthread_spin_unlock(&thread_lock__);
pthread_spin_unlock(&thread_lock__);
}
int
faultd_handler_register(int localfd,
const char* pipename,
faultd_handler_register(int localfd,
const char* pipename,
const char* binaryname)
{
int rv;
struct sigaction saction;
void* dummy_backtrace[1];
int dummy_backtrace_size;
int fd;
int rv;
struct sigaction saction;
void* dummy_backtrace[1];
int dummy_backtrace_size;
int fd;
if ( (rv = pthread_spin_init(&thread_lock__, 0)) ) {
return rv;
if ( (rv = pthread_spin_init(&thread_lock__, 0)) ) {
return rv;
}
/*
* These calls to backtrace are to assure that
* backtrace() and backtrace_symbols_fd() have actually
* been loaded into our process -- its possible they
/*
* These calls to backtrace are to assure that
* backtrace() and backtrace_symbols_fd() have actually
* been loaded into our process -- its possible they
* come from a dynamic library, and we don't want them
* to get loaded at fault-time.
*/
dummy_backtrace_size = backtrace(dummy_backtrace, 1);
/** Note - we could just pass an invalid descriptor here, but it
* it flags errors in valgrind.
dummy_backtrace_size = backtrace(dummy_backtrace, 1);
/** Note - we could just pass an invalid descriptor here, but it
* it flags errors in valgrind.
*/
fd = open("/dev/null", O_WRONLY);
backtrace_symbols_fd(dummy_backtrace, dummy_backtrace_size, fd);
close(fd);
fd = open("/dev/null", O_WRONLY);
backtrace_symbols_fd(dummy_backtrace, dummy_backtrace_size, fd);
close(fd);
AIM_MEMSET(&faultd_info__, 0, sizeof(faultd_info__));
if(!binaryname) {
binaryname = "Not specified.";
AIM_MEMSET(&faultd_info__, 0, sizeof(faultd_info__));
if(!binaryname) {
binaryname = "Not specified.";
}
aim_strlcpy(faultd_info__.binary, binaryname, sizeof(faultd_info__.binary));
aim_strlcpy(faultd_info__.binary, binaryname, sizeof(faultd_info__.binary));
if(pipename) {
faultd_client_create(&faultd_client__, pipename);
if(pipename) {
faultd_client_create(&faultd_client__, pipename);
}
AIM_MEMSET(&saction, 0, sizeof(saction));
saction.sa_sigaction = faultd_signal_handler__;
AIM_MEMSET(&saction, 0, sizeof(saction));
saction.sa_sigaction = faultd_signal_handler__;
sigfillset(&saction.sa_mask);
saction.sa_flags = SA_SIGINFO | SA_RESETHAND;
rv = sigaction (SIGSEGV, &saction, NULL);
sigfillset(&saction.sa_mask);
saction.sa_flags = SA_SIGINFO | SA_RESETHAND;
rv = sigaction (SIGSEGV, &saction, NULL);
rv |= sigaction (SIGILL, &saction, NULL);
rv |= sigaction (SIGFPE, &saction, NULL);
rv |= sigaction (SIGFPE, &saction, NULL);
rv |= sigaction (SIGBUS, &saction, NULL);
rv |= sigaction (SIGQUIT, &saction, NULL);
rv |= sigaction (SIGALRM, &saction, NULL);
/*
* SIGUSR2 can be used to request a backtrace explicitly.
* In this case, we don't want to reset the handler.
* SIGUSR2 can be used to request a backtrace explicitly.
* In this case, we don't want to reset the handler.
*/
saction.sa_flags = SA_SIGINFO;
rv |= sigaction (SIGUSR2, &saction, NULL);
saction.sa_flags = SA_SIGINFO;
rv |= sigaction (SIGUSR2, &saction, NULL);
/*
* The local fault handler will attempt to write a subset of
* the fault information (signal type and backtrace)
* to the localfd descriptor if specified.
* the fault information (signal type and backtrace)
* to the localfd descriptor if specified.
*/
localfd__ = localfd;
localfd__ = localfd;
return rv;
}

View File

@@ -0,0 +1,16 @@
diff -urpN a/Makefile b/Makefile
--- a/Makefile 2017-08-22 17:42:57.037875653 +0000
+++ b/Makefile 2017-08-22 17:43:53.089875539 +0000
@@ -616,6 +616,12 @@ include $(srctree)/arch/$(SRCARCH)/Makef
KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
+# Required for GCC-5/6
+KBUILD_CFLAGS += $(call cc-option, -fno-pie)
+KBUILD_CFLAGS += $(call cc-option, -no-pie)
+KBUILD_AFLAGS += $(call cc-option, -fno-pie)
+KBUILD_CPPFLAGS += $(call cc-option, -fno-pie)
+
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
else

View File

@@ -26,3 +26,4 @@ platform-powerpc-dni-7448-r0.patch
platform-powerpc-quanta-lb9-r0.patch
driver-support-intel-igb-bcm50210-phy.patch
driver-igb-netberg-aurora.patch
gcc-no-pie.patch

View File

@@ -69,6 +69,8 @@ sff_module_types: &sff_module_types
desc: "40GBASE-SR2"
- 40G_BASE_SM4:
desc: "40GBASE-SM4"
- 40G_BASE_ER4:
desc: "40GBASE-ER4"
- 25G_BASE_CR:
desc: "25GBASE-CR"
- 10G_BASE_SR:

View File

@@ -115,7 +115,7 @@
((idprom[131] & SFF8436_CC131_40GE_ACTIVE) != 0)
#define SFF8436_MEDIA_NONE(idprom) \
(idprom[131] == 0)
((idprom[131] & 0x7F) == 0)
#define SFF8436_CC132_40G_OTN 0x08
#define SFF8436_CC132_OC48_LONG SFF8472_CC4_OC48_LONG
@@ -291,6 +291,23 @@ _sff8436_qsfp_40g_sm4(const uint8_t* idprom)
return 1;
}
static inline int
_sff8436_qsfp_40g_er4(const uint8_t* idprom)
{
if(!SFF8436_MODULE_QSFP_PLUS_V2(idprom)) {
return 0;
}
if (idprom[130] != SFF8436_CONN_LC) return 0;
if (!SFF8436_MEDIA_NONE(idprom)) return 0;
/* 40 kilometer SMF */
if (idprom[142] != 40) {
return 0;
}
return 1;
}
static inline int
_sff8436_bitrate(const uint8_t *idprom)
{

View File

@@ -110,6 +110,7 @@ typedef enum sff_module_type_e {
SFF_MODULE_TYPE_40G_BASE_CR,
SFF_MODULE_TYPE_40G_BASE_SR2,
SFF_MODULE_TYPE_40G_BASE_SM4,
SFF_MODULE_TYPE_40G_BASE_ER4,
SFF_MODULE_TYPE_25G_BASE_CR,
SFF_MODULE_TYPE_10G_BASE_SR,
SFF_MODULE_TYPE_10G_BASE_LR,
@@ -148,6 +149,7 @@ typedef enum sff_module_type_e {
"40G_BASE_CR", \
"40G_BASE_SR2", \
"40G_BASE_SM4", \
"40G_BASE_ER4", \
"25G_BASE_CR", \
"10G_BASE_SR", \
"10G_BASE_LR", \

View File

@@ -20,6 +20,7 @@ SFF_MEDIA_TYPE_ENTRY(40G_BASE_ACTIVE, 40GBASE-ACTIVE)
SFF_MEDIA_TYPE_ENTRY(40G_BASE_CR, 40GBASE-CR)
SFF_MEDIA_TYPE_ENTRY(40G_BASE_SR2, 40GBASE-SR2)
SFF_MEDIA_TYPE_ENTRY(40G_BASE_SM4, 40GBASE-SM4)
SFF_MEDIA_TYPE_ENTRY(40G_BASE_ER4, 40GBASE-ER4)
SFF_MEDIA_TYPE_ENTRY(25G_BASE_CR, 25GBASE-CR)
SFF_MEDIA_TYPE_ENTRY(10G_BASE_SR, 10GBASE-SR)
SFF_MEDIA_TYPE_ENTRY(10G_BASE_LR, 10GBASE-LR)
@@ -64,6 +65,7 @@ SFF_MODULE_TYPE_ENTRY(40G_BASE_ACTIVE, 40GBASE-ACTIVE)
SFF_MODULE_TYPE_ENTRY(40G_BASE_CR, 40GBASE-CR)
SFF_MODULE_TYPE_ENTRY(40G_BASE_SR2, 40GBASE-SR2)
SFF_MODULE_TYPE_ENTRY(40G_BASE_SM4, 40GBASE-SM4)
SFF_MODULE_TYPE_ENTRY(40G_BASE_ER4, 40GBASE-ER4)
SFF_MODULE_TYPE_ENTRY(25G_BASE_CR, 25GBASE-CR)
SFF_MODULE_TYPE_ENTRY(10G_BASE_SR, 10GBASE-SR)
SFF_MODULE_TYPE_ENTRY(10G_BASE_LR, 10GBASE-LR)

View File

@@ -132,6 +132,11 @@ sff_module_type_get(const uint8_t* eeprom)
return SFF_MODULE_TYPE_40G_BASE_SM4;
}
if (SFF8436_MODULE_QSFP_PLUS_V2(eeprom)
&& _sff8436_qsfp_40g_er4(eeprom)) {
return SFF_MODULE_TYPE_40G_BASE_ER4;
}
if (SFF8472_MODULE_SFP(eeprom)
&& SFF8472_MEDIA_XGE_SR(eeprom)
&& !_sff8472_media_gbe_sx_fc_hack(eeprom))
@@ -242,6 +247,7 @@ sff_media_type_get(sff_module_type_t mt)
case SFF_MODULE_TYPE_40G_BASE_ACTIVE:
case SFF_MODULE_TYPE_40G_BASE_SR2:
case SFF_MODULE_TYPE_40G_BASE_SM4:
case SFF_MODULE_TYPE_40G_BASE_ER4:
case SFF_MODULE_TYPE_10G_BASE_SR:
case SFF_MODULE_TYPE_10G_BASE_LR:
case SFF_MODULE_TYPE_10G_BASE_LRM:
@@ -291,6 +297,7 @@ sff_module_caps_get(sff_module_type_t mt, uint32_t *caps)
case SFF_MODULE_TYPE_40G_BASE_CR:
case SFF_MODULE_TYPE_40G_BASE_SR2:
case SFF_MODULE_TYPE_40G_BASE_SM4:
case SFF_MODULE_TYPE_40G_BASE_ER4:
*caps |= SFF_MODULE_CAPS_F_40G;
return 0;
@@ -687,6 +694,7 @@ sff_info_init(sff_info_t* info, sff_module_type_t mt,
case SFF_MODULE_TYPE_40G_BASE_ACTIVE:
case SFF_MODULE_TYPE_40G_BASE_SR2:
case SFF_MODULE_TYPE_40G_BASE_SM4:
case SFF_MODULE_TYPE_40G_BASE_ER4:
case SFF_MODULE_TYPE_4X_MUX:
info->sfp_type = SFF_SFP_TYPE_QSFP_PLUS;
info->media_type = SFF_MEDIA_TYPE_FIBER;

View File

@@ -144,6 +144,7 @@ aim_map_si_t sff_module_type_map[] =
{ "40G_BASE_CR", SFF_MODULE_TYPE_40G_BASE_CR },
{ "40G_BASE_SR2", SFF_MODULE_TYPE_40G_BASE_SR2 },
{ "40G_BASE_SM4", SFF_MODULE_TYPE_40G_BASE_SM4 },
{ "40G_BASE_ER4", SFF_MODULE_TYPE_40G_BASE_ER4 },
{ "25G_BASE_CR", SFF_MODULE_TYPE_25G_BASE_CR },
{ "10G_BASE_SR", SFF_MODULE_TYPE_10G_BASE_SR },
{ "10G_BASE_LR", SFF_MODULE_TYPE_10G_BASE_LR },
@@ -179,6 +180,7 @@ aim_map_si_t sff_module_type_desc_map[] =
{ "40GBASE-CR", SFF_MODULE_TYPE_40G_BASE_CR },
{ "40GBASE-SR2", SFF_MODULE_TYPE_40G_BASE_SR2 },
{ "40GBASE-SM4", SFF_MODULE_TYPE_40G_BASE_SM4 },
{ "40GBASE-ER4", SFF_MODULE_TYPE_40G_BASE_ER4 },
{ "25GBASE-CR", SFF_MODULE_TYPE_25G_BASE_CR },
{ "10GBASE-SR", SFF_MODULE_TYPE_10G_BASE_SR },
{ "10GBASE-LR", SFF_MODULE_TYPE_10G_BASE_LR },

View File

@@ -3,12 +3,12 @@
#
# Inclusive Makefile for the sff module.
#
# Autogenerated 2017-05-22 21:57:32.679978
# Autogenerated 2017-08-22 22:14:08.507022
#
###############################################################################
sff_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
include $(sff_BASEDIR)module/make.mk
include $(sff_BASEDIR)module/auto/make.mk
include $(sff_BASEDIR)module/src/make.mk
include $(sff_BASEDIR)module/auto/make.mk
include $(sff_BASEDIR)utest/_make.mk

View File

@@ -458,7 +458,7 @@ int getCtrlOfBus(void)
return getCtrlOfBus_9541();
}
static const struct fan_cpld_reg fan_cpld_reg[FAN_NUM] = {
const struct fan_cpld_reg fan_cpld_reg[FAN_NUM] = {
{0x180, 0x181},
{0x182, 0x183},
{0x184, 0x185},
@@ -1952,5 +1952,3 @@ int fanSpeedSet(int id, unsigned short speed)
}
return ret;
}

View File

@@ -1,3 +1,2 @@
*x86*64*delta_agc7648a*.mk
*x86*64*delta*ag5648*.mk
onlpdump.mk

View File

@@ -2,7 +2,7 @@
* <bsn.cl fy=2014 v=onl>
*
* Copyright 2014 Big Switch Networks, Inc.
* Copyright (C) 2017 Delta Networks, Inc.
* Copyright (C) 2017 Delta Networks, Inc.
*
* Licensed under the Eclipse Public License, Version 1.0 (the
* "License"); you may not use this file except in compliance
@@ -43,44 +43,44 @@
* Get the information for the given LED OID.
*/
static onlp_led_info_t linfo[] =
{
{ }, /* Not used */
{
{ ONLP_LED_ID_CREATE(LED_FRONT_FAN), "FRONT LED (FAN LED)", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING | ONLP_LED_CAPS_AUTO,
},
{
{ ONLP_LED_ID_CREATE(LED_FRONT_SYS), "FRONT LED (SYS LED)", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN_BLINKING | ONLP_LED_CAPS_AUTO,
},
{
{ ONLP_LED_ID_CREATE(LED_FRONT_PWR), "FRONT LED (PWR LED)", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING,
},
{
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_1), "FAN TRAY 1 LED", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
},
{
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_2), "FAN TRAY 2 LED", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
},
{
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_3), "FAN TRAY 3 LED", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
},
{
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_4), "FAN TRAY 4 LED", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
},
};
{ }, /* Not used */
{
{ ONLP_LED_ID_CREATE(LED_FRONT_FAN), "FRONT LED (FAN LED)", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING | ONLP_LED_CAPS_AUTO,
},
{
{ ONLP_LED_ID_CREATE(LED_FRONT_SYS), "FRONT LED (SYS LED)", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN_BLINKING | ONLP_LED_CAPS_AUTO,
},
{
{ ONLP_LED_ID_CREATE(LED_FRONT_PWR), "FRONT LED (PWR LED)", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING,
},
{
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_1), "FAN TRAY 1 LED", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
},
{
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_2), "FAN TRAY 2 LED", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
},
{
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_3), "FAN TRAY 3 LED", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
},
{
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_4), "FAN TRAY 4 LED", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
},
};
/*
* This function will be called prior to any other onlp_ledi_* functions.
*/
@@ -104,10 +104,10 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
dev_info.flags = DEFAULT_FLAG;
/* Set front panel's mode of leds */
r_data = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,LED_REG);
r_data = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,LED_REG);
int local_id = ONLP_OID_ID_GET(id);
switch(local_id)
{
{
case LED_FRONT_FAN:
if((r_data & 0xc0) == 0x80)
info->mode = ONLP_LED_MODE_GREEN;
@@ -120,11 +120,11 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
break;
case LED_FRONT_SYS:
if((r_data & 0x30) == 0x10)
info->mode = ONLP_LED_MODE_GREEN;
info->mode = ONLP_LED_MODE_GREEN;
else if((r_data & 0x30) == 0x20)
info->mode = ONLP_LED_MODE_ORANGE;
info->mode = ONLP_LED_MODE_ORANGE;
else if((r_data & 0x30) == 0x00)
info->mode = ONLP_LED_MODE_GREEN_BLINKING;
info->mode = ONLP_LED_MODE_GREEN_BLINKING;
else
return ONLP_STATUS_E_INTERNAL;
break;
@@ -143,12 +143,12 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
r_data = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG);
fantray_present = dni_i2c_lock_read(NULL, &dev_info);
if(fantray_present >= 0)
{
if((r_data & 0x01) == 0x01)
info->mode = ONLP_LED_MODE_GREEN;
else
info->mode = ONLP_LED_MODE_ORANGE;
}
{
if((r_data & 0x01) == 0x01)
info->mode = ONLP_LED_MODE_GREEN;
else
info->mode = ONLP_LED_MODE_ORANGE;
}
else
info->mode = ONLP_LED_MODE_OFF;
break;
@@ -157,12 +157,12 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
r_data = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG);
fantray_present = dni_i2c_lock_read(NULL, &dev_info);
if(fantray_present >= 0)
{
if((r_data & 0x04) == 0x04)
info->mode = ONLP_LED_MODE_GREEN;
else
info->mode = ONLP_LED_MODE_ORANGE;
}
{
if((r_data & 0x04) == 0x04)
info->mode = ONLP_LED_MODE_GREEN;
else
info->mode = ONLP_LED_MODE_ORANGE;
}
else
info->mode = ONLP_LED_MODE_OFF;
break;
@@ -171,12 +171,12 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
r_data = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG);
fantray_present = dni_i2c_lock_read(NULL, &dev_info);
if(fantray_present >= 0)
{
if((r_data & 0x10) == 0x10)
info->mode = ONLP_LED_MODE_GREEN;
else
info->mode = ONLP_LED_MODE_ORANGE;
}
{
if((r_data & 0x10) == 0x10)
info->mode = ONLP_LED_MODE_GREEN;
else
info->mode = ONLP_LED_MODE_ORANGE;
}
else
info->mode = ONLP_LED_MODE_OFF;
break;
@@ -185,20 +185,20 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
r_data = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG);
fantray_present = dni_i2c_lock_read(NULL, &dev_info);
if(fantray_present >= 0)
{
if((r_data & 0x40) == 0x40)
info->mode = ONLP_LED_MODE_GREEN;
else
info->mode = ONLP_LED_MODE_ORANGE;
}
{
if((r_data & 0x40) == 0x40)
info->mode = ONLP_LED_MODE_GREEN;
else
info->mode = ONLP_LED_MODE_ORANGE;
}
else
info->mode = ONLP_LED_MODE_OFF;
break;
default:
break;
}
}
/* Set the on/off status */
if (info->mode == ONLP_LED_MODE_OFF)
if (info->mode == ONLP_LED_MODE_OFF)
info->status |= ONLP_LED_STATUS_FAILED;
else
info->status |=ONLP_LED_STATUS_PRESENT;
@@ -250,40 +250,40 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
fan_led_status_value = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,FAN_STAT1_REG);
fan_tray_pres_value = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,FAN_STAT2_REG);
alarm_reg_value = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,ALARM_REG);
switch(local_id)
{
case LED_FRONT_FAN:
switch(local_id)
{
case LED_FRONT_FAN:
/* Clean the bit 7,6 */
front_panel_led_value &= ~0xC0;
fan_board_not_present_count = 0;
/* Read cpld fan status to check present. Fan tray 1-4 */
/* Read cpld fan status to check present. Fan tray 1-4 */
for(i = 0; i < 4; i++)
{
fan_stat2_reg_mask = 0x01 << i;
fan_stat1_reg_mask = 0x01 << (i * 2);
if((fan_tray_pres_value & fan_stat2_reg_mask) == fan_stat2_reg_mask)
fan_board_not_present_count++;
else if((fan_led_status_value & fan_stat1_reg_mask) == fan_stat1_reg_mask)
count++;
}
{
fan_stat2_reg_mask = 0x01 << i;
fan_stat1_reg_mask = 0x01 << (i * 2);
if((fan_tray_pres_value & fan_stat2_reg_mask) == fan_stat2_reg_mask)
fan_board_not_present_count++;
else if((fan_led_status_value & fan_stat1_reg_mask) == fan_stat1_reg_mask)
count++;
}
/* Set front light of FAN */
if(count == ALL_FAN_TRAY_EXIST)
{
front_panel_led_value |= 0x80;/*Solid green, FAN operates normally.*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
}
{
front_panel_led_value |= 0x80;/*Solid green, FAN operates normally.*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
}
else if (fan_board_not_present_count > 0)
{
front_panel_led_value |= 0xc0;/*Blinking Yellow , FAN is failed */
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
}
{
front_panel_led_value |= 0xc0;/*Blinking Yellow , FAN is failed */
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
}
else
{
front_panel_led_value |= 0x40;/*Solid Amber FAN operating is NOT present */
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
}
{
front_panel_led_value |= 0x40;/*Solid Amber FAN operating is NOT present */
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
}
break;
case LED_FRONT_PWR:
@@ -298,52 +298,52 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
psu2_state = dni_i2c_lock_read(NULL, &dev_info);
if(psu1_state == 1 && psu2_state == 1)
{
power_state = dni_lock_cpld_read_attribute(MASTER_CPLD_PATH,PSU_STAT_REG);
if((power_state & 0x40) == 0x40 || (power_state & 0x04) == 0x04)
{
front_panel_led_value |= 0x06; /*Blinking Amber*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
power_state = dni_lock_cpld_read_attribute(MASTER_CPLD_PATH,PSU_STAT_REG);
if((power_state & 0x40) == 0x40 || (power_state & 0x04) == 0x04)
{
front_panel_led_value |= 0x06; /*Blinking Amber*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
}
else
{
front_panel_led_value |= 0x04; /*Solid Green*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
}
}
else
{
front_panel_led_value |= 0x04; /*Solid Green*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
}
}
else
front_panel_led_value |= 0x02; /*Solid Amber*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
break;
case LED_FRONT_SYS:
/* Clean bit 4,5 */
front_panel_led_value &= ~0x30;
fan_board_not_present_count = 0;
fan_board_not_present_count = 0;
/* Read fan eeprom to check present */
for(i = 0;i < 4; i++)
{
fan_stat2_reg_mask = 0x01 << i;
if((fan_tray_pres_value & fan_stat2_reg_mask) == fan_stat2_reg_mask)
fan_board_not_present_count++;
}
if(fan_board_not_present_count > 0 || (alarm_reg_value & 0xff) == 0xff)
{
fan_tray_interface_detected_value = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,INTERRUPT_REG);
if(fan_tray_interface_detected_value == 0xfe || (alarm_reg_value & 0xff) == 0xff)
{
front_panel_led_value |= 0x20;
fan_stat2_reg_mask = 0x01 << i;
if((fan_tray_pres_value & fan_stat2_reg_mask) == fan_stat2_reg_mask)
fan_board_not_present_count++;
}
if(fan_board_not_present_count > 0 || (alarm_reg_value & 0xff) == 0xff)
{
fan_tray_interface_detected_value = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,INTERRUPT_REG);
if(fan_tray_interface_detected_value == 0xfe || (alarm_reg_value & 0xff) == 0xff)
{
front_panel_led_value |= 0x20;
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH, LED_REG, front_panel_led_value);
}
}
else
{
front_panel_led_value |= 0x10;
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH, LED_REG, front_panel_led_value);
}
}
else
{
front_panel_led_value |= 0x10;
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH, LED_REG, front_panel_led_value);
}
break;
case LED_REAR_FAN_TRAY_1:
dev_info.addr = FAN_TRAY_1;
fantray_present = dni_i2c_lock_read(NULL, &dev_info);
@@ -351,15 +351,15 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN1_REAR);
fan_tray_led_reg_value &= ~0x03;
if(fantray_present >= 0 && rpm != FAN_ZERO_RPM && rpm != 0 && rpm1 != FAN_ZERO_RPM && rpm1 != 0 )
{
fan_tray_led_reg_value |= 0x01;/*Solid Green*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
{
fan_tray_led_reg_value |= 0x01;/*Solid Green*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
else
{
fan_tray_led_reg_value |= 0x02;/*Solid Amber*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
{
fan_tray_led_reg_value |= 0x02;/*Solid Amber*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
break;
case LED_REAR_FAN_TRAY_2:
@@ -368,17 +368,17 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
rpm = dni_i2c_lock_read_attribute(NULL, FAN2_FRONT);
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN2_REAR);
fan_tray_led_reg_value &= ~0x0c;
if(fantray_present >= 0 && rpm != FAN_ZERO_RPM && rpm != 0 && rpm1 != FAN_ZERO_RPM && rpm1 != 0 )
{
fan_tray_led_reg_value |= 0x04;/*Solid Green*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
{
fan_tray_led_reg_value |= 0x04;/*Solid Green*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
else
{
fan_tray_led_reg_value |= 0x08;/*Solid Amber*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
{
fan_tray_led_reg_value |= 0x08;/*Solid Amber*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
break;
case LED_REAR_FAN_TRAY_3:
@@ -388,15 +388,15 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
rpm = dni_i2c_lock_read_attribute(NULL, FAN3_FRONT);
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN3_REAR);
if(fantray_present >= 0 && rpm != FAN_ZERO_RPM && rpm != 0 && rpm1 != FAN_ZERO_RPM && rpm1 != 0 )
{
fan_tray_led_reg_value |= 0x10;/*Solid Green*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
{
fan_tray_led_reg_value |= 0x10;/*Solid Green*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
else
{
fan_tray_led_reg_value |= 0x20;/*Solid Amber*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
{
fan_tray_led_reg_value |= 0x20;/*Solid Amber*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
break;
case LED_REAR_FAN_TRAY_4:
@@ -406,16 +406,16 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
rpm = dni_i2c_lock_read_attribute(NULL, FAN4_FRONT);
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN4_REAR);
if(fantray_present >= 0 && rpm != FAN_ZERO_RPM && rpm !=0 && rpm1 != FAN_ZERO_RPM && rpm1 != 0 )
{
fan_tray_led_reg_value |= 0x40; /*Solid Green*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
{
fan_tray_led_reg_value |= 0x40; /*Solid Green*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
else
{
fan_tray_led_reg_value |= 0x80;/*Solid Amber*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
}
{
fan_tray_led_reg_value |= 0x80;/*Solid Amber*/
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
}
}
return ONLP_STATUS_OK;
}

View File

@@ -57,7 +57,7 @@
} while(0)
static long psu_data_convert(unsigned int d, int mult)
{
long X, Y, N, n;
long X, Y, N, n;
Y = d & 0x07FF;
N = (d >> 11) & 0x0f;
@@ -73,116 +73,116 @@ static long psu_data_convert(unsigned int d, int mult)
static long psu_data_convert_16(unsigned int d, int mult)
{
long X;
X = (d * mult) / (1 << 9);
return X;
long X;
X = (d * mult) / (1 << 9);
return X;
}
static int
static int
psu_status_info_get(int id, char *node)
{
int ret;
char r_data;
ret=i2c_devname_read_byte(CPLD_PSU_NAME,PSU_STATUS_REG);
if(ret<0)
return -1;
if (PSU1_ID == id) {
if(!strcmp("present",node))
r_data=!((ret& PSU_STATUS_PRESENT_BIT(id))>> PSU_STATUS_PRESENT_OFFSET(id));
else if(!strcmp("good",node))
r_data=((ret& PSU_STATUS_GOOD_BIT(id))>> PSU_STATUS_GOOD_OFFSET(id));
else
r_data=-1;
char r_data;
ret=i2c_devname_read_byte(CPLD_PSU_NAME,PSU_STATUS_REG);
if(ret<0)
return -1;
if (PSU1_ID == id) {
if(!strcmp("present",node))
r_data=!((ret& PSU_STATUS_PRESENT_BIT(id))>> PSU_STATUS_PRESENT_OFFSET(id));
else if(!strcmp("good",node))
r_data=((ret& PSU_STATUS_GOOD_BIT(id))>> PSU_STATUS_GOOD_OFFSET(id));
else
r_data=-1;
}
else if (PSU2_ID == id) {
if(!strcmp("present",node))
r_data=!((ret& PSU_STATUS_PRESENT_BIT(id))>> PSU_STATUS_PRESENT_OFFSET(id));
else if(!strcmp("good",node))
r_data=((ret& PSU_STATUS_GOOD_BIT(id))>> PSU_STATUS_GOOD_OFFSET(id));
else
r_data=-1;
}
r_data=!((ret& PSU_STATUS_PRESENT_BIT(id))>> PSU_STATUS_PRESENT_OFFSET(id));
else if(!strcmp("good",node))
r_data=((ret& PSU_STATUS_GOOD_BIT(id))>> PSU_STATUS_GOOD_OFFSET(id));
else
r_data=-1;
}
else{
r_data=-1;
}
return r_data;
r_data=-1;
}
return r_data;
}
static int
static int
psu_value_info_get(int id, char *type)
{
int ret;
char *dev_name;
int reg_offset;
char *dev_name;
int reg_offset;
if(PSU1_ID == id)
dev_name="PSU1_PMBUS";
else
dev_name="PSU2_PMBUS";
if(!strcmp(type,"vin"))
reg_offset=PSU_PNBUS_VIN_REG;
else if(!strcmp(type,"iin"))
reg_offset=PSU_PNBUS_IIN_REG;
else if(!strcmp(type,"pin"))
reg_offset=PSU_PNBUS_PIN_REG;
else if(!strcmp(type,"vout"))
reg_offset=PSU_PNBUS_VOUT_REG;
else if(!strcmp(type,"iout"))
reg_offset=PSU_PNBUS_IOUT_REG;
else
reg_offset=PSU_PNBUS_POUT_REG;
ret=i2c_devname_read_word(dev_name,reg_offset);
if(ret<0)
return -1;
return ret;
if(!strcmp(type,"vin"))
reg_offset=PSU_PNBUS_VIN_REG;
else if(!strcmp(type,"iin"))
reg_offset=PSU_PNBUS_IIN_REG;
else if(!strcmp(type,"pin"))
reg_offset=PSU_PNBUS_PIN_REG;
else if(!strcmp(type,"vout"))
reg_offset=PSU_PNBUS_VOUT_REG;
else if(!strcmp(type,"iout"))
reg_offset=PSU_PNBUS_IOUT_REG;
else
reg_offset=PSU_PNBUS_POUT_REG;
ret=i2c_devname_read_word(dev_name,reg_offset);
if(ret<0)
return -1;
return ret;
}
static int
static int
psu_serial_model_info_get(int id,char *type,char*data,int data_len)
{
int i,r_data,re_cnt;
char *dev_name;
int reg_offset;
char *dev_name;
int reg_offset;
if(PSU1_ID == id)
dev_name="PSU1_EEPROM";
else
dev_name="PSU2_EEPROM";
if(!strcmp(type,"serial"))
reg_offset=PSU_PNBUS_SERIAL_REG;
else
reg_offset=PSU_PNBUS_MODEL_REG;
for(i=0;i<data_len;i++){
re_cnt=3;
while(re_cnt){
r_data=i2c_devname_read_byte(dev_name,reg_offset+i);
if(r_data<0){
re_cnt--;
continue;
}
data[i]=r_data;
break;
}
if(re_cnt==0){
AIM_LOG_ERROR("Unable to read the %d reg \r\n",i);
return ONLP_STATUS_E_INTERNAL;
}
}
if(!strcmp(type,"serial"))
reg_offset=PSU_PNBUS_SERIAL_REG;
else
reg_offset=PSU_PNBUS_MODEL_REG;
return ONLP_STATUS_OK;
for(i=0;i<data_len;i++){
re_cnt=3;
while(re_cnt){
r_data=i2c_devname_read_byte(dev_name,reg_offset+i);
if(r_data<0){
re_cnt--;
continue;
}
data[i]=r_data;
break;
}
if(re_cnt==0){
AIM_LOG_ERROR("Unable to read the %d reg \r\n",i);
return ONLP_STATUS_E_INTERNAL;
}
}
return ONLP_STATUS_OK;
}
int
@@ -195,15 +195,15 @@ onlp_psui_init(void)
* Get all information about the given PSU oid.
*/
static onlp_psu_info_t pinfo[] =
{
{ }, /* Not used */
{
{ ONLP_PSU_ID_CREATE(PSU1_ID), "PSU-1", 0 },
},
{
{ ONLP_PSU_ID_CREATE(PSU2_ID), "PSU-2", 0 },
}
};
{ }, /* Not used */
{
{ ONLP_PSU_ID_CREATE(PSU1_ID), "PSU-1", 0 },
},
{
{ ONLP_PSU_ID_CREATE(PSU2_ID), "PSU-2", 0 },
}
};
int
onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
@@ -211,141 +211,141 @@ onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
int val = 0;
int ret = ONLP_STATUS_OK;
int index = ONLP_OID_ID_GET(id);
psu_type_t psu_type;
int r_data;
char sn_data[15]={0};
char model_data[17]={0};
psu_type_t psu_type;
int r_data;
char sn_data[15]={0};
char model_data[17]={0};
VALIDATE(id);
memset(info, 0, sizeof(onlp_psu_info_t));
*info = pinfo[index]; /* Set the onlp_oid_hdr_t */
/* Get the present state */
val=psu_status_info_get(index, "present");
val=psu_status_info_get(index, "present");
if (val<0) {
AIM_LOG_INFO("Unable to read PSU %d present value)\r\n", index);
return ONLP_STATUS_E_INVALID;
AIM_LOG_INFO("Unable to read PSU %d present value)\r\n", index);
return ONLP_STATUS_E_INVALID;
}
if (val != PSU_STATUS_PRESENT) {
if (val != PSU_STATUS_PRESENT) {
info->status &= ~ONLP_PSU_STATUS_PRESENT;
return ONLP_STATUS_OK;
}
info->status |= ONLP_PSU_STATUS_PRESENT;
/* Get power good status */
val=psu_status_info_get(index,"good");
if (val<0) {
AIM_LOG_INFO("Unable to read PSU %d good value)\r\n", index);
return ONLP_STATUS_E_INVALID;
val=psu_status_info_get(index,"good");
if (val<0) {
AIM_LOG_INFO("Unable to read PSU %d good value)\r\n", index);
return ONLP_STATUS_E_INVALID;
}
if (val != PSU_STATUS_POWER_GOOD) {
info->status |= ONLP_PSU_STATUS_FAILED;
}
/* Get PSU type
*/
psu_type = get_psu_type(index, info->model, sizeof(info->model));
switch (psu_type) {
case PSU_TYPE_AC_F2B:
case PSU_TYPE_AC_B2F:
info->caps = ONLP_PSU_CAPS_AC;
ret = ONLP_STATUS_OK;
break;
case PSU_TYPE_UNKNOWN: /* User insert a unknown PSU or unplugged.*/
info->status |= ONLP_PSU_STATUS_UNPLUGGED;
info->status &= ~ONLP_PSU_STATUS_FAILED;
ret = ONLP_STATUS_OK;
break;
default:
ret = ONLP_STATUS_E_UNSUPPORTED;
break;
case PSU_TYPE_AC_F2B:
case PSU_TYPE_AC_B2F:
info->caps = ONLP_PSU_CAPS_AC;
ret = ONLP_STATUS_OK;
break;
case PSU_TYPE_UNKNOWN: /* User insert a unknown PSU or unplugged.*/
info->status |= ONLP_PSU_STATUS_UNPLUGGED;
info->status &= ~ONLP_PSU_STATUS_FAILED;
ret = ONLP_STATUS_OK;
break;
default:
ret = ONLP_STATUS_E_UNSUPPORTED;
break;
}
/* Get PSU vin,vout*/
r_data=psu_value_info_get(index,"vin");
/* Get PSU vin,vout*/
r_data=psu_value_info_get(index,"vin");
if (r_data<0) {
AIM_LOG_INFO("Unable to read PSU %d Vin value)\r\n", index);
return ONLP_STATUS_E_INVALID;
AIM_LOG_INFO("Unable to read PSU %d Vin value)\r\n", index);
return ONLP_STATUS_E_INVALID;
}
info->mvin=psu_data_convert(r_data,1000);
r_data=psu_value_info_get(index,"vout");
info->mvin=psu_data_convert(r_data,1000);
r_data=psu_value_info_get(index,"vout");
if (r_data<0) {
AIM_LOG_INFO("Unable to read PSU %d Vout value)\r\n", index);
return ONLP_STATUS_E_INVALID;
AIM_LOG_INFO("Unable to read PSU %d Vout value)\r\n", index);
return ONLP_STATUS_E_INVALID;
}
info->mvout=psu_data_convert_16(r_data,1000);
/* Get PSU iin, iout
info->mvout=psu_data_convert_16(r_data,1000);
/* Get PSU iin, iout
*/
r_data=psu_value_info_get(index,"iin");
r_data=psu_value_info_get(index,"iin");
if (r_data<0) {
AIM_LOG_INFO("Unable to read PSU %d Iin value)\r\n", index);
return ONLP_STATUS_E_INVALID;
AIM_LOG_INFO("Unable to read PSU %d Iin value)\r\n", index);
return ONLP_STATUS_E_INVALID;
}
info->miin=psu_data_convert(r_data,1000);
r_data=psu_value_info_get(index,"iout");
info->miin=psu_data_convert(r_data,1000);
r_data=psu_value_info_get(index,"iout");
if (r_data<0) {
AIM_LOG_INFO("Unable to read PSU %d Iout value)\r\n", index);
return ONLP_STATUS_E_INVALID;
AIM_LOG_INFO("Unable to read PSU %d Iout value)\r\n", index);
return ONLP_STATUS_E_INVALID;
}
info->miout=psu_data_convert(r_data,1000);
/* Get PSU pin, pout
info->miout=psu_data_convert(r_data,1000);
/* Get PSU pin, pout
*/
r_data=psu_value_info_get(index,"pin");
r_data=psu_value_info_get(index,"pin");
if (r_data<0) {
AIM_LOG_INFO("Unable to read PSU %d Pin value)\r\n", index);
return ONLP_STATUS_E_INVALID;
AIM_LOG_INFO("Unable to read PSU %d Pin value)\r\n", index);
return ONLP_STATUS_E_INVALID;
}
info->mpin=psu_data_convert(r_data,1000);
r_data=psu_value_info_get(index,"pout");
info->mpin=psu_data_convert(r_data,1000);
r_data=psu_value_info_get(index,"pout");
if (r_data<0) {
AIM_LOG_INFO("Unable to read PSU %d Pout value)\r\n", index);
return ONLP_STATUS_E_INVALID;
AIM_LOG_INFO("Unable to read PSU %d Pout value)\r\n", index);
return ONLP_STATUS_E_INVALID;
}
info->mpout=psu_data_convert(r_data,1000);
/* Get PSU serial
info->mpout=psu_data_convert(r_data,1000);
/* Get PSU serial
*/
ret=psu_serial_model_info_get(index,"serial",sn_data,14);
if (ret!=ONLP_STATUS_OK) {
AIM_LOG_INFO("Unable to read PSU %d SN value)\r\n", index);
return ONLP_STATUS_E_INVALID;
ret=psu_serial_model_info_get(index,"serial",sn_data,14);
if (ret!=ONLP_STATUS_OK) {
AIM_LOG_INFO("Unable to read PSU %d SN value)\r\n", index);
return ONLP_STATUS_E_INVALID;
}
strcpy(info->serial,sn_data);
/* Get PSU model
strcpy(info->serial,sn_data);
/* Get PSU model
*/
ret=psu_serial_model_info_get(index,"model",model_data,16);
if (ret!=ONLP_STATUS_OK) {
AIM_LOG_INFO("Unable to read PSU %d model value)\r\n", index);
return ONLP_STATUS_E_INVALID;
ret=psu_serial_model_info_get(index,"model",model_data,16);
if (ret!=ONLP_STATUS_OK) {
AIM_LOG_INFO("Unable to read PSU %d model value)\r\n", index);
return ONLP_STATUS_E_INVALID;
}
strcpy(info->model,model_data);
strcpy(info->model,model_data);
return ONLP_STATUS_OK;
}
@@ -354,4 +354,3 @@ onlp_psui_ioctl(onlp_oid_t pid, va_list vargs)
{
return ONLP_STATUS_E_UNSUPPORTED;
}

View File

@@ -1,2 +1,2 @@
*x86*64*quanta*ly4r*rangeley.mk
*x86*64*quanta*ly4r*.mk
onlpdump.mk

View File

@@ -36,6 +36,10 @@ export BUILDROOTMIRROR=${BUILDROOTMIRROR:-"http://buildroot.opennetlinux.org/dl"
# These submodules are required for almost everything.
$ONL/tools/submodules.py $ONL sm/infra
$ONL/tools/submodules.py $ONL sm/bigcode
$ONL/tools/submodules.py $ONL sm/build-artifacts
# Prepopulate local REPO with build-artifacts.
cp -R $ONL/sm/build-artifacts/REPO/* $ONL/REPO
# Export the current debian suite
export ONL_DEBIAN_SUITE=$(lsb_release -c -s)
@@ -46,4 +50,4 @@ if [ ! -f $ONL/.git/hooks/post-merge ] && [ -d $ONL/.git ]; then
fi
# submodule post update scripts.
export ONL_SUBMODULE_UPDATED_SCRIPTS="$ONL/tools/scripts/submodule-updated.sh"
export ONL_SUBMODULE_UPDATED_SCRIPTS="$ONL/tools/scripts/submodule-updated.sh"

1
sm/build-artifacts Submodule

Submodule sm/build-artifacts added at 54005ad5e9

View File

@@ -9,7 +9,7 @@ ONL="$(realpath $(dirname $AUTOBUILD_SCRIPT)/../../)"
# Default build branch
BUILD_BRANCH=master
while getopts ":b:s:d:u:p:vc78r:" opt; do
while getopts ":b:s:d:u:p:vc789r:" opt; do
case $opt in
7)
ONLB_OPTIONS=--7
@@ -23,6 +23,12 @@ while getopts ":b:s:d:u:p:vc78r:" opt; do
echo "Selecting Debian 8 build..."
fi
;;
9)
ONLB_OPTIONS=--9
if [ -z "$DOCKER_IMAGE" ]; then
echo "Selecting Debian 9 build..."
fi
;;
c)
cd $ONL && git submodule update --init --recursive packages/platforms-closed
;;
@@ -41,9 +47,9 @@ while getopts ":b:s:d:u:p:vc78r:" opt; do
done
if [ -z "$ONLB_OPTIONS" ]; then
# Build both suites
$AUTOBUILD_SCRIPT --7 $@
# Build both 8 and 9
$AUTOBUILD_SCRIPT --8 $@
$AUTOBUILD_SCRIPT --9 $@
exit $?
fi