FreeNOS
IntelACPI.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Niek Linnenbank
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __LIBARCH_INTEL_ACPI_H
19 #define __LIBARCH_INTEL_ACPI_H
20 
21 #include <Types.h>
22 #include <CoreManager.h>
23 #include "IntelIO.h"
24 
39 class IntelACPI : public CoreManager
40 {
41  private:
42 
44  static const uint RSDBase = 0x1000;
45 
47  static const uint RSDSize = MegaByte(1) - 0x1000;
48 
50  static const uint RootSystemSignature1 = 0x20445352;
51 
53  static const uint RootSystemSignature2 = 0x20525450;
54 
56  static const u32 RootSystemTableSignature = 0x54445352;
57 
59  static const u32 ExtendedSystemTableSignature = 0x54445358;
60 
62  static const u32 MultipleAPICTableSignature = 0x43495041;
63 
67  typedef struct RootSystemDescriptor1
68  {
71  char vendorId[6];
74  } __attribute__((packed))
76 
80  typedef struct RootSystemDescriptor2
81  {
87  } __attribute__((packed))
89 
93  typedef struct SystemDescriptorHeader
94  {
99  char vendorId[6];
100  char vendorTableId[8];
104  } __attribute__((packed))
106 
110  typedef struct RootSystemTable
111  {
114  } __attribute__((packed))
116 
120  typedef struct ExtendedSystemTable
121  {
124  } __attribute__((packed))
126 
130  typedef struct MultipleAPICTableEntry
131  {
134  } __attribute__((packed))
136 
140  typedef struct MultipleAPICTableProc
141  {
146  } __attribute__((packed))
148 
152  typedef struct MultipleAPICTable
153  {
158  } __attribute__((packed))
160 
165  {
166  };
167 
168  public:
169 
173  IntelACPI();
174 
180  virtual Result initialize();
181 
187  virtual Result discover();
188 
196  virtual Result boot(CoreInfo *info);
197 
198  private:
199 
205  Result scanAPIC(MultipleAPICTable *madt);
206 
207  private:
208 
211 
214 };
215 
222 #endif /* __LIBARCH_INTEL_ACPI_H */
IntelACPI::RootSystemTable::entry
u32 entry[]
Definition: IntelACPI.h:113
IntelACPI::SystemDescriptorHeader::signature
u32 signature
Definition: IntelACPI.h:95
IntelACPI::SystemDescriptorHeader::vendorTableId
char vendorTableId[8]
Definition: IntelACPI.h:100
IntelACPI::SystemDescriptorHeader::vendorRevision
u32 vendorRevision
Definition: IntelACPI.h:101
IntelACPI::MultipleAPICTable
Multiple APIC Description Table (MADT).
Definition: IntelACPI.h:152
IntelIO.h
IntelACPI::ExtendedSystemTable::entry
u64 entry[]
Definition: IntelACPI.h:123
IntelACPI::RootSystemDescriptor1
Root System Description Pointer (ACPI v1.0).
Definition: IntelACPI.h:67
IntelACPI::RootSystemTableSignature
static const u32 RootSystemTableSignature
Signature for the Root System Descriptor Table (RSDT).
Definition: IntelACPI.h:56
Types.h
IntelACPI::m_rootIO
IntelIO m_rootIO
Root/Extended SDT table I/O object.
Definition: IntelACPI.h:213
CoreManager.h
IntelACPI::SystemDescriptorHeader::creatorRevision
u32 creatorRevision
Definition: IntelACPI.h:103
IntelACPI::RootSystemSignature2
static const uint RootSystemSignature2
Signature to detect a valid RootSystemDescriptor (part 2).
Definition: IntelACPI.h:53
IntelACPI::SystemDescriptorHeader::revision
u8 revision
Definition: IntelACPI.h:97
CoreManager
Generic Core Manager.
Definition: CoreManager.h:36
IntelACPI::MultipleAPICTableSignature
static const u32 MultipleAPICTableSignature
Signature for the Multiple APIC Descriptor Table (MADT).
Definition: IntelACPI.h:62
IntelACPI::RootSystemDescriptor1::signature
u32 signature[2]
Definition: IntelACPI.h:69
IntelACPI::RootSystemTable
Root System Descriptor Table (RSDT)
Definition: IntelACPI.h:110
IntelACPI::RSDSize
static const uint RSDSize
Size of the memory region for searching the RootSystemDescriptor.
Definition: IntelACPI.h:47
IntelACPI::RootSystemDescriptor1::revision
u8 revision
Definition: IntelACPI.h:72
IntelACPI::RootSystemDescriptor2::length
u32 length
Definition: IntelACPI.h:83
IntelACPI::boot
virtual Result boot(CoreInfo *info)
Boot a processor.
Definition: IntelACPI.cpp:148
IntelACPI::initialize
virtual Result initialize()
Initialize the ACPI.
Definition: IntelACPI.cpp:27
IntelACPI::scanAPIC
Result scanAPIC(MultipleAPICTable *madt)
Scan for cores in the APIC tables.
Definition: IntelACPI.cpp:66
IntelACPI::SystemDescriptorHeader::length
u32 length
Definition: IntelACPI.h:96
IntelACPI::discover
virtual Result discover()
Discover processors.
Definition: IntelACPI.cpp:97
uint
unsigned int uint
Unsigned integer number.
Definition: Types.h:44
IntelACPI::SystemDescriptorHeader::checksum
u8 checksum
Definition: IntelACPI.h:98
IntelACPI::RootSystemSignature1
static const uint RootSystemSignature1
Signature to detect a valid RootSystemDescriptor (part 1).
Definition: IntelACPI.h:50
MegaByte
#define MegaByte(v)
Convert megabytes to bytes.
Definition: Macros.h:57
IntelACPI::MultipleAPICTableEntry::type
u8 type
Definition: IntelACPI.h:132
IntelACPI::MultipleAPICTableProc::apicId
u8 apicId
Definition: IntelACPI.h:144
u64
unsigned long long u64
Unsigned 64-bit number.
Definition: Types.h:50
IntelACPI::MultipleAPICTableProc::header
MultipleAPICTableEntry header
Definition: IntelACPI.h:142
IntelACPI::RootSystemDescriptor2::extendedChecksum
u8 extendedChecksum
Definition: IntelACPI.h:85
IntelACPI::MultipleAPICTable::header
SystemDescriptorHeader header
Definition: IntelACPI.h:154
IntelACPI::RootSystemDescriptor2::v1
RootSystemDescriptor1 v1
Definition: IntelACPI.h:82
IntelACPI::IntelACPI
IntelACPI()
Constructor.
Definition: IntelACPI.cpp:22
IntelACPI::ExtendedSystemTable::header
SystemDescriptorHeader header
Definition: IntelACPI.h:122
IntelACPI::MultipleAPICTableProc
Multiple APIC Description Table (MADT) processor entry.
Definition: IntelACPI.h:140
IntelACPI::MultipleAPICTable::ctrlAddress
u32 ctrlAddress
Definition: IntelACPI.h:155
IntelACPI
Intel Advanced Configuration and Power Interface (ACPI).
Definition: IntelACPI.h:39
IntelACPI::__attribute__
enum IntelACPI::Registers __attribute__
IntelACPI::RootSystemTable::header
SystemDescriptorHeader header
Definition: IntelACPI.h:112
u32
unsigned int u32
Unsigned 32-bit number.
Definition: Types.h:53
IntelACPI::RootSystemDescriptor2::xsdtAddress
u64 xsdtAddress
Definition: IntelACPI.h:84
IntelACPI::SystemDescriptorHeader::creatorId
u32 creatorId
Definition: IntelACPI.h:102
IntelACPI::MultipleAPICTableEntry::length
u8 length
Definition: IntelACPI.h:133
IntelACPI::SystemDescriptorHeader
System Descriptor Header (ACPI v3.0)
Definition: IntelACPI.h:93
IntelACPI::RootSystemDescriptor1::vendorId
char vendorId[6]
Definition: IntelACPI.h:71
IntelACPI::MultipleAPICTableProc::flags
u32 flags
Definition: IntelACPI.h:145
CoreInfo
Per-Core information structure.
Definition: CoreInfo.h:60
IntelACPI::ExtendedSystemTableSignature
static const u32 ExtendedSystemTableSignature
Signature for the Extended System Descriptor Table (XSDT).
Definition: IntelACPI.h:59
IntelACPI::SystemDescriptorHeader::vendorId
char vendorId[6]
Definition: IntelACPI.h:99
IntelACPI::MultipleAPICTable::flags
u32 flags
Definition: IntelACPI.h:156
IntelACPI::RootSystemDescriptor1::rsdtAddress
u32 rsdtAddress
Definition: IntelACPI.h:73
IntelACPI::RSDBase
static const uint RSDBase
Memory base address for searching the RootSystemDescriptor.
Definition: IntelACPI.h:44
u8
unsigned char u8
Unsigned 8-bit number.
Definition: Types.h:59
IntelACPI::MultipleAPICTableProc::coreId
u8 coreId
Definition: IntelACPI.h:143
IntelACPI::RootSystemDescriptor2
Root System Description Pointer (ACPI v2.0)
Definition: IntelACPI.h:80
IntelIO
Intel I/O functions.
Definition: IntelIO.h:38
IntelACPI::MultipleAPICTable::entry
MultipleAPICTableEntry entry[]
Definition: IntelACPI.h:157
IntelACPI::ExtendedSystemTable
Extended System Descriptor Table (XSDT)
Definition: IntelACPI.h:120
IntelACPI::Registers
Registers
Hardware registers.
Definition: IntelACPI.h:164
IntelACPI::MultipleAPICTableEntry
Multiple APIC Description Table (MADT) entry.
Definition: IntelACPI.h:130
IntelACPI::m_bios
IntelIO m_bios
I/O object for searching the RootSystemDescriptor.
Definition: IntelACPI.h:210
IntelACPI::RootSystemDescriptor1::checksum
u8 checksum
Definition: IntelACPI.h:70
CoreManager::Result
Result
Result codes.
Definition: CoreManager.h:45
IntelACPI::RootSystemDescriptor2::reserved
u8 reserved[3]
Definition: IntelACPI.h:86