summaryrefslogtreecommitdiffstats
path: root/defines.hpp
blob: dda0530d9a8b111184e0f0303ced38fbd360465f (plain)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#pragma once

namespace openpower
{
namespace vpd
{

/** @brief OpenPOWER VPD records we're interested in */
enum class Record
{
    VINI, /**< Initial information, common to all OpenPOWER FRUs */
    OPFR, /**< OpenPOWER FRU information, common to all OpenPOWER FRUs */
    OSYS  /**< Information specific to a system board */
};

/** @brief Convert VPD Record name from enum to string
 *  @tparam R - VPD Record
 *  @returns string representation of Record name
 */
template<Record R>
constexpr const char* getRecord() = delete;

template<>
constexpr const char* getRecord<Record::VINI>()
{
    return "VINI";
}

template<>
constexpr const char* getRecord<Record::OPFR>()
{
    return "OPFR";
}

template<>
constexpr const char* getRecord<Record::OSYS>()
{
    return "OSYS";
}

namespace record
{

/** @brief OpenPOWER VPD keywords we're interested in */
enum class Keyword
{
    DR,  /**< FRU name/description */
    PN,  /**< FRU part number */
    SN,  /**< FRU serial number */
    CC,  /**< Customer Card Identification Number (CCIN) */
    HW,  /**< FRU version */
    B1,  /**< MAC Address */
    VN,  /**< FRU manufacturer name */
    MB,  /**< FRU manufacture date */
    MM,  /**< FRU model */
    UD,  /**< System UUID */
    VS,  /**< OpenPower serial number */
    VP   /**< OpenPower part number */
};

/** @brief Convert VPD Keyword name from enum to string
 *  @tparam K - VPD Keyword
 *  @returns string representation of Keyword name
 */
template<Keyword K>
constexpr const char* getKeyword() = delete;

template<>
constexpr const char* getKeyword<Keyword::DR>()
{
    return "DR";
}

template<>
constexpr const char* getKeyword<Keyword::PN>()
{
    return "PN";
}

template<>
constexpr const char* getKeyword<Keyword::SN>()
{
    return "SN";
}

template<>
constexpr const char* getKeyword<Keyword::CC>()
{
    return "CC";
}

template<>
constexpr const char* getKeyword<Keyword::HW>()
{
    return "HW";
}

template<>
constexpr const char* getKeyword<Keyword::B1>()
{
    return "B1";
}

template<>
constexpr const char* getKeyword<Keyword::VN>()
{
    return "VN";
}

template<>
constexpr const char* getKeyword<Keyword::MB>()
{
    return "MB";
}

template<>
constexpr const char* getKeyword<Keyword::MM>()
{
    return "MM";
}

template<>
constexpr const char* getKeyword<Keyword::UD>()
{
    return "UD";
}

template<>
constexpr const char* getKeyword<Keyword::VS>()
{
    return "VS";
}

template<>
constexpr const char* getKeyword<Keyword::VP>()
{
    return "VP";
}

} // namespace record

/** @brief FRUs whose VPD we're interested in
 *
 *  BMC       The VPD on the BMC planar, for eg
 *  ETHERNET  The ethernet card on the BMC
 */
enum Fru
{
    BMC,
    ETHERNET
};

} // namespace vpd
} // namespace openpower
OpenPOWER on IntegriCloud