gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 namespace smbios
65 {
66 
67 class SMBiosStructure : public SimObject
68 {
69  protected:
70  typedef X86SMBiosSMBiosStructureParams Params;
71 
72  public:
73 
74  virtual
76  {}
77 
78  // Offset 00h, 1 byte
79  uint8_t type;
80 
81  // Offset 01h, 1 byte
82  //Length: computed when written to memory.
83 
84  // Offset 02h, 2 bytes
85  uint16_t handle;
86 
87  virtual uint8_t
89  {
90  // This is the size of a structure with nothing but the header
91  return 4;
92  }
93 
94  virtual uint16_t writeOut(PortProxy& proxy, Addr addr);
95 
96  protected:
98 
99  SMBiosStructure(const Params &p, uint8_t _type);
100 
102 
103  void writeOutStrings(PortProxy& proxy, Addr addr);
104 
105  int getStringLength();
106 
107  public:
108 
109  int addString(const std::string &new_string);
110  std::string readString(int n);
111  void setString(int n, const std::string &new_string);
112 };
113 
115 {
116  protected:
117  const static uint8_t Type = 0;
118 
119  typedef X86SMBiosBiosInformationParams Params;
120 
121  public:
122  // Offset 04h, 1 byte
123  uint8_t vendor;
124  // Offset 05h, 1 byte
125  uint8_t version;
126  // Offset 06h, 2 bytes
128  // Offset 08h, 1 byte
129  uint8_t releaseDate;
130  // Offset 09h, 1 byte
131  uint8_t romSize;
132  // Offset 0Ah, 8 bytes
133  //See tables in 3.3.1 in the SMBios 2.5 spec from the DMTF for
134  //bit definitions.
135  uint64_t characteristics;
136  // Offset 12h, 2 bytes
138  // Offset 14h, 1 byte
139  uint8_t majorVer;
140  // Offset 15h, 1 byte
141  uint8_t minorVer;
142  // Offset 16h, 1 byte
144  // Offset 17h, 1 byte
146 
147  BiosInformation(const Params &p);
148 
149  uint8_t getLength() { return 0x18; }
150  uint16_t writeOut(PortProxy& proxy, Addr addr);
151 };
152 
153 class SMBiosTable : public SimObject
154 {
155  protected:
156  typedef X86SMBiosSMBiosTableParams Params;
157 
159  {
161  {}
162 
163  // Offset 00h, 4 bytes
164  static const char anchorString[];
165 
166  // Offset 04h, 1 byte
167  //Checksum: computed when written to memory.
168 
169  // Offset 05h, 1 byte
170  static const uint8_t entryPointLength;
171 
172  // Offset 06h, 1 byte
173  uint8_t majorVersion;
174 
175  // Offset 07h, 1 byte
176  uint8_t minorVersion;
177 
178  // Offset 08h, 2 bytes
179  //Maximum structure size: computed when written to memory.
180 
181  // Offset 0Ah, 1 byte
182  static const uint8_t entryPointRevision;
183 
184  // Offset 0Bh, 5 bytes
185  static const uint8_t formattedArea[5];
186 
187  // Offset 10h, 15 bytes
189  {
191  {}
192  // Offset 10h, 5 bytes
193  static const char anchorString[];
194 
195  // Offset 15h, 1 byte
196  //Checksum: computed when written to memory.
197 
198  // Offset 16h, 2 bytes
199  //Length of the structure table in bytes: computed when
200  //written to memory.
201 
202  // Offset 18h, 4 bytes
203  uint32_t tableAddr;
204 
205  // Offset 1Ch, 2 bytes
206  //Number of structures: computed when written to memory
207 
208  // Offset 1Eh, 1 byte
211  } smbiosHeader;
212 
214 
215  public:
216  SMBiosTable(const Params &p);
217 
219  {
221  }
222 
224  {
226  }
227 
228  void writeOut(PortProxy& proxy, Addr addr,
229  Addr &headerSize, Addr &structSize);
230 };
231 
232 } // namespace smbios
233 } // namespace X86ISA
234 } // namespace gem5
235 
236 #endif
gem5::X86ISA::smbios::SMBiosStructure::strings
std::vector< std::string > strings
Definition: smbios.hh:101
gem5::X86ISA::smbios::BiosInformation::romSize
uint8_t romSize
Definition: smbios.hh:131
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:209
gem5::X86ISA::smbios::BiosInformation::minorVer
uint8_t minorVer
Definition: smbios.hh:141
gem5::X86ISA::smbios::SMBiosStructure::writeOut
virtual uint16_t writeOut(PortProxy &proxy, Addr addr)
Definition: smbios.cc:76
gem5::X86ISA::smbios::BiosInformation
Definition: smbios.hh:114
gem5::X86ISA::smbios::BiosInformation::vendor
uint8_t vendor
Definition: smbios.hh:123
gem5::X86ISA::smbios::SMBiosStructure::stringFields
bool stringFields
Definition: smbios.hh:97
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::IntermediateHeader::anchorString
static const char anchorString[]
Definition: smbios.hh:193
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:160
gem5::X86ISA::smbios::BiosInformation::version
uint8_t version
Definition: smbios.hh:125
gem5::X86ISA::smbios::BiosInformation::Type
const static uint8_t Type
Definition: smbios.hh:117
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::minorVersion
uint8_t minorVersion
Definition: smbios.hh:176
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::entryPointRevision
static const uint8_t entryPointRevision
Definition: smbios.hh:182
std::vector< std::string >
gem5::X86ISA::smbios::SMBiosTable::Params
X86SMBiosSMBiosTableParams Params
Definition: smbios.hh:156
gem5::X86ISA::smbios::BiosInformation::characteristicExtBytes
uint16_t characteristicExtBytes
Definition: smbios.hh:137
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:79
gem5::X86ISA::smbios::BiosInformation::Params
X86SMBiosBiosInformationParams Params
Definition: smbios.hh:119
gem5::X86ISA::smbios::BiosInformation::majorVer
uint8_t majorVer
Definition: smbios.hh:139
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:203
sim_object.hh
gem5::X86ISA::smbios::SMBiosTable::setTableAddr
void setTableAddr(Addr addr)
Definition: smbios.hh:223
gem5::X86ISA::smbios::SMBiosStructure::~SMBiosStructure
virtual ~SMBiosStructure()
Definition: smbios.hh:75
gem5::X86ISA::smbios::BiosInformation::startingAddrSegment
uint16_t startingAddrSegment
Definition: smbios.hh:127
gem5::X86ISA::smbios::BiosInformation::characteristics
uint64_t characteristics
Definition: smbios.hh:135
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:213
gem5::X86ISA::smbios::BiosInformation::embContFirmwareMinor
uint8_t embContFirmwareMinor
Definition: smbios.hh:145
compiler.hh
gem5::SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:146
gem5::X86ISA::smbios::SMBiosStructure::Params
X86SMBiosSMBiosStructureParams Params
Definition: smbios.hh:70
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:153
gem5::X86ISA::smbios::SMBiosTable::SMBiosTable
SMBiosTable(const Params &p)
Definition: smbios.cc:205
gem5::X86ISA::smbios::SMBiosStructure
Definition: smbios.hh:67
gem5::X86ISA::smbios::BiosInformation::embContFirmwareMajor
uint8_t embContFirmwareMajor
Definition: smbios.hh:143
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::formattedArea
static const uint8_t formattedArea[5]
Definition: smbios.hh:185
gem5::ArmISA::n
Bitfield< 31 > n
Definition: misc_types.hh:513
types.hh
gem5::X86ISA::smbios::BiosInformation::releaseDate
uint8_t releaseDate
Definition: smbios.hh:129
gem5::X86ISA::smbios::SMBiosTable::getTableAddr
Addr getTableAddr()
Definition: smbios.hh:218
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:88
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:188
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::entryPointLength
static const uint8_t entryPointLength
Definition: smbios.hh:170
gem5::X86ISA::p
Bitfield< 0 > p
Definition: pagetable.hh:151
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::anchorString
static const char anchorString[]
Definition: smbios.hh:164
gem5::X86ISA::smbios::SMBiosStructure::handle
uint16_t handle
Definition: smbios.hh:85
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: gpu_translation_state.hh:37
gem5::X86ISA::smbios::BiosInformation::getLength
uint8_t getLength()
Definition: smbios.hh:149
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader
Definition: smbios.hh:158
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::majorVersion
uint8_t majorVersion
Definition: smbios.hh:173
gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::IntermediateHeader::IntermediateHeader
IntermediateHeader()
Definition: smbios.hh:190
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 Sun Jul 30 2023 01:56:50 for gem5 by doxygen 1.8.17