gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
i8259.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004-2005 The Regents of The University of Michigan
3  * All rights reserved.
4  *
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.
15  *
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.
27  *
28  * Authors: Gabe Black
29  */
30 
31 #ifndef __DEV_X86_I8259_HH__
32 #define __DEV_X86_I8259_HH__
33 
34 #include "dev/intpin.hh"
35 #include "dev/io_device.hh"
36 #include "enums/X86I8259CascadeMode.hh"
37 #include "params/I8259.hh"
38 
39 namespace X86ISA
40 {
41 
42 class I8259 : public BasicPioDevice
43 {
44  protected:
45  static const int NumLines = 8;
47 
48  void init() override;
49 
53  Enums::X86I8259CascadeMode mode;
55 
56  // Interrupt Request Register
57  uint8_t IRR;
58  // In Service Register
59  uint8_t ISR;
60  // Interrupt Mask Register
61  uint8_t IMR;
62 
63  // The higher order bits of the vector to return
64  uint8_t vectorOffset;
65 
67  // A bit vector of lines with slaves attached, or the slave id, depending
68  // on if this is a master or slave PIC.
69  uint8_t cascadeBits;
70 
72  bool readIRR;
73 
74  // State machine information for reading in initialization control words.
75  bool expectICW4;
77 
78  // Whether or not the PIC is in auto EOI mode.
79  bool autoEOI;
80 
81  void requestInterrupt(int line);
82  void handleEOI(int line);
83 
84  public:
85  typedef I8259Params Params;
86 
87  const Params *
88  params() const
89  {
90  return dynamic_cast<const Params *>(_params);
91  }
92 
93  I8259(Params * p);
94 
95  Port &
96  getPort(const std::string &if_name, PortID idx=InvalidPortID) override
97  {
98  if (if_name == "inputs")
99  return *inputs.at(idx);
100  else if (if_name == "output")
101  return *output.at(idx);
102  else
103  return BasicPioDevice::getPort(if_name, idx);
104  }
105 
106  Tick read(PacketPtr pkt) override;
107  Tick write(PacketPtr pkt) override;
108 
109  void
111  {
112  IMR = 0xFF;
113  }
114 
115  void
117  {
118  IMR = 0x00;
119  }
120 
121  void signalInterrupt(int line);
122  void raiseInterruptPin(int number);
123  void lowerInterruptPin(int number);
124  int getVector();
125 
126  void serialize(CheckpointOut &cp) const override;
127  void unserialize(CheckpointIn &cp) override;
128 };
129 
130 } // namespace X86ISA
131 
132 #endif //__DEV_X86_I8259_HH__
Ports are used to interface objects to each other.
Definition: port.hh:60
uint8_t IMR
Definition: i8259.hh:61
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: i8259.cc:97
const PortID InvalidPortID
Definition: types.hh:238
I8259(Params *p)
Definition: i8259.cc:39
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: i8259.cc:351
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: i8259.cc:73
Tick latency
Definition: i8259.hh:50
I8259 * slave
Definition: i8259.hh:54
bool edgeTriggered
Definition: i8259.hh:71
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: i8259.hh:96
bool cascadeMode
Definition: i8259.hh:66
Definition: cprintf.cc:42
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: i8259.cc:333
STL vector class.
Definition: stl.hh:40
bool autoEOI
Definition: i8259.hh:79
uint8_t cascadeBits
Definition: i8259.hh:69
uint8_t ISR
Definition: i8259.hh:59
void handleEOI(int line)
Definition: i8259.cc:243
std::vector< IntSinkPin< I8259 > * > inputs
Definition: i8259.hh:52
uint64_t Tick
Tick count type.
Definition: types.hh:63
static const int NumLines
Definition: i8259.hh:45
bool pinStates[NumLines]
Definition: i8259.hh:46
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:255
void raiseInterruptPin(int number)
Definition: i8259.cc:286
Enums::X86I8259CascadeMode mode
Definition: i8259.hh:53
const Params * params() const
Definition: i8259.hh:88
void maskAll()
Definition: i8259.hh:110
std::ostream CheckpointOut
Definition: serialize.hh:68
This is exposed globally, independent of the ISA.
Definition: acpi.hh:57
void unmaskAll()
Definition: i8259.hh:116
int getVector()
Definition: i8259.cc:308
I8259Params Params
Definition: i8259.hh:85
const SimObjectParams * _params
Cached copy of the object parameters.
Definition: sim_object.hh:110
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: i8259.cc:64
uint8_t vectorOffset
Definition: i8259.hh:64
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: io_device.cc:67
std::vector< IntSourcePin< I8259 > * > output
Definition: i8259.hh:51
bool expectICW4
Definition: i8259.hh:75
void signalInterrupt(int line)
Definition: i8259.cc:271
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
Bitfield< 0 > p
Definition: pagetable.hh:152
void lowerInterruptPin(int number)
Definition: i8259.cc:298
void requestInterrupt(int line)
Definition: i8259.cc:253
bool readIRR
Definition: i8259.hh:72
uint8_t IRR
Definition: i8259.hh:57
int initControlWord
Definition: i8259.hh:76

Generated on Fri Feb 28 2020 16:27:01 for gem5 by doxygen 1.8.13