2019-04-10 07:08:10 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
|
|
/*
|
|
|
|
* (C) Copyright 2019 Xilinx, Inc.
|
2023-07-10 12:35:49 +00:00
|
|
|
* Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>>
|
2019-04-10 07:08:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __FRU_H
|
|
|
|
#define __FRU_H
|
2022-02-23 14:00:59 +00:00
|
|
|
#include <net.h>
|
2019-04-10 07:08:10 +00:00
|
|
|
|
|
|
|
struct fru_common_hdr {
|
|
|
|
u8 version;
|
|
|
|
u8 off_internal;
|
|
|
|
u8 off_chassis;
|
|
|
|
u8 off_board;
|
|
|
|
u8 off_product;
|
|
|
|
u8 off_multirec;
|
|
|
|
u8 pad;
|
|
|
|
u8 crc;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define FRU_BOARD_MAX_LEN 32
|
2022-02-23 14:00:59 +00:00
|
|
|
#define FRU_MAX_NO_OF_MAC_ADDR 4
|
2019-04-10 07:08:10 +00:00
|
|
|
|
2019-04-15 11:54:09 +00:00
|
|
|
struct __packed fru_board_info_header {
|
|
|
|
u8 ver;
|
|
|
|
u8 len;
|
|
|
|
u8 lang_code;
|
|
|
|
u8 time[3];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct __packed fru_board_info_member {
|
|
|
|
u8 type_len;
|
|
|
|
u8 *name;
|
|
|
|
};
|
|
|
|
|
2019-04-10 07:08:10 +00:00
|
|
|
struct fru_board_data {
|
|
|
|
u8 ver;
|
|
|
|
u8 len;
|
|
|
|
u8 lang_code;
|
|
|
|
u8 time[3];
|
|
|
|
u8 manufacturer_type_len;
|
|
|
|
u8 manufacturer_name[FRU_BOARD_MAX_LEN];
|
|
|
|
u8 product_name_type_len;
|
|
|
|
u8 product_name[FRU_BOARD_MAX_LEN];
|
|
|
|
u8 serial_number_type_len;
|
|
|
|
u8 serial_number[FRU_BOARD_MAX_LEN];
|
|
|
|
u8 part_number_type_len;
|
|
|
|
u8 part_number[FRU_BOARD_MAX_LEN];
|
|
|
|
u8 file_id_type_len;
|
|
|
|
u8 file_id[FRU_BOARD_MAX_LEN];
|
2019-04-15 11:54:09 +00:00
|
|
|
/* Xilinx custom fields */
|
|
|
|
u8 rev_type_len;
|
|
|
|
u8 rev[FRU_BOARD_MAX_LEN];
|
2020-11-06 12:58:01 +00:00
|
|
|
u8 pcie_type_len;
|
|
|
|
u8 pcie[FRU_BOARD_MAX_LEN];
|
|
|
|
u8 uuid_type_len;
|
|
|
|
u8 uuid[FRU_BOARD_MAX_LEN];
|
2019-04-10 07:08:10 +00:00
|
|
|
};
|
|
|
|
|
2022-02-23 14:00:59 +00:00
|
|
|
struct fru_multirec_hdr {
|
|
|
|
u8 rec_type;
|
|
|
|
u8 type;
|
|
|
|
u8 len;
|
|
|
|
u8 csum;
|
|
|
|
u8 hdr_csum;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct fru_multirec_mac {
|
|
|
|
u8 xlnx_iana_id[3];
|
|
|
|
u8 ver;
|
|
|
|
u8 macid[FRU_MAX_NO_OF_MAC_ADDR][ETH_ALEN];
|
|
|
|
};
|
|
|
|
|
2019-04-10 07:08:10 +00:00
|
|
|
struct fru_table {
|
|
|
|
struct fru_common_hdr hdr;
|
|
|
|
struct fru_board_data brd;
|
2022-02-23 14:00:59 +00:00
|
|
|
struct fru_multirec_mac mac;
|
2020-11-06 12:53:01 +00:00
|
|
|
bool captured;
|
2019-04-10 07:08:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define FRU_TYPELEN_CODE_MASK 0xC0
|
|
|
|
#define FRU_TYPELEN_LEN_MASK 0x3F
|
|
|
|
#define FRU_COMMON_HDR_VER_MASK 0xF
|
|
|
|
#define FRU_COMMON_HDR_LEN_MULTIPLIER 8
|
|
|
|
#define FRU_LANG_CODE_ENGLISH 0
|
|
|
|
#define FRU_LANG_CODE_ENGLISH_1 25
|
|
|
|
#define FRU_TYPELEN_EOF 0xC1
|
2022-02-23 14:00:59 +00:00
|
|
|
#define FRU_MULTIREC_TYPE_OEM 0xD2
|
|
|
|
#define FRU_MULTIREC_MAC_OFFSET 4
|
|
|
|
#define FRU_LAST_REC BIT(7)
|
|
|
|
#define FRU_DUT_MACID 0x31
|
2022-11-23 11:48:44 +00:00
|
|
|
#define FRU_SC_MACID 0x11
|
2019-04-10 07:08:10 +00:00
|
|
|
|
|
|
|
/* This should be minimum of fields */
|
|
|
|
#define FRU_BOARD_AREA_TOTAL_FIELDS 5
|
|
|
|
#define FRU_TYPELEN_TYPE_SHIFT 6
|
|
|
|
#define FRU_TYPELEN_TYPE_BINARY 0
|
|
|
|
#define FRU_TYPELEN_TYPE_ASCII8 3
|
|
|
|
|
|
|
|
int fru_display(int verbose);
|
|
|
|
int fru_capture(unsigned long addr);
|
2019-04-15 11:54:09 +00:00
|
|
|
int fru_generate(unsigned long addr, char *manufacturer, char *board_name,
|
|
|
|
char *serial_no, char *part_no, char *revision);
|
2019-04-10 07:08:10 +00:00
|
|
|
u8 fru_checksum(u8 *addr, u8 len);
|
|
|
|
|
|
|
|
extern struct fru_table fru_data;
|
|
|
|
|
|
|
|
#endif /* FRU_H */
|