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

 (

3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one. )Change subject: arch-x86: Implement count latching with the PIT read back command.
......................................................................

arch-x86: Implement count latching with the PIT read back command.

This command can trigger count latching for any of the PIT channels
together with a single command, and can also latch a status byte. The
status byte is not implemented here, but there is already functionality
for latching the count which this can use.

Change-Id: Ic2ad7c73d0c521fdd6fe5f62cb478c6718f3b90c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55283
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/dev/intel_8254_timer.cc
M src/dev/intel_8254_timer.hh
2 files changed, 46 insertions(+), 4 deletions(-)

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




diff --git a/src/dev/intel_8254_timer.cc b/src/dev/intel_8254_timer.cc
index c0fc773..f64c0fe 100644
--- a/src/dev/intel_8254_timer.cc
+++ b/src/dev/intel_8254_timer.cc
@@ -58,12 +58,24 @@
 {
     int sel = data.sel;

-    if (sel == ReadBackCommand)
-       panic("PITimer Read-Back Command is not implemented.\n");
+    if (sel == ReadBackCommand) {
+        ReadBackCommandVal rb_val = static_cast<uint8_t>(data);

-    if (data.rw == LatchCommand)
+        panic_if(!rb_val.status,
+                "Latching the PIT status byte is not implemented.");
+
+        if (!rb_val.count) {
+            for (auto &cnt: counter) {
+                if (bits((uint8_t)rb_val.select, cnt->index()))
+                    cnt->latchCount();
+            }
+        }
+        return;
+    }
+
+    if (data.rw == LatchCommand) {
         counter[sel]->latchCount();
-    else {
+    } else {
         counter[sel]->setRW(data.rw);
         counter[sel]->setMode(data.mode);
         counter[sel]->setBCD(data.bcd);
diff --git a/src/dev/intel_8254_timer.hh b/src/dev/intel_8254_timer.hh
index 9876d13..e02a4cc 100644
--- a/src/dev/intel_8254_timer.hh
+++ b/src/dev/intel_8254_timer.hh
@@ -53,6 +53,16 @@
         Bitfield<0> bcd;
     EndBitUnion(CtrlReg)

+    BitUnion8(ReadBackCommandVal)
+        Bitfield<4> status; // Active low.
+        Bitfield<5> count; // Active low.
+        SubBitUnion(select, 3, 1)
+            Bitfield<3> cnt2;
+            Bitfield<2> cnt1;
+            Bitfield<1> cnt0;
+        EndSubBitUnion(select)
+    EndBitUnion(ReadBackCommandVal)
+
     enum SelectVal
     {
         SelectCounter0,
@@ -152,6 +162,8 @@
       public:
Counter(Intel8254Timer *p, const std::string &name, unsigned int num);

+        unsigned int index() const { return num; }
+
         /** Latch the current count (if one is not already latched) */
         void latchCount();


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/55283
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: Ic2ad7c73d0c521fdd6fe5f62cb478c6718f3b90c
Gerrit-Change-Number: 55283
Gerrit-PatchSet: 5
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Bradford Beckmann <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Matt Sinclair <[email protected]>
Gerrit-Reviewer: Matthew Poremba <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to