1/* 2 * Copyright (c) 2008 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 77 unchanged lines hidden (view full) --- 86 */ 87 88#ifndef __ARCH_X86_BIOS_SMBIOS_HH__ 89#define __ARCH_X86_BIOS_SMBIOS_HH__ 90 91#include <string> 92#include <vector> 93 |
94#include "enums/Characteristic.hh" 95#include "enums/ExtCharacteristic.hh" |
96#include "sim/host.hh" |
97#include "sim/sim_object.hh" |
98 |
99class FunctionalPort; 100class X86SMBiosBiosInformationParams; 101class X86SMBiosSMBiosStructureParams; 102class X86SMBiosSMBiosTableParams; 103 |
104namespace X86ISA 105{ 106 107namespace SMBios 108{ 109 |
110class SMBiosStructure : public SimObject |
111{ |
112 protected: 113 typedef X86SMBiosSMBiosStructureParams Params; 114 |
115 public: 116 117 virtual 118 ~SMBiosStructure() 119 {} 120 121 // Offset 00h, 1 byte 122 uint8_t type; --- 6 unchanged lines hidden (view full) --- 129 130 virtual uint8_t 131 getLength() 132 { 133 // This is the size of a structure with nothing but the header 134 return 4; 135 } 136 |
137 virtual uint16_t writeOut(FunctionalPort * port, Addr addr); |
138 |
139 protected: 140 bool stringFields; |
141 |
142 SMBiosStructure(Params * p, uint8_t _type); |
143 |
144 std::vector<std::string> strings; 145 |
146 void writeOutStrings(FunctionalPort * port, Addr addr); |
147 |
148 int getStringLength(); |
149 |
150 public: 151 |
152 int addString(std::string & newString); 153 std::string readString(int n); 154 void setString(int n, std::string & newString); |
155}; 156 157class BiosInformation : public SMBiosStructure 158{ |
159 protected: 160 const static uint8_t Type = 0; 161 162 typedef X86SMBiosBiosInformationParams Params; 163 |
164 public: 165 // Offset 04h, 1 byte 166 uint8_t vendor; 167 // Offset 05h, 1 byte 168 uint8_t version; 169 // Offset 06h, 2 bytes 170 uint16_t startingAddrSegment; 171 // Offset 08h, 1 byte 172 uint8_t releaseDate; 173 // Offset 09h, 1 byte 174 uint8_t romSize; 175 // Offset 0Ah, 8 bytes 176 //See tables in 3.3.1 in the SMBios 2.5 spec from the DMTF for 177 //bit definitions. 178 uint64_t characteristics; 179 // Offset 12h, 2 bytes 180 uint16_t characteristicExtBytes; 181 // Offset 14h, 1 byte |
182 uint8_t majorVer; |
183 // Offset 15h, 1 byte |
184 uint8_t minorVer; |
185 // Offset 16h, 1 byte 186 uint8_t embContFirmwareMajor; 187 // Offset 17h, 1 byte 188 uint8_t embContFirmwareMinor; 189 |
190 BiosInformation(Params * p); 191 |
192 uint8_t getLength() { return 0x18; } 193 uint16_t writeOut(FunctionalPort * port, Addr addr); 194}; 195 |
196class SMBiosTable : public SimObject |
197{ |
198 protected: 199 typedef X86SMBiosSMBiosTableParams Params; 200 |
201 struct SMBiosHeader 202 { 203 SMBiosHeader() 204 {} 205 206 // Offset 00h, 4 bytes 207 static const char anchorString[]; 208 --- 39 unchanged lines hidden (view full) --- 248 // Offset 1Ch, 2 bytes 249 //Number of structures: computed when written to memory 250 251 // Offset 1Eh, 1 byte 252 uint8_t smbiosBCDRevision; 253 } intermediateHeader; 254 } smbiosHeader; 255 |
256 std::vector<SMBiosStructure *> structures; |
257 |
258 public: 259 SMBiosTable(Params * p); 260 261 Addr getTableAddr() 262 { 263 return smbiosHeader.intermediateHeader.tableAddr; 264 } 265 266 void setTableAddr(Addr addr) 267 { 268 smbiosHeader.intermediateHeader.tableAddr = addr; 269 } 270 271 void writeOut(FunctionalPort * port, Addr addr, 272 Addr &headerSize, Addr &structSize); |
273}; 274 275} //SMBios 276} //X86ISA 277 278#endif |