FreeNOS
IntelMP.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_MP_H
19 #define __LIBARCH_INTEL_MP_H
20 
33 #define MPINFOADDR 0x10000
34 
41 #ifndef __ASSEMBLER__
42 
43 #include <Types.h>
44 #include <List.h>
45 #include <BitOperations.h>
46 #include <IntController.h>
47 #include <CoreInfo.h>
48 #include <CoreManager.h>
49 #include "IntelIO.h"
50 
52 class MemoryContext;
53 class IntelPIT;
54 class IntelAPIC;
55 
70 class IntelMP : public CoreManager
71 {
72  private:
73 
75  static const uint MPFloatSignature = 0x5f504d5f;
76 
78  static const uint MPEntryProc = 0;
79 
81  static const Address MPEntryAddr = 0xf000;
82 
84  static const Address MPInfoAddr = MPINFOADDR;
85 
87  static const Address MPAreaAddr = 0x1000;
88 
90  static const Size MPAreaSize = 0x100000-0x1000;
91 
95  typedef struct MPFloat
96  {
97  unsigned long signature;
98  unsigned long configAddr;
99  unsigned char length;
100  unsigned char revision;
101  unsigned char checksum;
102  unsigned char feature1;
103  unsigned long feature2;
104  }
105  MPFloat;
106 
110  typedef struct MPConfig
111  {
112  char signature[4];
113  unsigned short length;
114  unsigned char revision;
115  unsigned char checksum;
116  char oemId[8];
117  char productId[12];
118  unsigned long oemAddr;
119  unsigned short oemLength;
120  unsigned short count;
121  unsigned long apicAddr;
122  unsigned long reserved;
123  }
124  MPConfig;
125 
129  typedef struct MPEntry
130  {
131  unsigned char type;
132  unsigned char apicId;
133  unsigned char apicRevision;
134  unsigned char cpuFlags;
138  }
139  MPEntry;
140 
141  public:
142 
146  IntelMP(IntelAPIC & apic);
147 
153  virtual Result initialize();
154 
160  virtual Result discover();
161 
169  virtual Result boot(CoreInfo *info);
170 
171  private:
172 
179 
185  MPConfig * scanMemory(Address addr);
186 
187  private:
188 
191 
194 
197 };
198 
205 #endif /* __ASSEMBLER__ */
206 #endif /* __LIBARCH_INTEL_MP_H */
IntelMP::MPFloat
struct IntelMP::MPFloat MPFloat
Multiprocessor Floating Structure.
IntelMP::IntelMP
IntelMP(IntelAPIC &apic)
Constructor.
Definition: IntelMP.cpp:24
IntelPIT
Intel 8254 Programmable Interrupt Timer (PIT).
Definition: IntelPIT.h:40
IntelMP::MPConfig::signature
char signature[4]
Definition: IntelMP.h:112
IntelMP::MPConfig::checksum
unsigned char checksum
Definition: IntelMP.h:115
IntelIO.h
IntelMP::MPEntry
struct IntelMP::MPEntry MPEntry
Multiprocessor Configuration Entry.
MemoryContext
Virtual memory abstract interface.
Definition: MemoryContext.h:42
IntelMP::MPEntry::signature
u32 signature
Definition: IntelMP.h:135
IntelMP::MPEntry::apicId
unsigned char apicId
Definition: IntelMP.h:132
Types.h
IntelMP::MPEntryAddr
static const Address MPEntryAddr
Physical memory address at which cores start (bootEntry16).
Definition: IntelMP.h:81
IntelMP::MPAreaSize
static const Size MPAreaSize
BIOS memory area size to search for MP tables.
Definition: IntelMP.h:90
CoreManager.h
IntelMP::discover
virtual Result discover()
Discover processors.
Definition: IntelMP.cpp:56
IntelMP::MPEntry::apicRevision
unsigned char apicRevision
Definition: IntelMP.h:133
IntelMP::m_apic
IntelAPIC & m_apic
APIC instance.
Definition: IntelMP.h:196
IntelMP::MPConfig::oemLength
unsigned short oemLength
Definition: IntelMP.h:119
CoreManager
Generic Core Manager.
Definition: CoreManager.h:36
IntelMP::MPEntry::cpuFlags
unsigned char cpuFlags
Definition: IntelMP.h:134
IntelMP::MPConfig::count
unsigned short count
Definition: IntelMP.h:120
IntelMP::MPFloat::checksum
unsigned char checksum
Definition: IntelMP.h:101
IntelMP::MPFloat
Multiprocessor Floating Structure.
Definition: IntelMP.h:95
Address
unsigned long Address
A memory address.
Definition: Types.h:131
IntelMP::boot
virtual Result boot(CoreInfo *info)
Boot a processor.
Definition: IntelMP.cpp:90
BitOperations.h
IntelMP::MPConfig::apicAddr
unsigned long apicAddr
Definition: IntelMP.h:121
uint
unsigned int uint
Unsigned integer number.
Definition: Types.h:44
IntelMP::MPFloat::configAddr
unsigned long configAddr
Definition: IntelMP.h:98
IntelMP::MPEntryProc
static const uint MPEntryProc
Multiprocessor Configuration Type ID for processors.
Definition: IntelMP.h:78
IntelMP::MPConfig::length
unsigned short length
Definition: IntelMP.h:113
IntelMP::MPFloatSignature
static const uint MPFloatSignature
Multiprocessor Floating Structure Signature.
Definition: IntelMP.h:75
IntelMP::MPFloat::signature
unsigned long signature
Definition: IntelMP.h:97
IntelMP::MPConfig::reserved
unsigned long reserved
Definition: IntelMP.h:122
IntelMP::scanMemory
MPConfig * scanMemory(Address addr)
Scan memory for a Multiprocessor Config structure.
Definition: IntelMP.cpp:41
IntelMP::MPConfig::oemId
char oemId[8]
Definition: IntelMP.h:116
IntelMP::MPConfig::oemAddr
unsigned long oemAddr
Definition: IntelMP.h:118
u32
unsigned int u32
Unsigned 32-bit number.
Definition: Types.h:53
IntelMP::MPEntry::features
u32 features
Definition: IntelMP.h:136
IntelMP::initialize
virtual Result initialize()
Perform initialization.
Definition: IntelMP.cpp:30
IntelMP::MPConfig::productId
char productId[12]
Definition: IntelMP.h:117
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
IntelMP
Intel Multi-Processor Specification.
Definition: IntelMP.h:70
IntelMP::MPEntry
Multiprocessor Configuration Entry.
Definition: IntelMP.h:129
IntelMP::MPFloat::revision
unsigned char revision
Definition: IntelMP.h:100
CoreInfo
Per-Core information structure.
Definition: CoreInfo.h:60
IntelMP::MPInfoAddr
static const Address MPInfoAddr
Physical memory address for the CoreInfo structure.
Definition: IntelMP.h:84
entry
u32 entry[]
Definition: IntelACPI.h:64
MPINFOADDR
#define MPINFOADDR
Physical memory address for the CoreInfo structure.
Definition: IntelMP.h:33
IntelMP::MPFloat::feature2
unsigned long feature2
Definition: IntelMP.h:103
IntController.h
IntelMP::MPFloat::feature1
unsigned char feature1
Definition: IntelMP.h:102
CoreInfo.h
IntelAPIC
Intel Advanced Programmable Interrupt Controller (APIC)
Definition: IntelAPIC.h:45
IntelIO
Intel I/O functions.
Definition: IntelIO.h:38
IntelMP::MPFloat::length
unsigned char length
Definition: IntelMP.h:99
IntelMP::MPAreaAddr
static const Address MPAreaAddr
BIOS memory area to search for MP tables.
Definition: IntelMP.h:87
IntelMP::MPConfig
struct IntelMP::MPConfig MPConfig
Multiprocessor Configuration Structure.
IntelMP::MPConfig::revision
unsigned char revision
Definition: IntelMP.h:114
IntelMP::m_bios
IntelIO m_bios
I/O instance for BIOS memory.
Definition: IntelMP.h:190
IntelMP::MPEntry::reserved
u32 reserved[2]
Definition: IntelMP.h:137
IntelMP::MPConfig
Multiprocessor Configuration Structure.
Definition: IntelMP.h:110
IntelMP::parseEntry
MPEntry * parseEntry(MPEntry *entry)
Parse Multiprocessor Config entry.
Definition: IntelMP.cpp:121
IntelMP::MPEntry::type
unsigned char type
Definition: IntelMP.h:131
IntelMP::m_lastMemory
IntelIO m_lastMemory
I/O instance for the last 1MB of physical memory.
Definition: IntelMP.h:193
CoreManager::Result
Result
Result codes.
Definition: CoreManager.h:45
List.h