mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-11-02 19:28:18 +00:00
Merge branch 'master' into asgvolt64_20190729
This commit is contained in:
1
REPO/buster/Makefile
Normal file
1
REPO/buster/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/repo-suite.mk
|
||||
1
REPO/buster/packages/binary-all/Makefile
Normal file
1
REPO/buster/packages/binary-all/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/repo.mk
|
||||
1
REPO/buster/packages/binary-amd64/Makefile
Normal file
1
REPO/buster/packages/binary-amd64/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/repo.mk
|
||||
1
REPO/buster/packages/binary-arm64/Makefile
Normal file
1
REPO/buster/packages/binary-arm64/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/repo.mk
|
||||
1
REPO/buster/packages/binary-armel/Makefile
Normal file
1
REPO/buster/packages/binary-armel/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/repo.mk
|
||||
1
REPO/buster/packages/binary-armhf/Makefile
Normal file
1
REPO/buster/packages/binary-armhf/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/repo.mk
|
||||
87
builds/any/rootfs/buster/common/all-base-packages.yml
Normal file
87
builds/any/rootfs/buster/common/all-base-packages.yml
Normal file
@@ -0,0 +1,87 @@
|
||||
############################################################
|
||||
#
|
||||
# Common Release Packages for all systems.
|
||||
#
|
||||
############################################################
|
||||
- base-files
|
||||
- locales
|
||||
- python
|
||||
- apt
|
||||
- apt-utils
|
||||
- debconf
|
||||
- dialog
|
||||
- procps
|
||||
- net-tools
|
||||
- iputils-ping
|
||||
- less
|
||||
- sudo
|
||||
- openssh-server
|
||||
- iproute2
|
||||
- resolvconf
|
||||
- vim-tiny
|
||||
- zile
|
||||
- nano
|
||||
- lsof
|
||||
- mingetty
|
||||
- traceroute
|
||||
- rsyslog
|
||||
- nfs-common
|
||||
- netbase
|
||||
- bsdmainutils
|
||||
- ifupdown
|
||||
- psmisc
|
||||
- make
|
||||
- python-cherrypy3
|
||||
- python-tz
|
||||
- scapy
|
||||
- python-pypcap
|
||||
- snmpd
|
||||
- snmp
|
||||
- pciutils
|
||||
- usbutils
|
||||
- mtd-utils
|
||||
- i2c-tools
|
||||
- kmod
|
||||
- isc-dhcp-client
|
||||
- ntp
|
||||
- wget
|
||||
- ethtool
|
||||
- localepurge
|
||||
- telnetd
|
||||
- python-pyinotify
|
||||
- cpio
|
||||
- util-linux
|
||||
- dosfstools
|
||||
- u-boot-tools
|
||||
- ntpdate
|
||||
- onlp
|
||||
- parted
|
||||
- watchdog
|
||||
- netplug
|
||||
- binutils
|
||||
- file
|
||||
- smartmontools
|
||||
- coreutils
|
||||
- iptables
|
||||
- onl-faultd
|
||||
- onlp-snmpd
|
||||
- oom-shim
|
||||
- python-parted
|
||||
- python-yaml
|
||||
- bzip2
|
||||
- xz-utils
|
||||
- unzip
|
||||
- onl-mibs
|
||||
- openssl
|
||||
- gdb
|
||||
- tcpdump
|
||||
- strace
|
||||
- sysstat
|
||||
- tmux
|
||||
- lm-sensors
|
||||
- hddtemp
|
||||
- bc
|
||||
- vim
|
||||
- htop
|
||||
- tree
|
||||
- memtester
|
||||
15
builds/any/rootfs/buster/common/amd64-base-packages.yml
Normal file
15
builds/any/rootfs/buster/common/amd64-base-packages.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
############################################################
|
||||
#
|
||||
# Common packages for all amd64 systems.
|
||||
#
|
||||
############################################################
|
||||
- dmidecode
|
||||
- parted
|
||||
- smartmontools
|
||||
- grub2
|
||||
- onl-upgrade
|
||||
- onl-kernel-4.9-lts-x86-64-all-modules
|
||||
- onl-kernel-4.14-lts-x86-64-all-modules
|
||||
- efibootmgr
|
||||
- gdisk
|
||||
- acpid
|
||||
11
builds/any/rootfs/buster/common/amd64-onl-packages.yml
Normal file
11
builds/any/rootfs/buster/common/amd64-onl-packages.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-upgrade
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1
builds/any/rootfs/buster/common/arm64-base-packages.yml
Normal file
1
builds/any/rootfs/buster/common/arm64-base-packages.yml
Normal file
@@ -0,0 +1 @@
|
||||
- u-boot-tools
|
||||
9
builds/any/rootfs/buster/common/arm64-onl-packages.yml
Normal file
9
builds/any/rootfs/buster/common/arm64-onl-packages.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-loader-fit
|
||||
|
||||
|
||||
|
||||
2
builds/any/rootfs/buster/common/armel-base-packages.yml
Normal file
2
builds/any/rootfs/buster/common/armel-base-packages.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
- u-boot-tools
|
||||
- onl-kernel-4.14-lts-armel-iproc-all-modules
|
||||
9
builds/any/rootfs/buster/common/armel-onl-packages.yml
Normal file
9
builds/any/rootfs/buster/common/armel-onl-packages.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-loader-fit
|
||||
|
||||
|
||||
|
||||
2
builds/any/rootfs/buster/common/armhf-base-packages.yml
Normal file
2
builds/any/rootfs/buster/common/armhf-base-packages.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
- u-boot-tools
|
||||
- onl-kernel-4.14-lts-armhf-iproc-all-modules
|
||||
9
builds/any/rootfs/buster/common/armhf-onl-packages.yml
Normal file
9
builds/any/rootfs/buster/common/armhf-onl-packages.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-loader-fit
|
||||
|
||||
|
||||
|
||||
1
builds/any/rootfs/buster/common/overlay/etc/adjtime
Normal file
1
builds/any/rootfs/buster/common/overlay/etc/adjtime
Normal file
@@ -0,0 +1 @@
|
||||
0.0 0 0.0
|
||||
6
builds/any/rootfs/buster/common/overlay/etc/filesystems
Normal file
6
builds/any/rootfs/buster/common/overlay/etc/filesystems
Normal file
@@ -0,0 +1,6 @@
|
||||
jffs2
|
||||
ubifs
|
||||
vfat
|
||||
ext4
|
||||
ext3
|
||||
ext2
|
||||
3
builds/any/rootfs/buster/common/overlay/etc/inetd.conf
Normal file
3
builds/any/rootfs/buster/common/overlay/etc/inetd.conf
Normal 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
|
||||
|
||||
27
builds/any/rootfs/buster/common/overlay/etc/mtab.yml
Normal file
27
builds/any/rootfs/buster/common/overlay/etc/mtab.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
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
|
||||
|
||||
# ESP (EFI system partition)
|
||||
EFI-BOOT:
|
||||
mount: ro
|
||||
dir: /boot/efi
|
||||
fsck: false
|
||||
label: EFI System
|
||||
optional: true
|
||||
@@ -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"
|
||||
4
builds/any/rootfs/buster/common/overlay/etc/rssh.conf
Normal file
4
builds/any/rootfs/buster/common/overlay/etc/rssh.conf
Normal file
@@ -0,0 +1,4 @@
|
||||
logfacility = LOG_USER
|
||||
allowsftp
|
||||
allowscp
|
||||
umask = 022
|
||||
195
builds/any/rootfs/buster/common/overlay/etc/snmp/snmpd.conf
Normal file
195
builds/any/rootfs/buster/common/overlay/etc/snmp/snmpd.conf
Normal 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
|
||||
@@ -0,0 +1 @@
|
||||
SUBSYSTEM=="block", RUN+="/sbin/initblockdev $kernel $env{ACTION}"
|
||||
@@ -0,0 +1 @@
|
||||
SUBSYSTEM=="net", RUN+="/sbin/initnetdev $kernel $env{ACTION}"
|
||||
23
builds/any/rootfs/buster/common/overlay/sbin/pgetty
Executable file
23
builds/any/rootfs/buster/common/overlay/sbin/pgetty
Executable 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
|
||||
71
builds/any/rootfs/buster/common/overlay/sbin/watchdir
Executable file
71
builds/any/rootfs/buster/common/overlay/sbin/watchdir
Executable 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)
|
||||
11
builds/any/rootfs/buster/common/powerpc-base-packages.yml
Normal file
11
builds/any/rootfs/buster/common/powerpc-base-packages.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
############################################################
|
||||
#
|
||||
# Common packages for all PowerPC systems.
|
||||
#
|
||||
############################################################
|
||||
- u-boot-tools
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
9
builds/any/rootfs/buster/common/powerpc-onl-packages.yml
Normal file
9
builds/any/rootfs/buster/common/powerpc-onl-packages.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-loader-fit
|
||||
|
||||
|
||||
|
||||
115
builds/any/rootfs/buster/standard/standard.yml
Normal file
115
builds/any/rootfs/buster/standard/standard.yml
Normal file
@@ -0,0 +1,115 @@
|
||||
############################################################
|
||||
#
|
||||
# Standard ONL Debian 10 Root Filesystem Configuration.
|
||||
#
|
||||
# Requires:
|
||||
# ARCH, PLATFORM_LIST
|
||||
#
|
||||
#
|
||||
############################################################
|
||||
variables:
|
||||
!include $ONL/make/versions/version-onl.yml
|
||||
|
||||
Packages: &Packages
|
||||
- !script $ONL/tools/onl-init-pkgs.py ${INIT}
|
||||
- !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
|
||||
aptsources: Debian
|
||||
|
||||
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
|
||||
arches: amd64, arm64, armel
|
||||
|
||||
ONL-Local:
|
||||
packages: *Packages
|
||||
source: http://${APT_CACHE}apt.opennetlinux.org/debian
|
||||
suite: unstable
|
||||
omitdebsrc: true
|
||||
arches: amd64, arm64, armel
|
||||
|
||||
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
|
||||
- ${ONL}/builds/any/rootfs/${ONL_DEBIAN_SUITE}/${INIT}/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
|
||||
4
builds/any/rootfs/buster/systemd/overlay/sbin/init
Executable file
4
builds/any/rootfs/buster/systemd/overlay/sbin/init
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
/etc/boot.d/boot
|
||||
echo "Starting systemd..."
|
||||
exec /lib/systemd/systemd
|
||||
67
builds/any/rootfs/buster/sysvinit/overlay/etc/inittab
Normal file
67
builds/any/rootfs/buster/sysvinit/overlay/etc/inittab
Normal 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
|
||||
|
||||
153
docker/images/builder10/1.0/Dockerfile
Normal file
153
docker/images/builder10/1.0/Dockerfile
Normal file
@@ -0,0 +1,153 @@
|
||||
FROM debian:10
|
||||
MAINTAINER Jeff Townsend <jeffrey.townsend@bigswitch.com>
|
||||
|
||||
# First round of dependences
|
||||
RUN apt-get update && apt-get install -y \
|
||||
apt \
|
||||
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-cross \
|
||||
dpkg-sig \
|
||||
emacs \
|
||||
file \
|
||||
flex \
|
||||
gawk \
|
||||
gcc \
|
||||
gdb \
|
||||
genisoimage \
|
||||
git \
|
||||
gperf \
|
||||
ifupdown \
|
||||
iproute2 \
|
||||
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 \
|
||||
rsyslog \
|
||||
rsync \
|
||||
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 rake
|
||||
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
|
||||
|
||||
|
||||
# Cross environments.
|
||||
|
||||
RUN wget http://old-releases.ubuntu.com/ubuntu/pool/universe/e/emdebian-crush/xapt_2.2.20_all.deb && \
|
||||
dpkg -i xapt_2.2.20_all.deb && \
|
||||
rm xapt_2.2.20_all.deb
|
||||
|
||||
RUN dpkg --add-architecture arm64 && \
|
||||
dpkg --add-architecture armel && \
|
||||
dpkg --add-architecture armhf
|
||||
|
||||
RUN apt-get install -y \
|
||||
crossbuild-essential-arm64 \
|
||||
crossbuild-essential-armel \
|
||||
crossbuild-essential-armhf
|
||||
|
||||
RUN xapt -a arm64 libi2c-dev libsnmp-dev libssl-dev libedit-dev ncurses-dev && \
|
||||
xapt -a armel libi2c-dev libsnmp-dev libssl-dev libedit-dev ncurses-dev && \
|
||||
xapt -a armhf libi2c-dev libsnmp-dev libssl-dev libedit-dev ncurses-dev
|
||||
|
||||
#
|
||||
# Copy the docker shell init script to /bin
|
||||
#
|
||||
COPY docker_shell /bin/docker_shell
|
||||
COPY container-id /bin/container-id
|
||||
19
docker/images/builder10/1.0/Makefile
Normal file
19
docker/images/builder10/1.0/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
VERSION=1.0
|
||||
USER=opennetworklinux
|
||||
REPO=builder10
|
||||
|
||||
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)
|
||||
@@ -17,25 +17,33 @@ g_current_user = getpass.getuser()
|
||||
g_current_uid = os.getuid()
|
||||
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.10"
|
||||
g_builder9_image_name="opennetworklinux/builder9:1.5"
|
||||
g_builders = {
|
||||
'default' : 8,
|
||||
'builders' : {
|
||||
7 : ('wheezy', 'opennetworklinux/builder7:1.2'),
|
||||
8 : ('jessie', 'opennetworklinux/builder8:1.10'),
|
||||
9 : ('stretch', 'opennetworklinux/builder9:1.5' ),
|
||||
10 : ('buster', 'opennetworklinux/builder10:1.0'),
|
||||
},
|
||||
}
|
||||
|
||||
g_default_image_name=g_builder8_image_name
|
||||
g_default_image_name = g_builders['builders'][g_builders['default']][1]
|
||||
g_default_container_name = "%s_%s" % (g_current_user, g_timestamp)
|
||||
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')
|
||||
ap.add_argument('--7', '-7',
|
||||
help="Run the debian 7 version.",
|
||||
action='store_true', dest='debian7')
|
||||
for v in reversed(sorted(g_builders['builders'].keys())):
|
||||
(n, i) = g_builders['builders'][v]
|
||||
ap.add_argument('--' + str(v), '-' + str(v),
|
||||
'--' + n, '-' + n,
|
||||
help="Run the Debian %s (%s) image." % (v, n.capitalize()),
|
||||
action='store_const', const=i,
|
||||
dest='image', default=g_default_image_name)
|
||||
|
||||
ap.add_argument("--image", "-i",
|
||||
help="The docker image to use. The default is %s." % g_default_image_name,
|
||||
dest='image', default=g_default_image_name)
|
||||
|
||||
ap.add_argument("--pull",
|
||||
help="Pull the docker image before running to make sure it is up to date.",
|
||||
@@ -49,10 +57,6 @@ ap.add_argument("--verbose", "-v",
|
||||
help="Verbose logging.",
|
||||
action='store_true')
|
||||
|
||||
ap.add_argument("--image", "-i",
|
||||
help="The docker image to use. The default is %s." % g_default_image_name,
|
||||
default=g_default_image_name)
|
||||
|
||||
ap.add_argument("--exec", "-e",
|
||||
help="Execute in running container instead of starting a new one.",
|
||||
metavar='CONTAINER|NAME',
|
||||
@@ -115,15 +119,6 @@ ap.add_argument("--command", "-c",
|
||||
|
||||
ops = ap.parse_args()
|
||||
|
||||
if ops.debian7:
|
||||
ops.image = g_builder7_image_name
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@@ -53,6 +53,11 @@ pkg:
|
||||
$(ONL_V_GEN) $(ONLPM_ENVIRONMENT) NOBUILD=1 $(ONLPM) $(ONLPM_OPTS) --build all --arches $(ARCHES)
|
||||
|
||||
|
||||
#
|
||||
# Run the module autogen on all modules under the current directory.
|
||||
#
|
||||
autogen:
|
||||
$(BUILDER)/tools/modtool.py --load-dir . --foreach-module 'make -C %(dir)s autogen'
|
||||
|
||||
#
|
||||
# Generate a rule for all available packages
|
||||
|
||||
@@ -296,7 +296,7 @@ temp_devname_handler__(netsnmp_request_info *req,
|
||||
uint32_t index,
|
||||
onlp_snmp_sensor_t *ss)
|
||||
{
|
||||
char device_name[ONLP_SNMP_CONFIG_MAX_NAME_LENGTH+ONLP_SNMP_CONFIG_MAX_DESC_LENGTH];
|
||||
char device_name[ONLP_SNMP_CONFIG_MAX_NAME_LENGTH+ONLP_SNMP_CONFIG_MAX_DESC_LENGTH + 32];
|
||||
|
||||
snprintf(device_name, sizeof(device_name),
|
||||
"%s %s%s", "Thermal", ss->name, ss->desc);
|
||||
@@ -400,7 +400,7 @@ fan_devname_handler__(netsnmp_request_info *req,
|
||||
uint32_t index,
|
||||
onlp_snmp_sensor_t *ss)
|
||||
{
|
||||
char device_name[ONLP_SNMP_CONFIG_MAX_NAME_LENGTH+ONLP_SNMP_CONFIG_MAX_DESC_LENGTH];
|
||||
char device_name[ONLP_SNMP_CONFIG_MAX_NAME_LENGTH+ONLP_SNMP_CONFIG_MAX_DESC_LENGTH + 32];
|
||||
snprintf(device_name, sizeof(device_name),
|
||||
"%s %s%s", "Fan", ss->name, ss->desc);
|
||||
|
||||
@@ -600,7 +600,7 @@ psu_devname_handler__(netsnmp_request_info *req,
|
||||
uint32_t index,
|
||||
onlp_snmp_sensor_t *ss)
|
||||
{
|
||||
char device_name[ONLP_SNMP_CONFIG_MAX_NAME_LENGTH+ONLP_SNMP_CONFIG_MAX_DESC_LENGTH];
|
||||
char device_name[ONLP_SNMP_CONFIG_MAX_NAME_LENGTH+ONLP_SNMP_CONFIG_MAX_DESC_LENGTH + 32];
|
||||
snprintf(device_name, sizeof(device_name),
|
||||
"%s %s%s", "PSU", ss->name, ss->desc);
|
||||
|
||||
|
||||
@@ -59,6 +59,10 @@ cdefs: &cdefs
|
||||
doc: "Include the custom i2c header (include/linux/i2c-devices.h) to avoid conflicts with the kernel and i2c-dev packages."
|
||||
default: 1
|
||||
|
||||
- ONLPLIB_CONFIG_I2C_INCLUDE_SMBUS:
|
||||
doc: "Include <i2c/smbus.h>"
|
||||
default: 0
|
||||
|
||||
definitions:
|
||||
cdefs:
|
||||
ONLPLIB_CONFIG_HEADER:
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#if ONLPLIB_CONFIG_INCLUDE_I2C == 1
|
||||
|
||||
|
||||
/**
|
||||
* Use TENBIT mode. Default is to disable TENBIT mode.
|
||||
*/
|
||||
@@ -350,7 +351,15 @@ extern onlp_i2c_mux_driver_t onlp_i2c_mux_driver_pca9548;
|
||||
|
||||
|
||||
|
||||
#if ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER == 1
|
||||
#include <linux/i2c-devices.h>
|
||||
#else
|
||||
#include <linux/i2c-dev.h>
|
||||
#endif
|
||||
|
||||
#if ONLPLIB_CONFIG_I2C_INCLUDE_SMBUS == 1
|
||||
#include <i2c/smbus.h>
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* ONLPLIB_CONFIG_INCLUDE_I2C */
|
||||
|
||||
@@ -155,6 +155,16 @@
|
||||
#define ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ONLPLIB_CONFIG_INCLUDE_I2C_SMBUS
|
||||
*
|
||||
* Include <i2c/smbus.h> */
|
||||
|
||||
|
||||
#ifndef ONLPLIB_CONFIG_INCLUDE_I2C_SMBUS
|
||||
#define ONLPLIB_CONFIG_INCLUDE_I2C_SMBUS 0
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
############################################################
|
||||
# <bsn.cl fy=2014 v=onl>
|
||||
#
|
||||
# Copyright 2014, 2015 Big Switch Networks, Inc.
|
||||
#
|
||||
#
|
||||
# Copyright 2014, 2015 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>
|
||||
############################################################
|
||||
#
|
||||
@@ -28,3 +28,7 @@ onlplib_INCLUDES := -I $(THIS_DIR)inc
|
||||
onlplib_INTERNAL_INCLUDES := -I $(THIS_DIR)src
|
||||
onlplib_DEPENDMODULE_ENTRIES := init:onlplib
|
||||
|
||||
ifeq ($(ONL_DEBIAN_SUITE),buster)
|
||||
GLOBAL_CFLAGS += -DONLPLIB_CONFIG_I2C_INCLUDE_SMBUS=1
|
||||
GLOBAL_LINK_LIBS += -li2c
|
||||
endif
|
||||
|
||||
@@ -30,12 +30,6 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER == 1
|
||||
#include <linux/i2c-devices.h>
|
||||
#else
|
||||
#include <linux/i2c-dev.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -84,6 +84,11 @@ onlplib_config_settings_t onlplib_config_settings[] =
|
||||
{ __onlplib_config_STRINGIFY_NAME(ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER), __onlplib_config_STRINGIFY_VALUE(ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER) },
|
||||
#else
|
||||
{ ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER(__onlplib_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef ONLPLIB_CONFIG_INCLUDE_I2C_SMBUS
|
||||
{ __onlplib_config_STRINGIFY_NAME(ONLPLIB_CONFIG_INCLUDE_I2C_SMBUS), __onlplib_config_STRINGIFY_VALUE(ONLPLIB_CONFIG_INCLUDE_I2C_SMBUS) },
|
||||
#else
|
||||
{ ONLPLIB_CONFIG_INCLUDE_I2C_SMBUS(__onlplib_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Inclusive Makefile for the libonlp-arm-accton-as4610-30 module.
|
||||
#
|
||||
# Autogenerated 2016-07-20 18:29:31.706331
|
||||
#
|
||||
###############################################################################
|
||||
libonlp-arm-accton-as4610-30_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Inclusive Makefile for the libonlp-arm-accton-as4610-54 module.
|
||||
#
|
||||
# Autogenerated 2016-07-20 18:27:47.344268
|
||||
#
|
||||
###############################################################################
|
||||
libonlp-arm-accton-as4610-54_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Inclusive Makefile for the libonlp-arm-accton-as4610-30 module.
|
||||
#
|
||||
# Autogenerated 2016-07-20 18:29:31.706331
|
||||
#
|
||||
###############################################################################
|
||||
libonlp-arm-accton-as4610-30_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Inclusive Makefile for the libonlp-arm-accton-as4610-54 module.
|
||||
#
|
||||
# Autogenerated 2016-07-20 18:27:47.344268
|
||||
#
|
||||
###############################################################################
|
||||
libonlp-arm-accton-as4610-54_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
@@ -24,45 +24,44 @@
|
||||
############################################################
|
||||
|
||||
cdefs: &cdefs
|
||||
- ONLPSIM_CONFIG_INCLUDE_LOGGING:
|
||||
- ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING:
|
||||
doc: "Include or exclude logging."
|
||||
default: 1
|
||||
- ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT:
|
||||
- ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT:
|
||||
doc: "Default enabled log options."
|
||||
default: AIM_LOG_OPTIONS_DEFAULT
|
||||
- ONLPSIM_CONFIG_LOG_BITS_DEFAULT:
|
||||
- ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT:
|
||||
doc: "Default enabled log bits."
|
||||
default: AIM_LOG_BITS_DEFAULT
|
||||
- ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
|
||||
- ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
|
||||
doc: "Default enabled custom log bits."
|
||||
default: 0
|
||||
- ONLPSIM_CONFIG_PORTING_STDLIB:
|
||||
- ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB:
|
||||
doc: "Default all porting macros to use the C standard libraries."
|
||||
default: 1
|
||||
- ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
|
||||
- ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
|
||||
doc: "Include standard library headers for stdlib porting macros."
|
||||
default: ONLPSIM_CONFIG_PORTING_STDLIB
|
||||
- ONLPSIM_CONFIG_INCLUDE_UCLI:
|
||||
default: ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB
|
||||
- ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI:
|
||||
doc: "Include generic uCli support."
|
||||
default: 0
|
||||
- ONLPSIM_CONFIG_SFP_COUNT:
|
||||
- ARM_ACCTON_AS4610_CONFIG_SFP_COUNT:
|
||||
doc: "SFP Count."
|
||||
default: 0
|
||||
|
||||
definitions:
|
||||
cdefs:
|
||||
ONLPSIM_CONFIG_HEADER:
|
||||
ARM_ACCTON_AS4610_CONFIG_HEADER:
|
||||
defs: *cdefs
|
||||
basename: arm_accton_as4610_config
|
||||
|
||||
portingmacro:
|
||||
ONLPSIM:
|
||||
ARM_ACCTON_AS4610:
|
||||
macros:
|
||||
- malloc
|
||||
- free
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
|
||||
@@ -32,96 +32,96 @@
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __ONLPSIM_CONFIG_H__
|
||||
#define __ONLPSIM_CONFIG_H__
|
||||
#ifndef __ARM_ACCTON_AS4610_CONFIG_H__
|
||||
#define __ARM_ACCTON_AS4610_CONFIG_H__
|
||||
|
||||
#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG
|
||||
#include <global_custom_config.h>
|
||||
#endif
|
||||
#ifdef ONLPSIM_INCLUDE_CUSTOM_CONFIG
|
||||
#ifdef ARM_ACCTON_AS4610_INCLUDE_CUSTOM_CONFIG
|
||||
#include <arm_accton_as4610_custom_config.h>
|
||||
#endif
|
||||
|
||||
/* <auto.start.cdefs(ONLPSIM_CONFIG_HEADER).header> */
|
||||
/* <auto.start.cdefs(ARM_ACCTON_AS4610_CONFIG_HEADER).header> */
|
||||
#include <AIM/aim.h>
|
||||
/**
|
||||
* ONLPSIM_CONFIG_INCLUDE_LOGGING
|
||||
* ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING
|
||||
*
|
||||
* Include or exclude logging. */
|
||||
|
||||
|
||||
#ifndef ONLPSIM_CONFIG_INCLUDE_LOGGING
|
||||
#define ONLPSIM_CONFIG_INCLUDE_LOGGING 1
|
||||
#ifndef ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING
|
||||
#define ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
* ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
*
|
||||
* Default enabled log options. */
|
||||
|
||||
|
||||
#ifndef ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
#define ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT
|
||||
#ifndef ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
#define ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ONLPSIM_CONFIG_LOG_BITS_DEFAULT
|
||||
* ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT
|
||||
*
|
||||
* Default enabled log bits. */
|
||||
|
||||
|
||||
#ifndef ONLPSIM_CONFIG_LOG_BITS_DEFAULT
|
||||
#define ONLPSIM_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT
|
||||
#ifndef ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT
|
||||
#define ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
* ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
*
|
||||
* Default enabled custom log bits. */
|
||||
|
||||
|
||||
#ifndef ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
#define ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0
|
||||
#ifndef ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
#define ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ONLPSIM_CONFIG_PORTING_STDLIB
|
||||
* ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB
|
||||
*
|
||||
* Default all porting macros to use the C standard libraries. */
|
||||
|
||||
|
||||
#ifndef ONLPSIM_CONFIG_PORTING_STDLIB
|
||||
#define ONLPSIM_CONFIG_PORTING_STDLIB 1
|
||||
#ifndef ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB
|
||||
#define ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
* ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
*
|
||||
* Include standard library headers for stdlib porting macros. */
|
||||
|
||||
|
||||
#ifndef ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
#define ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS ONLPSIM_CONFIG_PORTING_STDLIB
|
||||
#ifndef ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
#define ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ONLPSIM_CONFIG_INCLUDE_UCLI
|
||||
* ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI
|
||||
*
|
||||
* Include generic uCli support. */
|
||||
|
||||
|
||||
#ifndef ONLPSIM_CONFIG_INCLUDE_UCLI
|
||||
#define ONLPSIM_CONFIG_INCLUDE_UCLI 0
|
||||
#ifndef ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI
|
||||
#define ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ONLPSIM_CONFIG_SFP_COUNT
|
||||
* ARM_ACCTON_AS4610_CONFIG_SFP_COUNT
|
||||
*
|
||||
* SFP Count. */
|
||||
|
||||
|
||||
#ifndef ONLPSIM_CONFIG_SFP_COUNT
|
||||
#define ONLPSIM_CONFIG_SFP_COUNT 0
|
||||
#ifndef ARM_ACCTON_AS4610_CONFIG_SFP_COUNT
|
||||
#define ARM_ACCTON_AS4610_CONFIG_SFP_COUNT 0
|
||||
#endif
|
||||
|
||||
|
||||
@@ -154,9 +154,9 @@ const char* arm_accton_as4610_config_lookup(const char* setting);
|
||||
*/
|
||||
int arm_accton_as4610_config_show(struct aim_pvs_s* pvs);
|
||||
|
||||
/* <auto.end.cdefs(ONLPSIM_CONFIG_HEADER).header> */
|
||||
/* <auto.end.cdefs(ARM_ACCTON_AS4610_CONFIG_HEADER).header> */
|
||||
|
||||
#include "arm_accton_as4610_porting.h"
|
||||
|
||||
#endif /* __ONLPSIM_CONFIG_H__ */
|
||||
#endif /* __ARM_ACCTON_AS4610_CONFIG_H__ */
|
||||
/* @} */
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
* arm_accton_as4610 Doxygen Header
|
||||
*
|
||||
***********************************************************/
|
||||
#ifndef __ONLPSIM_DOX_H__
|
||||
#define __ONLPSIM_DOX_H__
|
||||
#ifndef __ARM_ACCTON_AS4610_DOX_H__
|
||||
#define __ARM_ACCTON_AS4610_DOX_H__
|
||||
|
||||
/**
|
||||
* @defgroup arm_accton_as4610 arm_accton_as4610 - onlpsim Description
|
||||
@@ -48,4 +48,4 @@ The documentation overview for this module should go here.
|
||||
*
|
||||
*/
|
||||
|
||||
#endif /* __ONLPSIM_DOX_H__ */
|
||||
#endif /* __ARM_ACCTON_AS4610_DOX_H__ */
|
||||
|
||||
@@ -32,12 +32,12 @@
|
||||
* @{
|
||||
*
|
||||
***********************************************************/
|
||||
#ifndef __ONLPSIM_PORTING_H__
|
||||
#define __ONLPSIM_PORTING_H__
|
||||
#ifndef __ARM_ACCTON_AS4610_PORTING_H__
|
||||
#define __ARM_ACCTON_AS4610_PORTING_H__
|
||||
|
||||
|
||||
/* <auto.start.portingmacro(ALL).define> */
|
||||
#if ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1
|
||||
#if ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -45,88 +45,78 @@
|
||||
#include <memory.h>
|
||||
#endif
|
||||
|
||||
#ifndef ONLPSIM_MALLOC
|
||||
#ifndef ARM_ACCTON_AS4610_MALLOC
|
||||
#if defined(GLOBAL_MALLOC)
|
||||
#define ONLPSIM_MALLOC GLOBAL_MALLOC
|
||||
#elif ONLPSIM_CONFIG_PORTING_STDLIB == 1
|
||||
#define ONLPSIM_MALLOC malloc
|
||||
#define ARM_ACCTON_AS4610_MALLOC GLOBAL_MALLOC
|
||||
#elif ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB == 1
|
||||
#define ARM_ACCTON_AS4610_MALLOC malloc
|
||||
#else
|
||||
#error The macro ONLPSIM_MALLOC is required but cannot be defined.
|
||||
#error The macro ARM_ACCTON_AS4610_MALLOC is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ONLPSIM_FREE
|
||||
#ifndef ARM_ACCTON_AS4610_FREE
|
||||
#if defined(GLOBAL_FREE)
|
||||
#define ONLPSIM_FREE GLOBAL_FREE
|
||||
#elif ONLPSIM_CONFIG_PORTING_STDLIB == 1
|
||||
#define ONLPSIM_FREE free
|
||||
#define ARM_ACCTON_AS4610_FREE GLOBAL_FREE
|
||||
#elif ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB == 1
|
||||
#define ARM_ACCTON_AS4610_FREE free
|
||||
#else
|
||||
#error The macro ONLPSIM_FREE is required but cannot be defined.
|
||||
#error The macro ARM_ACCTON_AS4610_FREE is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ONLPSIM_MEMSET
|
||||
#ifndef ARM_ACCTON_AS4610_MEMSET
|
||||
#if defined(GLOBAL_MEMSET)
|
||||
#define ONLPSIM_MEMSET GLOBAL_MEMSET
|
||||
#elif ONLPSIM_CONFIG_PORTING_STDLIB == 1
|
||||
#define ONLPSIM_MEMSET memset
|
||||
#define ARM_ACCTON_AS4610_MEMSET GLOBAL_MEMSET
|
||||
#elif ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB == 1
|
||||
#define ARM_ACCTON_AS4610_MEMSET memset
|
||||
#else
|
||||
#error The macro ONLPSIM_MEMSET is required but cannot be defined.
|
||||
#error The macro ARM_ACCTON_AS4610_MEMSET is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ONLPSIM_MEMCPY
|
||||
#ifndef ARM_ACCTON_AS4610_MEMCPY
|
||||
#if defined(GLOBAL_MEMCPY)
|
||||
#define ONLPSIM_MEMCPY GLOBAL_MEMCPY
|
||||
#elif ONLPSIM_CONFIG_PORTING_STDLIB == 1
|
||||
#define ONLPSIM_MEMCPY memcpy
|
||||
#define ARM_ACCTON_AS4610_MEMCPY GLOBAL_MEMCPY
|
||||
#elif ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB == 1
|
||||
#define ARM_ACCTON_AS4610_MEMCPY memcpy
|
||||
#else
|
||||
#error The macro ONLPSIM_MEMCPY is required but cannot be defined.
|
||||
#error The macro ARM_ACCTON_AS4610_MEMCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ONLPSIM_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define ONLPSIM_STRNCPY GLOBAL_STRNCPY
|
||||
#elif ONLPSIM_CONFIG_PORTING_STDLIB == 1
|
||||
#define ONLPSIM_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro ONLPSIM_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ONLPSIM_VSNPRINTF
|
||||
#ifndef ARM_ACCTON_AS4610_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define ONLPSIM_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
#elif ONLPSIM_CONFIG_PORTING_STDLIB == 1
|
||||
#define ONLPSIM_VSNPRINTF vsnprintf
|
||||
#define ARM_ACCTON_AS4610_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
#elif ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB == 1
|
||||
#define ARM_ACCTON_AS4610_VSNPRINTF vsnprintf
|
||||
#else
|
||||
#error The macro ONLPSIM_VSNPRINTF is required but cannot be defined.
|
||||
#error The macro ARM_ACCTON_AS4610_VSNPRINTF is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ONLPSIM_SNPRINTF
|
||||
#ifndef ARM_ACCTON_AS4610_SNPRINTF
|
||||
#if defined(GLOBAL_SNPRINTF)
|
||||
#define ONLPSIM_SNPRINTF GLOBAL_SNPRINTF
|
||||
#elif ONLPSIM_CONFIG_PORTING_STDLIB == 1
|
||||
#define ONLPSIM_SNPRINTF snprintf
|
||||
#define ARM_ACCTON_AS4610_SNPRINTF GLOBAL_SNPRINTF
|
||||
#elif ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB == 1
|
||||
#define ARM_ACCTON_AS4610_SNPRINTF snprintf
|
||||
#else
|
||||
#error The macro ONLPSIM_SNPRINTF is required but cannot be defined.
|
||||
#error The macro ARM_ACCTON_AS4610_SNPRINTF is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ONLPSIM_STRLEN
|
||||
#ifndef ARM_ACCTON_AS4610_STRLEN
|
||||
#if defined(GLOBAL_STRLEN)
|
||||
#define ONLPSIM_STRLEN GLOBAL_STRLEN
|
||||
#elif ONLPSIM_CONFIG_PORTING_STDLIB == 1
|
||||
#define ONLPSIM_STRLEN strlen
|
||||
#define ARM_ACCTON_AS4610_STRLEN GLOBAL_STRLEN
|
||||
#elif ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB == 1
|
||||
#define ARM_ACCTON_AS4610_STRLEN strlen
|
||||
#else
|
||||
#error The macro ONLPSIM_STRLEN is required but cannot be defined.
|
||||
#error The macro ARM_ACCTON_AS4610_STRLEN is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* <auto.end.portingmacro(ALL).define> */
|
||||
|
||||
|
||||
#endif /* __ONLPSIM_PORTING_H__ */
|
||||
#endif /* __ARM_ACCTON_AS4610_PORTING_H__ */
|
||||
/* @} */
|
||||
|
||||
@@ -25,50 +25,50 @@
|
||||
|
||||
#include <arm_accton_as4610/arm_accton_as4610_config.h>
|
||||
|
||||
/* <auto.start.cdefs(ONLPSIM_CONFIG_HEADER).source> */
|
||||
/* <auto.start.cdefs(ARM_ACCTON_AS4610_CONFIG_HEADER).source> */
|
||||
#define __arm_accton_as4610_config_STRINGIFY_NAME(_x) #_x
|
||||
#define __arm_accton_as4610_config_STRINGIFY_VALUE(_x) __arm_accton_as4610_config_STRINGIFY_NAME(_x)
|
||||
arm_accton_as4610_config_settings_t arm_accton_as4610_config_settings[] =
|
||||
{
|
||||
#ifdef ONLPSIM_CONFIG_INCLUDE_LOGGING
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_INCLUDE_LOGGING), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_INCLUDE_LOGGING) },
|
||||
#ifdef ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING) },
|
||||
#else
|
||||
{ ONLPSIM_CONFIG_INCLUDE_LOGGING(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
{ ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT) },
|
||||
#ifdef ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT) },
|
||||
#else
|
||||
{ ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
{ ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef ONLPSIM_CONFIG_LOG_BITS_DEFAULT
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_LOG_BITS_DEFAULT), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_LOG_BITS_DEFAULT) },
|
||||
#ifdef ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT) },
|
||||
#else
|
||||
{ ONLPSIM_CONFIG_LOG_BITS_DEFAULT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
{ ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT) },
|
||||
#ifdef ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT) },
|
||||
#else
|
||||
{ ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
{ ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef ONLPSIM_CONFIG_PORTING_STDLIB
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_PORTING_STDLIB), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_PORTING_STDLIB) },
|
||||
#ifdef ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB) },
|
||||
#else
|
||||
{ ONLPSIM_CONFIG_PORTING_STDLIB(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
{ ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) },
|
||||
#ifdef ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) },
|
||||
#else
|
||||
{ ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
{ ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef ONLPSIM_CONFIG_INCLUDE_UCLI
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_INCLUDE_UCLI), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_INCLUDE_UCLI) },
|
||||
#ifdef ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI) },
|
||||
#else
|
||||
{ ONLPSIM_CONFIG_INCLUDE_UCLI(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
{ ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef ONLPSIM_CONFIG_SFP_COUNT
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_SFP_COUNT), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_SFP_COUNT) },
|
||||
#ifdef ARM_ACCTON_AS4610_CONFIG_SFP_COUNT
|
||||
{ __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_SFP_COUNT), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_SFP_COUNT) },
|
||||
#else
|
||||
{ ONLPSIM_CONFIG_SFP_COUNT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
{ ARM_ACCTON_AS4610_CONFIG_SFP_COUNT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
@@ -97,5 +97,5 @@ arm_accton_as4610_config_show(struct aim_pvs_s* pvs)
|
||||
return i;
|
||||
}
|
||||
|
||||
/* <auto.end.cdefs(ONLPSIM_CONFIG_HEADER).source> */
|
||||
/* <auto.end.cdefs(ARM_ACCTON_AS4610_CONFIG_HEADER).source> */
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
*
|
||||
***********************************************************/
|
||||
|
||||
#ifndef __ONLPSIM_INT_H__
|
||||
#define __ONLPSIM_INT_H__
|
||||
#ifndef __ARM_ACCTON_AS4610_INT_H__
|
||||
#define __ARM_ACCTON_AS4610_INT_H__
|
||||
|
||||
#include <arm_accton_as4610/arm_accton_as4610_config.h>
|
||||
|
||||
|
||||
#endif /* __ONLPSIM_INT_H__ */
|
||||
#endif /* __ARM_ACCTON_AS4610_INT_H__ */
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
* arm_accton_as4610 log struct.
|
||||
*/
|
||||
AIM_LOG_STRUCT_DEFINE(
|
||||
ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT,
|
||||
ONLPSIM_CONFIG_LOG_BITS_DEFAULT,
|
||||
ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT,
|
||||
ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT,
|
||||
NULL, /* Custom log map */
|
||||
ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
);
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
*
|
||||
***********************************************************/
|
||||
|
||||
#ifndef __ONLPSIM_LOG_H__
|
||||
#define __ONLPSIM_LOG_H__
|
||||
#ifndef __ARM_ACCTON_AS4610_LOG_H__
|
||||
#define __ARM_ACCTON_AS4610_LOG_H__
|
||||
|
||||
#define AIM_LOG_MODULE_NAME arm_accton_as4610
|
||||
#include <AIM/aim_log.h>
|
||||
|
||||
#endif /* __ONLPSIM_LOG_H__ */
|
||||
#endif /* __ARM_ACCTON_AS4610_LOG_H__ */
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
static int
|
||||
datatypes_init__(void)
|
||||
{
|
||||
#define ONLPSIM_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
|
||||
#define ARM_ACCTON_AS4610_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
|
||||
#include <arm_accton_as4610/arm_accton_as4610.x>
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include <arm_accton_as4610/arm_accton_as4610_config.h>
|
||||
|
||||
#if ONLPSIM_CONFIG_INCLUDE_UCLI == 1
|
||||
#if ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI == 1
|
||||
|
||||
#include <uCli/ucli.h>
|
||||
#include <uCli/ucli_argparse.h>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <onlp/platformi/fani.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include "platform_lib.h"
|
||||
#include "arm_accton_as4610_int.h"
|
||||
|
||||
@@ -123,7 +124,7 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info)
|
||||
{
|
||||
int fd, len, nbytes = 10;
|
||||
char r_data[10] = {0};
|
||||
char fullpath[65] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
/* get fan fault status (turn on when any one fails)
|
||||
*/
|
||||
@@ -132,7 +133,7 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info)
|
||||
if (atoi(r_data) > 0) {
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/* get fan speed
|
||||
*/
|
||||
@@ -152,7 +153,7 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info)
|
||||
int psu_id;
|
||||
int fd, len, nbytes = 10;
|
||||
char r_data[10] = {0};
|
||||
char fullpath[80] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
psu_type_t psu_type;
|
||||
|
||||
/* get fan fault status
|
||||
@@ -215,7 +216,7 @@ onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info)
|
||||
if (chassis_fan_count() == 0) {
|
||||
local_id += 1;
|
||||
}
|
||||
|
||||
|
||||
*info = linfo[local_id];
|
||||
|
||||
switch (local_id)
|
||||
@@ -263,7 +264,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p)
|
||||
{
|
||||
int fd, len, nbytes=10, local_id;
|
||||
char data[10] = {0};
|
||||
char fullpath[70] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
@@ -347,4 +348,3 @@ onlp_fani_ioctl(onlp_oid_t id, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
strncmp(model_name, "YM-1151D", strlen("YM-1151D")) == 0 ||
|
||||
strncmp(model_name, "YM-1601A", strlen("YM-1601A")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, modelname_len-1);
|
||||
aim_strlcpy(modelname, model_name, modelname_len-1);
|
||||
}
|
||||
return PSU_TYPE_AC_F2B;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ definitions:
|
||||
- free
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
|
||||
@@ -60,16 +60,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef POWERPC_ACCTON_AS4600_54T_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define POWERPC_ACCTON_AS4600_54T_STRNCPY GLOBAL_STRNCPY
|
||||
#elif POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB == 1
|
||||
#define POWERPC_ACCTON_AS4600_54T_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro POWERPC_ACCTON_AS4600_54T_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef POWERPC_ACCTON_AS4600_54T_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define POWERPC_ACCTON_AS4600_54T_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
|
||||
@@ -333,7 +333,7 @@ int as4600_54t_get_psu_type(int pid, char* modelname, int modelname_len)
|
||||
|
||||
if(modelname) {
|
||||
/* Return the model name in the given buffer */
|
||||
strncpy(modelname, model_name, modelname_len-1);
|
||||
aim_strlcpy(modelname, model_name, modelname_len-1);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -41,7 +41,7 @@ definitions:
|
||||
- free
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
|
||||
@@ -60,16 +60,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef POWERPC_ACCTON_AS5610_52X_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define POWERPC_ACCTON_AS5610_52X_STRNCPY GLOBAL_STRNCPY
|
||||
#elif POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB == 1
|
||||
#define POWERPC_ACCTON_AS5610_52X_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro POWERPC_ACCTON_AS5610_52X_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef POWERPC_ACCTON_AS5610_52X_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define POWERPC_ACCTON_AS5610_52X_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
|
||||
@@ -529,7 +529,7 @@ as5610_52x_psu_type_t as5610_52x_get_psu_type(int id, char* modelname, int model
|
||||
|
||||
if(modelname) {
|
||||
/* Return the model name in the given buffer */
|
||||
strncpy(modelname, model_name, modelname_len-1);
|
||||
aim_strlcpy(modelname, model_name, modelname_len-1);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -54,7 +54,7 @@ definitions:
|
||||
- free
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
|
||||
@@ -60,16 +60,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef POWERPC_ACCTON_AS5710_54X_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define POWERPC_ACCTON_AS5710_54X_STRNCPY GLOBAL_STRNCPY
|
||||
#elif POWERPC_ACCTON_AS5710_54X_CONFIG_PORTING_STDLIB == 1
|
||||
#define POWERPC_ACCTON_AS5710_54X_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro POWERPC_ACCTON_AS5710_54X_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef POWERPC_ACCTON_AS5710_54X_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define POWERPC_ACCTON_AS5710_54X_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
|
||||
@@ -135,13 +135,13 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
|
||||
if (strncmp(model_name, "CPR-4011-4M11", strlen("CPR-4011-4M11")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, 13);
|
||||
aim_strlcpy(modelname, model_name, 13);
|
||||
}
|
||||
return PSU_TYPE_AC_F2B;
|
||||
}
|
||||
else if (strncmp(model_name, "CPR-4011-4M21", strlen("CPR-4011-4M21")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, 13);
|
||||
aim_strlcpy(modelname, model_name, 13);
|
||||
}
|
||||
return PSU_TYPE_AC_B2F;
|
||||
}
|
||||
@@ -154,20 +154,20 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
|
||||
if (strncmp(model_name, "um400d01G", strlen("um400d01G")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, 9);
|
||||
aim_strlcpy(modelname, model_name, 9);
|
||||
}
|
||||
return PSU_TYPE_DC_48V_B2F;
|
||||
}
|
||||
else if (strncmp(model_name, "um400d01-01G", strlen("um400d01-01G")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, 12);
|
||||
aim_strlcpy(modelname, model_name, 12);
|
||||
}
|
||||
return PSU_TYPE_DC_48V_F2B;
|
||||
}
|
||||
|
||||
if (strncmp(model_name, "PSU-12V-650", 11) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, 11);
|
||||
aim_strlcpy(modelname, model_name, 11);
|
||||
}
|
||||
|
||||
node = (id == PSU1_ID) ? PSU1_DC_HWMON_NODE(psu_fan_dir) : PSU2_DC_HWMON_NODE(psu_fan_dir);
|
||||
|
||||
@@ -41,7 +41,7 @@ definitions:
|
||||
- free
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
|
||||
@@ -60,16 +60,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef POWERPC_ACCTON_AS6700_32X_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define POWERPC_ACCTON_AS6700_32X_STRNCPY GLOBAL_STRNCPY
|
||||
#elif POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB == 1
|
||||
#define POWERPC_ACCTON_AS6700_32X_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro POWERPC_ACCTON_AS6700_32X_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef POWERPC_ACCTON_AS6700_32X_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define POWERPC_ACCTON_AS6700_32X_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
|
||||
@@ -128,13 +128,13 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
|
||||
if (strncmp(model_name, "CPR-4011-4M11", strlen("CPR-4011-4M11")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, modelname_len-1);
|
||||
aim_strlcpy(modelname, model_name, modelname_len-1);
|
||||
}
|
||||
return PSU_TYPE_AC_F2B;
|
||||
}
|
||||
else if (strncmp(model_name, "CPR-4011-4M21", strlen("CPR-4011-4M21")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, modelname_len-1);
|
||||
aim_strlcpy(modelname, model_name, modelname_len-1);
|
||||
}
|
||||
return PSU_TYPE_AC_B2F;
|
||||
}
|
||||
@@ -147,13 +147,13 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
|
||||
if (strncmp(model_name, "um400d01G", strlen("um400d01G")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, modelname_len-1);
|
||||
aim_strlcpy(modelname, model_name, modelname_len-1);
|
||||
}
|
||||
return PSU_TYPE_DC_48V_B2F;
|
||||
}
|
||||
else if (strncmp(model_name, "um400d01-01G", strlen("um400d01-01G")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, modelname_len-1);
|
||||
aim_strlcpy(modelname, model_name, modelname_len-1);
|
||||
}
|
||||
return PSU_TYPE_DC_48V_F2B;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ definitions:
|
||||
- free
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
|
||||
@@ -60,16 +60,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS4222_28PE_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define X86_64_ACCTON_AS4222_28PE_STRNCPY GLOBAL_STRNCPY
|
||||
#elif X86_64_ACCTON_AS4222_28PE_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_ACCTON_AS4222_28PE_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro X86_64_ACCTON_AS4222_28PE_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS4222_28PE_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define X86_64_ACCTON_AS4222_28PE_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <onlplib/mmap.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include "platform_lib.h"
|
||||
|
||||
#define prefix_path "/sys/class/leds/accton_as4222_28pe_led::"
|
||||
@@ -52,7 +52,7 @@ enum onlp_led_id
|
||||
LED_FAN,
|
||||
LED_PSU,
|
||||
};
|
||||
|
||||
|
||||
enum led_light_mode {
|
||||
LED_MODE_OFF = 0,
|
||||
LED_MODE_GREEN,
|
||||
@@ -128,7 +128,7 @@ static onlp_led_info_t linfo[] =
|
||||
static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode)
|
||||
{
|
||||
int i, nsize = sizeof(led_map)/sizeof(led_map[0]);
|
||||
|
||||
|
||||
for (i = 0; i < nsize; i++)
|
||||
{
|
||||
if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode)
|
||||
@@ -136,14 +136,14 @@ static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driv
|
||||
return led_map[i].onlp_led_mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode)
|
||||
{
|
||||
int i, nsize = sizeof(led_map)/sizeof(led_map[0]);
|
||||
|
||||
|
||||
for(i = 0; i < nsize; i++)
|
||||
{
|
||||
if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode)
|
||||
@@ -151,7 +151,7 @@ static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led
|
||||
return led_map[i].driver_led_mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -174,15 +174,15 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
{
|
||||
int local_id;
|
||||
char data[2] = {0};
|
||||
char fullpath[50] = {0};
|
||||
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
|
||||
|
||||
/* get fullpath */
|
||||
sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename);
|
||||
|
||||
|
||||
/* Set the onlp_oid_hdr_t and capabilities */
|
||||
*info = linfo[ONLP_OID_ID_GET(id)];
|
||||
|
||||
@@ -233,13 +233,13 @@ int
|
||||
onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
|
||||
{
|
||||
int local_id;
|
||||
char fullpath[50] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename);
|
||||
|
||||
sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename);
|
||||
|
||||
if (onlp_file_write_integer(fullpath, onlp_to_driver_led_mode(local_id, mode)) != 0)
|
||||
{
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
@@ -256,4 +256,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ definitions:
|
||||
- free
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
|
||||
@@ -60,16 +60,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS4630_54PE_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define X86_64_ACCTON_AS4630_54PE_STRNCPY GLOBAL_STRNCPY
|
||||
#elif X86_64_ACCTON_AS4630_54PE_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_ACCTON_AS4630_54PE_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro X86_64_ACCTON_AS4630_54PE_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS4630_54PE_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define X86_64_ACCTON_AS4630_54PE_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
|
||||
@@ -109,21 +109,21 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
if (!strncmp(model_name, "FSH082", strlen("FSH082")))
|
||||
{
|
||||
if (modelname)
|
||||
strncpy(modelname, model_name, strlen("FSH082")<(modelname_len-1)?strlen("FSH082"):(modelname_len-1));
|
||||
aim_strlcpy(modelname, model_name, strlen("FSH082")<(modelname_len-1)?strlen("FSH082"):(modelname_len-1));
|
||||
|
||||
return PSU_TYPE_ACBEL;
|
||||
}
|
||||
if (!strncmp(model_name, "YM-2651Y", strlen("YM-2651Y")))
|
||||
{
|
||||
if (modelname)
|
||||
strncpy(modelname, model_name, modelname_len-1);
|
||||
aim_strlcpy(modelname, model_name, modelname_len-1);
|
||||
return PSU_TYPE_YM2651Y;
|
||||
}
|
||||
|
||||
if (!strncmp(model_name, "YPEB1200A", strlen("YPEB1200A")))
|
||||
{
|
||||
if (modelname)
|
||||
strncpy(modelname, model_name, modelname_len-1);
|
||||
aim_strlcpy(modelname, model_name, modelname_len-1);
|
||||
return PSU_TYPE_YPEB1200A;
|
||||
}
|
||||
return PSU_TYPE_UNKNOWN;
|
||||
|
||||
@@ -44,7 +44,7 @@ definitions:
|
||||
- free
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
|
||||
@@ -60,16 +60,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS5512_54X_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define X86_64_ACCTON_AS5512_54X_STRNCPY GLOBAL_STRNCPY
|
||||
#elif X86_64_ACCTON_AS5512_54X_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_ACCTON_AS5512_54X_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro X86_64_ACCTON_AS5512_54X_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS5512_54X_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define X86_64_ACCTON_AS5512_54X_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <onlp/platformi/fani.h>
|
||||
#include <onlplib/mmap.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include "platform_lib.h"
|
||||
|
||||
#define PREFIX_PATH_ON_MAIN_BOARD "/sys/devices/platform/as5512_54x_fan/"
|
||||
@@ -155,7 +156,7 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info)
|
||||
{
|
||||
int fd, len, nbytes = 10;
|
||||
char r_data[10] = {0};
|
||||
char fullpath[65] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
/* get fan/fanr fault status (turn on when any one fails)
|
||||
*/
|
||||
@@ -205,7 +206,7 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info)
|
||||
int psu_id, is_ac=0;
|
||||
int fd, len, nbytes = 10;
|
||||
char r_data[10] = {0};
|
||||
char fullpath[50] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
psu_type_t psu_type;
|
||||
|
||||
/* get fan other cap status according to psu type
|
||||
@@ -335,7 +336,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p)
|
||||
{
|
||||
int fd, len, nbytes=10, local_id;
|
||||
char data[10] = {0};
|
||||
char fullpath[70] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
@@ -416,5 +417,3 @@ onlp_fani_ioctl(onlp_oid_t id, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <onlplib/mmap.h>
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
@@ -196,7 +196,7 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
{
|
||||
int fd, len, nbytes=1, local_id;
|
||||
char data[2] = {0};
|
||||
char fullpath[50] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
@@ -270,7 +270,7 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
|
||||
{
|
||||
int fd, len, driver_mode, nbytes=1, local_id;
|
||||
char data[2] = {0};
|
||||
char fullpath[50] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
|
||||
@@ -133,13 +133,13 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
|
||||
if (strncmp(model_name, "CPR-4011-4M11", strlen("CPR-4011-4M11")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, modelname_len-1);
|
||||
aim_strlcpy(modelname, model_name, modelname_len-1);
|
||||
}
|
||||
return PSU_TYPE_AC_F2B;
|
||||
}
|
||||
else if (strncmp(model_name, "CPR-4011-4M21", strlen("CPR-4011-4M21")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, modelname_len-1);
|
||||
aim_strlcpy(modelname, model_name, modelname_len-1);
|
||||
}
|
||||
return PSU_TYPE_AC_B2F;
|
||||
}
|
||||
@@ -152,13 +152,13 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
|
||||
if (strncmp(model_name, "um400d01G", strlen("um400d01G")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, modelname_len-1);
|
||||
aim_strlcpy(modelname, model_name, modelname_len-1);
|
||||
}
|
||||
return PSU_TYPE_DC_48V_B2F;
|
||||
}
|
||||
else if (strncmp(model_name, "um400d01-01G", strlen("um400d01-01G")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, modelname_len-1);
|
||||
aim_strlcpy(modelname, model_name, modelname_len-1);
|
||||
}
|
||||
return PSU_TYPE_DC_48V_F2B;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ definitions:
|
||||
- free
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
|
||||
@@ -60,16 +60,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS5712_54X_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define X86_64_ACCTON_AS5712_54X_STRNCPY GLOBAL_STRNCPY
|
||||
#elif X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_ACCTON_AS5712_54X_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro X86_64_ACCTON_AS5712_54X_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS5712_54X_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define X86_64_ACCTON_AS5712_54X_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
|
||||
@@ -40,20 +40,20 @@ int deviceNodeWrite(char *filename, char *buffer, int buf_size, int data_len)
|
||||
|
||||
if ((buffer == NULL) || (buf_size < 0)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((len = write(fd, buffer, buf_size)) < 0) {
|
||||
close(fd);
|
||||
if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((len = write(fd, buffer, buf_size)) < 0) {
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((close(fd) == -1)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((len > buf_size) || (data_len != 0 && len != data_len)) {
|
||||
return -1;
|
||||
@@ -71,25 +71,25 @@ int deviceNodeWriteInt(char *filename, int value, int data_len)
|
||||
}
|
||||
|
||||
int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len)
|
||||
{
|
||||
{
|
||||
int fd;
|
||||
int len;
|
||||
|
||||
if ((buffer == NULL) || (buf_size < 0)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((fd = open(filename, O_RDONLY)) == -1) {
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((len = read(fd, buffer, buf_size)) < 0) {
|
||||
close(fd);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((close(fd) == -1)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((close(fd) == -1)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((len > buf_size) || (data_len != 0 && len != data_len)) {
|
||||
@@ -106,7 +106,7 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le
|
||||
if (data_len >= buf_size || data_len < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
ret = deviceNodeReadBinary(filename, buffer, buf_size-1, data_len);
|
||||
|
||||
if (ret == 0) {
|
||||
@@ -117,7 +117,7 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le
|
||||
buffer[buf_size-1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -135,25 +135,25 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
|
||||
if (strncmp(model_name, "CPR-4011-4M11", STRLEN("CPR-4011-4M11")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, sizeof(model_name));
|
||||
aim_strlcpy(modelname, model_name, sizeof(model_name));
|
||||
}
|
||||
return PSU_TYPE_AC_COMPUWARE_F2B;
|
||||
}
|
||||
else if (strncmp(model_name, "CPR-4011-4M21", STRLEN("CPR-4011-4M21")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, sizeof(model_name));
|
||||
aim_strlcpy(modelname, model_name, sizeof(model_name));
|
||||
}
|
||||
return PSU_TYPE_AC_COMPUWARE_B2F;
|
||||
}
|
||||
else if (strncmp(model_name, "CPR-6011-2M11", STRLEN("CPR-6011-2M11")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, sizeof(model_name));
|
||||
aim_strlcpy(modelname, model_name, sizeof(model_name));
|
||||
}
|
||||
return PSU_TYPE_AC_COMPUWARE_F2B;
|
||||
}
|
||||
else if (strncmp(model_name, "CPR-6011-2M21", STRLEN("CPR-6011-2M21")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, sizeof(model_name));
|
||||
aim_strlcpy(modelname, model_name, sizeof(model_name));
|
||||
}
|
||||
return PSU_TYPE_AC_COMPUWARE_B2F;
|
||||
}
|
||||
@@ -161,20 +161,20 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
|
||||
/* Check 3Y-Power AC model name */
|
||||
memset(model_name, 0, sizeof(model_name));
|
||||
node = (id == PSU1_ID) ? PSU1_AC_3YPOWER_EEPROM_NODE(psu_model_name) : PSU2_AC_3YPOWER_EEPROM_NODE(psu_model_name);
|
||||
node = (id == PSU1_ID) ? PSU1_AC_3YPOWER_EEPROM_NODE(psu_model_name) : PSU2_AC_3YPOWER_EEPROM_NODE(psu_model_name);
|
||||
|
||||
if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
|
||||
if (strncmp(model_name, "YM-2401JCR", STRLEN("YM-2401JCR")) == 0) {
|
||||
if (modelname) {
|
||||
model_name[STRLEN("YM-2401JCR")] = 0;
|
||||
strncpy(modelname, model_name, 11);
|
||||
aim_strlcpy(modelname, model_name, 11);
|
||||
}
|
||||
return PSU_TYPE_AC_3YPOWER_F2B;
|
||||
}
|
||||
else if (strncmp(model_name, "YM-2401JDR", STRLEN("YM-2401JDR")) == 0) {
|
||||
if (modelname) {
|
||||
model_name[STRLEN("YM-2401JDR")] = 0;
|
||||
strncpy(modelname, model_name, 11);
|
||||
aim_strlcpy(modelname, model_name, 11);
|
||||
}
|
||||
return PSU_TYPE_AC_3YPOWER_B2F;
|
||||
}
|
||||
@@ -188,14 +188,14 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
if (strncmp(model_name, "um400d01G", STRLEN("um400d01G")) == 0) {
|
||||
if (modelname) {
|
||||
model_name[STRLEN("um400d01G")] = 0;
|
||||
strncpy(modelname, model_name, 10);
|
||||
aim_strlcpy(modelname, model_name, 10);
|
||||
}
|
||||
return PSU_TYPE_DC_48V_B2F;
|
||||
}
|
||||
else if (strncmp(model_name, "um400d01-01G", STRLEN("um400d01-01G")) == 0) {
|
||||
if (modelname) {
|
||||
model_name[STRLEN("um400d01-01G")] = 0;
|
||||
strncpy(modelname, model_name, 13);
|
||||
aim_strlcpy(modelname, model_name, 13);
|
||||
}
|
||||
return PSU_TYPE_DC_48V_F2B;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ int psu_ym2401_pmbus_info_get(int id, char *node, int *value)
|
||||
{
|
||||
int ret = 0;
|
||||
char path[64] = {0};
|
||||
|
||||
|
||||
*value = 0;
|
||||
|
||||
if (PSU1_ID == id) {
|
||||
@@ -248,4 +248,3 @@ int psu_ym2401_pmbus_info_set(int id, char *node, int value)
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ definitions:
|
||||
- free
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
|
||||
@@ -60,16 +60,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS5812_54T_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define X86_64_ACCTON_AS5812_54T_STRNCPY GLOBAL_STRNCPY
|
||||
#elif X86_64_ACCTON_AS5812_54T_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_ACCTON_AS5812_54T_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro X86_64_ACCTON_AS5812_54T_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS5812_54T_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define X86_64_ACCTON_AS5812_54T_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <unistd.h>
|
||||
#include <onlplib/file.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include "platform_lib.h"
|
||||
#include "x86_64_accton_as5812_54t/x86_64_accton_as5812_54t_config.h"
|
||||
|
||||
@@ -44,7 +45,7 @@
|
||||
#define FAN_1_ON_PSU1 6
|
||||
#define FAN_1_ON_PSU2 7
|
||||
|
||||
#define PROJECT_NAME
|
||||
#define PROJECT_NAME
|
||||
|
||||
#define LEN_FILE_NAME 50
|
||||
|
||||
@@ -134,7 +135,7 @@ onlp_fan_info_t linfo[] = {
|
||||
printf("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \
|
||||
if (close(fd) == -1) \
|
||||
return ONLP_STATUS_E_INTERNAL
|
||||
|
||||
|
||||
|
||||
/* PSU relative marco */
|
||||
#define SET_PSU_TYPE_AC_F2B_FAN(info) \
|
||||
@@ -144,7 +145,7 @@ onlp_fan_info_t linfo[] = {
|
||||
#define SET_PSU_TYPE_AC_B2F_FAN(info) \
|
||||
info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F); \
|
||||
info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE
|
||||
|
||||
|
||||
#define SET_PSU_TYPE_UM400D_F2B_FAN(info) \
|
||||
info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B)
|
||||
|
||||
@@ -157,46 +158,46 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info)
|
||||
{
|
||||
int fd, len, nbytes = 10;
|
||||
char r_data[10] = {0};
|
||||
char fullpath[65] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
/* get fan/fanr fault status (turn on when any one fails)
|
||||
*/
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].status);
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].status);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
if (atoi(r_data) > 0)
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_status);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_status);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
if (atoi(r_data) > 0)
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
|
||||
/* get fan/fanr direction (both : the same)
|
||||
/* get fan/fanr direction (both : the same)
|
||||
*/
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].direction);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].direction);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
|
||||
if (atoi(r_data) == 0) /*F2B*/
|
||||
info->status |= ONLP_FAN_STATUS_F2B;
|
||||
else
|
||||
else
|
||||
info->status |= ONLP_FAN_STATUS_B2F;
|
||||
|
||||
/* get fan/fanr speed (take the average of two speeds)
|
||||
*/
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].speed);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].speed);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
info->rpm = atoi(r_data);
|
||||
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_speed);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_speed);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
info->rpm = (info->rpm + atoi(r_data))/2;
|
||||
|
||||
/* get speed percentage from rpm */
|
||||
info->percentage = (info->rpm * 100)/x86_64_accton_as5812_54t_CONFIG_SYS_FAN_FRONT_RPM_MAX;
|
||||
|
||||
/* check present */
|
||||
/* check present */
|
||||
if (info->rpm > 0)
|
||||
info->status |= ONLP_FAN_STATUS_PRESENT;
|
||||
info->status |= ONLP_FAN_STATUS_PRESENT;
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
@@ -211,7 +212,7 @@ _onlp_fani_info_get_fan_on_psu_ym2401(int pid, onlp_fan_info_t* info)
|
||||
if (psu_ym2401_pmbus_info_get(pid, "psu_fan1_speed_rpm", &val) == ONLP_STATUS_OK) {
|
||||
info->status |= (val > 0) ? 0 : ONLP_FAN_STATUS_FAILED;
|
||||
info->rpm = val;
|
||||
info->percentage = (info->rpm * 100) / 21600;
|
||||
info->percentage = (info->rpm * 100) / 21600;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
@@ -223,16 +224,16 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info)
|
||||
int psu_id;
|
||||
int fd, len, nbytes = 10;
|
||||
char r_data[10] = {0};
|
||||
char fullpath[50] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
psu_type_t psu_type;
|
||||
|
||||
/* get fan other cap status according to psu type
|
||||
|
||||
/* get fan other cap status according to psu type
|
||||
*/
|
||||
psu_id = (local_id-FAN_1_ON_PSU1) + 1;
|
||||
DEBUG_PRINT("[psu_id: %d]", psu_id);
|
||||
|
||||
DEBUG_PRINT("[psu_id: %d]", psu_id);
|
||||
|
||||
psu_type = get_psu_type(psu_id, NULL, 0); /* psu_id = 1 , present PSU1. pus_id =2 , present PSU2 */
|
||||
DEBUG_PRINT("[psu_type: %d]", psu_type);
|
||||
DEBUG_PRINT("[psu_type: %d]", psu_type);
|
||||
|
||||
switch (psu_type) {
|
||||
case PSU_TYPE_AC_COMPUWARE_F2B:
|
||||
@@ -251,26 +252,26 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info)
|
||||
break;
|
||||
default:
|
||||
if (LOCAL_DEBUG)
|
||||
printf("[Debug][%s][%d][psu_type=%d]\n", __FUNCTION__, __LINE__, psu_type);
|
||||
printf("[Debug][%s][%d][psu_type=%d]\n", __FUNCTION__, __LINE__, psu_type);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (psu_type == PSU_TYPE_AC_COMPUWARE_F2B ||
|
||||
psu_type == PSU_TYPE_AC_COMPUWARE_B2F )
|
||||
{
|
||||
/* get fan fault status
|
||||
/* get fan fault status
|
||||
*/
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].status);
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].status);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
if (atoi(r_data) > 0)
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
|
||||
|
||||
/* get fan speed
|
||||
*/
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].speed);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
info->rpm = atoi(r_data);
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].speed);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
info->rpm = atoi(r_data);
|
||||
|
||||
/* get speed percentage from rpm */
|
||||
info->percentage = (info->rpm * 100)/19328;
|
||||
@@ -314,11 +315,11 @@ onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info)
|
||||
{
|
||||
case FAN_1_ON_PSU1:
|
||||
case FAN_1_ON_PSU2:
|
||||
rc = _onlp_fani_info_get_fan_on_psu(local_id, info);
|
||||
rc = _onlp_fani_info_get_fan_on_psu(local_id, info);
|
||||
break;
|
||||
|
||||
default:
|
||||
rc =_onlp_fani_info_get_fan(local_id, info);
|
||||
rc =_onlp_fani_info_get_fan(local_id, info);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -349,10 +350,10 @@ onlp_fani_rpm_set(onlp_oid_t id, int rpm)
|
||||
*/
|
||||
int
|
||||
onlp_fani_percentage_set(onlp_oid_t id, int p)
|
||||
{
|
||||
{
|
||||
int fd, len, nbytes=10, local_id;
|
||||
char data[10] = {0};
|
||||
char fullpath[70] = {0};
|
||||
char data[10] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
@@ -362,7 +363,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p)
|
||||
if (p == 0){
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
|
||||
/* get fullpath */
|
||||
switch (local_id)
|
||||
{
|
||||
@@ -380,7 +381,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p)
|
||||
return psu_ym2401_pmbus_info_set(psu_id, "psu_fan1_duty_cycle_percentage", p);
|
||||
}
|
||||
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].ctrl_speed);
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].ctrl_speed);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -397,13 +398,13 @@ onlp_fani_percentage_set(onlp_oid_t id, int p)
|
||||
/* Create output file descriptor */
|
||||
fd = open(fullpath, O_WRONLY, 0644);
|
||||
if(fd == -1){
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
|
||||
len = write (fd, data, (ssize_t) nbytes);
|
||||
if(len != nbytes){
|
||||
close(fd);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
close(fd);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
@@ -447,5 +448,3 @@ onlp_fani_ioctl(onlp_oid_t id, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <onlplib/mmap.h>
|
||||
|
||||
@@ -58,15 +59,15 @@ enum led_light_mode { /*must be the same with the definition @ kernel driver */
|
||||
|
||||
int led_light_map_mode[][2] =
|
||||
{
|
||||
{LED_MODE_OFF, ONLP_LED_MODE_OFF},
|
||||
{LED_MODE_OFF, ONLP_LED_MODE_OFF},
|
||||
{LED_MODE_GREEN, ONLP_LED_MODE_GREEN},
|
||||
{LED_MODE_AMBER, ONLP_LED_MODE_ORANGE},
|
||||
{LED_MODE_RED, ONLP_LED_MODE_RED},
|
||||
{LED_MODE_RED, ONLP_LED_MODE_RED},
|
||||
{LED_MODE_GREEN_BLINK, ONLP_LED_MODE_GREEN_BLINKING},
|
||||
{LED_MODE_AMBER_BLINK, ONLP_LED_MODE_ORANGE_BLINKING},
|
||||
{LED_MODE_RED_BLINK, ONLP_LED_MODE_RED_BLINKING},
|
||||
{LED_MODE_AUTO, ONLP_LED_MODE_AUTO},
|
||||
};
|
||||
{LED_MODE_AUTO, ONLP_LED_MODE_AUTO},
|
||||
};
|
||||
|
||||
|
||||
#define prefix_path "/sys/class/leds/accton_as5812_54t_led::"
|
||||
@@ -84,7 +85,7 @@ enum onlp_led_id
|
||||
LED_FAN2,
|
||||
LED_FAN3,
|
||||
LED_FAN4,
|
||||
LED_FAN5,
|
||||
LED_FAN5,
|
||||
};
|
||||
|
||||
static char last_path[][10] = /* must map with onlp_led_id */
|
||||
@@ -99,7 +100,7 @@ static char last_path[][10] = /* must map with onlp_led_id */
|
||||
"fan2",
|
||||
"fan3",
|
||||
"fan4",
|
||||
"fan5",
|
||||
"fan5",
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -135,27 +136,27 @@ static onlp_led_info_t linfo[] =
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FAN1), "Chassis LED 6 (FAN1 LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FAN2), "Chassis LED 7 (FAN2 LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FAN3), "Chassis LED 8 (FAN3 LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FAN4), "Chassis LED 9 (FAN4 LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FAN5), "Chassis LED 10 (FAN5 LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED,
|
||||
},
|
||||
};
|
||||
@@ -168,7 +169,7 @@ static int convert_led_light_mode_to_onl(int led_ligth_mode)
|
||||
{
|
||||
if (led_ligth_mode == led_light_map_mode[i][0])
|
||||
{
|
||||
return led_light_map_mode[i][1];
|
||||
return led_light_map_mode[i][1];
|
||||
}
|
||||
}
|
||||
return ONLP_LED_MODE_ON;
|
||||
@@ -182,7 +183,7 @@ static int convert_led_light_mode_to_driver(int led_ligth_mode)
|
||||
{
|
||||
if (led_ligth_mode == led_light_map_mode[i][1])
|
||||
{
|
||||
return led_light_map_mode[i][0];
|
||||
return led_light_map_mode[i][0];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -208,40 +209,40 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
|
||||
int fd, len, nbytes=1, local_id;
|
||||
char data[2] = {0};
|
||||
char fullpath[50] = {0};
|
||||
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
|
||||
|
||||
/* get fullpath */
|
||||
if (strchr(last_path[local_id], '/') != NULL)
|
||||
{
|
||||
sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]);
|
||||
sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename);
|
||||
sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename);
|
||||
}
|
||||
|
||||
/* Set the onlp_oid_hdr_t and capabilities */
|
||||
|
||||
/* Set the onlp_oid_hdr_t and capabilities */
|
||||
*info = linfo[ONLP_OID_ID_GET(id)];
|
||||
|
||||
/* Set current mode */
|
||||
if ((fd = open(fullpath, O_RDONLY)) == -1)
|
||||
{
|
||||
{
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
|
||||
if ((len = read(fd, data, nbytes)) <= 0)
|
||||
{
|
||||
close(fd);
|
||||
close(fd);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
|
||||
/* If the read byte count is less, the format is different and calc will be wrong*/
|
||||
if (close(fd) == -1)
|
||||
{
|
||||
{
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
@@ -286,37 +287,37 @@ int
|
||||
onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
|
||||
{
|
||||
int fd, len, driver_mode, nbytes=1, local_id;
|
||||
char data[2] = {0};
|
||||
char fullpath[50] = {0};
|
||||
char data[2] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
|
||||
|
||||
/* get fullpath */
|
||||
if (strchr(last_path[local_id], '/') != NULL)
|
||||
{
|
||||
sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]);
|
||||
sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename);
|
||||
sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename);
|
||||
}
|
||||
|
||||
|
||||
driver_mode = convert_led_light_mode_to_driver(mode);
|
||||
sprintf(data, "%d", driver_mode);
|
||||
|
||||
|
||||
/* Create output file descriptor */
|
||||
fd = open(fullpath, O_WRONLY, 0644);
|
||||
if(fd == -1){
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
|
||||
len = write (fd, data, (ssize_t) nbytes);
|
||||
if(len != nbytes){
|
||||
close(fd);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
close(fd);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
return ONLP_STATUS_OK;
|
||||
@@ -330,4 +331,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,20 +40,20 @@ int deviceNodeWrite(char *filename, char *buffer, int buf_size, int data_len)
|
||||
|
||||
if ((buffer == NULL) || (buf_size < 0)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((len = write(fd, buffer, buf_size)) < 0) {
|
||||
close(fd);
|
||||
if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((len = write(fd, buffer, buf_size)) < 0) {
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((close(fd) == -1)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((len > buf_size) || (data_len != 0 && len != data_len)) {
|
||||
return -1;
|
||||
@@ -71,25 +71,25 @@ int deviceNodeWriteInt(char *filename, int value, int data_len)
|
||||
}
|
||||
|
||||
int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len)
|
||||
{
|
||||
{
|
||||
int fd;
|
||||
int len;
|
||||
|
||||
if ((buffer == NULL) || (buf_size < 0)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((fd = open(filename, O_RDONLY)) == -1) {
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((len = read(fd, buffer, buf_size)) < 0) {
|
||||
close(fd);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((close(fd) == -1)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((close(fd) == -1)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((len > buf_size) || (data_len != 0 && len != data_len)) {
|
||||
@@ -106,7 +106,7 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le
|
||||
if (data_len >= buf_size || data_len < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
ret = deviceNodeReadBinary(filename, buffer, buf_size-1, data_len);
|
||||
|
||||
if (ret == 0) {
|
||||
@@ -117,7 +117,7 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le
|
||||
buffer[buf_size-1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -135,25 +135,25 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
|
||||
if (strncmp(model_name, "CPR-4011-4M11", STRLEN("CPR-4011-4M11")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, sizeof(model_name));
|
||||
aim_strlcpy(modelname, model_name, sizeof(model_name));
|
||||
}
|
||||
return PSU_TYPE_AC_COMPUWARE_F2B;
|
||||
}
|
||||
else if (strncmp(model_name, "CPR-4011-4M21", STRLEN("CPR-4011-4M21")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, sizeof(model_name));
|
||||
aim_strlcpy(modelname, model_name, sizeof(model_name));
|
||||
}
|
||||
return PSU_TYPE_AC_COMPUWARE_B2F;
|
||||
}
|
||||
else if (strncmp(model_name, "CPR-6011-2M11", STRLEN("CPR-6011-2M11")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, sizeof(model_name));
|
||||
aim_strlcpy(modelname, model_name, sizeof(model_name));
|
||||
}
|
||||
return PSU_TYPE_AC_COMPUWARE_F2B;
|
||||
}
|
||||
else if (strncmp(model_name, "CPR-6011-2M21", STRLEN("CPR-6011-2M21")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, sizeof(model_name));
|
||||
aim_strlcpy(modelname, model_name, sizeof(model_name));
|
||||
}
|
||||
return PSU_TYPE_AC_COMPUWARE_B2F;
|
||||
}
|
||||
@@ -161,20 +161,20 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
|
||||
/* Check 3Y-Power AC model name */
|
||||
memset(model_name, 0, sizeof(model_name));
|
||||
node = (id == PSU1_ID) ? PSU1_AC_3YPOWER_EEPROM_NODE(psu_model_name) : PSU2_AC_3YPOWER_EEPROM_NODE(psu_model_name);
|
||||
node = (id == PSU1_ID) ? PSU1_AC_3YPOWER_EEPROM_NODE(psu_model_name) : PSU2_AC_3YPOWER_EEPROM_NODE(psu_model_name);
|
||||
|
||||
if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
|
||||
if (strncmp(model_name, "YM-2401JCR", STRLEN("YM-2401JCR")) == 0) {
|
||||
if (modelname) {
|
||||
model_name[STRLEN("YM-2401JCR")] = 0;
|
||||
strncpy(modelname, model_name, 11);
|
||||
aim_strlcpy(modelname, model_name, 11);
|
||||
}
|
||||
return PSU_TYPE_AC_3YPOWER_F2B;
|
||||
}
|
||||
else if (strncmp(model_name, "YM-2401JDR", STRLEN("YM-2401JDR")) == 0) {
|
||||
if (modelname) {
|
||||
model_name[STRLEN("YM-2401JDR")] = 0;
|
||||
strncpy(modelname, model_name, 11);
|
||||
aim_strlcpy(modelname, model_name, 11);
|
||||
}
|
||||
return PSU_TYPE_AC_3YPOWER_B2F;
|
||||
}
|
||||
@@ -188,14 +188,14 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
if (strncmp(model_name, "um400d01G", STRLEN("um400d01G")) == 0) {
|
||||
if (modelname) {
|
||||
model_name[STRLEN("um400d01G")] = 0;
|
||||
strncpy(modelname, model_name, 10);
|
||||
aim_strlcpy(modelname, model_name, 10);
|
||||
}
|
||||
return PSU_TYPE_DC_48V_B2F;
|
||||
}
|
||||
else if (strncmp(model_name, "um400d01-01G", STRLEN("um400d01-01G")) == 0) {
|
||||
if (modelname) {
|
||||
model_name[STRLEN("um400d01-01G")] = 0;
|
||||
strncpy(modelname, model_name, 13);
|
||||
aim_strlcpy(modelname, model_name, 13);
|
||||
}
|
||||
return PSU_TYPE_DC_48V_F2B;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ int psu_ym2401_pmbus_info_get(int id, char *node, int *value)
|
||||
{
|
||||
int ret = 0;
|
||||
char path[64] = {0};
|
||||
|
||||
|
||||
*value = 0;
|
||||
|
||||
if (PSU1_ID == id) {
|
||||
@@ -248,4 +248,3 @@ int psu_ym2401_pmbus_info_set(int id, char *node, int value)
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ definitions:
|
||||
- free
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
|
||||
@@ -60,16 +60,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS5812_54X_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define X86_64_ACCTON_AS5812_54X_STRNCPY GLOBAL_STRNCPY
|
||||
#elif X86_64_ACCTON_AS5812_54X_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_ACCTON_AS5812_54X_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro X86_64_ACCTON_AS5812_54X_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS5812_54X_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define X86_64_ACCTON_AS5812_54X_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <unistd.h>
|
||||
#include <onlplib/file.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include "platform_lib.h"
|
||||
#include "x86_64_accton_as5812_54x/x86_64_accton_as5812_54x_config.h"
|
||||
|
||||
@@ -44,7 +45,7 @@
|
||||
#define FAN_1_ON_PSU1 6
|
||||
#define FAN_1_ON_PSU2 7
|
||||
|
||||
#define PROJECT_NAME
|
||||
#define PROJECT_NAME
|
||||
|
||||
#define LEN_FILE_NAME 50
|
||||
|
||||
@@ -53,7 +54,7 @@ typedef struct last_path_S
|
||||
char status[LEN_FILE_NAME];
|
||||
char speed[LEN_FILE_NAME];
|
||||
char direction[LEN_FILE_NAME];
|
||||
char ctrl_speed[LEN_FILE_NAME];
|
||||
char ctrl_speed[LEN_FILE_NAME];
|
||||
char r_status[LEN_FILE_NAME];
|
||||
char r_speed[LEN_FILE_NAME];
|
||||
}last_path_T;
|
||||
@@ -76,10 +77,10 @@ static last_path_T last_path[] = /* must map with onlp_fan_id */
|
||||
MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_2_ON_MAIN_BOARD),
|
||||
MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_3_ON_MAIN_BOARD),
|
||||
MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_4_ON_MAIN_BOARD),
|
||||
MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_5_ON_MAIN_BOARD),
|
||||
MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_5_ON_MAIN_BOARD),
|
||||
|
||||
MAKE_FAN_LAST_PATH_ON_PSU(57-003c),
|
||||
MAKE_FAN_LAST_PATH_ON_PSU(58-003f),
|
||||
MAKE_FAN_LAST_PATH_ON_PSU(57-003c),
|
||||
MAKE_FAN_LAST_PATH_ON_PSU(58-003f),
|
||||
};
|
||||
|
||||
#define MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(id) \
|
||||
@@ -134,7 +135,7 @@ onlp_fan_info_t linfo[] = {
|
||||
printf("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \
|
||||
if (close(fd) == -1) \
|
||||
return ONLP_STATUS_E_INTERNAL
|
||||
|
||||
|
||||
|
||||
/* PSU relative marco */
|
||||
#define SET_PSU_TYPE_AC_F2B_FAN(info) \
|
||||
@@ -144,7 +145,7 @@ onlp_fan_info_t linfo[] = {
|
||||
#define SET_PSU_TYPE_AC_B2F_FAN(info) \
|
||||
info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F); \
|
||||
info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE
|
||||
|
||||
|
||||
#define SET_PSU_TYPE_UM400D_F2B_FAN(info) \
|
||||
info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B)
|
||||
|
||||
@@ -157,46 +158,46 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info)
|
||||
{
|
||||
int fd, len, nbytes = 10;
|
||||
char r_data[10] = {0};
|
||||
char fullpath[65] = {0};
|
||||
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
/* get fan/fanr fault status (turn on when any one fails)
|
||||
*/
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].status);
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].status);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
if (atoi(r_data) > 0)
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_status);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_status);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
if (atoi(r_data) > 0)
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
|
||||
/* get fan/fanr direction (both : the same)
|
||||
/* get fan/fanr direction (both : the same)
|
||||
*/
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].direction);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].direction);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
|
||||
if (atoi(r_data) == 0) /*F2B*/
|
||||
info->status |= ONLP_FAN_STATUS_F2B;
|
||||
else
|
||||
else
|
||||
info->status |= ONLP_FAN_STATUS_B2F;
|
||||
|
||||
/* get fan/fanr speed (take the average of two speeds)
|
||||
*/
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].speed);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].speed);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
info->rpm = atoi(r_data);
|
||||
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_speed);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_speed);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
info->rpm = (info->rpm + atoi(r_data))/2;
|
||||
|
||||
/* get speed percentage from rpm */
|
||||
info->percentage = (info->rpm * 100)/x86_64_accton_as5812_54x_CONFIG_SYS_FAN_FRONT_RPM_MAX;
|
||||
|
||||
/* check present */
|
||||
/* check present */
|
||||
if (info->rpm > 0)
|
||||
info->status |= ONLP_FAN_STATUS_PRESENT;
|
||||
info->status |= ONLP_FAN_STATUS_PRESENT;
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
@@ -211,7 +212,7 @@ _onlp_fani_info_get_fan_on_psu_ym2401(int pid, onlp_fan_info_t* info)
|
||||
if (psu_ym2401_pmbus_info_get(pid, "psu_fan1_speed_rpm", &val) == ONLP_STATUS_OK) {
|
||||
info->status |= (val > 0) ? 0 : ONLP_FAN_STATUS_FAILED;
|
||||
info->rpm = val;
|
||||
info->percentage = (info->rpm * 100) / 21600;
|
||||
info->percentage = (info->rpm * 100) / 21600;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
@@ -223,16 +224,16 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info)
|
||||
int psu_id;
|
||||
int fd, len, nbytes = 10;
|
||||
char r_data[10] = {0};
|
||||
char fullpath[50] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
psu_type_t psu_type;
|
||||
|
||||
/* get fan other cap status according to psu type
|
||||
|
||||
/* get fan other cap status according to psu type
|
||||
*/
|
||||
psu_id = (local_id-FAN_1_ON_PSU1) + 1;
|
||||
DEBUG_PRINT("[psu_id: %d]", psu_id);
|
||||
|
||||
DEBUG_PRINT("[psu_id: %d]", psu_id);
|
||||
|
||||
psu_type = get_psu_type(psu_id, NULL, 0); /* psu_id = 1 , present PSU1. pus_id =2 , present PSU2 */
|
||||
DEBUG_PRINT("[psu_type: %d]", psu_type);
|
||||
DEBUG_PRINT("[psu_type: %d]", psu_type);
|
||||
|
||||
switch (psu_type) {
|
||||
case PSU_TYPE_AC_COMPUWARE_F2B:
|
||||
@@ -251,26 +252,26 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info)
|
||||
break;
|
||||
default:
|
||||
if (LOCAL_DEBUG)
|
||||
printf("[Debug][%s][%d][psu_type=%d]\n", __FUNCTION__, __LINE__, psu_type);
|
||||
printf("[Debug][%s][%d][psu_type=%d]\n", __FUNCTION__, __LINE__, psu_type);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (psu_type == PSU_TYPE_AC_COMPUWARE_F2B ||
|
||||
psu_type == PSU_TYPE_AC_COMPUWARE_B2F )
|
||||
{
|
||||
/* get fan fault status
|
||||
/* get fan fault status
|
||||
*/
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].status);
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].status);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
if (atoi(r_data) > 0)
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
|
||||
|
||||
/* get fan speed
|
||||
*/
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].speed);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
info->rpm = atoi(r_data);
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].speed);
|
||||
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
|
||||
info->rpm = atoi(r_data);
|
||||
|
||||
/* get speed percentage from rpm */
|
||||
info->percentage = (info->rpm * 100)/19328;
|
||||
@@ -280,7 +281,7 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info)
|
||||
{
|
||||
return _onlp_fani_info_get_fan_on_psu_ym2401(psu_id, info);
|
||||
}
|
||||
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
@@ -302,26 +303,26 @@ onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info)
|
||||
int local_id;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
|
||||
|
||||
*info = linfo[local_id];
|
||||
|
||||
|
||||
if (LOCAL_DEBUG)
|
||||
printf("\n[Debug][%s][%d][local_id: %d]", __FUNCTION__, __LINE__, local_id);
|
||||
|
||||
|
||||
switch (local_id)
|
||||
{
|
||||
case FAN_1_ON_PSU1:
|
||||
case FAN_1_ON_PSU2:
|
||||
rc = _onlp_fani_info_get_fan_on_psu(local_id, info);
|
||||
rc = _onlp_fani_info_get_fan_on_psu(local_id, info);
|
||||
break;
|
||||
|
||||
default:
|
||||
rc =_onlp_fani_info_get_fan(local_id, info);
|
||||
rc =_onlp_fani_info_get_fan(local_id, info);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -350,20 +351,20 @@ onlp_fani_rpm_set(onlp_oid_t id, int rpm)
|
||||
*/
|
||||
int
|
||||
onlp_fani_percentage_set(onlp_oid_t id, int p)
|
||||
{
|
||||
{
|
||||
int fd, len, nbytes=10, local_id;
|
||||
char data[10] = {0};
|
||||
char fullpath[70] = {0};
|
||||
char data[10] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
|
||||
/* reject p=0 (p=0, stop fan) */
|
||||
if (p == 0){
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
|
||||
/* get fullpath */
|
||||
switch (local_id)
|
||||
{
|
||||
@@ -381,7 +382,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p)
|
||||
return psu_ym2401_pmbus_info_set(psu_id, "psu_fan1_duty_cycle_percentage", p);
|
||||
}
|
||||
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].ctrl_speed);
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].ctrl_speed);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -389,23 +390,23 @@ onlp_fani_percentage_set(onlp_oid_t id, int p)
|
||||
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].ctrl_speed);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
sprintf(data, "%d", p);
|
||||
|
||||
if (LOCAL_DEBUG)
|
||||
printf("[Debug][%s][%d][openfile: %s][data=%s]\n", __FUNCTION__, __LINE__, fullpath, data);
|
||||
|
||||
|
||||
/* Create output file descriptor */
|
||||
fd = open(fullpath, O_WRONLY, 0644);
|
||||
if(fd == -1){
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
|
||||
len = write (fd, data, (ssize_t) nbytes);
|
||||
if(len != nbytes){
|
||||
close(fd);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
close(fd);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
return ONLP_STATUS_OK;
|
||||
@@ -448,5 +449,3 @@ onlp_fani_ioctl(onlp_oid_t id, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <onlplib/mmap.h>
|
||||
|
||||
@@ -50,20 +51,20 @@ enum led_light_mode { /*must be the same with the definition @ kernel driver */
|
||||
LED_MODE_GREEN_BLINK,
|
||||
LED_MODE_AMBER_BLINK,
|
||||
LED_MODE_RED_BLINK,
|
||||
LED_MODE_AUTO,
|
||||
LED_MODE_AUTO,
|
||||
};
|
||||
|
||||
int led_light_map_mode[][2] =
|
||||
{
|
||||
{LED_MODE_OFF, ONLP_LED_MODE_OFF},
|
||||
{LED_MODE_OFF, ONLP_LED_MODE_OFF},
|
||||
{LED_MODE_GREEN, ONLP_LED_MODE_GREEN},
|
||||
{LED_MODE_AMBER, ONLP_LED_MODE_ORANGE},
|
||||
{LED_MODE_RED, ONLP_LED_MODE_RED},
|
||||
{LED_MODE_RED, ONLP_LED_MODE_RED},
|
||||
{LED_MODE_GREEN_BLINK, ONLP_LED_MODE_GREEN_BLINKING},
|
||||
{LED_MODE_AMBER_BLINK, ONLP_LED_MODE_ORANGE_BLINKING},
|
||||
{LED_MODE_RED_BLINK, ONLP_LED_MODE_RED_BLINKING},
|
||||
{LED_MODE_AUTO, ONLP_LED_MODE_AUTO},
|
||||
};
|
||||
{LED_MODE_AUTO, ONLP_LED_MODE_AUTO},
|
||||
};
|
||||
|
||||
|
||||
#define prefix_path "/sys/class/leds/accton_as5812_54x_led::"
|
||||
@@ -81,7 +82,7 @@ enum onlp_led_id
|
||||
LED_FAN2,
|
||||
LED_FAN3,
|
||||
LED_FAN4,
|
||||
LED_FAN5,
|
||||
LED_FAN5,
|
||||
};
|
||||
|
||||
static char last_path[][10] = /* must map with onlp_led_id */
|
||||
@@ -96,7 +97,7 @@ static char last_path[][10] = /* must map with onlp_led_id */
|
||||
"fan2",
|
||||
"fan3",
|
||||
"fan4",
|
||||
"fan5",
|
||||
"fan5",
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -160,7 +161,7 @@ static int conver_led_light_mode_to_onl(int led_ligth_mode)
|
||||
{
|
||||
if (led_ligth_mode == led_light_map_mode[i][0])
|
||||
{
|
||||
return led_light_map_mode[i][1];
|
||||
return led_light_map_mode[i][1];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -174,7 +175,7 @@ static int conver_led_light_mode_to_driver(int led_ligth_mode)
|
||||
{
|
||||
if (led_ligth_mode == led_light_map_mode[i][1])
|
||||
{
|
||||
return led_light_map_mode[i][0];
|
||||
return led_light_map_mode[i][0];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -200,40 +201,40 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
|
||||
int fd, len, nbytes=1, local_id;
|
||||
char data[2] = {0};
|
||||
char fullpath[50] = {0};
|
||||
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
|
||||
|
||||
/* get fullpath */
|
||||
if (strchr(last_path[local_id], '/') != NULL)
|
||||
{
|
||||
sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]);
|
||||
sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename);
|
||||
sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename);
|
||||
}
|
||||
|
||||
/* Set the onlp_oid_hdr_t and capabilities */
|
||||
|
||||
/* Set the onlp_oid_hdr_t and capabilities */
|
||||
*info = linfo[ONLP_OID_ID_GET(id)];
|
||||
|
||||
/* Set current mode */
|
||||
if ((fd = open(fullpath, O_RDONLY)) == -1)
|
||||
{
|
||||
{
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
|
||||
if ((len = read(fd, data, nbytes)) <= 0)
|
||||
{
|
||||
close(fd);
|
||||
close(fd);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
|
||||
/* If the read byte count is less, the format is different and calc will be wrong*/
|
||||
if (close(fd) == -1)
|
||||
{
|
||||
{
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
@@ -278,37 +279,37 @@ int
|
||||
onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
|
||||
{
|
||||
int fd, len, driver_mode, nbytes=1, local_id;
|
||||
char data[2] = {0};
|
||||
char fullpath[50] = {0};
|
||||
char data[2] = {0};
|
||||
char fullpath[PATH_MAX] = {0};
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
|
||||
|
||||
/* get fullpath */
|
||||
if (strchr(last_path[local_id], '/') != NULL)
|
||||
{
|
||||
sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]);
|
||||
sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename);
|
||||
sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename);
|
||||
}
|
||||
|
||||
|
||||
driver_mode = conver_led_light_mode_to_driver(mode);
|
||||
sprintf(data, "%d", driver_mode);
|
||||
|
||||
|
||||
/* Create output file descriptor */
|
||||
fd = open(fullpath, O_WRONLY, 0644);
|
||||
if(fd == -1){
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
|
||||
len = write (fd, data, (ssize_t) nbytes);
|
||||
if(len != nbytes){
|
||||
close(fd);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
close(fd);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
return ONLP_STATUS_OK;
|
||||
@@ -322,4 +323,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,20 +42,20 @@ int deviceNodeWrite(char *filename, char *buffer, int buf_size, int data_len)
|
||||
|
||||
if ((buffer == NULL) || (buf_size < 0)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((len = write(fd, buffer, buf_size)) < 0) {
|
||||
close(fd);
|
||||
if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((len = write(fd, buffer, buf_size)) < 0) {
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((close(fd) == -1)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((len > buf_size) || (data_len != 0 && len != data_len)) {
|
||||
return -1;
|
||||
@@ -73,25 +73,25 @@ int deviceNodeWriteInt(char *filename, int value, int data_len)
|
||||
}
|
||||
|
||||
int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len)
|
||||
{
|
||||
{
|
||||
int fd;
|
||||
int len;
|
||||
|
||||
if ((buffer == NULL) || (buf_size < 0)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((fd = open(filename, O_RDONLY)) == -1) {
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((len = read(fd, buffer, buf_size)) < 0) {
|
||||
close(fd);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((close(fd) == -1)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((close(fd) == -1)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((len > buf_size) || (data_len != 0 && len != data_len)) {
|
||||
@@ -108,7 +108,7 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le
|
||||
if (data_len >= buf_size || data_len < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
ret = deviceNodeReadBinary(filename, buffer, buf_size-1, data_len);
|
||||
|
||||
if (ret == 0) {
|
||||
@@ -119,7 +119,7 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le
|
||||
buffer[buf_size-1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -137,25 +137,25 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
|
||||
if (strncmp(model_name, "CPR-4011-4M11", STRLEN("CPR-4011-4M11")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, sizeof(model_name));
|
||||
aim_strlcpy(modelname, model_name, sizeof(model_name));
|
||||
}
|
||||
return PSU_TYPE_AC_COMPUWARE_F2B;
|
||||
}
|
||||
else if (strncmp(model_name, "CPR-4011-4M21", STRLEN("CPR-4011-4M21")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, sizeof(model_name));
|
||||
aim_strlcpy(modelname, model_name, sizeof(model_name));
|
||||
}
|
||||
return PSU_TYPE_AC_COMPUWARE_B2F;
|
||||
}
|
||||
else if (strncmp(model_name, "CPR-6011-2M11", STRLEN("CPR-6011-2M11")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, sizeof(model_name));
|
||||
aim_strlcpy(modelname, model_name, sizeof(model_name));
|
||||
}
|
||||
return PSU_TYPE_AC_COMPUWARE_F2B;
|
||||
}
|
||||
else if (strncmp(model_name, "CPR-6011-2M21", STRLEN("CPR-6011-2M21")) == 0) {
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, sizeof(model_name));
|
||||
aim_strlcpy(modelname, model_name, sizeof(model_name));
|
||||
}
|
||||
return PSU_TYPE_AC_COMPUWARE_B2F;
|
||||
}
|
||||
@@ -163,20 +163,20 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
|
||||
/* Check 3Y-Power AC model name */
|
||||
memset(model_name, 0, sizeof(model_name));
|
||||
node = (id == PSU1_ID) ? PSU1_AC_3YPOWER_EEPROM_NODE(psu_model_name) : PSU2_AC_3YPOWER_EEPROM_NODE(psu_model_name);
|
||||
node = (id == PSU1_ID) ? PSU1_AC_3YPOWER_EEPROM_NODE(psu_model_name) : PSU2_AC_3YPOWER_EEPROM_NODE(psu_model_name);
|
||||
|
||||
if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
|
||||
if (strncmp(model_name, "YM-2401JCR", STRLEN("YM-2401JCR")) == 0) {
|
||||
if (modelname) {
|
||||
model_name[STRLEN("YM-2401JCR")] = 0;
|
||||
strncpy(modelname, model_name, 11);
|
||||
aim_strlcpy(modelname, model_name, 11);
|
||||
}
|
||||
return PSU_TYPE_AC_3YPOWER_F2B;
|
||||
}
|
||||
else if (strncmp(model_name, "YM-2401JDR", STRLEN("YM-2401JDR")) == 0) {
|
||||
if (modelname) {
|
||||
model_name[STRLEN("YM-2401JDR")] = 0;
|
||||
strncpy(modelname, model_name, 11);
|
||||
aim_strlcpy(modelname, model_name, 11);
|
||||
}
|
||||
return PSU_TYPE_AC_3YPOWER_B2F;
|
||||
}
|
||||
@@ -190,14 +190,14 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
if (strncmp(model_name, "um400d01G", STRLEN("um400d01G")) == 0) {
|
||||
if (modelname) {
|
||||
model_name[STRLEN("um400d01G")] = 0;
|
||||
strncpy(modelname, model_name, 10);
|
||||
aim_strlcpy(modelname, model_name, 10);
|
||||
}
|
||||
return PSU_TYPE_DC_48V_B2F;
|
||||
}
|
||||
else if (strncmp(model_name, "um400d01-01G", STRLEN("um400d01-01G")) == 0) {
|
||||
if (modelname) {
|
||||
model_name[STRLEN("um400d01-01G")] = 0;
|
||||
strncpy(modelname, model_name, 13);
|
||||
aim_strlcpy(modelname, model_name, 13);
|
||||
}
|
||||
return PSU_TYPE_DC_48V_F2B;
|
||||
}
|
||||
@@ -210,7 +210,7 @@ int psu_ym2401_pmbus_info_get(int id, char *node, int *value)
|
||||
{
|
||||
int ret = 0;
|
||||
char path[64] = {0};
|
||||
|
||||
|
||||
*value = 0;
|
||||
|
||||
if (PSU1_ID == id) {
|
||||
@@ -256,14 +256,14 @@ int psu_ym2401_pmbus_info_set(int id, char *node, int value)
|
||||
int psu_serial_number_get(int id, psu_type_t psu_type, char *serial, int serial_len)
|
||||
{
|
||||
int size = 0;
|
||||
int ret = ONLP_STATUS_OK;
|
||||
int ret = ONLP_STATUS_OK;
|
||||
char *prefix = NULL;
|
||||
char *filename = NULL;
|
||||
|
||||
if (serial == NULL || serial_len < PSU_SERIAL_NUMBER_LEN) {
|
||||
return ONLP_STATUS_E_PARAM;
|
||||
}
|
||||
|
||||
|
||||
memset((void *)serial, 0x0, serial_len);
|
||||
switch (psu_type) {
|
||||
case PSU_TYPE_AC_COMPUWARE_F2B:
|
||||
@@ -292,4 +292,4 @@ int psu_serial_number_get(int id, psu_type_t psu_type, char *serial, int serial_
|
||||
|
||||
serial[PSU_SERIAL_NUMBER_LEN] = '\0';
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ definitions:
|
||||
- free
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
|
||||
@@ -60,16 +60,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS5822_54X_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define X86_64_ACCTON_AS5822_54X_STRNCPY GLOBAL_STRNCPY
|
||||
#elif X86_64_ACCTON_AS5822_54X_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_ACCTON_AS5822_54X_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro X86_64_ACCTON_AS5822_54X_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS5822_54X_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define X86_64_ACCTON_AS5822_54X_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
|
||||
@@ -121,7 +121,7 @@ int get_psu_serial_number(int id, char *serial, int serial_len)
|
||||
{
|
||||
char *node = NULL;
|
||||
char sn[PSU_SERIAL_NUMBER_LEN + 1] = {0};
|
||||
|
||||
|
||||
/* Check AC model name */
|
||||
node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_serial_numer) : PSU2_AC_HWMON_NODE(psu_serial_numer);
|
||||
|
||||
@@ -130,7 +130,7 @@ int get_psu_serial_number(int id, char *serial, int serial_len)
|
||||
}
|
||||
|
||||
if (serial) {
|
||||
strncpy(serial, sn, sizeof(sn));
|
||||
aim_strlcpy(serial, sn, sizeof(sn));
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
@@ -149,7 +149,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
}
|
||||
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, sizeof(model_name));
|
||||
aim_strlcpy(modelname, model_name, sizeof(model_name));
|
||||
}
|
||||
|
||||
if (strncmp(model_name, "YM-2401JCR", 10) == 0) {
|
||||
@@ -203,4 +203,4 @@ int psu_ym2401_pmbus_info_set(int id, char *node, int value)
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ definitions:
|
||||
- free
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
|
||||
@@ -60,16 +60,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS5912_54X_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define X86_64_ACCTON_AS5912_54X_STRNCPY GLOBAL_STRNCPY
|
||||
#elif X86_64_ACCTON_AS5912_54X_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_ACCTON_AS5912_54X_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro X86_64_ACCTON_AS5912_54X_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_ACCTON_AS5912_54X_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define X86_64_ACCTON_AS5912_54X_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
|
||||
@@ -135,7 +135,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
|
||||
}
|
||||
|
||||
if (modelname) {
|
||||
strncpy(modelname, model_name, modelname_len-1);
|
||||
aim_strlcpy(modelname, model_name, modelname_len-1);
|
||||
}
|
||||
|
||||
node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user