X86LocalApic.py revision 14145
12SN/A# Copyright (c) 2012 ARM Limited
22188SN/A# All rights reserved.
32SN/A#
42SN/A# The license below extends only to copyright in the software and shall
52SN/A# not be construed as granting a license to any other intellectual
62SN/A# property including but not limited to intellectual property relating
72SN/A# to a hardware implementation of the functionality of the software
82SN/A# licensed hereunder.  You may use the software subject to the license
92SN/A# terms below provided that you ensure that this notice is replicated
102SN/A# unmodified and in its entirety in all distributions of the software,
112SN/A# modified or unmodified, in source code or in binary form.
122SN/A#
132SN/A# Copyright (c) 2008 The Regents of The University of Michigan
142SN/A# All rights reserved.
152SN/A#
162SN/A# Redistribution and use in source and binary forms, with or without
172SN/A# modification, are permitted provided that the following conditions are
182SN/A# met: redistributions of source code must retain the above copyright
192SN/A# notice, this list of conditions and the following disclaimer;
202SN/A# redistributions in binary form must reproduce the above copyright
212SN/A# notice, this list of conditions and the following disclaimer in the
222SN/A# documentation and/or other materials provided with the distribution;
232SN/A# neither the name of the copyright holders nor the names of its
242SN/A# contributors may be used to endorse or promote products derived from
252SN/A# this software without specific prior written permission.
262SN/A#
272665SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
282665SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
292665SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
302665SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
312665SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
322SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
332SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
342SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
352SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
362465SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
373565Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
385529Snate@binkert.org#
398777Sgblack@eecs.umich.edu# Authors: Gabe Black
401917SN/A
411070SN/Afrom m5.defines import buildEnv
421917SN/Afrom m5.params import *
432188SN/Afrom m5.proxy import *
448777Sgblack@eecs.umich.edu
458777Sgblack@eecs.umich.edufrom m5.objects.Device import BasicPioDevice
461917SN/Afrom m5.objects.ClockDomain import DerivedClockDomain
472290SN/A
488777Sgblack@eecs.umich.educlass X86LocalApic(BasicPioDevice):
498777Sgblack@eecs.umich.edu    type = 'X86LocalApic'
508706Sandreas.hansson@arm.com    cxx_class = 'X86ISA::Interrupts'
518799Sgblack@eecs.umich.edu    cxx_header = 'arch/x86/interrupts.hh'
528809Sgblack@eecs.umich.edu    int_master = MasterPort("Port for sending interrupt messages")
5310319SAndreas.Sandberg@ARM.com    int_slave = SlavePort("Port for receiving interrupt messages")
548793Sgblack@eecs.umich.edu    int_latency = Param.Latency('1ns', \
558777Sgblack@eecs.umich.edu            "Latency for an interrupt to propagate through this device.")
561070SN/A
571917SN/A    # pio_addr isn't used by the local APIC model since it's address is
582519SN/A    # calculated dynamically using the initial ID of the CPU it's attached to,
592SN/A    # but it needs to be set to something to make the BasicPioDevice happy.
602SN/A    pio_addr = 0x2000000000000000
612SN/A
622SN/A    # The clock rate for the local APIC timer is supposed to be the "bus clock"
638820Sgblack@eecs.umich.edu    # which we assume is 1/16th the rate of the CPU clock. I don't think this
648820Sgblack@eecs.umich.edu    # is a hard rule, but seems to be true in practice. This can be overriden
659384SAndreas.Sandberg@arm.com    # in configs that use it.
6610537Sandreas.hansson@arm.com    clk_domain = DerivedClockDomain(
6710537Sandreas.hansson@arm.com            clk_domain=Parent.clk_domain, clk_divider=16)
689384SAndreas.Sandberg@arm.com