From df1324b999fe8f528401455562a35abc5b2aa212 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Fri, 10 Jul 2020 16:46:22 +0100 Subject: [PATCH] dev-arm: Avoid code duplication in Pl111 Change-Id: I17af93459ace0e4ef82693622a4135c3e831aaf5 Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31176 Reviewed-by: Bobby R. Bruce Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg Tested-by: kokoro --- src/dev/arm/pl111.cc | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/src/dev/arm/pl111.cc b/src/dev/arm/pl111.cc index 27606e11d..111de0358 100644 --- a/src/dev/arm/pl111.cc +++ b/src/dev/arm/pl111.cc @@ -203,21 +203,7 @@ Pl111::read(PacketPtr pkt) } } - switch(pkt->getSize()) { - case 1: - pkt->setLE(data); - break; - case 2: - pkt->setLE(data); - break; - case 4: - pkt->setLE(data); - break; - default: - panic("CLCD controller read size too big?\n"); - break; - } - + pkt->setUintX(data, LittleEndianByteOrder); pkt->makeAtomicResponse(); return pioDelay; } @@ -229,22 +215,7 @@ Pl111::write(PacketPtr pkt) // use a temporary data since the LCD registers are read/written with // different size operations // - uint32_t data = 0; - - switch(pkt->getSize()) { - case 1: - data = pkt->getLE(); - break; - case 2: - data = pkt->getLE(); - break; - case 4: - data = pkt->getLE(); - break; - default: - panic("PL111 CLCD controller write size too big?\n"); - break; - } + const uint32_t data = pkt->getUintX(LittleEndianByteOrder); assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize); -- 2.30.2