Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/55804 )

 (

11 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
 )Change subject: dev,arch-x86: Change the i8042 to a normal PioDevice.
......................................................................

dev,arch-x86: Change the i8042 to a normal PioDevice.

It was already acting like a normal PioDevice, but was inheriting from
BasicPioDevice and then disabling the additions that came with it.

Change-Id: I95791c200251c555ace6fe0c4297899877a94471
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55804
Reviewed-by: Matthew Poremba <matthew.pore...@amd.com>
Maintainer: Gabe Black <gabe.bl...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/dev/x86/I8042.py
M src/dev/x86/i8042.cc
M src/dev/x86/i8042.hh
3 files changed, 33 insertions(+), 21 deletions(-)

Approvals:
  Matthew Poremba: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/dev/x86/I8042.py b/src/dev/x86/I8042.py
index d2d9a17..956a1bf 100644
--- a/src/dev/x86/I8042.py
+++ b/src/dev/x86/I8042.py
@@ -26,17 +26,16 @@

 from m5.params import *
 from m5.proxy import *
-from m5.objects.Device import BasicPioDevice
+from m5.objects.Device import PioDevice
 from m5.objects.IntPin import IntSourcePin
 from m5.objects.PS2 import *

-class I8042(BasicPioDevice):
+class I8042(PioDevice):
     type = 'I8042'
     cxx_class = 'gem5::X86ISA::I8042'
     cxx_header = "dev/x86/i8042.hh"

-    # This isn't actually used for anything here.
-    pio_addr = 0x0
+    pio_latency = Param.Latency('100ns', "Programmed IO latency")
     data_port = Param.Addr('Data port address')
     command_port = Param.Addr('Command/status port address')
     mouse_int_pin = IntSourcePin('Pin to signal the mouse has data')
diff --git a/src/dev/x86/i8042.cc b/src/dev/x86/i8042.cc
index 8bfbaec..7aed0ee 100644
--- a/src/dev/x86/i8042.cc
+++ b/src/dev/x86/i8042.cc
@@ -48,10 +48,8 @@


 X86ISA::I8042::I8042(const Params &p)
-    : BasicPioDevice(p, 0), // pioSize arg is dummy value... not used
-      latency(p.pio_latency),
+    : PioDevice(p), latency(p.pio_latency),
       dataPort(p.data_port), commandPort(p.command_port),
-      statusReg(0), commandByte(0), dataReg(0), lastCommand(NoCommand),
       mouse(p.mouse), keyboard(p.keyboard)
 {
     fatal_if(!mouse, "The i8042 model requires a mouse instance");
@@ -80,7 +78,6 @@
 X86ISA::I8042::getAddrRanges() const
 {
     AddrRangeList ranges;
-    // TODO: Are these really supposed to be a single byte and not 4?
     ranges.push_back(RangeSize(dataPort, 1));
     ranges.push_back(RangeSize(commandPort, 1));
     return ranges;
diff --git a/src/dev/x86/i8042.hh b/src/dev/x86/i8042.hh
index 4ab86ac..d6e464b 100644
--- a/src/dev/x86/i8042.hh
+++ b/src/dev/x86/i8042.hh
@@ -43,7 +43,7 @@
 namespace X86ISA
 {

-class I8042 : public BasicPioDevice
+class I8042 : public PioDevice
 {
   protected:
     enum Command
@@ -98,25 +98,25 @@
         Bitfield<0> keyboardFullInt;
     EndBitUnion(CommandByte)

-    Tick latency;
-    Addr dataPort;
-    Addr commandPort;
+    Tick latency = 0;
+    Addr dataPort = 0;
+    Addr commandPort = 0;

-    StatusReg statusReg;
-    CommandByte commandByte;
+    StatusReg statusReg = 0;
+    CommandByte commandByte = 0;

-    uint8_t dataReg;
+    uint8_t dataReg = 0;

-    static const uint16_t NoCommand = (uint16_t)(-1);
-    uint16_t lastCommand;
+    static inline const uint16_t NoCommand = (uint16_t)(-1);
+    uint16_t lastCommand = NoCommand;

     std::vector<IntSourcePin<I8042> *> mouseIntPin;
     std::vector<IntSourcePin<I8042> *> keyboardIntPin;

-    ps2::Device *mouse;
-    ps2::Device *keyboard;
+    ps2::Device *mouse = nullptr;
+    ps2::Device *keyboard = nullptr;

-    void writeData(uint8_t newData, bool mouse = false);
+    void writeData(uint8_t newData, bool mouse=false);
     uint8_t readDataOut();

   public:
@@ -132,7 +132,7 @@
         else if (if_name == "keyboard_int_pin")
             return *keyboardIntPin.at(idx);
         else
-            return BasicPioDevice::getPort(if_name, idx);
+            return PioDevice::getPort(if_name, idx);
     }

     AddrRangeList getAddrRanges() const override;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/55804
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I95791c200251c555ace6fe0c4297899877a94471
Gerrit-Change-Number: 55804
Gerrit-PatchSet: 13
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Bradford Beckmann <bradford.beckm...@gmail.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Matt Sinclair <mattdsincl...@gmail.com>
Gerrit-Reviewer: Matthew Poremba <matthew.pore...@amd.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to