Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/55283 )
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
---
M src/dev/intel_8254_timer.cc
M src/dev/intel_8254_timer.hh
2 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/src/dev/intel_8254_timer.cc b/src/dev/intel_8254_timer.cc
index c0fc773..b9e37a1 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(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: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s