gem5  v21.1.0.2
smbios.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 The Hewlett-Packard Development Company
3  * All rights reserved.
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2008 The Regents of The University of Michigan
15  * All rights reserved.
16  *
17  * Redistribution and use in source and binary forms, with or without
18  * modification, are permitted provided that the following conditions are
19  * met: redistributions of source code must retain the above copyright
20  * notice, this list of conditions and the following disclaimer;
21  * redistributions in binary form must reproduce the above copyright
22  * notice, this list of conditions and the following disclaimer in the
23  * documentation and/or other materials provided with the distribution;
24  * neither the name of the copyright holders nor the names of its
25  * contributors may be used to endorse or promote products derived from
26  * this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  */
40 
41 #ifndef __ARCH_X86_BIOS_SMBIOS_HH__
42 #define __ARCH_X86_BIOS_SMBIOS_HH__
43 
44 #include <string>
45 #include <vector>
46 
47 #include "base/compiler.hh"
48 #include "base/types.hh"
49 #include "enums/Characteristic.hh"
50 #include "enums/ExtCharacteristic.hh"
51 #include "sim/sim_object.hh"
52 
53 namespace gem5
54 {
55 
56 class PortProxy;
57 struct X86SMBiosBiosInformationParams;
58 struct X86SMBiosSMBiosStructureParams;
59 struct X86SMBiosSMBiosTableParams;
60 
61 namespace X86ISA
62 {
63 
64 GEM5_DEPRECATED_NAMESPACE(SMBios, smbios);
65 namespace smbios
66 {
67 
68 class SMBiosStructure : public SimObject
69 {
70  protected:
71  typedef X86SMBiosSMBiosStructureParams Params;
72 
73  public:
74 
75  virtual
77  {}
78 
79  // Offset 00h, 1 byte
80  uint8_t type;
81 
82  // Offset 01h, 1 byte
83  //Length: computed when written to memory.
84 
85  // Offset 02h, 2 bytes
86  uint16_t handle;
87 
88  virtual uint8_t
90  {
91  // This is the size of a structure with nothing but the header
92  return 4;
93  }
94 
95  virtual uint16_t writeOut(PortProxy& proxy, Addr addr);
96 
97  protected:
99 
100  SMBiosStructure(const Params &p, uint8_t _type);
101 
103 
104  void writeOutStrings(PortProxy& proxy, Addr addr);
105 
106  int getStringLength();
107 
108  public:
109 
110  int addString(const std::string &new_string);
111  std::string readString(int n);
112  void setString(int n, const std::string &new_string);
113 };
114 
116 {
117  protected:
118  const static uint8_t Type = 0;
119 
120  typedef X86SMBiosBiosInformationParams Params;
121 
122  public:
123  // Offset 04h, 1 byte
124  uint8_t vendor;
125  // Offset 05h, 1 byte
126  uint8_t version;
127  // Offset 06h, 2 bytes
129  // Offset 08h, 1 byte
130  uint8_t releaseDate;
131  // Offset 09h, 1 byte
132  uint8_t romSize;
133  // Offset 0Ah, 8 bytes
134  //See tables in 3.3.1 in the SMBios 2.5 spec from the DMTF for
135  //bit definitions.
136  uint64_t characteristics;
137  // Offset 12h, 2 bytes
139  // Offset 14h, 1 byte
140  uint8_t majorVer;
141  // Offset 15h, 1 byte
142  uint8_t minorVer;
143  // Offset 16h, 1 byte
145  // Offset 17h, 1 byte
147 
148  BiosInformation(const Params &p);
149 
150  uint8_t getLength() { return 0x18; }
151  uint16_t writeOut(PortProxy& proxy, Addr addr);
152 };
153 
154 class SMBiosTable : public SimObject
155 {
156  protected:
157  typedef X86SMBiosSMBiosTableParams Params;
158 
160  {
162  {}
163 
164  // Offset 00h, 4 bytes
165  static const char anchorString[];
166 
167  // Offset 04h, 1 byte
168  //Checksum: computed when written to memory.
169 
170  // Offset 05h, 1 byte
171  static const uint8_t entryPointLength;
172 
173  // Offset 06h, 1 byte
174  uint8_t majorVersion;
175 
176  // Offset 07h, 1 byte
177  uint8_t minorVersion;
178 
179  // Offset 08h, 2 bytes
180  //Maximum structure size: computed when written to memory.
181 
182  // Offset 0Ah, 1 byte
183  static const uint8_t entryPointRevision;
184 
185  // Offset 0Bh, 5 bytes
186  static const uint8_t formattedArea[5];
187 
188  // Offset 10h, 15 bytes
190  {
192  {}
193  // Offset 10h, 5 bytes
194  static const char anchorString[];
195 
196  // Offset 15h, 1 byte
197  //Checksum: computed when written to memory.
198 
199  // Offset 16h, 2 bytes
200  //Length of the structure table in bytes: computed when
201  //written to memory.
202 
203  // Offset 18h, 4 bytes
204  uint32_t tableAddr;
205 
206  // Offset 1Ch, 2 bytes
207  //Number of structures: computed when written to memory
208 
209  // Offset 1Eh, 1 byte
212  } smbiosHeader;
213 
215 
216  public:
217  SMBiosTable(const Params &p);
218 
220  {
222  }
223 
225  {
227  }
228 
229  void writeOut(PortProxy& proxy, Addr addr,
230  Addr &headerSize, Addr &structSize);
231 };
232 
233 } // namespace smbios
234 } // namespace X86ISA
235 } // namespace gem5
236 
237 #endif
gem5::X86ISA::smbios::SMBiosStructure::strings
std::vector< std::string > strings
Definition: smbios.hh:102
gem5::X86ISA::smbios::BiosInformation::romSize
uint8_t romSize
Definition: smbios.hh:132
gem5::X86ISA::smbios::SMBiosStructure::readString
std::string readString(int n)
Definition: smbios.cc:143
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::IntermediateHeader::smbiosBCDRevision
uint8_t smbiosBCDRevision
Definition: smbios.hh:210
gem5::X86ISA::smbios::BiosInformation::minorVer
uint8_t minorVer
Definition: smbios.hh:142
gem5::X86ISA::smbios::SMBiosStructure::writeOut
virtual uint16_t writeOut(PortProxy &proxy, Addr addr)
Definition: smbios.cc:76
gem5::X86ISA::smbios::BiosInformation
Definition: smbios.hh:115
gem5::X86ISA::smbios::BiosInformation::vendor
uint8_t vendor
Definition: smbios.hh:124
gem5::X86ISA::smbios::SMBiosStructure::stringFields
bool stringFields
Definition: smbios.hh:98
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::IntermediateHeader::anchorString
static const char anchorString[]
Definition: smbios.hh:194
gem5::X86ISA::smbios::BiosInformation::writeOut
uint16_t writeOut(PortProxy &proxy, Addr addr)
Definition: smbios.cc:175
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::SMBiosHeader
SMBiosHeader()
Definition: smbios.hh:161
gem5::X86ISA::smbios::BiosInformation::version
uint8_t version
Definition: smbios.hh:126
gem5::X86ISA::smbios::BiosInformation::Type
const static uint8_t Type
Definition: smbios.hh:118
gem5::X86ISA::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(IntelMP, intelmp)
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::minorVersion
uint8_t minorVersion
Definition: smbios.hh:177
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::entryPointRevision
static const uint8_t entryPointRevision
Definition: smbios.hh:183
std::vector< std::string >
gem5::X86ISA::smbios::SMBiosTable::Params
X86SMBiosSMBiosTableParams Params
Definition: smbios.hh:157
gem5::X86ISA::smbios::BiosInformation::characteristicExtBytes
uint16_t characteristicExtBytes
Definition: smbios.hh:138
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::intermediateHeader
struct gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::IntermediateHeader intermediateHeader
gem5::X86ISA::smbios::SMBiosTable::writeOut
void writeOut(PortProxy &proxy, Addr addr, Addr &headerSize, Addr &structSize)
Definition: smbios.cc:217
gem5::X86ISA::smbios::SMBiosStructure::type
uint8_t type
Definition: smbios.hh:80
gem5::X86ISA::smbios::BiosInformation::Params
X86SMBiosBiosInformationParams Params
Definition: smbios.hh:120
gem5::X86ISA::smbios::BiosInformation::majorVer
uint8_t majorVer
Definition: smbios.hh:140
gem5::X86ISA::smbios::SMBiosStructure::writeOutStrings
void writeOutStrings(PortProxy &proxy, Addr addr)
Definition: smbios.cc:95
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::IntermediateHeader::tableAddr
uint32_t tableAddr
Definition: smbios.hh:204
sim_object.hh
gem5::X86ISA::smbios::SMBiosTable::setTableAddr
void setTableAddr(Addr addr)
Definition: smbios.hh:224
gem5::X86ISA::smbios::SMBiosStructure::~SMBiosStructure
virtual ~SMBiosStructure()
Definition: smbios.hh:76
gem5::X86ISA::smbios::BiosInformation::startingAddrSegment
uint16_t startingAddrSegment
Definition: smbios.hh:128
gem5::X86ISA::smbios::BiosInformation::characteristics
uint64_t characteristics
Definition: smbios.hh:136
gem5::PortProxy
This object is a proxy for a port or other object which implements the functional response protocol,...
Definition: port_proxy.hh:86
gem5::X86ISA::smbios::SMBiosTable::structures
std::vector< SMBiosStructure * > structures
Definition: smbios.hh:214
gem5::X86ISA::smbios::BiosInformation::embContFirmwareMinor
uint8_t embContFirmwareMinor
Definition: smbios.hh:146
compiler.hh
gem5::SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:146
gem5::X86ISA::smbios::SMBiosStructure::Params
X86SMBiosSMBiosStructureParams Params
Definition: smbios.hh:71
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::X86ISA::smbios::SMBiosTable
Definition: smbios.hh:154
gem5::X86ISA::smbios::SMBiosTable::SMBiosTable
SMBiosTable(const Params &p)
Definition: smbios.cc:205
gem5::X86ISA::smbios::SMBiosStructure
Definition: smbios.hh:68
gem5::X86ISA::smbios::BiosInformation::embContFirmwareMajor
uint8_t embContFirmwareMajor
Definition: smbios.hh:144
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::formattedArea
static const uint8_t formattedArea[5]
Definition: smbios.hh:186
gem5::ArmISA::n
Bitfield< 31 > n
Definition: misc_types.hh:455
types.hh
gem5::X86ISA::smbios::BiosInformation::releaseDate
uint8_t releaseDate
Definition: smbios.hh:130
gem5::X86ISA::smbios::SMBiosTable::getTableAddr
Addr getTableAddr()
Definition: smbios.hh:219
gem5::X86ISA::smbios::BiosInformation::BiosInformation
BiosInformation(const Params &p)
Definition: smbios.cc:157
gem5::X86ISA::smbios::SMBiosStructure::setString
void setString(int n, const std::string &new_string)
Definition: smbios.cc:150
gem5::X86ISA::smbios::SMBiosStructure::getLength
virtual uint8_t getLength()
Definition: smbios.hh:89
gem5::X86ISA::smbios::SMBiosStructure::SMBiosStructure
SMBiosStructure(const Params &p, uint8_t _type)
Definition: smbios.cc:89
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::IntermediateHeader
Definition: smbios.hh:189
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::entryPointLength
static const uint8_t entryPointLength
Definition: smbios.hh:171
gem5::X86ISA::p
Bitfield< 0 > p
Definition: pagetable.hh:151
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::anchorString
static const char anchorString[]
Definition: smbios.hh:165
gem5::X86ISA::smbios::SMBiosStructure::handle
uint16_t handle
Definition: smbios.hh:86
gem5::X86ISA::smbios::SMBiosStructure::getStringLength
int getStringLength()
Definition: smbios.cc:118
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::X86ISA::smbios::BiosInformation::getLength
uint8_t getLength()
Definition: smbios.hh:150
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader
Definition: smbios.hh:159
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::majorVersion
uint8_t majorVersion
Definition: smbios.hh:174
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::IntermediateHeader::IntermediateHeader
IntermediateHeader()
Definition: smbios.hh:191
gem5::X86ISA::smbios::SMBiosTable::smbiosHeader
struct gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader smbiosHeader
gem5::X86ISA::smbios::SMBiosStructure::addString
int addString(const std::string &new_string)
Definition: smbios.cc:131
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84

Generated on Tue Sep 21 2021 12:24:51 for gem5 by doxygen 1.8.17