summaryrefslogtreecommitdiffstats
path: root/meta-facebook/meta-yosemite/recipes-yosemite/ipmid/files/fruid.c
diff options
context:
space:
mode:
Diffstat (limited to 'meta-facebook/meta-yosemite/recipes-yosemite/ipmid/files/fruid.c')
-rw-r--r--meta-facebook/meta-yosemite/recipes-yosemite/ipmid/files/fruid.c120
1 files changed, 0 insertions, 120 deletions
diff --git a/meta-facebook/meta-yosemite/recipes-yosemite/ipmid/files/fruid.c b/meta-facebook/meta-yosemite/recipes-yosemite/ipmid/files/fruid.c
deleted file mode 100644
index d3fb856..0000000
--- a/meta-facebook/meta-yosemite/recipes-yosemite/ipmid/files/fruid.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <syslog.h>
-#include <string.h>
-#include <stdint.h>
-#include "fruid.h"
-
-#define EEPROM_SPB "/sys/class/i2c-adapter/i2c-8/8-0051/eeprom"
-#define EEPROM_NIC "/sys/class/i2c-adapter/i2c-12/12-0051/eeprom"
-
-#define BIN_SPB "/tmp/fruid_spb.bin"
-#define BIN_NIC "/tmp/fruid_nic.bin"
-
-#define NAME_SPB "Side Plane Board"
-#define NAME_NIC "Mezz Card"
-
-#define FRUID_SIZE 256
-
-/*
- * copy_eeprom_to_bin - copy the eeprom to binary file im /tmp directory
- *
- * @eeprom_file : path for the eeprom of the device
- * @bin_file : path for the binary file
- *
- * returns 0 on successful copy
- * returns non-zero on file operation errors
- */
-int copy_eeprom_to_bin(const char * eeprom_file, const char * bin_file) {
-
- int eeprom;
- int bin;
- uint64_t tmp[FRUID_SIZE];
- ssize_t bytes_rd, bytes_wr;
-
- errno = 0;
-
- if (access(eeprom_file, F_OK) != -1) {
-
- eeprom = open(eeprom_file, O_RDONLY);
- if (eeprom == -1) {
- syslog(LOG_ERR, "copy_eeprom_to_bin: unable to open the %s file: %s",
- eeprom_file, strerror(errno));
- return errno;
- }
-
- bin = open(bin_file, O_WRONLY | O_CREAT, 0644);
- if (bin == -1) {
- syslog(LOG_ERR, "copy_eeprom_to_bin: unable to create %s file: %s",
- bin_file, strerror(errno));
- return errno;
- }
-
- bytes_rd = read(eeprom, tmp, FRUID_SIZE);
- if (bytes_rd != FRUID_SIZE) {
- syslog(LOG_ERR, "copy_eeprom_to_bin: write to %s file failed: %s",
- eeprom_file, strerror(errno));
- return errno;
- }
-
- bytes_wr = write(bin, tmp, bytes_rd);
- if (bytes_wr != bytes_rd) {
- syslog(LOG_ERR, "copy_eeprom_to_bin: write to %s file failed: %s",
- bin_file, strerror(errno));
- return errno;
- }
-
- close(bin);
- close(eeprom);
- }
-
- return 0;
-}
-
-/* Populate the platform specific eeprom for fruid info */
-int plat_fruid_init(void) {
-
- int ret;
-
- ret = copy_eeprom_to_bin(EEPROM_SPB, BIN_SPB);
- ret = copy_eeprom_to_bin(EEPROM_NIC, BIN_NIC);
-
- return ret;
-}
-
-int plat_fruid_size(void) {
- /* TODO: Not supported yet */
- return 0;
-}
-int plat_fruid_data(int offset, int count, unsigned char *data) {
- /* TODO: Not supported yet */
- return 0;
-}
OpenPOWER on IntegriCloud