2 * Copyright (c) 2008 The Hewlett-Packard Development Company
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.
14 * Copyright (c) 2008 The Regents of The University of Michigan
15 * All rights reserved.
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.
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.
43 #ifndef __ARCH_X86_BIOS_SMBIOS_HH__
44 #define __ARCH_X86_BIOS_SMBIOS_HH__
49 #include "base/types.hh"
50 #include "enums/Characteristic.hh"
51 #include "enums/ExtCharacteristic.hh"
52 #include "sim/sim_object.hh"
55 struct X86SMBiosBiosInformationParams;
56 struct X86SMBiosSMBiosStructureParams;
57 struct X86SMBiosSMBiosTableParams;
65 class SMBiosStructure : public SimObject
68 typedef X86SMBiosSMBiosStructureParams Params;
80 //Length: computed when written to memory.
82 // Offset 02h, 2 bytes
88 // This is the size of a structure with nothing but the header
92 virtual uint16_t writeOut(PortProxy& proxy, Addr addr);
97 SMBiosStructure(Params * p, uint8_t _type);
99 std::vector<std::string> strings;
101 void writeOutStrings(PortProxy& proxy, Addr addr);
103 int getStringLength();
107 int addString(std::string & newString);
108 std::string readString(int n);
109 void setString(int n, std::string & newString);
112 class BiosInformation : public SMBiosStructure
115 const static uint8_t Type = 0;
117 typedef X86SMBiosBiosInformationParams Params;
120 // Offset 04h, 1 byte
122 // Offset 05h, 1 byte
124 // Offset 06h, 2 bytes
125 uint16_t startingAddrSegment;
126 // Offset 08h, 1 byte
128 // Offset 09h, 1 byte
130 // Offset 0Ah, 8 bytes
131 //See tables in 3.3.1 in the SMBios 2.5 spec from the DMTF for
133 uint64_t characteristics;
134 // Offset 12h, 2 bytes
135 uint16_t characteristicExtBytes;
136 // Offset 14h, 1 byte
138 // Offset 15h, 1 byte
140 // Offset 16h, 1 byte
141 uint8_t embContFirmwareMajor;
142 // Offset 17h, 1 byte
143 uint8_t embContFirmwareMinor;
145 BiosInformation(Params * p);
147 uint8_t getLength() { return 0x18; }
148 uint16_t writeOut(PortProxy& proxy, Addr addr);
151 class SMBiosTable : public SimObject
154 typedef X86SMBiosSMBiosTableParams Params;
161 // Offset 00h, 4 bytes
162 static const char anchorString[];
164 // Offset 04h, 1 byte
165 //Checksum: computed when written to memory.
167 // Offset 05h, 1 byte
168 static const uint8_t entryPointLength;
170 // Offset 06h, 1 byte
171 uint8_t majorVersion;
173 // Offset 07h, 1 byte
174 uint8_t minorVersion;
176 // Offset 08h, 2 bytes
177 //Maximum structure size: computed when written to memory.
179 // Offset 0Ah, 1 byte
180 static const uint8_t entryPointRevision;
182 // Offset 0Bh, 5 bytes
183 static const uint8_t formattedArea[5];
185 // Offset 10h, 15 bytes
186 struct IntermediateHeader
188 IntermediateHeader() : tableAddr(0)
190 // Offset 10h, 5 bytes
191 static const char anchorString[];
193 // Offset 15h, 1 byte
194 //Checksum: computed when written to memory.
196 // Offset 16h, 2 bytes
197 //Length of the structure table in bytes: computed when
200 // Offset 18h, 4 bytes
203 // Offset 1Ch, 2 bytes
204 //Number of structures: computed when written to memory
206 // Offset 1Eh, 1 byte
207 uint8_t smbiosBCDRevision;
208 } intermediateHeader;
211 std::vector<SMBiosStructure *> structures;
214 SMBiosTable(Params * p);
218 return smbiosHeader.intermediateHeader.tableAddr;
221 void setTableAddr(Addr addr)
223 smbiosHeader.intermediateHeader.tableAddr = addr;
226 void writeOut(PortProxy& proxy, Addr addr,
227 Addr &headerSize, Addr &structSize);