Add LY4R platform:

1. [LY4R] Port platform driver
2. [LY4R] Port ONLP: board info
3. [LY4R] Port ONLP: systemled
4. [LY4R] Port ONLP: SFP
5. [LY4R] Print "ONLP is not supported for RPSU/FAN/THERMAL"
6. [LY4R] Port UEFI support
This commit is contained in:
Jonathan Tsai
2017-04-28 15:13:14 +08:00
parent 4e4a090daa
commit 01a3908322
44 changed files with 1740 additions and 10 deletions

View File

@@ -511,12 +511,12 @@ menuentry %(boot_menu_entry)s {
# Menu entry to chainload ONIE
menuentry ONIE {
search --no-floppy --label --set=root ONIE-BOOT
# Always return to entry 0 by default.
set saved_entry="0"
save_env saved_entry
%(set_root_para)s
search --no-floppy %(set_search_para2)s --set=root %(onie_boot)s
%(set_save_entry_para)s
%(set_save_env_para)s
echo 'Loading ONIE ...'
chainloader +1
chainloader %(set_chainloader_para)s
}
"""
@@ -528,6 +528,7 @@ class GrubInstaller(SubprocessMixin, Base):
def __init__(self, *args, **kwargs):
Base.__init__(self, *args, **kwargs)
self.isUEFI = False
def findGpt(self):
self.blkidParts = BlkidParser(log=self.log.getChild("blkid"))
@@ -566,8 +567,9 @@ class GrubInstaller(SubprocessMixin, Base):
self.log.error("cannot find an install device")
return 1
code = self.assertUnmounted()
if code: return code
if not self.isUEFI:
code = self.assertUnmounted()
if code: return code
# optionally back up a config partition
# if it's on the boot device
@@ -656,6 +658,22 @@ class GrubInstaller(SubprocessMixin, Base):
ctx['boot_menu_entry'] = sysconfig.installer.menu_name
ctx['boot_loading_name'] = sysconfig.installer.os_name
if self.isUEFI:
ctx['set_root_para'] = "set root='(hd0,gpt1)'"
ctx['set_search_para2'] = "--fs-uuid"
ctx['set_save_entry_para'] = ""
ctx['set_save_env_para'] = ""
dev_UEFI = self.blkidParts['EFI System']
ctx['onie_boot'] = dev_UEFI.uuid
ctx['set_chainloader_para'] = "/EFI/onie/grubx64.efi"
else:
ctx['set_root_para'] = ""
ctx['set_search_para2'] = "--label"
ctx['set_save_entry_para'] = "set saved_entry=\"0\""
ctx['set_save_env_para'] = "save_env saved_entry"
ctx['onie_boot'] = "ONIE-BOOT"
ctx['set_chainloader_para'] = "+1"
cf = GRUB_TPL % ctx
with MountContext(dev.device, log=self.log) as ctx:
@@ -670,7 +688,7 @@ class GrubInstaller(SubprocessMixin, Base):
def installGrub(self):
self.log.info("Installing GRUB to %s", self.partedDevice.path)
self.im.grubEnv.install(self.partedDevice.path)
self.im.grubEnv.install(self.partedDevice.path, self.isUEFI)
return 0
def installGpt(self):
@@ -757,6 +775,9 @@ class GrubInstaller(SubprocessMixin, Base):
if label != 'gpt':
self.log.error("invalid GRUB label in platform config: %s", label)
return 1
if os.path.isdir('/sys/firmware/efi/efivars'):
self.isUEFI = True
return self.installGpt()
def upgradeBootLoader(self):

View File

@@ -203,6 +203,7 @@ class ProxyGrubEnv:
INSTALL = "grub-install"
EDITENV = "grub-editenv"
EFIBOOTMGR = "efibootmgr"
# system defaults
ENV_PATH = "/grub/grubenv"
@@ -302,7 +303,7 @@ class ProxyGrubEnv:
fd.write(cmd)
fd.write("\n")
def install(self, device):
def install(self, device, isUEFI=False):
self.log.warn("deferring commands to %s...", self.installerConf.installer_postinst)
cmds = []
if self.bootDir and self.chroot:
@@ -315,7 +316,15 @@ class ProxyGrubEnv:
elif self.bootPart:
cmds.append("mpt=$(mktemp -t -d)")
cmds.append("mount %s $mpt" % self.bootPart)
cmds.append(("sts=0; %s --boot-directory=\"$mpt\" %s || sts=$?"
if isUEFI:
cmds.append("[ -n \"$(efibootmgr -v | grep 'Open Network Linux')\" ] && (efibootmgr -b $(efibootmgr | grep \"Open Network Linux\" | sed 's/^.*Boot//g'| sed 's/** Open.*$//g') -B)")
cmds.append(("sts=0; %s --target=x86_64-efi --no-nvram --bootloader-id=ONL --efi-directory=/boot/efi --boot-directory=\"$mpt\" --recheck %s || sts=$?"
% (self.INSTALL, device,)))
cmds.append("test $sts -eq 0")
cmds.append(("sts=0; %s --quiet --create --label \"Open Network Linux\" --disk %s --part 1 --loader /EFI/ONL/grubx64.efi || sts=$?"
% (self.EFIBOOTMGR , device,)))
else:
cmds.append(("sts=0; %s --boot-directory=\"$mpt\" %s || sts=$?"
% (self.INSTALL, device,)))
cmds.append("umount $mpt")
cmds.append("rmdir $mpt")

View File

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

View File

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

View File

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

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/platform-modules.yml ARCH=amd64 VENDOR=quanta BASENAME=x86-64-quanta-ly4r KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"

View File

@@ -0,0 +1 @@
lib

View File

@@ -0,0 +1,6 @@
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64
KMODULES := $(wildcard *.c)
VENDOR := quanta
BASENAME := x86-64-quanta-ly4r
ARCH := x86_64
include $(ONL)/make/kmodule.mk

View File

@@ -0,0 +1,172 @@
/*
* Quanta LY4R platform driver
*
*
* Copyright (C) 2014 Quanta Computer inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/err.h>
#include <linux/proc_fs.h>
#include <linux/backlight.h>
#include <linux/fb.h>
#include <linux/leds.h>
#include <linux/platform_device.h>
#include <linux/uaccess.h>
#include <linux/input.h>
#include <linux/input/sparse-keymap.h>
#include <linux/input-polldev.h>
#include <linux/rfkill.h>
#include <linux/slab.h>
#include <linux/i2c/pca954x.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0))
#include <linux/i2c/pca953x.h>
#else
#include <linux/platform_data/pca953x.h>
#endif
#define MUX_INFO(bus, deselect) \
{.adap_id = bus, .deselect_on_exit = deselect}
static struct pca954x_platform_mode pca9548sfp1_modes[] = {
MUX_INFO(0x20, 1),
MUX_INFO(0x21, 1),
MUX_INFO(0x22, 1),
MUX_INFO(0x23, 1),
MUX_INFO(0x24, 1),
};
static struct pca954x_platform_data pca9548sfp1_data = {
.modes = pca9548sfp1_modes,
.num_modes = 5,
};
static struct pca953x_platform_data pca9698_data = {
.gpio_base = 0x10,
};
static struct i2c_board_info ly4r_i2c_devices[] = {
{
I2C_BOARD_INFO("pca9698", 0x20),
.platform_data = &pca9698_data,
},
{
I2C_BOARD_INFO("24c02", 0x54),
},
{
I2C_BOARD_INFO("pca9548", 0x73),
.platform_data = &pca9548sfp1_data,
},
{
I2C_BOARD_INFO("24c02", 0x50),
},
};
static struct platform_driver ly4r_platform_driver = {
.driver = {
.name = "qci-ly4r",
.owner = THIS_MODULE,
},
};
static struct platform_device *ly4r_device;
static int __init ly4r_platform_init(void)
{
struct i2c_client *client;
struct i2c_adapter *adapter;
int ret;
ret = platform_driver_register(&ly4r_platform_driver);
if (ret < 0)
return ret;
/* Register platform stuff */
ly4r_device = platform_device_alloc("qci-ly4r", -1);
if (!ly4r_device) {
ret = -ENOMEM;
goto fail_platform_driver;
}
ret = platform_device_add(ly4r_device);
if (ret)
goto fail_platform_device;
adapter = i2c_get_adapter(1);
client = i2c_new_device(adapter, &ly4r_i2c_devices[2]); // pca9548sfp_1
client = i2c_new_device(adapter, &ly4r_i2c_devices[0]); // pca9698
client = i2c_new_device(adapter, &ly4r_i2c_devices[1]); // EEprom
i2c_put_adapter(adapter);
adapter = i2c_get_adapter(0x20);
client = i2c_new_device(adapter, &ly4r_i2c_devices[3]); // sfp_1 EEprom
i2c_put_adapter(adapter);
adapter = i2c_get_adapter(0x21);
client = i2c_new_device(adapter, &ly4r_i2c_devices[3]); // sfp_2 EEprom
i2c_put_adapter(adapter);
adapter = i2c_get_adapter(0x22);
client = i2c_new_device(adapter, &ly4r_i2c_devices[3]); // sfp_3 EEprom
i2c_put_adapter(adapter);
adapter = i2c_get_adapter(0x23);
client = i2c_new_device(adapter, &ly4r_i2c_devices[3]); // sfp_4 EEprom
i2c_put_adapter(adapter);
adapter = i2c_get_adapter(0x24);
client = i2c_new_device(adapter, &ly4r_i2c_devices[3]); // msfp EEprom
i2c_put_adapter(adapter);
#if 0
if (!ly4r_device_present) {
ret = -ENODEV;
goto fail_no_device;
}
#endif
return 0;
fail_platform_device:
platform_device_put(ly4r_device);
fail_platform_driver:
platform_driver_unregister(&ly4r_platform_driver);
return ret;
}
static void __exit ly4r_platform_exit(void)
{
platform_device_unregister(ly4r_device);
platform_driver_unregister(&ly4r_platform_driver);
}
module_init(ly4r_platform_init);
module_exit(ly4r_platform_exit);
MODULE_AUTHOR("Jonathan Tsai (jonathan.tsai@quantatw.com)");
MODULE_VERSION("1.0");
MODULE_DESCRIPTION("Quanta LY4R Platform Driver");
MODULE_LICENSE("GPL");

View File

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

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/onlp-platform-any.yml PLATFORM=x86-64-quanta-ly4r ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu

View File

@@ -0,0 +1,2 @@
FILTER=src
include $(ONL)/make/subdirs.mk

View File

@@ -0,0 +1,45 @@
############################################################
# <bsn.cl fy=2014 v=onl>
#
# Copyright 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
#
############################################################
include $(ONL)/make/config.amd64.mk
MODULE := libonlp-x86-64-quanta-ly4r
include $(BUILDER)/standardinit.mk
DEPENDMODULES := AIM IOF x86_64_quanta_ly4r quanta_sys_eeprom onlplib
DEPENDMODULE_HEADERS := sff
include $(BUILDER)/dependmodules.mk
SHAREDLIB := libonlp-x86-64-quanta-ly4r.so
$(SHAREDLIB)_TARGETS := $(ALL_TARGETS)
include $(BUILDER)/so.mk
.DEFAULT_GOAL := $(SHAREDLIB)
GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
GLOBAL_CFLAGS += -fPIC
GLOBAL_LINK_LIBS += -lpthread
include $(BUILDER)/targets.mk

View File

@@ -0,0 +1,45 @@
############################################################
# <bsn.cl fy=2014 v=onl>
#
# Copyright 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
#
#
############################################################
include $(ONL)/make/config.amd64.mk
.DEFAULT_GOAL := onlpdump
MODULE := onlpdump
include $(BUILDER)/standardinit.mk
DEPENDMODULES := AIM IOF onlp x86_64_quanta_ly4r quanta_sys_eeprom onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS
include $(BUILDER)/dependmodules.mk
BINARY := onlpdump
$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS)
include $(BUILDER)/bin.mk
GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
GLOBAL_LINK_LIBS += -lpthread -lm
include $(BUILDER)/targets.mk

View File

@@ -0,0 +1 @@
name: x86_64_quanta_ly4r

View File

@@ -0,0 +1,9 @@
###############################################################################
#
#
#
###############################################################################
include $(ONL)/make/config.mk
MODULE := x86_64_quanta_ly4r
AUTOMODULE := x86_64_quanta_ly4r
include $(BUILDER)/definemodule.mk

View File

@@ -0,0 +1,9 @@
###############################################################################
#
# x86_64_quanta_ly4r Autogeneration
#
###############################################################################
x86_64_quanta_ly4r_AUTO_DEFS := module/auto/x86_64_quanta_ly4r.yml
x86_64_quanta_ly4r_AUTO_DIRS := module/inc/x86_64_quanta_ly4r module/src
include $(BUILDER)/auto.mk

View File

@@ -0,0 +1,134 @@
###############################################################################
#
# x86_64_quanta_ly4r Autogeneration Definitions.
#
###############################################################################
cdefs: &cdefs
- X86_64_QUANTA_LY4R_CONFIG_INCLUDE_LOGGING:
doc: "Include or exclude logging."
default: 1
- X86_64_QUANTA_LY4R_CONFIG_LOG_OPTIONS_DEFAULT:
doc: "Default enabled log options."
default: AIM_LOG_OPTIONS_DEFAULT
- X86_64_QUANTA_LY4R_CONFIG_LOG_BITS_DEFAULT:
doc: "Default enabled log bits."
default: AIM_LOG_BITS_DEFAULT
- X86_64_QUANTA_LY4R_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
doc: "Default enabled custom log bits."
default: 0
- X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB:
doc: "Default all porting macros to use the C standard libraries."
default: 1
- X86_64_QUANTA_LY4R_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
doc: "Include standard library headers for stdlib porting macros."
default: X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB
- X86_64_QUANTA_LY4R_CONFIG_INCLUDE_UCLI:
doc: "Include generic uCli support."
default: 0
- X86_64_QUANTA_LY4R_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD:
doc: "RPM Threshold at which the fan is considered to have failed."
default: 3000
- X86_64_QUANTA_LY4R_CONFIG_SYSFAN_F2B_RPM_MAX:
doc: "Maximum system front-to-back fan speed."
default: 18000
- X86_64_QUANTA_LY4R_CONFIG_SYSFAN_B2F_RPM_MAX:
doc: "Maximum system back-to-front fan speed."
default: 18000
- X86_64_QUANTA_LY4R_CONFIG_PHY_RESET_DELAY_MS:
doc: "Time to hold Phy GPIO in reset, in ms"
default: 100
definitions:
cdefs:
X86_64_QUANTA_LY4R_CONFIG_HEADER:
defs: *cdefs
basename: x86_64_quanta_ly4r_config
enum: &enums
fan_id:
members:
- FAN1 : 1
- FAN2 : 2
- FAN3 : 3
- FAN4 : 4
- FAN5 : 5
- FAN6 : 6
- FAN7 : 7
- FAN8 : 8
- FAN9 : 9
- FAN10 : 10
fan_oid:
members:
- FAN1 : ONLP_FAN_ID_CREATE(1)
- FAN2 : ONLP_FAN_ID_CREATE(2)
- FAN3 : ONLP_FAN_ID_CREATE(3)
- FAN4 : ONLP_FAN_ID_CREATE(4)
- FAN5 : ONLP_FAN_ID_CREATE(5)
- FAN6 : ONLP_FAN_ID_CREATE(6)
- FAN7 : ONLP_FAN_ID_CREATE(7)
- FAN8 : ONLP_FAN_ID_CREATE(8)
- FAN9 : ONLP_FAN_ID_CREATE(9)
- FAN10 : ONLP_FAN_ID_CREATE(10)
psu_id:
members:
- PSU1 : 1
- PSU2 : 2
psu_oid:
members:
- PSU1 : ONLP_PSU_ID_CREATE(1)
- PSU2 : ONLP_PSU_ID_CREATE(2)
thermal_id:
members:
- THERMAL1 : 1
- THERMAL2 : 2
- THERMAL3 : 3
- THERMAL4 : 4
- THERMAL5 : 5
- THERMAL6 : 6
- THERMAL7 : 7
- THERMAL8 : 8
- THERMAL9 : 9
- THERMAL10 : 10
- THERMAL11 : 11
- THERMAL12 : 12
- THERMAL13 : 13
- THERMAL14 : 14
- THERMAL15 : 15
- THERMAL16 : 16
thermal_oid:
members:
- THERMAL1 : ONLP_THERMAL_ID_CREATE(1)
- THERMAL2 : ONLP_THERMAL_ID_CREATE(2)
- THERMAL3 : ONLP_THERMAL_ID_CREATE(3)
- THERMAL4 : ONLP_THERMAL_ID_CREATE(4)
- THERMAL5 : ONLP_THERMAL_ID_CREATE(5)
- THERMAL6 : ONLP_THERMAL_ID_CREATE(6)
- THERMAL7 : ONLP_THERMAL_ID_CREATE(7)
- THERMAL8 : ONLP_THERMAL_ID_CREATE(8)
- THERMAL9 : ONLP_THERMAL_ID_CREATE(9)
- THERMAL10 : ONLP_THERMAL_ID_CREATE(10)
- THERMAL11 : ONLP_THERMAL_ID_CREATE(11)
- THERMAL12 : ONLP_THERMAL_ID_CREATE(12)
- THERMAL13 : ONLP_THERMAL_ID_CREATE(13)
- THERMAL14 : ONLP_THERMAL_ID_CREATE(14)
- THERMAL15 : ONLP_THERMAL_ID_CREATE(15)
- THERMAL16 : ONLP_THERMAL_ID_CREATE(16)
portingmacro:
X86_64_QUANTA_LY4R:
macros:
- memset
- memcpy
- strncpy
- vsnprintf
- snprintf
- strlen

View File

@@ -0,0 +1,14 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r_config.h>
/* <--auto.start.xmacro(ALL).define> */
/* <auto.end.xmacro(ALL).define> */
/* <--auto.start.xenum(ALL).define> */
/* <auto.end.xenum(ALL).define> */

View File

@@ -0,0 +1,167 @@
/**************************************************************************//**
*
* @file
* @brief x86_64_quanta_ly4r Configuration Header
*
* @addtogroup x86_64_quanta_ly4r-config
* @{
*
*****************************************************************************/
#ifndef __X86_64_QUANTA_LY4R_CONFIG_H__
#define __X86_64_QUANTA_LY4R_CONFIG_H__
#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG
#include <global_custom_config.h>
#endif
#ifdef X86_64_QUANTA_LY4R_INCLUDE_CUSTOM_CONFIG
#include <x86_64_quanta_ly4r_custom_config.h>
#endif
/* <auto.start.cdefs(X86_64_QUANTA_LY4R_CONFIG_HEADER).header> */
#include <AIM/aim.h>
/**
* X86_64_QUANTA_LY4R_CONFIG_INCLUDE_LOGGING
*
* Include or exclude logging. */
#ifndef X86_64_QUANTA_LY4R_CONFIG_INCLUDE_LOGGING
#define X86_64_QUANTA_LY4R_CONFIG_INCLUDE_LOGGING 1
#endif
/**
* X86_64_QUANTA_LY4R_CONFIG_LOG_OPTIONS_DEFAULT
*
* Default enabled log options. */
#ifndef X86_64_QUANTA_LY4R_CONFIG_LOG_OPTIONS_DEFAULT
#define X86_64_QUANTA_LY4R_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT
#endif
/**
* X86_64_QUANTA_LY4R_CONFIG_LOG_BITS_DEFAULT
*
* Default enabled log bits. */
#ifndef X86_64_QUANTA_LY4R_CONFIG_LOG_BITS_DEFAULT
#define X86_64_QUANTA_LY4R_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT
#endif
/**
* X86_64_QUANTA_LY4R_CONFIG_LOG_CUSTOM_BITS_DEFAULT
*
* Default enabled custom log bits. */
#ifndef X86_64_QUANTA_LY4R_CONFIG_LOG_CUSTOM_BITS_DEFAULT
#define X86_64_QUANTA_LY4R_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0
#endif
/**
* X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB
*
* Default all porting macros to use the C standard libraries. */
#ifndef X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB
#define X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB 1
#endif
/**
* X86_64_QUANTA_LY4R_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
*
* Include standard library headers for stdlib porting macros. */
#ifndef X86_64_QUANTA_LY4R_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
#define X86_64_QUANTA_LY4R_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB
#endif
/**
* X86_64_QUANTA_LY4R_CONFIG_INCLUDE_UCLI
*
* Include generic uCli support. */
#ifndef X86_64_QUANTA_LY4R_CONFIG_INCLUDE_UCLI
#define X86_64_QUANTA_LY4R_CONFIG_INCLUDE_UCLI 0
#endif
/**
* X86_64_QUANTA_LY4R_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD
*
* RPM Threshold at which the fan is considered to have failed. */
#ifndef X86_64_QUANTA_LY4R_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD
#define X86_64_QUANTA_LY4R_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD 3000
#endif
/**
* X86_64_QUANTA_LY4R_CONFIG_SYSFAN_F2B_RPM_MAX
*
* Maximum system front-to-back fan speed. */
#ifndef X86_64_QUANTA_LY4R_CONFIG_SYSFAN_F2B_RPM_MAX
#define X86_64_QUANTA_LY4R_CONFIG_SYSFAN_F2B_RPM_MAX 18000
#endif
/**
* X86_64_QUANTA_LY4R_CONFIG_SYSFAN_B2F_RPM_MAX
*
* Maximum system back-to-front fan speed. */
#ifndef X86_64_QUANTA_LY4R_CONFIG_SYSFAN_B2F_RPM_MAX
#define X86_64_QUANTA_LY4R_CONFIG_SYSFAN_B2F_RPM_MAX 18000
#endif
/**
* X86_64_QUANTA_LY4R_CONFIG_PHY_RESET_DELAY_MS
*
* Time to hold Phy GPIO in reset, in ms */
#ifndef X86_64_QUANTA_LY4R_CONFIG_PHY_RESET_DELAY_MS
#define X86_64_QUANTA_LY4R_CONFIG_PHY_RESET_DELAY_MS 100
#endif
/**
* All compile time options can be queried or displayed
*/
/** Configuration settings structure. */
typedef struct x86_64_quanta_ly4r_config_settings_s {
/** name */
const char* name;
/** value */
const char* value;
} x86_64_quanta_ly4r_config_settings_t;
/** Configuration settings table. */
/** x86_64_quanta_ly4r_config_settings table. */
extern x86_64_quanta_ly4r_config_settings_t x86_64_quanta_ly4r_config_settings[];
/**
* @brief Lookup a configuration setting.
* @param setting The name of the configuration option to lookup.
*/
const char* x86_64_quanta_ly4r_config_lookup(const char* setting);
/**
* @brief Show the compile-time configuration.
* @param pvs The output stream.
*/
int x86_64_quanta_ly4r_config_show(struct aim_pvs_s* pvs);
/* <auto.end.cdefs(X86_64_QUANTA_LY4R_CONFIG_HEADER).header> */
#include "x86_64_quanta_ly4r_porting.h"
#endif /* __X86_64_QUANTA_LY4R_CONFIG_H__ */
/* @} */

View File

@@ -0,0 +1,26 @@
/**************************************************************************//**
*
* x86_64_quanta_ly4r Doxygen Header
*
*****************************************************************************/
#ifndef __X86_64_QUANTA_LY4R_DOX_H__
#define __X86_64_QUANTA_LY4R_DOX_H__
/**
* @defgroup x86_64_quanta_ly4r x86_64_quanta_ly4r - x86_64_quanta_ly4r Description
*
The documentation overview for this module should go here.
*
* @{
*
* @defgroup x86_64_quanta_ly4r-x86_64_quanta_ly4r Public Interface
* @defgroup x86_64_quanta_ly4r-config Compile Time Configuration
* @defgroup x86_64_quanta_ly4r-porting Porting Macros
*
* @}
*
*/
#endif /* __X86_64_QUANTA_LY4R_DOX_H__ */

View File

@@ -0,0 +1,24 @@
#ifndef __X86_64_QUANTA_LY4R_GPIO_TABLE_H__
#define __X86_64_QUANTA_LY4R_GPIO_TABLE_H__
/*
* defined within platform/quanta_switch.c
* Quanta Switch Platform driver
*/
#define QUANTA_LY4R_PCA953x_GPIO(P1, P2) (P1*8+P2)
#define QUANTA_LY4R_PCA9698_GPIO_SIZE 0x28
#define QUANTA_LY4R_I2C_GPIO_BASE 0x10
#define QUANTA_LY4R_PCA9698_GPIO_BASE (QUANTA_LY4R_I2C_GPIO_BASE)
#define QUANTA_LY4R_PCA9698_GPIO_SFP_1_PRSNT_N (QUANTA_LY4R_PCA9698_GPIO_BASE + QUANTA_LY4R_PCA953x_GPIO(0,2))
#define QUANTA_LY4R_PCA9698_GPIO_SFP_2_PRSNT_N (QUANTA_LY4R_PCA9698_GPIO_BASE + QUANTA_LY4R_PCA953x_GPIO(0,6))
#define QUANTA_LY4R_PCA9698_GPIO_SFP_3_PRSNT_N (QUANTA_LY4R_PCA9698_GPIO_BASE + QUANTA_LY4R_PCA953x_GPIO(1,2))
#define QUANTA_LY4R_PCA9698_GPIO_SFP_4_PRSNT_N (QUANTA_LY4R_PCA9698_GPIO_BASE + QUANTA_LY4R_PCA953x_GPIO(1,6))
#define QUANTA_LY4R_PCA9698_GPIO_SFP_5_PRSNT_N (QUANTA_LY4R_PCA9698_GPIO_BASE + QUANTA_LY4R_PCA953x_GPIO(2,2))
#define QUANTA_LY4R_PCA9698_BOOT_STSLED_N (QUANTA_LY4R_PCA9698_GPIO_BASE + QUANTA_LY4R_PCA953x_GPIO(2,4))
#define QUANTA_LY4R_PCA9698_SYS_STSLED (QUANTA_LY4R_PCA9698_GPIO_BASE + QUANTA_LY4R_PCA953x_GPIO(2,5))
#define QUANTA_LY4R_PCA9698_GPIO_SFP_P3V3_PW_EN (QUANTA_LY4R_PCA9698_GPIO_BASE + QUANTA_LY4R_PCA953x_GPIO(2,6))
#define QUANTA_LY4R_PCA9698_GPIO_SFP_P3V3_PW_GD (QUANTA_LY4R_PCA9698_GPIO_BASE + QUANTA_LY4R_PCA953x_GPIO(2,7))
#endif /* __X86_64_QUANTA_LY4R_GPIO_TABLE_H__ */

View File

@@ -0,0 +1,87 @@
/**************************************************************************//**
*
* @file
* @brief x86_64_quanta_ly4r Porting Macros.
*
* @addtogroup x86_64_quanta_ly4r-porting
* @{
*
*****************************************************************************/
#ifndef __X86_64_QUANTA_LY4R_PORTING_H__
#define __X86_64_QUANTA_LY4R_PORTING_H__
/* <auto.start.portingmacro(ALL).define> */
#if X86_64_QUANTA_LY4R_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <memory.h>
#endif
#ifndef X86_64_QUANTA_LY4R_MEMSET
#if defined(GLOBAL_MEMSET)
#define X86_64_QUANTA_LY4R_MEMSET GLOBAL_MEMSET
#elif X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB == 1
#define X86_64_QUANTA_LY4R_MEMSET memset
#else
#error The macro X86_64_QUANTA_LY4R_MEMSET is required but cannot be defined.
#endif
#endif
#ifndef X86_64_QUANTA_LY4R_MEMCPY
#if defined(GLOBAL_MEMCPY)
#define X86_64_QUANTA_LY4R_MEMCPY GLOBAL_MEMCPY
#elif X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB == 1
#define X86_64_QUANTA_LY4R_MEMCPY memcpy
#else
#error The macro X86_64_QUANTA_LY4R_MEMCPY is required but cannot be defined.
#endif
#endif
#ifndef X86_64_QUANTA_LY4R_STRNCPY
#if defined(GLOBAL_STRNCPY)
#define X86_64_QUANTA_LY4R_STRNCPY GLOBAL_STRNCPY
#elif X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB == 1
#define X86_64_QUANTA_LY4R_STRNCPY strncpy
#else
#error The macro X86_64_QUANTA_LY4R_STRNCPY is required but cannot be defined.
#endif
#endif
#ifndef X86_64_QUANTA_LY4R_VSNPRINTF
#if defined(GLOBAL_VSNPRINTF)
#define X86_64_QUANTA_LY4R_VSNPRINTF GLOBAL_VSNPRINTF
#elif X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB == 1
#define X86_64_QUANTA_LY4R_VSNPRINTF vsnprintf
#else
#error The macro X86_64_QUANTA_LY4R_VSNPRINTF is required but cannot be defined.
#endif
#endif
#ifndef X86_64_QUANTA_LY4R_SNPRINTF
#if defined(GLOBAL_SNPRINTF)
#define X86_64_QUANTA_LY4R_SNPRINTF GLOBAL_SNPRINTF
#elif X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB == 1
#define X86_64_QUANTA_LY4R_SNPRINTF snprintf
#else
#error The macro X86_64_QUANTA_LY4R_SNPRINTF is required but cannot be defined.
#endif
#endif
#ifndef X86_64_QUANTA_LY4R_STRLEN
#if defined(GLOBAL_STRLEN)
#define X86_64_QUANTA_LY4R_STRLEN GLOBAL_STRLEN
#elif X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB == 1
#define X86_64_QUANTA_LY4R_STRLEN strlen
#else
#error The macro X86_64_QUANTA_LY4R_STRLEN is required but cannot be defined.
#endif
#endif
/* <auto.end.portingmacro(ALL).define> */
#endif /* __X86_64_QUANTA_LY4R_PORTING_H__ */
/* @} */

View File

@@ -0,0 +1,10 @@
###############################################################################
#
#
#
###############################################################################
THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
x86_64_quanta_ly4r_INCLUDES := -I $(THIS_DIR)inc
x86_64_quanta_ly4r_INTERNAL_INCLUDES := -I $(THIS_DIR)src
x86_64_quanta_ly4r_DEPENDMODULE_ENTRIES := init:x86_64_quanta_ly4r ucli:x86_64_quanta_ly4r

View File

@@ -0,0 +1,9 @@
###############################################################################
#
# Local source generation targets.
#
###############################################################################
ucli:
@../../../../tools/uclihandlers.py x86_64_quanta_ly4r_ucli.c

View File

@@ -0,0 +1,40 @@
/************************************************************
* <bsn.cl fy=2014 v=onl>
*
* Copyright 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>
************************************************************
*
*
*
***********************************************************/
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r_config.h>
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r_gpio_table.h>
#include <onlp/platformi/fani.h>
#include "x86_64_quanta_ly4r_int.h"
#include "x86_64_quanta_ly4r_log.h"
#include <onlplib/file.h>
#include <onlplib/gpio.h>
int
onlp_fani_init(void)
{
AIM_LOG_MSG("ONLP is not supported for FAN");
return ONLP_STATUS_E_UNSUPPORTED;
}

View File

@@ -0,0 +1,78 @@
#include <onlp/platformi/ledi.h>
#include <sys/mman.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include "x86_64_quanta_ly4r_int.h"
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r_gpio_table.h>
#include <onlplib/gpio.h>
/*
* Get the information for the given LED OID.
*/
static onlp_led_info_t led_info[] =
{
{ }, /* Not used */
{
{ LED_OID_SYSTEM, "System LED", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN,
}
};
int
onlp_ledi_init(void)
{
return ONLP_STATUS_OK;
}
int
onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
{
int led_id;
led_id = ONLP_OID_ID_GET(id);
*info = led_info[led_id];
info->status |= ONLP_LED_STATUS_ON;
info->mode |= ONLP_LED_MODE_ON;
return ONLP_STATUS_OK;
}
void
Sysfs_Set_System_LED(onlp_led_mode_t mode)
{
if(mode == ONLP_LED_MODE_GREEN){
onlp_gpio_set(QUANTA_LY4R_PCA9698_BOOT_STSLED_N, 0);
onlp_gpio_set(QUANTA_LY4R_PCA9698_SYS_STSLED, 1);
}
else if(mode == ONLP_LED_MODE_ORANGE){
onlp_gpio_set(QUANTA_LY4R_PCA9698_BOOT_STSLED_N, 1);
onlp_gpio_set(QUANTA_LY4R_PCA9698_SYS_STSLED, 0);
}
else{
onlp_gpio_set(QUANTA_LY4R_PCA9698_BOOT_STSLED_N, 1);
onlp_gpio_set(QUANTA_LY4R_PCA9698_SYS_STSLED, 1);
}
}
int
onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
{
int led_id;
led_id = ONLP_OID_ID_GET(id);
switch (led_id) {
case LED_ID_SYSTEM:
Sysfs_Set_System_LED(mode);
break;
default:
return ONLP_STATUS_E_INTERNAL;
break;
}
return ONLP_STATUS_OK;
}

View File

@@ -0,0 +1,9 @@
###############################################################################
#
#
#
###############################################################################
LIBRARY := x86_64_quanta_ly4r
$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(BUILDER)/lib.mk

View File

@@ -0,0 +1,23 @@
/************************************************************
* <bsn.cl fy=2014 v=onl>
* </bsn.cl>
************************************************************
*
*
*
***********************************************************/
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r_config.h>
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r_gpio_table.h>
#include <onlp/platformi/psui.h>
#include <onlplib/file.h>
#include <onlplib/gpio.h>
#include "x86_64_quanta_ly4r_int.h"
#include "x86_64_quanta_ly4r_log.h"
#include <AIM/aim_string.h>
int
onlp_psui_init(void)
{
AIM_LOG_MSG("ONLP is not supported for RPSU");
return ONLP_STATUS_E_UNSUPPORTED;
}

View File

@@ -0,0 +1,142 @@
/************************************************************
* <bsn.cl fy=2014 v=onl>
*
* Copyright 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>
************************************************************
*
* SFPI Interface for the Quanta LY4R
*
***********************************************************/
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r_config.h>
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r_gpio_table.h>
#include <onlp/platformi/sfpi.h>
#include <onlplib/sfp.h>
#include <onlplib/gpio.h>
#include "x86_64_quanta_ly4r_log.h"
#include <unistd.h>
#include <fcntl.h>
/**
* This table maps the presence gpio, reset gpio, and eeprom file
* for each SFP port.
*/
typedef struct sfpmap_s {
int port;
int present_gpio;
const char* reset_gpio;
const char* eeprom;
const char* dom;
} sfpmap_t;
static sfpmap_t sfpmap__[] =
{
{ 49, QUANTA_LY4R_PCA9698_GPIO_SFP_1_PRSNT_N, NULL, "/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-32/32-0050/eeprom", NULL },
{ 50, QUANTA_LY4R_PCA9698_GPIO_SFP_2_PRSNT_N, NULL, "/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-33/33-0050/eeprom", NULL },
{ 51, QUANTA_LY4R_PCA9698_GPIO_SFP_3_PRSNT_N, NULL, "/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-34/34-0050/eeprom", NULL },
{ 52, QUANTA_LY4R_PCA9698_GPIO_SFP_4_PRSNT_N, NULL, "/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-35/35-0050/eeprom", NULL },
{ 53, QUANTA_LY4R_PCA9698_GPIO_SFP_5_PRSNT_N, NULL, "/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-36/36-0050/eeprom", NULL },
};
#define SFP_GET(_port) (sfpmap__ + _port - 49)
int
onlp_sfpi_init(void)
{
int value = -1, ret, i;
sfpmap_t* sfp;
onlp_gpio_export(QUANTA_LY4R_PCA9698_GPIO_SFP_P3V3_PW_EN, ONLP_GPIO_DIRECTION_IN);
ret = onlp_gpio_get(QUANTA_LY4R_PCA9698_GPIO_SFP_P3V3_PW_EN, &value);
if(ret == ONLP_STATUS_OK && value != 0) {
onlp_gpio_export(QUANTA_LY4R_PCA9698_GPIO_SFP_P3V3_PW_EN, ONLP_GPIO_DIRECTION_OUT);
ret = onlp_gpio_set(QUANTA_LY4R_PCA9698_GPIO_SFP_P3V3_PW_EN, 0);
sleep(1);
}
for(i = 49; i < 54; i++) {
sfp = SFP_GET(i);
onlp_gpio_export(sfp->present_gpio, ONLP_GPIO_DIRECTION_IN);
}
return ret;
}
int
onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap)
{
int p;
for(p = 49; p < 54; p++) {
AIM_BITMAP_SET(bmap, p);
}
return ONLP_STATUS_OK;
}
int
onlp_sfpi_is_present(int port)
{
int value = 0;
sfpmap_t* sfp = SFP_GET(port);
if(sfp->present_gpio > 0) {
if(onlp_gpio_get(sfp->present_gpio, &value) == ONLP_STATUS_OK)
return (value == 0);
else
return ONLP_STATUS_E_MISSING;
}
else {
/**
* If we can open and read a byte from the EEPROM file
* then we consider it present.
*/
int fd = open(sfp->eeprom, O_RDONLY);
if (fd < 0) {
/* Not Present */
return 0;
}
int rv;
uint8_t byte;
if(read(fd, &byte, 1) == 1) {
/* Present */
rv = 1;
}
else {
/* No Present */
rv = 0;
}
close(fd);
return rv;
}
}
int
onlp_sfpi_eeprom_read(int port, uint8_t data[256])
{
sfpmap_t* sfp = SFP_GET(port);
return onlplib_sfp_eeprom_read_file(sfp->eeprom, data);
}
int
onlp_sfpi_dom_read(int port, uint8_t data[256])
{
sfpmap_t* sfp = SFP_GET(port);
return onlplib_sfp_eeprom_read_file(sfp->dom, data);
}

View File

@@ -0,0 +1,66 @@
/************************************************************
* <bsn.cl fy=2014 v=onl>
* </bsn.cl>
************************************************************
*
*
*
***********************************************************/
#include <onlp/platformi/sysi.h>
#include "x86_64_quanta_ly4r_int.h"
#include "x86_64_quanta_ly4r_log.h"
#include <quanta_sys_eeprom/eeprom.h>
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r_gpio_table.h>
#include <onlplib/gpio.h>
#include <onlplib/i2c.h>
#include <onlp/platformi/ledi.h>
const char*
onlp_sysi_platform_get(void)
{
/* Config GPIO */
/* LED Output */
onlp_gpio_export(QUANTA_LY4R_PCA9698_BOOT_STSLED_N, ONLP_GPIO_DIRECTION_OUT);
onlp_gpio_export(QUANTA_LY4R_PCA9698_SYS_STSLED, ONLP_GPIO_DIRECTION_OUT);
/* Set LED to green */
onlp_ledi_mode_set(LED_OID_SYSTEM, ONLP_LED_MODE_GREEN);
return "x86-64-quanta-ly4r-r0";
}
int
onlp_sysi_init(void)
{
return ONLP_STATUS_OK;
}
#define QUANTA_SYS_EEPROM_PATH \
"/sys/devices/pci0000:00/0000:00:13.0/i2c-1/1-0054/eeprom"
int
onlp_sysi_onie_info_get(onlp_onie_info_t* onie)
{
int rv;
rv = onlp_onie_decode_file(onie, QUANTA_SYS_EEPROM_PATH);
if(rv >= 0) {
onie->platform_name = aim_strdup("x86-64-quanta-ly4r-r0");
rv = quanta_onie_sys_eeprom_custom_format(onie);
}
return rv;
}
int
onlp_sysi_oids_get(onlp_oid_t* table, int max)
{
onlp_oid_t* e = table;
memset(table, 0, max*sizeof(onlp_oid_t));
/*
* 1 LED
*/
*e++ = LED_OID_SYSTEM;
return 0;
}

View File

@@ -0,0 +1,35 @@
/************************************************************
* <bsn.cl fy=2014 v=onl>
*
* Copyright 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>
************************************************************
*
*
*
***********************************************************/
#include <onlp/platformi/thermali.h>
#include <onlplib/file.h>
#include "x86_64_quanta_ly4r_int.h"
#include "x86_64_quanta_ly4r_log.h"
int
onlp_thermali_init(void)
{
AIM_LOG_MSG("ONLP is not supported for THERMAL");
return ONLP_STATUS_E_UNSUPPORTED;
}

View File

@@ -0,0 +1,95 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r_config.h>
/* <auto.start.cdefs(X86_64_QUANTA_LY4R_CONFIG_HEADER).source> */
#define __x86_64_quanta_ly4r_config_STRINGIFY_NAME(_x) #_x
#define __x86_64_quanta_ly4r_config_STRINGIFY_VALUE(_x) __x86_64_quanta_ly4r_config_STRINGIFY_NAME(_x)
x86_64_quanta_ly4r_config_settings_t x86_64_quanta_ly4r_config_settings[] =
{
#ifdef X86_64_QUANTA_LY4R_CONFIG_INCLUDE_LOGGING
{ __x86_64_quanta_ly4r_config_STRINGIFY_NAME(X86_64_QUANTA_LY4R_CONFIG_INCLUDE_LOGGING), __x86_64_quanta_ly4r_config_STRINGIFY_VALUE(X86_64_QUANTA_LY4R_CONFIG_INCLUDE_LOGGING) },
#else
{ X86_64_QUANTA_LY4R_CONFIG_INCLUDE_LOGGING(__x86_64_quanta_ly4r_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_QUANTA_LY4R_CONFIG_LOG_OPTIONS_DEFAULT
{ __x86_64_quanta_ly4r_config_STRINGIFY_NAME(X86_64_QUANTA_LY4R_CONFIG_LOG_OPTIONS_DEFAULT), __x86_64_quanta_ly4r_config_STRINGIFY_VALUE(X86_64_QUANTA_LY4R_CONFIG_LOG_OPTIONS_DEFAULT) },
#else
{ X86_64_QUANTA_LY4R_CONFIG_LOG_OPTIONS_DEFAULT(__x86_64_quanta_ly4r_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_QUANTA_LY4R_CONFIG_LOG_BITS_DEFAULT
{ __x86_64_quanta_ly4r_config_STRINGIFY_NAME(X86_64_QUANTA_LY4R_CONFIG_LOG_BITS_DEFAULT), __x86_64_quanta_ly4r_config_STRINGIFY_VALUE(X86_64_QUANTA_LY4R_CONFIG_LOG_BITS_DEFAULT) },
#else
{ X86_64_QUANTA_LY4R_CONFIG_LOG_BITS_DEFAULT(__x86_64_quanta_ly4r_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_QUANTA_LY4R_CONFIG_LOG_CUSTOM_BITS_DEFAULT
{ __x86_64_quanta_ly4r_config_STRINGIFY_NAME(X86_64_QUANTA_LY4R_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __x86_64_quanta_ly4r_config_STRINGIFY_VALUE(X86_64_QUANTA_LY4R_CONFIG_LOG_CUSTOM_BITS_DEFAULT) },
#else
{ X86_64_QUANTA_LY4R_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__x86_64_quanta_ly4r_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB
{ __x86_64_quanta_ly4r_config_STRINGIFY_NAME(X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB), __x86_64_quanta_ly4r_config_STRINGIFY_VALUE(X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB) },
#else
{ X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB(__x86_64_quanta_ly4r_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_QUANTA_LY4R_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
{ __x86_64_quanta_ly4r_config_STRINGIFY_NAME(X86_64_QUANTA_LY4R_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __x86_64_quanta_ly4r_config_STRINGIFY_VALUE(X86_64_QUANTA_LY4R_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) },
#else
{ X86_64_QUANTA_LY4R_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__x86_64_quanta_ly4r_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_QUANTA_LY4R_CONFIG_INCLUDE_UCLI
{ __x86_64_quanta_ly4r_config_STRINGIFY_NAME(X86_64_QUANTA_LY4R_CONFIG_INCLUDE_UCLI), __x86_64_quanta_ly4r_config_STRINGIFY_VALUE(X86_64_QUANTA_LY4R_CONFIG_INCLUDE_UCLI) },
#else
{ X86_64_QUANTA_LY4R_CONFIG_INCLUDE_UCLI(__x86_64_quanta_ly4r_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_QUANTA_LY4R_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD
{ __x86_64_quanta_ly4r_config_STRINGIFY_NAME(X86_64_QUANTA_LY4R_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD), __x86_64_quanta_ly4r_config_STRINGIFY_VALUE(X86_64_QUANTA_LY4R_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD) },
#else
{ X86_64_QUANTA_LY4R_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD(__x86_64_quanta_ly4r_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_QUANTA_LY4R_CONFIG_SYSFAN_F2B_RPM_MAX
{ __x86_64_quanta_ly4r_config_STRINGIFY_NAME(X86_64_QUANTA_LY4R_CONFIG_SYSFAN_F2B_RPM_MAX), __x86_64_quanta_ly4r_config_STRINGIFY_VALUE(X86_64_QUANTA_LY4R_CONFIG_SYSFAN_F2B_RPM_MAX) },
#else
{ X86_64_QUANTA_LY4R_CONFIG_SYSFAN_F2B_RPM_MAX(__x86_64_quanta_ly4r_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_QUANTA_LY4R_CONFIG_SYSFAN_B2F_RPM_MAX
{ __x86_64_quanta_ly4r_config_STRINGIFY_NAME(X86_64_QUANTA_LY4R_CONFIG_SYSFAN_B2F_RPM_MAX), __x86_64_quanta_ly4r_config_STRINGIFY_VALUE(X86_64_QUANTA_LY4R_CONFIG_SYSFAN_B2F_RPM_MAX) },
#else
{ X86_64_QUANTA_LY4R_CONFIG_SYSFAN_B2F_RPM_MAX(__x86_64_quanta_ly4r_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_QUANTA_LY4R_CONFIG_PHY_RESET_DELAY_MS
{ __x86_64_quanta_ly4r_config_STRINGIFY_NAME(X86_64_QUANTA_LY4R_CONFIG_PHY_RESET_DELAY_MS), __x86_64_quanta_ly4r_config_STRINGIFY_VALUE(X86_64_QUANTA_LY4R_CONFIG_PHY_RESET_DELAY_MS) },
#else
{ X86_64_QUANTA_LY4R_CONFIG_PHY_RESET_DELAY_MS(__x86_64_quanta_ly4r_config_STRINGIFY_NAME), "__undefined__" },
#endif
{ NULL, NULL }
};
#undef __x86_64_quanta_ly4r_config_STRINGIFY_VALUE
#undef __x86_64_quanta_ly4r_config_STRINGIFY_NAME
const char*
x86_64_quanta_ly4r_config_lookup(const char* setting)
{
int i;
for(i = 0; x86_64_quanta_ly4r_config_settings[i].name; i++) {
if(strcmp(x86_64_quanta_ly4r_config_settings[i].name, setting)) {
return x86_64_quanta_ly4r_config_settings[i].value;
}
}
return NULL;
}
int
x86_64_quanta_ly4r_config_show(struct aim_pvs_s* pvs)
{
int i;
for(i = 0; x86_64_quanta_ly4r_config_settings[i].name; i++) {
aim_printf(pvs, "%s = %s\n", x86_64_quanta_ly4r_config_settings[i].name, x86_64_quanta_ly4r_config_settings[i].value);
}
return i;
}
/* <auto.end.cdefs(X86_64_QUANTA_LY4R_CONFIG_HEADER).source> */

View File

@@ -0,0 +1,10 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r_config.h>
/* <--auto.start.enum(ALL).source> */
/* <auto.end.enum(ALL).source> */

View File

@@ -0,0 +1,283 @@
/**************************************************************************//**
*
* x86_64_quanta_ly4r Internal Header
*
*****************************************************************************/
#ifndef __X86_64_QUANTA_LY4R_INT_H__
#define __X86_64_QUANTA_LY4R_INT_H__
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r_config.h>
#include <limits.h>
/* <auto.start.enum(ALL).header> */
/** thermal_oid */
typedef enum thermal_oid_e {
THERMAL_OID_THERMAL1 = ONLP_THERMAL_ID_CREATE(1),
THERMAL_OID_THERMAL2 = ONLP_THERMAL_ID_CREATE(2),
THERMAL_OID_THERMAL3 = ONLP_THERMAL_ID_CREATE(3),
THERMAL_OID_THERMAL4 = ONLP_THERMAL_ID_CREATE(4),
THERMAL_OID_THERMAL5 = ONLP_THERMAL_ID_CREATE(5),
THERMAL_OID_THERMAL6 = ONLP_THERMAL_ID_CREATE(6),
THERMAL_OID_THERMAL7 = ONLP_THERMAL_ID_CREATE(7),
THERMAL_OID_THERMAL8 = ONLP_THERMAL_ID_CREATE(8),
THERMAL_OID_THERMAL9 = ONLP_THERMAL_ID_CREATE(9),
THERMAL_OID_THERMAL10 = ONLP_THERMAL_ID_CREATE(10),
THERMAL_OID_THERMAL11 = ONLP_THERMAL_ID_CREATE(11),
THERMAL_OID_THERMAL12 = ONLP_THERMAL_ID_CREATE(12),
THERMAL_OID_THERMAL13 = ONLP_THERMAL_ID_CREATE(13),
THERMAL_OID_THERMAL14 = ONLP_THERMAL_ID_CREATE(14),
THERMAL_OID_THERMAL15 = ONLP_THERMAL_ID_CREATE(15),
THERMAL_OID_THERMAL16 = ONLP_THERMAL_ID_CREATE(16),
} thermal_oid_t;
/** Enum names. */
const char* thermal_oid_name(thermal_oid_t e);
/** Enum values. */
int thermal_oid_value(const char* str, thermal_oid_t* e, int substr);
/** Enum descriptions. */
const char* thermal_oid_desc(thermal_oid_t e);
/** Enum validator. */
int thermal_oid_valid(thermal_oid_t e);
/** validator */
#define THERMAL_OID_VALID(_e) \
(thermal_oid_valid((_e)))
/** thermal_oid_map table. */
extern aim_map_si_t thermal_oid_map[];
/** thermal_oid_desc_map table. */
extern aim_map_si_t thermal_oid_desc_map[];
/** psu_oid */
typedef enum psu_oid_e {
PSU_OID_PSU1 = ONLP_PSU_ID_CREATE(1),
PSU_OID_PSU2 = ONLP_PSU_ID_CREATE(2),
} psu_oid_t;
/** Enum names. */
const char* psu_oid_name(psu_oid_t e);
/** Enum values. */
int psu_oid_value(const char* str, psu_oid_t* e, int substr);
/** Enum descriptions. */
const char* psu_oid_desc(psu_oid_t e);
/** Enum validator. */
int psu_oid_valid(psu_oid_t e);
/** validator */
#define PSU_OID_VALID(_e) \
(psu_oid_valid((_e)))
/** psu_oid_map table. */
extern aim_map_si_t psu_oid_map[];
/** psu_oid_desc_map table. */
extern aim_map_si_t psu_oid_desc_map[];
/** thermal_id */
typedef enum thermal_id_e {
THERMAL_ID_THERMAL1 = 1,
THERMAL_ID_THERMAL2 = 2,
THERMAL_ID_THERMAL3 = 3,
THERMAL_ID_THERMAL4 = 4,
THERMAL_ID_THERMAL5 = 5,
THERMAL_ID_THERMAL6 = 6,
THERMAL_ID_THERMAL7 = 7,
THERMAL_ID_THERMAL8 = 8,
THERMAL_ID_THERMAL9 = 9,
THERMAL_ID_THERMAL10 = 10,
THERMAL_ID_THERMAL11 = 11,
THERMAL_ID_THERMAL12 = 12,
THERMAL_ID_THERMAL13 = 13,
THERMAL_ID_THERMAL14 = 14,
THERMAL_ID_THERMAL15 = 15,
THERMAL_ID_THERMAL16 = 16,
} thermal_id_t;
/** Enum names. */
const char* thermal_id_name(thermal_id_t e);
/** Enum values. */
int thermal_id_value(const char* str, thermal_id_t* e, int substr);
/** Enum descriptions. */
const char* thermal_id_desc(thermal_id_t e);
/** Enum validator. */
int thermal_id_valid(thermal_id_t e);
/** validator */
#define THERMAL_ID_VALID(_e) \
(thermal_id_valid((_e)))
/** thermal_id_map table. */
extern aim_map_si_t thermal_id_map[];
/** thermal_id_desc_map table. */
extern aim_map_si_t thermal_id_desc_map[];
/** fan_id */
typedef enum fan_id_e {
FAN_ID_FAN1 = 1,
FAN_ID_FAN2 = 2,
FAN_ID_FAN3 = 3,
FAN_ID_FAN4 = 4,
FAN_ID_FAN5 = 5,
FAN_ID_FAN6 = 6,
FAN_ID_FAN7 = 7,
FAN_ID_FAN8 = 8,
FAN_ID_FAN9 = 9,
FAN_ID_FAN10 = 10,
} fan_id_t;
/** Enum names. */
const char* fan_id_name(fan_id_t e);
/** Enum values. */
int fan_id_value(const char* str, fan_id_t* e, int substr);
/** Enum descriptions. */
const char* fan_id_desc(fan_id_t e);
/** Enum validator. */
int fan_id_valid(fan_id_t e);
/** validator */
#define FAN_ID_VALID(_e) \
(fan_id_valid((_e)))
/** fan_id_map table. */
extern aim_map_si_t fan_id_map[];
/** fan_id_desc_map table. */
extern aim_map_si_t fan_id_desc_map[];
/** psu_id */
typedef enum psu_id_e {
PSU_ID_PSU1 = 1,
PSU_ID_PSU2 = 2,
} psu_id_t;
/** Enum names. */
const char* psu_id_name(psu_id_t e);
/** Enum values. */
int psu_id_value(const char* str, psu_id_t* e, int substr);
/** Enum descriptions. */
const char* psu_id_desc(psu_id_t e);
/** Enum validator. */
int psu_id_valid(psu_id_t e);
/** validator */
#define PSU_ID_VALID(_e) \
(psu_id_valid((_e)))
/** psu_id_map table. */
extern aim_map_si_t psu_id_map[];
/** psu_id_desc_map table. */
extern aim_map_si_t psu_id_desc_map[];
/** fan_oid */
typedef enum fan_oid_e {
FAN_OID_FAN1 = ONLP_FAN_ID_CREATE(1),
FAN_OID_FAN2 = ONLP_FAN_ID_CREATE(2),
FAN_OID_FAN3 = ONLP_FAN_ID_CREATE(3),
FAN_OID_FAN4 = ONLP_FAN_ID_CREATE(4),
FAN_OID_FAN5 = ONLP_FAN_ID_CREATE(5),
FAN_OID_FAN6 = ONLP_FAN_ID_CREATE(6),
FAN_OID_FAN7 = ONLP_FAN_ID_CREATE(7),
FAN_OID_FAN8 = ONLP_FAN_ID_CREATE(8),
FAN_OID_FAN9 = ONLP_FAN_ID_CREATE(9),
FAN_OID_FAN10 = ONLP_FAN_ID_CREATE(10),
} fan_oid_t;
/** Enum names. */
const char* fan_oid_name(fan_oid_t e);
/** Enum values. */
int fan_oid_value(const char* str, fan_oid_t* e, int substr);
/** Enum descriptions. */
const char* fan_oid_desc(fan_oid_t e);
/** Enum validator. */
int fan_oid_valid(fan_oid_t e);
/** validator */
#define FAN_OID_VALID(_e) \
(fan_oid_valid((_e)))
/** fan_oid_map table. */
extern aim_map_si_t fan_oid_map[];
/** fan_oid_desc_map table. */
extern aim_map_si_t fan_oid_desc_map[];
/* <auto.end.enum(ALL).header> */
/* psu info table */
struct psu_info_s {
char path[PATH_MAX];
int present;
int busno;
int addr;
};
/** led_id */
typedef enum led_id_e {
LED_ID_SYSTEM = 1,
} led_id_t;
/** Enum names. */
const char* led_id_name(led_id_t e);
/** Enum values. */
int led_id_value(const char* str, led_id_t* e, int substr);
/** Enum descriptions. */
const char* led_id_desc(led_id_t e);
/** Enum validator. */
int led_id_valid(led_id_t e);
/** validator */
#define LED_ID_VALID(_e) \
(led_id_valid((_e)))
/** led_id_map table. */
extern aim_map_si_t led_id_map[];
/** led_id_desc_map table. */
extern aim_map_si_t led_id_desc_map[];
/** led_oid */
typedef enum led_oid_e {
LED_OID_SYSTEM = ONLP_LED_ID_CREATE(LED_ID_SYSTEM),
} led_oid_t;
/** Enum names. */
const char* led_oid_name(led_oid_t e);
/** Enum values. */
int led_oid_value(const char* str, led_oid_t* e, int substr);
/** Enum descriptions. */
const char* led_oid_desc(led_oid_t e);
/** Enum validator. */
int led_oid_valid(led_oid_t e);
/** validator */
#define LED_OID_VALID(_e) \
(led_oid_valid((_e)))
/** led_oid_map table. */
extern aim_map_si_t led_oid_map[];
/** led_oid_desc_map table. */
extern aim_map_si_t led_oid_desc_map[];
/* <auto.end.enum(ALL).header> */
#define SYS_HWMON_PREFIX "/sys/devices/pci0000:00/0000:00:1f.3/i2c-0/0-004e"
#endif /* __X86_64_QUANTA_LY4R_INT_H__ */

View File

@@ -0,0 +1,18 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r_config.h>
#include "x86_64_quanta_ly4r_log.h"
/*
* x86_64_quanta_ly4r log struct.
*/
AIM_LOG_STRUCT_DEFINE(
X86_64_QUANTA_LY4R_CONFIG_LOG_OPTIONS_DEFAULT,
X86_64_QUANTA_LY4R_CONFIG_LOG_BITS_DEFAULT,
NULL, /* Custom log map */
X86_64_QUANTA_LY4R_CONFIG_LOG_CUSTOM_BITS_DEFAULT
);

View File

@@ -0,0 +1,12 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#ifndef __X86_64_QUANTA_LY4R_LOG_H__
#define __X86_64_QUANTA_LY4R_LOG_H__
#define AIM_LOG_MODULE_NAME x86_64_quanta_ly4r
#include <AIM/aim_log.h>
#endif /* __X86_64_QUANTA_LY4R_LOG_H__ */

View File

@@ -0,0 +1,24 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r_config.h>
#include "x86_64_quanta_ly4r_log.h"
static int
datatypes_init__(void)
{
#define X86_64_QUANTA_LY4R_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r.x>
return 0;
}
void __x86_64_quanta_ly4r_module_init__(void)
{
AIM_LOG_STRUCT_REGISTER();
datatypes_init__();
}
int __onlp_platform_version__ = 1;

View File

@@ -0,0 +1,50 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_quanta_ly4r/x86_64_quanta_ly4r_config.h>
#if X86_64_QUANTA_LY4R_CONFIG_INCLUDE_UCLI == 1
#include <uCli/ucli.h>
#include <uCli/ucli_argparse.h>
#include <uCli/ucli_handler_macros.h>
static ucli_status_t
x86_64_quanta_ly4r_ucli_ucli__config__(ucli_context_t* uc)
{
UCLI_HANDLER_MACRO_MODULE_CONFIG(x86_64_quanta_ly4r)
}
/* <auto.ucli.handlers.start> */
/* <auto.ucli.handlers.end> */
static ucli_module_t
x86_64_quanta_ly4r_ucli_module__ =
{
"x86_64_quanta_ly4r_ucli",
NULL,
x86_64_quanta_ly4r_ucli_ucli_handlers__,
NULL,
NULL,
};
ucli_node_t*
x86_64_quanta_ly4r_ucli_node_create(void)
{
ucli_node_t* n;
ucli_module_init(&x86_64_quanta_ly4r_ucli_module__);
n = ucli_node_create("x86_64_quanta_ly4r", NULL, &x86_64_quanta_ly4r_ucli_module__);
ucli_node_subnode_add(n, ucli_module_log_node_create("x86_64_quanta_ly4r"));
return n;
}
#else
void*
x86_64_quanta_ly4r_ucli_node_create(void)
{
return NULL;
}
#endif

View File

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

View File

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

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=quanta BASENAME=x86-64-quanta-ly4r REVISION=r0

View File

@@ -0,0 +1,31 @@
---
######################################################################
#
# platform-config for LY4R
#
######################################################################
x86-64-quanta-ly4r-r0:
grub:
serial: >-
--port=0x2f8
--speed=115200
--word=8
--parity=no
--stop=1
kernel:
<<: *kernel-3-16
args: >-
console=ttyS1,115200n8
reboot=c,p
##network:
## interfaces:
## ma1:
## name: ~
## syspath: pci0000:00/0000:00:14.0

View File

@@ -0,0 +1,13 @@
from onl.platform.base import *
from onl.platform.quanta import *
class OnlPlatform_x86_64_quanta_ly4r_r0(OnlPlatformQuanta,
OnlPlatformPortConfig_48x1_4x10):
PLATFORM='x86-64-quanta-ly4r-r0'
MODEL="LY4R"
SYS_OBJECT_ID=".8.1"
def baseconfig(self):
self.insmod("quanta_platform_ly4r")
return True