gem5  v20.1.0.0
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/types.hh"
48 #include "enums/Characteristic.hh"
49 #include "enums/ExtCharacteristic.hh"
50 #include "sim/sim_object.hh"
51 
52 class PortProxy;
53 struct X86SMBiosBiosInformationParams;
54 struct X86SMBiosSMBiosStructureParams;
55 struct X86SMBiosSMBiosTableParams;
56 
57 namespace X86ISA
58 {
59 
60 namespace SMBios
61 {
62 
63 class SMBiosStructure : public SimObject
64 {
65  protected:
66  typedef X86SMBiosSMBiosStructureParams Params;
67 
68  public:
69 
70  virtual
72  {}
73 
74  // Offset 00h, 1 byte
75  uint8_t type;
76 
77  // Offset 01h, 1 byte
78  //Length: computed when written to memory.
79 
80  // Offset 02h, 2 bytes
81  uint16_t handle;
82 
83  virtual uint8_t
85  {
86  // This is the size of a structure with nothing but the header
87  return 4;
88  }
89 
90  virtual uint16_t writeOut(PortProxy& proxy, Addr addr);
91 
92  protected:
94 
95  SMBiosStructure(Params * p, uint8_t _type);
96 
98 
99  void writeOutStrings(PortProxy& proxy, Addr addr);
100 
101  int getStringLength();
102 
103  public:
104 
105  int addString(std::string & newString);
106  std::string readString(int n);
107  void setString(int n, std::string & newString);
108 };
109 
111 {
112  protected:
113  const static uint8_t Type = 0;
114 
115  typedef X86SMBiosBiosInformationParams Params;
116 
117  public:
118  // Offset 04h, 1 byte
119  uint8_t vendor;
120  // Offset 05h, 1 byte
121  uint8_t version;
122  // Offset 06h, 2 bytes
124  // Offset 08h, 1 byte
125  uint8_t releaseDate;
126  // Offset 09h, 1 byte
127  uint8_t romSize;
128  // Offset 0Ah, 8 bytes
129  //See tables in 3.3.1 in the SMBios 2.5 spec from the DMTF for
130  //bit definitions.
131  uint64_t characteristics;
132  // Offset 12h, 2 bytes
134  // Offset 14h, 1 byte
135  uint8_t majorVer;
136  // Offset 15h, 1 byte
137  uint8_t minorVer;
138  // Offset 16h, 1 byte
140  // Offset 17h, 1 byte
142 
144 
145  uint8_t getLength() { return 0x18; }
146  uint16_t writeOut(PortProxy& proxy, Addr addr);
147 };
148 
149 class SMBiosTable : public SimObject
150 {
151  protected:
152  typedef X86SMBiosSMBiosTableParams Params;
153 
155  {
157  {}
158 
159  // Offset 00h, 4 bytes
160  static const char anchorString[];
161 
162  // Offset 04h, 1 byte
163  //Checksum: computed when written to memory.
164 
165  // Offset 05h, 1 byte
166  static const uint8_t entryPointLength;
167 
168  // Offset 06h, 1 byte
169  uint8_t majorVersion;
170 
171  // Offset 07h, 1 byte
172  uint8_t minorVersion;
173 
174  // Offset 08h, 2 bytes
175  //Maximum structure size: computed when written to memory.
176 
177  // Offset 0Ah, 1 byte
178  static const uint8_t entryPointRevision;
179 
180  // Offset 0Bh, 5 bytes
181  static const uint8_t formattedArea[5];
182 
183  // Offset 10h, 15 bytes
185  {
187  {}
188  // Offset 10h, 5 bytes
189  static const char anchorString[];
190 
191  // Offset 15h, 1 byte
192  //Checksum: computed when written to memory.
193 
194  // Offset 16h, 2 bytes
195  //Length of the structure table in bytes: computed when
196  //written to memory.
197 
198  // Offset 18h, 4 bytes
199  uint32_t tableAddr;
200 
201  // Offset 1Ch, 2 bytes
202  //Number of structures: computed when written to memory
203 
204  // Offset 1Eh, 1 byte
207  } smbiosHeader;
208 
210 
211  public:
212  SMBiosTable(Params * p);
213 
215  {
217  }
218 
220  {
222  }
223 
224  void writeOut(PortProxy& proxy, Addr addr,
225  Addr &headerSize, Addr &structSize);
226 };
227 
228 } //SMBios
229 } //X86ISA
230 
231 #endif
X86ISA::SMBios::SMBiosTable::SMBiosHeader::IntermediateHeader::anchorString
static const char anchorString[]
Definition: smbios.hh:189
X86ISA::SMBios::SMBiosStructure::type
uint8_t type
Definition: smbios.hh:75
X86ISA::SMBios::SMBiosStructure::SMBiosStructure
SMBiosStructure(Params *p, uint8_t _type)
Definition: smbios.cc:89
X86ISA::SMBios::BiosInformation::startingAddrSegment
uint16_t startingAddrSegment
Definition: smbios.hh:123
X86ISA::SMBios::BiosInformation::vendor
uint8_t vendor
Definition: smbios.hh:119
X86ISA::SMBios::SMBiosStructure::writeOutStrings
void writeOutStrings(PortProxy &proxy, Addr addr)
Definition: smbios.cc:94
X86ISA::SMBios::BiosInformation::writeOut
uint16_t writeOut(PortProxy &proxy, Addr addr)
Definition: smbios.cc:173
X86ISA::SMBios::SMBiosTable::SMBiosHeader::intermediateHeader
struct X86ISA::SMBios::SMBiosTable::SMBiosHeader::IntermediateHeader intermediateHeader
X86ISA::SMBios::BiosInformation::minorVer
uint8_t minorVer
Definition: smbios.hh:137
X86ISA::SMBios::BiosInformation::romSize
uint8_t romSize
Definition: smbios.hh:127
X86ISA::SMBios::SMBiosStructure::stringFields
bool stringFields
Definition: smbios.hh:93
X86ISA::SMBios::SMBiosStructure::writeOut
virtual uint16_t writeOut(PortProxy &proxy, Addr addr)
Definition: smbios.cc:76
X86ISA::SMBios::SMBiosTable::Params
X86SMBiosSMBiosTableParams Params
Definition: smbios.hh:152
X86ISA::SMBios::SMBiosTable
Definition: smbios.hh:149
X86ISA::SMBios::BiosInformation::embContFirmwareMajor
uint8_t embContFirmwareMajor
Definition: smbios.hh:139
X86ISA::SMBios::BiosInformation::embContFirmwareMinor
uint8_t embContFirmwareMinor
Definition: smbios.hh:141
std::vector< std::string >
X86ISA::SMBios::SMBiosStructure::readString
std::string readString(int n)
Definition: smbios.cc:142
X86ISA::SMBios::SMBiosTable::SMBiosHeader::anchorString
static const char anchorString[]
Definition: smbios.hh:160
X86ISA::SMBios::SMBiosStructure::addString
int addString(std::string &newString)
Definition: smbios.cc:130
X86ISA::SMBios::SMBiosTable::SMBiosHeader::IntermediateHeader::IntermediateHeader
IntermediateHeader()
Definition: smbios.hh:186
X86ISA::SMBios::SMBiosStructure::Params
X86SMBiosSMBiosStructureParams Params
Definition: smbios.hh:66
X86ISA::SMBios::SMBiosStructure::handle
uint16_t handle
Definition: smbios.hh:81
ArmISA::n
Bitfield< 31 > n
Definition: miscregs_types.hh:450
X86ISA::SMBios::SMBiosTable::structures
std::vector< SMBiosStructure * > structures
Definition: smbios.hh:209
X86ISA::SMBios::SMBiosTable::getTableAddr
Addr getTableAddr()
Definition: smbios.hh:214
X86ISA::SMBios::SMBiosTable::writeOut
void writeOut(PortProxy &proxy, Addr addr, Addr &headerSize, Addr &structSize)
Definition: smbios.cc:215
X86ISA::SMBios::SMBiosTable::SMBiosHeader::IntermediateHeader::smbiosBCDRevision
uint8_t smbiosBCDRevision
Definition: smbios.hh:205
X86ISA::SMBios::SMBiosTable::SMBiosHeader::formattedArea
static const uint8_t formattedArea[5]
Definition: smbios.hh:181
X86ISA::SMBios::SMBiosTable::smbiosHeader
struct X86ISA::SMBios::SMBiosTable::SMBiosHeader smbiosHeader
sim_object.hh
X86ISA::SMBios::BiosInformation::Params
X86SMBiosBiosInformationParams Params
Definition: smbios.hh:115
X86ISA::SMBios::BiosInformation::characteristicExtBytes
uint16_t characteristicExtBytes
Definition: smbios.hh:133
X86ISA::SMBios::BiosInformation::Type
const static uint8_t Type
Definition: smbios.hh:113
X86ISA::SMBios::SMBiosTable::SMBiosHeader::minorVersion
uint8_t minorVersion
Definition: smbios.hh:172
X86ISA::SMBios::SMBiosStructure::getStringLength
int getStringLength()
Definition: smbios.cc:117
X86ISA::SMBios::BiosInformation::majorVer
uint8_t majorVer
Definition: smbios.hh:135
X86ISA::SMBios::SMBiosTable::SMBiosHeader::IntermediateHeader
Definition: smbios.hh:184
X86ISA::SMBios::BiosInformation
Definition: smbios.hh:110
X86ISA
This is exposed globally, independent of the ISA.
Definition: acpi.hh:55
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
X86ISA::SMBios::BiosInformation::releaseDate
uint8_t releaseDate
Definition: smbios.hh:125
X86ISA::SMBios::BiosInformation::BiosInformation
BiosInformation(Params *p)
Definition: smbios.cc:155
X86ISA::SMBios::SMBiosTable::SMBiosHeader::entryPointRevision
static const uint8_t entryPointRevision
Definition: smbios.hh:178
X86ISA::SMBios::SMBiosStructure::getLength
virtual uint8_t getLength()
Definition: smbios.hh:84
X86ISA::SMBios::SMBiosStructure::setString
void setString(int n, std::string &newString)
Definition: smbios.cc:149
X86ISA::SMBios::SMBiosStructure::~SMBiosStructure
virtual ~SMBiosStructure()
Definition: smbios.hh:71
X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:79
X86ISA::SMBios::SMBiosStructure
Definition: smbios.hh:63
PortProxy
This object is a proxy for a port or other object which implements the functional response protocol,...
Definition: port_proxy.hh:80
X86ISA::p
Bitfield< 0 > p
Definition: pagetable.hh:151
types.hh
X86ISA::SMBios::SMBiosTable::SMBiosHeader::SMBiosHeader
SMBiosHeader()
Definition: smbios.hh:156
X86ISA::SMBios::BiosInformation::getLength
uint8_t getLength()
Definition: smbios.hh:145
X86ISA::SMBios::SMBiosTable::SMBiosHeader::majorVersion
uint8_t majorVersion
Definition: smbios.hh:169
X86ISA::SMBios::SMBiosTable::SMBiosHeader::IntermediateHeader::tableAddr
uint32_t tableAddr
Definition: smbios.hh:199
X86ISA::SMBios::BiosInformation::version
uint8_t version
Definition: smbios.hh:121
X86ISA::SMBios::BiosInformation::characteristics
uint64_t characteristics
Definition: smbios.hh:131
X86ISA::SMBios::SMBiosTable::SMBiosHeader::entryPointLength
static const uint8_t entryPointLength
Definition: smbios.hh:166
X86ISA::SMBios::SMBiosStructure::strings
std::vector< std::string > strings
Definition: smbios.hh:97
X86ISA::SMBios::SMBiosTable::SMBiosTable
SMBiosTable(Params *p)
Definition: smbios.cc:203
X86ISA::SMBios::SMBiosTable::SMBiosHeader
Definition: smbios.hh:154
X86ISA::SMBios::SMBiosTable::setTableAddr
void setTableAddr(Addr addr)
Definition: smbios.hh:219
SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:92

Generated on Wed Sep 30 2020 14:02:07 for gem5 by doxygen 1.8.17