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

Generated on Fri Jun 9 2017 13:03:40 for gem5 by doxygen 1.8.6