diff options
Diffstat (limited to 'meta-facebook/meta-yosemite/recipes-yosemite/fblibs/files/yosemite_common')
3 files changed, 110 insertions, 0 deletions
diff --git a/meta-facebook/meta-yosemite/recipes-yosemite/fblibs/files/yosemite_common/Makefile b/meta-facebook/meta-yosemite/recipes-yosemite/fblibs/files/yosemite_common/Makefile new file mode 100644 index 0000000..76bf61f --- /dev/null +++ b/meta-facebook/meta-yosemite/recipes-yosemite/fblibs/files/yosemite_common/Makefile @@ -0,0 +1,11 @@ +# Copyright 2015-present Facebook. All Rights Reserved. +lib: libyosemite_common.so + +libyosemite_common.so: yosemite_common.c + $(CC) $(CFLAGS) -fPIC -c -o yosemite_common.o yosemite_common.c + $(CC) -shared -o libyosemite_common.so yosemite_common.o -lc + +.PHONY: clean + +clean: + rm -rf *.o libyosemite_common.so diff --git a/meta-facebook/meta-yosemite/recipes-yosemite/fblibs/files/yosemite_common/yosemite_common.c b/meta-facebook/meta-yosemite/recipes-yosemite/fblibs/files/yosemite_common/yosemite_common.c new file mode 100644 index 0000000..e41690f --- /dev/null +++ b/meta-facebook/meta-yosemite/recipes-yosemite/fblibs/files/yosemite_common/yosemite_common.c @@ -0,0 +1,55 @@ +/* + * + * Copyright 2015-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 <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <stdbool.h> +#include <math.h> +#include <fcntl.h> +#include <errno.h> +#include <syslog.h> +#include "yosemite_common.h" + +int +yosemite_common_fru_id(char *str, uint8_t *fru) { + + if (!strcmp(str, "all")) { + *fru = FRU_ALL; + } else if (!strcmp(str, "slot1")) { + *fru = FRU_SLOT1; + } else if (!strcmp(str, "slot2")) { + *fru = FRU_SLOT2; + } else if (!strcmp(str, "slot3")) { + *fru = FRU_SLOT3; + } else if (!strcmp(str, "slot4")) { + *fru = FRU_SLOT4; + } else if (!strcmp(str, "spb")) { + *fru = FRU_SPB; + } else if (!strcmp(str, "nic")) { + *fru = FRU_NIC; + } else { + syslog(LOG_ALERT, "yosemite_common_fru_id: Wrong fru id"); + return -1; + } + + return 0; +} diff --git a/meta-facebook/meta-yosemite/recipes-yosemite/fblibs/files/yosemite_common/yosemite_common.h b/meta-facebook/meta-yosemite/recipes-yosemite/fblibs/files/yosemite_common/yosemite_common.h new file mode 100644 index 0000000..85d8638 --- /dev/null +++ b/meta-facebook/meta-yosemite/recipes-yosemite/fblibs/files/yosemite_common/yosemite_common.h @@ -0,0 +1,44 @@ +/* + * + * 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 __YOSEMITE_COMMON_H__ +#define __YOSEMITE_COMMON_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + FRU_ALL = 0, + FRU_SLOT1 = 1, + FRU_SLOT2 = 2, + FRU_SLOT3 = 3, + FRU_SLOT4 = 4, + FRU_SPB = 5, + FRU_NIC = 6, +}; + +int yosemite_common_fru_id(char *str, uint8_t *fru); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif /* __YOSEMITE_COMMON_H__ */ |