diff options
author | Andreas Sandberg <andreas.sandberg@arm.com> | 2017-07-20 11:20:17 +0100 |
---|---|---|
committer | Andreas Sandberg <andreas.sandberg@arm.com> | 2017-11-08 10:32:54 +0000 |
commit | d6c204c67d42a3cea9d603888ec52a8d8dacf1a3 (patch) | |
tree | 3c5c0f263d122a4d13901e432ff408bfa905f1f3 /src/dev/virtio/console.cc | |
parent | 344911b885114b8401482679202aaee89fa8b29b (diff) | |
download | gem5-d6c204c67d42a3cea9d603888ec52a8d8dacf1a3.tar.xz |
dev: Refactor UART->Terminal interface
The UART models currently assume that they are always wired to a
terminal. While true at the moment, this isn't necessarily a valid
assumption. This change introduces the SerialDevice class that defines
the interface for serial devices. Currently, Terminal is the only
class that implements this interface.
Change-Id: I74fefafbbaf5ac1ec0d4ec0b5a0f4b246fdad305
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Curtis Dunham <curtis.dunham@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/4289
Reviewed-by: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/dev/virtio/console.cc')
-rw-r--r-- | src/dev/virtio/console.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dev/virtio/console.cc b/src/dev/virtio/console.cc index e3428e951..1027925bb 100644 --- a/src/dev/virtio/console.cc +++ b/src/dev/virtio/console.cc @@ -47,7 +47,7 @@ VirtIOConsole::VirtIOConsole(Params *params) : VirtIODeviceBase(params, ID_CONSOLE, sizeof(Config), F_SIZE), qRecv(params->system->physProxy, params->qRecvSize, *this), qTrans(params->system->physProxy, params->qTransSize, *this), - term(*params->terminal), callbackDataAvail(qRecv) + device(*params->device), callbackDataAvail(qRecv) { registerQueue(qRecv); registerQueue(qTrans); @@ -55,7 +55,7 @@ VirtIOConsole::VirtIOConsole(Params *params) config.cols = 80; config.rows = 24; - term.regDataAvailCallback(&callbackDataAvail); + device.regInterfaceCallback(&callbackDataAvail); } @@ -81,11 +81,11 @@ VirtIOConsole::TermRecvQueue::trySend() // get free descriptors (i.e., there are buffers available to // send) from the guest. VirtDescriptor *d; - while (parent.term.dataAvailable() && (d = consumeDescriptor())) { + while (parent.device.dataAvailable() && (d = consumeDescriptor())) { DPRINTF(VIOConsole, "Got descriptor (len: %i)\n", d->size()); size_t len(0); - while (parent.term.dataAvailable() && len < d->size()) { - uint8_t in(parent.term.in()); + while (parent.device.dataAvailable() && len < d->size()) { + uint8_t in(parent.device.readData()); d->chainWrite(len, &in, sizeof(uint8_t)); ++len; } @@ -108,7 +108,7 @@ VirtIOConsole::TermTransQueue::onNotifyDescriptor(VirtDescriptor *desc) uint8_t data[size]; desc->chainRead(0, data, size); for (int i = 0; i < desc->size(); ++i) - parent.term.out(data[i]); + parent.device.writeData(data[i]); // Tell the guest that we are done with this descriptor. produceDescriptor(desc, 0); |