2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 * Malta I/O Space mapping including RTC/timer interrupts
37 #ifndef __DEV_MALTA_IO_HH__
38 #define __DEV_MALTA_IO_HH__
40 #include "dev/mips/malta.hh"
41 #include "dev/intel_8254_timer.hh"
42 #include "dev/io_device.hh"
43 #include "dev/mc146818.hh"
44 #include "params/MaltaIO.hh"
45 #include "sim/eventq.hh"
48 * Malta I/O device is a catch all for all the south bridge stuff we care
51 class MaltaIO : public BasicPioDevice
58 class RTC : public MC146818
62 RTC(const std::string &name, const MaltaIOParams *p);
67 //Actually interrupt the processor here
68 malta->cchip->postRTC();
72 /** Mask of the PIC1 */
75 /** Mask of the PIC2 */
78 /** Mode of PIC1. Not used for anything */
81 /** Mode of PIC2. Not used for anything */
84 /** Raw PIC interrupt register before masking */
85 uint8_t picr; //Raw PIC interrput register
87 /** Is the pic interrupting right now or not. */
90 /** A pointer to the Malta device which be belong to */
93 /** Intel 8253 Periodic Interval Timer */
94 Intel8254Timer pitimer;
98 /** The interval is set via two writes to the PIT.
99 * This variable contains a flag as to how many writes have happened, and
106 * Return the freqency of the RTC
107 * @return interrupt rate of the RTC
109 Tick frequency() const;
111 typedef MaltaIOParams Params;
116 return dynamic_cast<const Params *>(_params);
120 * Initialize all the data for devices supported by Malta I/O.
121 * @param p pointer to Params struct
123 MaltaIO(const Params *p);
125 virtual Tick read(PacketPtr pkt);
126 virtual Tick write(PacketPtr pkt);
129 /** Post an Interrupt to the CPU */
130 void postIntr(uint8_t interrupt);
132 /** Clear an Interrupt to the CPU */
133 void clearIntr(uint8_t interrupt);
136 * Serialize this object to the given output stream.
137 * @param os The stream to serialize to.
139 virtual void serialize(std::ostream &os);
142 * Reconstruct the state of this object from a checkpoint.
143 * @param cp The checkpoint use.
144 * @param section The section name of this object
146 virtual void unserialize(Checkpoint *cp, const std::string §ion);
150 #endif // __DEV_MALTA_IO_HH__