aboutsummaryrefslogtreecommitdiff
path: root/hw/ide/pci.c
diff options
context:
space:
mode:
authorBernhard Beschow <shentey@gmail.com>2023-05-31 23:10:41 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2023-07-11 00:11:25 +0200
commit5fe24213f0c17c3050a7c9e95db459198e27de0e (patch)
treeed6cd1c0dfee94ea7108edd15392c22040cadae7 /hw/ide/pci.c
parentbf0576edd71cf4f70352cc8de1cc914b419b36ff (diff)
downloadqemu-5fe24213f0c17c3050a7c9e95db459198e27de0e.zip
qemu-5fe24213f0c17c3050a7c9e95db459198e27de0e.tar.gz
qemu-5fe24213f0c17c3050a7c9e95db459198e27de0e.tar.bz2
hw/ide: Extract bmdma_status_writeb()
Every TYPE_PCI_IDE device performs the same not-so-trivial bit manipulation by copy'n'paste code. Extract this into bmdma_status_writeb(), mirroring bmdma_cmd_writeb(). Signed-off-by: Bernhard Beschow <shentey@gmail.com> Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu> Message-Id: <20230531211043.41724-6-shentey@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'hw/ide/pci.c')
-rw-r--r--hw/ide/pci.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 4cf1e9c..0b26a4c 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -318,6 +318,11 @@ void bmdma_cmd_writeb(BMDMAState *bm, uint32_t val)
bm->cmd = val & 0x09;
}
+void bmdma_status_writeb(BMDMAState *bm, uint32_t val)
+{
+ bm->status = (val & 0x60) | (bm->status & 1) | (bm->status & ~val & 0x06);
+}
+
static uint64_t bmdma_addr_read(void *opaque, hwaddr addr,
unsigned width)
{