changeset 27a9526eea1f in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=27a9526eea1f
description:
X86: Change I8254 and PCSpeaker devices from subdevices to SimObjects
and eliminate subdevices.
diffstat:
19 files changed, 228 insertions(+), 211 deletions(-)
src/dev/x86/I8254.py | 18 +++++++++++
src/dev/x86/PC.py | 1
src/dev/x86/PcSpeaker.py | 18 +++++++++++
src/dev/x86/SConscript | 3 +
src/dev/x86/i8254.cc | 34 +++++++++++++++++++++
src/dev/x86/i8254.hh | 48 ++++++++++++++++++++++++++++++
src/dev/x86/pc.cc | 1
src/dev/x86/pc.hh | 2 -
src/dev/x86/south_bridge/SConscript | 1
src/dev/x86/south_bridge/SouthBridge.py | 16 ++++++++--
src/dev/x86/south_bridge/i8254.cc | 40 -------------------------
src/dev/x86/south_bridge/i8254.hh | 33 --------------------
src/dev/x86/south_bridge/south_bridge.cc | 19 +++--------
src/dev/x86/south_bridge/south_bridge.hh | 17 ++++++----
src/dev/x86/south_bridge/speaker.cc | 35 ---------------------
src/dev/x86/south_bridge/speaker.hh | 37 -----------------------
src/dev/x86/south_bridge/sub_device.hh | 39 ------------------------
src/dev/x86/speaker.cc | 38 +++++++++++++++++++++++
src/dev/x86/speaker.hh | 39 ++++++++++++++++++++++++
diffs (truncated from 1090 to 300 lines):
diff -r b65e232e7755 -r 27a9526eea1f src/dev/x86/I8254.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/dev/x86/I8254.py Sat Oct 11 02:16:11 2008 -0700
@@ -0,0 +1,37 @@
+# Copyright (c) 2008 The Regents of The University of Michigan
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+from m5.params import *
+from m5.proxy import *
+from Device import BasicPioDevice
+
+class I8254(BasicPioDevice):
+ type = 'I8254'
+ cxx_class = 'X86ISA::I8254'
+ pio_latency = Param.Latency('1ns', "Programmed IO latency in simticks")
+ int_pin = Param.X86IntPin('Pin to signal timer interrupts to')
diff -r b65e232e7755 -r 27a9526eea1f src/dev/x86/PC.py
--- a/src/dev/x86/PC.py Sat Oct 11 01:49:39 2008 -0700
+++ b/src/dev/x86/PC.py Sat Oct 11 02:16:11 2008 -0700
@@ -29,10 +29,8 @@
from m5.params import *
from m5.proxy import *
-from Cmos import Cmos
from Device import IsaFake
from Pci import PciConfigAll
-from I8259 import I8259
from Platform import Platform
from SouthBridge import SouthBridge
from Terminal import Terminal
@@ -49,10 +47,6 @@
pciconfig = PciConfigAll()
south_bridge = SouthBridge()
- pic1 = I8259(pio_addr=x86IOAddress(0x20), mode='I8259Master')
- pic2 = I8259(pio_addr=x86IOAddress(0xA0),
- mode='I8259Slave', output=pic1.pin(2))
- cmos = Cmos(pio_addr=x86IOAddress(0x70), int_pin=pic2.pin(0))
# "Non-existant" port used for timing purposes by the linux kernel
i_dont_exist = IsaFake(pio_addr=x86IOAddress(0x80), pio_size=1)
@@ -68,10 +62,7 @@
com_1.terminal = terminal
def attachIO(self, bus):
- self.south_bridge.pio = bus.port
- self.cmos.pio = bus.port
- self.pic1.pio = bus.port
- self.pic2.pio = bus.port
+ self.south_bridge.attachIO(bus)
self.i_dont_exist.pio = bus.port
self.behind_pci.pio = bus.port
self.com_1.pio = bus.port
diff -r b65e232e7755 -r 27a9526eea1f src/dev/x86/PcSpeaker.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/dev/x86/PcSpeaker.py Sat Oct 11 02:16:11 2008 -0700
@@ -0,0 +1,37 @@
+# Copyright (c) 2008 The Regents of The University of Michigan
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+from m5.params import *
+from m5.proxy import *
+from Device import BasicPioDevice
+
+class PcSpeaker(BasicPioDevice):
+ type = 'PcSpeaker'
+ cxx_class = 'X86ISA::Speaker'
+ pio_latency = Param.Latency('1ns', "Programmed IO latency in simticks")
+ i8254 = Param.I8254('Timer that drives the speaker')
diff -r b65e232e7755 -r 27a9526eea1f src/dev/x86/SConscript
--- a/src/dev/x86/SConscript Sat Oct 11 01:49:39 2008 -0700
+++ b/src/dev/x86/SConscript Sat Oct 11 02:16:11 2008 -0700
@@ -42,5 +42,12 @@
Source('i8259.cc')
TraceFlag('I8259', 'Accesses to the I8259 PIC devices')
+ SimObject('I8254.py')
+ Source('i8254.cc')
+
+ SimObject('PcSpeaker.py')
+ Source('speaker.cc')
+ TraceFlag('PcSpeaker')
+
SimObject('X86IntPin.py')
Source('intdev.cc')
diff -r b65e232e7755 -r 27a9526eea1f src/dev/x86/i8254.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/dev/x86/i8254.cc Sat Oct 11 02:16:11 2008 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2008 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Gabe Black
+ */
+
+#include "dev/x86/i8254.hh"
+#include "mem/packet.hh"
+#include "mem/packet_access.hh"
+
+Tick
+X86ISA::I8254::read(PacketPtr pkt)
+{
+ assert(pkt->getSize() == 1);
+ Addr offset = pkt->getAddr() - pioAddr;
+ if (offset < 3) {
+ pkt->set(pit.readCounter(offset));
+ } else if (offset == 3) {
+ pkt->set(uint8_t(-1));
+ } else {
+ panic("Read from undefined i8254 register.\n");
+ }
+ return latency;
+}
+
+Tick
+X86ISA::I8254::write(PacketPtr pkt)
+{
+ assert(pkt->getSize() == 1);
+ Addr offset = pkt->getAddr() - pioAddr;
+ if (offset < 3) {
+ pit.writeCounter(offset, pkt->get<uint8_t>());
+ } else if (offset == 3) {
+ pit.writeControl(pkt->get<uint8_t>());
+ } else {
+ panic("Write to undefined i8254 register.\n");
+ }
+ return latency;
+}
+
+X86ISA::I8254 *
+I8254Params::create()
+{
+ return new X86ISA::I8254(this);
+}
diff -r b65e232e7755 -r 27a9526eea1f src/dev/x86/i8254.hh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/dev/x86/i8254.hh Sat Oct 11 02:16:11 2008 -0700
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2008 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Gabe Black
+ */
+
+#ifndef __DEV_X86_I8254_HH__
+#define __DEV_X86_I8254_HH__
+
+#include "dev/intel_8254_timer.hh"
+#include "dev/io_device.hh"
+#include "params/I8254.hh"
+
+namespace X86ISA
+{
+
+class IntPin;
+
+class I8254 : public BasicPioDevice
+{
+ protected:
+ Tick latency;
+ Intel8254Timer pit;
+
+ IntPin *intPin;
+
+ public:
+ typedef I8254Params Params;
+
+ const Params *
+ params() const
+ {
+ return dynamic_cast<const Params *>(_params);
+ }
+
+ I8254(Params *p) : BasicPioDevice(p), latency(p->pio_latency),
+ pit(this, p->name), intPin(p->int_pin)
+ {
+ pioSize = 4;
+ }
+ Tick read(PacketPtr pkt);
+
+ Tick write(PacketPtr pkt);
+
+ bool
+ outputHigh(unsigned int num)
+ {
+ return pit.outputHigh(num);
+ }
+
+ uint8_t
+ readCounter(unsigned int num)
+ {
+ return pit.readCounter(num);
+ }
+
+ void
+ writeCounter(unsigned int num, const uint8_t data)
+ {
+ pit.writeCounter(num, data);
+ }
+
+ void
+ writeControl(uint8_t val)
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev