diff options
author | Timothy Pearson <tpearson@raptorengineering.com> | 2017-08-27 16:20:38 -0500 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2017-08-27 16:20:38 -0500 |
commit | 84eea7fdc46dd76e84cafbf96813bc826d5e08ad (patch) | |
tree | 035d28afe18ce33231b956349d1a3a90ec763d60 /meta-raptor | |
parent | e65a7944211c70f6b5cfb6cedd73cc31105319de (diff) | |
download | ast2050-yocto-openbmc-84eea7fdc46dd76e84cafbf96813bc826d5e08ad.zip ast2050-yocto-openbmc-84eea7fdc46dd76e84cafbf96813bc826d5e08ad.tar.gz |
Add initial support for the ASpeed 2050 and the ASUS KGPE-D16
Thermal management is functional but expects all fans to be attached
Known issues:
* BMC has been observed spontaneously rebooting after ~7-8 hours uptime
with no logs and no console output.
* While kcs has been implemented, the IPMI daemon is only functional
enough to report chassis status.
Diffstat (limited to 'meta-raptor')
130 files changed, 15666 insertions, 0 deletions
diff --git a/meta-raptor/meta-asus/COPYING.MIT b/meta-raptor/meta-asus/COPYING.MIT new file mode 100644 index 0000000..89de354 --- /dev/null +++ b/meta-raptor/meta-asus/COPYING.MIT @@ -0,0 +1,17 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/meta-raptor/meta-asus/README b/meta-raptor/meta-asus/README new file mode 100644 index 0000000..949936b --- /dev/null +++ b/meta-raptor/meta-asus/README @@ -0,0 +1,64 @@ +This README file contains information on the contents of the +asus layer. + +Please see the corresponding sections below for details. + + +Dependencies +============ + +This layer depends on: + + URI: git://git.openembedded.org/bitbake + branch: master + + URI: git://git.openembedded.org/openembedded-core + layers: meta + branch: master + + URI: git://git.yoctoproject.org/xxxx + layers: xxxx + branch: master + + +Patches +======= + +Please submit any patches against the asus layer to the +xxxx mailing list (xxxx@zzzz.org) and cc: the maintainer: + +Maintainer: XXX YYYYYY <xxx.yyyyyy@zzzzz.com> + + +Table of Contents +================= + + I. Adding the asus layer to your build + II. Misc + + +I. Adding the asus layer to your build +================================================= + +--- replace with specific instructions for the asus layer --- + +In order to use this layer, you need to make the build system aware of +it. + +Assuming the asus layer exists at the top-level of your +yocto build tree, you can add it to the build system by adding the +location of the asus layer to bblayers.conf, along with any +other layers needed. e.g.: + + BBLAYERS ?= " \ + /path/to/yocto/meta \ + /path/to/yocto/meta-yocto \ + /path/to/yocto/meta-yocto-bsp \ + /path/to/yocto/meta-asus \ + " + + +II. Misc +======== + +--- replace with specific information about the asus layer --- diff --git a/meta-raptor/meta-asus/classes/asus_uboot_image.bbclass b/meta-raptor/meta-asus/classes/asus_uboot_image.bbclass new file mode 100644 index 0000000..19aa05d --- /dev/null +++ b/meta-raptor/meta-asus/classes/asus_uboot_image.bbclass @@ -0,0 +1,51 @@ +inherit image_types_uboot + +# 24M +IMAGE_ROOTFS_SIZE = "24576" +# and don't put overhead behind my back +IMAGE_OVERHEAD_FACTOR = "1" + +IMAGE_PREPROCESS_COMMAND += " generate_data_mount_dir ; " +IMAGE_POSTPROCESS_COMMAND += " flash_image_generate ; " + +FLASH_IMAGE_NAME ?= "flash-${MACHINE}-${DATETIME}" +FLASH_IMAGE_LINK ?= "flash-${MACHINE}" +# 16M +FLASH_SIZE ?= "16384" +FLASH_UBOOT_OFFSET ?= "0" +# 512k +FLASH_KERNEL_OFFSET ?= "512" +# 2.4M +FLASH_ROOTFS_OFFSET ?= "2304" + +flash_image_generate() { + kernelfile="${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}" + ubootfile="${DEPLOY_DIR_IMAGE}/u-boot.${UBOOT_SUFFIX}" + # rootfs has to match the type defined in IMAGE_FSTYPES" + rootfs="${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.squashfs" + if [ ! -f $kernelfile ]; then + echo "Kernel file ${kernelfile} does not exist" + return 1 + fi + if [ ! -f $ubootfile ]; then + echo "U-boot file ${ubootfile} does not exist" + return 1 + fi + if [ ! -f $rootfs ]; then + echo "Rootfs file ${rootfs} does not exist" + return 1 + fi + dst="${DEPLOY_DIR_IMAGE}/${FLASH_IMAGE_NAME}" + rm -rf $dst + dd if=/dev/zero bs=1k count=${FLASH_SIZE} | tr "\000" "\377" > ${dst} + dd if=${ubootfile} of=${dst} bs=1k seek=${FLASH_UBOOT_OFFSET} conv=notrunc + dd if=${kernelfile} of=${dst} bs=1k seek=${FLASH_KERNEL_OFFSET} conv=notrunc + dd if=${rootfs} of=${dst} bs=1k seek=${FLASH_ROOTFS_OFFSET} conv=notrunc + dstlink="${DEPLOY_DIR_IMAGE}/${FLASH_IMAGE_LINK}" + rm -rf $dstlink + ln -sf ${FLASH_IMAGE_NAME} $dstlink +} + +generate_data_mount_dir() { + mkdir -p "${IMAGE_ROOTFS}/mnt/data" +} diff --git a/meta-raptor/meta-asus/conf/bblayers.conf.sample b/meta-raptor/meta-asus/conf/bblayers.conf.sample new file mode 100644 index 0000000..1fd6752 --- /dev/null +++ b/meta-raptor/meta-asus/conf/bblayers.conf.sample @@ -0,0 +1,22 @@ +# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +LCONF_VERSION = "6" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ##OEROOT##/meta \ + ##OEROOT##/meta-yocto \ + ##OEROOT##/meta-yocto-bsp \ + ##OEROOT##/meta-openembedded/meta-oe \ + ##OEROOT##/meta-openembedded/meta-networking \ + ##OEROOT##/meta-openembedded/meta-python \ + ##OEROOT##/meta-openbmc \ + ##OEROOT##/meta-openbmc/meta-aspeed \ + ##OEROOT##/meta-openbmc/meta-raptor/meta-asus \ + " +BBLAYERS_NON_REMOVABLE ?= " \ + ##OEROOT##/meta \ + ##OEROOT##/meta-yocto \ + " diff --git a/meta-raptor/meta-asus/conf/conf-notes.txt b/meta-raptor/meta-asus/conf/conf-notes.txt new file mode 100644 index 0000000..99f9d6a --- /dev/null +++ b/meta-raptor/meta-asus/conf/conf-notes.txt @@ -0,0 +1,2 @@ +Common targets are: + asus-image diff --git a/meta-raptor/meta-asus/conf/layer.conf b/meta-raptor/meta-asus/conf/layer.conf new file mode 100644 index 0000000..547625c --- /dev/null +++ b/meta-raptor/meta-asus/conf/layer.conf @@ -0,0 +1,10 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have recipes-* directories, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "asus" +BBFILE_PATTERN_asus = "^${LAYERDIR}/" +BBFILE_PRIORITY_asus = "10" diff --git a/meta-raptor/meta-asus/conf/local.conf.sample b/meta-raptor/meta-asus/conf/local.conf.sample new file mode 100644 index 0000000..2de916f --- /dev/null +++ b/meta-raptor/meta-asus/conf/local.conf.sample @@ -0,0 +1,9 @@ +# +# Local configuration file for building the OpenBMC image. +# + +# Machine Selection +MACHINE ??= "asus" + +# OpenBMC distro settings +DISTRO ?= "poky" diff --git a/meta-raptor/meta-asus/conf/machine/asus.conf b/meta-raptor/meta-asus/conf/machine/asus.conf new file mode 100644 index 0000000..13852e7 --- /dev/null +++ b/meta-raptor/meta-asus/conf/machine/asus.conf @@ -0,0 +1,18 @@ +#@TYPE: Machine +#@NAME: ASUS +#@DESCRIPTION: Machine configuration for Raptor ASUS + +UBOOT_MACHINE_asus = "asus_config" + +require conf/machine/include/ast1250.inc + +# configuration for preferred version of packages +PREFERRED_VERSION_libipmi = "0.1" +PREFERRED_VERSION_ipmid = "0.1" +PREFERRED_VERSION_rest-api = "0.1" + +MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-i2c-dev-sysfs" +MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-cpld" +MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-com-e-driver" + +TCLIBC = 'eglibc' diff --git a/meta-raptor/meta-asus/recipes-asus/bmc-log/bmc-log_0.1.bb b/meta-raptor/meta-asus/recipes-asus/bmc-log/bmc-log_0.1.bb new file mode 100644 index 0000000..2788a36 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/bmc-log/bmc-log_0.1.bb @@ -0,0 +1,50 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +SUMMARY = "Logging Utility" +DESCRIPTION = "Util for logging" +SECTION = "base" +PR = "r1" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://bmc-log.c;beginline=4;endline=16;md5=da35978751a9d71b73679307c4d296ec" + +SRC_URI = "file://bmc-log.c \ + file://bmc-log.h \ + file://Makefile \ + file://bmc-log-config \ + file://bmc-log.sh \ + " + +S = "${WORKDIR}" + +do_install() { + install -d ${D}${sbindir} + install -m 755 bmc-log ${D}${sbindir}/bmc-log + install -d ${D}${sysconfdir}/default + install -m 755 bmc-log-config ${D}${sysconfdir}/default/bmc-log + install -d ${D}${sysconfdir}/init.d + install -m 755 bmc-log.sh ${D}${sysconfdir}/init.d/bmc-log.sh + update-rc.d -r ${D} bmc-log.sh start 92 S . +} + +FILES_${PN} = "${sbindir} ${sysconfdir} " + +# Inhibit complaints about .debug directories + +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" diff --git a/meta-raptor/meta-asus/recipes-asus/bmc-log/files/Makefile b/meta-raptor/meta-asus/recipes-asus/bmc-log/files/Makefile new file mode 100644 index 0000000..5004556 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/bmc-log/files/Makefile @@ -0,0 +1,24 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +LIBS = -lutil + +all: + ${CC} ${CFLAGS} -o bmc-log bmc-log.c ${LIBS} + +clean: + rm -rf *.o bmc-log diff --git a/meta-raptor/meta-asus/recipes-asus/bmc-log/files/bmc-log-config b/meta-raptor/meta-asus/recipes-asus/bmc-log/files/bmc-log-config new file mode 100644 index 0000000..529adf2 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/bmc-log/files/bmc-log-config @@ -0,0 +1,16 @@ +# Configuration used by bmc-log script + +#Serial port connected to the micro-server +US_TTY="" + +#IP version of the log collecting server +LOG_SERVER_IP_VERSION="" + +#Host name of the log collecting server +LOG_SERVER_NAME="" + +#Port number of the log collecting server +LOG_SERVER_PORT="" + +#Baud rate to set for the US_TTY +TTY_BAUD_RATE="" diff --git a/meta-raptor/meta-asus/recipes-asus/bmc-log/files/bmc-log.c b/meta-raptor/meta-asus/recipes-asus/bmc-log/files/bmc-log.c new file mode 100644 index 0000000..078db7b --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/bmc-log/files/bmc-log.c @@ -0,0 +1,559 @@ +/* + * Copyright 2014-present Facebook. All Rights Reserved. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <fcntl.h> +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <stdbool.h> +#include <unistd.h> +#include <string.h> +#include <linux/serial.h> +#include <sys/socket.h> +#include <sys/types.h> +#include <sys/param.h> +#include <time.h> +#include <arpa/inet.h> +#include <sys/stat.h> +#include <pty.h> +#include <errno.h> +#include <signal.h> +#include <netinet/in.h> +#include <netdb.h> +#include "bmc-log.h" + +FILE *error_file = NULL; + +bool kill_received = false; // To check if a killing interrupt is received + +speed_t baud_rate = B57600; // Default baud rate - change if user inputs a different one + +int fd_tty = -1, fd_soc = -1; + +/* Hostname and port of the server */ +char *hostname; +int port; + +struct termios orig_tty_state; + +char *get_time() +{ + static char mytime[TIME_FORMAT_SIZE]; + memset(mytime, 0, sizeof(mytime)); + time_t this_time; + struct tm *this_tm; + this_time = time(NULL); + this_tm = localtime(&this_time); + + snprintf(mytime, sizeof(mytime), "%04d-%02d-%02d %02d:%02d:%02d", + 1900 + this_tm->tm_year, this_tm->tm_mon + 1, + this_tm->tm_mday, this_tm->tm_hour, + this_tm->tm_min, this_tm->tm_sec); + return mytime; +} + +void errlog(char *frmt, ...) +{ + va_list args; + va_start(args, frmt); + struct stat st; + + char *time_now = get_time(); + + fprintf(stderr, "[%s] ", time_now); + vfprintf(stderr, frmt, args); + + if (error_file) { + stat(error_log_file, &st); + if (st.st_size >= MAX_LOG_FILE_SIZE) { + truncate(error_log_file, 0); + } + fprintf(error_file, "[%s] ", time_now); + vfprintf(error_file, frmt, args); + fflush(error_file); + } +} + +/* Get the address info of netcons server */ +struct addrinfo *get_addr_info(int ip_version) +{ + int ip_family = (ip_version == IPV4) ? AF_INET : AF_INET6; + struct addrinfo hints; + + struct addrinfo *result; + result = malloc(sizeof(*result)); + if (!result) { + errlog("Error: Unable to allocate memory - %m\n"); + return NULL; + } + + memset(&hints, 0, sizeof(struct addrinfo)); + hints.ai_family = ip_family; /* Allow IPv4 or IPv6 */ + hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */ + hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */ + hints.ai_protocol = 0; /* Any protocol */ + hints.ai_canonname = NULL; + hints.ai_addr = NULL; + hints.ai_next = NULL; + + if (getaddrinfo(hostname, NULL, &hints, &result)) { + errlog("Error: getaddrinfo failed - %m\n"); + return NULL; + } + + return result; +} + +/* Prepare Ipv4 Socket */ +bool prepare_sock(struct sockaddr_in * tgt_addr) +{ + struct addrinfo *addr_info; + memset(tgt_addr, 0, sizeof(*tgt_addr)); + + if ((addr_info = get_addr_info(IPV4)) == NULL) { + errlog("Error: Unable to get address info\n"); + return false; + } + + tgt_addr->sin_addr = ((struct sockaddr_in *)addr_info->ai_addr)->sin_addr; + tgt_addr->sin_port = htons(port); + tgt_addr->sin_family = AF_INET; + + return true; +} + +/* Prepare Ipv6 Socket */ +bool prepare_sock6(struct sockaddr_in6 * tgt_addr6) +{ + struct addrinfo *addr_info; + memset(tgt_addr6, 0, sizeof(*tgt_addr6)); + + if ((addr_info = get_addr_info(IPV6)) == NULL) { + errlog("Erorr: Unable to get address info\n"); + return false; + } + + tgt_addr6->sin6_addr = ((struct sockaddr_in6 *)addr_info->ai_addr)->sin6_addr; + tgt_addr6->sin6_port = htons(port); + tgt_addr6->sin6_family = AF_INET6; + + return true; +} + +/* Set TTY to raw mode */ +bool set_tty(int fd) +{ + struct termios tty_state; + + if (tcgetattr(fd, &tty_state) < 0) { + return false; + } + + if (tcgetattr(fd, &orig_tty_state) < 0) // Save original settings + { + return false; + } + + if (cfsetspeed(&tty_state, baud_rate) == -1) { + errlog("Error: Baud Rate not set - %m\n"); + return false; + } + + tty_state.c_lflag &= ~(ICANON | IEXTEN | ISIG | ECHO); + tty_state.c_iflag &= ~(IGNCR | ICRNL | INPCK | ISTRIP | IXON | BRKINT); + tty_state.c_iflag |= (IGNCR | ICRNL); + tty_state.c_oflag &= ~OPOST; + tty_state.c_cflag |= CS8; + + tty_state.c_cc[VMIN] = 1; + tty_state.c_cc[VTIME] = 0; + + if (tcsetattr(fd, TCSAFLUSH, &tty_state) < 0) { + return false; + } + + return true; +} + +/* Create a pseudo terminal for other process to use (as this program is using up the actual TTY) */ +int create_pseudo_tty() +{ + int amaster, aslave; + int flags; + + if (openpty(&amaster, &aslave, NULL, NULL, NULL) == -1) { + errlog("Error: Openpty failed - %m\n"); + return -1; + } + + /* Set to non blocking mode */ + flags = fcntl(amaster, F_GETFL); + flags |= O_NONBLOCK; + fcntl(amaster, F_SETFL, flags); + + FILE *pseudo_save_file = fopen(pseudo_tty_save_file, "w+"); + if (!pseudo_save_file) { + errlog("Error: Unable to open the pseudo info file - %m\n"); + return -1; + } + /* Save the name of the created pseudo tty in a text file for other processes to use */ + if (fprintf(pseudo_save_file, "%s\n", ttyname(aslave)) == -1) { + errlog("Error writing to the pseudo info file\n"); + fclose(pseudo_save_file); + return -1; + } + fclose(pseudo_save_file); + + if (set_tty(aslave) == -1) { + errlog("Error: Slave TTY not set properly\n"); + return -1; + } + + return amaster; +} + +/* Prepare logs from the read_buf and send them to the server */ +bool prepare_log_send(char *read_buf, int max_read, int fd_socket) +{ + size_t buff_index = 0; // Index for the read_buf string + + static char line[LINE_LEN] = { 0 }; + static size_t line_index = 0; // Index for the line string + + char msg[MSG_LEN] = { 0 }; // Message to be sent to the server + + /* Kernel Version */ + static char kernel_version[KERNEL_VERSION_LEN] = "dummy_kernel"; + static int kernel_search_pos = 0; + + while (buff_index < max_read && read_buf[buff_index] != '\0') { + if (read_buf[buff_index] == 'L') // Check if there is a possibility of new kernel version + { + kernel_search_pos = line_index; + } + + /* Send the log when a line is read */ + if (read_buf[buff_index] == '\n') { + if (kernel_search_pos > 0) { + if (strncmp(line + kernel_search_pos, "Linux version ", kernel_search_len) == 0) { + sscanf(line + kernel_search_pos + kernel_search_len, "%s", kernel_version); + } + kernel_search_pos = 0; + } + + /* Prepare the message */ + memset(msg, 0, sizeof(msg)); + if (snprintf(msg, sizeof(msg), "%s %s %s %s", "kernel:", kernel_version, "- msg", line) < 0) { + errlog("Error copying the message - %m\n"); + return false; + } + + /* Send message to the server */ + if (write(fd_socket, msg, strlen(msg)) < 0) { + errlog("Error: Write to socket failed - %m\n"); + return false; + } + + /* Reset the line buffer */ + line_index = 0; + memset(line, 0, sizeof(line)); + + buff_index++; + continue; + } + + /* If line is too big, send only the first few bytes and discard others. */ + if (line_index >= sizeof(line)) { + line[line_index - 1] = 0; + buff_index++; + continue; + } + + line[line_index++] = read_buf[buff_index++]; + } + + return true; +} + +/* Read text from the TTY and send to send as logs */ +bool read_send(int fd_tty, int fd_socket) +{ + char read_buf[LINE_LEN] = { 0 }; // Buffer to be read into. + int read_size = 0; + fd_set readset; + int sel; + int fdmax; + + int pseudo_tty = create_pseudo_tty(); + + if (pseudo_tty == -1) { + errlog("Error: Cannot create a psuedo terminal\n"); + return false; + } + + fdmax = MAX(fd_tty, pseudo_tty); + + while (!kill_received) { + do { + FD_ZERO(&readset); + FD_SET(fd_tty, &readset); + FD_SET(pseudo_tty, &readset); + + sel = select(fdmax + 1, &readset, NULL, NULL, NULL); + } + while (sel == -1 && errno == EINTR && !kill_received); + + memset(read_buf, 0, sizeof(read_buf)); + if (FD_ISSET(fd_tty, &readset)) { + read_size = read(fd_tty, read_buf, sizeof(read_buf) - 1); + + if (read_size == 0) { + continue; + } + if (read_size < 0) { + if (errno == EAGAIN) { + continue; + } + errlog("Error: Read from tty failed - %m\n"); + return false; + } + + /* Send the read data to the pseudo terminal */ + if (write(pseudo_tty, read_buf, read_size) < 0) { + if (errno == EAGAIN) // Output buffer full - flush it. + { + tcflush(pseudo_tty, TCIOFLUSH); + continue; + } + + errlog("Error: Write to pseudo tty failed - %m\n"); + return false; + } + + /* Prepare log message and send to the server */ + if (!prepare_log_send(read_buf, sizeof(read_buf), fd_socket)) { + errlog("Error: Sending log failed - %m\n"); + return false; + } + } + /*if (FD_ISSET(fd_tty, &readset)) */ + if (kill_received) { + break; + } + + /* Check if there is an data in the pseudo terminal's buffer */ + if (FD_ISSET(pseudo_tty, &readset)) { + read_size = read(pseudo_tty, read_buf, sizeof(read_buf) - 1); + + if (read_size == 0) { + continue; + } + if (read_size < 0) { + if (errno == EAGAIN) { + continue; + } + errlog("Error: Read from pseudo tty failed - %m\n"); + return false; + } + + if (write(fd_tty, read_buf, read_size) < 0) { + if (errno == EAGAIN) // Output buffer full - flush it. + { + tcflush(fd_tty, TCIOFLUSH); + continue; + } + + errlog("Error: Write to tty failed - %m\n"); + return false; + } + } /*if (FD_ISSET(pseudo_tty,&readset)) */ + } /*while (!kill_received) */ + + return true; +} + +void cleanup() +{ + remove(pseudo_tty_save_file); + tcsetattr(fd_tty, TCSAFLUSH, &orig_tty_state); //Restore original settings + close(fd_tty); + close(fd_soc); + fclose(error_file); +} + +void sig_kill(int signum) +{ + kill_received = true; +} + +void register_kill() +{ + struct sigaction sigact; + sigset_t sigset; + + sigemptyset(&sigset); + memset(&sigact, 0, sizeof sigact); + sigact.sa_handler = sig_kill; + sigact.sa_mask = sigset; + + sigaction(SIGHUP, &sigact, NULL); + sigaction(SIGINT, &sigact, NULL); + sigaction(SIGQUIT, &sigact, NULL); + sigaction(SIGPIPE, &sigact, NULL); + sigaction(SIGTERM, &sigact, NULL); + sigaction(SIGKILL, &sigact, NULL); + sigaction(SIGABRT, &sigact, NULL); +} + +void usage(char *prog_name) +{ + printf("Usage:\n"); + printf("\t%s TTY ip_version(4 or 6) hostname port [baud rate (like 57600)]\n", prog_name); + printf("\t%s -h : For this help\n", prog_name); + printf("Example:\n\t./bmc-log /dev/ttyS1 4 netcons.any.facebook.com 1514\n"); + printf("\tOR\n\t./bmc-log /dev/ttyS1 6 netcons6.any.facebook.com 1514 57600\n"); +} + +bool parse_user_input(int nargs, char **args, char *read_tty, int read_tty_size, int *ip_version) +{ + if (nargs < 5) { + if ((nargs > 1) && ((strcmp(args[1], "-h") == 0) || (strcmp(args[1], "--help") == 0))) { + usage(args[0]); + return false; // Not an error but returning -1 for the main function to return + } + fprintf(stderr, "Error: Invalid number of arguments\n"); + usage(args[0]); + return false; + } + + if (strlen(args[1]) > read_tty_size) { + fprintf(stderr, "Error: TTY too long\n"); + usage(args[0]); + return false; + } + + /* TTT to read the logs from */ + strncpy(read_tty, args[1], read_tty_size); + + /* IP Version, IP Address and Port of the netcons server */ + *ip_version = atoi(args[2]); + if (*ip_version != IPV4 && *ip_version != IPV6) { + fprintf(stderr, "Error: Invalid IP Version input\n"); + usage(args[0]); + return false; + } + + hostname = args[3]; + port = atoi(args[4]); + + baud_rate = B57600; + if (nargs == 6) + baud_rate = atoi(args[5]); + + return true; +} + +int main(int argc, char **argv) +{ + char read_tty[TTY_LEN] = { 0 }; + int ip_version; + int socket_domain = AF_UNSPEC; + char cmd[COMMAND_LEN] = { 0 }; + + /* Open the error log file */ + error_file = fopen(error_log_file, "a+"); + if (!error_file) { + printf("Error: Unable to open log file - %m\n"); + return 1; + } + + /* Register actions upon interrupts */ + register_kill(); + + /* Parse the user input */ + if (!parse_user_input(argc, argv, read_tty, sizeof(read_tty), &ip_version)) { + return 2; + } + + snprintf(cmd, sizeof(cmd), "%s %s", uS_console, "connect"); + if (system(cmd) == -1) { + errlog("Error: Unable to connect to the micro-server\n"); + return 3; + } + + /* Create a socket to communicate with the netcons server */ + socket_domain = (ip_version == IPV4) ? AF_INET : AF_INET6; + fd_soc = socket(socket_domain, SOCK_DGRAM, 0); + if (fd_soc == -1) { + errlog("Error: Socket creation failed - %m\n"); + return 4; + } + + if (ip_version == IPV4) { /* IPv4 */ + struct sockaddr_in tgt_addr; + if (!prepare_sock(&tgt_addr)) { + close(fd_soc); + errlog("Error: Socket not valid\n"); + return 5; + } + + if (connect(fd_soc, (struct sockaddr *)&tgt_addr, sizeof(tgt_addr)) == -1) { + close(fd_soc); + errlog("Error: Socket connection failed - %m\n"); + return 6; + } + + } else { /* IPv6 */ + + struct sockaddr_in6 tgt_addr6; + if (!prepare_sock6(&tgt_addr6)) { + close(fd_soc); + errlog("Error: Socket not valid\n"); + return 5; + } + + if (connect(fd_soc, (struct sockaddr *)&tgt_addr6, sizeof(tgt_addr6)) == -1) { + close(fd_soc); + errlog("Error: Socket connection failed - %m\n"); + return 6; + } + } + + /* TTY Operations */ + if ((fd_tty = open(read_tty, O_RDWR | O_NOCTTY | O_NDELAY | O_NONBLOCK)) == -1) { + close(fd_soc); + errlog("Error: Serial Port %s open failed - %m\n", read_tty); + return 7; + } + + if (!set_tty(fd_tty)) { + errlog("Error: tty not set properly\n"); + cleanup(); + return 8; + } + + /* Read, prepare and send the logs */ + if (!read_send(fd_tty, fd_soc)) { + errlog("Error: Sending logs failed\n"); + cleanup(); + return 9; + } + + cleanup(); + return 0; +} diff --git a/meta-raptor/meta-asus/recipes-asus/bmc-log/files/bmc-log.h b/meta-raptor/meta-asus/recipes-asus/bmc-log/files/bmc-log.h new file mode 100644 index 0000000..5795e6a --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/bmc-log/files/bmc-log.h @@ -0,0 +1,46 @@ +/* + * Copyright 2014-present Facebook. All Rights Reserved. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef BMC_LOG_H_ +#define BMC_LOG_H_ + +/* IP Version */ +#define IPV4 (4) +#define IPV6 (6) + +/* Search string for the kernel version */ +#define KERNEL_SEARCH_STR "Linux version " + +/* Size constants */ +#define TIME_FORMAT_SIZE (100) +#define MAX_LOG_FILE_SIZE (1024*1024*5) //5MB +#define TTY_LEN (50) +#define LINE_LEN (257) +#define MSG_LEN (1025) +#define COMMAND_LEN (100) +#define KERNEL_VERSION_LEN (100) + +static char *uS_console = "/usr/local/fbpackages/utils/us_console.sh"; + +static char *error_log_file = "/var/log/bmc-log"; + +static char *pseudo_tty_save_file = "/etc/us_pseudo_tty"; + +static int kernel_search_len = sizeof(KERNEL_SEARCH_STR) - 1; + +#endif diff --git a/meta-raptor/meta-asus/recipes-asus/bmc-log/files/bmc-log.sh b/meta-raptor/meta-asus/recipes-asus/bmc-log/files/bmc-log.sh new file mode 100755 index 0000000..00bf63c --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/bmc-log/files/bmc-log.sh @@ -0,0 +1,77 @@ +#!/bin/sh +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +### BEGIN INIT INFO +# Provides: bmc-log +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Collect micro-server kernel logs through serial port +### END INIT INFO + +. /etc/default/bmc-log +. /etc/init.d/functions + +DAEMON=/usr/sbin/bmc-log +NAME=bmc-log +DESC="Micro-Server log collection" + +TTY=${US_TTY:-/dev/ttyS1} +IP=${LOG_SERVER_IP_VERSION:-4} +LOG_SERVER=${LOG_SERVER_NAME:-} +PORT=${LOG_SERVER_PORT:-} +BAUD_RATE=${TTY_BAUD_RATE:-} + +if [ -z "$LOG_SERVER" ] || [ -z "$PORT" ] +then + echo "Error: Server and/or port not set" + exit 0 +fi + + +ACTION="$1" + +case "$ACTION" in + start) + echo -e "Starting $DESC" + $DAEMON $TTY $IP $LOG_SERVER $PORT $BAUD_RATE + ;; + stop) + echo -e "Stopping $DESC: " + start-stop-daemon --stop --quiet --exec $DAEMON + ;; + restart|force-reload) + echo -e "Restarting $DESC: " + start-stop-daemon --stop --quiet --exec $DAEMON + sleep 1 + $DAEMON $TTY $IP $LOG_SERVER $PORT $BAUD_RATE + ;; + status) + stat $DAEMON + exit $? + ;; + *) + N=${0##*/} + N=${N#[SK]??} + echo "Usage: $N {start|stop|status|restart|force-reload}" >&2 + exit 1 + ;; +esac diff --git a/meta-raptor/meta-asus/recipes-asus/fblibs/files/alert_control/Makefile b/meta-raptor/meta-asus/recipes-asus/fblibs/files/alert_control/Makefile new file mode 100644 index 0000000..2f27a8c --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fblibs/files/alert_control/Makefile @@ -0,0 +1,27 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +lib: libalert_control.so + +libalert_control.so: alert_control.c + $(CC) $(CFLAGS) -fPIC -c -o alert_control.o alert_control.c + $(CC) -shared -o libalert_control.so alert_control.o -lc + +.PHONY: clean + +clean: + rm -rf *.o libalert_control.so diff --git a/meta-raptor/meta-asus/recipes-asus/fblibs/files/alert_control/alert_control.c b/meta-raptor/meta-asus/recipes-asus/fblibs/files/alert_control/alert_control.c new file mode 100644 index 0000000..81b0329 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fblibs/files/alert_control/alert_control.c @@ -0,0 +1,117 @@ +/* + * + * Copyright 2014-present Facebook. All Rights Reserved. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#include <syslog.h> +#include "alert_control.h" + +#define PATH_ALERT_STATUS "/sys/bus/i2c/drivers/panther_plus/4-0040/alert_status" +#define PATH_ALERT_CONTROL "/sys/bus/i2c/drivers/panther_plus/4-0040/alert_control" + +#define MASK_ALERT_SMS_KCS 0x01 + +/* + * Function to enable/disable alert signal generation for a given Function Block + */ +int +alert_control(e_fbid_t id, e_flag_t cflag) { + FILE *fp; + unsigned char rbuf[5] = {0}; + unsigned char tbuf[3] = {0}; + int count = 0; + + fp = fopen(PATH_ALERT_CONTROL, "r+"); + if (!fp) { + return -1; + } + + count = fread(rbuf, sizeof(unsigned char), sizeof(rbuf), fp); + if (count == 0x0) { + fclose(fp); + return -1; + } + + // Size of the request + tbuf[0] = 0x02; + + switch(id) { + case FBID_SMS_KCS: + if (cflag == FLAG_ENABLE) + tbuf[1] = rbuf[2] | (0x01 << FBID_SMS_KCS); + else + tbuf[1] = rbuf[2] & (~(0x01 << FBID_SMS_KCS)); + + tbuf[2] = rbuf[3]; + break; + // TODO: Add logic for other Function Blocks here + default: + tbuf[0] = rbuf[2]; + tbuf[1] = rbuf[3]; + break; + } + + count = fwrite(tbuf, sizeof(unsigned char), sizeof(tbuf), fp); + if (count != sizeof(tbuf)) { + fclose(fp); + return (-1); + } + + fclose(fp); + + return 0; +} + +/* + * Function to check if the alert for a given Function Block is asserted or not + */ +bool +is_alert_present(e_fbid_t id) { + FILE *fp; + unsigned char buf[5] = {0}; + int count = 0; + + fp = fopen(PATH_ALERT_STATUS, "r"); + + if (!fp) { + return false; + } + + count = fread(buf, sizeof(unsigned char), sizeof(buf), fp); + if (count == 0x0) { + fclose(fp); + sleep(2); + return false; + } + + fclose(fp); + + switch(id) { + case FBID_SMS_KCS: + if (buf[2] & (0x01 << FBID_SMS_KCS)) + return true; + else + return false; + //TODO: Add logic for other Function Blocks here + default: + return false; + } +} diff --git a/meta-raptor/meta-asus/recipes-asus/fblibs/files/alert_control/alert_control.h b/meta-raptor/meta-asus/recipes-asus/fblibs/files/alert_control/alert_control.h new file mode 100644 index 0000000..ca72591 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fblibs/files/alert_control/alert_control.h @@ -0,0 +1,64 @@ +/* + * + * Copyright 2014-present Facebook. All Rights Reserved. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __ALERT_CONTROL_H__ +#define __ALERT_CONTROL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdbool.h> + +typedef enum { + FLAG_DISABLE = 0x00, + FLAG_ENABLE, +} e_flag_t; + +typedef enum { + FBID_SMS_KCS = 0x00, + FBID_SMM_KCS, + FBID_COM1_DATA, + FBID_COM2_DATA, + FBID_COM1_STAT_CTRL, + FBID_COM2_STAT_CTRL, + FBID_POST, + FBID_I2C_PROXY1_MASTER, + FBID_I2C_PROXY1_STAT, + FBID_I2C_PROXY2_MASTER, + FBID_I2C_PROXY2_STAT, + FBID_GPIO_CONFIG, + FBID_GPIO_OUTPUT, + FBID_GPIO_INPUT, + FBID_GPIO_INTR, + FBID_GPIO_EVENT, + FBID_REG_READ, + FBID_ALERT_CTRL = 0xFD, + FBID_AERT_STAT = 0xFE, + FBID_DISCOVERY = 0xFF, +} e_fbid_t; + +int alert_control(e_fbid_t id, e_flag_t cflag); +bool is_alert_present(e_fbid_t id); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif /* __ALERT_CONTROL_H__ */ diff --git a/meta-raptor/meta-asus/recipes-asus/fblibs/files/ipmi/Makefile b/meta-raptor/meta-asus/recipes-asus/fblibs/files/ipmi/Makefile new file mode 100644 index 0000000..369819c --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fblibs/files/ipmi/Makefile @@ -0,0 +1,27 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +lib: libipmi.so + +libipmi.so: ipmi.c + $(CC) $(CFLAGS) -fPIC -c -o ipmi.o ipmi.c + $(CC) -shared -o libipmi.so ipmi.o -lc + +.PHONY: clean + +clean: + rm -rf *.o libipmi.so diff --git a/meta-raptor/meta-asus/recipes-asus/fblibs/files/ipmi/ipmi.c b/meta-raptor/meta-asus/recipes-asus/fblibs/files/ipmi/ipmi.c new file mode 100644 index 0000000..b5a3e19 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fblibs/files/ipmi/ipmi.c @@ -0,0 +1,81 @@ +/* + * + * Copyright 2014-present Facebook. All Rights Reserved. + * + * This file contains code to support IPMI2.0 Specificaton available @ + * http://www.intel.com/content/www/us/en/servers/ipmi/ipmi-specifications.html + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "ipmi.h" +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <string.h> +#include <syslog.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/un.h> + +#define SOCK_PATH "/tmp/ipmi_socket" +#define MAX_IPMI_RES_LEN 100 + +/* + * Function to handle IPMI messages + */ +void +ipmi_handle(unsigned char *request, unsigned char req_len, + unsigned char *response, unsigned char *res_len) { + + int s, t, len; + struct sockaddr_un remote; + + // TODO: Need to update to reuse the socket instead of creating new + if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { + syslog(LOG_ALERT, "ipmi_handle: socket() failed\n"); + return; + } + + remote.sun_family = AF_UNIX; + strcpy(remote.sun_path, SOCK_PATH); + len = strlen(remote.sun_path) + sizeof(remote.sun_family); + + if (connect(s, (struct sockaddr *)&remote, len) == -1) { + syslog(LOG_ALERT, "ipmi_handle: connect() failed\n"); + return; + } + + if (send(s, request, req_len, 0) == -1) { + syslog(LOG_ALERT, "ipmi_handle: send() failed\n"); + return; + } + + if ((t=recv(s, response, MAX_IPMI_RES_LEN, 0)) > 0) { + *res_len = t; + } else { + if (t < 0) { + syslog(LOG_ALERT, "ipmi_handle: recv() failed\n"); + } else { + printf("Server closed connection"); + } + + return; + } + + close(s); + + return; +} diff --git a/meta-raptor/meta-asus/recipes-asus/fblibs/files/ipmi/ipmi.h b/meta-raptor/meta-asus/recipes-asus/fblibs/files/ipmi/ipmi.h new file mode 100644 index 0000000..4c6ed62 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fblibs/files/ipmi/ipmi.h @@ -0,0 +1,35 @@ +/* + * + * Copyright 2014-present Facebook. All Rights Reserved. + * + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __IPMI_H__ +#define __IPMI_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void ipmi_handle(unsigned char *request, unsigned char req_len, + unsigned char *response, unsigned char *res_len); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif /* __IPMI_H__ */ diff --git a/meta-raptor/meta-asus/recipes-asus/fblibs/libalert-control_0.1.bb b/meta-raptor/meta-asus/recipes-asus/fblibs/libalert-control_0.1.bb new file mode 100644 index 0000000..ec02d04 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fblibs/libalert-control_0.1.bb @@ -0,0 +1,38 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +SUMMARY = "Wedge Alert Control Library" +DESCRIPTION = "library for Wedge Alert Control" +SECTION = "base" +PR = "r1" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://alert_control.c;beginline=5;endline=17;md5=da35978751a9d71b73679307c4d296ec" + +SRC_URI = "file://alert_control \ + " + +S = "${WORKDIR}/alert_control" + +do_install() { + install -d ${D}${libdir} + install -m 0644 libalert_control.so ${D}${libdir}/libalert_control.so + + install -d ${D}${includedir}/facebook + install -m 0644 alert_control.h ${D}${includedir}/facebook/alert_control.h +} + +FILES_${PN} = "${libdir}/libalert_control.so" +FILES_${PN}-dev = "${includedir}/facebook/alert_control.h" diff --git a/meta-raptor/meta-asus/recipes-asus/fblibs/libipmi_0.1.bb b/meta-raptor/meta-asus/recipes-asus/fblibs/libipmi_0.1.bb new file mode 100644 index 0000000..83292be --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fblibs/libipmi_0.1.bb @@ -0,0 +1,39 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +SUMMARY = "Wedge IPMI Client Library" +DESCRIPTION = "library for Wedge IPMI Client" +SECTION = "base" +PR = "r1" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://ipmi.c;beginline=8;endline=20;md5=da35978751a9d71b73679307c4d296ec" + + +SRC_URI = "file://ipmi \ + " + +S = "${WORKDIR}/ipmi" + +do_install() { + install -d ${D}${libdir} + install -m 0644 libipmi.so ${D}${libdir}/libipmi.so + + install -d ${D}${includedir}/facebook + install -m 0644 ipmi.h ${D}${includedir}/facebook/ipmi.h +} + +FILES_${PN} = "${libdir}/libipmi.so" +FILES_${PN}-dev = "${includedir}/facebook/ipmi.h" diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/COPYING b/meta-raptor/meta-asus/recipes-asus/fbutils/files/COPYING new file mode 100644 index 0000000..3912109 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/asus_power.sh b/meta-raptor/meta-asus/recipes-asus/fbutils/files/asus_power.sh new file mode 100644 index 0000000..4810ab2 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/asus_power.sh @@ -0,0 +1,165 @@ +#!/bin/bash +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +. /usr/local/bin/openbmc-utils.sh + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin + +prog="$0" + +usage() { + echo "Usage: $prog <command> [command options]" + echo + echo "Commands:" + echo " status: Get the current microserver power status" + echo + echo " on: Power on microserver if not powered on already" + echo " options:" + echo " -f: Re-do power on sequence no matter if microserver has " + echo " been powered on or not." + echo + echo " off: Power off microserver ungracefully" + echo + echo " reset: Power reset microserver ungracefully" + echo " options:" + echo " -s: Power reset whole wedge system ungracefully" + echo +} + +do_status() { + echo -n "Mainboard power is " + if asus_is_us_on; then + echo "on" + else + echo "off" + fi + return 0 +} + +do_on() { + local force opt pulse_us n retries + force=0 + while getopts "f" opt; do + case $opt in + f) + force=1 + ;; + *) + usage + exit -1 + ;; + + esac + done + echo -n "Power on mainboard ..." + if [ $force -eq 0 ]; then + # need to check if uS is on or not + if asus_is_us_on 10 "."; then + echo " Already on. Skip!" + return 1 + fi + fi + gpio_set CTL_REQ_POWERDOWN_N 1 + gpio_set CTL_REQ_RESET_N 0 + gpio_set CTL_REQ_POWERUP_N 0 + sleep 1 + gpio_set CTL_REQ_RESET_N 1 + gpio_set CTL_REQ_POWERUP_N 1 + + echo " Done" + return 0 +} + +do_off() { + echo -n "Power off mainboard ..." + gpio_set CTL_REQ_RESET_N 1 + gpio_set CTL_REQ_POWERUP_N 1 + gpio_set CTL_REQ_POWERDOWN_N 0 + sleep 1 + gpio_set CTL_REQ_POWERDOWN_N 1 + echo " Done" + return 0 +} + +do_reset() { + local system opt + system=0 + while getopts "s" opt; do + case $opt in + s) + system=1 + ;; + *) + usage + exit -1 + ;; + esac + done + if [ $system -eq 1 ]; then + echo -n "Power reset whole system ..." + do_off + sleep 1 + do_on + else + if ! asus_is_us_on; then + echo "Power resetting mainboard that is powered off has no effect." + echo "Use '$prog on' to power the microserver on" + return -1 + fi + echo -n "Power reset mainboard ..." + gpio_set CTL_REQ_POWERDOWN_N 1 + gpio_set CTL_REQ_RESET_N 0 + gpio_set CTL_REQ_POWERUP_N 1 + sleep 1 + gpio_set CTL_REQ_RESET_N 1 + fi + echo " Done" + return 0 +} + +if [ $# -lt 1 ]; then + usage + exit -1 +fi + +command="$1" +shift + +case "$command" in + status) + do_status $@ + ;; + on) + do_on $@ + ;; + off) + do_off $@ + ;; + reset) + do_reset $@ + ;; + *) + usage + exit -1 + ;; +esac + +exit $? diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/asus_us_mac.sh b/meta-raptor/meta-asus/recipes-asus/fbutils/files/asus_us_mac.sh new file mode 100644 index 0000000..b819b6a --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/asus_us_mac.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2015-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin + +. /usr/local/bin/openbmc-utils.sh + +mac=$(fw_printenv ethaddr) + +if [ -n "$mac" -a "${mac/X/}" = "${mac}" ]; then + echo $mac + exit 0 +else + echo "Cannot determine BMC MAC" 1>&2 + exit -1 +fi diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/board-utils.sh b/meta-raptor/meta-asus/recipes-asus/fbutils/files/board-utils.sh new file mode 100644 index 0000000..a43ad8b --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/board-utils.sh @@ -0,0 +1,45 @@ +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2015-present Facebook. All Rights Reserved. + +SLOT_ID=1 + +asus_is_us_on() { + val=$(gpio_get STA_LINE_POWER) + if [ "$val" == "1" ]; then + return 0 # powered on + else + return 1 + fi +} + +asus_board_type() { + echo 'ASUS ASMB4 Platform' +} + +asus_slot_id() { + printf "%d\n" $SLOT_ID +} + +asus_board_rev() { + echo 0 +} + +# Should we enable OOB interface or not +asus_should_enable_oob() { + # ASUS uses BMC MAC + return -1 +} + +asus_power_on_board() { + local val + val=$(asus_is_us_on) + if [[ "$val" == "1" ]]; then + # power on + gpio_set CTL_REQ_POWERDOWN_N 1 + gpio_set CTL_REQ_RESET_N 0 + gpio_set CTL_REQ_POWERUP_N 0 + sleep 1 + gpio_set CTL_REQ_RESET_N 1 + gpio_set CTL_REQ_POWERUP_N 1 + fi +} diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/eth0_mac_fixup.sh b/meta-raptor/meta-asus/recipes-asus/fbutils/files/eth0_mac_fixup.sh new file mode 100644 index 0000000..f244bd0 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/eth0_mac_fixup.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +### BEGIN INIT INFO +# Provides: eth0_mac_fixup.sh +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Fixup the MAC address for eth0 based on wedge EEPROM +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin + +# get the MAC from EEPROM +mac=$(weutil 2>/dev/null | grep '^Local MAC' 2>/dev/null | cut -d' ' -f3 2>/dev/null) + +# get the MAC from u-boot environment +ethaddr=$(fw_printenv ethaddr 2>/dev/null | cut -d'=' -f2 2>/dev/null) + +if [ -z "$mac" ] && [ -n "$ethaddr" ]; then + # no MAC from EEPROM, use the one from u-boot environment + mac="$ethaddr" +fi + +if [ -n "$mac" ]; then + ifconfig eth0 hw ether $mac +else + # no MAC from either EEPROM or u-boot environment + mac=$(ifconfig eth0 2>/dev/null |grep HWaddr 2>/dev/null |awk '{ print $5 }') + +fi + +if [ "$ethaddr" != "$mac" ]; then + # set the MAC from EEPROM or ifconfig back to u-boot environment so that u-boot + # can use it + fw_setenv "ethaddr" "$mac" +fi diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/mdio.py b/meta-raptor/meta-asus/recipes-asus/fbutils/files/mdio.py new file mode 100755 index 0000000..aa7d4bf --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/mdio.py @@ -0,0 +1,124 @@ +#!/usr/bin/python +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +from argparse import ArgumentParser +import subprocess +import time + +IO_BASE = [ 0x1e660000, 0x1e680000 ] +PHYCR_REG_OFFSET = 0x60 +PHYCR_READ_BIT = 0x1 << 26 +PHYCR_WRITE_BIT = 0x1 << 27 +phycr_reg = lambda mac: IO_BASE[mac - 1] + PHYCR_REG_OFFSET +PHYDATA_REG_OFFSET = 0x64 +phydata_reg = lambda mac: IO_BASE[mac - 1] + PHYDATA_REG_OFFSET + + +devmem_read_cmd = lambda reg: [ 'devmem', hex(reg) ] +devmem_write_cmd = lambda reg, val: [ 'devmem', hex(reg), '32', hex(val)] + + +def devmem_read(reg): + cmd = devmem_read_cmd(reg) + #print('Cmd: {}'.format(cmd)) + out = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] + return int(out, 0) + + +def devmem_write(reg, val): + cmd = devmem_write_cmd(reg, val) + #print('Cmd: {}'.format(cmd)) + subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] + + +def wait_for_mdio_done(args): + reg = phycr_reg(args.mac) + while devmem_read(reg) & (PHYCR_READ_BIT|PHYCR_WRITE_BIT): + time.sleep(0.010) # 10ms + + +def read_mdio(args): + reg = phycr_reg(args.mac) + ctrl = devmem_read(reg) + ctrl &= 0x3000003f + ctrl |= (args.phy & 0x1F) << 16 + ctrl |= (args.register & 0x1F) << 21 + ctrl |= PHYCR_READ_BIT + devmem_write(reg, ctrl) + wait_for_mdio_done(args) + val = devmem_read(phydata_reg(args.mac)) >> 16 + print('Read from PHY ({}.{}): {}' + .format(hex(args.phy), hex(args.register), hex(val))) + + +def write_mdio(args): + ctrl_reg = phycr_reg(args.mac) + ctrl = devmem_read(ctrl_reg) + ctrl &= 0x3000003f + ctrl |= (args.phy & 0x1F) << 16 + ctrl |= (args.register & 0x1F) << 21 + ctrl |= PHYCR_WRITE_BIT + data_reg = phydata_reg(args.mac) + # write data first + devmem_write(data_reg, args.value) + # then ctrl + devmem_write(ctrl_reg, ctrl) + wait_for_mdio_done(args) + print('Write to PHY ({}.{}): {}' + .format(hex(args.phy), hex(args.register), hex(args.value))) + + +def auto_int(x): + return int(x, 0) + +if __name__ == '__main__': + ap = ArgumentParser() + ap.add_argument('--mac', '-m', type=int, default=2, + help='The MAC') + ap.add_argument('--phy', '-p', type=auto_int, default=0x1f, + help='The PHY address') + + subparsers = ap.add_subparsers() + + read_parser = subparsers.add_parser('read', + help='read MDIO') + read_parser.set_defaults(func=read_mdio) + read_parser.add_argument('register', type=auto_int, + help='The register to read from') + + write_parser = subparsers.add_parser('write', + help='write MDIO') + write_parser.set_defaults(func=write_mdio) + write_parser.add_argument('register', type=auto_int, + help='The register to write to') + write_parser.add_argument('value', type=auto_int, + help='The value to write to') + + args = ap.parse_args() + + if args.mac != 2 and args.mac != 1: + print("MAC can only be either 1 or 2.") + exit(-1) + + if args.phy > 0x1f: + printf("PHY address must be smaller than 0x1f.") + exit(-2) + + args.func(args) diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/mount_data0.sh b/meta-raptor/meta-asus/recipes-asus/fbutils/files/mount_data0.sh new file mode 100755 index 0000000..6986be5 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/mount_data0.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +### BEGIN INIT INFO +# Provides: mount_data0 +# Required-Start: mountvirtfs +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Mount data0 partition from flash chip. +# Description: +### END INIT INFO + +. /etc/default/rcS + +# Find out which device maps to 'data0' on mtd +# Note: /proc/mtd lists partitions using mtdX, where X is a number, +# but we mount using /dev/mtdblockX. We'll do some magic here +# to get the mtdX (char device) and mtdblockX (block device) +# names. +MOUNT_POINT="/mnt/data" +DATA_CHAR_DEV=$(cat /proc/mtd | awk '{ if ($4 == "\"data0\"") print $1 }' | + cut -d ':' -f 1 | awk '{ print "/dev/" $1 }') +if [ -z "$DATA_CHAR_DEV" ] +then + echo "No data0 partition found. Not mounting anything to $MOUNT_POINT." +else + DEVICE_ID=$(echo $DATA_CHAR_DEV | tail -c 2) + DATA_BLOCK_DEV=${DATA_CHAR_DEV/mtd/mtdblock} + + echo "data0 partition found on $DATA_BLOCK_DEV; mounting to $MOUNT_POINT." + mount -t jffs2 $DATA_BLOCK_DEV $MOUNT_POINT + + # if the mount failed, format the partition and remount + if [ $? -ne 0 ] + then + echo "Mount failed; formatting $DATA_BLOCK_DEV and remounting." + flash_eraseall $DATA_CHAR_DEV + mount -t jffs2 $DATA_BLOCK_DEV $MOUNT_POINT + fi +fi + +: exit 0 + diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/post_led.sh b/meta-raptor/meta-asus/recipes-asus/fbutils/files/post_led.sh new file mode 100644 index 0000000..b653cb3 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/post_led.sh @@ -0,0 +1,105 @@ +#!/bin/sh +# +# Copyright 2004-present Facebook. All rights reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +usage() { + echo "Displays values onto the debug header LEDs." + echo "Hex and decimal accepted." + echo "Usage: $0 <value>" +} + +. /usr/local/bin/openbmc-utils.sh + +# Function to set the less significant hex digit +display_lower() { + local bit0=$(expr $1 % 2) + local bit1=$(expr $1 / 2 % 2) + local bit2=$(expr $1 / 4 % 2) + local bit3=$(expr $1 / 8 % 2) + + # Set the pins to the correct operating mode. + # The relevant pins are GPIOG[0...3]. + # For GPIO bank G, SCU84[0..3] must be 0. + devmem_clear_bit $(scu_addr 84) 0 + devmem_clear_bit $(scu_addr 84) 1 + devmem_clear_bit $(scu_addr 84) 2 + devmem_clear_bit $(scu_addr 84) 3 + + # Now set the GPIOs to the right binary values + gpio_set 48 $bit0 + gpio_set 49 $bit1 + gpio_set 50 $bit2 + gpio_set 51 $bit3 +} + +# Function to set the more significant hex digit +display_upper() { + local bit0=$(expr $1 % 2) + local bit1=$(expr $1 / 2 % 2) + local bit2=$(expr $1 / 4 % 2) + local bit3=$(expr $1 / 8 % 2) + + # Set the pins to the correct operating mode. + # The relevant pins are GPIOB[4...7]. + # GPIOB4: SCU80[12] = 0 and Strap[14] = 0 + # GPIOB5: SCU80[13] = 0 + # GPIOB6: SCU80[14] = 0 + # GPIOB7: SCU80[15] = 0 + devmem_clear_bit $(scu_addr 70) 14 + devmem_clear_bit $(scu_addr 80) 12 + devmem_clear_bit $(scu_addr 80) 13 + devmem_clear_bit $(scu_addr 80) 14 + devmem_clear_bit $(scu_addr 80) 15 + + gpio_set 12 $bit0 + gpio_set 13 $bit1 + gpio_set 14 $bit2 + gpio_set 15 $bit3 +} + +# Check number of parameters +if [ $# -ne 1 ] +then + usage + exit 1 +fi + +# Make sure input is actually numeric +DEC_VALUE=$(printf "%d" $1 2>/dev/null) +if [ $? -eq 1 ] +then + echo "Unable to parse input as numeric value." + exit 1 +fi + +# Make sure input is within proper range +if [ $DEC_VALUE -lt 0 ] || [ $DEC_VALUE -gt 255 ] +then + echo "Value $DEC_VALUE is outside of displayable range 0 - 0xff (255)." + exit 1 +fi + +# Get upper/lower decimal values +LOWER_DEC_VALUE=$(expr $DEC_VALUE % 16) +UPPER_DEC_VALUE=$(expr $DEC_VALUE / 16) + +# Display the results +display_lower $LOWER_DEC_VALUE +display_upper $UPPER_DEC_VALUE + diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/power-on.sh b/meta-raptor/meta-asus/recipes-asus/fbutils/files/power-on.sh new file mode 100644 index 0000000..c6a3c10 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/power-on.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +### BEGIN INIT INFO +# Provides: power-on +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Power on mainboard +### END INIT INFO +. /usr/local/bin/openbmc-utils.sh + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin + +echo -n "Checking mainboard power status ... " +if asus_is_us_on 10 "."; then + echo "on" + on=1 +else + echo "off" + on=0 +fi + +if [ $on -eq 0 ]; then + # Power on now + asus_power.sh on -f +fi diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/power_led.sh b/meta-raptor/meta-asus/recipes-asus/fbutils/files/power_led.sh new file mode 100755 index 0000000..066646e --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/power_led.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +usage() { + echo "Usage: $1 <on | off>" + exit -1 +} + +. /usr/local/bin/openbmc-utils.sh + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +set -e + +if [ $# != 1 ]; then + usage $0 +fi + +if [ $1 = "on" ]; then + val=1 +elif [ $1 = "off" ]; then + val=0 +else + usage $0 +fi + +# To use GPIOE5 (37), SCU80[21], SCU8C[14], and SCU70[22] must be 0 +devmem_clear_bit $(scu_addr 80) 21 +devmem_clear_bit $(scu_addr 8C) 14 +devmem_clear_bit $(scu_addr 70) 22 + +gpio_set 37 $val diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/rc.early b/meta-raptor/meta-asus/recipes-asus/fbutils/files/rc.early new file mode 100644 index 0000000..0f47c72 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/rc.early @@ -0,0 +1,25 @@ +#!/bin/sh +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# This script will be executed at rcS S04 level, which is right after mount /mnt/data +# and before almost anything else. + +if [ -x /mnt/data/etc/rc.early ]; then + /mnt/data/etc/rc.early +fi diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/rc.local b/meta-raptor/meta-asus/recipes-asus/fbutils/files/rc.local new file mode 100644 index 0000000..36fa0f1 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/rc.local @@ -0,0 +1,26 @@ +#!/bin/sh +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +# +# This script will be executed *after* all the other init scripts. + +if [ -x /mnt/data/etc/rc.local ]; then + /mnt/data/etc/rc.local +fi diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/setup-gpio.sh b/meta-raptor/meta-asus/recipes-asus/fbutils/files/setup-gpio.sh new file mode 100755 index 0000000..49f8e58 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/setup-gpio.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +### BEGIN INIT INFO +# Provides: gpio-setup +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Set up GPIO pins as appropriate +### END INIT INFO + +# This file contains definitions for the GPIO pins that were not otherwise +# defined in other files. We should probably move some more of the +# definitions to this file at some point. + +# The commented-out sections are generally already defined elsewhere, +# and defining them twice generates errors. + +. /usr/local/bin/openbmc-utils.sh + +# echo 4 > /sys/class/gpio/export +# echo 9 > /sys/class/gpio/export +# echo 14 > /sys/class/gpio/export +# echo 33 > /sys/class/gpio/export +# echo 34 > /sys/class/gpio/export +# echo 35 > /sys/class/gpio/export +# echo 40 > /sys/class/gpio/export +# echo 42 > /sys/class/gpio/export +# echo 44 > /sys/class/gpio/export +# echo 45 > /sys/class/gpio/export +# echo 48 > /sys/class/gpio/export +# echo 49 > /sys/class/gpio/export +# echo 58 > /sys/class/gpio/export +echo "out" > /sys/class/gpio/gpio4/direction +echo "out" > /sys/class/gpio/gpio9/direction +echo "out" > /sys/class/gpio/gpio14/direction +echo "out" > /sys/class/gpio/gpio33/direction +echo "out" > /sys/class/gpio/gpio34/direction +echo "out" > /sys/class/gpio/gpio35/direction +echo "out" > /sys/class/gpio/gpio40/direction +echo "out" > /sys/class/gpio/gpio44/direction +echo "out" > /sys/class/gpio/gpio45/direction +echo "out" > /sys/class/gpio/gpio48/direction +echo "in" > /sys/class/gpio/gpio49/direction +echo "in" > /sys/class/gpio/gpio58/direction + +# Once we set "out", output values will be random unless we set them +# to something + +echo "1" > /sys/class/gpio/gpio4/value +echo "1" > /sys/class/gpio/gpio9/value +echo "1" > /sys/class/gpio/gpio14/value +echo "1" > /sys/class/gpio/gpio33/value +echo "1" > /sys/class/gpio/gpio34/value +echo "1" > /sys/class/gpio/gpio35/value +echo "1" > /sys/class/gpio/gpio40/value +echo "1" > /sys/class/gpio/gpio44/value +echo "1" > /sys/class/gpio/gpio45/value +echo "1" > /sys/class/gpio/gpio48/value diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/setup_switch.py b/meta-raptor/meta-asus/recipes-asus/fbutils/files/setup_switch.py new file mode 100644 index 0000000..995cec8 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/setup_switch.py @@ -0,0 +1,49 @@ +#!/usr/bin/python +# +# Copyright 2004-present Facebook. All rights reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# This script combines multiple switch configuration into one python script. +# All such configuration can be done directly through bcm5396_util.py. +# But, it turns out it took several seconds to just start the python script. +# Involking the script 16 times (2 to create vlan, 13 to set port vlan default, +# and 1 to enable vlan function) contributes 1 minute delay. + +from bcm5396 import Bcm5396 + +MDC_GPIO = 6 +MDIO_GPIO = 7 + +INTERNAL_VLAN = 4088 +DEFAULT_VLAN=4090 + +INTERNAL_PORTS = [3, 10, 1, 11, 0, 8, 2, 9, 4, 12, 14, 13] +FRONT_PORT=5 + +if __name__ == '__main__': + bcm = Bcm5396(Bcm5396.MDIO_ACCESS, mdc=MDC_GPIO, mdio=MDIO_GPIO) + # create default VLAN including internal ports and front panel + # port (un-tagged) + bcm.add_vlan(DEFAULT_VLAN, INTERNAL_PORTS + [FRONT_PORT], + INTERNAL_PORTS + [FRONT_PORT], 0) + # set ingress vlan for internal ports and front panel port to default vlan + for port in INTERNAL_PORTS + [FRONT_PORT]: + bcm.vlan_set_port_default(port, DEFAULT_VLAN, 0) + # create internal vlan including internal ports only (tagged) + bcm.add_vlan(INTERNAL_VLAN, [], INTERNAL_PORTS, 0) + # enable vlan + bcm.vlan_ctrl(True) diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/sol.sh b/meta-raptor/meta-asus/recipes-asus/fbutils/files/sol.sh new file mode 100755 index 0000000..2998c81 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/sol.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +CONSOLE_SH=/usr/local/bin/us_console.sh +FILE=/etc/us_pseudo_tty +TTY=/dev/ttyS1 + +if [ -a $FILE ] + then + read -r TTY<$FILE +fi + +$CONSOLE_SH connect + +echo "You are in SOL session." +echo "Use ctrl-x to quit." +echo "-----------------------" +echo + +trap '"$CONSOLE_SH" disconnect' INT TERM QUIT EXIT + +/usr/bin/microcom -s 57600 $TTY + +echo +echo +echo "-----------------------" +echo "Exit from SOL session." diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/src/include/i2c-dev.h b/meta-raptor/meta-asus/recipes-asus/fbutils/files/src/include/i2c-dev.h new file mode 100644 index 0000000..eefb6e4 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/src/include/i2c-dev.h @@ -0,0 +1,362 @@ +/* + i2c-dev.h - i2c-bus driver, char device interface + + Copyright (C) 1995-97 Simon G. Vogl + Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl> + + 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., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +#ifndef _LINUX_I2C_DEV_H +#define _LINUX_I2C_DEV_H + +#include <linux/types.h> +#include <sys/ioctl.h> +#include <stddef.h> +#include <string.h> + + +/* -- i2c.h -- */ + +#define _I2C_MIN(a, b) (((a) <= (b)) ? (a) : (b)) + +/* + * I2C Message - used for pure i2c transaction, also from /dev interface + */ +struct i2c_msg { + __u16 addr; /* slave address */ + unsigned short flags; +#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ +#define I2C_M_TEN 0x0010 /* this is a ten bit chip address */ +#define I2C_M_RD 0x0001 /* read data, from slave to master */ +#define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_PROTOCOL_MANGLING */ +#define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */ +#define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */ +#define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */ +#define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */ + short len; /* msg length */ + char *buf; /* pointer to msg data */ +}; + +/* To determine what functionality is present */ + +#define I2C_FUNC_I2C 0x00000001 +#define I2C_FUNC_10BIT_ADDR 0x00000002 +#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */ +#define I2C_FUNC_SMBUS_PEC 0x00000008 +#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ +#define I2C_FUNC_SMBUS_QUICK 0x00010000 +#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 +#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000 +#define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000 +#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000 +#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000 +#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000 +#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 +#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 +#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 +#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ +#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ + +#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ + I2C_FUNC_SMBUS_WRITE_BYTE) +#define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \ + I2C_FUNC_SMBUS_WRITE_BYTE_DATA) +#define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \ + I2C_FUNC_SMBUS_WRITE_WORD_DATA) +#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ + I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) +#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) + +/* Old name, for compatibility */ +#define I2C_FUNC_SMBUS_HWPEC_CALC I2C_FUNC_SMBUS_PEC + +/* + * Data for SMBus Messages + */ +#define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ +#define I2C_SMBUS_I2C_BLOCK_MAX 32 /* Not specified but we use same structure */ +union i2c_smbus_data { + __u8 byte; + __u16 word; + __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */ + /* and one more for PEC */ +}; + +#define I2C_SMBUS_BLOCK_LARGE_MAX 240 +union i2c_smbus_large_data { + union i2c_smbus_data data; + __u8 block[I2C_SMBUS_BLOCK_LARGE_MAX + 2]; /* block[0] is used for length */ + /* and one more for PEC */ +}; + +/* smbus_access read or write markers */ +#define I2C_SMBUS_READ 1 +#define I2C_SMBUS_WRITE 0 + +/* SMBus transaction types (size parameter in the above functions) + Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */ +#define I2C_SMBUS_QUICK 0 +#define I2C_SMBUS_BYTE 1 +#define I2C_SMBUS_BYTE_DATA 2 +#define I2C_SMBUS_WORD_DATA 3 +#define I2C_SMBUS_PROC_CALL 4 +#define I2C_SMBUS_BLOCK_DATA 5 +#define I2C_SMBUS_I2C_BLOCK_BROKEN 6 +#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ +#define I2C_SMBUS_I2C_BLOCK_DATA 8 +#define I2C_SMBUS_BLOCK_LARGE_DATA 9 + + +/* /dev/i2c-X ioctl commands. The ioctl's parameter is always an + * unsigned long, except for: + * - I2C_FUNCS, takes pointer to an unsigned long + * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data + * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data + */ +#define I2C_RETRIES 0x0701 /* number of times a device address should + be polled when not acknowledging */ +#define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */ + +/* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses + * are NOT supported! (due to code brokenness) + */ +#define I2C_SLAVE 0x0703 /* Use this slave address */ +#define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it + is already in use by a driver! */ +#define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */ + +#define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */ + +#define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */ + +#define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */ +#define I2C_SMBUS 0x0720 /* SMBus transfer */ + + +/* This is the structure as used in the I2C_SMBUS ioctl call */ +struct i2c_smbus_ioctl_data { + __u8 read_write; + __u8 command; + __u32 size; + union i2c_smbus_data *data; +}; + +/* This is the structure as used in the I2C_RDWR ioctl call */ +struct i2c_rdwr_ioctl_data { + struct i2c_msg *msgs; /* pointers to i2c_msgs */ + __u32 nmsgs; /* number of i2c_msgs */ +}; + +#define I2C_RDRW_IOCTL_MAX_MSGS 42 + + +static inline __s32 i2c_smbus_access(int file, char read_write, __u8 command, + int size, union i2c_smbus_data *data) +{ + struct i2c_smbus_ioctl_data args; + + args.read_write = read_write; + args.command = command; + args.size = size; + args.data = data; + return ioctl(file,I2C_SMBUS,&args); +} + + +static inline __s32 i2c_smbus_write_quick(int file, __u8 value) +{ + return i2c_smbus_access(file,value,0,I2C_SMBUS_QUICK,NULL); +} + +static inline __s32 i2c_smbus_read_byte(int file) +{ + union i2c_smbus_data data; + if (i2c_smbus_access(file,I2C_SMBUS_READ,0,I2C_SMBUS_BYTE,&data)) + return -1; + else + return 0x0FF & data.byte; +} + +static inline __s32 i2c_smbus_write_byte(int file, __u8 value) +{ + return i2c_smbus_access(file,I2C_SMBUS_WRITE,value, + I2C_SMBUS_BYTE,NULL); +} + +static inline __s32 i2c_smbus_read_byte_data(int file, __u8 command) +{ + union i2c_smbus_data data; + if (i2c_smbus_access(file,I2C_SMBUS_READ,command, + I2C_SMBUS_BYTE_DATA,&data)) + return -1; + else + return 0x0FF & data.byte; +} + +static inline __s32 i2c_smbus_write_byte_data(int file, __u8 command, + __u8 value) +{ + union i2c_smbus_data data; + data.byte = value; + return i2c_smbus_access(file,I2C_SMBUS_WRITE,command, + I2C_SMBUS_BYTE_DATA, &data); +} + +static inline __s32 i2c_smbus_read_word_data(int file, __u8 command) +{ + union i2c_smbus_data data; + if (i2c_smbus_access(file,I2C_SMBUS_READ,command, + I2C_SMBUS_WORD_DATA,&data)) + return -1; + else + return 0x0FFFF & data.word; +} + +static inline __s32 i2c_smbus_write_word_data(int file, __u8 command, + __u16 value) +{ + union i2c_smbus_data data; + data.word = value; + return i2c_smbus_access(file,I2C_SMBUS_WRITE,command, + I2C_SMBUS_WORD_DATA, &data); +} + +static inline __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value) +{ + union i2c_smbus_data data; + data.word = value; + if (i2c_smbus_access(file,I2C_SMBUS_WRITE,command, + I2C_SMBUS_PROC_CALL,&data)) + return -1; + else + return 0x0FFFF & data.word; +} + + +/* Returns the number of read bytes */ +static inline __s32 i2c_smbus_read_block_data(int file, __u8 command, + __u8 *values) +{ + union i2c_smbus_data data; + if (i2c_smbus_access(file,I2C_SMBUS_READ,command, + I2C_SMBUS_BLOCK_DATA,&data)) + return -1; + else { + memcpy(values, &data.block[1], _I2C_MIN(data.block[0], I2C_SMBUS_BLOCK_MAX)); + return data.block[0]; + } +} + +static inline __s32 i2c_smbus_write_block_data(int file, __u8 command, + __u8 length, const __u8 *values) +{ + union i2c_smbus_data data; + if (length > 32) + length = 32; + memcpy(&data.block[1], values, length); + data.block[0] = length; + return i2c_smbus_access(file,I2C_SMBUS_WRITE,command, + I2C_SMBUS_BLOCK_DATA, &data); +} + +static inline __s32 i2c_smbus_read_block_large_data(int file, __u8 command, + __u8 *values) +{ + union i2c_smbus_large_data data; + if (i2c_smbus_access(file, I2C_SMBUS_READ, command, + I2C_SMBUS_BLOCK_LARGE_DATA, + (union i2c_smbus_data *)&data)) { + return -1; + } else { + /* the first byte is the length which is not copied */ + memcpy(values, &data.block[1], _I2C_MIN(data.block[0], I2C_SMBUS_BLOCK_LARGE_MAX)); + return data.block[0]; + } +} + +static inline __s32 i2c_smbus_write_block_large_data(int file, __u8 command, + __u8 length, + const __u8 *values) +{ + union i2c_smbus_large_data data; + if (length > I2C_SMBUS_BLOCK_LARGE_MAX) { + length = I2C_SMBUS_BLOCK_LARGE_MAX; + } + data.block[0] = length; + memcpy(&data.block[1], values, length); + return i2c_smbus_access(file, I2C_SMBUS_WRITE, command, + I2C_SMBUS_BLOCK_LARGE_DATA, + (union i2c_smbus_data *)&data); +} + +/* Returns the number of read bytes */ +/* Until kernel 2.6.22, the length is hardcoded to 32 bytes. If you + ask for less than 32 bytes, your code will only work with kernels + 2.6.23 and later. */ +static inline __s32 i2c_smbus_read_i2c_block_data(int file, __u8 command, + __u8 length, __u8 *values) +{ + union i2c_smbus_data data; + + if (length > 32) + length = 32; + data.block[0] = length; + if (i2c_smbus_access(file,I2C_SMBUS_READ,command, + length == 32 ? I2C_SMBUS_I2C_BLOCK_BROKEN : + I2C_SMBUS_I2C_BLOCK_DATA,&data)) + return -1; + else { + memcpy(values, &data.block[1], _I2C_MIN(data.block[0], I2C_SMBUS_BLOCK_MAX)); + return data.block[0]; + } +} + +static inline __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command, + __u8 length, + const __u8 *values) +{ + union i2c_smbus_data data; + if (length > 32) + length = 32; + memcpy(&data.block[1], values, length); + data.block[0] = length; + return i2c_smbus_access(file,I2C_SMBUS_WRITE,command, + I2C_SMBUS_I2C_BLOCK_BROKEN, &data); +} + +/* Returns the number of read bytes */ +static inline __s32 i2c_smbus_block_process_call(int file, __u8 command, + __u8 length, __u8 *values) +{ + union i2c_smbus_data data; + if (length > 32) + length = 32; + memcpy(&data.block[1], values, length); + data.block[0] = length; + if (i2c_smbus_access(file,I2C_SMBUS_WRITE,command, + I2C_SMBUS_BLOCK_PROC_CALL,&data)) + return -1; + else { + memcpy(values, &data.block[1], _I2C_MIN(data.block[0], I2C_SMBUS_BLOCK_MAX)); + return data.block[0]; + } +} + +#undef _I2C_MIN + +#endif /* _LINUX_I2C_DEV_H */ diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/start_us_monitor.sh b/meta-raptor/meta-asus/recipes-asus/fbutils/files/start_us_monitor.sh new file mode 100644 index 0000000..773afad --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/start_us_monitor.sh @@ -0,0 +1,74 @@ +#! /bin/sh +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +### BEGIN INIT INFO +# Provides: us-monitor +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Start the mainboard reset monitoring script +# +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +NAME="us_monitor" +DESC="monitoring mainboard reset" +DAEMON="us_monitor.sh" + +# source function library +. /etc/init.d/functions + +. /usr/local/bin/openbmc-utils.sh + +STOPPER= +ACTION="$1" + +case "$ACTION" in + start) + echo -n "Starting $DESC: " + /usr/local/bin/${DAEMON} > /dev/null 2>&1 & + echo "$NAME." + ;; + stop) + echo -n "Stopping $DESC: " + killall ${DAEMON} + echo "$NAME." + ;; + restart|force-reload) + echo -n "Restarting $DESC: " + killall ${DAEMON} + /usr/local/bin/${DAEMON} > /dev/null 2>&1 & + echo "$NAME." + ;; + status) + status ${DAEMON} + exit $? + ;; + *) + N=${0##*/} + N=${N#[SK]??} + echo "Usage: $N {start|stop|status|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/us_console.sh b/meta-raptor/meta-asus/recipes-asus/fbutils/files/us_console.sh new file mode 100755 index 0000000..75bbcea --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/us_console.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +usage() { + echo "$0 <connect | disconnect>" +} + +. /usr/local/bin/openbmc-utils.sh + +if [ $# -ne 1 ]; then + usage + exit 1 +fi + +if [ "$1" == "connect" ]; then + VALUE=1 +elif [ "$1" == "disconnect" ]; then + VALUE=0 +else + usage + exit 1 +fi + +# GPIOE0 (32) controls if uS console connects to UART1 or not. +# To enable GPIOE0, SCU80[16], SCU8C[12], and SCU70[22] must be 0 +devmem_clear_bit $(scu_addr 80) 16 +devmem_clear_bit $(scu_addr 8C) 12 +devmem_clear_bit $(scu_addr 70) 22 + +gpio_set 32 $VALUE diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/files/us_monitor.sh b/meta-raptor/meta-asus/recipes-asus/fbutils/files/us_monitor.sh new file mode 100644 index 0000000..bb47539 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/files/us_monitor.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Copyright 2017 Raptor Engineering, LLC +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +. /usr/local/bin/openbmc-utils.sh + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin + +# Blink the BMC status LED +while true; do + gpio_set LED_STA_BMC_N 0 + usleep 50000 # 50ms + gpio_set LED_STA_BMC_N 1 + usleep 100000 # 100ms + gpio_set LED_STA_BMC_N 0 + usleep 50000 # 50ms + gpio_set LED_STA_BMC_N 1 + usleep 700000 # 800ms +done diff --git a/meta-raptor/meta-asus/recipes-asus/fbutils/openbmc-utils_%.bbappend b/meta-raptor/meta-asus/recipes-asus/fbutils/openbmc-utils_%.bbappend new file mode 100644 index 0000000..ed49a3b --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/fbutils/openbmc-utils_%.bbappend @@ -0,0 +1,51 @@ +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += "file://board-utils.sh \ + file://us_console.sh \ + file://sol.sh \ + file://power_led.sh \ + file://post_led.sh \ + file://setup-gpio.sh \ + file://mdio.py \ + file://mount_data0.sh \ + file://asus_power.sh \ + file://power-on.sh \ + file://asus_us_mac.sh \ + file://rc.early \ + file://rc.local \ + file://src \ + file://start_us_monitor.sh \ + file://us_monitor.sh \ + file://eth0_mac_fixup.sh \ + " + +OPENBMC_UTILS_FILES += " \ + board-utils.sh us_console.sh sol.sh power_led.sh post_led.sh \ + mdio.py asus_power.sh asus_us_mac.sh us_monitor.sh \ + " + +DEPENDS_append = " update-rc.d-native" + +do_install_append() { + do_install_board +} + +FILES_${PN} += "${sysconfdir}" diff --git a/meta-raptor/meta-asus/recipes-asus/ipmid/files/Makefile b/meta-raptor/meta-asus/recipes-asus/ipmid/files/Makefile new file mode 100644 index 0000000..c65c3c5 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/ipmid/files/Makefile @@ -0,0 +1,29 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +all: ipmid + +ipmid: ipmid.c \ + platform/timestamp.c platform/sel.c platform/sdr.c \ + platform/wedge/sensor.c \ + platform/wedge/fruid.c + $(CC) -pthread -std=c99 -o $@ $^ $(LDFLAGS) + +.PHONY: clean + +clean: + rm -rf *.o platform/*.o platform/wedge/*.o ipmid diff --git a/meta-raptor/meta-asus/recipes-asus/ipmid/files/ipmid.c b/meta-raptor/meta-asus/recipes-asus/ipmid/files/ipmid.c new file mode 100644 index 0000000..ed2b75f --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/ipmid/files/ipmid.c @@ -0,0 +1,1490 @@ +/* + * + * Copyright 2014-present Facebook. All Rights Reserved. + * + * This file contains code to support IPMI2.0 Specificaton available @ + * http://www.intel.com/content/www/us/en/servers/ipmi/ipmi-specifications.html + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "platform/sdr.h" +#include "platform/sel.h" +#include "platform/fruid.h" +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#include <syslog.h> +#include <string.h> +#include <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/un.h> + +#define SOCK_PATH "/tmp/ipmi_socket" + +#define MAX_NUM_DIMMS 4 +#define IPMI_SEL_VERSION 0x51 +#define IPMI_SDR_VERSION 0x51 + +#define SIZE_AUTH_ENABLES 5 +#define SIZE_IP_ADDR 4 +#define SIZE_MAC_ADDR 6 +#define SIZE_NET_MASK 4 +#define SIZE_IP_HDR 3 +#define SIZE_RMCP_PORT 2 +#define SIZE_COMMUNITY_STR 18 +#define SIZE_DEST_TYPE 4 +#define SIZE_DEST_ADDR 18 +#define SIZE_TIME_STAMP 4 + +#define SIZE_PROC_FREQ 2 +#define SIZE_DIMM_SPEED 2 +#define SIZE_DIMM_SIZE 2 + +#define SIZE_SYSFW_VER 17 +#define SIZE_SYS_NAME 17 +#define SIZE_OS_NAME 17 +#define SIZE_OS_VER 17 +#define SIZE_BMC_URL 17 +#define SIZE_OS_HV_URL 17 + +#define SIZE_SEL_REC 16 +#define SIZE_IPMI_RES_HDR 3 + +#define MAX_IPMI_MSG_SIZE 100 + +// IPMI request Structure (IPMI/Section 9.2) +typedef struct +{ + unsigned char netfn_lun; + unsigned char cmd; + unsigned char data[]; +} ipmi_req_t; + +// IPMI response Structure (IPMI/Section 9.3) +typedef struct +{ + unsigned char netfn_lun; + unsigned char cmd; + unsigned char cc; + unsigned char data[]; +} ipmi_res_t; + +// LAN Configuration Structure (IPMI/Table 23.4) +typedef struct +{ + unsigned char set_in_prog; + unsigned char auth_support; + unsigned char auth_enables[SIZE_AUTH_ENABLES]; + unsigned char ip_addr[SIZE_IP_ADDR]; + unsigned char ip_src; + unsigned char mac_addr[SIZE_MAC_ADDR]; + unsigned char net_mask[SIZE_NET_MASK]; + unsigned char ip_hdr[SIZE_IP_HDR]; + unsigned char pri_rmcp_port[SIZE_RMCP_PORT]; + unsigned char sec_rmcp_port[SIZE_RMCP_PORT]; + unsigned char arp_ctrl; + unsigned char garp_interval; + unsigned char df_gw_ip_addr[SIZE_IP_ADDR]; + unsigned char df_gw_mac_addr[SIZE_MAC_ADDR]; + unsigned char back_gw_ip_addr[SIZE_IP_ADDR]; + unsigned char back_gw_mac_addr[SIZE_MAC_ADDR]; + unsigned char community_str[SIZE_COMMUNITY_STR]; + unsigned char no_of_dest; + unsigned char dest_type[SIZE_DEST_TYPE]; + unsigned char dest_addr[SIZE_DEST_ADDR]; +} lan_config_t; + +// Structure to store Processor Information +typedef struct +{ + unsigned char type; + unsigned char freq[SIZE_PROC_FREQ]; +} proc_info_t; + +// Structure to store DIMM Information +typedef struct +{ + unsigned char type; + unsigned char speed[SIZE_DIMM_SPEED]; + unsigned char size[SIZE_DIMM_SIZE]; +} dimm_info_t; + +// Structure for System Info Params (IPMI/Section 22.14a) +typedef struct +{ + unsigned char set_in_prog; + unsigned char sysfw_ver[SIZE_SYSFW_VER]; + unsigned char sys_name[SIZE_SYS_NAME]; + unsigned char pri_os_name[SIZE_OS_NAME]; + unsigned char present_os_name[SIZE_OS_NAME]; + unsigned char present_os_ver[SIZE_OS_VER]; + unsigned char bmc_url[SIZE_BMC_URL]; + unsigned char os_hv_url[SIZE_OS_HV_URL]; +} sys_info_param_t; + +// Network Function Codes (IPMI/Section 5.1) +enum +{ + NETFN_CHASSIS_REQ = 0x00, + NETFN_CHASSIS_RES, + NETFN_BRIDGE_REQ, + NETFN_BRIDGE_RES, + NETFN_SENSOR_REQ, + NETFN_SENSOR_RES, + NETFN_APP_REQ, + NETFN_APP_RES, + NETFN_FIRMWARE_REQ, + NETFN_FIRMWARE_RES, + NETFN_STORAGE_REQ, + NETFN_STORAGE_RES, + NETFN_TRANSPORT_REQ, + NETFN_TRANSPORT_RES, + NETFN_OEM_REQ = 0x30, + NETFN_OEM_RES = 0x31, +}; + +// Chassis Command Codes (IPMI/Table H-1) +enum +{ + CMD_CHASSIS_GET_STATUS = 0x01, + CMD_CHASSIS_GET_BOOT_OPTIONS = 0x09, +}; + +// Application Command Codes (IPMI/Table H-1) +enum +{ + CMD_APP_GET_DEVICE_ID = 0x01, + CMD_APP_GET_SELFTEST_RESULTS = 0x04, + CMD_APP_GET_DEVICE_GUID = 0x08, + CMD_APP_RESET_WDT = 0x22, + CMD_APP_SET_WDT = 0x24, + CMD_APP_GET_WDT = 0x25, + CMD_APP_GET_GLOBAL_ENABLES = 0x2F, + CMD_APP_GET_SYSTEM_GUID = 0x37, + CMD_APP_SET_SYS_INFO_PARAMS = 0x58, + CMD_APP_GET_SYS_INFO_PARAMS = 0x59, +}; + +// Storage Command Codes (IPMI/Table H-1) +enum +{ + CMD_STORAGE_GET_FRUID_INFO = 0x10, + CMD_STORAGE_READ_FRUID_DATA = 0x11, + CMD_STORAGE_GET_SDR_INFO = 0x20, + CMD_STORAGE_RSV_SDR = 0x22, + CMD_STORAGE_GET_SDR = 0x23, + CMD_STORAGE_GET_SEL_INFO = 0x40, + CMD_STORAGE_RSV_SEL = 0x42, + CMD_STORAGE_GET_SEL = 0x43, + CMD_STORAGE_ADD_SEL = 0x44, + CMD_STORAGE_CLR_SEL = 0x47, + CMD_STORAGE_GET_SEL_TIME = 0x48, + CMD_STORAGE_GET_SEL_UTC = 0x5C, +}; + +// Transport Command Codes (IPMI/Table H-1) +enum +{ + CMD_TRANSPORT_SET_LAN_CONFIG = 0x01, + CMD_TRANSPORT_GET_LAN_CONFIG = 0x02, +}; + +// OEM Command Codes (Quanta/FB defined commands) +enum +{ + CMD_OEM_SET_PROC_INFO = 0x1A, + CMD_OEM_SET_DIMM_INFO = 0x1C, + CMD_OEM_SET_POST_START = 0x73, + CMD_OEM_SET_POST_END = 0x74, +}; + +// IPMI command Completion Codes (IPMI/Section 5.2) +enum +{ + CC_SUCCESS = 0x00, + CC_INVALID_PARAM = 0x80, + CC_SEL_ERASE_PROG = 0x81, + CC_INVALID_CMD = 0xC1, + CC_PARAM_OUT_OF_RANGE = 0xC9, + CC_UNSPECIFIED_ERROR = 0xFF, +}; + +// LAN Configuration parameters (IPMI/Table 23-4) +enum +{ + LAN_PARAM_SET_IN_PROG, + LAN_PARAM_AUTH_SUPPORT, + LAN_PARAM_AUTH_ENABLES, + LAN_PARAM_IP_ADDR, + LAN_PARAM_IP_SRC, + LAN_PARAM_MAC_ADDR, + LAN_PARAM_NET_MASK, + LAN_PARAM_IP_HDR, + LAN_PARAM_PRI_RMCP_PORT, + LAN_PARAM_SEC_RMCP_PORT, + LAN_PARAM_ARP_CTRL, + LAN_PARAM_GARP_INTERVAL, + LAN_PARAM_DF_GW_IP_ADDR, + LAN_PARAM_DF_GW_MAC_ADDR, + LAN_PARAM_BACK_GW_IP_ADDR, + LAN_PARAM_BACK_GW_MAC_ADDR, + LAN_PARAM_COMMUNITY_STR, + LAN_PARAM_NO_OF_DEST, + LAN_PARAM_DEST_TYPE, + LAN_PARAM_DEST_ADDR, +}; + +// Boot Option Parameters (IPMI/Table 28-14) +enum +{ + PARAM_SET_IN_PROG = 0x00, + PARAM_SVC_PART_SELECT, + PARAM_SVC_PART_SCAN, + PARAM_BOOT_FLAG_CLR, + PARAM_BOOT_INFO_ACK, + PARAM_BOOT_FLAGS, + PARAM_BOOT_INIT_INFO, +}; + +//System Info Parameters (IPMI/Table 22-16c) +enum +{ + SYS_INFO_PARAM_SET_IN_PROG, + SYS_INFO_PARAM_SYSFW_VER, + SYS_INFO_PARAM_SYS_NAME, + SYS_INFO_PARAM_PRI_OS_NAME, + SYS_INFO_PARAM_PRESENT_OS_NAME, + SYS_INFO_PARAM_PRESENT_OS_VER, + SYS_INFO_PARAM_BMC_URL, + SYS_INFO_PARAM_OS_HV_URL, +}; + +// TODO: Once data storage is finalized, the following structure needs +// to be retrieved/updated from persistant backend storage +static lan_config_t g_lan_config = { 0 }; +static proc_info_t g_proc_info = { 0 }; +static dimm_info_t g_dimm_info[MAX_NUM_DIMMS] = { 0 }; + +// TODO: Need to store this info after identifying proper storage +static sys_info_param_t g_sys_info_params; + +// TODO: Based on performance testing results, might need fine grained locks +// Since the global data is specific to a NetFunction, adding locs at NetFn level +static pthread_mutex_t m_chassis; +static pthread_mutex_t m_app; +static pthread_mutex_t m_storage; +static pthread_mutex_t m_transport; +static pthread_mutex_t m_oem; + +/* + * Function(s) to handle IPMI messages with NetFn: Chassis + */ +// Get Chassis Status (IPMI/Section 28.2) +static void +chassis_get_status (unsigned char *response, unsigned char *res_len) +{ + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + + res->cc = CC_SUCCESS; + + // TODO: Need to obtain current power state and last power event + // from platform and return + *data++ = 0x01; // Current Power State + *data++ = 0x00; // Last Power Event + *data++ = 0x40; // Misc. Chassis Status + *data++ = 0x00; // Front Panel Button Disable + + *res_len = data - &res->data[0]; +} + +// Get System Boot Options (IPMI/Section 28.12) +static void +chassis_get_boot_options (unsigned char *request, unsigned char *response, + unsigned char *res_len) +{ + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res= (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + unsigned char param = req->data[0]; + + // Fill response with default values + res->cc = CC_SUCCESS; + *data++ = 0x01; // Parameter Version + *data++ = req->data[0]; // Parameter + + // TODO: Need to store user settings and return + switch (param) + { + case PARAM_SET_IN_PROG: + *data++ = 0x00; // Set In Progress + break; + case PARAM_SVC_PART_SELECT: + *data++ = 0x00; // Service Partition Selector + break; + case PARAM_SVC_PART_SCAN: + *data++ = 0x00; // Service Partition Scan + break; + case PARAM_BOOT_FLAG_CLR: + *data++ = 0x00; // BMC Boot Flag Valid Bit Clear + break; + case PARAM_BOOT_INFO_ACK: + *data++ = 0x00; // Write Mask + *data++ = 0x00; // Boot Initiator Ack Data + break; + case PARAM_BOOT_FLAGS: + *data++ = 0x00; // Boot Flags + *data++ = 0x00; // Boot Device Selector + *data++ = 0x00; // Firmwaer Verbosity + *data++ = 0x00; // BIOS Override + *data++ = 0x00; // Device Instance Selector + break; + case PARAM_BOOT_INIT_INFO: + *data++ = 0x00; // Chanel Number + *data++ = 0x00; // Session ID (4 bytes) + *data++ = 0x00; + *data++ = 0x00; + *data++ = 0x00; + *data++ = 0x00; // Boot Info Timestamp (4 bytes) + *data++ = 0x00; + *data++ = 0x00; + *data++ = 0x00; + break; + deault: + res->cc = CC_PARAM_OUT_OF_RANGE; + break; + } + + if (res->cc == CC_SUCCESS) { + *res_len = data - &res->data[0]; + } +} + +// Handle Chassis Commands (IPMI/Section 28) +static void +ipmi_handle_chassis (unsigned char *request, unsigned char req_len, + unsigned char *response, unsigned char *res_len) +{ + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char cmd = req->cmd; + + pthread_mutex_lock(&m_chassis); + switch (cmd) + { + case CMD_CHASSIS_GET_STATUS: + chassis_get_status (response, res_len); + break; + case CMD_CHASSIS_GET_BOOT_OPTIONS: + chassis_get_boot_options (request, response, res_len); + break; + default: + res->cc = CC_INVALID_CMD; + break; + } + pthread_mutex_unlock(&m_chassis); +} + +/* + * Function(s) to handle IPMI messages with NetFn: Application + */ +// Get Device ID (IPMI/Section 20.1) +static void +app_get_device_id (unsigned char *response, unsigned char *res_len) +{ + + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + + res->cc = CC_SUCCESS; + + //TODO: Following data needs to be updated based on platform + *data++ = 0x20; // Device ID + *data++ = 0x81; // Device Revision + *data++ = 0x00; // Firmware Revision Major + *data++ = 0x09; // Firmware Revision Minor + *data++ = 0x02; // IPMI Version + *data++ = 0xBF; // Additional Device Support + *data++ = 0x15; // Manufacturer ID1 + *data++ = 0xA0; // Manufacturer ID2 + *data++ = 0x00; // Manufacturer ID3 + *data++ = 0x46; // Product ID1 + *data++ = 0x31; // Product ID2 + *data++ = 0x00; // Aux. Firmware Version1 + *data++ = 0x00; // Aux. Firmware Version2 + *data++ = 0x00; // Aux. Firmware Version3 + *data++ = 0x00; // Aux. Firmware Version4 + + *res_len = data - &res->data[0]; +} + +// Get Self Test Results (IPMI/Section 20.4) +static void +app_get_selftest_results (unsigned char *response, unsigned char *res_len) +{ + + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + + res->cc = CC_SUCCESS; + + //TODO: Following data needs to be updated based on self-test results + *data++ = 0x55; // Self-Test result + *data++ = 0x00; // Extra error info in case of failure + + *res_len = data - &res->data[0]; +} + +// Get Device GUID (IPMI/Section 20.8) +static void +app_get_device_guid (unsigned char *response, unsigned char *res_len) +{ + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + + res->cc = 0x00; + + // TODO: Following data is Globaly Unique ID i.e. MAC Address.. + *data++ = 0x0; + *data++ = 0x1; + *data++ = 0x2; + *data++ = 0x3; + *data++ = 0x4; + *data++ = 0x5; + *data++ = 0x6; + *data++ = 0x7; + *data++ = 0x8; + *data++ = 0x9; + *data++ = 0xa; + *data++ = 0xb; + *data++ = 0xc; + *data++ = 0xd; + *data++ = 0xe; + *data++ = 0xf; + + *res_len = data - &res->data[0]; +} + +// Get BMC Global Enables (IPMI/Section 22.2) +static void +app_get_global_enables (unsigned char *response, unsigned char *res_len) +{ + + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + + res->cc = CC_SUCCESS; + + *data++ = 0x09; // Global Enable + + *res_len = data - &res->data[0]; +} + +// Set System Info Params (IPMI/Section 22.14a) +static void +app_set_sys_info_params (unsigned char *request, unsigned char *response, + unsigned char *res_len) +{ + + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char param = req->data[0]; + + res->cc = CC_SUCCESS; + + switch (param) + { + case SYS_INFO_PARAM_SET_IN_PROG: + g_sys_info_params.set_in_prog = req->data[1]; + break; + case SYS_INFO_PARAM_SYSFW_VER: + memcpy(g_sys_info_params.sysfw_ver, &req->data[1], SIZE_SYSFW_VER); + break; + case SYS_INFO_PARAM_SYS_NAME: + memcpy(g_sys_info_params.sys_name, &req->data[1], SIZE_SYS_NAME); + break; + case SYS_INFO_PARAM_PRI_OS_NAME: + memcpy(g_sys_info_params.pri_os_name, &req->data[1], SIZE_OS_NAME); + break; + case SYS_INFO_PARAM_PRESENT_OS_NAME: + memcpy(g_sys_info_params.present_os_name, &req->data[1], SIZE_OS_NAME); + break; + case SYS_INFO_PARAM_PRESENT_OS_VER: + memcpy(g_sys_info_params.present_os_ver, &req->data[1], SIZE_OS_VER); + break; + case SYS_INFO_PARAM_BMC_URL: + memcpy(g_sys_info_params.bmc_url, &req->data[1], SIZE_BMC_URL); + break; + case SYS_INFO_PARAM_OS_HV_URL: + memcpy(g_sys_info_params.os_hv_url, &req->data[1], SIZE_OS_HV_URL); + break; + default: + res->cc = CC_INVALID_PARAM; + break; + } + + return; +} + +// Get System Info Params (IPMI/Section 22.14b) +static void +app_get_sys_info_params (unsigned char *request, unsigned char *response, + unsigned char *res_len) +{ + + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + unsigned char param = req->data[1]; + + // Fill default return values + res->cc = CC_SUCCESS; + *data++ = 1; // Parameter revision + + switch (param) + { + case SYS_INFO_PARAM_SET_IN_PROG: + *data++ = g_sys_info_params.set_in_prog; + break; + case SYS_INFO_PARAM_SYSFW_VER: + memcpy(data, g_sys_info_params.sysfw_ver, SIZE_SYSFW_VER); + data += SIZE_SYSFW_VER; + break; + case SYS_INFO_PARAM_SYS_NAME: + memcpy(data, g_sys_info_params.sys_name, SIZE_SYS_NAME); + data += SIZE_SYS_NAME; + break; + case SYS_INFO_PARAM_PRI_OS_NAME: + memcpy(data, g_sys_info_params.pri_os_name, SIZE_OS_NAME); + data += SIZE_OS_NAME; + break; + case SYS_INFO_PARAM_PRESENT_OS_NAME: + memcpy(data, g_sys_info_params.present_os_name, SIZE_OS_NAME); + data += SIZE_OS_NAME; + break; + case SYS_INFO_PARAM_PRESENT_OS_VER: + memcpy(data, g_sys_info_params.present_os_ver, SIZE_OS_VER); + data += SIZE_OS_VER; + break; + case SYS_INFO_PARAM_BMC_URL: + memcpy(data, g_sys_info_params.bmc_url, SIZE_BMC_URL); + data += SIZE_BMC_URL; + break; + case SYS_INFO_PARAM_OS_HV_URL: + memcpy(data, g_sys_info_params.os_hv_url, SIZE_OS_HV_URL); + data += SIZE_OS_HV_URL; + break; + default: + res->cc = CC_INVALID_PARAM; + break; + } + + if (res->cc == CC_SUCCESS) { + *res_len = data - &res->data[0]; + } + + return; +} + +// Handle Appliction Commands (IPMI/Section 20) +static void +ipmi_handle_app (unsigned char *request, unsigned char req_len, + unsigned char *response, unsigned char *res_len) +{ + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char cmd = req->cmd; + + pthread_mutex_lock(&m_app); + switch (cmd) + { + case CMD_APP_GET_DEVICE_ID: + app_get_device_id (response, res_len); + break; + case CMD_APP_GET_SELFTEST_RESULTS: + app_get_selftest_results (response, res_len); + break; + case CMD_APP_GET_DEVICE_GUID: + case CMD_APP_GET_SYSTEM_GUID: + // Get Device GUID and Get System GUID returns same data + // from IPMI stack. FYI, Get System GUID will have to be + // sent with in an IPMI session that includes session info + app_get_device_guid (response, res_len); + break; + case CMD_APP_GET_GLOBAL_ENABLES: + app_get_global_enables (response, res_len); + break; + case CMD_APP_SET_SYS_INFO_PARAMS: + app_set_sys_info_params (request, response, res_len); + break; + case CMD_APP_GET_SYS_INFO_PARAMS: + app_get_sys_info_params (request, response, res_len); + break; + default: + res->cc = CC_INVALID_CMD; + break; + } + pthread_mutex_unlock(&m_app); +} + +/* + * Function(s) to handle IPMI messages with NetFn: Storage + */ + +static void +storage_get_fruid_info(unsigned char *response, unsigned char *res_len) +{ + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + int size = plat_fruid_size(); + + res->cc = CC_SUCCESS; + + *data++ = size & 0xFF; // FRUID size LSB + *data++ = (size >> 8) & 0xFF; // FRUID size MSB + *data++ = 0x00; // Device accessed by bytes + + *res_len = data - &res->data[0]; + + return; +} + +static void +storage_get_fruid_data(unsigned char *request, unsigned char *response, + unsigned char *res_len) +{ + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + + int offset = req->data[1] + (req->data[2] << 8); + int count = req->data[3]; + + int ret = plat_fruid_data(offset, count, &(res->data[1])); + if (ret) { + res->cc = CC_UNSPECIFIED_ERROR; + } else { + res->cc = CC_SUCCESS; + *data++ = count; + data += count; + } + + if (res->cc == CC_SUCCESS) { + *res_len = data - &res->data[0]; + } + return; +} + +static void +storage_get_sdr_info (unsigned char *response, unsigned char *res_len) +{ + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + int num_entries; // number of sdr records + int free_space; // free space in SDR device in bytes + time_stamp_t ts_recent_add; // Recent Addition Timestamp + time_stamp_t ts_recent_erase; // Recent Erasure Timestamp + + // Use platform APIs to get SDR information + num_entries = plat_sdr_num_entries (); + free_space = plat_sdr_free_space (); + plat_sdr_ts_recent_add (&ts_recent_add); + plat_sdr_ts_recent_erase (&ts_recent_erase); + + res->cc = CC_SUCCESS; + + *data++ = IPMI_SDR_VERSION; // SDR version + *data++ = num_entries & 0xFF; // number of sdr entries + *data++ = (num_entries >> 8) & 0xFF; + *data++ = free_space & 0xFF; // Free SDR Space + *data++ = (free_space >> 8) & 0xFF; + + memcpy(data, ts_recent_add.ts, SIZE_TIME_STAMP); + data += SIZE_TIME_STAMP; + + memcpy(data, ts_recent_erase.ts, SIZE_TIME_STAMP); + data += SIZE_TIME_STAMP; + + *data++ = 0x02; // Operations supported + + *res_len = data - &res->data[0]; + + return; +} + +static void +storage_rsv_sdr (unsigned char *response, unsigned char *res_len) +{ + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + int rsv_id; // SDR reservation ID + + // Use platform APIs to get a SDR reservation ID + rsv_id = plat_sdr_rsv_id (); + if (rsv_id < 0) + { + res->cc = CC_UNSPECIFIED_ERROR; + return; + } + + res->cc = CC_SUCCESS; + *data++ = rsv_id & 0xFF; // Reservation ID + *data++ = (rsv_id >> 8) & 0XFF; + + *res_len = data - &res->data[0]; + + return; +} + +static void +storage_get_sdr (unsigned char *request, unsigned char *response, + unsigned char *res_len) +{ + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + + int read_rec_id; //record ID to be read + int next_rec_id; //record ID for the next entry + int rsv_id; // Reservation ID for the request + int rec_offset; // Read offset into the record + int rec_bytes; // Number of bytes to be read + sdr_rec_t entry; // SDR record entry + int ret; + + rsv_id = (req->data[1] >> 8) | req->data[0]; + read_rec_id = (req->data[3] >> 8) | req->data[2]; + rec_offset = req->data[4]; + rec_bytes = req->data[5]; + + // Use platform API to read the record Id and get next ID + ret = plat_sdr_get_entry (rsv_id, read_rec_id, &entry, &next_rec_id); + if (ret) + { + res->cc = CC_UNSPECIFIED_ERROR; + return; + } + + res->cc = CC_SUCCESS; + *data++ = next_rec_id & 0xFF; // next record ID + *data++ = (next_rec_id >> 8) & 0xFF; + + memcpy (data, &entry.rec[rec_offset], rec_bytes); + data += rec_bytes; + + *res_len = data - &res->data[0]; + + return; +} + +static void +storage_get_sel_info (unsigned char *response, unsigned char *res_len) +{ + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + int num_entries; // number of log entries + int free_space; // free space in SEL device in bytes + time_stamp_t ts_recent_add; // Recent Addition Timestamp + time_stamp_t ts_recent_erase; // Recent Erasure Timestamp + + // Use platform APIs to get SEL information + num_entries = plat_sel_num_entries (); + free_space = plat_sel_free_space (); + plat_sel_ts_recent_add (&ts_recent_add); + plat_sel_ts_recent_erase (&ts_recent_erase); + + res->cc = CC_SUCCESS; + + *data++ = IPMI_SEL_VERSION; // SEL version + *data++ = num_entries & 0xFF; // number of log entries + *data++ = (num_entries >> 8) & 0xFF; + *data++ = free_space & 0xFF; // Free SEL Space + *data++ = (free_space >> 8) & 0xFF; + + memcpy(data, ts_recent_add.ts, SIZE_TIME_STAMP); + data += SIZE_TIME_STAMP; + + memcpy(data, ts_recent_erase.ts, SIZE_TIME_STAMP); + data += SIZE_TIME_STAMP; + + *data++ = 0x02; // Operations supported + + *res_len = data - &res->data[0]; + + return; +} + +static void +storage_rsv_sel (unsigned char *response, unsigned char *res_len) +{ + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + int rsv_id; // SEL reservation ID + + // Use platform APIs to get a SEL reservation ID + rsv_id = plat_sel_rsv_id (); + if (rsv_id < 0) + { + res->cc = CC_SEL_ERASE_PROG; + return; + } + + res->cc = CC_SUCCESS; + *data++ = rsv_id & 0xFF; // Reservation ID + *data++ = (rsv_id >> 8) & 0XFF; + + *res_len = data - &res->data[0]; + + return; +} + +static void +storage_get_sel (unsigned char *request, unsigned char *response, + unsigned char *res_len) +{ + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + + int read_rec_id; //record ID to be read + int next_rec_id; //record ID for the next msg + sel_msg_t entry; // SEL log entry + int ret; + + read_rec_id = (req->data[3] >> 8) | req->data[2]; + + // Use platform API to read the record Id and get next ID + ret = plat_sel_get_entry (read_rec_id, &entry, &next_rec_id); + if (ret) + { + res->cc = CC_UNSPECIFIED_ERROR; + return; + } + + res->cc = CC_SUCCESS; + *data++ = next_rec_id & 0xFF; // next record ID + *data++ = (next_rec_id >> 8) & 0xFF; + + memcpy(data, entry.msg, SIZE_SEL_REC); + data += SIZE_SEL_REC; + + *res_len = data - &res->data[0]; + + return; +} + +static void +storage_add_sel (unsigned char *request, unsigned char *response, + unsigned char *res_len) +{ + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + + + int record_id; // Record ID for added entry + int ret; + + sel_msg_t entry; + + memcpy(entry.msg, req->data, SIZE_SEL_REC); + + // Use platform APIs to add the new SEL entry + ret = plat_sel_add_entry (&entry, &record_id); + if (ret) + { + res->cc = CC_UNSPECIFIED_ERROR; + return; + } + + res->cc = CC_SUCCESS; + *data++ = record_id & 0xFF; + *data++ = (record_id >> 8) & 0xFF; + + *res_len = data - &res->data[0]; + + return; +} + +static void +storage_clr_sel (unsigned char *request, unsigned char *response, + unsigned char *res_len) +{ + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + + sel_erase_stat_t status; + int ret; + int rsv_id; + + // Verify the request to contain 'CLR' characters + if ((req->data[2] != 'C') || (req->data[3] != 'L') || (req->data[4] != 'R')) + { + res->cc = CC_INVALID_PARAM; + return; + } + + // Populate reservation ID given in request + rsv_id = (req->data[1] << 8) | req->data[0]; + + // Use platform APIs to clear or get status + if (req->data[5] == IPMI_SEL_INIT_ERASE) + { + ret = plat_sel_erase (rsv_id); + } + else if (req->data[5] == IPMI_SEL_ERASE_STAT) + { + ret = plat_sel_erase_status (rsv_id, &status); + } + else + { + res->cc = CC_INVALID_PARAM; + return; + } + + // Handle platform error and return + if (ret) + { + res->cc = CC_UNSPECIFIED_ERROR; + return; + } + + res->cc = CC_SUCCESS; + *data++ = status; + + *res_len = data - &res->data[0]; + + return; +} + +static void +ipmi_handle_storage (unsigned char *request, unsigned char req_len, + unsigned char *response, unsigned char *res_len) +{ + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char cmd = req->cmd; + + res->cc = CC_SUCCESS; + *res_len = 0; + + pthread_mutex_lock(&m_storage); + switch (cmd) + { + case CMD_STORAGE_GET_FRUID_INFO: + storage_get_fruid_info (response, res_len); + break; + case CMD_STORAGE_READ_FRUID_DATA: + storage_get_fruid_data (request, response, res_len); + break; + case CMD_STORAGE_GET_SEL_INFO: + storage_get_sel_info (response, res_len); + break; + case CMD_STORAGE_RSV_SEL: + storage_rsv_sel (response, res_len); + break; + case CMD_STORAGE_ADD_SEL: + storage_add_sel (request, response, res_len); + break; + case CMD_STORAGE_GET_SEL: + storage_get_sel (request, response, res_len); + break; + case CMD_STORAGE_CLR_SEL: + storage_clr_sel (request, response, res_len); + break; + case CMD_STORAGE_GET_SDR_INFO: + storage_get_sdr_info (response, res_len); + break; + case CMD_STORAGE_RSV_SDR: + storage_rsv_sdr (response, res_len); + break; + case CMD_STORAGE_GET_SDR: + storage_get_sdr (request, response, res_len); + break; + default: + res->cc = CC_INVALID_CMD; + break; + } + + pthread_mutex_unlock(&m_storage); + return; +} + +/* + * Function(s) to handle IPMI messages with NetFn: Transport + */ + +// Set LAN Configuration (IPMI/Section 23.1) +static void +transport_set_lan_config (unsigned char *request, unsigned char *response, + unsigned char *res_len) +{ + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char param = req->data[1]; + + // Fill the response with default values + res->cc = CC_SUCCESS; + + switch (param) + { + case LAN_PARAM_SET_IN_PROG: + g_lan_config.set_in_prog = req->data[2]; + break; + case LAN_PARAM_AUTH_SUPPORT: + g_lan_config.auth_support = req->data[2]; + break; + case LAN_PARAM_AUTH_ENABLES: + memcpy(g_lan_config.auth_enables, &req->data[2], SIZE_AUTH_ENABLES); + break; + case LAN_PARAM_IP_ADDR: + memcpy(g_lan_config.ip_addr, &req->data[2], SIZE_IP_ADDR); + break; + case LAN_PARAM_IP_SRC: + g_lan_config.ip_src = req->data[2]; + break; + case LAN_PARAM_MAC_ADDR: + memcpy(g_lan_config.mac_addr, &req->data[2], SIZE_MAC_ADDR); + break; + case LAN_PARAM_NET_MASK: + memcpy(g_lan_config.net_mask, &req->data[2], SIZE_NET_MASK); + break; + case LAN_PARAM_IP_HDR: + memcpy(g_lan_config.ip_hdr, &req->data[2], SIZE_IP_HDR); + break; + case LAN_PARAM_PRI_RMCP_PORT: + g_lan_config.pri_rmcp_port[0] = req->data[2]; + g_lan_config.pri_rmcp_port[1] = req->data[3]; + break; + case LAN_PARAM_SEC_RMCP_PORT: + g_lan_config.sec_rmcp_port[0] = req->data[2]; + g_lan_config.sec_rmcp_port[1] = req->data[3]; + break; + case LAN_PARAM_ARP_CTRL: + g_lan_config.arp_ctrl = req->data[2]; + break; + case LAN_PARAM_GARP_INTERVAL: + g_lan_config.garp_interval = req->data[2]; + break; + case LAN_PARAM_DF_GW_IP_ADDR: + memcpy(g_lan_config.df_gw_ip_addr, &req->data[2], SIZE_IP_ADDR); + break; + case LAN_PARAM_DF_GW_MAC_ADDR: + memcpy(g_lan_config.df_gw_mac_addr, &req->data[2], SIZE_MAC_ADDR); + break; + case LAN_PARAM_BACK_GW_IP_ADDR: + memcpy(g_lan_config.back_gw_ip_addr, &req->data[2], SIZE_IP_ADDR); + break; + case LAN_PARAM_BACK_GW_MAC_ADDR: + memcpy(g_lan_config.back_gw_mac_addr, &req->data[2], SIZE_MAC_ADDR); + break; + case LAN_PARAM_COMMUNITY_STR: + memcpy(g_lan_config.community_str, &req->data[2], SIZE_COMMUNITY_STR); + break; + case LAN_PARAM_NO_OF_DEST: + g_lan_config.no_of_dest = req->data[2]; + break; + case LAN_PARAM_DEST_TYPE: + memcpy(g_lan_config.dest_type, &req->data[2], SIZE_DEST_TYPE); + break; + case LAN_PARAM_DEST_ADDR: + memcpy(g_lan_config.dest_addr, &req->data[2], SIZE_DEST_ADDR); + break; + default: + res->cc = CC_INVALID_PARAM; + break; + } +} + +// Get LAN Configuration (IPMI/Section 23.2) +static void +transport_get_lan_config (unsigned char *request, unsigned char *response, + unsigned char *res_len) +{ + + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char *data = &res->data[0]; + unsigned char param = req->data[1]; + + // Fill the response with default values + res->cc = CC_SUCCESS; + *data++ = 0x01; // Parameter revision + + switch (param) + { + case LAN_PARAM_SET_IN_PROG: + *data++ = g_lan_config.set_in_prog; + break; + case LAN_PARAM_AUTH_SUPPORT: + *data++ = g_lan_config.auth_support; + break; + case LAN_PARAM_AUTH_ENABLES: + memcpy(data, g_lan_config.auth_enables, SIZE_AUTH_ENABLES); + data += SIZE_AUTH_ENABLES; + break; + case LAN_PARAM_IP_ADDR: + memcpy(data, g_lan_config.ip_addr, SIZE_IP_ADDR); + data += SIZE_IP_ADDR; + break; + case LAN_PARAM_IP_SRC: + *data++ = g_lan_config.ip_src; + break; + case LAN_PARAM_MAC_ADDR: + memcpy(data, g_lan_config.mac_addr, SIZE_MAC_ADDR); + data += SIZE_MAC_ADDR; + break; + case LAN_PARAM_NET_MASK: + memcpy(data, g_lan_config.net_mask, SIZE_NET_MASK); + data += SIZE_NET_MASK; + break; + case LAN_PARAM_IP_HDR: + memcpy(data, g_lan_config.ip_hdr, SIZE_IP_HDR); + data += SIZE_IP_HDR; + break; + case LAN_PARAM_PRI_RMCP_PORT: + *data++ = g_lan_config.pri_rmcp_port[0]; + *data++ = g_lan_config.pri_rmcp_port[1]; + break; + case LAN_PARAM_SEC_RMCP_PORT: + *data++ = g_lan_config.sec_rmcp_port[0]; + *data++ = g_lan_config.sec_rmcp_port[1]; + break; + case LAN_PARAM_ARP_CTRL: + *data++ = g_lan_config.arp_ctrl; + break; + case LAN_PARAM_GARP_INTERVAL: + *data++ = g_lan_config.garp_interval; + break; + case LAN_PARAM_DF_GW_IP_ADDR: + memcpy(data, g_lan_config.df_gw_ip_addr, SIZE_IP_ADDR); + data += SIZE_IP_ADDR; + break; + case LAN_PARAM_DF_GW_MAC_ADDR: + memcpy(data, g_lan_config.df_gw_mac_addr, SIZE_MAC_ADDR); + data += SIZE_MAC_ADDR; + break; + case LAN_PARAM_BACK_GW_IP_ADDR: + memcpy(data, g_lan_config.back_gw_ip_addr, SIZE_IP_ADDR); + data += SIZE_IP_ADDR; + break; + case LAN_PARAM_BACK_GW_MAC_ADDR: + memcpy(data, g_lan_config.back_gw_mac_addr, SIZE_MAC_ADDR); + data += SIZE_MAC_ADDR; + break; + case LAN_PARAM_COMMUNITY_STR: + memcpy(data, g_lan_config.community_str, SIZE_COMMUNITY_STR); + data += SIZE_COMMUNITY_STR; + break; + case LAN_PARAM_NO_OF_DEST: + *data++ = g_lan_config.no_of_dest; + break; + case LAN_PARAM_DEST_TYPE: + memcpy(data, g_lan_config.dest_type, SIZE_DEST_TYPE); + data += SIZE_DEST_TYPE; + break; + case LAN_PARAM_DEST_ADDR: + memcpy(data, g_lan_config.dest_addr, SIZE_DEST_ADDR); + data += SIZE_DEST_ADDR; + break; + default: + res->cc = CC_INVALID_PARAM; + break; + } + + if (res->cc == CC_SUCCESS) { + *res_len = data - &res->data[0]; + } +} + +// Handle Transport Commands (IPMI/Section 23) +static void +ipmi_handle_transport (unsigned char *request, unsigned char req_len, + unsigned char *response, unsigned char *res_len) +{ + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char cmd = req->cmd; + + pthread_mutex_lock(&m_transport); + switch (cmd) + { + case CMD_TRANSPORT_SET_LAN_CONFIG: + transport_set_lan_config (request, response, res_len); + break; + case CMD_TRANSPORT_GET_LAN_CONFIG: + transport_get_lan_config (request, response, res_len); + break; + default: + res->cc = CC_INVALID_CMD; + break; + } + pthread_mutex_unlock(&m_transport); +} + +/* + * Function(s) to handle IPMI messages with NetFn: OEM + */ + +static void +oem_set_proc_info (unsigned char *request, unsigned char *response, + unsigned char *res_len) +{ + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + + g_proc_info.type = req->data[1]; + g_proc_info.freq[0] = req->data[2]; + g_proc_info.freq[1] = req->data[3]; + + res->cc = CC_SUCCESS; + *res_len = 0; +} + +static void +oem_set_dimm_info (unsigned char *request, unsigned char *response, + unsigned char *res_len) +{ + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + + unsigned char index = req->data[0]; + + g_dimm_info[index].type = req->data[1]; + g_dimm_info[index].speed[0] = req->data[2]; + g_dimm_info[index].speed[1] = req->data[3]; + g_dimm_info[index].size[0] = req->data[4]; + g_dimm_info[index].size[1] = req->data[5]; + + res->cc = CC_SUCCESS; + *res_len = 0; +} + +static void +oem_set_post_start (unsigned char *response, unsigned char *res_len) +{ + + ipmi_res_t *res = (ipmi_res_t *) response; + + // TODO: For now logging the event, need to find usage for this info + syslog (LOG_INFO, "POST Start Event\n"); + + res->cc = CC_SUCCESS; + *res_len = 0; +} + +static void +oem_set_post_end (unsigned char *response, unsigned char *res_len) +{ + + ipmi_res_t *res = (ipmi_res_t *) response; + + // TODO: For now logging the event, need to find usage for this info + syslog (LOG_INFO, "POST End Event\n"); + + res->cc = CC_SUCCESS; + *res_len = 0; +} + +static void +ipmi_handle_oem (unsigned char *request, unsigned char req_len, + unsigned char *response, unsigned char *res_len) +{ + + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + + unsigned char cmd = req->cmd; + + pthread_mutex_lock(&m_oem); + switch (cmd) + { + case CMD_OEM_SET_PROC_INFO: + oem_set_proc_info (request, response, res_len); + break; + case CMD_OEM_SET_DIMM_INFO: + oem_set_dimm_info (request, response, res_len); + break; + case CMD_OEM_SET_POST_START: + oem_set_post_start (response, res_len); + break; + case CMD_OEM_SET_POST_END: + oem_set_post_end (response, res_len); + break; + default: + res->cc = CC_INVALID_CMD; + break; + } + pthread_mutex_unlock(&m_oem); +} + +/* + * Function to handle all IPMI messages + */ +static void +ipmi_handle (unsigned char *request, unsigned char req_len, + unsigned char *response, unsigned char *res_len) +{ + + ipmi_req_t *req = (ipmi_req_t *) request; + ipmi_res_t *res = (ipmi_res_t *) response; + unsigned char netfn; + + netfn = req->netfn_lun >> 2; + + // Provide default values in the response message + res->cmd = req->cmd; + res->cc = 0xFF; // Unspecified completion code + *res_len = 0; + + switch (netfn) + { + case NETFN_CHASSIS_REQ: + res->netfn_lun = NETFN_CHASSIS_RES << 2; + ipmi_handle_chassis (request, req_len, response, res_len); + break; + case NETFN_APP_REQ: + res->netfn_lun = NETFN_APP_RES << 2; + ipmi_handle_app (request, req_len, response, res_len); + break; + case NETFN_STORAGE_REQ: + res->netfn_lun = NETFN_STORAGE_RES << 2; + ipmi_handle_storage (request, req_len, response, res_len); + break; + case NETFN_TRANSPORT_REQ: + res->netfn_lun = NETFN_TRANSPORT_RES << 2; + ipmi_handle_transport (request, req_len, response, res_len); + break; + case NETFN_OEM_REQ: + res->netfn_lun = NETFN_OEM_RES << 2; + ipmi_handle_oem (request, req_len, response, res_len); + break; + default: + res->netfn_lun = (netfn + 1) << 2; + break; + } + + // This header includes NetFunction, Command, and Completion Code + *res_len += SIZE_IPMI_RES_HDR; + + return; +} + +void +*conn_handler(void *socket_desc) { + int sock = *(int*)socket_desc; + int n; + unsigned char req_buf[MAX_IPMI_MSG_SIZE]; + unsigned char res_buf[MAX_IPMI_MSG_SIZE]; + unsigned char res_len = 0; + + n = recv (sock, req_buf, sizeof(req_buf), 0); + if (n <= 0) { + syslog(LOG_ALERT, "ipmid: recv() failed with %d\n", n); + goto conn_cleanup; + } + + ipmi_handle(req_buf, n, res_buf, &res_len); + + if (send (sock, res_buf, res_len, 0) < 0) { + syslog(LOG_ALERT, "ipmid: send() failed\n"); + } + +conn_cleanup: + close(sock); + + pthread_exit(NULL); + return 0; +} + + +int +main (void) +{ + int s, s2, t, len; + struct sockaddr_un local, remote; + pthread_t tid; + + daemon(1, 0); + openlog("ipmid", LOG_CONS, LOG_DAEMON); + + plat_sel_init(); + plat_sensor_init(); + plat_sdr_init(); + plat_fruid_init(); + + pthread_mutex_init(&m_chassis, NULL); + pthread_mutex_init(&m_app, NULL); + pthread_mutex_init(&m_storage, NULL); + pthread_mutex_init(&m_transport, NULL); + pthread_mutex_init(&m_oem, NULL); + + if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) == -1) + { + syslog(LOG_ALERT, "ipmid: socket() failed\n"); + exit (1); + } + + local.sun_family = AF_UNIX; + strcpy (local.sun_path, SOCK_PATH); + unlink (local.sun_path); + len = strlen (local.sun_path) + sizeof (local.sun_family); + if (bind (s, (struct sockaddr *) &local, len) == -1) + { + syslog(LOG_ALERT, "ipmid: bind() failed\n"); + exit (1); + } + + if (listen (s, 5) == -1) + { + syslog(LOG_ALERT, "ipmid: listen() failed\n"); + exit (1); + } + + while(1) { + int n; + t = sizeof (remote); + if ((s2 = accept (s, (struct sockaddr *) &remote, &t)) < 0) { + syslog(LOG_ALERT, "ipmid: accept() failed\n"); + break; + } + + // Creating a worker thread to handle the request + // TODO: Need to monitor the server performance with higher load and + // see if we need to create pre-defined number of workers and schedule + // the requests among them. + if (pthread_create(&tid, NULL, conn_handler, (void*) &s2) < 0) { + syslog(LOG_ALERT, "ipmid: pthread_create failed\n"); + close(s2); + continue; + } + + pthread_detach(tid); + } + + close(s); + + pthread_mutex_destroy(&m_chassis); + pthread_mutex_destroy(&m_app); + pthread_mutex_destroy(&m_storage); + pthread_mutex_destroy(&m_transport); + pthread_mutex_destroy(&m_oem); + + return 0; +} diff --git a/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/fruid.h b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/fruid.h new file mode 100644 index 0000000..3580b08 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/fruid.h @@ -0,0 +1,28 @@ +/* + * + * Copyright 2015-present Facebook. All Rights Reserved. + * + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __FRUID_H__ +#define __FRUID_H__ + +int plat_fruid_size(void); +int plat_fruid_data(int offset, int count, unsigned char *data); +int plat_fruid_init(void); + +#endif /* __FRUID_H__ */ diff --git a/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/sdr.c b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/sdr.c new file mode 100644 index 0000000..e0a2f9a --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/sdr.c @@ -0,0 +1,412 @@ +/* + * + * Copyright 2014-present Facebook. All Rights Reserved. + * + * This file represents platform specific implementation for storing + * SDR record entries and acts as back-end for IPMI stack + * + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include "sdr.h" +#include "sensor.h" +#include "timestamp.h" +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#include <syslog.h> +#include <string.h> + +// SDR Header magic number +#define SDR_HDR_MAGIC 0xFBFBFBFB + +// SDR Header version number +#define SDR_HDR_VERSION 0x01 + +// SDR reservation IDs can not be 0x00 or 0xFFFF +#define SDR_RSVID_MIN 0x01 +#define SDR_RSVID_MAX 0xFFFE + +#define SDR_RECORDS_MAX 64 // to support around 64 sensors + +// SDR index to keep track +#define SDR_INDEX_MIN 0 +#define SDR_INDEX_MAX (SDR_RECORDS_MAX - 1) + +// Record ID can not be 0x0 (IPMI/Section 31) +#define SDR_RECID_MIN 1 +#define SDR_RECID_MAX SDR_RECORDS_MAX + +// Special RecID value for first and last (IPMI/Section 31) +#define SDR_RECID_FIRST 0x0000 +#define SDR_RECID_LAST 0xFFFF + +#define SDR_VERSION 0x51 +#define SDR_LEN_MAX 64 + +#define SDR_FULL_TYPE 0x01 +#define SDR_MGMT_TYPE 0x12 +#define SDR_OEM_TYPE 0xC0 + +#define SDR_FULL_LEN 64 +#define SDR_MGMT_LEN 32 +#define SDR_OEM_LEN 64 + +// SDR header struct to keep track of SEL Log entries +typedef struct { + int magic; // Magic number to check validity + int version; // version number of this header + int begin; // index to the first SDR entry + int end; // index to the last SDR entry + time_stamp_t ts_add; // last addition time stamp + time_stamp_t ts_erase; // last erase time stamp +} sdr_hdr_t; + +// Keep track of last Reservation ID +static int g_rsv_id = 0x01; + +// SDR Header and data global structures +static sdr_hdr_t g_sdr_hdr; +static sdr_rec_t g_sdr_data[SDR_RECORDS_MAX]; + +// Add a new SDR entry +static int +plat_sdr_add_entry(sdr_rec_t *rec, int *rec_id) { + // If SDR is full, return error + if (plat_sdr_num_entries() == SDR_RECORDS_MAX) { + syslog(LOG_ALERT, "plat_sdr_add_entry: SDR full\n"); + return -1; + } + + // Add Record ID which is array index + 1 + rec->rec[0] = g_sdr_hdr.end+1; + + // Add the enry at end + memcpy(g_sdr_data[g_sdr_hdr.end].rec, rec->rec, sizeof(sdr_rec_t)); + + // Return the newly added record ID + *rec_id = g_sdr_hdr.end+1; + + // Increment the end pointer + ++g_sdr_hdr.end; + + // Update timestamp for add in header + time_stamp_fill(g_sdr_hdr.ts_add.ts); + + return 0; +} + +static int +sdr_add_mgmt_rec(sensor_mgmt_t *p_rec) { + int rec_id = 0; + sdr_rec_t sdr = { 0 }; + sdr_mgmt_t rec = { 0 }; + + // Populate SDR MGMT record + rec.ver = SDR_VERSION; + rec.type = SDR_MGMT_TYPE; + rec.len = SDR_MGMT_LEN; + + rec.slave_addr = p_rec->slave_addr; + rec.chan_no = p_rec->chan_no; + + rec.pwr_state_init = p_rec->pwr_state_init; + rec.dev_caps = p_rec->dev_caps; + rec.ent_id = p_rec->ent_id; + rec.ent_inst = p_rec->ent_inst; + rec.oem = p_rec->oem; + rec.str_type_len = p_rec->str_type_len; + memcpy(rec.str, p_rec->str, SENSOR_STR_SIZE); + + // Copy this record to generic SDR record + memcpy(sdr.rec, &rec, SDR_LEN_MAX); + + // Add this record to SDR repo + if (plat_sdr_add_entry(&sdr, &rec_id)) { + syslog(LOG_ALERT, "sdr_add_mgmt_rec: plat_sdr_add_entry failed\n"); + return -1; + } + + return 0; +} + +static int +sdr_add_disc_rec(sensor_disc_t *p_rec) { + int rec_id = 0; + sdr_rec_t sdr = { 0 }; + sdr_full_t rec = { 0 }; + + // Populate SDR FULL record + rec.ver = SDR_VERSION; + rec.type = SDR_FULL_TYPE; + rec.len = SDR_FULL_LEN; + + rec.owner = p_rec->owner; + rec.lun = p_rec->lun; + + rec.ent_id = p_rec->ent_id; + rec.ent_inst = p_rec->ent_inst; + rec.sensor_init = p_rec->sensor_init; + rec.sensor_caps = p_rec->sensor_caps; + rec.sensor_type = p_rec->sensor_type; + rec.evt_read_type = p_rec->evt_read_type; + memcpy(rec.assert_evt_mask, p_rec->assert_evt_mask, 2); + memcpy(rec.deassert_evt_mask, p_rec->deassert_evt_mask, 2); + memcpy(rec.read_evt_mask, p_rec->read_evt_mask, 2); + rec.oem = p_rec->oem; + rec.str_type_len = p_rec->str_type_len; + memcpy(rec.str, p_rec->str, SENSOR_STR_SIZE); + + // Copy this record to generic SDR record + memcpy(sdr.rec, &rec, SDR_LEN_MAX); + + // Add this record to SDR repo + if (plat_sdr_add_entry(&sdr, &rec_id)) { + syslog(LOG_ALERT, "sdr_add_disc_rec: plat_sdr_add_entry failed\n"); + return -1; + } + + return 0; +} + +static int +sdr_add_thresh_rec(sensor_thresh_t *p_rec) { + int rec_id = 0; + sdr_rec_t sdr = { 0 }; + sdr_full_t rec = { 0 }; + + // Populate SDR FULL record + rec.ver = SDR_VERSION; + rec.type = SDR_FULL_TYPE; + rec.len = SDR_FULL_LEN; + + rec.owner = p_rec->owner; + rec.lun = p_rec->lun; + + rec.ent_id = p_rec->ent_id; + rec.ent_inst = p_rec->ent_inst; + rec.sensor_init = p_rec->sensor_init; + rec.sensor_caps = p_rec->sensor_caps; + rec.sensor_type = p_rec->sensor_type; + rec.evt_read_type = p_rec->evt_read_type; + memcpy(rec.lt_read_mask, p_rec->lt_read_mask, 2); + memcpy(rec.ut_read_mask, p_rec->ut_read_mask, 2); + memcpy(rec.set_thresh_mask, p_rec->set_thresh_mask, 2); + rec.sensor_units1 = p_rec->sensor_units1; + rec.sensor_units2 = p_rec->sensor_units2; + rec.sensor_units3 = p_rec->sensor_units3; + rec.linear = p_rec->linear; + rec.m_val = p_rec->m_val; + rec.m_tolerance = p_rec->m_tolerance; + rec.b_val = p_rec->b_val; + rec.b_accuracy = p_rec->b_accuracy; + rec.analog_flags = p_rec->analog_flags; + rec.nominal = p_rec->nominal; + rec.normal_max = p_rec->normal_max; + rec.normal_min = p_rec->normal_min; + rec.max_reading = p_rec->max_reading; + rec.min_reading = p_rec->min_reading; + rec.unr_thresh = p_rec->unr_thresh; + rec.uc_thresh = p_rec->uc_thresh; + rec.unc_thresh = p_rec->unc_thresh; + rec.lnr_thresh = p_rec->lnr_thresh; + rec.lc_thresh = p_rec->lc_thresh; + rec.lnc_thresh = p_rec->lnc_thresh; + rec.pos_hyst = p_rec->pos_hyst; + rec.neg_hyst = p_rec->neg_hyst; + rec.oem = p_rec->oem; + rec.str_type_len = p_rec->str_type_len; + memcpy(rec.str, p_rec->str, SENSOR_STR_SIZE); + + // Copy this record to generic SDR record + memcpy(sdr.rec, &rec, SDR_LEN_MAX); + + // Add this record to SDR repo + if (plat_sdr_add_entry(&sdr, &rec_id)) { + syslog(LOG_ALERT, "sdr_add_thresh_rec: plat_sdr_add_entry failed\n"); + return -1; + } + + return 0; +} + +static int +sdr_add_oem_rec(sensor_oem_t *p_rec) { + int rec_id = 0; + sdr_rec_t sdr = { 0 }; + sdr_oem_t rec = { 0 }; + + // Populate SDR OEM record + rec.ver = SDR_VERSION; + rec.type = SDR_OEM_TYPE; + rec.len = SDR_OEM_LEN; + + memcpy(rec.mfr_id, p_rec->mfr_id, 3); + memcpy(rec.oem_data, p_rec->oem_data, SENSOR_OEM_DATA_SIZE); + + // Copy this record to generic SDR record + memcpy(sdr.rec, &rec, SDR_LEN_MAX); + + // Add this record to SDR repo + if (plat_sdr_add_entry(&sdr, &rec_id)) { + syslog(LOG_ALERT, "sdr_add_oem_rec: plat_sdr_add_entry failed\n"); + return -1; + } + + return 0; +} + +// Platform specific SEL API entry points +// Retrieve time stamp for recent add operation +void +plat_sdr_ts_recent_add(time_stamp_t *ts) { + memcpy(ts->ts, g_sdr_hdr.ts_add.ts, 0x04); +} + +// Retrieve time stamp for recent erase operation +void +plat_sdr_ts_recent_erase(time_stamp_t *ts) { + memcpy(ts->ts, g_sdr_hdr.ts_erase.ts, 0x04); +} + +// Retrieve total number of entries in SDR repo +int +plat_sdr_num_entries(void) { + return (g_sdr_hdr.end - g_sdr_hdr.begin); +} + +// Retrieve total free space available in SDR repo +int +plat_sdr_free_space(void) { + int total_space; + int used_space; + + total_space = SDR_RECORDS_MAX * sizeof(sdr_rec_t); + used_space = plat_sdr_num_entries() * sizeof(sdr_rec_t); + + return (total_space - used_space); +} + +// Reserve an ID that will be used in later operations +// IPMI/Section 33.11 +int +plat_sdr_rsv_id() { + // Increment the current reservation ID and return + if (g_rsv_id++ == SDR_RSVID_MAX) { + g_rsv_id = SDR_RSVID_MIN; + } + + return g_rsv_id; +} + +// Get the SDR entry for a given record ID +// IPMI/Section 33.12 +int +plat_sdr_get_entry(int rsv_id, int read_rec_id, sdr_rec_t *rec, + int *next_rec_id) { + + int index; + + // Make sure the rsv_id matches + if (rsv_id != g_rsv_id) { + syslog(LOG_ALERT, "plat_sdr_get_entry: Reservation ID mismatch\n"); + return -1; + } + + // Find the index in to array based on given index + if (read_rec_id == SDR_RECID_FIRST) { + index = g_sdr_hdr.begin; + } else if (read_rec_id == SDR_RECID_LAST) { + index = g_sdr_hdr.end - 1; + } else { + index = read_rec_id - 1; + } + + // If the SDR repo is empty return error + if (plat_sdr_num_entries() == 0) { + syslog(LOG_ALERT, "plat_sdr_get_entry: No entries\n"); + return -1; + } + + // Check for boundary conditions + if ((index < SDR_INDEX_MIN) || (index > SDR_INDEX_MAX)) { + syslog(LOG_ALERT, "plat_sdr_get_entry: Invalid Record ID %d\n", read_rec_id); + return -1; + } + + // Check to make sure the given id is valid + if (index < g_sdr_hdr.begin || index >= g_sdr_hdr.end) { + syslog(LOG_ALERT, "plat_sdr_get_entry: Wrong Record ID %d\n", read_rec_id); + return -1; + } + + memcpy(rec->rec, g_sdr_data[index].rec, sizeof(sdr_rec_t)); + + // Return the next record ID in the log + *next_rec_id = ++read_rec_id; + + // If this is the last entry in the log, return 0xFFFF + if (*next_rec_id == g_sdr_hdr.end) { + *next_rec_id = SDR_RECID_LAST; + } + + return 0; +} + + +// Initialize SDR Repo structure +int +plat_sdr_init(void) { + int num; + sensor_mgmt_t *p_mgmt; + sensor_thresh_t *p_thresh; + sensor_disc_t *p_disc; + sensor_oem_t *p_oem; + + // Populate SDR Header + g_sdr_hdr.magic = SDR_HDR_MAGIC; + g_sdr_hdr.version = SDR_HDR_VERSION; + g_sdr_hdr.begin = SDR_INDEX_MIN; + g_sdr_hdr.end = SDR_INDEX_MIN; + memset(g_sdr_hdr.ts_add.ts, 0x0, 4); + memset(g_sdr_hdr.ts_erase.ts, 0x0, 4); + + // Populate all mgmt control sensors + plat_sensor_mgmt_info(&num, &p_mgmt); + for (int i = 0; i < num; i++) { + sdr_add_mgmt_rec(&p_mgmt[i]); + } + + // Populate all discrete sensors + plat_sensor_disc_info(&num, &p_disc); + for (int i = 0; i < num; i++) { + sdr_add_disc_rec(&p_disc[i]); + } + + // Populate all threshold sensors + plat_sensor_thresh_info(&num, &p_thresh); + for (int i = 0; i < num; i++) { + sdr_add_thresh_rec(&p_thresh[i]); + } + + // Populate all OEM sensors + plat_sensor_oem_info(&num, &p_oem); + for (int i = 0; i < num; i++) { + sdr_add_oem_rec(&p_oem[i]); + } + + return 0; +} diff --git a/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/sdr.h b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/sdr.h new file mode 100644 index 0000000..5e2a591 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/sdr.h @@ -0,0 +1,132 @@ +/* + * + * Copyright 2014-present Facebook. All Rights Reserved. + * + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SDR_H__ +#define __SDR_H__ + +#include "timestamp.h" + +typedef struct { + unsigned char rec[64]; +} sdr_rec_t; + +// Full Sensor SDR record; IPMI/Section 43.1 +typedef struct { + // Sensor Record Header + unsigned char rec_id[2]; + unsigned char ver; + unsigned char type; + unsigned char len; + // Record Key Bytes + unsigned char owner; + unsigned char lun; + unsigned char sensor_num; + // Record Body Bytes + unsigned char ent_id; + unsigned char ent_inst; + unsigned char sensor_init; + unsigned char sensor_caps; + unsigned char sensor_type; + unsigned char evt_read_type; + union { + unsigned char assert_evt_mask[2]; + unsigned char lt_read_mask[2]; + }; + union { + unsigned char deassert_evt_mask[2]; + unsigned char ut_read_mask[2]; + }; + union { + unsigned char read_evt_mask[2]; + unsigned char set_thresh_mask[2]; + }; + unsigned char sensor_units1; + unsigned char sensor_units2; + unsigned char sensor_units3; + unsigned char linear; + unsigned char m_val; + unsigned char m_tolerance; + unsigned char b_val; + unsigned char b_accuracy; + unsigned char accuracy_dir; + unsigned char rb_exp; + unsigned char analog_flags; + unsigned char nominal; + unsigned char normal_max; + unsigned char normal_min; + unsigned char max_reading; + unsigned char min_reading; + unsigned char unr_thresh; + unsigned char uc_thresh; + unsigned char unc_thresh; + unsigned char lnr_thresh; + unsigned char lc_thresh; + unsigned char lnc_thresh; + unsigned char pos_hyst; + unsigned char neg_hyst; + unsigned char rsvd[2]; + unsigned char oem; + unsigned char str_type_len; + char str[16]; +} sdr_full_t; + +// Mgmt. Controller SDR record; IPMI/ Section 43.9 +typedef struct { + // Sensor Record Header + unsigned char rec_id[2]; + unsigned char ver; + unsigned char type; + unsigned char len; + // Record Key Bytes + unsigned char slave_addr; + unsigned char chan_no; + // Record Body Bytes + unsigned char pwr_state_init; + unsigned char dev_caps; + unsigned char rsvd[3]; + unsigned char ent_id; + unsigned char ent_inst; + unsigned char oem; + unsigned char str_type_len; + char str[16]; +} sdr_mgmt_t; + +// OEM type SDR record; IPMI/Section 43.12 +typedef struct { + // Sensor Record Header + unsigned char rec_id[2]; + unsigned char ver; + unsigned char type; + unsigned char len; + // Record Body Bytes + unsigned char mfr_id[3]; + unsigned char oem_data[56]; +} sdr_oem_t; + +void plat_sdr_ts_recent_add(time_stamp_t *ts); +void plat_sdr_ts_recent_erase(time_stamp_t *ts); +int plat_sdr_num_entries(void); +int plat_sdr_free_space(void); +int plat_sdr_rsv_id(); +int plat_sdr_get_entry(int rsv_id, int read_rec_id, sdr_rec_t *rec, + int *next_rec_id); +int plat_sdr_init(void); + +#endif /* __SDR_H__ */ diff --git a/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/sel.c b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/sel.c new file mode 100644 index 0000000..a7aa78f --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/sel.c @@ -0,0 +1,438 @@ +/* + * + * Copyright 2014-present Facebook. All Rights Reserved. + * + * This file represents platform specific implementation for storing + * SEL logs and acts as back-end for IPMI stack + * + * TODO: Optimize the file handling to keep file open always instead of + * current open/seek/close + * + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include "sel.h" +#include "timestamp.h" +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#include <syslog.h> +#include <string.h> + +// SEL File. +#define SEL_LOG_FILE "/mnt/data/sel.bin" + +// SEL Header magic number +#define SEL_HDR_MAGIC 0xFBFBFBFB + +// SEL Header version number +#define SEL_HDR_VERSION 0x01 + +// SEL Data offset from file beginning +#define SEL_DATA_OFFSET 0x100 + +// SEL reservation IDs can not be 0x00 or 0xFFFF +#define SEL_RSVID_MIN 0x01 +#define SEL_RSVID_MAX 0xFFFE + +// Number of SEL records before wrap +#define SEL_RECORDS_MAX 128 // TODO: Based on need we can make it bigger +#define SEL_ELEMS_MAX (SEL_RECORDS_MAX+1) + +// Index for circular array +#define SEL_INDEX_MIN 0x00 +#define SEL_INDEX_MAX SEL_RECORDS_MAX + +// Record ID can not be 0x0 (IPMI/Section 31) +#define SEL_RECID_MIN (SEL_INDEX_MIN+1) +#define SEL_RECID_MAX (SEL_INDEX_MAX+1) + +// Special RecID value for first and last (IPMI/Section 31) +#define SEL_RECID_FIRST 0x0000 +#define SEL_RECID_LAST 0xFFFF + +// SEL header struct to keep track of SEL Log entries +typedef struct { + int magic; // Magic number to check validity + int version; // version number of this header + int begin; // index to the begining of the log + int end; // index to end of the log + time_stamp_t ts_add; // last addition time stamp + time_stamp_t ts_erase; // last erase time stamp +} sel_hdr_t; + +// Keep track of last Reservation ID +static int g_rsv_id = 0x01; + +// Cached version of SEL Header and data +static sel_hdr_t g_sel_hdr; +static sel_msg_t g_sel_data[SEL_ELEMS_MAX]; + +// Local helper functions to interact with file system +static int +file_get_sel_hdr(void) { + FILE *fp; + + fp = fopen(SEL_LOG_FILE, "r"); + if (fp == NULL) { + return -1; + } + + if (fread(&g_sel_hdr, sizeof(sel_hdr_t), 1, fp) <= 0) { + syslog(LOG_ALERT, "file_get_sel_hdr: fread\n"); + fclose (fp); + return -1; + } + + fclose(fp); + return 0; +} + +static int +file_get_sel_data(void) { + FILE *fp; + + fp = fopen(SEL_LOG_FILE, "r"); + if (fp == NULL) { + syslog(LOG_ALERT, "file_get_sel_data: fopen\n"); + return -1; + } + + if (fseek(fp, SEL_DATA_OFFSET, SEEK_SET)) { + syslog(LOG_ALERT, "file_get_sel_data: fseek\n"); + fclose(fp); + return -1; + } + + unsigned char buf[SEL_ELEMS_MAX * 16]; + if (fread(buf, 1, SEL_ELEMS_MAX * sizeof(sel_msg_t), fp) <= 0) { + syslog(LOG_ALERT, "file_get_sel_data: fread\n"); + fclose(fp); + return -1; + } + + fclose(fp); + + for (int i = 0; i < SEL_ELEMS_MAX; i++) { + for (int j = 0; j < sizeof(sel_msg_t);j++) { + g_sel_data[i].msg[j] = buf[i*16 + j]; + } + } + + return 0; +} + +static int +file_store_sel_hdr(void) { + FILE *fp; + + fp = fopen(SEL_LOG_FILE, "r+"); + if (fp == NULL) { + syslog(LOG_ALERT, "file_store_sel_hdr: fopen\n"); + return -1; + } + + if (fwrite(&g_sel_hdr, sizeof(sel_hdr_t), 1, fp) <= 0) { + syslog(LOG_ALERT, "file_store_sel_hdr: fwrite\n"); + fclose(fp); + return -1; + } + + fclose(fp); + + return 0; +} + +static int +file_store_sel_data(int recId, sel_msg_t *data) { + FILE *fp; + int index; + + fp = fopen(SEL_LOG_FILE, "r+"); + if (fp == NULL) { + syslog(LOG_ALERT, "file_store_sel_data: fopen\n"); + return -1; + } + + // Records are stored using zero-based index + index = (recId-1) * sizeof(sel_msg_t); + + if (fseek(fp, SEL_DATA_OFFSET+index, SEEK_SET)) { + syslog(LOG_ALERT, "file_store_sel_data: fseek\n"); + fclose(fp); + return -1; + } + + if (fwrite(data->msg, sizeof(sel_msg_t), 1, fp) <= 0) { + syslog(LOG_ALERT, "file_store_sel_data: fwrite\n"); + fclose(fp); + return -1; + } + + fclose(fp); + + return 0; +} + +// Platform specific SEL API entry points +// Retrieve time stamp for recent add operation +void +plat_sel_ts_recent_add(time_stamp_t *ts) { + memcpy(ts->ts, g_sel_hdr.ts_add.ts, 0x04); +} + +// Retrieve time stamp for recent erase operation +void +plat_sel_ts_recent_erase(time_stamp_t *ts) { + memcpy(ts->ts, g_sel_hdr.ts_erase.ts, 0x04); +} + +// Retrieve total number of entries in SEL log +int +plat_sel_num_entries(void) { + if (g_sel_hdr.begin <= g_sel_hdr.end) { + return (g_sel_hdr.end - g_sel_hdr.begin); + } else { + return (g_sel_hdr.end + (SEL_INDEX_MAX - g_sel_hdr.begin + 1)); + } +} + +// Retrieve total free space available in SEL log +int +plat_sel_free_space(void) { + int total_space; + int used_space; + + total_space = SEL_RECORDS_MAX * sizeof(sel_msg_t); + used_space = plat_sel_num_entries() * sizeof(sel_msg_t); + + return (total_space - used_space); +} + +// Reserve an ID that will be used in later operations +// IPMI/Section 31.4 +int +plat_sel_rsv_id() { + // Increment the current reservation ID and return + if (g_rsv_id++ == SEL_RSVID_MAX) { + g_rsv_id = SEL_RSVID_MIN; + } + + return g_rsv_id; +} + +// Get the SEL entry for a given record ID +// IPMI/Section 31.5 +int +plat_sel_get_entry(int read_rec_id, sel_msg_t *msg, int *next_rec_id) { + + int index; + + // Find the index in to array based on given index + if (read_rec_id == SEL_RECID_FIRST) { + index = g_sel_hdr.begin; + } else if (read_rec_id == SEL_RECID_LAST) { + if (g_sel_hdr.end) { + index = g_sel_hdr.end - 1; + } else { + index = SEL_INDEX_MAX; + } + } else { + index = read_rec_id - 1; + } + + // If the log is empty return error + if (plat_sel_num_entries() == 0) { + syslog(LOG_ALERT, "plat_sel_get_entry: No entries\n"); + return -1; + } + + // Check for boundary conditions + if ((index < SEL_INDEX_MIN) || (index > SEL_INDEX_MAX)) { + syslog(LOG_ALERT, "plat_sel_get_entry: Invalid Record ID %d\n", read_rec_id); + return -1; + } + + // If begin < end, check to make sure the given id falls between + if (g_sel_hdr.begin < g_sel_hdr.end) { + if (index < g_sel_hdr.begin || index >= g_sel_hdr.end) { + syslog(LOG_ALERT, "plat_sel_get_entry: Wrong Record ID %d\n", read_rec_id); + return -1; + } + } + + // If end < begin, check to make sure the given id is valid + if (g_sel_hdr.begin > g_sel_hdr.end) { + if (index >= g_sel_hdr.end && index < g_sel_hdr.begin) { + syslog(LOG_ALERT, "plat_sel_get_entry: Wrong Record ID2 %d\n", read_rec_id); + return -1; + } + } + + memcpy(msg->msg, g_sel_data[index].msg, sizeof(sel_msg_t)); + + // Return the next record ID in the log + *next_rec_id = read_rec_id++; + if (*next_rec_id > SEL_INDEX_MAX) { + *next_rec_id = SEL_INDEX_MIN; + } + + // If this is the last entry in the log, return 0xFFFF + if (*next_rec_id == g_sel_hdr.end) { + *next_rec_id = SEL_RECID_LAST; + } + + return 0; +} + +// Add a new entry in to SEL log +// IPMI/Section 31.6 +int +plat_sel_add_entry(sel_msg_t *msg, int *rec_id) { + // If the SEL if full, roll over. To keep track of empty condition, use + // one empty location less than the max records. + if (plat_sel_num_entries() == SEL_RECORDS_MAX) { + syslog(LOG_ALERT, "plat_sel_add_entry: SEL rollover\n"); + if (++g_sel_hdr.begin > SEL_INDEX_MAX) { + g_sel_hdr.begin = SEL_INDEX_MIN; + } + } + + // Update message's time stamp starting at byte 4 + time_stamp_fill(&msg->msg[3]); + + // Add the enry at end + memcpy(g_sel_data[g_sel_hdr.end].msg, msg->msg, sizeof(sel_msg_t)); + + // Return the newly added record ID + *rec_id = g_sel_hdr.end+1; + + if (file_store_sel_data(*rec_id, msg)) { + syslog(LOG_ALERT, "plat_sel_add_entry: file_store_sel_data\n"); + return -1; + } + + // Increment the end pointer + if (++g_sel_hdr.end > SEL_INDEX_MAX) { + g_sel_hdr.end = SEL_INDEX_MIN; + } + + // Update timestamp for add in header + time_stamp_fill(g_sel_hdr.ts_add.ts); + + // Store the structure persistently + if (file_store_sel_hdr()) { + syslog(LOG_ALERT, "plat_sel_add_entry: file_store_sel_hdr\n"); + return -1; + } + + return 0; +} + +// Erase the SEL completely +// IPMI/Section 31.9 +// Note: To reduce wear/tear, instead of erasing, manipulating the metadata +int +plat_sel_erase(int rsv_id) { + if (rsv_id != g_rsv_id) { + return -1; + } + + // Erase SEL Logs + g_sel_hdr.begin = SEL_INDEX_MIN; + g_sel_hdr.end = SEL_INDEX_MIN; + + // Update timestamp for erase in header + time_stamp_fill(g_sel_hdr.ts_erase.ts); + + // Store the structure persistently + if (file_store_sel_hdr()) { + syslog(LOG_ALERT, "plat_sel_erase: file_store_sel_hdr\n"); + return -1; + } + + return 0; +} + +// To get the erase status while erase happens +// IPMI/Section 31.2 +// Note: Since we are not doing offline erasing, need not return in-progress state +int +plat_sel_erase_status(int rsv_id, sel_erase_stat_t *status) { + if (rsv_id != g_rsv_id) { + return -1; + } + + // Since we do not do any offline erasing, always return erase done + *status = SEL_ERASE_DONE; + + return 0; +} + +// Initialize SEL log file +int +plat_sel_init(void) { + FILE *fp; + + // Check if the file exists or not + if (access(SEL_LOG_FILE, F_OK) == 0) { + // Since file is present, fetch all the contents to cache + if (file_get_sel_hdr()) { + syslog(LOG_ALERT, "plat_init_sel: file_get_sel_hdr\n"); + return -1; + } + + if (file_get_sel_data()) { + syslog(LOG_ALERT, "plat_init_sel: file_get_sel_data\n"); + return -1; + } + + return 0; + } + + // File not present, so create the file + fp = fopen(SEL_LOG_FILE, "w+"); + if (fp == NULL) { + syslog(LOG_ALERT, "plat_init_sel: fopen\n"); + return -1; + } + + fclose (fp); + + // Populate SEL Header in to the file + g_sel_hdr.magic = SEL_HDR_MAGIC; + g_sel_hdr.version = SEL_HDR_VERSION; + g_sel_hdr.begin = SEL_INDEX_MIN; + g_sel_hdr.end = SEL_INDEX_MIN; + memset(g_sel_hdr.ts_add.ts, 0x0, 4); + memset(g_sel_hdr.ts_erase.ts, 0x0, 4); + + if (file_store_sel_hdr()) { + syslog(LOG_ALERT, "plat_init_sel: file_store_sel_hdr\n"); + return -1; + } + + // Populate SEL Data in to the file + for (int i = 1; i <= SEL_RECORDS_MAX; i++) { + sel_msg_t msg = {0}; + if (file_store_sel_data(i, &msg)) { + syslog(LOG_ALERT, "plat_init_sel: file_store_sel_data\n"); + return -1; + } + } + + return 0; +} diff --git a/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/sel.h b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/sel.h new file mode 100644 index 0000000..81dbcdf --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/sel.h @@ -0,0 +1,51 @@ +/* + * + * Copyright 2014-present Facebook. All Rights Reserved. + * + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SEL_H__ +#define __SEL_H__ + +#include "timestamp.h" + +enum { + IPMI_SEL_INIT_ERASE = 0xAA, + IPMI_SEL_ERASE_STAT = 0x00, +}; + +typedef enum { + SEL_ERASE_IN_PROG = 0x00, + SEL_ERASE_DONE = 0x01, +} sel_erase_stat_t; + +typedef struct { + unsigned char msg[16]; +} sel_msg_t; + +void plat_sel_ts_recent_add(time_stamp_t *ts); +void plat_sel_ts_recent_erase(time_stamp_t *ts); +int plat_sel_num_entries(void); +int plat_sel_free_space(void); +int plat_sel_rsv_id(); +int plat_sel_get_entry(int read_rec_id, sel_msg_t *msg, int *next_rec_id); +int plat_sel_add_entry(sel_msg_t *msg, int *rec_id); +int plat_sel_erase(int rsv_id); +int plat_sel_erase_status(int rsv_id, sel_erase_stat_t *status); +int plat_sel_init(void); + +#endif /* __SEL_H__ */ diff --git a/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/sensor.h b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/sensor.h new file mode 100644 index 0000000..5d8c11a --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/sensor.h @@ -0,0 +1,117 @@ +/* + * + * Copyright 2014-present Facebook. All Rights Reserved. + * + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SENSOR_H__ +#define __SENSOR_H__ + +#include "timestamp.h" + +#define IANA_ID_SIZE 3 +#define SENSOR_STR_SIZE 16 +#define SENSOR_OEM_DATA_SIZE 56 + +// Threshold Sensor Descriptor +typedef struct { + unsigned char owner; + unsigned char lun; + unsigned char sensor_num; + unsigned char ent_id; + unsigned char ent_inst; + unsigned char sensor_init; + unsigned char sensor_caps; + unsigned char sensor_type; + unsigned char evt_read_type; + unsigned char lt_read_mask[2]; + unsigned char ut_read_mask[2]; + unsigned char set_thresh_mask[2]; + unsigned char sensor_units1; + unsigned char sensor_units2; + unsigned char sensor_units3; + unsigned char linear; + unsigned char m_val; + unsigned char m_tolerance; + unsigned char b_val; + unsigned char b_accuracy; + unsigned char accuracy_dir; + unsigned char rb_exp; + unsigned char analog_flags; + unsigned char nominal; + unsigned char normal_max; + unsigned char normal_min; + unsigned char max_reading; + unsigned char min_reading; + unsigned char unr_thresh; + unsigned char uc_thresh; + unsigned char unc_thresh; + unsigned char lnr_thresh; + unsigned char lc_thresh; + unsigned char lnc_thresh; + unsigned char pos_hyst; + unsigned char neg_hyst; + unsigned char oem; + unsigned char str_type_len; + char str[SENSOR_STR_SIZE]; +} sensor_thresh_t; + +// Discrete Sensor Descriptor +typedef struct { + unsigned char owner; + unsigned char lun; + unsigned char sensor_num; + unsigned char ent_id; + unsigned char ent_inst; + unsigned char sensor_init; + unsigned char sensor_caps; + unsigned char sensor_type; + unsigned char evt_read_type; + unsigned char assert_evt_mask[2]; + unsigned char deassert_evt_mask[2]; + unsigned char read_evt_mask[2]; + unsigned char oem; + unsigned char str_type_len; + char str[SENSOR_STR_SIZE]; +} sensor_disc_t; + +// Mgmt. Controller Sensor Descriptor +typedef struct { + unsigned char slave_addr; + unsigned char chan_no; + unsigned char pwr_state_init; + unsigned char dev_caps; + unsigned char ent_id; + unsigned char ent_inst; + unsigned char oem; + unsigned char str_type_len; + char str[SENSOR_STR_SIZE]; +} sensor_mgmt_t; + +// OEM type Sensor Descriptor +typedef struct { + unsigned char mfr_id[IANA_ID_SIZE]; + unsigned char oem_data[SENSOR_OEM_DATA_SIZE]; +} sensor_oem_t; + +void plat_sensor_mgmt_info(int *num, sensor_mgmt_t **p_sensor); +void plat_sensor_disc_info(int *num, sensor_disc_t **p_sensor); +void plat_sensor_thresh_info(int *num, sensor_thresh_t **p_sensor); +void plat_sensor_oem_info(int *num, sensor_oem_t **p_sensor); +int plat_sensor_init(void); + +#endif /* __SENSOR_H__ */ diff --git a/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/timestamp.c b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/timestamp.c new file mode 100644 index 0000000..11ac03e --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/timestamp.c @@ -0,0 +1,46 @@ +/* + * + * Copyright 2014-present Facebook. All Rights Reserved. + * + * This file is a helper file to fill timestamps from platform + * used by SEL Logs, SDR records etc. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#include <syslog.h> +#include <string.h> +#include <sys/time.h> +#include <time.h> + +// Local helper function to fill time stamp +void +time_stamp_fill(unsigned char *ts) { + unsigned int time; + struct timeval tv; + + gettimeofday(&tv, NULL); + + time = tv.tv_sec; + ts[0] = time & 0xFF; + ts[1] = (time >> 8) & 0xFF; + ts[2] = (time >> 16) & 0xFF; + ts[3] = (time >> 24) & 0xFF; + + return; +} diff --git a/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/timestamp.h b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/timestamp.h new file mode 100644 index 0000000..430dd23 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/timestamp.h @@ -0,0 +1,30 @@ +/* + * + * Copyright 2014-present Facebook. All Rights Reserved. + * + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __TIMESTAMP_H__ +#define __TIMESTAMP_H__ + +typedef struct { + unsigned char ts[4]; +} time_stamp_t; + +void time_stamp_fill(unsigned char *ts); + +#endif /* __TIMESTAMP_H__ */ diff --git a/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/wedge/fruid.c b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/wedge/fruid.c new file mode 100644 index 0000000..5076ebe --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/wedge/fruid.c @@ -0,0 +1,185 @@ +/* + * + * Copyright 2015-present Facebook. All Rights Reserved. + * + * This file provides platform specific implementation of FRUID information + * + * FRUID specification can be found at + * www.intel.com/content/dam/www/public/us/en/documents/product-briefs/platform-management-fru-document-rev-1-2-feb-2013.pdf + * + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "../fruid.h" +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#include <syslog.h> +#include <string.h> +//#include <facebook/wedge_eeprom.h> + +#define WEDGE_FRUID_SIZE 0x100 + +#define COMMON_HDR_VER 1 +#define PROD_INFO_VER 1 + +#define PROD_INFO_AREA_OFFSET 0x10 +#define PROD_INFO_CKSUM_OFFSET (PROD_INFO_AREA_OFFSET + 1) +#define LANG_CODE_ENGLISH 25 +#define TYPE_STR 0xC0 +#define TYPE_LAST 0xC1 +#define ZERO_CKSUM_CONST 0x100 +#define LEN_BYTE_SIZE 8 + +typedef struct _fruid_common_hdr_t { + unsigned char ver; + unsigned char internal_use_area_offset; + unsigned char chassis_info_area_offset; + unsigned char board_info_area_offset; + unsigned char prod_info_area_offset; + unsigned char multi_record_area_offset; + unsigned char padding; + unsigned char cksum; +} fruid_common_hdr_t; + +// Global structures +static unsigned char g_fruid[WEDGE_FRUID_SIZE] = {0}; + +static void +populate_fruid(void) { + + memset(&g_fruid, sizeof(g_fruid), 0); + +#if 0 + fruid_common_hdr_t *chdr = g_fruid; + + // Set Common Header version + chdr->ver = COMMON_HDR_VER; + + // Product Info Area offset in multiples of 8 bytes + chdr->prod_info_area_offset = PROD_INFO_AREA_OFFSET/LEN_BYTE_SIZE; + + // Calculate zero checksum + chdr->cksum = chdr->ver + chdr->prod_info_area_offset; + chdr->cksum = ZERO_CKSUM_CONST - chdr->cksum; + + // Retrieve Wedge EEPROM content + struct wedge_eeprom_st eeprom; + int rc = 0; + rc = wedge_eeprom_parse(NULL, &eeprom); + if (rc) + { + syslog(LOG_ALERT, "populate_fruid: wedge_eeprom_parse returns %d\n", rc); + return; + } + + // Start index at beginning of product info area + int i = PROD_INFO_AREA_OFFSET; + g_fruid[i++] = PROD_INFO_VER; + g_fruid[i++] = 0x00; // prod area length; filled at end + g_fruid[i++] = LANG_CODE_ENGLISH; + +#define _APPEND_STR_VALUE(name) do { \ + if (sizeof(name) < 1 || i + 1 + sizeof(name) >= sizeof(g_fruid)) { \ + break; \ + } \ + g_fruid[i++] = TYPE_STR + sizeof(name); \ + memcpy(&g_fruid[i], name, sizeof(name)); \ + i += sizeof(name); \ +} while(0) + + // Fill system manufacturer field + + _APPEND_STR_VALUE(eeprom.fbw_system_manufacturer); + + // Fill product name field + _APPEND_STR_VALUE(eeprom.fbw_product_name); + + // Fill product number field + _APPEND_STR_VALUE(eeprom.fbw_product_number); + + // convert product version to string and fill + char vbuf[5] = {0}; + snprintf(vbuf, sizeof(vbuf), "%0X", eeprom.fbw_product_version); + _APPEND_STR_VALUE(vbuf); + + // Fill product serial number field + _APPEND_STR_VALUE(eeprom.fbw_product_serial); + + // Fill product asset tag field + _APPEND_STR_VALUE(eeprom.fbw_product_asset); + + // Fill fruid file with dummy file name + char fruid_file_name[] = "fruid_1.0"; + _APPEND_STR_VALUE(fruid_file_name); + + // Field to indicate the last entry + g_fruid[i++] = TYPE_LAST; + + // length of the area in multiples of 8 bytes + int len = i-PROD_INFO_AREA_OFFSET+1; + if (len % LEN_BYTE_SIZE){ + // For non-multiple of 8 bytes, add one for partial data + g_fruid[PROD_INFO_CKSUM_OFFSET] = len/LEN_BYTE_SIZE + 1; + // And also increment index to keep checksum byte + i += (len % LEN_BYTE_SIZE); + } else { + g_fruid[PROD_INFO_CKSUM_OFFSET] = len/LEN_BYTE_SIZE; + } + + // Calculate zero checksum by adding all the values in product info area + for (int j = PROD_INFO_AREA_OFFSET; j < i; j++) { + g_fruid[i] += g_fruid[j]; + } + + // Calculate final cksum by subtraction + g_fruid[i] = ZERO_CKSUM_CONST - g_fruid[i]; + +#undef _APPEND_STR_VALUE +#endif + + return; +} + +// Access functions for FRUID +int +plat_fruid_size(void) { + return WEDGE_FRUID_SIZE; +} + +int +plat_fruid_data(int offset, int count, unsigned char *data) { + // Check for the boundary condition + if ((offset + count) > WEDGE_FRUID_SIZE) { + return -1; + } + + // Copy the FRUID content from the global structure + memcpy(data, &(g_fruid[offset]), count); + + return 0; +} + +// Initialize FRUID +int +plat_fruid_init(void) { + + // Populate FRUID global structure + populate_fruid(); + + return 0; +} diff --git a/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/wedge/sensor.c b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/wedge/sensor.c new file mode 100644 index 0000000..ce3d4fb --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/ipmid/files/platform/wedge/sensor.c @@ -0,0 +1,371 @@ +/* + * + * Copyright 2014-present Facebook. All Rights Reserved. + * + * This file provides platform specific implementation of sensor information + * + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include "../sensor.h" +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#include <syslog.h> +#include <string.h> + +#define SENSOR_MGMT_MAX 1 +#define SENSOR_DISC_MAX 8 +#define SENSOR_THRESH_MAX 1 +#define SENSOR_OEM_MAX 1 + +#define BMC_SLAVE_ADDR 0x20 + +typedef struct { + unsigned char num; + sensor_mgmt_t sensor[SENSOR_MGMT_MAX]; +} sensor_mgmt_info_t; + +typedef struct { + unsigned char num; + sensor_disc_t sensor[SENSOR_DISC_MAX]; +} sensor_disc_info_t; + +typedef struct { + unsigned char num; + sensor_thresh_t sensor[SENSOR_THRESH_MAX]; +} sensor_thresh_info_t; + +typedef struct { + unsigned char num; + sensor_oem_t sensor[SENSOR_OEM_MAX]; +} sensor_oem_info_t; + +// Global structures +static sensor_mgmt_info_t g_sensor_mgmt = {0}; +static sensor_disc_info_t g_sensor_disc = {0}; +static sensor_thresh_info_t g_sensor_thresh = {0}; +static sensor_oem_info_t g_sensor_oem = {0}; + +static void +populate_mgmt_sensors(void) { + sensor_mgmt_t sensor = {0}; + + // Add record for the AST2100 BMC + sensor.slave_addr = BMC_SLAVE_ADDR; + sensor.chan_no = 0x0; // Primary BMC controller + + // Init Agent = false + sensor.pwr_state_init = 0x00; + + // FRUID = true, SEL = true, SDR = true, Sensor = true + sensor.dev_caps = 0x0F; + + // Device ID string + // Type - 0xC0: ASCII, Length - 0x09 + sensor.str_type_len = 0xC0 + 0x09; + strncpy(sensor.str, "Wedge-BMC", 0x09); + + // Add this sensor to the global table + if (g_sensor_mgmt.num >= SENSOR_MGMT_MAX) { + syslog(LOG_ALERT, "populate_mgmt_sensors: num exceeded\n"); + return; + } + + memcpy(&g_sensor_mgmt.sensor[g_sensor_mgmt.num], &sensor, sizeof(sensor_mgmt_t)); + + g_sensor_mgmt.num++; + + return; +} + +static void +populate_disc_sensors(void) { + + sensor_disc_t sensor = {0}; + + // Sensor uS Status + // Sensor# 0x10 + // EntitiyId# 0xD0, EntityInst# 0x00 + // Sensor Type# Chassis 0x18 + // Event Read/Type# OEM 0x70 + sensor.owner= BMC_SLAVE_ADDR; + sensor.lun = 0x00; + sensor.sensor_num = 0x10; + + sensor.ent_id = 0xD0; + sensor.ent_inst = 0x00; + // Enable Scanning, Enable Events + sensor.sensor_init = 0x63; + // Supports Auto Re-Arm + sensor.sensor_caps = 0x40; + sensor.sensor_type = 0x18; + sensor.evt_read_type = 0x70; + // 1-bit for CPU0 Thermal Trip + sensor.assert_evt_mask[0] = 0x04; + sensor.deassert_evt_mask[0] = 0x00; + sensor.read_evt_mask[0] = 0x04; + + // Device ID string + // Type - 0xC0: ASCII, Length - 12 + sensor.str_type_len = 0xC0 + 9; + strncpy(sensor.str, "uS-Status", 9); + + // Add this sensor to the global table + if (g_sensor_disc.num >= SENSOR_DISC_MAX) { + syslog(LOG_ALERT, "populate_disc_sensors: num exceeded\n"); + return; + } + + memcpy(&g_sensor_disc.sensor[g_sensor_disc.num], &sensor, sizeof(sensor_disc_t)); + + g_sensor_disc.num++; + + // Sensor SEL Status + // Sensor# 0x5F + // EntitiyId# 0xD0, EntityInst# 0x02 + // Sensor Type# OEM: 0xC0 + // Event Read/Type# Sensor Specific: 0x6F + sensor.owner= BMC_SLAVE_ADDR; + sensor.lun = 0x00; + sensor.sensor_num = 0x5F; + + sensor.ent_id = 0xD0; + sensor.ent_inst = 0x02; + // Enable Scanning, Enable Events + sensor.sensor_init = 0x63; + // Supports Auto Re-Arm + sensor.sensor_caps = 0x40; + sensor.sensor_type = 0xC0; + sensor.evt_read_type = 0x6F; + // SEL Clear(bit1), SEL Rollover(bit8) + sensor.assert_evt_mask[0] = 0x02; + sensor.assert_evt_mask[1] = 0x01; + sensor.deassert_evt_mask[0] = 0x00; + sensor.deassert_evt_mask[1] = 0x00; + sensor.read_evt_mask[0] = 0x02; + sensor.read_evt_mask[1] = 0x01; + + // Device ID string + // Type - 0xC0: ASCII, Length - 12 + sensor.str_type_len = 0xC0 + 10; + strncpy(sensor.str, "SEL-Status", 10); + + // Add this sensor to the global table + if (g_sensor_disc.num >= SENSOR_DISC_MAX) { + syslog(LOG_ALERT, "populate_disc_sensors: num exceeded\n"); + return; + } + + memcpy(&g_sensor_disc.sensor[g_sensor_disc.num], &sensor, sizeof(sensor_disc_t)); + + g_sensor_disc.num++; + + + // Sensor WDT + // Sensor# 0x60 + // EntitiyId# 0xD0, EntityInst# 0x03 + // Sensor Type# WDT2: 0x23 + // Event Read/Type# Sensor Specific: 0x6F + sensor.owner= BMC_SLAVE_ADDR; + sensor.lun = 0x00; + sensor.sensor_num = 0x60; + + sensor.ent_id = 0xD0; + sensor.ent_inst = 0x03; + // Enable Scanning, Enable Events + sensor.sensor_init = 0x63; + // Supports Auto Re-Arm + sensor.sensor_caps = 0x40; + sensor.sensor_type = 0x23; + sensor.evt_read_type = 0x6F; + // 5 bits for expiry, reset, pwrdown, pwrcycle, timer + sensor.assert_evt_mask[0] = 0x0F; + sensor.assert_evt_mask[1] = 0x01; + sensor.deassert_evt_mask[0] = 0x00; + sensor.deassert_evt_mask[1] = 0x00; + sensor.read_evt_mask[0] = 0x0F; + sensor.read_evt_mask[1] = 0x01; + + // Device ID string + // Type - 0xC0: ASCII, Length - 12 + sensor.str_type_len = 0xC0 + 3; + strncpy(sensor.str, "WDT", 3); + + // Add this sensor to the global table + if (g_sensor_disc.num >= SENSOR_DISC_MAX) { + syslog(LOG_ALERT, "populate_disc_sensors: num exceeded\n"); + return; + } + + memcpy(&g_sensor_disc.sensor[g_sensor_disc.num], &sensor, sizeof(sensor_disc_t)); + + g_sensor_disc.num++; + + + // Sensor Chassis Pwr Sts + // Sensor# 0x70 + // EntitiyId# 0x15, EntityInst# 0x00 + // Sensor Type# OEM: 0xC8 + // Event Read/Type# Sensor Specific: 0x6F + sensor.owner= BMC_SLAVE_ADDR; + sensor.lun = 0x00; + sensor.sensor_num = 0x70; + + sensor.ent_id = 0x15; + sensor.ent_inst = 0x00; + // Enable Scanning, Enable Events + sensor.sensor_init = 0x63; + // Supports Auto Re-Arm + sensor.sensor_caps = 0x40; + sensor.sensor_type = 0xC8; + sensor.evt_read_type = 0x6F; + // 6 bits for pwroff, pwrcycle, pwron, softdown, ac-lost, hard-reset + sensor.assert_evt_mask[0] = 0x3F; + sensor.deassert_evt_mask[0] = 0x00; + sensor.read_evt_mask[0] = 0x3F; + + // Device ID string + // Type - 0xC0: ASCII, Length - 12 + sensor.str_type_len = 0xC0 + 13; + strncpy(sensor.str, "CH-Pwr-Status", 13); + + // Add this sensor to the global table + if (g_sensor_disc.num >= SENSOR_DISC_MAX) { + syslog(LOG_ALERT, "populate_disc_sensors: num exceeded\n"); + return; + } + + memcpy(&g_sensor_disc.sensor[g_sensor_disc.num], &sensor, sizeof(sensor_disc_t)); + + g_sensor_disc.num++; + + // Sensor CPU DIMM Hot + // Sensor# 0xB3 + // EntitiyId# 0xD0, EntityInst# 0x05 + // Sensor Type# OEM 0xC6 + // Event Read/Type# Sensor Specific 6Fh + sensor.owner= BMC_SLAVE_ADDR; + sensor.lun = 0x00; + sensor.sensor_num = 0xB3; + + sensor.ent_id = 0xD0; + sensor.ent_inst = 0x05; + // Enable Scanning, Enable Events + sensor.sensor_init = 0x63; + // Supports Auto Re-Arm + sensor.sensor_caps = 0x40; + sensor.sensor_type = 0xC6; + sensor.evt_read_type = 0x6F; + // Two bits for CPU Hot, DIMM Hot + sensor.assert_evt_mask[0] = 0x05; + sensor.deassert_evt_mask[0] = 0x05; + sensor.read_evt_mask[0] = 0x05; + + // Device ID string + // Type - 0xC0: ASCII, Length - 12 + sensor.str_type_len = 0xC0 + 12; + strncpy(sensor.str, "CPU_DIMM_HOT", 12); + + // Add this sensor to the global table + if (g_sensor_disc.num >= SENSOR_DISC_MAX) { + syslog(LOG_ALERT, "populate_disc_sensors: num exceeded\n"); + return; + } + + memcpy(&g_sensor_disc.sensor[g_sensor_disc.num], &sensor, sizeof(sensor_disc_t)); + + g_sensor_disc.num++; + + // Sensor PMBus Status Word Low + // Sensor PMBus Status Word High + // Sensor PMBus Status MFR + // Sensor PMBus Status Input + // Sensor NTP Status + // Sensor# 0xED + // EntitiyId# 0x35, EntityInst# 0x00 + // Sensor Type# OEM 0xC7 + // Event Read/Type# Sensor Specific 6Fh + sensor.owner= BMC_SLAVE_ADDR; + sensor.lun = 0x00; + sensor.sensor_num = 0xED; + + sensor.ent_id = 0x35; + sensor.ent_inst = 0x00; + // Enable Scanning, Enable Events + sensor.sensor_init = 0x63; + // Supports Auto Re-Arm + sensor.sensor_caps = 0x40; + sensor.sensor_type = 0xC7; + sensor.evt_read_type = 0x6F; + // 1-bit for date/time sync failed + sensor.assert_evt_mask[0] = 0x01; + sensor.deassert_evt_mask[0] = 0x00; + sensor.read_evt_mask[0] = 0x01; + + // Device ID string + // Type - 0xC0: ASCII, Length - 10 + sensor.str_type_len = 0xC0 + 12; + strncpy(sensor.str, "NTP-Status", 10); + + // Add this sensor to the global table + if (g_sensor_disc.num >= SENSOR_DISC_MAX) { + syslog(LOG_ALERT, "populate_disc_sensors: num exceeded\n"); + return; + } + + memcpy(&g_sensor_disc.sensor[g_sensor_disc.num], &sensor, sizeof(sensor_disc_t)); + + g_sensor_disc.num++; + + return; +} + +// Access functions for Sensor Table +void +plat_sensor_mgmt_info(int *p_num, sensor_mgmt_t **p_sensor) { + *p_num = g_sensor_mgmt.num; + *p_sensor = g_sensor_mgmt.sensor; +} + +void +plat_sensor_disc_info(int *p_num, sensor_disc_t **p_sensor) { + *p_num = g_sensor_disc.num; + *p_sensor = g_sensor_disc.sensor; +} + +void +plat_sensor_thresh_info(int *p_num, sensor_thresh_t **p_sensor) { + *p_num = g_sensor_thresh.num; + *p_sensor = g_sensor_thresh.sensor; +} + +void +plat_sensor_oem_info(int *p_num, sensor_oem_t **p_sensor) { + *p_num = g_sensor_oem.num; + *p_sensor = g_sensor_oem.sensor; +} + +// Initialize Sensor Table +int +plat_sensor_init(void) { + + // Populate all Sensors + populate_mgmt_sensors(); + populate_disc_sensors(); + + return 0; +} diff --git a/meta-raptor/meta-asus/recipes-asus/ipmid/files/setup-ipmid.sh b/meta-raptor/meta-asus/recipes-asus/ipmid/files/setup-ipmid.sh new file mode 100644 index 0000000..b724d70 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/ipmid/files/setup-ipmid.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +### BEGIN INIT INFO +# Provides: setup-ipmid +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Set IPMI Message handler +### END INIT INFO + +echo -n "Setup IPMI message handler... " +/usr/local/bin/ipmid +echo "done." diff --git a/meta-raptor/meta-asus/recipes-asus/ipmid/ipmid_0.1.bb b/meta-raptor/meta-asus/recipes-asus/ipmid/ipmid_0.1.bb new file mode 100644 index 0000000..7ec7eaf --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/ipmid/ipmid_0.1.bb @@ -0,0 +1,70 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# Copyright 2017 Raptor Engineering, LLC. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +SUMMARY = "IPMI Daemon" +DESCRIPTION = "Daemon to handle IPMI Messages." +SECTION = "base" +PR = "r1" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://ipmid.c;beginline=8;endline=20;md5=da35978751a9d71b73679307c4d296ec" + + +DEPENDS_append = " update-rc.d-native" + +SRC_URI = "file://Makefile \ + file://setup-ipmid.sh \ + file://ipmid.c \ + file://platform/timestamp.c \ + file://platform/timestamp.h \ + file://platform/sel.c \ + file://platform/sel.h \ + file://platform/sdr.c \ + file://platform/sdr.h \ + file://platform/sensor.h \ + file://platform/fruid.h \ + file://platform/wedge/sensor.c \ + file://platform/wedge/fruid.c \ + " + +S = "${WORKDIR}" + +binfiles = "ipmid" + +pkgdir = "ipmid" + +do_install() { + dst="${D}/usr/local/fbpackages/${pkgdir}" + bin="${D}/usr/local/bin" + install -d $dst + install -d $bin + install -m 755 ipmid ${dst}/ipmid + ln -snf ../fbpackages/${pkgdir}/ipmid ${bin}/ipmid + install -d ${D}${sysconfdir}/init.d + install -d ${D}${sysconfdir}/rcS.d + install -m 755 setup-ipmid.sh ${D}${sysconfdir}/init.d/setup-ipmid.sh + update-rc.d -r ${D} setup-ipmid.sh start 64 S . +} + +FBPACKAGEDIR = "${prefix}/local/fbpackages" + +FILES_${PN} = "${FBPACKAGEDIR}/ipmid ${prefix}/local/bin ${sysconfdir} " + +# Inhibit complaints about .debug directories for the fand binary: + +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" diff --git a/meta-raptor/meta-asus/recipes-asus/lm_sensors/files/wedge.conf b/meta-raptor/meta-asus/recipes-asus/lm_sensors/files/wedge.conf new file mode 100644 index 0000000..266a695 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/lm_sensors/files/wedge.conf @@ -0,0 +1,77 @@ + +bus "i2c-3" "ast_i2c.3" + +bus "i2c-4" "ast_i2c.4" + +bus "i2c-6" "ast_i2c.6" + +chip "tmp75-i2c-3-48" + label temp1 "Inlet Temp" + set temp1_max 70 + set temp1_max_hyst 60 + +chip "tmp75-i2c-3-49" + label temp1 "Switch Temp" + set temp1_max 70 + set temp1_max_hyst 60 + +chip "tmp75-i2c-3-4a" + label temp1 "Outlet Temp" + set temp1_max 70 + set temp1_max_hyst 60 + +chip "tmp75-i2c-4-4c" + label temp1 "Microserver Ambient Temp" + +chip "max127-i2c-6-28" + label in0 "+1 Voltage" + label in1 "+2.5 Voltage" + ignore in2 + label in3 "+1 Voltage" + ignore in4 + label in5 "+3.3 Voltage" + label in6 "+5 Voltage" + ignore in7 + +chip "ast_pwm-*" + label fan1 "Fan 2 front" + label fan2 "Fan 3 front" + label fan3 "Fan 1 front" + label fan4 "Fan 0 front" + label fan5 "Fan 2 rear" + label fan6 "Fan 3 rear" + label fan7 "Fan 1 rear" + label fan8 "Fan 0 rear" + ignore fan9 + ignore fan10 + ignore fan11 + ignore fan12 + ignore fan13 + ignore fan14 + ignore fan15 + ignore fan16 + +chip "fb_panther_plus-*" + label temp1 "CPU Temp" + label temp2 "DIMM0 Temp" + ignore temp3 + ignore temp4 + ignore temp5 + +chip "ast_adc-isa-0000" + ignore in0 + ignore in1 + ignore in2 + ignore in3 + ignore in4 + label in5 "+1 Core Voltage" + label in6 "+1 Analog Voltage" + label in7 "+5 Voltage" + label in8 "+3.3 Voltage" + label in9 "+2.5 Voltage" + ignore in10 + ignore in11 + ignore in12 + ignore in13 + ignore in14 + ignore in15 diff --git a/meta-raptor/meta-asus/recipes-asus/lm_sensors/lmsensors_%.bbappend b/meta-raptor/meta-asus/recipes-asus/lm_sensors/lmsensors_%.bbappend new file mode 100644 index 0000000..90a3954 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/lm_sensors/lmsensors_%.bbappend @@ -0,0 +1,14 @@ + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += "file://wedge.conf \ + " + +do_install_board_config() { + install -d ${D}${sysconfdir}/sensors.d + install -m 644 ../wedge.conf ${D}${sysconfdir}/sensors.d/wedge.conf +} + +do_install_append() { + do_install_board_config +} diff --git a/meta-raptor/meta-asus/recipes-asus/po-eeprom/files/Makefile b/meta-raptor/meta-asus/recipes-asus/po-eeprom/files/Makefile new file mode 100644 index 0000000..0b3fd71 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/po-eeprom/files/Makefile @@ -0,0 +1,26 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +all: po-eeprom + +po-eeprom: po-eeprom.o + $(CC) -o $@ $^ $(LDFLAGS) + +.PHONY: clean + +clean: + rm -rf *.o po-eeprom diff --git a/meta-raptor/meta-asus/recipes-asus/po-eeprom/files/po-eeprom.c b/meta-raptor/meta-asus/recipes-asus/po-eeprom/files/po-eeprom.c new file mode 100644 index 0000000..46debee --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/po-eeprom/files/po-eeprom.c @@ -0,0 +1,80 @@ +/* + * Copyright 2014-present Facebook. All Rights Reserved. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include <sys/types.h> + +#define SERIAL_LEN 17 + +usage() +{ + fprintf(stderr, "Usage: po-eeprom filename [filename...]\n" + "\twhere filename is the location of the PowerOne EEPROM, likely\n" + "\t/sys/bus/i2c/drivers/at24/7-0051/eeprom or\n" + "\t/sys/bus/i2c/drivers/at24/7-0052/eeprom\n"); + exit(2); +} + +int safe_read(int fd, void *buf, size_t size, char *msg) +{ + if (read(fd, buf, size) != size) { + perror(msg); + exit(3); + } +} + +int main(int argc, char **argv) +{ + int fd; + int file = 1; + uint8_t size; + uint8_t junk; + uint16_t crc; + char serial[SERIAL_LEN + 1]; + + if (argc < 2) + usage(); + + while (file < argc) { + fd = open(argv[file], O_RDONLY); + if (fd < 0) { + fprintf(stderr, "Couldn't open %s for EEPROM reading\n", argv[1]); + exit(1); + } + + safe_read(fd, &size, sizeof(size), "read size"); + safe_read(fd, &junk, sizeof(junk), "read junk"); + /* + * Should probably check CRC here, PowerOne provided some code where + * it looks like a pretty standard CCITT CRC16. + */ + safe_read(fd, &crc, sizeof(crc), "read CRC len"); + safe_read(fd, serial, SERIAL_LEN, "read serial number"); + + serial[SERIAL_LEN] = 0; + printf("Serial number: %s\n", serial); + close(fd); + file++; + } +} diff --git a/meta-raptor/meta-asus/recipes-asus/po-eeprom/po-eeprom_0.1.bb b/meta-raptor/meta-asus/recipes-asus/po-eeprom/po-eeprom_0.1.bb new file mode 100644 index 0000000..ad635dc --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/po-eeprom/po-eeprom_0.1.bb @@ -0,0 +1,42 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +SUMMARY = "PowerOne EEPROM Utilities" +DESCRIPTION = "Util for PowerOne eeprom" +SECTION = "base" +PR = "r1" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://po-eeprom.c;beginline=4;endline=16;md5=da35978751a9d71b73679307c4d296ec" + +SRC_URI = "file://po-eeprom.c \ + file://Makefile \ + " + +S = "${WORKDIR}" + +do_install() { + install -d ${D}${bindir} + install -m 0755 po-eeprom ${D}${bindir}/po-eeprom +} + +FILES_${PN} = "${bindir}" + +# Inhibit complaints about .debug directories + +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" diff --git a/meta-raptor/meta-asus/recipes-asus/rest-api/files/bmc_command.py b/meta-raptor/meta-asus/recipes-asus/rest-api/files/bmc_command.py new file mode 100644 index 0000000..d4dc877 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/rest-api/files/bmc_command.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import os +import subprocess +import select +import sys +import time + +DEFAULT_TIMEOUT = 10 #sec + +# Note: Python 3.0 supports communicate() with a timeout option. +# If we upgrade to this version we will no longer need timed_communicate + +class TimeoutError(Exception): + def __init__(self, output, error): + super(TimeoutError, self).__init__('process timed out') + self.output = output + self.error = error + +class WaitTimeoutError(Exception): + pass + +def kill_process(proc): + proc.terminate() + try: + timed_wait(proc, 0.1) + except WaitTimeoutError: + proc.kill() + try: + timed_wait(proc, 0.1) + except WaitTimeoutError: + # This can happen if the process is stuck waiting inside a system + # call for a long time. There isn't much we can do unless we want + # to keep waiting forever. Just give up. The child process will + # remain around as a zombie until we exit. + pass + +def timed_wait(proc, timeout): + # There unfortunately isn't a great way to wait for a process with a + # timeout, other than polling. (Registering for SIGCHLD and sleeping might + # be one option, but that's fragile and not thread-safe.) + poll_interval = 0.1 + end_time = time.time() + timeout + while True: + if proc.poll() is not None: + return + time_left = max(end_time - time.time(), 0) + if time_left <= 0: + raise WaitTimeoutError() + time.sleep(min(time_left, poll_interval)) + +def timed_communicate(proc, timeout=DEFAULT_TIMEOUT): + end_time = time.time() + timeout + + p = select.poll() + outfd = proc.stdout.fileno() + errfd = proc.stderr.fileno() + p.register(outfd, select.POLLIN) + p.register(errfd, select.POLLIN) + results = {outfd: [], errfd: []} + remaining_fds = set([outfd, errfd]) + + bufsize = 4096 + while remaining_fds: + time_left = max(end_time - time.time(), 0) + r = p.poll(time_left * 1000) # poll() takes timeout in milliseconds + if not r: + kill_process(proc) + raise TimeoutError(b''.join(results[outfd]), + b''.join(results[errfd])) + for fd, flags in r: + # We didn't put the fds in non-blocking mode, but we know the fd + # has data to read, so os.read() will return immediately. + d = os.read(fd, bufsize) + if d: + results[fd].append(d) + else: + # EOF on this fd, stop listening on it + p.unregister(fd) + remaining_fds.remove(fd) + + try: + timed_wait(proc, max(end_time - time.time(), 0)) + except WaitTimeoutError: + kill_process(proc) + raise TimeoutError(b''.join(results[outfd]), + b''.join(results[errfd])) + + return b''.join(results[outfd]), b''.join(results[errfd]) diff --git a/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest.py b/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest.py new file mode 100644 index 0000000..876f03a --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest.py @@ -0,0 +1,208 @@ +#!/usr/bin/env python +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +from ctypes import * +import bottle +from cherrypy.wsgiserver import CherryPyWSGIServer +from cherrypy.wsgiserver.ssl_pyopenssl import pyOpenSSLAdapter +import datetime +import logging +import logging.config +import json +import ssl +import socket +import os +import rest_fruid +import rest_server +import rest_sensors +import rest_bmc +import rest_gpios +import rest_slotid + +CONSTANTS = { + 'certificate': '/usr/lib/ssl/certs/rest_server.pem', + 'key': '/usr/lib/ssl/private/rest_server_key.pem', + 'listen_address': '0.0.0.0', +} + +LOGGER_CONF = { + 'version': 1, + 'disable_existing_loggers': False, + 'formatters': { + 'default': { + 'format': '%(message)s' + }, + }, + 'handlers': { + 'file_handler': { + 'level': 'INFO', + 'formatter':'default', + 'class': 'logging.handlers.RotatingFileHandler', + 'filename':'/tmp/rest.log', + 'maxBytes': 1048576, + 'backupCount': 3, + 'encoding': 'utf8' + }, + }, + 'loggers': { + '': { + 'handlers': ['file_handler'], + 'level': 'DEBUG', + 'propagate': True, + }, + } +} + +# Handler for root resource endpoint +@bottle.route('/api') +def rest_api(): + result = { + "Information": { + "Description": "Wedge RESTful API Entry", + }, + "Actions": [], + "Resources": [ "sys"], + } + + return result + +# Handler for sys resource endpoint +@bottle.route('/api/sys') +def rest_sys(): + result = { + "Information": { + "Description": "System", + }, + "Actions": [], + "Resources": [ "mb", "bmc", "server", "sensors", "gpios", + "slotid"], + } + + return result + +# Handler for sys/mb resource endpoint +@bottle.route('/api/sys/mb') +def rest_sys(): + result = { + "Information": { + "Description": "Mainboard", + }, + "Actions": [], + "Resources": [ "fruid"], + } + + return result + +# Handler for sys/mb/fruid resource endpoint +@bottle.route('/api/sys/mb/fruid') +def rest_fruid_hdl(): + return rest_fruid.get_fruid() + +# Handler for sys/bmc resource endpoint +@bottle.route('/api/sys/bmc') +def rest_bmc_hdl(): + return rest_bmc.get_bmc() + +# Handler for sys/server resource endpoint +@bottle.route('/api/sys/server') +def rest_server_hdl(): + return rest_server.get_server() + +# Handler for uServer resource endpoint +@bottle.route('/api/sys/server', method='POST') +def rest_server_act_hdl(): + data = json.load(request.body) + return rest_server.server_action(data) + +# Handler for sensors resource endpoint +@bottle.route('/api/sys/sensors') +def rest_sensors_hdl(): + return rest_sensors.get_sensors() + +# Handler for sensors resource endpoint +@bottle.route('/api/sys/gpios') +def rest_gpios_hdl(): + return rest_gpios.get_gpios() + +# Handler for sensors resource endpoint +@bottle.route('/api/sys/slotid') +def rest_slotid_hdl(): + return rest_slotid.get_slotid() + +# SSL Wrapper for Rest API +class SSLCherryPyServer(bottle.ServerAdapter): + def run(self, handler): + server = CherryPyWSGIServer((self.host, self.port), handler) + server.ssl_adapter = pyOpenSSLAdapter(CONSTANTS['certificate'], CONSTANTS['key']) + try: + server.start() + finally: + server.stop() + + +def log_after_request(): + try: + length = bottle.response.content_length + except: + try: + length = len(bottle.response.body) + except: + length = 0 + + logging.info('{} - - [{}] "{} {} {}" {} {}'.format( + bottle.request.environ.get('REMOTE_ADDR'), + datetime.datetime.now().strftime('%d/%b/%Y %H:%M:%S'), + bottle.request.environ.get('REQUEST_METHOD'), + bottle.request.environ.get('REQUEST_URI'), + bottle.request.environ.get('SERVER_PROTOCOL'), + bottle.response.status_code, + length)) + + +# Error logging to log file +class ErrorLogging(object): + def write(self, err): + logging.error(err) + + +# Middleware to log the requests +class LogMiddleware(object): + def __init__(self, app): + self.app = app + + def __call__(self, e, h): + e['wsgi.errors'] = ErrorLogging() + ret_val = self.app(e, h) + log_after_request() + return ret_val + +# overwrite the stderr and stdout to log to the file +bottle._stderr = logging.error +bottle._stdout = logging.info +logging.config.dictConfig(LOGGER_CONF) + +bottle_app = LogMiddleware(bottle.app()) +# Use SSL if the certificate and key exists. Otherwise, run without SSL. +if (os.access(CONSTANTS['key'], os.R_OK) and + os.access(CONSTANTS['certificate'], os.R_OK)): + bottle.run(host = CONSTANTS['listen_address'], port = 8443, server=SSLCherryPyServer, app=bottle_app) +else: + bottle.run(host = CONSTANTS['listen_address'], port = 8080, server='cherrypy', app=bottle_app) diff --git a/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_bmc.py b/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_bmc.py new file mode 100644 index 0000000..fe838b6 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_bmc.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + + +from subprocess import * +import re + +# Handler for FRUID resource endpoint +def get_bmc(): + # Get BMC Reset Reason + wdt_counter = Popen('devmem 0x1e785010', \ + shell=True, stdout=PIPE).stdout.read() + wdt_counter = int(wdt_counter, 0) + + wdt_counter &= 0xff00 + + if wdt_counter: + por_flag = 0 + else: + por_flag = 1 + + if por_flag: + reset_reason = "Power ON Reset" + else: + reset_reason = "User Initiated Reset or WDT Reset" + + # Get BMC's Up Time + uptime = Popen('uptime', \ + shell=True, stdout=PIPE).stdout.read() + + # Get Usage information + data = Popen('top -b n1', \ + shell=True, stdout=PIPE).stdout.read() + adata = data.split('\n') + mem_usage = adata[0] + cpu_usage = adata[1] + + # Get OpenBMC version + version = "" + data = Popen('cat /etc/issue', \ + shell=True, stdout=PIPE).stdout.read() + ver = re.search(r'v([\w\d._-]*)\s', data) + if ver: + version = ver.group(1) + + result = { + "Information": { + "Description": "ASUS ASMB4iKVM BMC", + "Reset Reason": reset_reason, + "Uptime": uptime, + "Memory Usage": mem_usage, + "CPU Usage": cpu_usage, + "OpenBMC Version": version, + }, + "Actions": [], + "Resources": [], + } + + return result; + diff --git a/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_fruid.py b/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_fruid.py new file mode 100644 index 0000000..245afc4 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_fruid.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +import subprocess + +def get_fruid(): + + mac2str = lambda mac: ':'.join(['{:02X}'.format(b) for b in mac]) + + fruinfo = { "Version": subprocess.Popen(['fw_printenv', 'fru_version'], stdout=subprocess.PIPE).communicate()[0], + "Product Name": subprocess.Popen(['fw_printenv', 'fru_product'], stdout=subprocess.PIPE).communicate()[0], + "Product Part Number": subprocess.Popen(['fw_printenv', 'fru_product_pn'], stdout=subprocess.PIPE).communicate()[0], + "System Assembly Part Number": subprocess.Popen(['fw_printenv', 'fru_subassembly'], stdout=subprocess.PIPE).communicate()[0], + "ODM PCB Part Number": subprocess.Popen(['fw_printenv', 'fru_odm_pn'], stdout=subprocess.PIPE).communicate()[0], + "ODM PCB Serial Number": subprocess.Popen(['fw_printenv', 'fru_odm_serial'], stdout=subprocess.PIPE).communicate()[0], + "Product Production State": subprocess.Popen(['fw_printenv', 'fru_prod_stat'], stdout=subprocess.PIPE).communicate()[0], + "Product Version": subprocess.Popen(['fw_printenv', 'fru_prod_major_version'], stdout=subprocess.PIPE).communicate()[0], + "Product Sub-Version": subprocess.Popen(['fw_printenv', 'fru_prod_minor_version'], stdout=subprocess.PIPE).communicate()[0], + "Product Serial Number": subprocess.Popen(['fw_printenv', 'fru_prod_serial'], stdout=subprocess.PIPE).communicate()[0], + "Product Asset Tag": subprocess.Popen(['fw_printenv', 'fru_asset_tag'], stdout=subprocess.PIPE).communicate()[0], + "System Manufacturer": subprocess.Popen(['fw_printenv', 'fru_prod_manufacturer'], stdout=subprocess.PIPE).communicate()[0], + "System Manufacturing Date": subprocess.Popen(['fw_printenv', 'fru_manufacturing_date'], stdout=subprocess.PIPE).communicate()[0], + "PCB Manufacturer": subprocess.Popen(['fw_printenv', 'fru_pcb_manufacturer'], stdout=subprocess.PIPE).communicate()[0], + "Assembled At": subprocess.Popen(['fw_printenv', 'fru_assembled_at'], stdout=subprocess.PIPE).communicate()[0], + "Local MAC": subprocess.Popen(['fw_printenv', 'ethaddr'], stdout=subprocess.PIPE).communicate()[0], + "Location": subprocess.Popen(['fw_printenv', 'fru_location'], stdout=subprocess.PIPE).communicate()[0] + } + + result = { + "Information": fruinfo, + "Actions": [], + "Resources": [], + } + + return result diff --git a/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_gpios.py b/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_gpios.py new file mode 100644 index 0000000..dcbb436 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_gpios.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +from rest_fruid import get_fruid + +MAINBOARDS = ["KGPE-D16", "KCMA-D8"] + + +def read_gpio_sysfs(gpio): + with open('/sys/class/gpio/gpio%d/value' % gpio, 'r') as f: + val_string = f.read() + if val_string == '1\n': + return 1 + if val_string == '0\n': + return 0 + return None + + +def read_asus_gpio(): + bhinfo = {} + return bhinfo + + +def get_gpios(): + fruinfo = get_fruid() + gpioinfo = {} + if fruinfo["Information"]["Product Name"] in MAINBOARDS: + gpioinfo["back_ports"] = read_asus_gpio() + return gpioinfo diff --git a/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_sensors.py b/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_sensors.py new file mode 100644 index 0000000..01e8f89 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_sensors.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +import json +import re +import subprocess +import bmc_command + +# Handler for sensors resource endpoint +def get_sensors(): + result = [] + proc = subprocess.Popen(['sensors'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + try: + data, err = bmc_command.timed_communicate(proc) + except bmc_command.TimeoutError as ex: + data = ex.output + err = ex.error + + data = re.sub(r'\(.+?\)', '', data) + data = re.sub(r' sensor = .*', '', data) + for edata in data.split('\n\n'): + adata = edata.split('\n', 1) + sresult = {} + if (len(adata) < 2): + break; + sresult['name'] = adata[0] + for sdata in adata[1].split('\n'): + tdata = sdata.split(':') + if (len(tdata) < 2): + continue + sresult[tdata[0].strip()] = tdata[1].strip() + result.append(sresult) + + fresult = { + "Information": result, + "Actions": [], + "Resources": [], + } + return fresult diff --git a/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_server.py b/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_server.py new file mode 100644 index 0000000..7a334a6 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_server.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + + +import os +from subprocess import * + +# Handler for mainboard resource endpoint +def get_server(): + ret = Popen('/usr/local/bin/asus_power.sh status', \ + shell=True, stdout=PIPE).stdout.read() + status = ret.rsplit()[-1] + + result = { + "Information": { "status": status }, + "Actions": ["power-on", "power-off", "power-reset"], + "Resources": [], + } + + return result + +def server_action(data): + if data["action"] == 'power-on': + ret = Popen('/usr/local/bin/asus_power.sh status', \ + shell=True, stdout=PIPE).stdout.read() + status = ret.rsplit()[-1] + if status == 'on': + res = 'failure' + reason = 'already on' + else: + ret = Popen('/usr/local/bin/asus_power.sh on', \ + shell=True, stdout=PIPE).stdout.read() + res = "success" + elif data["action"] == 'power-off': + ret = Popen('/usr/local/bin/asus_power.sh off', \ + shell=True, stdout=PIPE).stdout.read() + res = "success" + elif data["action"] == 'power-reset': + ret = Popen('/usr/local/bin/asus_power.sh reset', \ + shell=True, stdout=PIPE).stdout.read() + res = "success" + else: + res = 'failure' + reason = 'invalid action' + + if res == 'failure': + result = { "result": res, "reason": reason} + else: + result = { "result": res } + + return result diff --git a/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_slotid.py b/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_slotid.py new file mode 100644 index 0000000..1b03b91 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/rest-api/files/rest_slotid.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +import subprocess + +# Handler for sensors resource endpoint +def get_slotid(): + p = subprocess.Popen('source /usr/local/bin/openbmc-utils.sh;' + 'asus_slot_id $(asus_board_type)', + shell=True, stdout=subprocess.PIPE) + out, err = p.communicate() + try: + slot = int(out.strip('\n')) + except: + slot = 0 + return { 'slotid' : slot } diff --git a/meta-raptor/meta-asus/recipes-asus/rest-api/files/setup-rest-api.sh b/meta-raptor/meta-asus/recipes-asus/rest-api/files/setup-rest-api.sh new file mode 100644 index 0000000..2b274dc --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/rest-api/files/setup-rest-api.sh @@ -0,0 +1,79 @@ +#!/bin/sh +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +### BEGIN INIT INFO +# Provides: setup-rest-api +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Set REST API handler +### END INIT INFO + +# source function library +. /etc/init.d/functions + +ACTION="$1" +CMD="/usr/local/bin/rest.py" +case "$ACTION" in + start) + echo -n "Setting up REST API handler: " + pid=$(ps | grep -v grep | grep $CMD | awk '{print $1}') + if [ $pid ]; then + echo "already running" + else + $CMD > /tmp/rest_start.log 2>&1 & + echo "done." + fi + ;; + stop) + echo -n "Stopping REST API handler: " + pid=$(ps | grep -v grep | grep $CMD | awk '{print $1}') + if [ $pid ]; then + kill $pid + fi + echo "done." + ;; + restart) + echo -n "Restarting REST API handler: " + pid=$(ps | grep -v grep | grep $CMD | awk '{print $1}') + if [ $pid ]; then + kill $pid + fi + sleep 1 + $CMD > /tmp/rest_start.log 2>&1 & + echo "done." + ;; + status) + if [[ -n $(ps | grep -v grep | grep $CMD | awk '{print $1}') ]]; then + echo "REST API handler is running" + else + echo "REST API is stopped" + fi + ;; + *) + N=${0##*/} + N=${N#[SK]??} + echo "Usage: $N {start|stop|status|restart}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/meta-raptor/meta-asus/recipes-asus/rest-api/rest-api_0.1.bb b/meta-raptor/meta-asus/recipes-asus/rest-api/rest-api_0.1.bb new file mode 100644 index 0000000..53675b7 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/rest-api/rest-api_0.1.bb @@ -0,0 +1,70 @@ +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +SUMMARY = "Rest API Daemon" +DESCRIPTION = "Daemon to handle RESTful interface." +SECTION = "base" +PR = "r1" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://rest.py;beginline=6;endline=19;md5=0b1ee7d6f844d472fa306b2fee2167e0" + + +DEPENDS_append = " update-rc.d-native" + +SRC_URI = "file://setup-rest-api.sh \ + file://rest.py \ + file://rest_bmc.py \ + file://rest_fruid.py \ + file://rest_gpios.py \ + file://rest_server.py \ + file://rest_sensors.py \ + file://rest_slotid.py \ + file://bmc_command.py \ + " + +S = "${WORKDIR}" + +binfiles = "rest.py rest_bmc.py rest_fruid.py rest_gpios.py rest_server.py rest_sensors.py bmc_command.py rest_slotid.py setup-rest-api.sh" + +pkgdir = "rest-api" + +do_install() { + dst="${D}/usr/local/fbpackages/${pkgdir}" + bin="${D}/usr/local/bin" + install -d $dst + install -d $bin + for f in ${binfiles}; do + install -m 755 $f ${dst}/$f + ln -snf ../fbpackages/${pkgdir}/$f ${bin}/$f + done + for f in ${otherfiles}; do + install -m 644 $f ${dst}/$f + done + install -d ${D}${sysconfdir}/init.d + install -d ${D}${sysconfdir}/rcS.d + install -m 755 setup-rest-api.sh ${D}${sysconfdir}/init.d/setup-rest-api.sh + update-rc.d -r ${D} setup-rest-api.sh start 95 2 3 4 5 . +} + +FBPACKAGEDIR = "${prefix}/local/fbpackages" + +FILES_${PN} = "${FBPACKAGEDIR}/rest-api ${prefix}/local/bin ${sysconfdir} " + +# Inhibit complaints about .debug directories for the fand binary: + +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" diff --git a/meta-raptor/meta-asus/recipes-asus/sensor-setup/files/sensor-setup.sh b/meta-raptor/meta-asus/recipes-asus/sensor-setup/files/sensor-setup.sh new file mode 100644 index 0000000..7f02cd5 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/sensor-setup/files/sensor-setup.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +### BEGIN INIT INFO +# Provides: sensor-setup +# Required-Start: power-on +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Power on micro-server +### END INIT INFO + +# Eventually, this will be used to configure the various (mostly +# i2c-based) sensors, once we have a kernel version that supports +# doing this more dynamically. + +modprobe pmbus +modprobe w83795 force=1,0x2f diff --git a/meta-raptor/meta-asus/recipes-asus/sensor-setup/sensor-setup_0.1.bb b/meta-raptor/meta-asus/recipes-asus/sensor-setup/sensor-setup_0.1.bb new file mode 100644 index 0000000..1b0f937 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/sensor-setup/sensor-setup_0.1.bb @@ -0,0 +1,38 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +SUMMARY = "Configure the sensors" +DESCRIPTION = "The script configure sensors" +SECTION = "base" +PR = "r1" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://sensor-setup.sh;beginline=5;endline=18;md5=0b1ee7d6f844d472fa306b2fee2167e0" + +DEPENDS_append = " update-rc.d-native" + +SRC_URI = "file://sensor-setup.sh \ + " + +S = "${WORKDIR}" + +do_install() { + install -d ${D}${sysconfdir}/init.d + install -d ${D}${sysconfdir}/rcS.d + install -m 755 sensor-setup.sh ${D}${sysconfdir}/init.d/sensor-setup.sh + update-rc.d -r ${D} sensor-setup.sh start 90 S . +} + +FILES_${PN} = " ${sysconfdir} " diff --git a/meta-raptor/meta-asus/recipes-asus/sms-kcsd/sms-kcsd/Makefile b/meta-raptor/meta-asus/recipes-asus/sms-kcsd/sms-kcsd/Makefile new file mode 100644 index 0000000..dba9dbb --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/sms-kcsd/sms-kcsd/Makefile @@ -0,0 +1,26 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +all: sms-kcsd + +sms-kcsd: sms-kcsd.c + $(CC) -pthread -lalert_control -lipmi -std=c99 -o $@ $^ $(LDFLAGS) + +.PHONY: clean + +clean: + rm -rf *.o sms-kcsd diff --git a/meta-raptor/meta-asus/recipes-asus/sms-kcsd/sms-kcsd/setup-sms-kcs.sh b/meta-raptor/meta-asus/recipes-asus/sms-kcsd/sms-kcsd/setup-sms-kcs.sh new file mode 100644 index 0000000..b4234a4 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/sms-kcsd/sms-kcsd/setup-sms-kcs.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +### BEGIN INIT INFO +# Provides: setup-sms-kcs +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Set SMS KCS handler +### END INIT INFO + +echo -n "Setup SMS KCS message handler... " +/usr/local/bin/sms-kcsd +echo "done." diff --git a/meta-raptor/meta-asus/recipes-asus/sms-kcsd/sms-kcsd/sms-kcsd.c b/meta-raptor/meta-asus/recipes-asus/sms-kcsd/sms-kcsd/sms-kcsd.c new file mode 100644 index 0000000..b3f65fa --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/sms-kcsd/sms-kcsd/sms-kcsd.c @@ -0,0 +1,133 @@ +/* + * sms-kcsd + * + * Copyright 2017 Raptor Engineering, LLC + * Copyright 2014-present Facebook. All Rights Reserved. + * + * Daemon to monitor traffic coming from sms-kcs interface + * and respond to the command using IPMI stack + * + * TODO: Determine if the daemon is already started. + * TODO: Cache the file descriptors instead of open/close everytime + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#include <syslog.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <facebook/alert_control.h> +#include <facebook/ipmi.h> + +#define PATH_SMS_KCS "/dev/kcs" +#define MAX_ALERT_CONTROL_RETRIES 3 + +typedef enum +{ + SET_SMS_BIT, + CLEAR_SMS_BIT, + ENABLE_KCS_INTERRUPT, + DISABLE_KCS_INTERRUPT, + START_HW_UNIT_TEST, + READ_KCS_DATA, + WRITE_KCS_DATA, + SET_OBF_BIT, + KCS_ENABLE, + KCS_DISABLE, + SET_STATUS_DATA, + END_OF_FUNCLIST, +} kcs_io_controls; + +struct kcs_data_t { + unsigned char channel_num; + unsigned int num_bytes; + unsigned char * buffer; +}; + +typedef struct { + unsigned char fbid; + unsigned char length; + unsigned char buf[]; +} kcs_msg_t; + +/* + * Daemon Main loop + * - Reads the incoming request on KCS channel + * - Invokes IPMI handler to provide response + * - Writes reply back to KCS channel + */ +int main(int argc, char **argv) { + int i = 0; + int count = 0; + int ret; + int fd_rd; + int fd_wr; + FILE *fp_kcs; + kcs_msg_t *msg; + unsigned char rbuf[256] = {0}; + unsigned char tbuf[256] = {0}; + unsigned char tlen = 0; + + daemon(1, 0); + openlog("sms-kcs", LOG_CONS, LOG_DAEMON); + + while (1) { + // Open control file + fp_kcs = fopen(PATH_SMS_KCS, "r+"); + if (!fp_kcs) { + syslog(LOG_ALERT, "failed to open file %s\n", PATH_SMS_KCS); + return -1; + } + fd_rd = fileno(fp_kcs); + fd_wr = fileno(fp_kcs); + + // Forever loop to poll and process KCS messages + while (1) { + // Reads incoming request + count = read(fd_rd, rbuf+2, sizeof(rbuf-2)); + if (count == 0) { + syslog(LOG_INFO, "read returns zero bytes\n"); + fclose(fp_kcs); + break; + } + + // Set payload ID to 0 + rbuf[0] = 0; + // Set length to the number of received bytes + rbuf[1] = count; + + msg = (kcs_msg_t*)rbuf; + + // Invoke IPMI handler + ipmi_handle(msg->buf, msg->length, tbuf, &tlen); + + // Write Reply back to KCS channel + count = write(fd_wr, tbuf, tlen); + if (count != tlen) { + syslog(LOG_ALERT, "write returns: %d, expected: %d\n", count, tlen); + fclose(fp_kcs); + break; + } + + // Rate limit + usleep(10000); + } + } +} diff --git a/meta-raptor/meta-asus/recipes-asus/sms-kcsd/sms-kcsd_0.1.bb b/meta-raptor/meta-asus/recipes-asus/sms-kcsd/sms-kcsd_0.1.bb new file mode 100644 index 0000000..dda7c33 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/sms-kcsd/sms-kcsd_0.1.bb @@ -0,0 +1,61 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +SUMMARY = "SMS KCS Daemon" +DESCRIPTION = "Daemon to handle SMS KCS interface." +SECTION = "base" +PR = "r1" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://sms-kcsd.c;beginline=13;endline=25;md5=da35978751a9d71b73679307c4d296ec" + + +DEPENDS_append = " update-rc.d-native" + +DEPENDS += "libalert-control" +DEPENDS += "libipmi" + +SRC_URI = "file://Makefile \ + file://setup-sms-kcs.sh \ + file://sms-kcsd.c \ + " + +S = "${WORKDIR}" + +binfiles = "sms-kcsd" + +pkgdir = "sms-kcsd" + +do_install() { + dst="${D}/usr/local/fbpackages/${pkgdir}" + bin="${D}/usr/local/bin" + install -d $dst + install -d $bin + install -m 755 sms-kcsd ${dst}/sms-kcsd + ln -snf ../fbpackages/${pkgdir}/sms-kcsd ${bin}/sms-kcsd + install -d ${D}${sysconfdir}/init.d + install -d ${D}${sysconfdir}/rcS.d + install -m 755 setup-sms-kcs.sh ${D}${sysconfdir}/init.d/setup-sms-kcs.sh + update-rc.d -r ${D} setup-sms-kcs.sh start 65 S . +} + +FBPACKAGEDIR = "${prefix}/local/fbpackages" + +FILES_${PN} = "${FBPACKAGEDIR}/sms-kcsd ${prefix}/local/bin ${sysconfdir} " + +# Inhibit complaints about .debug directories for the fand binary: + +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" diff --git a/meta-raptor/meta-asus/recipes-asus/usb-console/files/usbcons.sh b/meta-raptor/meta-asus/recipes-asus/usb-console/files/usbcons.sh new file mode 100755 index 0000000..de284bb --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/usb-console/files/usbcons.sh @@ -0,0 +1,80 @@ +#! /bin/sh +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +### BEGIN INIT INFO +# Provides: usbcons +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Creates a virtual USB serial device and starts a console +# on it. +# +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +NAME=usbcons +PIDFILE=/run/usbcons.pid +DESC="USB Serial Console" + +# source function library +. /etc/init.d/functions + +STOPPER= +ACTION="$1" + +case "$ACTION" in + start) + # Ability to prevent this from starting by editing cmdline in u-boot. + # Keeping this here until I get gadget switching working properly. (t4906522) + if grep "nousbcons" /proc/cmdline > /dev/null 2>&1 + then + echo "USB Console Disabled." + exit 0 + fi + echo -n "Starting $DESC: " + /usr/local/bin/usbmon.sh > /dev/null 2>&1 & + echo "$NAME." + ;; + stop) + echo -n "Stopping $DESC: " + killall usbmon.sh + echo "$NAME." + ;; + restart|force-reload) + echo -n "Restarting $DESC: " + killall usbmon.sh + sleep 1 + /usr/local/bin/usbmon.sh > /dev/null 2>&1 & + echo "$NAME." + ;; + status) + status $DAEMON + exit $? + ;; + *) + N=${0##*/} + N=${N#[SK]??} + echo "Usage: $N {start|stop|status|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/meta-raptor/meta-asus/recipes-asus/usb-console/files/usbmon.sh b/meta-raptor/meta-asus/recipes-asus/usb-console/files/usbmon.sh new file mode 100755 index 0000000..2e1ee67 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/usb-console/files/usbmon.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +modprobe g_cdc host_addr=02:00:00:00:00:02 dev_addr=02:00:00:00:00:01 +# For g-ether interface, if the remote side brings down the interface, BMC side +# still treats it as up. In this case, all packets through usb0 (i.e. NDP) will +# be queued in the kernel for this interface. Ether interface has the default +# TX queue length as 1000, which means there could be up to 1000 package queued +# in kernel for that. In our case, kmalloc-192 is exhausted when 298 packets +# are queued. +# To solve this issue, we change the TX queue length for usb0 to 64 to avoid +# memory exhaust. +ifconfig usb0 txqueuelen 64 +while true; do + getty /dev/ttyGS0 57600 + sleep 1 +done diff --git a/meta-raptor/meta-asus/recipes-asus/usb-console/usb-console_0.1.bb b/meta-raptor/meta-asus/recipes-asus/usb-console/usb-console_0.1.bb new file mode 100644 index 0000000..c934f46 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-asus/usb-console/usb-console_0.1.bb @@ -0,0 +1,42 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +SUMMARY = "Set up a USB serial console" +DESCRIPTION = "Sets up a USB serial console" +SECTION = "base" +PR = "r1" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://usbcons.sh;beginline=5;endline=18;md5=0b1ee7d6f844d472fa306b2fee2167e0" + +DEPENDS_append = " update-rc.d-native" + +SRC_URI = "file://usbcons.sh \ + file://usbmon.sh \ + " + +S = "${WORKDIR}" + +do_install() { + install -d ${D}${sysconfdir}/init.d + install -d ${D}${sysconfdir}/rcS.d + install -m 755 usbcons.sh ${D}${sysconfdir}/init.d/usbcons.sh + update-rc.d -r ${D} usbcons.sh start 90 S . + localbindir="${D}/usr/local/bin" + install -d ${localbindir} + install -m 755 usbmon.sh ${localbindir}/usbmon.sh +} + +FILES_${PN} = " ${sysconfdir} /usr/local" diff --git a/meta-raptor/meta-asus/recipes-core/base-files/base-files/fstab b/meta-raptor/meta-asus/recipes-core/base-files/base-files/fstab new file mode 100644 index 0000000..42787f3 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/base-files/base-files/fstab @@ -0,0 +1,7 @@ +/dev/root / auto defaults 1 1 +proc /proc proc defaults 0 0 +devpts /dev/pts devpts mode=0620,gid=5 0 0 +usbdevfs /proc/bus/usb usbdevfs noauto 0 0 +tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0 +tmpfs /var/volatile tmpfs defaults 0 0 +tmpfs /tmp tmpfs defaults,size=8M 0 0 diff --git a/meta-raptor/meta-asus/recipes-core/base-files/base-files_3.0.14.bbappend b/meta-raptor/meta-asus/recipes-core/base-files/base-files_3.0.14.bbappend new file mode 100644 index 0000000..72d991c --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/base-files/base-files_3.0.14.bbappend @@ -0,0 +1 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/meta-raptor/meta-asus/recipes-core/busybox/busybox/busybox.cfg b/meta-raptor/meta-asus/recipes-core/busybox/busybox/busybox.cfg new file mode 100644 index 0000000..66da117 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/busybox/busybox/busybox.cfg @@ -0,0 +1,18 @@ +CONFIG_SH_MATH_SUPPORT_64=y +CONFIG_DEVMEM=y +CONFIG_LSUSB=y +CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y +CONFIG_RX=y +CONFIG_FLASHCP=y +CONFIG_FLASH_LOCK=y +CONFIG_FLASH_UNLOCK=y +CONFIG_FLASH_ERASEALL=y +CONFIG_TRACEROUTE6=y +CONFIG_VCONFIG=y +# we use the standalone ip util +CONFIG_IP=n +# use dhclient, as udhcpc will flush all v6 link local addresses during renew +CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP=y +CONFIG_UDHCPD=n +CONFIG_UDHCPC=n +CONFIG_UDHCPC6=n diff --git a/meta-raptor/meta-asus/recipes-core/busybox/busybox/syslog-startup.conf b/meta-raptor/meta-asus/recipes-core/busybox/busybox/syslog-startup.conf new file mode 100644 index 0000000..53d7297 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/busybox/busybox/syslog-startup.conf @@ -0,0 +1,13 @@ +# This configuration file is used by the busybox syslog init script, +# /etc/init.d/syslog[.busybox] to set syslog configuration at start time. + +DESTINATION=file # log destinations (buffer file remote) +LOGFILE=/var/log/messages # where to log (file) +REMOTE=loghost:514 # where to log (syslog remote) +REDUCE=no # reduce-size logging +DROPDUPLICATES=no # whether to drop duplicate log entries +ROTATESIZE=128 # rotate log if grown beyond X [kByte] +ROTATEGENS=1 # keep X generations of rotated logs +BUFFERSIZE=64 # size of circular buffer [kByte] +FOREGROUND=no # run in foreground (don't use!) +#LOGLEVEL=5 # local log level (between 1 and 8) diff --git a/meta-raptor/meta-asus/recipes-core/busybox/busybox/syslog.conf b/meta-raptor/meta-asus/recipes-core/busybox/busybox/syslog.conf new file mode 100644 index 0000000..817a9a9 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/busybox/busybox/syslog.conf @@ -0,0 +1,5 @@ +# /etc/syslog.conf Configuration file for busybox's syslogd utility +# Send emergency messages to the console +*.emerg /dev/console +# Store everything else +*.* /var/log/messages diff --git a/meta-raptor/meta-asus/recipes-core/busybox/busybox_%.bbappend b/meta-raptor/meta-asus/recipes-core/busybox/busybox_%.bbappend new file mode 100644 index 0000000..501d2a1 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/busybox/busybox_%.bbappend @@ -0,0 +1,7 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +SRC_URI += " \ + file://busybox.cfg \ + file://syslog.conf \ + file://syslog-startup.conf \ + " diff --git a/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/get_fan_speed.sh b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/get_fan_speed.sh new file mode 100755 index 0000000..4955582 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/get_fan_speed.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2015-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +usage() { + echo "Usage: $0 [Fan Unit (1..8)]" >&2 +} + +FAN_DIR=/sys/class/i2c-adapter/i2c-1/1-002f + +show_pwm() +{ + pwm="${FAN_DIR}/fantray${1}_pwm" + val=$(cat $pwm | head -n 1) + echo "$((val * 100 / 31))%" +} + +show_rpm() +{ + front_rpm="${FAN_DIR}/fan$((($1 * 2 - 1)))_input" + rear_rpm="${FAN_DIR}/fan$((($1 * 2)))_input" + echo "$(cat $front_rpm), $(cat $rear_rpm)" +} + +set -e + +# refer to the comments in init_pwn.sh regarding +# the fan unit and tacho mapping +if [ "$#" -eq 0 ]; then + FANS="1 2 3 4 5 6 7 8" +elif [ "$#" -eq 1 ]; then + if [ $1 -gt 8 ]; then + usage + exit 1 + fi + FANS="$1" +else + usage + exit 1 +fi + +for fan in $FANS; do + echo "Fan $fan RPMs: $(show_rpm $fan), ($(show_pwm $fan))" +done diff --git a/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/init_pwm.sh b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/init_pwm.sh new file mode 100755 index 0000000..5804598 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/init_pwm.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2004-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +PWM_DIR=/sys/class/i2c-adapter/i2c-1/1-002f + +set -e + +# On ASUS boards, there are up to 8 fans connected. +# Each fan has one PWM input and 1 tachometer output. +# For each fan, set the type, and set initial speed to 100% +for pwm in 1 2 3 4 5 6 7 8; do + echo 1 > $PWM_DIR/pwm${pwm}_enable + echo 255 > $PWM_DIR/pwm${pwm} +done diff --git a/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/set_fan_speed.sh b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/set_fan_speed.sh new file mode 100755 index 0000000..99be901 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/set_fan_speed.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2015-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +usage() { + echo "Usage: $0 <PERCENT (0..100)> <Fan Unit (1..8)> " >&2 +} + +FAN_DIR=/sys/class/i2c-adapter/i2c-1/1-002f + +set -e + +if [ "$#" -ne 2 ] && [ "$#" -ne 1 ]; then + usage + exit 1 +fi + +if [ "$#" -eq 1 ]; then + FANS="1 2 3 4 5 6 7 8" +else + FANS="$2" +fi + +# Convert the percentage to our 1/256th unit (0-255). +unit=$(( ( $1 * 255 ) / 100 )) + +for fan in $FANS; do + pwm="${FAN_DIR}/pwm${fan}" + echo "$unit" > $pwm + echo "Successfully set fan ${fan} speed to $1%" +done diff --git a/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/setup-fan.sh b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/setup-fan.sh new file mode 100644 index 0000000..2b2e902 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/setup-fan.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +### BEGIN INIT INFO +# Provides: setup-fan +# Required-Start: board-id +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Set fan speed +### END INIT INFO + +echo -n "Setup fan speed... " +rmmod w83795 || true +/usr/local/bin/platform_sensor_init +modprobe w83795 force_w83795=1,0x2f +/usr/local/bin/init_pwm.sh +/usr/local/bin/set_fan_speed.sh 50 +/usr/local/bin/fand +echo "done." diff --git a/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl_0.1.bbappend b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl_0.1.bbappend new file mode 100644 index 0000000..b6f0ae1 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl_0.1.bbappend @@ -0,0 +1,65 @@ +# Copyright 2017-present Raptor Engineering. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +DEPENDS_append = " update-rc.d-native" + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +SRC_URI += "file://get_fan_speed.sh \ + file://set_fan_speed.sh \ + file://init_pwm.sh \ + file://setup-fan.sh \ + " + +S = "${WORKDIR}" + +binfiles = " \ + get_fan_speed.sh \ + set_fan_speed.sh \ + init_pwm.sh \ + fand \ + platform_sensor_init \ + " + +CXXFLAGS_prepend = "-DCONFIG_ASUS " + +pkgdir = "fan_ctrl" + +do_install() { + dst="${D}/usr/local/fbpackages/${pkgdir}" + bin="${D}/usr/local/bin" + install -d $dst + install -d $bin + for f in ${binfiles}; do + install -m 755 $f ${bin}/$f + done + for f in ${otherfiles}; do + install -m 644 $f ${dst}/$f + done + install -d ${D}${sysconfdir}/init.d + install -d ${D}${sysconfdir}/rcS.d + install -m 755 setup-fan.sh ${D}${sysconfdir}/init.d/setup-fan.sh + update-rc.d -r ${D} setup-fan.sh start 91 S . +} + +FBPACKAGEDIR = "${prefix}/local/fbpackages" + +FILES_${PN} = "${FBPACKAGEDIR}/fan_ctrl ${prefix}/local/bin ${sysconfdir} " + +# Inhibit complaints about .debug directories for the fand binary: + +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" diff --git a/meta-raptor/meta-asus/recipes-core/images/asus-image.bb b/meta-raptor/meta-asus/recipes-core/images/asus-image.bb new file mode 100644 index 0000000..b623f38 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/images/asus-image.bb @@ -0,0 +1,106 @@ +inherit asus_uboot_image + +# /dev +require recipes-core/images/aspeed-dev.inc + +# Base this image on core-image-minimal +include recipes-core/images/core-image-minimal.bb + +# Changing the image compression from gz to lzma achieves 30% saving (~3M). +# However, the current u-boot does not have lzma enabled. Stick to gz +# until we generate a new u-boot image. +IMAGE_FSTYPES += "squashfs" + +PYTHON_PKGS = " \ + python-core \ + python-io \ + python-json \ + python-shell \ + python-subprocess \ + python-argparse \ + python-ctypes \ + python-datetime \ + python-email \ + python-threading \ + python-mime \ + python-pickle \ + python-misc \ + python-netserver \ + " + +NTP_PKGS = " \ + ntp \ + ntp-utils \ + sntp \ + ntpdate \ + " + +# Include modules in rootfs +IMAGE_INSTALL += " \ + kernel-modules \ + u-boot \ + u-boot-fw-utils \ + openbmc-utils \ + openbmc-gpio \ + fan-ctrl \ + watchdog-ctrl \ + i2c-tools \ + sensor-setup \ + lldp-util \ + lmsensors-sensors \ + sms-kcsd \ + rest-api \ + bottle \ + ipmid \ + po-eeprom \ + bitbang \ + ${PYTHON_PKGS} \ + ${NTP_PKGS} \ + iproute2 \ + dhcp-client \ + jbi \ + flashrom \ + cherryPy \ + screen \ + " + +IMAGE_FEATURES += " \ + ssh-server-openssh \ + " + +DISTRO_FEATURES += " \ + ext2 \ + nfs \ + usbgadget \ + " + +# IPv6 deactivated due to lack of memory. If you need IPv6 please deactivate IPv4 +# DISTRO_FEATURES += " ipv6" +disable_ipv6() { + rm -f ${IMAGE_ROOTFS}/etc/network/if-up.d/dhcpv6_* +} +ROOTFS_POSTPROCESS_COMMAND += "disable_ipv6;" + +# Flash space is limited and PIP will not be run +# However, it does not appear there is a way to prevent ensurepip from being installed, +# so simply delete it before the rootfs is packaged / compressed... +# Same goes for the various Python module test suites... +# ...and tutorial PDFs... +remove_spurious_files() { + rm -rf ${IMAGE_ROOTFS}/usr/lib/python2.7/ensurepip + rm -rf ${IMAGE_ROOTFS}/usr/lib/python2.7/ctypes/test + rm -rf ${IMAGE_ROOTFS}/usr/lib/python2.7/email/test + rm -rf ${IMAGE_ROOTFS}/usr/lib/python2.7/json/tests + rm -rf ${IMAGE_ROOTFS}/usr/lib/python2.7/site-packages/cherrypy/test + rm -rf ${IMAGE_ROOTFS}/usr/share/cherrypy/tutorial/ +} + +ROOTFS_POSTPROCESS_COMMAND += "remove_spurious_files;" + +# Our root filesystem is read-only, so some directories need to be created before the +# rootfs is flashed onto the system +create_missing_directories() { + mkdir ${IMAGE_ROOTFS}/mnt/data +} + +ROOTFS_POSTPROCESS_COMMAND += "create_missing_directories;" diff --git a/meta-raptor/meta-asus/recipes-core/initscripts/initscripts/mountall.sh b/meta-raptor/meta-asus/recipes-core/initscripts/initscripts/mountall.sh new file mode 100755 index 0000000..68c20ef --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/initscripts/initscripts/mountall.sh @@ -0,0 +1,57 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: mountall +# Required-Start: mountvirtfs +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Mount all filesystems. +# Description: +### END INIT INFO + +. /etc/default/rcS + +# +# Mount local filesystems in /etc/fstab. For some reason, people +# might want to mount "proc" several times, and mount -v complains +# about this. So we mount "proc" filesystems without -v. +# +test "$VERBOSE" != no && echo "Mounting local filesystems..." +mount -at nonfs,nosmbfs,noncpfs 2>/dev/null +mount /tmp + +# Create unionfs + +mkdir /tmp/unionfs +mkdir /tmp/unionfs/dev +mkdir /tmp/unionfs/etc +mkdir /tmp/unionfs/var +mkdir /tmp/unionfs/media + +umount /dev/pts + +mount -t unionfs -o dirs=/tmp/unionfs/dev=rw:/dev=ro none /dev +mount -t unionfs -o dirs=/tmp/unionfs/etc=rw:/etc=ro none /etc +mount -t unionfs -o dirs=/tmp/unionfs/var=rw:/var=ro none /var +mount -t unionfs -o dirs=/tmp/unionfs/media=rw:/media=ro none /media + +mount -t devpts devpts /dev/pts + +# +# We might have mounted something over /dev, see if /dev/initctl is there. +# +if test ! -p /dev/initctl +then + rm -f /dev/initctl + mknod -m 600 /dev/initctl p +fi +kill -USR1 1 + +# +# Execute swapon command again, in case we want to swap to +# a file on a now mounted filesystem. +# +swapon -a 2> /dev/null + +: exit 0 + diff --git a/meta-raptor/meta-asus/recipes-core/initscripts/initscripts_1.0.bbappend b/meta-raptor/meta-asus/recipes-core/initscripts/initscripts_1.0.bbappend new file mode 100644 index 0000000..9652309 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/initscripts/initscripts_1.0.bbappend @@ -0,0 +1 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
\ No newline at end of file diff --git a/meta-raptor/meta-asus/recipes-core/sysvinit/sysvinit-inittab_%.bbappend b/meta-raptor/meta-asus/recipes-core/sysvinit/sysvinit-inittab_%.bbappend new file mode 100644 index 0000000..7d17499 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/sysvinit/sysvinit-inittab_%.bbappend @@ -0,0 +1,2 @@ +# ttyS1 is UART1, connected to on-board console debug port +SERIAL_CONSOLES = "38400;ttyS1" diff --git a/meta-raptor/meta-asus/recipes-extended/rsyslog/rsyslog/rsyslog.logrotate b/meta-raptor/meta-asus/recipes-extended/rsyslog/rsyslog/rsyslog.logrotate new file mode 100644 index 0000000..b85cbcf --- /dev/null +++ b/meta-raptor/meta-asus/recipes-extended/rsyslog/rsyslog/rsyslog.logrotate @@ -0,0 +1,39 @@ +# /etc/logrotate.d/rsyslog - Ported from Debian + +/var/log/syslog +{ + rotate 2 + hourly + missingok + notifempty + delaycompress + compress + postrotate + /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true + endscript +} + +/var/log/mail.info +/var/log/mail.warn +/var/log/mail.err +/var/log/mail.log +/var/log/daemon.log +/var/log/kern.log +/var/log/auth.log +/var/log/user.log +/var/log/lpr.log +/var/log/cron.log +/var/log/debug +/var/log/messages +{ + rotate 2 + hourly + missingok + notifempty + compress + delaycompress + sharedscripts + postrotate + /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true + endscript +} diff --git a/meta-raptor/meta-asus/recipes-extended/rsyslog/rsyslog_7.4.4.bbappend b/meta-raptor/meta-asus/recipes-extended/rsyslog/rsyslog_7.4.4.bbappend new file mode 100644 index 0000000..72d991c --- /dev/null +++ b/meta-raptor/meta-asus/recipes-extended/rsyslog/rsyslog_7.4.4.bbappend @@ -0,0 +1 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/meta-raptor/meta-asus/recipes-kernel/com-e-mod/files/COPYING b/meta-raptor/meta-asus/recipes-kernel/com-e-mod/files/COPYING new file mode 100644 index 0000000..6d45519 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/com-e-mod/files/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/meta-raptor/meta-asus/recipes-kernel/com-e-mod/files/Makefile b/meta-raptor/meta-asus/recipes-kernel/com-e-mod/files/Makefile new file mode 100644 index 0000000..d3b524e --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/com-e-mod/files/Makefile @@ -0,0 +1,31 @@ +# Copyright 2015-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +obj-m := com_e_driver.o + +SRC := $(shell pwd) + +all: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) + +modules_install: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install + +clean: + rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c + rm -f Module.markers Module.symvers modules.order + rm -rf .tmp_versions Modules.symvers diff --git a/meta-raptor/meta-asus/recipes-kernel/com-e-mod/files/com_e_driver.c b/meta-raptor/meta-asus/recipes-kernel/com-e-mod/files/com_e_driver.c new file mode 100644 index 0000000..0a3df37 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/com-e-mod/files/com_e_driver.c @@ -0,0 +1,365 @@ +/* + * com_e_driver.c - The i2c driver for COMe + * + * Copyright 2015-present Facebook. All Rights Reserved. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <linux/errno.h> +#include <linux/module.h> +#include <linux/i2c.h> +#include <linux/i2c_dev_sysfs.h> + +#ifdef DEBUG + +#define PP_DEBUG(fmt, ...) do { \ + printk(KERN_DEBUG "%s:%d " fmt "\n", \ + __FUNCTION__, __LINE__, ##__VA_ARGS__); \ +} while (0) + +#else /* !DEBUG */ + +#define PP_DEBUG(fmt, ...) + +#endif + +static ssize_t i2c_dev_show_mac(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + uint8_t values[6]; + int ret_val; + + ret_val = i2c_dev_read_nbytes(dev, attr, values, 6); + if (ret_val < 0) { + return ret_val; + } + //values[] : mac address + return scnprintf(buf, PAGE_SIZE, "%02x:%02x:%02x:%02x:%02x:%02x\n", values[0], + values[1], values[2], values[3], values[4], values[5]); +} + +static ssize_t i2c_dev_show_date(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + uint8_t values[3]; + int ret_val; + + ret_val = i2c_dev_read_nbytes(dev, attr, values, 3); + if (ret_val < 0) { + return ret_val; + } + //values[0] : year + //values[1] : month + //values[2] : day + return scnprintf(buf, PAGE_SIZE, "%x/%x/%x\n", values[1], + values[2], values[0]); +} + +static ssize_t i2c_dev_show_version(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + uint8_t values[3]; + int ret_val; + + ret_val = i2c_dev_read_nbytes(dev, attr, values, 3); + if (ret_val < 0) { + return ret_val; + } + //values[0] : Version_R + //values[1] : Version_E + //values[2] : Version_T + return scnprintf(buf, PAGE_SIZE, "EC Version R=0x%02x E=0x%02x T=0x%2x\n", + values[0], values[1], values[2]); + +} + +static ssize_t i2c_dev_show_cpu_temp(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + int ret_val; + + ret_val = i2c_dev_read_byte(dev, attr); + if (ret_val < 0) { + return ret_val; + } + return scnprintf(buf, PAGE_SIZE, "%u\n", ret_val); +} + +static ssize_t i2c_dev_show_voltage0(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + int result; + + result = i2c_dev_read_word_littleendian(dev, attr); + if (result < 0) { + return result; + } + result = (result * 1000) / 341; + return scnprintf(buf, PAGE_SIZE, "%u\n", result); +} + +static ssize_t i2c_dev_show_voltage1(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + int result; + + result = i2c_dev_read_word_littleendian(dev, attr); + if (result < 0) { + return result; + } + result = (result * 2000) / 341; + return scnprintf(buf, PAGE_SIZE, "%u\n", result); +} + +static ssize_t i2c_dev_show_voltage2(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + int result; + + result = i2c_dev_read_word_littleendian(dev, attr); + if (result < 0) { + return result; + } + result = (result * 3200) / 341; + return scnprintf(buf, PAGE_SIZE, "%u\n", result); +} + +static ssize_t i2c_dev_show_voltage3(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + int result; + + result = i2c_dev_read_word_littleendian(dev, attr); + if (result < 0) { + return result; + } + result = (result * 6600) / 341; + return scnprintf(buf, PAGE_SIZE, "%u\n", result); +} + +static const i2c_dev_attr_st com_e_attr_table[] = { + { + "temp1_input", // cpu_temp + NULL, + i2c_dev_show_cpu_temp, + NULL, + 0x0, 0, 8, + }, + { + "version", // version_r,_e,_t + NULL, + i2c_dev_show_version, + NULL, + 0x1D, 0, 24, + }, + { + "in0_input", // CPU_vcore + NULL, + i2c_dev_show_voltage0, + NULL, + 0x20, 0, 16, + }, + { + "in1_input",// 3V + NULL, + i2c_dev_show_voltage1, + NULL, + 0x22, 0, 16, + }, + { + "in2_input",// 5V + NULL, + i2c_dev_show_voltage2, + NULL, + 0x24, 0, 16, + }, + { + "date", + NULL, + i2c_dev_show_date, + NULL, + 0x2D, 0, 24, + }, + { + "in3_input",// 12V + NULL, + i2c_dev_show_voltage3, + NULL, + 0x30, 0, 16, + }, + { + "in4_input",// VDIMM + NULL, + i2c_dev_show_voltage0, + NULL, + 0x32, 0, 16, + }, + { + "product_name", + NULL, + i2c_dev_show_ascii, + NULL, + 0x3C, 0, 32, + }, + { + "customize_name", + NULL, + i2c_dev_show_ascii, + NULL, + 0x4D, 0, 24, + }, + { + "mac", + NULL, + i2c_dev_show_mac, + NULL, + 0x50, 0, 48, + }, + { + "serial_number", + NULL, + i2c_dev_show_ascii, + NULL, + 0x60, 0, 256, + }, + { + "in0_label", + "CPU Vcore", + i2c_dev_show_label, + NULL, + 0x0, 0, 0, + }, + { + "in1_label", + "+3V Voltage", + i2c_dev_show_label, + NULL, + 0x0, 0, 0, + }, + { + "in2_label", + "+5V Voltage", + i2c_dev_show_label, + NULL, + 0x0, 0, 0, + }, + { + "in3_label", + "+12V Voltage", + i2c_dev_show_label, + NULL, + 0x0, 0, 0, + }, + { + "in4_label", + "VDIMM Voltage", + i2c_dev_show_label, + NULL, + 0x0, 0, 0, + }, + { + "temp1_label", + "CPU Temp", + i2c_dev_show_label, + NULL, + 0x0, 0, 0, + }, +}; + +static i2c_dev_data_st com_e_data; + +/* + * COMe i2c addresses. + * normal_i2c is used in I2C_CLIENT_INSMOD_1() + */ +static const unsigned short normal_i2c[] = { + 0x33, I2C_CLIENT_END +}; + +/* + * Insmod parameters + */ +I2C_CLIENT_INSMOD_1(com_e); + +/* COMe id */ +static const struct i2c_device_id com_e_id[] = { + { "com_e_driver", com_e_id }, + { }, +}; +MODULE_DEVICE_TABLE(i2c, com_e_id); + +/* Return 0 if detection is successful, -ENODEV otherwise */ +static int com_e_detect(struct i2c_client *client, int kind, + struct i2c_board_info *info) +{ + /* + * We don't currently do any detection of the COMe + */ + strlcpy(info->type, "com_e_driver", I2C_NAME_SIZE); + return 0; +} + +static int com_e_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + int n_attrs = sizeof(com_e_attr_table) / sizeof(com_e_attr_table[0]); + return i2c_dev_sysfs_data_init(client, &com_e_data, + com_e_attr_table, n_attrs); +} + +static int com_e_remove(struct i2c_client *client) +{ + i2c_dev_sysfs_data_clean(client, &com_e_data); + return 0; +} + +static struct i2c_driver com_e_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "com_e_driver", + }, + .probe = com_e_probe, + .remove = com_e_remove, + .id_table = com_e_id, + .detect = com_e_detect, + /* addr_data is defined through I2C_CLIENT_INSMOD_1() */ + .address_data = &addr_data, +}; + +static int __init com_e_mod_init(void) +{ + return i2c_add_driver(&com_e_driver); +} + +static void __exit com_e_mod_exit(void) +{ + i2c_del_driver(&com_e_driver); +} + +MODULE_AUTHOR("Vineela Kukkadapu <vineelak@fb.com>"); +MODULE_DESCRIPTION("COM_E Driver"); +MODULE_LICENSE("GPL"); + +module_init(com_e_mod_init); +module_exit(com_e_mod_exit); diff --git a/meta-raptor/meta-asus/recipes-kernel/com-e-mod/kernel-module-com-e-driver_0.1.bb b/meta-raptor/meta-asus/recipes-kernel/com-e-mod/kernel-module-com-e-driver_0.1.bb new file mode 100644 index 0000000..8ec6511 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/com-e-mod/kernel-module-com-e-driver_0.1.bb @@ -0,0 +1,40 @@ +# Copyright 2016-present Raptor Engineering. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +SUMMARY = "ASUS COMe driver" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" + +inherit module + +PR = "r0" +PV = "0.1" + +SRC_URI = "file://Makefile \ + file://com_e_driver.c \ + file://COPYING \ + " + +S = "${WORKDIR}" + +DEPENDS += "kernel-module-i2c-dev-sysfs" + +RDEPENDS_${PN} += "kernel-module-i2c-dev-sysfs" + +KERNEL_MODULE_AUTOLOAD += " \ + com_e_driver \ +" diff --git a/meta-raptor/meta-asus/recipes-kernel/cpld-mod/files/COPYING b/meta-raptor/meta-asus/recipes-kernel/cpld-mod/files/COPYING new file mode 100644 index 0000000..6d45519 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/cpld-mod/files/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/meta-raptor/meta-asus/recipes-kernel/cpld-mod/files/Makefile b/meta-raptor/meta-asus/recipes-kernel/cpld-mod/files/Makefile new file mode 100644 index 0000000..bfbd786 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/cpld-mod/files/Makefile @@ -0,0 +1,31 @@ +# Copyright 2015-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +obj-m := syscpld.o fancpld.o + +SRC := $(shell pwd) + +all: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) + +modules_install: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install + +clean: + rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c + rm -f Module.markers Module.symvers modules.order + rm -rf .tmp_versions Modules.symvers diff --git a/meta-raptor/meta-asus/recipes-kernel/cpld-mod/files/fancpld.c b/meta-raptor/meta-asus/recipes-kernel/cpld-mod/files/fancpld.c new file mode 100644 index 0000000..65ea0d1 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/cpld-mod/files/fancpld.c @@ -0,0 +1,396 @@ +/* + * fancpld.c - The i2c driver for FANBOARDCPLD + * + * Copyright 2015-present Facebook. All Rights Reserved. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +//#define DEBUG + +#include <linux/errno.h> +#include <linux/module.h> +#include <linux/i2c.h> +#include <linux/i2c_dev_sysfs.h> + +#ifdef DEBUG + +#define PP_DEBUG(fmt, ...) do { \ + printk(KERN_DEBUG "%s:%d " fmt "\n", \ + __FUNCTION__, __LINE__, ##__VA_ARGS__); \ +} while (0) + +#else /* !DEBUG */ + +#define PP_DEBUG(fmt, ...) + +#endif + +static ssize_t fancpld_fan_rpm_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + int val; + + val = i2c_dev_read_byte(dev, attr); + if (val < 0) { + return val; + } + /* Multiply by 150 to get the RPM */ + val *= 150; + + return scnprintf(buf, PAGE_SIZE, "%u\n", val); +} + +#define FANTRAY_PWM_HELP \ + "each value represents 1/32 duty cycle" +#define FANTRAY_LED_CTRL_HELP \ + "0x0: Under HW control\n" \ + "0x1: Red off, Blue on\n" \ + "0x2: Red on, Blue off\n" \ + "0x3: Red off, Blue off" +#define FANTRAY_LED_BLINK_HELP \ + "0: no blink\n" \ + "1: blink" + +static const i2c_dev_attr_st fancpld_attr_table[] = { + { + "board_rev", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 0, 0, 4, + }, + { + "model_id", + "0x0: wedge100\n" + "0x1: 6-pack100 linecard\n" + "0x2: 6-pack100 fabric card\n" + "0x3: reserved", + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 0, 4, 2, + }, + { + "cpld_rev", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 1, 0, 6, + }, + { + "cpld_released", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 1, 6, 1, + }, + { + "cpld_sub_rev", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 2, 0, 8, + }, + { + "slotid", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 3, 0, 5, + }, + { + "jaybox_gpio", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 4, 0, 8, + }, + { + "jaybox_status", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 5, 0, 2, + }, + { + "fantray_failure", + "bit value 0: fan tray has failure\n" + "bit value 1: fan try is good and alive", + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 9, 0, 5, + }, + { + "fan1_input", + NULL, + fancpld_fan_rpm_show, + NULL, + 0x10, 0, 8, + }, + { + "fan2_input", + NULL, + fancpld_fan_rpm_show, + NULL, + 0x11, 0, 8, + }, + { + "fan3_input", + NULL, + fancpld_fan_rpm_show, + NULL, + 0x12, 0, 8, + }, + { + "fan4_input", + NULL, + fancpld_fan_rpm_show, + NULL, + 0x13, 0, 8, + }, + { + "fan5_input", + NULL, + fancpld_fan_rpm_show, + NULL, + 0x14, 0, 8, + }, + { + "fan6_input", + NULL, + fancpld_fan_rpm_show, + NULL, + 0x15, 0, 8, + }, + { + "fan7_input", + NULL, + fancpld_fan_rpm_show, + NULL, + 0x16, 0, 8, + }, + { + "fan8_input", + NULL, + fancpld_fan_rpm_show, + NULL, + 0x17, 0, 8, + }, + { + "fan9_input", + NULL, + fancpld_fan_rpm_show, + NULL, + 0x18, 0, 8, + }, + { + "fan10_input", + NULL, + fancpld_fan_rpm_show, + NULL, + 0x19, 0, 8, + }, + { + "fantray_present", + "0: present\n" + "1: not present", + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 0x1d, 0, 5, + }, + { + "fantray1_pwm", + FANTRAY_PWM_HELP, + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x20, 0, 5, + }, + { + "fantray2_pwm", + FANTRAY_PWM_HELP, + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x21, 0, 5, + }, + { + "fantray3_pwm", + FANTRAY_PWM_HELP, + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x22, 0, 5, + }, + { + "fantray4_pwm", + FANTRAY_PWM_HELP, + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x23, 0, 5, + }, + { + "fantray5_pwm", + FANTRAY_PWM_HELP, + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x24, 0, 5, + }, + { + "fantray1_led_ctrl", + FANTRAY_LED_CTRL_HELP, + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x25, 0, 2, + }, + { + "fantray1_led_blink", + FANTRAY_LED_BLINK_HELP, + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x25, 2, 1, + }, + { + "fantray2_led_ctrl", + FANTRAY_LED_CTRL_HELP, + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x25, 4, 2, + }, + { + "fantray2_led_blink", + FANTRAY_LED_BLINK_HELP, + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x25, 6, 1, + }, + { + "fantray3_led_ctrl", + FANTRAY_LED_CTRL_HELP, + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x26, 0, 2, + }, + { + "fantray3_led_blink", + FANTRAY_LED_BLINK_HELP, + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x26, 2, 1, + }, + { + "fantray4_led_ctrl", + FANTRAY_LED_CTRL_HELP, + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x26, 4, 2, + }, + { + "fantray4_led_blink", + FANTRAY_LED_BLINK_HELP, + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x26, 6, 1, + }, + { + "fantray5_led_ctrl", + FANTRAY_LED_CTRL_HELP, + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x27, 0, 2, + }, + { + "fantray5_led_blink", + FANTRAY_LED_BLINK_HELP, + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x27, 2, 1, + }, +}; + +static i2c_dev_data_st fancpld_data; + +/* + * FANCPLD i2c addresses. + * normal_i2c is used in I2C_CLIENT_INSMOD_1() + */ +static const unsigned short normal_i2c[] = { + 0x33, I2C_CLIENT_END +}; + +/* + * Insmod parameters + */ +I2C_CLIENT_INSMOD_1(fancpld); + +/* FANCPLD id */ +static const struct i2c_device_id fancpld_id[] = { + { "fancpld", fancpld }, + { }, +}; +MODULE_DEVICE_TABLE(i2c, fancpld_id); + +/* Return 0 if detection is successful, -ENODEV otherwise */ +static int fancpld_detect(struct i2c_client *client, int kind, + struct i2c_board_info *info) +{ + /* + * We don't currently do any detection of the FANCPLD + */ + strlcpy(info->type, "fancpld", I2C_NAME_SIZE); + return 0; +} + +static int fancpld_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + int n_attrs = sizeof(fancpld_attr_table) / sizeof(fancpld_attr_table[0]); + return i2c_dev_sysfs_data_init(client, &fancpld_data, + fancpld_attr_table, n_attrs); +} + +static int fancpld_remove(struct i2c_client *client) +{ + i2c_dev_sysfs_data_clean(client, &fancpld_data); + return 0; +} + +static struct i2c_driver fancpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "fancpld", + }, + .probe = fancpld_probe, + .remove = fancpld_remove, + .id_table = fancpld_id, + .detect = fancpld_detect, + /* addr_data is defined through I2C_CLIENT_INSMOD_1() */ + .address_data = &addr_data, +}; + +static int __init fancpld_mod_init(void) +{ + return i2c_add_driver(&fancpld_driver); +} + +static void __exit fancpld_mod_exit(void) +{ + i2c_del_driver(&fancpld_driver); +} + +MODULE_AUTHOR("Tian Fang <tfang@fb.com>"); +MODULE_DESCRIPTION("FANCPLD Driver"); +MODULE_LICENSE("GPL"); + +module_init(fancpld_mod_init); +module_exit(fancpld_mod_exit); diff --git a/meta-raptor/meta-asus/recipes-kernel/cpld-mod/files/syscpld.c b/meta-raptor/meta-asus/recipes-kernel/cpld-mod/files/syscpld.c new file mode 100644 index 0000000..1f5abeb --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/cpld-mod/files/syscpld.c @@ -0,0 +1,281 @@ +/* + * syscpld.c - The i2c driver for SYSCPLD + * + * Copyright 2015-present Facebook. All Rights Reserved. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +//#define DEBUG + +#include <linux/errno.h> +#include <linux/module.h> +#include <linux/i2c.h> +#include <linux/i2c_dev_sysfs.h> + +#ifdef DEBUG + +#define PP_DEBUG(fmt, ...) do { \ + printk(KERN_DEBUG "%s:%d " fmt "\n", \ + __FUNCTION__, __LINE__, ##__VA_ARGS__); \ +} while (0) + +#else /* !DEBUG */ + +#define PP_DEBUG(fmt, ...) + +#endif + +static const i2c_dev_attr_st syscpld_attr_table[] = { + { + "board_rev", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 0, 0, 4, + }, + { + "model_id", + "0x0: wedge100\n" + "0x1: 6-pack100 linecard\n" + "0x2: 6-pack100 fabric card\n" + "0x3: reserved", + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 0, 4, 2, + }, + { + "cpld_rev", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 1, 0, 6, + }, + { + "cpld_released", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 1, 6, 1, + }, + { + "cpld_sub_rev", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 2, 0, 8, + }, + { + "slotid", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 3, 0, 5, + }, + { + "psu1_present", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 8, 0, 1, + }, + { + "psu2_present", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 8, 1, 1, + }, + { + "fan_rackmon_present", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 8, 2, 1, + }, + { + "micro_srv_present", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 8, 3, 1, + }, + { + "th_rov", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 0xb, 0, 4, + }, + { + "vcore_idsel", + NULL, + I2C_DEV_ATTR_SHOW_DEFAULT, + NULL, + 0xb, 4, 3, + }, + { + "uart_mux", + "0x0: UART_SELECT_BMC\n0x1: UART_SELECT_DBG\n" + "0x2: Force to select 0\n0x3: Force to select 1\n\n" + "UART_SEL\n" + "1: micro-server console connected to BMC\n" + "0: micro-server console connected to debug header", + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x26, 0, 2, + }, + { + "heart_attach_en", + "0: no fan tray fatal error attack\n" + "1: fan-tray fatal error attack mode enabled", + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x2e, 7, 1, + }, + { + "dual_boot_en", + "0: single boot\n" + "1: dual boot", + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x2f, 0, 1, + }, + { + "2nd_flash_wp", + "0: writeable\n" + "1: write protected", + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x2f, 1, 1, + }, + { + "pwr_cyc_all_n", + "0: power cycle all power\n" + "1: normal", + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x30, 0, 1, + }, + { + "pwr_main_n", + "0: main power is off\n" + "1: main power is enabled", + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x30, 1, 1, + }, + { + "pwr_usrv_en", + "0: micro-server power is off\n" + "1: micro-server power is on", + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x30, 2, 1, + }, + { + "pwr_usrv_btn_en", + "0: micro-server power button is off\n" + "1: micro-server power button is on", + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x30, 3, 1, + }, + { + "usrv_rst_n", + "0: write 0 to trigger micro-server reset" + "1: normal", + I2C_DEV_ATTR_SHOW_DEFAULT, + I2C_DEV_ATTR_STORE_DEFAULT, + 0x32, 0, 1, + }, +}; + +static i2c_dev_data_st syscpld_data; + +/* + * SYSCPLD i2c addresses. + * normal_i2c is used in I2C_CLIENT_INSMOD_1() + */ +static const unsigned short normal_i2c[] = { + 0x31, I2C_CLIENT_END +}; + +/* + * Insmod parameters + */ +I2C_CLIENT_INSMOD_1(syscpld); + +/* SYSCPLD id */ +static const struct i2c_device_id syscpld_id[] = { + { "syscpld", syscpld }, + { }, +}; +MODULE_DEVICE_TABLE(i2c, syscpld_id); + +/* Return 0 if detection is successful, -ENODEV otherwise */ +static int syscpld_detect(struct i2c_client *client, int kind, + struct i2c_board_info *info) +{ + /* + * We don't currently do any detection of the SYSCPLD + */ + strlcpy(info->type, "syscpld", I2C_NAME_SIZE); + return 0; +} + +static int syscpld_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + int n_attrs = sizeof(syscpld_attr_table) / sizeof(syscpld_attr_table[0]); + return i2c_dev_sysfs_data_init(client, &syscpld_data, + syscpld_attr_table, n_attrs); +} + +static int syscpld_remove(struct i2c_client *client) +{ + i2c_dev_sysfs_data_clean(client, &syscpld_data); + return 0; +} + +static struct i2c_driver syscpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "syscpld", + }, + .probe = syscpld_probe, + .remove = syscpld_remove, + .id_table = syscpld_id, + .detect = syscpld_detect, + /* addr_data is defined through I2C_CLIENT_INSMOD_1() */ + .address_data = &addr_data, +}; + +static int __init syscpld_mod_init(void) +{ + return i2c_add_driver(&syscpld_driver); +} + +static void __exit syscpld_mod_exit(void) +{ + i2c_del_driver(&syscpld_driver); +} + +MODULE_AUTHOR("Tian Fang <tfang@fb.com>"); +MODULE_DESCRIPTION("SYSCPLD Driver"); +MODULE_LICENSE("GPL"); + +module_init(syscpld_mod_init); +module_exit(syscpld_mod_exit); diff --git a/meta-raptor/meta-asus/recipes-kernel/cpld-mod/kernel-module-cpld_0.1.bb b/meta-raptor/meta-asus/recipes-kernel/cpld-mod/kernel-module-cpld_0.1.bb new file mode 100644 index 0000000..0e6b4f7 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/cpld-mod/kernel-module-cpld_0.1.bb @@ -0,0 +1,42 @@ +# Copyright 2016-present Raptor Engineering. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +SUMMARY = "ASUS CPLD drivers" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" + +inherit module + +PR = "r0" +PV = "0.1" + +SRC_URI = "file://Makefile \ + file://syscpld.c \ + file://fancpld.c \ + file://COPYING \ + " + +S = "${WORKDIR}" + +DEPENDS += "kernel-module-i2c-dev-sysfs" + +RDEPENDS_${PN} += "kernel-module-i2c-dev-sysfs" + +KERNEL_MODULE_AUTOLOAD += " \ + syscpld \ + fancpld \ +" diff --git a/meta-raptor/meta-asus/recipes-kernel/i2c-dev-sysfs-mod/files/COPYING b/meta-raptor/meta-asus/recipes-kernel/i2c-dev-sysfs-mod/files/COPYING new file mode 100644 index 0000000..6d45519 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/i2c-dev-sysfs-mod/files/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/meta-raptor/meta-asus/recipes-kernel/i2c-dev-sysfs-mod/files/Makefile b/meta-raptor/meta-asus/recipes-kernel/i2c-dev-sysfs-mod/files/Makefile new file mode 100644 index 0000000..4be7b62 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/i2c-dev-sysfs-mod/files/Makefile @@ -0,0 +1,31 @@ +# Copyright 2015-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +obj-m := i2c_dev_sysfs.o + +SRC := $(shell pwd) + +all: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) + +modules_install: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install + +clean: + rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c + rm -f Module.markers Module.symvers modules.order + rm -rf .tmp_versions Modules.symvers diff --git a/meta-raptor/meta-asus/recipes-kernel/i2c-dev-sysfs-mod/files/i2c_dev_sysfs.c b/meta-raptor/meta-asus/recipes-kernel/i2c-dev-sysfs-mod/files/i2c_dev_sysfs.c new file mode 100644 index 0000000..96c1b98 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/i2c-dev-sysfs-mod/files/i2c_dev_sysfs.c @@ -0,0 +1,349 @@ +/* + * i2c_dev_sysfs.c - The i2c device sysfs library + * + * Copyright 2015-present Facebook. All Rights Reserved. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +//#define DEBUG + +#include <linux/err.h> +#include <linux/errno.h> +#include <linux/hwmon.h> +#include <linux/hwmon-sysfs.h> +#include <linux/i2c.h> +#include <linux/module.h> +#include <linux/mutex.h> +#include <linux/sysfs.h> + +#include "i2c_dev_sysfs.h" + +#ifdef DEBUG + +#define PP_DEBUG(fmt, ...) do { \ + printk(KERN_DEBUG "%s:%d " fmt "\n", \ + __FUNCTION__, __LINE__, ##__VA_ARGS__); \ +} while (0) + +#else /* !DEBUG */ + +#define PP_DEBUG(fmt, ...) + +#endif + +ssize_t i2c_dev_show_label(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + i2c_sysfs_attr_st *i2c_attr = TO_I2C_SYSFS_ATTR(attr); + const i2c_dev_attr_st *dev_attr = i2c_attr->isa_i2c_attr; + + if (dev_attr->ida_help) { + return sprintf(buf, "%s\n", dev_attr->ida_help); + } + return sprintf(buf, "%s\n", dev_attr->ida_name); +} +EXPORT_SYMBOL_GPL(i2c_dev_show_label); + +int i2c_dev_read_byte(struct device *dev, + struct device_attribute *attr) +{ + struct i2c_client *client = to_i2c_client(dev); + i2c_dev_data_st *data = i2c_get_clientdata(client); + i2c_sysfs_attr_st *i2c_attr = TO_I2C_SYSFS_ATTR(attr); + const i2c_dev_attr_st *dev_attr = i2c_attr->isa_i2c_attr; + int val; + int val_mask; + + val_mask = ~(((-1) >> (dev_attr->ida_n_bits)) << (dev_attr->ida_n_bits)); + + mutex_lock(&data->idd_lock); + + val = i2c_smbus_read_byte_data(client, dev_attr->ida_reg); + + mutex_unlock(&data->idd_lock); + + if (val < 0) { + /* error case */ + return val; + } + + val = (val >> dev_attr->ida_bit_offset) & val_mask; + return val; +} +EXPORT_SYMBOL_GPL(i2c_dev_read_byte); + +int i2c_dev_read_nbytes(struct device *dev, + struct device_attribute *attr, + uint8_t values[], + int nbytes) +{ + struct i2c_client *client = to_i2c_client(dev); + i2c_dev_data_st *data = i2c_get_clientdata(client); + i2c_sysfs_attr_st *i2c_attr = TO_I2C_SYSFS_ATTR(attr); + const i2c_dev_attr_st *dev_attr = i2c_attr->isa_i2c_attr; + int i; + + mutex_lock(&data->idd_lock); + for (i = 0; i < nbytes; ++i) { + values[i] = i2c_smbus_read_byte_data(client, dev_attr->ida_reg + i); + if (values[i] < 0) { + mutex_unlock(&data->idd_lock); + return values[i]; + } + } + mutex_unlock(&data->idd_lock); + return nbytes; +} +EXPORT_SYMBOL_GPL(i2c_dev_read_nbytes); + +int i2c_dev_read_word_littleendian(struct device *dev, + struct device_attribute *attr) +{ + uint8_t values[2]; + int ret_val; + + ret_val = i2c_dev_read_nbytes(dev, attr, values, 2); + if (ret_val < 0) { + return ret_val; + } + // values[0] : LSB + // values[1] : MSB + return ((values[1]<<8) + values[0]); +} +EXPORT_SYMBOL_GPL(i2c_dev_read_word_littleendian); + +int i2c_dev_read_word_bigendian(struct device *dev, + struct device_attribute *attr) +{ + uint8_t values[2]; + int ret_val; + + ret_val = i2c_dev_read_nbytes(dev, attr, values, 2); + if (ret_val < 0) { + return ret_val; + } + // values[0] : MSB + // values[1] : LSB + return ((values[0]<<8) + values[1]); +} +EXPORT_SYMBOL_GPL(i2c_dev_read_word_bigendian); + +ssize_t i2c_dev_show_ascii(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + i2c_sysfs_attr_st *i2c_attr = TO_I2C_SYSFS_ATTR(attr); + const i2c_dev_attr_st *dev_attr = i2c_attr->isa_i2c_attr; + int nbytes, ret_val; + + nbytes = (dev_attr->ida_n_bits) / 8; + ret_val = i2c_dev_read_nbytes(dev, attr, buf, nbytes); + if (ret_val < 0) { + return ret_val; + } + //buf[] : ascii data + buf[nbytes] = '\n'; + return (nbytes + 1); +} +EXPORT_SYMBOL_GPL(i2c_dev_show_ascii); + +static ssize_t i2c_dev_sysfs_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + i2c_dev_data_st *data = i2c_get_clientdata(client); + i2c_sysfs_attr_st *i2c_attr = TO_I2C_SYSFS_ATTR(attr); + const i2c_dev_attr_st *dev_attr = i2c_attr->isa_i2c_attr; + int val; + int val_mask; + + if (!dev_attr->ida_show) { + return -EOPNOTSUPP; + } + + if (dev_attr->ida_show != I2C_DEV_ATTR_SHOW_DEFAULT) { + return dev_attr->ida_show(dev, attr, buf); + } + + val_mask = ~(((-1) >> (dev_attr->ida_n_bits)) << (dev_attr->ida_n_bits)); + + mutex_lock(&data->idd_lock); + + /* default handling */ + val = i2c_smbus_read_byte_data(client, dev_attr->ida_reg); + + mutex_unlock(&data->idd_lock); + + if (val < 0) { + /* error case */ + return val; + } + + val = (val >> dev_attr->ida_bit_offset) & val_mask; + + return scnprintf(buf, PAGE_SIZE, "0x%x%s%s\n", val, + (dev_attr->ida_help) ? "\n\nNote:\n" : "", + (dev_attr->ida_help) ? dev_attr->ida_help : ""); +} + +static ssize_t i2c_dev_sysfs_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + i2c_dev_data_st *data = i2c_get_clientdata(client); + i2c_sysfs_attr_st *i2c_attr = TO_I2C_SYSFS_ATTR(attr); + const i2c_dev_attr_st *dev_attr = i2c_attr->isa_i2c_attr; + int val; + int req_val; + int req_val_mask; + + if (!dev_attr->ida_store) { + return -EOPNOTSUPP; + } + + if (dev_attr->ida_store != I2C_DEV_ATTR_STORE_DEFAULT) { + return dev_attr->ida_store(dev, attr, buf, count); + } + + /* parse the buffer */ + if (sscanf(buf, "%i", &req_val) <= 0) { + return -EINVAL; + } + req_val_mask = ~(((-1) >> (dev_attr->ida_n_bits)) << (dev_attr->ida_n_bits)); + req_val &= req_val_mask; + + mutex_lock(&data->idd_lock); + + /* default handling, first read back the current value */ + val = i2c_smbus_read_byte_data(client, dev_attr->ida_reg); + + if (val < 0) { + /* fail to read */ + goto unlock_out; + } + + /* mask out all bits for the value requested */ + val &= ~(req_val_mask << dev_attr->ida_bit_offset); + val |= req_val << dev_attr->ida_bit_offset; + + val = i2c_smbus_write_byte_data(client, dev_attr->ida_reg, val); + + unlock_out: + mutex_unlock(&data->idd_lock); + + if (val < 0) { + /* error case */ + return val; + } + + return count; +} + +void i2c_dev_sysfs_data_clean(struct i2c_client *client, i2c_dev_data_st *data) +{ + if (!data) { + return; + } + if (data->idd_hwmon_dev) { + hwmon_device_unregister(data->idd_hwmon_dev); + } + if (data->idd_attr_group.attrs) { + sysfs_remove_group(&client->dev.kobj, &data->idd_attr_group); + kfree(data->idd_attr_group.attrs); + } + if (data->idd_attrs) { + kfree(data->idd_attrs); + } + memset(data, 0, sizeof(*data)); +} +EXPORT_SYMBOL_GPL(i2c_dev_sysfs_data_clean); + +int i2c_dev_sysfs_data_init(struct i2c_client *client, + i2c_dev_data_st *data, + const i2c_dev_attr_st *dev_attrs, + int n_attrs) +{ + int i; + int err; + i2c_sysfs_attr_st *cur_attr; + const i2c_dev_attr_st *cur_dev_attr; + struct attribute **cur_grp_attr; + + memset(data, 0, sizeof(*data)); + + i2c_set_clientdata(client, data); + mutex_init(&data->idd_lock); + + /* allocate all attribute */ + data->idd_attrs = kzalloc(sizeof(*data->idd_attrs) * n_attrs, GFP_KERNEL); + /* allocate the attribute group. +1 for the last NULL */ + data->idd_attr_group.attrs + = kzalloc(sizeof(*data->idd_attr_group.attrs) * (n_attrs + 1), GFP_KERNEL); + if (!data->idd_attrs || !data->idd_attr_group.attrs) { + err = -ENOMEM; + goto exit_cleanup; + } + PP_DEBUG("Allocated %u attributes", n_attrs); + + for (i = 0, + cur_attr = &data->idd_attrs[0], + cur_grp_attr = &data->idd_attr_group.attrs[0], + cur_dev_attr = dev_attrs; + i < n_attrs; + i++, cur_attr++, cur_grp_attr++, cur_dev_attr++) { + + mode_t mode = S_IRUGO; + if (cur_dev_attr->ida_store) { + mode |= S_IWUSR; + } + cur_attr->isa_dev_attr.attr.name = cur_dev_attr->ida_name; + cur_attr->isa_dev_attr.attr.mode = mode; + cur_attr->isa_dev_attr.show = i2c_dev_sysfs_show; + cur_attr->isa_dev_attr.store = i2c_dev_sysfs_store; + *cur_grp_attr = &cur_attr->isa_dev_attr.attr; + cur_attr->isa_i2c_attr = cur_dev_attr; + PP_DEBUG("Created attribute \"%s\"", cur_attr->isa_dev_attr.attr.name); + } + + /* Register sysfs hooks */ + if ((err = sysfs_create_group(&client->dev.kobj, &data->idd_attr_group))) { + goto exit_cleanup; + } + + data->idd_hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->idd_hwmon_dev)) { + err = PTR_ERR(data->idd_hwmon_dev); + data->idd_hwmon_dev = NULL; + goto exit_cleanup; + } + + PP_DEBUG("i2c device sysfs init data done"); + + return 0; + + exit_cleanup: + i2c_dev_sysfs_data_clean(client, data); + return err; +} +EXPORT_SYMBOL_GPL(i2c_dev_sysfs_data_init); + + +MODULE_AUTHOR("Tian Fang <tfang@fb.com>"); +MODULE_DESCRIPTION("i2c device sysfs attribute library"); +MODULE_LICENSE("GPL"); diff --git a/meta-raptor/meta-asus/recipes-kernel/i2c-dev-sysfs-mod/files/i2c_dev_sysfs.h b/meta-raptor/meta-asus/recipes-kernel/i2c-dev-sysfs-mod/files/i2c_dev_sysfs.h new file mode 100644 index 0000000..47862cc --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/i2c-dev-sysfs-mod/files/i2c_dev_sysfs.h @@ -0,0 +1,84 @@ +/* + * i2c_dev_sysfs.h - The i2c device sysfs library header + * + * Copyright 2015-present Facebook. All Rights Reserved. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef I2C_DEV_SYSFS_H +#define I2C_DEV_SYSFS_H + +#include <linux/device.h> +#include <linux/types.h> + +typedef ssize_t (*i2c_dev_attr_show_fn)(struct device *dev, + struct device_attribute *attr, + char *buf); +typedef ssize_t (*i2c_dev_attr_store_fn)(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count); + +#define I2C_DEV_ATTR_SHOW_DEFAULT (i2c_dev_attr_show_fn)(1) +#define I2C_DEV_ATTR_STORE_DEFAULT (i2c_dev_attr_store_fn)(1) + +typedef struct i2c_dev_attr_st_ { + const char *ida_name; + const char *ida_help; + i2c_dev_attr_show_fn ida_show; + i2c_dev_attr_store_fn ida_store; + int ida_reg; + int ida_bit_offset; + int ida_n_bits; +} i2c_dev_attr_st; + +typedef struct i2c_sysfs_attr_st_{ + struct device_attribute isa_dev_attr; + const i2c_dev_attr_st *isa_i2c_attr; +} i2c_sysfs_attr_st; + +#define TO_I2C_SYSFS_ATTR(_attr) \ + container_of(_attr, i2c_sysfs_attr_st, isa_dev_attr) + +typedef struct i2c_dev_data_st_ { + struct device *idd_hwmon_dev; + struct mutex idd_lock; + i2c_sysfs_attr_st *idd_attrs; + struct attribute_group idd_attr_group; +} i2c_dev_data_st; + +int i2c_dev_sysfs_data_init(struct i2c_client *client, + i2c_dev_data_st *data, + const i2c_dev_attr_st *dev_attrs, + int n_attrs); +void i2c_dev_sysfs_data_clean(struct i2c_client *client, i2c_dev_data_st *data); +int i2c_dev_read_byte(struct device *dev, + struct device_attribute *attr); +int i2c_dev_read_nbytes(struct device *dev, + struct device_attribute *attr, + uint8_t values[], + int nbytes); +int i2c_dev_read_word_littleendian(struct device *dev, + struct device_attribute *attr); +int i2c_dev_read_word_bigendian(struct device *dev, + struct device_attribute *attr); +ssize_t i2c_dev_show_label(struct device *dev, + struct device_attribute *attr, + char *buf); +ssize_t i2c_dev_show_ascii(struct device *dev, + struct device_attribute *attr, + char *buf); + +#endif diff --git a/meta-raptor/meta-asus/recipes-kernel/i2c-dev-sysfs-mod/kernel-module-i2c-dev-sysfs_0.1.bb b/meta-raptor/meta-asus/recipes-kernel/i2c-dev-sysfs-mod/kernel-module-i2c-dev-sysfs_0.1.bb new file mode 100644 index 0000000..526ef57 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/i2c-dev-sysfs-mod/kernel-module-i2c-dev-sysfs_0.1.bb @@ -0,0 +1,42 @@ +# Copyright 2016-present Raptor Engineering. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +SUMMARY = "ASUS i2c device library" +DESCRIPTION = "i2c device sysfs attribute library" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" + +inherit module + +PR = "r0" +PV = "0.1" + +SRC_URI = "file://Makefile \ + file://i2c_dev_sysfs.c \ + file://i2c_dev_sysfs.h \ + file://COPYING \ + " + +S = "${WORKDIR}" + +do_install_append() { + kerneldir=${STAGING_KERNEL_DIR}/include/linux + install -d ${kerneldir} + install -m 0644 i2c_dev_sysfs.h ${kerneldir}/ +} + +FILES_${PN}-dev = "${kerneldir}/i2c_dev_sysfs.h" diff --git a/meta-raptor/meta-asus/recipes-kernel/linux/files/defconfig b/meta-raptor/meta-asus/recipes-kernel/linux/files/defconfig new file mode 100644 index 0000000..ed72c29 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/linux/files/defconfig @@ -0,0 +1,1588 @@ +# +# Automatically generated make config: don't edit +# Linux kernel version: 2.6.28.9 +# Wed Mar 16 11:22:39 2016 +# +CONFIG_ARM=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_GENERIC_GPIO=y +CONFIG_GENERIC_TIME=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_MMU=y +# CONFIG_NO_IOPORT is not set +CONFIG_GENERIC_HARDIRQS=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_ARCH_HAS_ILOG2_U32 is not set +# CONFIG_ARCH_HAS_ILOG2_U64 is not set +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y +CONFIG_VECTORS_BASE=0xffff0000 +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" + +# +# General setup +# +CONFIG_EXPERIMENTAL=y +CONFIG_BROKEN_ON_SMP=y +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_BZIP2 is not set +# CONFIG_KERNEL_LZMA is not set +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +# CONFIG_POSIX_MQUEUE is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_TASKSTATS is not set +# CONFIG_AUDIT is not set +CONFIG_IKCONFIG=m +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=16 +# CONFIG_CGROUPS is not set +# CONFIG_GROUP_SCHED is not set +CONFIG_SYSFS_DEPRECATED=y +CONFIG_SYSFS_DEPRECATED_V2=y +# CONFIG_RELAY is not set +CONFIG_NAMESPACES=y +# CONFIG_UTS_NS is not set +# CONFIG_IPC_NS is not set +# CONFIG_USER_NS is not set +# CONFIG_PID_NS is not set +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +# CONFIG_EMBEDDED is not set +CONFIG_UID16=y +CONFIG_SYSCTL_SYSCALL=y +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS_EXTRA_PASS=y +CONFIG_HOTPLUG=y +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +CONFIG_SHMEM=y +CONFIG_AIO=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y +CONFIG_COMPAT_BRK=y +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +# CONFIG_PROFILING is not set +# CONFIG_MARKERS is not set +CONFIG_HAVE_OPROFILE=y +# CONFIG_KPROBES is not set +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_SLABINFO=y +CONFIG_RT_MUTEXES=y +# CONFIG_TINY_SHMEM is not set +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +# CONFIG_MODULE_FORCE_LOAD is not set +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +CONFIG_KMOD=y +CONFIG_BLOCK=y +# CONFIG_LBD is not set +# CONFIG_BLK_DEV_IO_TRACE is not set +# CONFIG_LSF is not set +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_BLK_DEV_INTEGRITY is not set + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_AS=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_DEFAULT_AS is not set +# CONFIG_DEFAULT_DEADLINE is not set +CONFIG_DEFAULT_CFQ=y +# CONFIG_DEFAULT_NOOP is not set +CONFIG_DEFAULT_IOSCHED="cfq" +CONFIG_CLASSIC_RCU=y +CONFIG_FREEZER=y + +# +# System Type +# +CONFIG_ARCH_ASPEED=y +# CONFIG_ARCH_AAEC2000 is not set +# CONFIG_ARCH_INTEGRATOR is not set +# CONFIG_ARCH_REALVIEW is not set +# CONFIG_ARCH_VERSATILE is not set +# CONFIG_ARCH_AT91 is not set +# CONFIG_ARCH_CLPS7500 is not set +# CONFIG_ARCH_CLPS711X is not set +# CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_EP93XX is not set +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_NETX is not set +# CONFIG_ARCH_H720X is not set +# CONFIG_ARCH_IMX is not set +# CONFIG_ARCH_IOP13XX is not set +# CONFIG_ARCH_IOP32X is not set +# CONFIG_ARCH_IOP33X is not set +# CONFIG_ARCH_IXP23XX is not set +# CONFIG_ARCH_IXP2000 is not set +# CONFIG_ARCH_IXP4XX is not set +# CONFIG_ARCH_L7200 is not set +# CONFIG_ARCH_KIRKWOOD is not set +# CONFIG_ARCH_KS8695 is not set +# CONFIG_ARCH_NS9XXX is not set +# CONFIG_ARCH_LOKI is not set +# CONFIG_ARCH_MV78XX0 is not set +# CONFIG_ARCH_MXC is not set +# CONFIG_ARCH_ORION5X is not set +# CONFIG_ARCH_PNX4008 is not set +# CONFIG_ARCH_PXA is not set +# CONFIG_ARCH_RPC is not set +# CONFIG_ARCH_SA1100 is not set +# CONFIG_ARCH_S3C2410 is not set +# CONFIG_ARCH_SHARK is not set +# CONFIG_ARCH_LH7A40X is not set +# CONFIG_ARCH_DAVINCI is not set +# CONFIG_ARCH_OMAP is not set +# CONFIG_ARCH_MSM is not set +CONFIG_IRMP=y +# CONFIG_PCEXT is not set +# CONFIG_REMOTEFX is not set +# CONFIG_ARCH_AST1100 is not set +CONFIG_ARCH_AST2100=y +# CONFIG_ARCH_AST2200 is not set +# CONFIG_ARCH_AST2300 is not set +# CONFIG_ARCH_AST2400 is not set +# CONFIG_ARCH_AST2500 is not set + +# +# FLASH Chip Select +# +# CONFIG_AST_CS0_NOR is not set +# CONFIG_AST_CS0_NAND is not set +# CONFIG_AST_CS0_SPI is not set +CONFIG_AST_CS0_NONE=y +# CONFIG_AST_CS1_NOR is not set +# CONFIG_AST_CS1_NAND is not set +# CONFIG_AST_CS1_SPI is not set +CONFIG_AST_CS1_NONE=y +# CONFIG_AST_CS2_NOR is not set +# CONFIG_AST_CS2_NAND is not set +CONFIG_AST_CS2_SPI=y +# CONFIG_AST_CS2_NONE is not set +# CONFIG_AST_CS3_NOR is not set +# CONFIG_AST_CS3_NAND is not set +# CONFIG_AST_CS3_SPI is not set +CONFIG_AST_CS3_NONE=y +# CONFIG_AST_CS4_NOR is not set +# CONFIG_AST_CS4_NAND is not set +# CONFIG_AST_CS4_SPI is not set +CONFIG_AST_CS4_NONE=y +# CONFIG_ARCH_AST1070 is not set +# CONFIG_AST_SCU_LOCK is not set +# CONFIG_WEDGE is not set +# CONFIG_WEDGE100 is not set +# CONFIG_YOSEMITE is not set +# CONFIG_FBPLATFORM1 is not set +CONFIG_ASUSPLATFORM=y + +# +# Boot options +# + +# +# Power management +# +CONFIG_PLAT_ASPEED=y + +# +# Processor Type +# +CONFIG_CPU_32=y +CONFIG_CPU_ARM926T=y +CONFIG_CPU_32v5=y +CONFIG_CPU_ABRT_EV5TJ=y +CONFIG_CPU_PABRT_NOIFAR=y +CONFIG_CPU_CACHE_VIVT=y +CONFIG_CPU_COPY_V4WB=y +CONFIG_CPU_TLB_V4WBI=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y + +# +# Processor Features +# +CONFIG_ARM_THUMB=y +# CONFIG_CPU_ICACHE_DISABLE is not set +# CONFIG_CPU_DCACHE_DISABLE is not set +# CONFIG_CPU_DCACHE_WRITETHROUGH is not set +# CONFIG_CPU_CACHE_ROUND_ROBIN is not set +# CONFIG_OUTER_CACHE is not set + +# +# Bus support +# +CONFIG_ARM_AMBA=y +# CONFIG_PCI_SYSCALL is not set +# CONFIG_ARCH_SUPPORTS_MSI is not set +# CONFIG_PCCARD is not set + +# +# Kernel Features +# +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_VMSPLIT_3G=y +# CONFIG_VMSPLIT_2G is not set +# CONFIG_VMSPLIT_1G is not set +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PREEMPT is not set +CONFIG_HZ=100 +CONFIG_AEABI=y +CONFIG_OABI_COMPAT=y +CONFIG_ARCH_FLATMEM_HAS_HOLES=y +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +CONFIG_SELECT_MEMORY_MODEL=y +CONFIG_FLATMEM_MANUAL=y +# CONFIG_DISCONTIGMEM_MANUAL is not set +# CONFIG_SPARSEMEM_MANUAL is not set +CONFIG_FLATMEM=y +CONFIG_FLAT_NODE_MEM_MAP=y +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_SPLIT_PTLOCK_CPUS=4096 +# CONFIG_RESOURCES_64BIT is not set +# CONFIG_PHYS_ADDR_T_64BIT is not set +CONFIG_ZONE_DMA_FLAG=0 +CONFIG_VIRT_TO_BUS=y +CONFIG_UNEVICTABLE_LRU=y +CONFIG_ALIGNMENT_TRAP=y + +# +# Boot options +# +CONFIG_ZBOOT_ROM_TEXT=0 +CONFIG_ZBOOT_ROM_BSS=0 +CONFIG_CMDLINE="" +# CONFIG_XIP_KERNEL is not set +# CONFIG_KEXEC is not set + +# +# CPU Power Management +# +# CONFIG_CPU_IDLE is not set + +# +# Floating point emulation +# + +# +# At least one emulation must be selected +# +CONFIG_FPE_NWFPE=y +CONFIG_FPE_NWFPE_XP=y +# CONFIG_FPE_FASTFPE is not set +CONFIG_VFP=y + +# +# Userspace binary formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +CONFIG_HAVE_AOUT=y +# CONFIG_BINFMT_AOUT is not set +# CONFIG_BINFMT_MISC is not set + +# +# Power management options +# +CONFIG_PM=y +# CONFIG_PM_DEBUG is not set +CONFIG_PM_SLEEP=y +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# CONFIG_APM_EMULATION is not set +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_MMAP is not set +CONFIG_UNIX=y +CONFIG_XFRM=y +# CONFIG_XFRM_USER is not set +# CONFIG_XFRM_SUB_POLICY is not set +# CONFIG_XFRM_MIGRATE is not set +# CONFIG_XFRM_STATISTICS is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_FIB_HASH=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_IP_MROUTE is not set +# CONFIG_ARPD is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set +CONFIG_INET_TUNNEL=m +CONFIG_INET_XFRM_MODE_TRANSPORT=y +CONFIG_INET_XFRM_MODE_TUNNEL=y +CONFIG_INET_XFRM_MODE_BEET=y +# CONFIG_INET_LRO is not set +CONFIG_INET_DIAG=y +CONFIG_INET_TCP_DIAG=y +# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_CUBIC=y +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=m +# CONFIG_IPV6_PRIVACY is not set +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set +CONFIG_INET6_XFRM_MODE_TRANSPORT=m +CONFIG_INET6_XFRM_MODE_TUNNEL=m +CONFIG_INET6_XFRM_MODE_BEET=m +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +CONFIG_IPV6_SIT=m +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_NETWORK_SECMARK is not set +# CONFIG_NETFILTER is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_BRIDGE is not set +# CONFIG_NET_DSA is not set +CONFIG_VLAN_8021Q=m +# CONFIG_VLAN_8021Q_GVRP is not set +# CONFIG_DECNET is not set +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_ECONET is not set +CONFIG_WAN_ROUTER=y +# CONFIG_NET_SCHED is not set + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set +# CONFIG_AF_RXRPC is not set +# CONFIG_PHONET is not set +# CONFIG_WIRELESS is not set +# CONFIG_RFKILL is not set +# CONFIG_NET_9P is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +CONFIG_FW_LOADER=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_SYS_HYPERVISOR is not set +CONFIG_CONNECTOR=y +CONFIG_PROC_EVENTS=y +CONFIG_MTD=y +# CONFIG_MTD_DEBUG is not set +CONFIG_MTD_CONCAT=y +CONFIG_MTD_PARTITIONS=y +# CONFIG_MTD_REDBOOT_PARTS is not set +CONFIG_MTD_CMDLINE_PARTS=y +# CONFIG_MTD_AFS_PARTS is not set +# CONFIG_MTD_AR7_PARTS is not set + +# +# User Modules And Translation Layers +# +CONFIG_MTD_CHAR=y +CONFIG_MTD_BLKDEVS=y +CONFIG_MTD_BLOCK=y +# CONFIG_FTL is not set +# CONFIG_NFTL is not set +# CONFIG_INFTL is not set +# CONFIG_RFD_FTL is not set +# CONFIG_SSFDC is not set +# CONFIG_MTD_OOPS is not set + +# +# RAM/ROM/Flash chip drivers +# +# CONFIG_MTD_CFI is not set +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set + +# +# Mapping drivers for chip access +# +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +# CONFIG_MTD_PLATRAM is not set + +# +# Self-contained MTD device drivers +# +CONFIG_MTD_DATAFLASH=m +CONFIG_MTD_DATAFLASH_WRITE_VERIFY=y +# CONFIG_MTD_DATAFLASH_OTP is not set +CONFIG_MTD_M25P80=y +CONFIG_M25PXX_USE_FAST_READ=y +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLOCK2MTD is not set + +# +# Disk-On-Chip Device Drivers +# +# CONFIG_MTD_DOC2000 is not set +# CONFIG_MTD_DOC2001 is not set +# CONFIG_MTD_DOC2001PLUS is not set +# CONFIG_MTD_NAND is not set +# CONFIG_MTD_ONENAND is not set + +# +# UBI - Unsorted block images +# +# CONFIG_MTD_UBI is not set +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_COW_COMMON is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=y +# CONFIG_BLK_DEV_UB is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=16384 +# CONFIG_BLK_DEV_XIP is not set +# CONFIG_RD_BZIP2 is not set +CONFIG_RD_LZMA=y +CONFIG_RD_GZIP=y +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_ATA_OVER_ETH is not set +CONFIG_MISC_DEVICES=y +# CONFIG_EEPROM_93CX6 is not set +# CONFIG_ICS932S401 is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_C2PORT is not set +CONFIG_HAVE_IDE=y +# CONFIG_IDE is not set + +# +# SCSI device support +# +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +CONFIG_SCSI_TGT=y +# CONFIG_SCSI_NETLINK is not set +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +# CONFIG_BLK_DEV_SR is not set +CONFIG_CHR_DEV_SG=y +# CONFIG_CHR_DEV_SCH is not set + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# +# CONFIG_SCSI_MULTI_LUN is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set +CONFIG_SCSI_SCAN_ASYNC=y +CONFIG_SCSI_WAIT_SCAN=m + +# +# SCSI Transports +# +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_FC_ATTRS is not set +CONFIG_SCSI_ISCSI_ATTRS=m +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SRP_ATTRS is not set +# CONFIG_SCSI_LOWLEVEL is not set +# CONFIG_SCSI_DH is not set +# CONFIG_ATA is not set +# CONFIG_MD is not set +CONFIG_NETDEVICES=y +# CONFIG_DUMMY is not set +CONFIG_BONDING=m +# CONFIG_MACVLAN is not set +# CONFIG_EQUALIZER is not set +CONFIG_TUN=m +# CONFIG_VETH is not set +CONFIG_PHYLIB=y + +# +# MII PHY device drivers +# +# CONFIG_MARVELL_PHY is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_QSEMI_PHY is not set +CONFIG_LXT_PHY=y +# CONFIG_CICADA_PHY is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_SMSC_PHY is not set +# CONFIG_BROADCOM_PHY is not set +# CONFIG_ICPLUS_PHY is not set +CONFIG_REALTEK_PHY=y +# CONFIG_FIXED_PHY is not set +CONFIG_MDIO_BITBANG=y +CONFIG_NET_ETHERNET=y +CONFIG_MII=y +# CONFIG_AX88796 is not set +# CONFIG_SMC91X is not set +# CONFIG_DM9000 is not set +# CONFIG_ENC28J60 is not set +# CONFIG_SMC911X is not set +# CONFIG_IBM_NEW_EMAC_ZMII is not set +# CONFIG_IBM_NEW_EMAC_RGMII is not set +# CONFIG_IBM_NEW_EMAC_TAH is not set +# CONFIG_IBM_NEW_EMAC_EMAC4 is not set +# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set +# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set +# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set +# CONFIG_B44 is not set +CONFIG_NETDEV_1000=y +CONFIG_ASPEEDMAC=y +# CONFIG_NETDEV_10000 is not set + +# +# Wireless LAN +# +# CONFIG_WLAN_PRE80211 is not set +# CONFIG_WLAN_80211 is not set +# CONFIG_IWLWIFI_LEDS is not set + +# +# USB Network Adapters +# +# CONFIG_USB_CATC is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_PEGASUS is not set +# CONFIG_USB_RTL8150 is not set +# CONFIG_USB_USBNET is not set +# CONFIG_WAN is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set +# CONFIG_NETCONSOLE is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_ISDN is not set + +# +# Input device support +# +CONFIG_INPUT=y +# CONFIG_INPUT_FF_MEMLESS is not set +# CONFIG_INPUT_POLLDEV is not set + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSEDEV_PSAUX=y +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +# CONFIG_INPUT_JOYDEV is not set +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVBUG is not set + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +CONFIG_KEYBOARD_ATKBD=y +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_LKKBD is not set +# CONFIG_KEYBOARD_XTKBD is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_GPIO is not set +CONFIG_INPUT_MOUSE=y +CONFIG_MOUSE_PS2=y +CONFIG_MOUSE_PS2_ALPS=y +CONFIG_MOUSE_PS2_LOGIPS2PP=y +CONFIG_MOUSE_PS2_SYNAPTICS=y +CONFIG_MOUSE_PS2_LIFEBOOK=y +CONFIG_MOUSE_PS2_TRACKPOINT=y +# CONFIG_MOUSE_PS2_ELANTECH is not set +# CONFIG_MOUSE_PS2_TOUCHKIT is not set +CONFIG_MOUSE_SERIAL=y +# CONFIG_MOUSE_APPLETOUCH is not set +# CONFIG_MOUSE_BCM5974 is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MOUSE_GPIO is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TABLET is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set + +# +# Hardware I/O ports +# +CONFIG_SERIO=y +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_AMBAKMI is not set +CONFIG_SERIO_LIBPS2=y +# CONFIG_SERIO_RAW is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_HW_CONSOLE=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_DEVKMEM=y +CONFIG_SERIAL_NONSTANDARD=y +# CONFIG_N_HDLC is not set +# CONFIG_RISCOM8 is not set +# CONFIG_SPECIALIX is not set +# CONFIG_RIO is not set +# CONFIG_STALDRV is not set + +# +# Serial drivers +# +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +# CONFIG_SERIAL_AST_DMA_UART is not set +# CONFIG_SERIAL_8250_EXTENDED is not set + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_AMBA_PL010 is not set +# CONFIG_SERIAL_AMBA_PL011 is not set +# CONFIG_SERIAL_AST is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_IPMI_HANDLER is not set +CONFIG_KCS_GENERIC=y +CONFIG_AST_MISC=y +# CONFIG_AST_VIDEO is not set +# CONFIG_ADC_CAT9883 is not set +# CONFIG_AST_SPI_BIOS is not set +CONFIG_AST_PECI=y +CONFIG_AST_KCS=y +# CONFIG_AST_GPIO is not set +# CONFIG_HW_RANDOM is not set +CONFIG_NVRAM=y +# CONFIG_R3964 is not set +# CONFIG_RAW_DRIVER is not set +# CONFIG_TCG_TPM is not set +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_HELPER_AUTO=y + +# +# I2C Hardware Bus support +# + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +# CONFIG_I2C_GPIO is not set +# CONFIG_I2C_OCORES is not set +CONFIG_I2C_AST=y +CONFIG_AST_I2C_SLAVE_MODE=y +CONFIG_AST_I2C_SLAVE_EEPROM=y +# CONFIG_AST_I2C_SLAVE_RDWR is not set +# CONFIG_I2C_SIMTEC is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set + +# +# Other I2C/SMBus bus drivers +# +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_STUB is not set + +# +# Miscellaneous I2C Chip support +# +# CONFIG_DS1682 is not set +CONFIG_AT24=m +# CONFIG_SENSORS_EEPROM is not set +CONFIG_SENSORS_PCF8574=m +# CONFIG_PCF8575 is not set +# CONFIG_SENSORS_PCA9539 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_TPS65010 is not set +# CONFIG_SENSORS_MAX6875 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +# CONFIG_I2C_DEBUG_CHIP is not set +CONFIG_SPI=y +# CONFIG_SPI_DEBUG is not set +CONFIG_SPI_MASTER=y + +# +# SPI Master Controller Drivers +# +# CONFIG_SPI_AST is not set +CONFIG_SPI_FMC=y +CONFIG_SPI_BITBANG=y + +# +# SPI Protocol Masters +# +CONFIG_SPI_AT25=m +# CONFIG_SPI_SPIDEV is not set +# CONFIG_SPI_TLE62X0 is not set +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_GPIOLIB=y +# CONFIG_DEBUG_GPIO is not set +CONFIG_GPIO_SYSFS=y + +# +# Memory mapped GPIO expanders: +# + +# +# I2C GPIO expanders: +# +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set + +# +# PCI GPIO expanders: +# + +# +# SPI GPIO expanders: +# +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MCP23S08 is not set +# CONFIG_W1 is not set +# CONFIG_POWER_SUPPLY is not set +CONFIG_HWMON=y +# CONFIG_HWMON_VID is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7473 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +CONFIG_SENSORS_LM75=m +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +CONFIG_SENSORS_MAX127=m +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +CONFIG_SENSORS_ADS7828=m +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +CONFIG_SENSORS_W83795=m +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +# CONFIG_SENSORS_AST_ADC is not set +# CONFIG_SENSORS_AST_PWM_FAN is not set +# CONFIG_SENSORS_FB_PANTHER_PLUS is not set +CONFIG_PMBUS=m +CONFIG_SENSORS_PMBUS=m +CONFIG_SENSORS_ADM1275=m +CONFIG_SENSORS_LM25066=m +CONFIG_SENSORS_LTC2978=m +CONFIG_SENSORS_MAX16064=m +CONFIG_SENSORS_MAX34440=m +CONFIG_SENSORS_MAX8688=m +CONFIG_SENSORS_PFE1100=m +CONFIG_SENSORS_PFE3000=m +CONFIG_SENSORS_UCD9000=m +CONFIG_SENSORS_UCD9200=m +CONFIG_SENSORS_ZL6100=m +# CONFIG_HWMON_DEBUG_CHIP is not set +CONFIG_THERMAL=y +CONFIG_THERMAL_HWMON=y +CONFIG_WATCHDOG=y +# CONFIG_WATCHDOG_NOWAYOUT is not set + +# +# Watchdog Device Drivers +# +# CONFIG_SOFT_WATCHDOG is not set +CONFIG_AST_WATCHDOG=y +# CONFIG_AST_WATCHDOG_REARM_DUAL_BOOT is not set + +# +# USB-based Watchdog Cards +# +# CONFIG_USBPCWATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Sonics Silicon Backplane +# +# CONFIG_SSB is not set + +# +# Multifunction device drivers +# +# CONFIG_MFD_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_ASIC3 is not set +# CONFIG_HTC_EGPIO is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_TC6393XB is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM8350_I2C is not set + +# +# Multimedia devices +# + +# +# Multimedia core support +# +# CONFIG_VIDEO_DEV is not set +# CONFIG_DVB_CORE is not set +# CONFIG_VIDEO_MEDIA is not set + +# +# Multimedia drivers +# +# CONFIG_DAB is not set + +# +# Graphics support +# +# CONFIG_VGASTATE is not set +# CONFIG_VIDEO_OUTPUT_CONTROL is not set +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +# CONFIG_FB_DDC is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +# CONFIG_FB_CFB_FILLRECT is not set +# CONFIG_FB_CFB_COPYAREA is not set +# CONFIG_FB_CFB_IMAGEBLIT is not set +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +# CONFIG_FB_SYS_FILLRECT is not set +# CONFIG_FB_SYS_COPYAREA is not set +# CONFIG_FB_SYS_IMAGEBLIT is not set +# CONFIG_FB_FOREIGN_ENDIAN is not set +# CONFIG_FB_SYS_FOPS is not set +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_BACKLIGHT is not set +# CONFIG_FB_MODE_HELPERS is not set +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +# CONFIG_FB_ARMCLCD is not set +# CONFIG_FB_UVESA is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_AST is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_MB862XX is not set +# CONFIG_BACKLIGHT_LCD_SUPPORT is not set + +# +# Display device support +# +# CONFIG_DISPLAY_SUPPORT is not set + +# +# Console display driver support +# +# CONFIG_VGA_CONSOLE is not set +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=m +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +# CONFIG_LOGO is not set +# CONFIG_SOUND is not set +# CONFIG_HID_SUPPORT is not set +CONFIG_USB_SUPPORT=y +CONFIG_USB_ARCH_HAS_HCD=y +# CONFIG_USB_ARCH_HAS_OHCI is not set +CONFIG_USB_ARCH_HAS_EHCI=y +CONFIG_USB=m +# CONFIG_USB_DEBUG is not set +# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set + +# +# Miscellaneous USB options +# +CONFIG_USB_DEVICEFS=y +CONFIG_USB_DEVICE_CLASS=y +# CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_SUSPEND is not set +# CONFIG_USB_OTG is not set +# CONFIG_USB_MON is not set +# CONFIG_USB_WUSB is not set +# CONFIG_USB_WUSB_CBAF is not set + +# +# USB Host Controller Drivers +# +# CONFIG_USB_C67X00_HCD is not set +# CONFIG_USB_EHCI_HCD is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_R8A66597_HCD is not set +# CONFIG_USB_HWA_HCD is not set + +# +# AST USB Drivers +# +# CONFIG_AST_USB_UHCI_HCD is not set +# CONFIG_AST_USB_UHCI_MULTIPORT_1 is not set +# CONFIG_AST_USB_UHCI_MULTIPORT_2 is not set +# CONFIG_AST_USB_UHCI_MULTIPORT_4 is not set +# CONFIG_USB_GADGET_MUSB_HDRC is not set + +# +# USB Device Class drivers +# +# CONFIG_USB_ACM is not set +# CONFIG_USB_PRINTER is not set +# CONFIG_USB_WDM is not set +# CONFIG_USB_TMC is not set + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed; +# + +# +# see USB_STORAGE Help for more information +# +CONFIG_USB_STORAGE=m +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_DPCM is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_KARMA is not set +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +# CONFIG_USB_LIBUSUAL is not set + +# +# USB Imaging devices +# +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set + +# +# USB port drivers +# +# CONFIG_USB_SERIAL is not set + +# +# USB Miscellaneous drivers +# +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_ADUTUX is not set +# CONFIG_USB_SEVSEG is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_BERRY_CHARGE is not set +# CONFIG_USB_LED is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_PHIDGET is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_ISIGHTFW is not set +# CONFIG_USB_VST is not set +CONFIG_USB_GADGET=y +# CONFIG_USB_GADGET_DEBUG is not set +# CONFIG_USB_GADGET_DEBUG_FILES is not set +CONFIG_USB_GADGET_VBUS_DRAW=2 +CONFIG_USB_GADGET_SELECTED=y +# CONFIG_USB_GADGET_AT91 is not set +# CONFIG_USB_GADGET_ATMEL_USBA is not set +# CONFIG_USB_GADGET_FSL_USB2 is not set +# CONFIG_USB_GADGET_LH7A40X is not set +# CONFIG_USB_GADGET_OMAP is not set +# CONFIG_USB_GADGET_PXA25X is not set +# CONFIG_USB_GADGET_PXA27X is not set +# CONFIG_USB_GADGET_S3C2410 is not set +# CONFIG_USB_GADGET_M66592 is not set +# CONFIG_USB_GADGET_AMD5536UDC is not set +# CONFIG_USB_GADGET_FSL_QE is not set +# CONFIG_USB_GADGET_NET2280 is not set +# CONFIG_USB_GADGET_GOKU is not set +CONFIG_USB_GADGET_ASPEED_AST=y +CONFIG_USB_ASPEED_AST=y +# CONFIG_USB_GADGET_DUMMY_HCD is not set +CONFIG_USB_GADGET_DUALSPEED=y +CONFIG_USB_ZERO=m +CONFIG_USB_ETH=m +CONFIG_USB_ETH_RNDIS=y +CONFIG_USB_GADGETFS=m +CONFIG_USB_FILE_STORAGE=m +# CONFIG_USB_FILE_STORAGE_TEST is not set +CONFIG_USB_G_SERIAL=m +# CONFIG_USB_MIDI_GADGET is not set +# CONFIG_USB_G_PRINTER is not set +CONFIG_USB_CDC_COMPOSITE=m +# CONFIG_MMC is not set +# CONFIG_MEMSTICK is not set +# CONFIG_ACCESSIBILITY is not set +# CONFIG_NEW_LEDS is not set +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +# CONFIG_RTC_HCTOSYS is not set +# CONFIG_RTC_DEBUG is not set + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_DS1307 is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_X1205 is not set +# CONFIG_RTC_DRV_PCF8563 is not set +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8581 is not set + +# +# SPI RTC drivers +# +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_DS3234 is not set + +# +# Platform RTC drivers +# +# CONFIG_RTC_DRV_CMOS is not set +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_V3020 is not set + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_PL030 is not set +# CONFIG_RTC_DRV_PL031 is not set +CONFIG_RTC_DRV_ASPEED=y +# CONFIG_DMADEVICES is not set +# CONFIG_REGULATOR is not set +# CONFIG_UIO is not set + +# +# File systems +# +CONFIG_EXT2_FS=y +CONFIG_EXT2_FS_XATTR=y +CONFIG_EXT2_FS_POSIX_ACL=y +CONFIG_EXT2_FS_SECURITY=y +# CONFIG_EXT2_FS_XIP is not set +# CONFIG_EXT3_FS is not set +# CONFIG_EXT4_FS is not set +CONFIG_FS_MBCACHE=y +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +CONFIG_FS_POSIX_ACL=y +CONFIG_FILE_LOCKING=y +# CONFIG_XFS_FS is not set +# CONFIG_OCFS2_FS is not set +CONFIG_DNOTIFY=y +CONFIG_INOTIFY=y +CONFIG_INOTIFY_USER=y +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_FUSE_FS is not set +CONFIG_GENERIC_ACL=y + +# +# CD-ROM/DVD Filesystems +# +# CONFIG_ISO9660_FS is not set +# CONFIG_UDF_FS is not set + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=y +CONFIG_MSDOS_FS=y +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +CONFIG_NTFS_FS=y +# CONFIG_NTFS_DEBUG is not set +CONFIG_NTFS_RW=y + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +# CONFIG_HUGETLB_PAGE is not set +CONFIG_CONFIGFS_FS=m + +# +# Layered filesystems +# +CONFIG_UNION_FS=y +CONFIG_UNION_FS_XATTR=y +# CONFIG_UNION_FS_DEBUG is not set + +# +# Miscellaneous filesystems +# +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_FS_DEBUG=0 +CONFIG_JFFS2_FS_WRITEBUFFER=y +# CONFIG_JFFS2_FS_WBUF_VERIFY is not set +# CONFIG_JFFS2_SUMMARY is not set +# CONFIG_JFFS2_FS_XATTR is not set +# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set +CONFIG_JFFS2_ZLIB=y +# CONFIG_JFFS2_LZO is not set +CONFIG_JFFS2_RTIME=y +# CONFIG_JFFS2_RUBIN is not set +CONFIG_CRAMFS=y +CONFIG_SQUASHFS=y +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_VXFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=y +# CONFIG_NFS_V3 is not set +# CONFIG_NFS_V4 is not set +CONFIG_ROOT_NFS=y +# CONFIG_NFSD is not set +CONFIG_LOCKD=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=y +# CONFIG_SUNRPC_REGISTER_V4 is not set +# CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_RPCSEC_GSS_SPKM3 is not set +# CONFIG_SMB_FS is not set +# CONFIG_CIFS is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +CONFIG_NLS_CODEPAGE_936=y +CONFIG_NLS_CODEPAGE_950=y +CONFIG_NLS_CODEPAGE_932=y +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set + +# +# Kernel hacking +# +# CONFIG_PRINTK_TIME is not set +# CONFIG_ENABLE_WARN_DEPRECATED is not set +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_FRAME_WARN=1024 +CONFIG_MAGIC_SYSRQ=y +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_DEBUG_FS is not set +# CONFIG_HEADERS_CHECK is not set +CONFIG_DEBUG_KERNEL=y +# CONFIG_DEBUG_SHIRQ is not set +CONFIG_DETECT_SOFTLOCKUP=y +# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 +CONFIG_SCHED_DEBUG=y +# CONFIG_SCHEDSTATS is not set +# CONFIG_TIMER_STATS is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_RT_MUTEX_TESTER is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_DEBUG_KOBJECT is not set +CONFIG_DEBUG_BUGVERBOSE=y +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_WRITECOUNT is not set +CONFIG_DEBUG_MEMORY_INIT=y +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_SG is not set +CONFIG_FRAME_POINTER=y +# CONFIG_BOOT_PRINTK_DELAY is not set +# CONFIG_RCU_TORTURE_TEST is not set +# CONFIG_RCU_CPU_STALL_DETECTOR is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_FAULT_INJECTION is not set +# CONFIG_LATENCYTOP is not set +# CONFIG_SYSCTL_SYSCALL_CHECK is not set +CONFIG_HAVE_FUNCTION_TRACER=y + +# +# Tracers +# +# CONFIG_FUNCTION_TRACER is not set +# CONFIG_IRQSOFF_TRACER is not set +# CONFIG_SCHED_TRACER is not set +# CONFIG_CONTEXT_SWITCH_TRACER is not set +# CONFIG_BOOT_TRACER is not set +# CONFIG_STACK_TRACER is not set +# CONFIG_DYNAMIC_PRINTK_DEBUG is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +# CONFIG_DEBUG_USER is not set +# CONFIG_DEBUG_ERRORS is not set +# CONFIG_DEBUG_STACK_USAGE is not set +CONFIG_DEBUG_LL=y +CONFIG_EARLY_PRINTK=y +# CONFIG_DEBUG_ICEDCC is not set + +# +# Security options +# +# CONFIG_KEYS is not set +# CONFIG_SECURITY is not set +# CONFIG_SECURITYFS is not set +# CONFIG_SECURITY_FILE_CAPABILITIES is not set +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +# CONFIG_CRYPTO_FIPS is not set +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=m +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_GF128MUL is not set +CONFIG_CRYPTO_NULL=y +# CONFIG_CRYPTO_CRYPTD is not set +CONFIG_CRYPTO_AUTHENC=m +# CONFIG_CRYPTO_TEST is not set + +# +# Authenticated Encryption with Associated Data +# +# CONFIG_CRYPTO_CCM is not set +# CONFIG_CRYPTO_GCM is not set +# CONFIG_CRYPTO_SEQIV is not set + +# +# Block modes +# +CONFIG_CRYPTO_CBC=y +# CONFIG_CRYPTO_CTR is not set +# CONFIG_CRYPTO_CTS is not set +# CONFIG_CRYPTO_ECB is not set +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set + +# +# Hash modes +# +CONFIG_CRYPTO_HMAC=y +# CONFIG_CRYPTO_XCBC is not set + +# +# Digest +# +# CONFIG_CRYPTO_CRC32C is not set +# CONFIG_CRYPTO_MD4 is not set +CONFIG_CRYPTO_MD5=y +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +CONFIG_CRYPTO_SHA1=y +# CONFIG_CRYPTO_SHA256 is not set +# CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set + +# +# Ciphers +# +# CONFIG_CRYPTO_AES is not set +# CONFIG_CRYPTO_ANUBIS is not set +# CONFIG_CRYPTO_ARC4 is not set +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +CONFIG_CRYPTO_DES=y +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_TEA is not set +# CONFIG_CRYPTO_TWOFISH is not set + +# +# Compression +# +CONFIG_CRYPTO_DEFLATE=m +# CONFIG_CRYPTO_LZO is not set + +# +# Random Number Generation +# +# CONFIG_CRYPTO_ANSI_CPRNG is not set +# CONFIG_CRYPTO_HW is not set + +# +# Library routines +# +CONFIG_BITREVERSE=y +# CONFIG_CRC_CCITT is not set +# CONFIG_CRC16 is not set +# CONFIG_CRC_T10DIF is not set +CONFIG_CRC_ITU_T=m +CONFIG_CRC32=y +# CONFIG_CRC7 is not set +# CONFIG_LIBCRC32C is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_PLIST=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAS_DMA=y diff --git a/meta-raptor/meta-asus/recipes-kernel/linux/files/defconfig_production_candidate b/meta-raptor/meta-asus/recipes-kernel/linux/files/defconfig_production_candidate new file mode 100644 index 0000000..140c1d6 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/linux/files/defconfig_production_candidate @@ -0,0 +1,1574 @@ +# +# Automatically generated make config: don't edit +# Linux kernel version: 2.6.28.9 +# Fri Mar 11 14:20:24 2016 +# +CONFIG_ARM=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_GENERIC_GPIO=y +CONFIG_GENERIC_TIME=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_MMU=y +# CONFIG_NO_IOPORT is not set +CONFIG_GENERIC_HARDIRQS=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_ARCH_HAS_ILOG2_U32 is not set +# CONFIG_ARCH_HAS_ILOG2_U64 is not set +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y +CONFIG_VECTORS_BASE=0xffff0000 +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" + +# +# General setup +# +CONFIG_EXPERIMENTAL=y +CONFIG_BROKEN_ON_SMP=y +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_BZIP2 is not set +# CONFIG_KERNEL_LZMA is not set +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +# CONFIG_POSIX_MQUEUE is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_TASKSTATS is not set +# CONFIG_AUDIT is not set +CONFIG_IKCONFIG=m +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=16 +# CONFIG_CGROUPS is not set +# CONFIG_GROUP_SCHED is not set +CONFIG_SYSFS_DEPRECATED=y +CONFIG_SYSFS_DEPRECATED_V2=y +# CONFIG_RELAY is not set +CONFIG_NAMESPACES=y +# CONFIG_UTS_NS is not set +# CONFIG_IPC_NS is not set +# CONFIG_USER_NS is not set +# CONFIG_PID_NS is not set +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +# CONFIG_EMBEDDED is not set +CONFIG_UID16=y +CONFIG_SYSCTL_SYSCALL=y +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS_EXTRA_PASS=y +CONFIG_HOTPLUG=y +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +CONFIG_SHMEM=y +CONFIG_AIO=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y +CONFIG_COMPAT_BRK=y +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +# CONFIG_PROFILING is not set +# CONFIG_MARKERS is not set +CONFIG_HAVE_OPROFILE=y +# CONFIG_KPROBES is not set +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_SLABINFO=y +CONFIG_RT_MUTEXES=y +# CONFIG_TINY_SHMEM is not set +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +# CONFIG_MODULE_FORCE_LOAD is not set +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +CONFIG_KMOD=y +CONFIG_BLOCK=y +# CONFIG_LBD is not set +# CONFIG_BLK_DEV_IO_TRACE is not set +# CONFIG_LSF is not set +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_BLK_DEV_INTEGRITY is not set + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_AS=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_DEFAULT_AS is not set +# CONFIG_DEFAULT_DEADLINE is not set +CONFIG_DEFAULT_CFQ=y +# CONFIG_DEFAULT_NOOP is not set +CONFIG_DEFAULT_IOSCHED="cfq" +CONFIG_CLASSIC_RCU=y +CONFIG_FREEZER=y + +# +# System Type +# +CONFIG_ARCH_ASPEED=y +# CONFIG_ARCH_AAEC2000 is not set +# CONFIG_ARCH_INTEGRATOR is not set +# CONFIG_ARCH_REALVIEW is not set +# CONFIG_ARCH_VERSATILE is not set +# CONFIG_ARCH_AT91 is not set +# CONFIG_ARCH_CLPS7500 is not set +# CONFIG_ARCH_CLPS711X is not set +# CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_EP93XX is not set +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_NETX is not set +# CONFIG_ARCH_H720X is not set +# CONFIG_ARCH_IMX is not set +# CONFIG_ARCH_IOP13XX is not set +# CONFIG_ARCH_IOP32X is not set +# CONFIG_ARCH_IOP33X is not set +# CONFIG_ARCH_IXP23XX is not set +# CONFIG_ARCH_IXP2000 is not set +# CONFIG_ARCH_IXP4XX is not set +# CONFIG_ARCH_L7200 is not set +# CONFIG_ARCH_KIRKWOOD is not set +# CONFIG_ARCH_KS8695 is not set +# CONFIG_ARCH_NS9XXX is not set +# CONFIG_ARCH_LOKI is not set +# CONFIG_ARCH_MV78XX0 is not set +# CONFIG_ARCH_MXC is not set +# CONFIG_ARCH_ORION5X is not set +# CONFIG_ARCH_PNX4008 is not set +# CONFIG_ARCH_PXA is not set +# CONFIG_ARCH_RPC is not set +# CONFIG_ARCH_SA1100 is not set +# CONFIG_ARCH_S3C2410 is not set +# CONFIG_ARCH_SHARK is not set +# CONFIG_ARCH_LH7A40X is not set +# CONFIG_ARCH_DAVINCI is not set +# CONFIG_ARCH_OMAP is not set +# CONFIG_ARCH_MSM is not set +CONFIG_IRMP=y +# CONFIG_PCEXT is not set +# CONFIG_REMOTEFX is not set +# CONFIG_ARCH_AST1100 is not set +CONFIG_ARCH_AST2100=y +# CONFIG_ARCH_AST2200 is not set +# CONFIG_ARCH_AST2300 is not set +# CONFIG_ARCH_AST2400 is not set +# CONFIG_ARCH_AST2500 is not set + +# +# FLASH Chip Select +# +# CONFIG_AST_CS0_NOR is not set +# CONFIG_AST_CS0_NAND is not set +# CONFIG_AST_CS0_SPI is not set +CONFIG_AST_CS0_NONE=y +# CONFIG_AST_CS1_NOR is not set +# CONFIG_AST_CS1_NAND is not set +# CONFIG_AST_CS1_SPI is not set +CONFIG_AST_CS1_NONE=y +# CONFIG_AST_CS2_NOR is not set +# CONFIG_AST_CS2_NAND is not set +CONFIG_AST_CS2_SPI=y +# CONFIG_AST_CS2_NONE is not set +# CONFIG_AST_CS3_NOR is not set +# CONFIG_AST_CS3_NAND is not set +# CONFIG_AST_CS3_SPI is not set +CONFIG_AST_CS3_NONE=y +# CONFIG_AST_CS4_NOR is not set +# CONFIG_AST_CS4_NAND is not set +# CONFIG_AST_CS4_SPI is not set +CONFIG_AST_CS4_NONE=y +# CONFIG_ARCH_AST1070 is not set +# CONFIG_AST_SCU_LOCK is not set +# CONFIG_WEDGE is not set +# CONFIG_WEDGE100 is not set +# CONFIG_YOSEMITE is not set +# CONFIG_FBPLATFORM1 is not set +CONFIG_ASUSPLATFORM=y + +# +# Boot options +# + +# +# Power management +# +CONFIG_PLAT_ASPEED=y + +# +# Processor Type +# +CONFIG_CPU_32=y +CONFIG_CPU_ARM926T=y +CONFIG_CPU_32v5=y +CONFIG_CPU_ABRT_EV5TJ=y +CONFIG_CPU_PABRT_NOIFAR=y +CONFIG_CPU_CACHE_VIVT=y +CONFIG_CPU_COPY_V4WB=y +CONFIG_CPU_TLB_V4WBI=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y + +# +# Processor Features +# +CONFIG_ARM_THUMB=y +# CONFIG_CPU_ICACHE_DISABLE is not set +# CONFIG_CPU_DCACHE_DISABLE is not set +# CONFIG_CPU_DCACHE_WRITETHROUGH is not set +# CONFIG_CPU_CACHE_ROUND_ROBIN is not set +# CONFIG_OUTER_CACHE is not set + +# +# Bus support +# +CONFIG_ARM_AMBA=y +# CONFIG_PCI_SYSCALL is not set +# CONFIG_ARCH_SUPPORTS_MSI is not set +# CONFIG_PCCARD is not set + +# +# Kernel Features +# +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_VMSPLIT_3G=y +# CONFIG_VMSPLIT_2G is not set +# CONFIG_VMSPLIT_1G is not set +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PREEMPT is not set +CONFIG_HZ=100 +CONFIG_AEABI=y +CONFIG_OABI_COMPAT=y +CONFIG_ARCH_FLATMEM_HAS_HOLES=y +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +CONFIG_SELECT_MEMORY_MODEL=y +CONFIG_FLATMEM_MANUAL=y +# CONFIG_DISCONTIGMEM_MANUAL is not set +# CONFIG_SPARSEMEM_MANUAL is not set +CONFIG_FLATMEM=y +CONFIG_FLAT_NODE_MEM_MAP=y +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_SPLIT_PTLOCK_CPUS=4096 +# CONFIG_RESOURCES_64BIT is not set +# CONFIG_PHYS_ADDR_T_64BIT is not set +CONFIG_ZONE_DMA_FLAG=0 +CONFIG_VIRT_TO_BUS=y +CONFIG_UNEVICTABLE_LRU=y +CONFIG_ALIGNMENT_TRAP=y + +# +# Boot options +# +CONFIG_ZBOOT_ROM_TEXT=0 +CONFIG_ZBOOT_ROM_BSS=0 +CONFIG_CMDLINE="" +# CONFIG_XIP_KERNEL is not set +# CONFIG_KEXEC is not set + +# +# CPU Power Management +# +# CONFIG_CPU_IDLE is not set + +# +# Floating point emulation +# + +# +# At least one emulation must be selected +# +CONFIG_FPE_NWFPE=y +CONFIG_FPE_NWFPE_XP=y +# CONFIG_FPE_FASTFPE is not set +CONFIG_VFP=y + +# +# Userspace binary formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +CONFIG_HAVE_AOUT=y +# CONFIG_BINFMT_AOUT is not set +# CONFIG_BINFMT_MISC is not set + +# +# Power management options +# +CONFIG_PM=y +# CONFIG_PM_DEBUG is not set +CONFIG_PM_SLEEP=y +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# CONFIG_APM_EMULATION is not set +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_MMAP is not set +CONFIG_UNIX=y +CONFIG_XFRM=y +# CONFIG_XFRM_USER is not set +# CONFIG_XFRM_SUB_POLICY is not set +# CONFIG_XFRM_MIGRATE is not set +# CONFIG_XFRM_STATISTICS is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_FIB_HASH=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_IP_MROUTE is not set +# CONFIG_ARPD is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set +CONFIG_INET_TUNNEL=m +CONFIG_INET_XFRM_MODE_TRANSPORT=y +CONFIG_INET_XFRM_MODE_TUNNEL=y +CONFIG_INET_XFRM_MODE_BEET=y +# CONFIG_INET_LRO is not set +CONFIG_INET_DIAG=y +CONFIG_INET_TCP_DIAG=y +# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_CUBIC=y +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=m +# CONFIG_IPV6_PRIVACY is not set +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set +CONFIG_INET6_XFRM_MODE_TRANSPORT=m +CONFIG_INET6_XFRM_MODE_TUNNEL=m +CONFIG_INET6_XFRM_MODE_BEET=m +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +CONFIG_IPV6_SIT=m +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_NETWORK_SECMARK is not set +# CONFIG_NETFILTER is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_BRIDGE is not set +# CONFIG_NET_DSA is not set +CONFIG_VLAN_8021Q=m +# CONFIG_VLAN_8021Q_GVRP is not set +# CONFIG_DECNET is not set +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_ECONET is not set +CONFIG_WAN_ROUTER=y +# CONFIG_NET_SCHED is not set + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set +# CONFIG_AF_RXRPC is not set +# CONFIG_PHONET is not set +# CONFIG_WIRELESS is not set +# CONFIG_RFKILL is not set +# CONFIG_NET_9P is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +CONFIG_FW_LOADER=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_SYS_HYPERVISOR is not set +CONFIG_CONNECTOR=y +CONFIG_PROC_EVENTS=y +CONFIG_MTD=y +# CONFIG_MTD_DEBUG is not set +CONFIG_MTD_CONCAT=y +CONFIG_MTD_PARTITIONS=y +# CONFIG_MTD_REDBOOT_PARTS is not set +CONFIG_MTD_CMDLINE_PARTS=y +# CONFIG_MTD_AFS_PARTS is not set +# CONFIG_MTD_AR7_PARTS is not set + +# +# User Modules And Translation Layers +# +CONFIG_MTD_CHAR=y +CONFIG_MTD_BLKDEVS=y +CONFIG_MTD_BLOCK=y +# CONFIG_FTL is not set +# CONFIG_NFTL is not set +# CONFIG_INFTL is not set +# CONFIG_RFD_FTL is not set +# CONFIG_SSFDC is not set +# CONFIG_MTD_OOPS is not set + +# +# RAM/ROM/Flash chip drivers +# +# CONFIG_MTD_CFI is not set +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set + +# +# Mapping drivers for chip access +# +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +# CONFIG_MTD_PLATRAM is not set + +# +# Self-contained MTD device drivers +# +CONFIG_MTD_DATAFLASH=m +CONFIG_MTD_DATAFLASH_WRITE_VERIFY=y +# CONFIG_MTD_DATAFLASH_OTP is not set +CONFIG_MTD_M25P80=y +CONFIG_M25PXX_USE_FAST_READ=y +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLOCK2MTD is not set + +# +# Disk-On-Chip Device Drivers +# +# CONFIG_MTD_DOC2000 is not set +# CONFIG_MTD_DOC2001 is not set +# CONFIG_MTD_DOC2001PLUS is not set +# CONFIG_MTD_NAND is not set +# CONFIG_MTD_ONENAND is not set + +# +# UBI - Unsorted block images +# +# CONFIG_MTD_UBI is not set +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_COW_COMMON is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=y +# CONFIG_BLK_DEV_UB is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=16384 +# CONFIG_BLK_DEV_XIP is not set +# CONFIG_RD_BZIP2 is not set +CONFIG_RD_LZMA=y +CONFIG_RD_GZIP=y +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_ATA_OVER_ETH is not set +CONFIG_MISC_DEVICES=y +# CONFIG_EEPROM_93CX6 is not set +# CONFIG_ICS932S401 is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_C2PORT is not set +CONFIG_HAVE_IDE=y +# CONFIG_IDE is not set + +# +# SCSI device support +# +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +CONFIG_SCSI_TGT=y +# CONFIG_SCSI_NETLINK is not set +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +# CONFIG_BLK_DEV_SR is not set +CONFIG_CHR_DEV_SG=y +# CONFIG_CHR_DEV_SCH is not set + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# +# CONFIG_SCSI_MULTI_LUN is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set +CONFIG_SCSI_SCAN_ASYNC=y +CONFIG_SCSI_WAIT_SCAN=m + +# +# SCSI Transports +# +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_FC_ATTRS is not set +CONFIG_SCSI_ISCSI_ATTRS=m +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SRP_ATTRS is not set +# CONFIG_SCSI_LOWLEVEL is not set +# CONFIG_SCSI_DH is not set +# CONFIG_ATA is not set +# CONFIG_MD is not set +CONFIG_NETDEVICES=y +# CONFIG_DUMMY is not set +CONFIG_BONDING=m +# CONFIG_MACVLAN is not set +# CONFIG_EQUALIZER is not set +CONFIG_TUN=m +# CONFIG_VETH is not set +CONFIG_PHYLIB=y + +# +# MII PHY device drivers +# +# CONFIG_MARVELL_PHY is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_QSEMI_PHY is not set +CONFIG_LXT_PHY=y +# CONFIG_CICADA_PHY is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_SMSC_PHY is not set +# CONFIG_BROADCOM_PHY is not set +# CONFIG_ICPLUS_PHY is not set +CONFIG_REALTEK_PHY=y +# CONFIG_FIXED_PHY is not set +CONFIG_MDIO_BITBANG=y +CONFIG_NET_ETHERNET=y +CONFIG_MII=y +# CONFIG_AX88796 is not set +# CONFIG_SMC91X is not set +# CONFIG_DM9000 is not set +# CONFIG_ENC28J60 is not set +# CONFIG_SMC911X is not set +# CONFIG_IBM_NEW_EMAC_ZMII is not set +# CONFIG_IBM_NEW_EMAC_RGMII is not set +# CONFIG_IBM_NEW_EMAC_TAH is not set +# CONFIG_IBM_NEW_EMAC_EMAC4 is not set +# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set +# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set +# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set +# CONFIG_B44 is not set +CONFIG_NETDEV_1000=y +CONFIG_ASPEEDMAC=y +# CONFIG_NETDEV_10000 is not set + +# +# Wireless LAN +# +# CONFIG_WLAN_PRE80211 is not set +# CONFIG_WLAN_80211 is not set +# CONFIG_IWLWIFI_LEDS is not set + +# +# USB Network Adapters +# +# CONFIG_USB_CATC is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_PEGASUS is not set +# CONFIG_USB_RTL8150 is not set +# CONFIG_USB_USBNET is not set +# CONFIG_WAN is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set +# CONFIG_NETCONSOLE is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_ISDN is not set + +# +# Input device support +# +CONFIG_INPUT=y +# CONFIG_INPUT_FF_MEMLESS is not set +# CONFIG_INPUT_POLLDEV is not set + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSEDEV_PSAUX=y +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +# CONFIG_INPUT_JOYDEV is not set +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVBUG is not set + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +CONFIG_KEYBOARD_ATKBD=y +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_LKKBD is not set +# CONFIG_KEYBOARD_XTKBD is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_GPIO is not set +CONFIG_INPUT_MOUSE=y +CONFIG_MOUSE_PS2=y +CONFIG_MOUSE_PS2_ALPS=y +CONFIG_MOUSE_PS2_LOGIPS2PP=y +CONFIG_MOUSE_PS2_SYNAPTICS=y +CONFIG_MOUSE_PS2_LIFEBOOK=y +CONFIG_MOUSE_PS2_TRACKPOINT=y +# CONFIG_MOUSE_PS2_ELANTECH is not set +# CONFIG_MOUSE_PS2_TOUCHKIT is not set +CONFIG_MOUSE_SERIAL=y +# CONFIG_MOUSE_APPLETOUCH is not set +# CONFIG_MOUSE_BCM5974 is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MOUSE_GPIO is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TABLET is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set + +# +# Hardware I/O ports +# +CONFIG_SERIO=y +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_AMBAKMI is not set +CONFIG_SERIO_LIBPS2=y +# CONFIG_SERIO_RAW is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_HW_CONSOLE=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_DEVKMEM=y +CONFIG_SERIAL_NONSTANDARD=y +# CONFIG_N_HDLC is not set +# CONFIG_RISCOM8 is not set +# CONFIG_SPECIALIX is not set +# CONFIG_RIO is not set +# CONFIG_STALDRV is not set + +# +# Serial drivers +# +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +# CONFIG_SERIAL_AST_DMA_UART is not set +# CONFIG_SERIAL_8250_EXTENDED is not set + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_AMBA_PL010 is not set +# CONFIG_SERIAL_AMBA_PL011 is not set +# CONFIG_SERIAL_AST is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_IPMI_HANDLER is not set +CONFIG_AST_MISC=y +# CONFIG_AST_VIDEO is not set +# CONFIG_ADC_CAT9883 is not set +# CONFIG_AST_SPI_BIOS is not set +CONFIG_AST_PECI=y +# CONFIG_AST_KCS is not set +# CONFIG_AST_GPIO is not set +# CONFIG_HW_RANDOM is not set +CONFIG_NVRAM=y +# CONFIG_R3964 is not set +# CONFIG_RAW_DRIVER is not set +# CONFIG_TCG_TPM is not set +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_HELPER_AUTO=y + +# +# I2C Hardware Bus support +# + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +# CONFIG_I2C_GPIO is not set +# CONFIG_I2C_OCORES is not set +CONFIG_I2C_AST=y +CONFIG_AST_I2C_SLAVE_MODE=y +CONFIG_AST_I2C_SLAVE_EEPROM=y +# CONFIG_AST_I2C_SLAVE_RDWR is not set +# CONFIG_I2C_SIMTEC is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set + +# +# Other I2C/SMBus bus drivers +# +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_STUB is not set + +# +# Miscellaneous I2C Chip support +# +# CONFIG_DS1682 is not set +CONFIG_AT24=m +# CONFIG_SENSORS_EEPROM is not set +CONFIG_SENSORS_PCF8574=m +# CONFIG_PCF8575 is not set +# CONFIG_SENSORS_PCA9539 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_TPS65010 is not set +# CONFIG_SENSORS_MAX6875 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +# CONFIG_I2C_DEBUG_CHIP is not set +CONFIG_SPI=y +# CONFIG_SPI_DEBUG is not set +CONFIG_SPI_MASTER=y + +# +# SPI Master Controller Drivers +# +# CONFIG_SPI_AST is not set +# CONFIG_SPI_FMC is not set +CONFIG_SPI_BITBANG=y + +# +# SPI Protocol Masters +# +CONFIG_SPI_AT25=m +# CONFIG_SPI_SPIDEV is not set +# CONFIG_SPI_TLE62X0 is not set +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_GPIOLIB=y +# CONFIG_DEBUG_GPIO is not set +CONFIG_GPIO_SYSFS=y + +# +# Memory mapped GPIO expanders: +# + +# +# I2C GPIO expanders: +# +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set + +# +# PCI GPIO expanders: +# + +# +# SPI GPIO expanders: +# +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MCP23S08 is not set +# CONFIG_W1 is not set +# CONFIG_POWER_SUPPLY is not set +CONFIG_HWMON=y +# CONFIG_HWMON_VID is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7473 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +CONFIG_SENSORS_LM75=m +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +CONFIG_SENSORS_MAX127=m +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +CONFIG_SENSORS_ADS7828=m +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +# CONFIG_SENSORS_AST_ADC is not set +CONFIG_SENSORS_AST_PWM_FAN=y +CONFIG_SENSORS_FB_PANTHER_PLUS=m +CONFIG_PMBUS=m +CONFIG_SENSORS_PMBUS=m +CONFIG_SENSORS_ADM1275=m +# CONFIG_SENSORS_LM25066 is not set +# CONFIG_SENSORS_LTC2978 is not set +# CONFIG_SENSORS_MAX16064 is not set +# CONFIG_SENSORS_MAX34440 is not set +# CONFIG_SENSORS_MAX8688 is not set +CONFIG_SENSORS_PFE1100=m +CONFIG_SENSORS_PFE3000=m +# CONFIG_SENSORS_UCD9000 is not set +# CONFIG_SENSORS_UCD9200 is not set +# CONFIG_SENSORS_ZL6100 is not set +# CONFIG_HWMON_DEBUG_CHIP is not set +CONFIG_THERMAL=y +CONFIG_THERMAL_HWMON=y +CONFIG_WATCHDOG=y +# CONFIG_WATCHDOG_NOWAYOUT is not set + +# +# Watchdog Device Drivers +# +# CONFIG_SOFT_WATCHDOG is not set +CONFIG_AST_WATCHDOG=y +# CONFIG_AST_WATCHDOG_REARM_DUAL_BOOT is not set + +# +# USB-based Watchdog Cards +# +# CONFIG_USBPCWATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Sonics Silicon Backplane +# +# CONFIG_SSB is not set + +# +# Multifunction device drivers +# +# CONFIG_MFD_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_ASIC3 is not set +# CONFIG_HTC_EGPIO is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_TC6393XB is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM8350_I2C is not set + +# +# Multimedia devices +# + +# +# Multimedia core support +# +# CONFIG_VIDEO_DEV is not set +# CONFIG_DVB_CORE is not set +# CONFIG_VIDEO_MEDIA is not set + +# +# Multimedia drivers +# +# CONFIG_DAB is not set + +# +# Graphics support +# +# CONFIG_VGASTATE is not set +# CONFIG_VIDEO_OUTPUT_CONTROL is not set +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +# CONFIG_FB_DDC is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +# CONFIG_FB_CFB_FILLRECT is not set +# CONFIG_FB_CFB_COPYAREA is not set +# CONFIG_FB_CFB_IMAGEBLIT is not set +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +# CONFIG_FB_SYS_FILLRECT is not set +# CONFIG_FB_SYS_COPYAREA is not set +# CONFIG_FB_SYS_IMAGEBLIT is not set +# CONFIG_FB_FOREIGN_ENDIAN is not set +# CONFIG_FB_SYS_FOPS is not set +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_BACKLIGHT is not set +# CONFIG_FB_MODE_HELPERS is not set +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +# CONFIG_FB_ARMCLCD is not set +# CONFIG_FB_UVESA is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_AST is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_MB862XX is not set +# CONFIG_BACKLIGHT_LCD_SUPPORT is not set + +# +# Display device support +# +# CONFIG_DISPLAY_SUPPORT is not set + +# +# Console display driver support +# +# CONFIG_VGA_CONSOLE is not set +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=m +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +# CONFIG_LOGO is not set +# CONFIG_SOUND is not set +# CONFIG_HID_SUPPORT is not set +CONFIG_USB_SUPPORT=y +CONFIG_USB_ARCH_HAS_HCD=y +# CONFIG_USB_ARCH_HAS_OHCI is not set +CONFIG_USB_ARCH_HAS_EHCI=y +CONFIG_USB=m +# CONFIG_USB_DEBUG is not set +# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set + +# +# Miscellaneous USB options +# +CONFIG_USB_DEVICEFS=y +CONFIG_USB_DEVICE_CLASS=y +# CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_SUSPEND is not set +# CONFIG_USB_OTG is not set +# CONFIG_USB_MON is not set +# CONFIG_USB_WUSB is not set +# CONFIG_USB_WUSB_CBAF is not set + +# +# USB Host Controller Drivers +# +# CONFIG_USB_C67X00_HCD is not set +# CONFIG_USB_EHCI_HCD is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_R8A66597_HCD is not set +# CONFIG_USB_HWA_HCD is not set + +# +# AST USB Drivers +# +# CONFIG_AST_USB_UHCI_HCD is not set +# CONFIG_AST_USB_UHCI_MULTIPORT_1 is not set +# CONFIG_AST_USB_UHCI_MULTIPORT_2 is not set +# CONFIG_AST_USB_UHCI_MULTIPORT_4 is not set +# CONFIG_USB_GADGET_MUSB_HDRC is not set + +# +# USB Device Class drivers +# +# CONFIG_USB_ACM is not set +# CONFIG_USB_PRINTER is not set +# CONFIG_USB_WDM is not set +# CONFIG_USB_TMC is not set + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed; +# + +# +# see USB_STORAGE Help for more information +# +CONFIG_USB_STORAGE=m +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_DPCM is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_KARMA is not set +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +# CONFIG_USB_LIBUSUAL is not set + +# +# USB Imaging devices +# +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set + +# +# USB port drivers +# +# CONFIG_USB_SERIAL is not set + +# +# USB Miscellaneous drivers +# +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_ADUTUX is not set +# CONFIG_USB_SEVSEG is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_BERRY_CHARGE is not set +# CONFIG_USB_LED is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_PHIDGET is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_ISIGHTFW is not set +# CONFIG_USB_VST is not set +CONFIG_USB_GADGET=y +# CONFIG_USB_GADGET_DEBUG is not set +# CONFIG_USB_GADGET_DEBUG_FILES is not set +CONFIG_USB_GADGET_VBUS_DRAW=2 +CONFIG_USB_GADGET_SELECTED=y +# CONFIG_USB_GADGET_AT91 is not set +# CONFIG_USB_GADGET_ATMEL_USBA is not set +# CONFIG_USB_GADGET_FSL_USB2 is not set +# CONFIG_USB_GADGET_LH7A40X is not set +# CONFIG_USB_GADGET_OMAP is not set +# CONFIG_USB_GADGET_PXA25X is not set +# CONFIG_USB_GADGET_PXA27X is not set +# CONFIG_USB_GADGET_S3C2410 is not set +# CONFIG_USB_GADGET_M66592 is not set +# CONFIG_USB_GADGET_AMD5536UDC is not set +# CONFIG_USB_GADGET_FSL_QE is not set +# CONFIG_USB_GADGET_NET2280 is not set +# CONFIG_USB_GADGET_GOKU is not set +CONFIG_USB_GADGET_ASPEED_AST=y +CONFIG_USB_ASPEED_AST=y +# CONFIG_USB_GADGET_DUMMY_HCD is not set +CONFIG_USB_GADGET_DUALSPEED=y +CONFIG_USB_ZERO=m +CONFIG_USB_ETH=m +CONFIG_USB_ETH_RNDIS=y +CONFIG_USB_GADGETFS=m +CONFIG_USB_FILE_STORAGE=m +# CONFIG_USB_FILE_STORAGE_TEST is not set +CONFIG_USB_G_SERIAL=m +# CONFIG_USB_MIDI_GADGET is not set +# CONFIG_USB_G_PRINTER is not set +CONFIG_USB_CDC_COMPOSITE=m +# CONFIG_MMC is not set +# CONFIG_MEMSTICK is not set +# CONFIG_ACCESSIBILITY is not set +# CONFIG_NEW_LEDS is not set +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +# CONFIG_RTC_HCTOSYS is not set +# CONFIG_RTC_DEBUG is not set + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_DS1307 is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_X1205 is not set +# CONFIG_RTC_DRV_PCF8563 is not set +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8581 is not set + +# +# SPI RTC drivers +# +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_DS3234 is not set + +# +# Platform RTC drivers +# +# CONFIG_RTC_DRV_CMOS is not set +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_V3020 is not set + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_PL030 is not set +# CONFIG_RTC_DRV_PL031 is not set +CONFIG_RTC_DRV_ASPEED=y +# CONFIG_DMADEVICES is not set +# CONFIG_REGULATOR is not set +# CONFIG_UIO is not set + +# +# File systems +# +CONFIG_EXT2_FS=y +CONFIG_EXT2_FS_XATTR=y +CONFIG_EXT2_FS_POSIX_ACL=y +CONFIG_EXT2_FS_SECURITY=y +# CONFIG_EXT2_FS_XIP is not set +# CONFIG_EXT3_FS is not set +# CONFIG_EXT4_FS is not set +CONFIG_FS_MBCACHE=y +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +CONFIG_FS_POSIX_ACL=y +CONFIG_FILE_LOCKING=y +# CONFIG_XFS_FS is not set +# CONFIG_OCFS2_FS is not set +CONFIG_DNOTIFY=y +CONFIG_INOTIFY=y +CONFIG_INOTIFY_USER=y +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_FUSE_FS is not set +CONFIG_GENERIC_ACL=y + +# +# CD-ROM/DVD Filesystems +# +# CONFIG_ISO9660_FS is not set +# CONFIG_UDF_FS is not set + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=y +CONFIG_MSDOS_FS=y +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +CONFIG_NTFS_FS=y +# CONFIG_NTFS_DEBUG is not set +CONFIG_NTFS_RW=y + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +# CONFIG_HUGETLB_PAGE is not set +CONFIG_CONFIGFS_FS=m + +# +# Miscellaneous filesystems +# +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_FS_DEBUG=0 +CONFIG_JFFS2_FS_WRITEBUFFER=y +# CONFIG_JFFS2_FS_WBUF_VERIFY is not set +# CONFIG_JFFS2_SUMMARY is not set +# CONFIG_JFFS2_FS_XATTR is not set +# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set +CONFIG_JFFS2_ZLIB=y +# CONFIG_JFFS2_LZO is not set +CONFIG_JFFS2_RTIME=y +# CONFIG_JFFS2_RUBIN is not set +# CONFIG_CRAMFS is not set +# CONFIG_VXFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=y +# CONFIG_NFS_V3 is not set +# CONFIG_NFS_V4 is not set +CONFIG_ROOT_NFS=y +# CONFIG_NFSD is not set +CONFIG_LOCKD=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=y +# CONFIG_SUNRPC_REGISTER_V4 is not set +# CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_RPCSEC_GSS_SPKM3 is not set +# CONFIG_SMB_FS is not set +# CONFIG_CIFS is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +CONFIG_NLS_CODEPAGE_936=y +CONFIG_NLS_CODEPAGE_950=y +CONFIG_NLS_CODEPAGE_932=y +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set + +# +# Kernel hacking +# +# CONFIG_PRINTK_TIME is not set +# CONFIG_ENABLE_WARN_DEPRECATED is not set +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_FRAME_WARN=1024 +CONFIG_MAGIC_SYSRQ=y +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_DEBUG_FS is not set +# CONFIG_HEADERS_CHECK is not set +CONFIG_DEBUG_KERNEL=y +# CONFIG_DEBUG_SHIRQ is not set +CONFIG_DETECT_SOFTLOCKUP=y +# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 +CONFIG_SCHED_DEBUG=y +# CONFIG_SCHEDSTATS is not set +# CONFIG_TIMER_STATS is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_RT_MUTEX_TESTER is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_DEBUG_KOBJECT is not set +CONFIG_DEBUG_BUGVERBOSE=y +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_WRITECOUNT is not set +CONFIG_DEBUG_MEMORY_INIT=y +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_SG is not set +CONFIG_FRAME_POINTER=y +# CONFIG_BOOT_PRINTK_DELAY is not set +# CONFIG_RCU_TORTURE_TEST is not set +# CONFIG_RCU_CPU_STALL_DETECTOR is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_FAULT_INJECTION is not set +# CONFIG_LATENCYTOP is not set +# CONFIG_SYSCTL_SYSCALL_CHECK is not set +CONFIG_HAVE_FUNCTION_TRACER=y + +# +# Tracers +# +# CONFIG_FUNCTION_TRACER is not set +# CONFIG_IRQSOFF_TRACER is not set +# CONFIG_SCHED_TRACER is not set +# CONFIG_CONTEXT_SWITCH_TRACER is not set +# CONFIG_BOOT_TRACER is not set +# CONFIG_STACK_TRACER is not set +# CONFIG_DYNAMIC_PRINTK_DEBUG is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +# CONFIG_DEBUG_USER is not set +# CONFIG_DEBUG_ERRORS is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_LL is not set + +# +# Security options +# +# CONFIG_KEYS is not set +# CONFIG_SECURITY is not set +# CONFIG_SECURITYFS is not set +# CONFIG_SECURITY_FILE_CAPABILITIES is not set +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +# CONFIG_CRYPTO_FIPS is not set +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=m +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_GF128MUL is not set +CONFIG_CRYPTO_NULL=y +# CONFIG_CRYPTO_CRYPTD is not set +CONFIG_CRYPTO_AUTHENC=m +# CONFIG_CRYPTO_TEST is not set + +# +# Authenticated Encryption with Associated Data +# +# CONFIG_CRYPTO_CCM is not set +# CONFIG_CRYPTO_GCM is not set +# CONFIG_CRYPTO_SEQIV is not set + +# +# Block modes +# +CONFIG_CRYPTO_CBC=y +# CONFIG_CRYPTO_CTR is not set +# CONFIG_CRYPTO_CTS is not set +# CONFIG_CRYPTO_ECB is not set +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set + +# +# Hash modes +# +CONFIG_CRYPTO_HMAC=y +# CONFIG_CRYPTO_XCBC is not set + +# +# Digest +# +# CONFIG_CRYPTO_CRC32C is not set +# CONFIG_CRYPTO_MD4 is not set +CONFIG_CRYPTO_MD5=y +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +CONFIG_CRYPTO_SHA1=y +# CONFIG_CRYPTO_SHA256 is not set +# CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set + +# +# Ciphers +# +# CONFIG_CRYPTO_AES is not set +# CONFIG_CRYPTO_ANUBIS is not set +# CONFIG_CRYPTO_ARC4 is not set +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +CONFIG_CRYPTO_DES=y +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_TEA is not set +# CONFIG_CRYPTO_TWOFISH is not set + +# +# Compression +# +CONFIG_CRYPTO_DEFLATE=m +# CONFIG_CRYPTO_LZO is not set + +# +# Random Number Generation +# +# CONFIG_CRYPTO_ANSI_CPRNG is not set +# CONFIG_CRYPTO_HW is not set + +# +# Library routines +# +CONFIG_BITREVERSE=y +# CONFIG_CRC_CCITT is not set +# CONFIG_CRC16 is not set +# CONFIG_CRC_T10DIF is not set +CONFIG_CRC_ITU_T=m +CONFIG_CRC32=y +# CONFIG_CRC7 is not set +# CONFIG_LIBCRC32C is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_PLIST=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAS_DMA=y diff --git a/meta-raptor/meta-asus/recipes-kernel/linux/linux-aspeed_2.6%.bbappend b/meta-raptor/meta-asus/recipes-kernel/linux/linux-aspeed_2.6%.bbappend new file mode 100644 index 0000000..164e42f --- /dev/null +++ b/meta-raptor/meta-asus/recipes-kernel/linux/linux-aspeed_2.6%.bbappend @@ -0,0 +1,8 @@ +LINUX_VERSION_EXTENSION = "-asus" + +COMPATIBLE_MACHINE = "asus" + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += "file://defconfig \ + " diff --git a/meta-raptor/meta-asus/recipes-utils/lm_sensors/files/asus.conf b/meta-raptor/meta-asus/recipes-utils/lm_sensors/files/asus.conf new file mode 100644 index 0000000..770d343 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/lm_sensors/files/asus.conf @@ -0,0 +1,78 @@ + +bus "i2c-3" "ast_i2c.3" + +bus "i2c-4" "ast_i2c.4" + +bus "i2c-8" "ast_i2c.8" + +chip "tmp75-i2c-3-48" + label temp1 "Outlet Middle Temp" + set temp1_max 70 + set temp1_max_hyst 60 + +chip "tmp75-i2c-3-49" + label temp1 "Inlet Middle Temp" + set temp1_max 70 + set temp1_max_hyst 60 + +chip "tmp75-i2c-3-4a" + label temp1 "Inlet Left Temp" + set temp1_max 70 + set temp1_max_hyst 60 + +chip "tmp75-i2c-3-4b" + label temp1 "Switch Temp" + set temp1_max 70 + set temp1_max_hyst 60 + +chip "tmp75-i2c-3-4c" + label temp1 "Inlet Right Temp" + set temp1_max 70 + set temp1_max_hyst 60 + +chip "tmp75-i2c-8-48" + label temp1 "Outlet Right Temp" + set temp1_max 70 + set temp1_max_hyst 60 + +chip "tmp75-i2c-8-49" + label temp1 "Outlet Left Temp" + set temp1_max 70 + set temp1_max_hyst 60 + +chip "fancpld-i2c-8-33" + label fan1 "Fan 1 front" + label fan2 "Fan 1 rear" + label fan3 "Fan 2 front" + label fan4 "Fan 2 rear" + label fan5 "Fan 3 front" + label fan6 "Fan 3 rear" + label fan7 "Fan 4 front" + label fan8 "Fan 4 rear" + label fan9 "Fan 5 front" + label fan10 "Fan 5 rear" + +chip "fb_panther_plus-*" + label temp1 "CPU Temp" + label temp2 "DIMM0 Temp" + ignore temp3 + ignore temp4 + ignore temp5 + +chip "ast_adc-isa-0000" + ignore in0 + ignore in1 + ignore in2 + ignore in3 + ignore in4 + label in5 "+1 Core Voltage" + label in6 "+1 Analog Voltage" + label in7 "+5 Voltage" + label in8 "+3.3 Voltage" + label in9 "+2.5 Voltage" + ignore in10 + ignore in11 + ignore in12 + ignore in13 + ignore in14 + ignore in15 diff --git a/meta-raptor/meta-asus/recipes-utils/lm_sensors/lmsensors_%.bbappend b/meta-raptor/meta-asus/recipes-utils/lm_sensors/lmsensors_%.bbappend new file mode 100644 index 0000000..b53ed62 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/lm_sensors/lmsensors_%.bbappend @@ -0,0 +1,10 @@ + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += "file://asus.conf \ + " + +do_install_board_config() { + install -d ${D}${sysconfdir}/sensors.d + install -m 644 ../asus.conf ${D}${sysconfdir}/sensors.d/asus.conf +} diff --git a/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/asus_gpio_parse.py b/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/asus_gpio_parse.py new file mode 100644 index 0000000..5199389 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/asus_gpio_parse.py @@ -0,0 +1,102 @@ +#!/usr/bin/python -tt +# Copyright 2015-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import argparse +import csv +import logging +import re +import sys + + +GPIO_SYMBOL = 'BoardGPIO' + + +class CsvReader: + ''' + A class for parsing the CSV files containing the board GPIO config + ''' + def __init__(self, path): + self.path = path + + fileobj = open(path, 'r') + self.reader = csv.reader(fileobj, delimiter=b',', quotechar=b'"') + + def next(self): + try: + line = self.reader.next() + except StopIteration: + return None + return line + + +class ASUSGPIO(object): + def __init__(self, data): + self.data = data + self.gpios = {} + self.names = set() + + def parse(self): + while True: + line = self.data.next() + if line is None: + break + + logging.debug('Parsing line: %s' % line) + + if len(line) < 4: + logging.error('No enough fields in "%s". Skip!' % line) + continue + + gpio = None + for part in line[1].split('_'): + if part.startswith('GPIO'): + gpio = part + break + if gpio is None: + logging.error('Cannot find GPIO file from "%s". Skip!' % line) + continue + + name = line[3] + assert gpio not in self.gpios and name not in self.names + self.gpios[gpio] = name + self.names.add(name) + + def print(self, out): + for gpio in sorted(self.gpios): + out.write(' %s(\'%s\', \'%s\'),\n' + % (GPIO_SYMBOL, gpio, self.gpios[gpio])) + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument('data', help='The GPIO data file') + args = ap.parse_args() + + logging.basicConfig(level=logging.INFO, format='%(asctime)s: %(message)s') + + gpio = ASUSGPIO(CsvReader(args.data)) + gpio.parse() + gpio.print(sys.stdout) + + +rc = main() +sys.exit(rc) diff --git a/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/board_gpio_rev_table.py b/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/board_gpio_rev_table.py new file mode 100644 index 0000000..9b830b4 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/board_gpio_rev_table.py @@ -0,0 +1,33 @@ +# Copyright 2015-present Facebook. All rights reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +from openbmc_gpio_table import BoardGPIO + +# The fallowing table is generated using: +# python asus_gpio_parser.py data/asus-BMC-gpio.csv +# DO NOT MODIFY THE TABLE!!! +# Manual modification will be overridden!!! + +board_gpio_rev_table = [ + BoardGPIO('GPIOY0', 'BOARD_REV_ID0'), + BoardGPIO('GPIOY1', 'BOARD_REV_ID1'), + BoardGPIO('GPIOY2', 'BOARD_REV_ID2'), +] diff --git a/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/board_gpio_table_v1.py b/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/board_gpio_table_v1.py new file mode 100644 index 0000000..9438c0b --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/board_gpio_table_v1.py @@ -0,0 +1,44 @@ +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2015-present Facebook. All rights reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +from openbmc_gpio_table import BoardGPIO + + +# The fallowing table is generated using: +# python asus_gpio_parser.py data/asus-BMC-GPIO.csv +# DO NOT MODIFY THE TABLE!!! +# Manual modification will be overridden!!! + +board_gpio_table_v1 = [ + BoardGPIO('GPIOA4', 'ASUS_BMC_CTL_LOCKOUT_N'), + BoardGPIO('GPIOB1', 'CTL_REQ_POWERUP_N'), + BoardGPIO('GPIOB6', 'CTL_REQ_RESET_N'), + BoardGPIO('GPIOE1', 'LED_STA_BMC_N'), + BoardGPIO('GPIOE2', 'LED_ERR_CPU2_N'), + BoardGPIO('GPIOE3', 'LED_ERR_CPU1_N'), + BoardGPIO('GPIOF0', 'CTL_REQ_POWERDOWN_N'), + BoardGPIO('GPIOF4', 'CTL_REQ_SPD_MUX_S1'), + BoardGPIO('GPIOF5', 'CTL_REQ_SPD_MUX_S0'), + BoardGPIO('GPIOG0', 'LED_STA_LOC_N'), + BoardGPIO('GPIOG1', 'USR_SW_LOC_N'), + BoardGPIO('GPIOH2', 'STA_LINE_POWER'), +] diff --git a/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/data/asus-BMC-GPIO.csv b/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/data/asus-BMC-GPIO.csv new file mode 100644 index 0000000..b2027ea --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/data/asus-BMC-GPIO.csv @@ -0,0 +1,12 @@ +D11,GPIOA4_PHYLINK,Out,ASUS_BMC_CTL_LOCKOUT_N,"Lock out BMC access to board controls. Active low" +A11,GPIOB1_FLBUSY#,Out,CTL_REQ_POWERUP_N,"Engage mainboard power. Active low" +D9,GPIOB6_VBDO,Out,CTL_REQ_RESET_N,"Reset mainboard. Active low" +V4,GPIOF0_VP8,Out,CTL_REQ_POWERDOWN_N,"Forcibly power off mainboard. Active low" +W4,GPIOF4_VP12,Out,CTL_REQ_SPD_MUX_S1,"SPD mux pin S1" +W3,GPIOF5_VP13,Out,CTL_REQ_SPD_MUX_S0,"SPD mux pin S0" +T4,GPIOE3_VP3,Out,LED_ERR_CPU1_N,"CPU1 error indicator" +R1,GPIOE2_VP2,Out,LED_ERR_CPU2_N,"CPU2 error indicator" +R2,GPIOE1_VP1,Out,LED_STA_BMC_N,"BMC status LED" +Y4,GPIOG0_VP16,Out,LED_STA_LOC_N,"BMC locator LED" +Y3,GPIOG1_VP17,In,USR_SW_LOC_N,"BMC locator switch" +A12,GPIOH2_SDA7,In,STA_LINE_POWER,"Mainboard power status. 1 = power on, 0= power off. (I2C bus power)"
\ No newline at end of file diff --git a/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/openbmc_gpio_setup.py b/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/openbmc_gpio_setup.py new file mode 100644 index 0000000..56beefe --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/openbmc_gpio_setup.py @@ -0,0 +1,42 @@ +#!/usr/bin/python -tt +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2015-present Facebook. All rights reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +from board_gpio_table_v1 import board_gpio_table_v1 +from soc_gpio_table import soc_gpio_table +from openbmc_gpio_table import setup_board_gpio +from soc_gpio import soc_get_register + +import openbmc_gpio +import sys + +def main(): + print('Setting up GPIOs ... ', end='') + sys.stdout.flush() + openbmc_gpio.setup_shadow() + setup_board_gpio(soc_gpio_table, board_gpio_table_v1) + print('Done') + sys.stdout.flush() + return 0 + +if __name__ == '__main__': + sys.exit(main()) diff --git a/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/setup_board.py b/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/setup_board.py new file mode 100644 index 0000000..cc35824 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/files/setup_board.py @@ -0,0 +1,21 @@ +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2015-present Facebook. All rights reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +board_py_modules=[ + 'board_gpio_table_v1', +] diff --git a/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/openbmc-gpio_%.bbappend b/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/openbmc-gpio_%.bbappend new file mode 100644 index 0000000..dbf34f4 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/openbmc-gpio/openbmc-gpio_%.bbappend @@ -0,0 +1,35 @@ +# Copyright 2017 Raptor Engineering +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += " \ + file://board_gpio_table_v1.py \ + file://board_gpio_rev_table.py \ + file://openbmc_gpio_setup.py \ + file://setup_board.py \ + " +OPENBMC_GPIO_SOC_TABLE = "ast2050_gpio_table.py" + +do_install_append() { + install -d ${D}${sysconfdir}/init.d + install -d ${D}${sysconfdir}/rcS.d + install -m 755 openbmc_gpio_setup.py ${D}${sysconfdir}/init.d/openbmc_gpio_setup.py + update-rc.d -r ${D} openbmc_gpio_setup.py start 59 S . +} + +FILES_${PN} += "/usr/local/bin ${sysconfdir}" diff --git a/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/COPYING b/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/COPYING new file mode 100644 index 0000000..3912109 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/asus_power.sh b/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/asus_power.sh new file mode 100644 index 0000000..f61cf63 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/asus_power.sh @@ -0,0 +1,191 @@ +#!/bin/bash +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2015-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +. /usr/local/bin/openbmc-utils.sh + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin + +prog="$0" + +PWR_BTN_GPIO="BMC_PWR_BTN_OUT_N" +PWR_SYSTEM_SYSFS="${SYSCPLD_SYSFS_DIR}/pwr_cyc_all_n" +PWR_USRV_RST_SYSFS="${SYSCPLD_SYSFS_DIR}/usrv_rst_n" + +usage() { + echo "Usage: $prog <command> [command options]" + echo + echo "Commands:" + echo " status: Get the current microserver power status" + echo + echo " on: Power on microserver if not powered on already" + echo " options:" + echo " -f: Re-do power on sequence no matter if microserver has " + echo " been powered on or not." + echo + echo " off: Power off microserver ungracefully" + echo + echo " reset: Power reset microserver ungracefully" + echo " options:" + echo " -s: Power reset whole wedge system ungracefully" + echo +} + +do_status() { + echo -n "Mainboard power is " + if asus_is_us_on; then + echo "on" + else + echo "off" + fi + return 0 +} + +do_gpio_power_on() { + gpio_set CTL_REQ_POWERDOWN_N 1 + gpio_set CTL_REQ_RESET_N 0 + gpio_set CTL_REQ_POWERUP_N 0 + sleep 1 + gpio_set CTL_REQ_RESET_N 1 + gpio_set CTL_REQ_POWERUP_N 1 + return 0 +} + +do_on() { + local force opt ret + force=0 + while getopts "f" opt; do + case $opt in + f) + force=1 + ;; + *) + usage + exit -1 + ;; + + esac + done + echo -n "Power on mainboard ..." + if [ $force -eq 0 ]; then + # need to check if uS is on or not + if asus_is_us_on 10 "."; then + echo " Already on. Skip!" + return 1 + fi + fi + + # power on sequence + do_gpio_power_on + ret=$? + if [ $ret -eq 0 ]; then + echo " Done" + else + echo " Failed" + fi + return $ret +} + +do_gpio_power_off() { + gpio_set CTL_REQ_RESET_N 1 + gpio_set CTL_REQ_POWERUP_N 1 + gpio_set CTL_REQ_POWERDOWN_N 0 + sleep 1 + gpio_set CTL_REQ_POWERDOWN_N 1 + return 0 +} + +do_off() { + local ret + echo -n "Power off mainboard ..." + do_gpio_power_off + ret=$? + if [ $ret -eq 0 ]; then + echo " Done" + else + echo " Failed" + fi + return $ret +} + +do_reset() { + local system opt pulse_us + system=0 + while getopts "s" opt; do + case $opt in + s) + system=1 + ;; + *) + usage + exit -1 + ;; + esac + done + if [ $system -eq 1 ]; then + echo -n "Power reset whole system ..." + do_gpio_power_off + sleep 1 + do_gpio_power_on + else + if ! asus_is_us_on; then + echo "Power resetting mainboard that is powered off has no effect." + echo "Use '$prog on' to power the mainboard on" + return -1 + fi + echo -n "Power reset microserver ..." + gpio_set CTL_REQ_POWERDOWN_N 1 + gpio_set CTL_REQ_RESET_N 0 + gpio_set CTL_REQ_POWERUP_N 1 + sleep 1 + gpio_set CTL_REQ_RESET_N 1 + fi + echo " Done" + return 0 +} + +if [ $# -lt 1 ]; then + usage + exit -1 +fi + +command="$1" +shift + +case "$command" in + status) + do_status $@ + ;; + on) + do_on $@ + ;; + off) + do_off $@ + ;; + reset) + do_reset $@ + ;; + *) + usage + exit -1 + ;; +esac + +exit $? diff --git a/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/asus_us_mac.sh b/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/asus_us_mac.sh new file mode 100644 index 0000000..b819b6a --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/asus_us_mac.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2015-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin + +. /usr/local/bin/openbmc-utils.sh + +mac=$(fw_printenv ethaddr) + +if [ -n "$mac" -a "${mac/X/}" = "${mac}" ]; then + echo $mac + exit 0 +else + echo "Cannot determine BMC MAC" 1>&2 + exit -1 +fi diff --git a/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/board-utils.sh b/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/board-utils.sh new file mode 100644 index 0000000..a43ad8b --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/board-utils.sh @@ -0,0 +1,45 @@ +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2015-present Facebook. All Rights Reserved. + +SLOT_ID=1 + +asus_is_us_on() { + val=$(gpio_get STA_LINE_POWER) + if [ "$val" == "1" ]; then + return 0 # powered on + else + return 1 + fi +} + +asus_board_type() { + echo 'ASUS ASMB4 Platform' +} + +asus_slot_id() { + printf "%d\n" $SLOT_ID +} + +asus_board_rev() { + echo 0 +} + +# Should we enable OOB interface or not +asus_should_enable_oob() { + # ASUS uses BMC MAC + return -1 +} + +asus_power_on_board() { + local val + val=$(asus_is_us_on) + if [[ "$val" == "1" ]]; then + # power on + gpio_set CTL_REQ_POWERDOWN_N 1 + gpio_set CTL_REQ_RESET_N 0 + gpio_set CTL_REQ_POWERUP_N 0 + sleep 1 + gpio_set CTL_REQ_RESET_N 1 + gpio_set CTL_REQ_POWERUP_N 1 + fi +} diff --git a/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/disable_watchdog.sh b/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/disable_watchdog.sh new file mode 100644 index 0000000..07826d6 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/disable_watchdog.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +. /usr/local/bin/openbmc-utils.sh + +# Disable the dual boot watch dog +devmem_clear_bit 0x1e78502c 0 diff --git a/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/power-on.sh b/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/power-on.sh new file mode 100644 index 0000000..3b313d4 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/openbmc-utils/files/power-on.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +### BEGIN INIT INFO +# Provides: power-on +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Power on micro-server +### END INIT INFO +. /usr/local/bin/openbmc-utils.sh + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin + +# set power and reset lines high to prepare for power on sequence +gpio_set CTL_REQ_POWERUP_N 1 +gpio_set CTL_REQ_POWERDOWN_N 1 +gpio_set CTL_REQ_RESET_N 1 + +# release control lockout +gpio_set ASUS_BMC_CTL_LOCKOUT_N 1 + +# power up +asus_power_on_board + +echo -n "Checking mainboard power status ... " +if asus_is_us_on 10 "."; then + echo "on" + on=1 +else + echo "off" + on=0 +fi + +if [ $on -eq 0 ]; then + # Power on now + asus_power.sh on -f +fi diff --git a/meta-raptor/meta-asus/recipes-utils/openbmc-utils/openbmc-utils_%.bbappend b/meta-raptor/meta-asus/recipes-utils/openbmc-utils/openbmc-utils_%.bbappend new file mode 100644 index 0000000..45aef73 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-utils/openbmc-utils/openbmc-utils_%.bbappend @@ -0,0 +1,71 @@ +# Copyright 2015-present Facebook. All Rights Reserved. +# +# This program file 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; version 2 of the License. +# +# 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 in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += "file://disable_watchdog.sh \ + file://board-utils.sh \ + " + +OPENBMC_UTILS_FILES += " \ + disable_watchdog.sh \ + " + +DEPENDS_append = " update-rc.d-native" + +do_install_board() { + # for backward compatible, create /usr/local/fbpackages/utils/ast-functions + olddir="/usr/local/fbpackages/utils" + install -d ${D}${olddir} + ln -s "/usr/local/bin/openbmc-utils.sh" "${D}${olddir}/ast-functions" + + # common lib and include files + install -d ${D}${includedir}/facebook + install -m 0644 src/include/i2c-dev.h ${D}${includedir}/facebook/i2c-dev.h + + # init + install -d ${D}${sysconfdir}/init.d + install -d ${D}${sysconfdir}/rcS.d + + # the script to mount /mnt/data + install -m 0755 ${WORKDIR}/mount_data0.sh ${D}${sysconfdir}/init.d/mount_data0.sh + update-rc.d -r ${D} mount_data0.sh start 03 S . + install -m 0755 ${WORKDIR}/rc.early ${D}${sysconfdir}/init.d/rc.early + update-rc.d -r ${D} rc.early start 04 S . + + # Initial GPIO setup and heartbeat monitor + install -m 0755 ${WORKDIR}/setup-gpio.sh ${D}${sysconfdir}/init.d/setup-gpio.sh + update-rc.d -r ${D} setup-gpio.sh start 59 S . + install -m 0755 ${WORKDIR}/start_us_monitor.sh ${D}${sysconfdir}/init.d/start_us_monitor.sh + update-rc.d -r ${D} start_us_monitor.sh start 84 S . + + # networking is done after rcS, any start level within rcS + # for mac fixup should work + install -m 755 eth0_mac_fixup.sh ${D}${sysconfdir}/init.d/eth0_mac_fixup.sh + update-rc.d -r ${D} eth0_mac_fixup.sh start 70 S . + + install -m 755 power-on.sh ${D}${sysconfdir}/init.d/power-on.sh + update-rc.d -r ${D} power-on.sh start 85 S . + + install -m 0755 ${WORKDIR}/rc.local ${D}${sysconfdir}/init.d/rc.local + update-rc.d -r ${D} rc.local start 99 2 3 4 5 . + + install -m 0755 ${WORKDIR}/disable_watchdog.sh ${D}${sysconfdir}/init.d/disable_watchdog.sh + update-rc.d -r ${D} disable_watchdog.sh start 99 2 3 4 5 . +} + +FILES_${PN} += "${sysconfdir}" |