From: Giacomo Travaglini Date: Fri, 10 Jul 2020 15:46:22 +0000 (+0100) Subject: dev-arm: Avoid code duplication in Pl111 X-Git-Tag: v20.1.0.0~361 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=df1324b999fe8f528401455562a35abc5b2aa212;p=gem5.git 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 --- 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);