1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/*
* 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 <errno.h>
#include <stdio.h>
#include <facebook/wedge_eeprom.h>
#include <openbmc/log.h>
int main(int argc, const char *argv[])
{
const char *fn;
struct wedge_eeprom_st eeprom;
int rc;
if (argc >= 2) {
fn = argv[1];
} else {
fn = NULL;
}
rc = wedge_eeprom_parse(fn, &eeprom);
if (rc) {
fprintf(stderr, "Failed to parse %s EEPROM\n", fn ? fn : "default");
return -1;
}
printf("Wedge EEPROM %s:\n", fn ? fn : "");
printf("Version: %d\n", eeprom.fbw_version);
printf("Product Name: %s\n", eeprom.fbw_product_name);
printf("Product Part Number: %s\n", eeprom.fbw_product_number);
printf("System Assembly Part Number: %s\n", eeprom.fbw_assembly_number);
printf("Facebook PCB Part Number: %s\n", eeprom.fbw_facebook_pcb_number);
printf("ODM PCB Part Number: %s\n", eeprom.fbw_odm_pcb_number);
printf("ODM PCB Serial Number: %s\n", eeprom.fbw_odm_pcb_serial);
printf("Product Production State: %d\n", eeprom.fbw_production_state);
printf("Product Version: %d\n", eeprom.fbw_product_version);
printf("Product Sub-Version: %d\n", eeprom.fbw_product_subversion);
printf("Product Serial Number: %s\n", eeprom.fbw_product_serial);
printf("Product Asset Tag: %s\n", eeprom.fbw_product_asset);
printf("System Manufacturer: %s\n", eeprom.fbw_system_manufacturer);
printf("System Manufacturing Date: %s\n",
eeprom.fbw_system_manufacturing_date);
printf("PCB Manufacturer: %s\n", eeprom.fbw_pcb_manufacturer);
printf("Assembled At: %s\n", eeprom.fbw_assembled);
printf("Local MAC: %X:%X:%X:%X:%X:%X\n",
eeprom.fbw_local_mac[0], eeprom.fbw_local_mac[1],
eeprom.fbw_local_mac[2], eeprom.fbw_local_mac[3],
eeprom.fbw_local_mac[4], eeprom.fbw_local_mac[5]);
printf("Extended MAC Base: %X:%X:%X:%X:%X:%X\n",
eeprom.fbw_mac_base[0], eeprom.fbw_mac_base[1],
eeprom.fbw_mac_base[2], eeprom.fbw_mac_base[3],
eeprom.fbw_mac_base[4], eeprom.fbw_mac_base[5]);
printf("Extended MAC Address Size: %d\n", eeprom.fbw_mac_size);
printf("Location on Fabric: %s\n", eeprom.fbw_location);
printf("CRC8: 0x%x\n", eeprom.fbw_crc8);
return 0;
}
|