gem5  v22.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/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
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
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
This object is a proxy for a port or other object which implements the functional response protocol,...
Definition: port_proxy.hh:87
Abstract superclass for simulation objects.
Definition: sim_object.hh:148
X86SMBiosBiosInformationParams Params
Definition: smbios.hh:120
uint16_t writeOut(PortProxy &proxy, Addr addr)
Definition: smbios.cc:175
SMBiosStructure(const Params &p, uint8_t _type)
Definition: smbios.cc:89
int addString(const std::string &new_string)
Definition: smbios.cc:131
std::vector< std::string > strings
Definition: smbios.hh:102
X86SMBiosSMBiosStructureParams Params
Definition: smbios.hh:71
void setString(int n, const std::string &new_string)
Definition: smbios.cc:150
void writeOutStrings(PortProxy &proxy, Addr addr)
Definition: smbios.cc:95
virtual uint16_t writeOut(PortProxy &proxy, Addr addr)
Definition: smbios.cc:76
void writeOut(PortProxy &proxy, Addr addr, Addr &headerSize, Addr &structSize)
Definition: smbios.cc:217
struct gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader smbiosHeader
void setTableAddr(Addr addr)
Definition: smbios.hh:224
std::vector< SMBiosStructure * > structures
Definition: smbios.hh:214
SMBiosTable(const Params &p)
Definition: smbios.cc:205
X86SMBiosSMBiosTableParams Params
Definition: smbios.hh:157
Bitfield< 31 > n
Definition: misc_types.hh:462
GEM5_DEPRECATED_NAMESPACE(IntelMP, intelmp)
Bitfield< 3 > addr
Definition: types.hh:84
Bitfield< 0 > p
Definition: pagetable.hh:151
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
struct gem5::X86ISA::smbios::SMBiosTable::SMBiosHeader::IntermediateHeader intermediateHeader

Generated on Wed Dec 21 2022 10:22:28 for gem5 by doxygen 1.9.1