IntelMP.py (5838:47ada83a8958) IntelMP.py (7087:fb8d5786ff30)
1# Copyright (c) 2008 The Hewlett-Packard Development Company
2# All rights reserved.
3#
1# Copyright (c) 2008 The Hewlett-Packard Development Company
2# All rights reserved.
3#
4# Redistribution and use of this software in source and binary forms,
5# with or without modification, are permitted provided that the
6# following conditions are met:
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license
9# terms below provided that you ensure that this notice is replicated
10# unmodified and in its entirety in all distributions of the software,
11# modified or unmodified, in source code or in binary form.
7#
12#
8# The software must be used only for Non-Commercial Use which means any
9# use which is NOT directed to receiving any direct monetary
10# compensation for, or commercial advantage from such use. Illustrative
11# examples of non-commercial use are academic research, personal study,
12# teaching, education and corporate research & development.
13# Illustrative examples of commercial use are distributing products for
14# commercial advantage and providing services using the software for
15# commercial advantage.
16#
17# If you wish to use this software or functionality therein that may be
18# covered by patents for commercial use, please contact:
19# Director of Intellectual Property Licensing
20# Office of Strategy and Technology
21# Hewlett-Packard Company
22# 1501 Page Mill Road
23# Palo Alto, California 94304
24#
25# Redistributions of source code must retain the above copyright notice,
26# this list of conditions and the following disclaimer. Redistributions
27# in binary form must reproduce the above copyright notice, this list of
28# conditions and the following disclaimer in the documentation and/or
29# other materials provided with the distribution. Neither the name of
30# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
13# Redistribution and use in source and binary forms, with or without
14# modification, are permitted provided that the following conditions are
15# met: redistributions of source code must retain the above copyright
16# notice, this list of conditions and the following disclaimer;
17# redistributions in binary form must reproduce the above copyright
18# notice, this list of conditions and the following disclaimer in the
19# documentation and/or other materials provided with the distribution;
20# neither the name of the copyright holders nor the names of its
31# contributors may be used to endorse or promote products derived from
21# contributors may be used to endorse or promote products derived from
32# this software without specific prior written permission. No right of
33# sublicense is granted herewith. Derivatives of the software and
34# output created using the software may be prepared, but only for
35# Non-Commercial Uses. Derivatives of the software may be shared with
36# others provided: (i) the others agree to abide by the list of
37# conditions herein which includes the Non-Commercial Use restrictions;
38# and (ii) such Derivatives of the software include the above copyright
39# notice to acknowledge the contribution from this software where
40# applicable, this list of conditions and the disclaimer below.
22# this software without specific prior written permission.
41#
42# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53#
54# Authors: Gabe Black
55
56from m5.params import *
57from m5.SimObject import SimObject
58
59class X86IntelMPFloatingPointer(SimObject):
60 type = 'X86IntelMPFloatingPointer'
61 cxx_class = 'X86ISA::IntelMP::FloatingPointer'
62
63 # The minor revision of the spec to support. The major version is assumed
64 # to be 1 in accordance with the spec.
65 spec_rev = Param.UInt8(4, 'minor revision of the MP spec supported')
66 # If no default configuration is used, set this to 0.
67 default_config = Param.UInt8(0, 'which default configuration to use')
68 imcr_present = Param.Bool(True,
69 'whether the IMCR register is present in the APIC')
70
71class X86IntelMPConfigTable(SimObject):
72 type = 'X86IntelMPConfigTable'
73 cxx_class = 'X86ISA::IntelMP::ConfigTable'
74
75 spec_rev = Param.UInt8(4, 'minor revision of the MP spec supported')
76 oem_id = Param.String("", 'system manufacturer')
77 product_id = Param.String("", 'product family')
78 oem_table_addr = Param.UInt32(0,
79 'pointer to the optional oem configuration table')
80 oem_table_size = Param.UInt16(0, 'size of the oem configuration table')
81 local_apic = Param.UInt32(0xFEE00000, 'address of the local APIC')
82
83 base_entries = VectorParam.X86IntelMPBaseConfigEntry([],
84 'base configuration table entries')
85
86 ext_entries = VectorParam.X86IntelMPExtConfigEntry([],
87 'extended configuration table entries')
88
89 def add_entry(self, entry):
90 if isinstance(entry, X86IntelMPBaseConfigEntry):
91 self.base_entries.append(entry)
92 elif isinstance(entry, X86IntelMPExtConfigEntry):
93 self.ext_entries.append(entry)
94 else:
95 panic("Don't know what type of Intel MP entry %s is." \
96 % entry.__class__.__name__)
97
98class X86IntelMPBaseConfigEntry(SimObject):
99 type = 'X86IntelMPBaseConfigEntry'
100 cxx_class = 'X86ISA::IntelMP::BaseConfigEntry'
101 abstract = True
102
103class X86IntelMPExtConfigEntry(SimObject):
104 type = 'X86IntelMPExtConfigEntry'
105 cxx_class = 'X86ISA::IntelMP::ExtConfigEntry'
106 abstract = True
107
108class X86IntelMPProcessor(X86IntelMPBaseConfigEntry):
109 type = 'X86IntelMPProcessor'
110 cxx_class = 'X86ISA::IntelMP::Processor'
111
112 local_apic_id = Param.UInt8(0, 'local APIC id')
113 local_apic_version = Param.UInt8(0,
114 'bits 0-7 of the local APIC version register')
115 enable = Param.Bool(True, 'if this processor is usable')
116 bootstrap = Param.Bool(False, 'if this is the bootstrap processor')
117
118 stepping = Param.UInt8(0, 'Processor stepping')
119 model = Param.UInt8(0, 'Processor model')
120 family = Param.UInt8(0, 'Processor family')
121
122 feature_flags = Param.UInt32(0, 'flags returned by the CPUID instruction')
123
124class X86IntelMPBus(X86IntelMPBaseConfigEntry):
125 type = 'X86IntelMPBus'
126 cxx_class = 'X86ISA::IntelMP::Bus'
127
128 bus_id = Param.UInt8(0, 'bus id assigned by the bios')
129 bus_type = Param.String("", 'string that identify the bus type')
130 # Legal values for bus_type are:
131 #
132 # "CBUS", "CBUSII", "EISA", "FUTURE", "INTERN", "ISA", "MBI", "MBII",
133 # "MCA", "MPI", "MPSA", "NUBUS", "PCI", "PCMCIA", "TC", "VL", "VME",
134 # "XPRESS"
135
136class X86IntelMPIOAPIC(X86IntelMPBaseConfigEntry):
137 type = 'X86IntelMPIOAPIC'
138 cxx_class = 'X86ISA::IntelMP::IOAPIC'
139
140 id = Param.UInt8(0, 'id of this APIC')
141 version = Param.UInt8(0, 'bits 0-7 of the version register')
142
143 enable = Param.Bool(True, 'if this APIC is usable')
144
145 address = Param.UInt32(0xfec00000, 'address of this APIC')
146
147class X86IntelMPInterruptType(Enum):
148 map = {'INT' : 0,
149 'NMI' : 1,
150 'SMI' : 2,
151 'ExtInt' : 3
152 }
153
154class X86IntelMPPolarity(Enum):
155 map = {'ConformPolarity' : 0,
156 'ActiveHigh' : 1,
157 'ActiveLow' : 3
158 }
159
160class X86IntelMPTriggerMode(Enum):
161 map = {'ConformTrigger' : 0,
162 'EdgeTrigger' : 1,
163 'LevelTrigger' : 3
164 }
165
166class X86IntelMPIOIntAssignment(X86IntelMPBaseConfigEntry):
167 type = 'X86IntelMPIOIntAssignment'
168 cxx_class = 'X86ISA::IntelMP::IOIntAssignment'
169
170 interrupt_type = Param.X86IntelMPInterruptType('INT', 'type of interrupt')
171
172 polarity = Param.X86IntelMPPolarity('ConformPolarity', 'polarity')
173 trigger = Param.X86IntelMPTriggerMode('ConformTrigger', 'trigger mode')
174
175 source_bus_id = Param.UInt8(0,
176 'id of the bus from which the interrupt signal comes')
177 source_bus_irq = Param.UInt8(0,
178 'which interrupt signal from the source bus')
179
180 dest_io_apic_id = Param.UInt8(0,
181 'id of the IO APIC the interrupt is going to')
182 dest_io_apic_intin = Param.UInt8(0,
183 'the INTIN pin on the IO APIC the interrupt is connected to')
184
185class X86IntelMPLocalIntAssignment(X86IntelMPBaseConfigEntry):
186 type = 'X86IntelMPLocalIntAssignment'
187 cxx_class = 'X86ISA::IntelMP::LocalIntAssignment'
188
189 interrupt_type = Param.X86IntelMPInterruptType('INT', 'type of interrupt')
190
191 polarity = Param.X86IntelMPPolarity('ConformPolarity', 'polarity')
192 trigger = Param.X86IntelMPTriggerMode('ConformTrigger', 'trigger mode')
193
194 source_bus_id = Param.UInt8(0,
195 'id of the bus from which the interrupt signal comes')
196 source_bus_irq = Param.UInt8(0,
197 'which interrupt signal from the source bus')
198
199 dest_local_apic_id = Param.UInt8(0,
200 'id of the local APIC the interrupt is going to')
201 dest_local_apic_intin = Param.UInt8(0,
202 'the INTIN pin on the local APIC the interrupt is connected to')
203
204class X86IntelMPAddressType(Enum):
205 map = {"IOAddress" : 0,
206 "MemoryAddress" : 1,
207 "PrefetchAddress" : 2
208 }
209
210class X86IntelMPAddrSpaceMapping(X86IntelMPExtConfigEntry):
211 type = 'X86IntelMPAddrSpaceMapping'
212 cxx_class = 'X86ISA::IntelMP::AddrSpaceMapping'
213
214 bus_id = Param.UInt8(0, 'id of the bus the address space is mapped to')
215 address_type = Param.X86IntelMPAddressType('IOAddress',
216 'address type used to access bus')
217 address = Param.Addr(0, 'starting address of the mapping')
218 length = Param.UInt64(0, 'length of mapping in bytes')
219
220class X86IntelMPBusHierarchy(X86IntelMPExtConfigEntry):
221 type = 'X86IntelMPBusHierarchy'
222 cxx_class = 'X86ISA::IntelMP::BusHierarchy'
223
224 bus_id = Param.UInt8(0, 'id of the bus being described')
225 subtractive_decode = Param.Bool(False,
226 'whether this bus contains all addresses not used by its children')
227 parent_bus = Param.UInt8(0, 'bus id of this busses parent')
228
229class X86IntelMPRangeList(Enum):
230 map = {"ISACompatible" : 0,
231 "VGACompatible" : 1
232 }
233
234class X86IntelMPCompatAddrSpaceMod(X86IntelMPExtConfigEntry):
235 type = 'X86IntelMPCompatAddrSpaceMod'
236 cxx_class = 'X86ISA::IntelMP::CompatAddrSpaceMod'
237
238 bus_id = Param.UInt8(0, 'id of the bus being described')
239 add = Param.Bool(False,
240 'if the range should be added to the original mapping')
241 range_list = Param.X86IntelMPRangeList('ISACompatible',
242 'which predefined range of addresses to use')
23#
24# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35#
36# Authors: Gabe Black
37
38from m5.params import *
39from m5.SimObject import SimObject
40
41class X86IntelMPFloatingPointer(SimObject):
42 type = 'X86IntelMPFloatingPointer'
43 cxx_class = 'X86ISA::IntelMP::FloatingPointer'
44
45 # The minor revision of the spec to support. The major version is assumed
46 # to be 1 in accordance with the spec.
47 spec_rev = Param.UInt8(4, 'minor revision of the MP spec supported')
48 # If no default configuration is used, set this to 0.
49 default_config = Param.UInt8(0, 'which default configuration to use')
50 imcr_present = Param.Bool(True,
51 'whether the IMCR register is present in the APIC')
52
53class X86IntelMPConfigTable(SimObject):
54 type = 'X86IntelMPConfigTable'
55 cxx_class = 'X86ISA::IntelMP::ConfigTable'
56
57 spec_rev = Param.UInt8(4, 'minor revision of the MP spec supported')
58 oem_id = Param.String("", 'system manufacturer')
59 product_id = Param.String("", 'product family')
60 oem_table_addr = Param.UInt32(0,
61 'pointer to the optional oem configuration table')
62 oem_table_size = Param.UInt16(0, 'size of the oem configuration table')
63 local_apic = Param.UInt32(0xFEE00000, 'address of the local APIC')
64
65 base_entries = VectorParam.X86IntelMPBaseConfigEntry([],
66 'base configuration table entries')
67
68 ext_entries = VectorParam.X86IntelMPExtConfigEntry([],
69 'extended configuration table entries')
70
71 def add_entry(self, entry):
72 if isinstance(entry, X86IntelMPBaseConfigEntry):
73 self.base_entries.append(entry)
74 elif isinstance(entry, X86IntelMPExtConfigEntry):
75 self.ext_entries.append(entry)
76 else:
77 panic("Don't know what type of Intel MP entry %s is." \
78 % entry.__class__.__name__)
79
80class X86IntelMPBaseConfigEntry(SimObject):
81 type = 'X86IntelMPBaseConfigEntry'
82 cxx_class = 'X86ISA::IntelMP::BaseConfigEntry'
83 abstract = True
84
85class X86IntelMPExtConfigEntry(SimObject):
86 type = 'X86IntelMPExtConfigEntry'
87 cxx_class = 'X86ISA::IntelMP::ExtConfigEntry'
88 abstract = True
89
90class X86IntelMPProcessor(X86IntelMPBaseConfigEntry):
91 type = 'X86IntelMPProcessor'
92 cxx_class = 'X86ISA::IntelMP::Processor'
93
94 local_apic_id = Param.UInt8(0, 'local APIC id')
95 local_apic_version = Param.UInt8(0,
96 'bits 0-7 of the local APIC version register')
97 enable = Param.Bool(True, 'if this processor is usable')
98 bootstrap = Param.Bool(False, 'if this is the bootstrap processor')
99
100 stepping = Param.UInt8(0, 'Processor stepping')
101 model = Param.UInt8(0, 'Processor model')
102 family = Param.UInt8(0, 'Processor family')
103
104 feature_flags = Param.UInt32(0, 'flags returned by the CPUID instruction')
105
106class X86IntelMPBus(X86IntelMPBaseConfigEntry):
107 type = 'X86IntelMPBus'
108 cxx_class = 'X86ISA::IntelMP::Bus'
109
110 bus_id = Param.UInt8(0, 'bus id assigned by the bios')
111 bus_type = Param.String("", 'string that identify the bus type')
112 # Legal values for bus_type are:
113 #
114 # "CBUS", "CBUSII", "EISA", "FUTURE", "INTERN", "ISA", "MBI", "MBII",
115 # "MCA", "MPI", "MPSA", "NUBUS", "PCI", "PCMCIA", "TC", "VL", "VME",
116 # "XPRESS"
117
118class X86IntelMPIOAPIC(X86IntelMPBaseConfigEntry):
119 type = 'X86IntelMPIOAPIC'
120 cxx_class = 'X86ISA::IntelMP::IOAPIC'
121
122 id = Param.UInt8(0, 'id of this APIC')
123 version = Param.UInt8(0, 'bits 0-7 of the version register')
124
125 enable = Param.Bool(True, 'if this APIC is usable')
126
127 address = Param.UInt32(0xfec00000, 'address of this APIC')
128
129class X86IntelMPInterruptType(Enum):
130 map = {'INT' : 0,
131 'NMI' : 1,
132 'SMI' : 2,
133 'ExtInt' : 3
134 }
135
136class X86IntelMPPolarity(Enum):
137 map = {'ConformPolarity' : 0,
138 'ActiveHigh' : 1,
139 'ActiveLow' : 3
140 }
141
142class X86IntelMPTriggerMode(Enum):
143 map = {'ConformTrigger' : 0,
144 'EdgeTrigger' : 1,
145 'LevelTrigger' : 3
146 }
147
148class X86IntelMPIOIntAssignment(X86IntelMPBaseConfigEntry):
149 type = 'X86IntelMPIOIntAssignment'
150 cxx_class = 'X86ISA::IntelMP::IOIntAssignment'
151
152 interrupt_type = Param.X86IntelMPInterruptType('INT', 'type of interrupt')
153
154 polarity = Param.X86IntelMPPolarity('ConformPolarity', 'polarity')
155 trigger = Param.X86IntelMPTriggerMode('ConformTrigger', 'trigger mode')
156
157 source_bus_id = Param.UInt8(0,
158 'id of the bus from which the interrupt signal comes')
159 source_bus_irq = Param.UInt8(0,
160 'which interrupt signal from the source bus')
161
162 dest_io_apic_id = Param.UInt8(0,
163 'id of the IO APIC the interrupt is going to')
164 dest_io_apic_intin = Param.UInt8(0,
165 'the INTIN pin on the IO APIC the interrupt is connected to')
166
167class X86IntelMPLocalIntAssignment(X86IntelMPBaseConfigEntry):
168 type = 'X86IntelMPLocalIntAssignment'
169 cxx_class = 'X86ISA::IntelMP::LocalIntAssignment'
170
171 interrupt_type = Param.X86IntelMPInterruptType('INT', 'type of interrupt')
172
173 polarity = Param.X86IntelMPPolarity('ConformPolarity', 'polarity')
174 trigger = Param.X86IntelMPTriggerMode('ConformTrigger', 'trigger mode')
175
176 source_bus_id = Param.UInt8(0,
177 'id of the bus from which the interrupt signal comes')
178 source_bus_irq = Param.UInt8(0,
179 'which interrupt signal from the source bus')
180
181 dest_local_apic_id = Param.UInt8(0,
182 'id of the local APIC the interrupt is going to')
183 dest_local_apic_intin = Param.UInt8(0,
184 'the INTIN pin on the local APIC the interrupt is connected to')
185
186class X86IntelMPAddressType(Enum):
187 map = {"IOAddress" : 0,
188 "MemoryAddress" : 1,
189 "PrefetchAddress" : 2
190 }
191
192class X86IntelMPAddrSpaceMapping(X86IntelMPExtConfigEntry):
193 type = 'X86IntelMPAddrSpaceMapping'
194 cxx_class = 'X86ISA::IntelMP::AddrSpaceMapping'
195
196 bus_id = Param.UInt8(0, 'id of the bus the address space is mapped to')
197 address_type = Param.X86IntelMPAddressType('IOAddress',
198 'address type used to access bus')
199 address = Param.Addr(0, 'starting address of the mapping')
200 length = Param.UInt64(0, 'length of mapping in bytes')
201
202class X86IntelMPBusHierarchy(X86IntelMPExtConfigEntry):
203 type = 'X86IntelMPBusHierarchy'
204 cxx_class = 'X86ISA::IntelMP::BusHierarchy'
205
206 bus_id = Param.UInt8(0, 'id of the bus being described')
207 subtractive_decode = Param.Bool(False,
208 'whether this bus contains all addresses not used by its children')
209 parent_bus = Param.UInt8(0, 'bus id of this busses parent')
210
211class X86IntelMPRangeList(Enum):
212 map = {"ISACompatible" : 0,
213 "VGACompatible" : 1
214 }
215
216class X86IntelMPCompatAddrSpaceMod(X86IntelMPExtConfigEntry):
217 type = 'X86IntelMPCompatAddrSpaceMod'
218 cxx_class = 'X86ISA::IntelMP::CompatAddrSpaceMod'
219
220 bus_id = Param.UInt8(0, 'id of the bus being described')
221 add = Param.Bool(False,
222 'if the range should be added to the original mapping')
223 range_list = Param.X86IntelMPRangeList('ISACompatible',
224 'which predefined range of addresses to use')