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 * Tsunami I/O Space mapping including RTC/timer interrupts
37 #ifndef __DEV_TSUNAMI_IO_HH__
38 #define __DEV_TSUNAMI_IO_HH__
40 #include "base/range.hh"
41 #include "dev/alpha/tsunami.hh"
42 #include "dev/intel_8254_timer.hh"
43 #include "dev/mc146818.hh"
44 #include "dev/io_device.hh"
45 #include "params/TsunamiIO.hh"
46 #include "sim/eventq.hh"
49 * Tsunami I/O device is a catch all for all the south bridge stuff we care
52 class TsunamiIO : public BasicPioDevice
59 class RTC : public MC146818
63 RTC(const std::string &n, const TsunamiIOParams *p);
68 //Actually interrupt the processor here
69 tsunami->cchip->postRTC();
73 /** Mask of the PIC1 */
76 /** Mask of the PIC2 */
79 /** Mode of PIC1. Not used for anything */
82 /** Mode of PIC2. Not used for anything */
85 /** Raw PIC interrupt register before masking */
86 uint8_t picr; //Raw PIC interrput register
88 /** Is the pic interrupting right now or not. */
91 /** A pointer to the Tsunami device which be belong to */
94 /** Intel 8253 Periodic Interval Timer */
95 Intel8254Timer pitimer;
101 /** The interval is set via two writes to the PIT.
102 * This variable contains a flag as to how many writes have happened, and
109 * Return the freqency of the RTC
110 * @return interrupt rate of the RTC
112 Tick frequency() const;
115 typedef TsunamiIOParams Params;
117 * Initialize all the data for devices supported by Tsunami I/O.
118 * @param p pointer to Params struct
120 TsunamiIO(const Params *p);
125 return dynamic_cast<const Params *>(_params);
128 virtual Tick read(PacketPtr pkt);
129 virtual Tick write(PacketPtr pkt);
132 * Post an PIC interrupt to the CPU via the CChip
133 * @param bitvector interrupt to post.
135 void postPIC(uint8_t bitvector);
138 * Clear a posted interrupt
139 * @param bitvector interrupt to clear
141 void clearPIC(uint8_t bitvector);
144 * Serialize this object to the given output stream.
145 * @param os The stream to serialize to.
147 virtual void serialize(std::ostream &os);
150 * Reconstruct the state of this object from a checkpoint.
151 * @param cp The checkpoint use.
152 * @param section The section name of this object
154 virtual void unserialize(Checkpoint *cp, const std::string §ion);
158 #endif // __DEV_TSUNAMI_IO_HH__