summaryrefslogtreecommitdiffstats
path: root/meta-facebook/meta-yosemite/recipes-yosemite/bic-cached
diff options
context:
space:
mode:
Diffstat (limited to 'meta-facebook/meta-yosemite/recipes-yosemite/bic-cached')
-rw-r--r--meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/bic-cached_0.1.bb44
-rw-r--r--meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/files/Makefile10
-rw-r--r--meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/files/bic-cached.c133
-rw-r--r--meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/files/setup-bic-cached.sh33
4 files changed, 0 insertions, 220 deletions
diff --git a/meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/bic-cached_0.1.bb b/meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/bic-cached_0.1.bb
deleted file mode 100644
index 010e8cf..0000000
--- a/meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/bic-cached_0.1.bb
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 2015-present Facebook. All Rights Reserved.
-
-SUMMARY = "Bridge IC Cache Daemon"
-DESCRIPTION = "Daemon to provide Bridge IC Cache information."
-SECTION = "base"
-PR = "r1"
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://bic-cached.c;beginline=5;endline=17;md5=da35978751a9d71b73679307c4d296ec"
-
-
-DEPENDS_append = "libbic update-rc.d-native"
-
-SRC_URI = "file://Makefile \
- file://setup-bic-cached.sh \
- file://bic-cached.c \
- "
-
-S = "${WORKDIR}"
-
-binfiles = "bic-cached"
-
-pkgdir = "bic-cached"
-
-do_install() {
- dst="${D}/usr/local/fbpackages/${pkgdir}"
- bin="${D}/usr/local/bin"
- install -d $dst
- install -d $bin
- install -m 755 bic-cached ${dst}/bic-cached
- ln -snf ../fbpackages/${pkgdir}/bic-cached ${bin}/bic-cached
- install -d ${D}${sysconfdir}/init.d
- install -d ${D}${sysconfdir}/rcS.d
- install -m 755 setup-bic-cached.sh ${D}${sysconfdir}/init.d/setup-bic-cached.sh
- update-rc.d -r ${D} setup-bic-cached.sh start 66 5 .
-}
-
-FBPACKAGEDIR = "${prefix}/local/fbpackages"
-
-FILES_${PN} = "${FBPACKAGEDIR}/bic-cached ${prefix}/local/bin ${sysconfdir} "
-
-# Inhibit complaints about .debug directories:
-
-INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
-INHIBIT_PACKAGE_STRIP = "1"
diff --git a/meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/files/Makefile b/meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/files/Makefile
deleted file mode 100644
index 478b25e..0000000
--- a/meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/files/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright 2015-present Facebook. All Rights Reserved.
-all: bic-cached
-
-bic-cached: bic-cached.c
- $(CC) -pthread -lbic -std=c99 -o $@ $^ $(LDFLAGS)
-
-.PHONY: clean
-
-clean:
- rm -rf *.o bic-cached
diff --git a/meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/files/bic-cached.c b/meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/files/bic-cached.c
deleted file mode 100644
index 78e443d..0000000
--- a/meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/files/bic-cached.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <syslog.h>
-#include <string.h>
-#include <pthread.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <openbmc/ipmi.h>
-#include <openbmc/ipmb.h>
-#include <facebook/bic.h>
-
-#define LAST_RECORD_ID 0xFFFF
-#define MAX_SENSOR_NUM 0xFF
-#define BYTES_ENTIRE_RECORD 0xFF
-
-void
-fruid_cache_init(uint8_t slot_id) {
- // Initialize Slot0's fruid
- int ret;
- int i;
- char fruid_temp_path[64] = {0};
- char fruid_path[64] = {0};
-
- sprintf(fruid_temp_path, "/tmp/tfruid_slot%d.bin", slot_id);
- sprintf(fruid_path, "/tmp/fruid_slot%d.bin", slot_id);
-
- ret = bic_read_fruid(slot_id, 0, fruid_temp_path);
- if (ret) {
- syslog(LOG_WARNING, "fruid_cache_init: bic_read_fruid returns %d\n", ret);
- }
-
- rename(fruid_temp_path, fruid_path);
-
- return;
-}
-
-void
-sdr_cache_init(uint8_t slot_id) {
- int ret;
- int fd;
- uint8_t rlen;
- uint8_t rbuf[MAX_IPMB_RES_LEN] = {0};
- char *path = NULL;
- char sdr_temp_path[64] = {0};
- char sdr_path[64] = {0};
-
- sprintf(sdr_temp_path, "/tmp/tsdr_slot%d.bin", slot_id);
- sprintf(sdr_path, "/tmp/sdr_slot%d.bin", slot_id);
-
- ipmi_sel_sdr_req_t req;
- ipmi_sel_sdr_res_t *res = (ipmi_sel_sdr_res_t *) rbuf;
-
- req.rsv_id = 0;
- req.rec_id = 0;
- req.offset = 0;
- req.nbytes = BYTES_ENTIRE_RECORD;
-
- // Read Slot0's SDR records and store
- path = sdr_temp_path;
- unlink(path);
- fd = open(path, O_WRONLY | O_CREAT | O_EXCL, 0666);
- if (fd < 0) {
- syslog(LOG_WARNING, "sdr_cache_init: open fails for path: %s\n", path);
- return;
- }
-
- while (1) {
- ret = bic_get_sdr(slot_id, &req, res, &rlen);
- if (ret) {
- syslog(LOG_WARNING, "sdr_cache_init:bic_get_sdr returns %d\n", ret);
- continue;
- }
-
- sdr_full_t *sdr = res->data;
-
- write(fd, sdr, sizeof(sdr_full_t));
-
- req.rec_id = res->next_rec_id;
- if (req.rec_id == LAST_RECORD_ID) {
- // syslog(LOG_INFO, "This record is LAST record\n");
- break;
- }
- }
-
- rename(sdr_temp_path, sdr_path);
-}
-
-int
-main (int argc, char * const argv[])
-{
- int ret;
- ipmi_dev_id_t id = {0};
- uint8_t slot_id;
-
- if (argc != 2) {
- return -1;
- }
-
- slot_id = atoi(argv[1]);
-
- do {
- ret = bic_get_dev_id(slot_id, &id);
- sleep(5);
- } while (ret != 0);
-
- fruid_cache_init(slot_id);
- sdr_cache_init(slot_id);
-
- return 0;
-}
diff --git a/meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/files/setup-bic-cached.sh b/meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/files/setup-bic-cached.sh
deleted file mode 100644
index 45eb1e3..0000000
--- a/meta-facebook/meta-yosemite/recipes-yosemite/bic-cached/files/setup-bic-cached.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2015-present Facebook. All Rights Reserved.
-#
-### BEGIN INIT INFO
-# Provides: setup-bic-cached
-# Required-Start:
-# Required-Stop:
-# Default-Start: S
-# Default-Stop:
-# Short-Description: Set Cachcing for Bridge IC info
-### END INIT INFO
-
-. /usr/local/fbpackages/utils/ast-functions
-
-echo -n "Setup Caching for Bridge IC info.."
-if [ $(is_server_prsnt 1) == "1" ]; then
- /usr/local/bin/bic-cached 1 > /dev/null 2>&1 &
-fi
-
-if [ $(is_server_prsnt 2) == "1" ]; then
-/usr/local/bin/bic-cached 2 > /dev/null 2>&1 &
-fi
-
-if [ $(is_server_prsnt 3) == "1" ]; then
-/usr/local/bin/bic-cached 3 > /dev/null 2>&1 &
-fi
-
-if [ $(is_server_prsnt 4) == "1" ]; then
-/usr/local/bin/bic-cached 4 > /dev/null 2>&1 &
-fi
-
-echo "done."
OpenPOWER on IntegriCloud