diff options
author | Gabe Black <gabeblack@google.com> | 2019-09-06 15:22:22 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2019-09-20 17:54:39 +0000 |
commit | ab376064bdfa9796eebad5ee8d84c766e7a30bd6 (patch) | |
tree | 291365a98580568244fe15137b26c85f9abf900c /src/dev/x86/cmos.hh | |
parent | 67e310836baa0e652ae7a3b4ebd00263a52239c2 (diff) | |
download | gem5-ab376064bdfa9796eebad5ee8d84c766e7a30bd6.tar.xz |
dev, x86: Convert x86 devices to the generic int pins.
Change-Id: I4551ad00cf205c31555c90b53e87bc206a8d8729
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20701
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/dev/x86/cmos.hh')
-rw-r--r-- | src/dev/x86/cmos.hh | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/dev/x86/cmos.hh b/src/dev/x86/cmos.hh index 1a755be1a..2f662070d 100644 --- a/src/dev/x86/cmos.hh +++ b/src/dev/x86/cmos.hh @@ -31,6 +31,7 @@ #ifndef __DEV_X86_CMOS_HH__ #define __DEV_X86_CMOS_HH__ +#include "dev/intpin.hh" #include "dev/io_device.hh" #include "dev/mc146818.hh" #include "params/Cmos.hh" @@ -38,8 +39,6 @@ namespace X86ISA { -class IntSourcePin; - class Cmos : public BasicPioDevice { protected: @@ -56,13 +55,17 @@ class Cmos : public BasicPioDevice class X86RTC : public MC146818 { - protected: - IntSourcePin * intPin; public: + std::vector<::IntSourcePin<X86RTC> *> intPin; + X86RTC(EventManager *em, const std::string &n, const struct tm time, - bool bcd, Tick frequency, IntSourcePin * _intPin) : - MC146818(em, n, time, bcd, frequency), intPin(_intPin) + bool bcd, Tick frequency, int int_pin_count) : + MC146818(em, n, time, bcd, frequency) { + for (int i = 0; i < int_pin_count; i++) { + intPin.push_back(new ::IntSourcePin<X86RTC>( + csprintf("%s.int_pin[%d]", n, i), i, this)); + } } protected: void handleEvent(); @@ -72,12 +75,22 @@ class Cmos : public BasicPioDevice typedef CmosParams Params; Cmos(const Params *p) : BasicPioDevice(p, 2), latency(p->pio_latency), - rtc(this, "rtc", p->time, true, ULL(5000000000), p->int_pin) + rtc(this, name() + ".rtc", p->time, true, ULL(5000000000), + p->port_int_pin_connection_count) { memset(regs, 0, numRegs * sizeof(uint8_t)); address = 0; } + Port & + getPort(const std::string &if_name, PortID idx=InvalidPortID) override + { + if (if_name == "int_pin") + return *rtc.intPin.at(idx); + else + return BasicPioDevice::getPort(if_name, idx); + } + Tick read(PacketPtr pkt) override; Tick write(PacketPtr pkt) override; |