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
52class MemoryContext;
53class IntelPIT;
54class IntelAPIC;
55
70class 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
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 }
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 }
125
129 typedef struct MPEntry
130 {
131 unsigned char type;
132 unsigned char apicId;
133 unsigned char apicRevision;
134 unsigned char cpuFlags;
138 }
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
186
187 private:
188
191
194
197};
198
205#endif /* __ASSEMBLER__ */
206#endif /* __LIBARCH_INTEL_MP_H */
u32 entry[]
Definition IntelACPI.h:1
Generic Core Manager.
Definition CoreManager.h:37
Result
Result codes.
Definition CoreManager.h:46
Intel Advanced Programmable Interrupt Controller (APIC)
Definition IntelAPIC.h:46
Intel I/O functions.
Definition IntelIO.h:39
Intel Multi-Processor Specification.
Definition IntelMP.h:71
IntelIO m_bios
I/O instance for BIOS memory.
Definition IntelMP.h:190
IntelIO m_lastMemory
I/O instance for the last 1MB of physical memory.
Definition IntelMP.h:193
struct IntelMP::MPEntry MPEntry
Multiprocessor Configuration Entry.
MPEntry * parseEntry(MPEntry *entry)
Parse Multiprocessor Config entry.
Definition IntelMP.cpp:121
static const uint MPFloatSignature
Multiprocessor Floating Structure Signature.
Definition IntelMP.h:75
MPConfig * scanMemory(Address addr)
Scan memory for a Multiprocessor Config structure.
Definition IntelMP.cpp:41
static const uint MPEntryProc
Multiprocessor Configuration Type ID for processors.
Definition IntelMP.h:78
struct IntelMP::MPConfig MPConfig
Multiprocessor Configuration Structure.
virtual Result boot(CoreInfo *info)
Boot a processor.
Definition IntelMP.cpp:90
IntelAPIC & m_apic
APIC instance.
Definition IntelMP.h:196
virtual Result initialize()
Perform initialization.
Definition IntelMP.cpp:30
virtual Result discover()
Discover processors.
Definition IntelMP.cpp:56
struct IntelMP::MPFloat MPFloat
Multiprocessor Floating Structure.
static const Size MPAreaSize
BIOS memory area size to search for MP tables.
Definition IntelMP.h:90
static const Address MPInfoAddr
Physical memory address for the CoreInfo structure.
Definition IntelMP.h:84
static const Address MPEntryAddr
Physical memory address at which cores start (bootEntry16).
Definition IntelMP.h:81
static const Address MPAreaAddr
BIOS memory area to search for MP tables.
Definition IntelMP.h:87
Intel 8254 Programmable Interrupt Timer (PIT).
Definition IntelPIT.h:41
Virtual memory abstract interface.
#define MPINFOADDR
Physical memory address for the CoreInfo structure.
Definition IntelMP.h:33
unsigned int u32
Unsigned 32-bit number.
Definition Types.h:53
unsigned long Address
A memory address.
Definition Types.h:131
unsigned int uint
Unsigned integer number.
Definition Types.h:44
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128
Per-Core information structure.
Definition CoreInfo.h:61
Multiprocessor Configuration Structure.
Definition IntelMP.h:111
char signature[4]
Definition IntelMP.h:112
unsigned short oemLength
Definition IntelMP.h:119
unsigned long apicAddr
Definition IntelMP.h:121
unsigned long oemAddr
Definition IntelMP.h:118
unsigned short length
Definition IntelMP.h:113
unsigned char checksum
Definition IntelMP.h:115
unsigned long reserved
Definition IntelMP.h:122
char productId[12]
Definition IntelMP.h:117
unsigned short count
Definition IntelMP.h:120
unsigned char revision
Definition IntelMP.h:114
Multiprocessor Configuration Entry.
Definition IntelMP.h:130
unsigned char apicRevision
Definition IntelMP.h:133
u32 reserved[2]
Definition IntelMP.h:137
unsigned char type
Definition IntelMP.h:131
unsigned char apicId
Definition IntelMP.h:132
unsigned char cpuFlags
Definition IntelMP.h:134
Multiprocessor Floating Structure.
Definition IntelMP.h:96
unsigned long feature2
Definition IntelMP.h:103
unsigned char feature1
Definition IntelMP.h:102
unsigned char checksum
Definition IntelMP.h:101
unsigned long signature
Definition IntelMP.h:97
unsigned char revision
Definition IntelMP.h:100
unsigned long configAddr
Definition IntelMP.h:98
unsigned char length
Definition IntelMP.h:99