x86: Move APIC clock divider to Python

This patch moves the 16x APIC clock divider to the Python code to
avoid the post-instantiation modifications to the clock. The x86 APIC
was the only object setting the clock after creation time and this
required some custom functionality and configuration. With this patch,
the clock multiplier is moved to the Python code and the objects are
instantiated with the appropriate clock.
This commit is contained in:
Andreas Hansson
2013-02-19 05:56:06 -05:00
parent 86a4d09269
commit 5c7ebee434
5 changed files with 23 additions and 27 deletions

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2012 ARM Limited
# Copyright (c) 2012-2013 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
@@ -1207,9 +1207,10 @@ class Frequency(TickParamValue):
def ini_str(self):
return '%d' % self.getValue()
# A generic frequency and/or Latency value. Value is stored as a latency,
# but to avoid ambiguity this object does not support numeric ops (* or /).
# An explicit conversion to a Latency or Frequency must be made first.
# A generic frequency and/or Latency value. Value is stored as a
# latency, and any manipulation using a multiplier thus scales the
# clock period, i.e. a 2x multiplier doubles the clock period and thus
# halves the clock frequency.
class Clock(ParamValue):
cxx_type = 'Tick'
@@ -1243,6 +1244,14 @@ class Clock(ParamValue):
return Latency(self)
raise AttributeError, "Frequency object has no attribute '%s'" % attr
def __mul__(self, other):
# Always treat the clock as a period when scaling
newobj = self.__class__(self)
newobj.value *= other
return newobj
__rmul__ = __mul__
def getValue(self):
return self.period.getValue()