The Pedigree Project  0.1
SMBios.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef KERNEL_MACHINE_X86_COMMON_SMBIOS_H
21 #define KERNEL_MACHINE_X86_COMMON_SMBIOS_H
22 
23 #if defined(SMBIOS)
24 
25 #include "pedigree/kernel/compiler.h"
26 #include "pedigree/kernel/processor/types.h"
27 
28 class SMBios
29 {
30  public:
32  SMBios() INITIALISATION_ONLY;
34  ~SMBios();
35 
37  void initialise() INITIALISATION_ONLY;
38 
39  private:
42  SMBios(const SMBios &);
45  SMBios &operator=(const SMBios &);
46 
47  struct EntryPoint
48  {
49  uint32_t signature;
50  uint8_t checksum;
51  uint8_t length;
52  uint8_t majorVersion;
53  uint8_t minorVersion;
54  uint16_t maxStructureSize;
55  uint8_t revision;
56  uint8_t reserved[5];
57  uint8_t signature2[5];
58  uint8_t checksum2;
59  uint16_t tableLength;
60  uint32_t tableAddress;
61  uint16_t structureCount;
62  uint8_t bcdRevision;
63  } PACKED;
64 
65  struct Header
66  {
67  uint8_t type;
68  uint8_t length;
69  uint16_t handle;
70  } PACKED;
71 
72  struct BiosInformation
73  {
74  uint8_t vendorIndex;
75  uint8_t biosVersionIndex;
76  uint16_t biosStartSegment;
77  uint8_t biosReleaseDateIndex;
78  uint8_t biosRomSize;
79  uint32_t biosCharacteristics;
80  } PACKED;
81 
82  Header *next(Header *pHeader) INITIALISATION_ONLY;
83  const char *
84  getString(const Header *pHeader, size_t index) INITIALISATION_ONLY;
85  void find() INITIALISATION_ONLY;
86  bool checksum(const EntryPoint *pEntryPoint) INITIALISATION_ONLY;
87 
88  EntryPoint *m_pEntryPoint;
89 };
90 
91 #endif
92 
93 #endif