diff mbox series

[v3,6/7] hw/ide/pci: Replace some magic numbers by constants

Message ID 20230531211043.41724-7-shentey@gmail.com
State New
Headers show
Series VIA and general PCI IDE cleanup | expand

Commit Message

Bernhard Beschow May 31, 2023, 9:10 p.m. UTC
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/ide/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé May 31, 2023, 9:25 p.m. UTC | #1
On 31/5/23 23:10, Bernhard Beschow wrote:
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/ide/pci.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Mark Cave-Ayland June 1, 2023, 12:24 p.m. UTC | #2
On 31/05/2023 22:10, Bernhard Beschow wrote:

> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/ide/pci.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ide/pci.c b/hw/ide/pci.c
> index 0b26a4ce9f..a25b352537 100644
> --- a/hw/ide/pci.c
> +++ b/hw/ide/pci.c
> @@ -320,7 +320,8 @@ void bmdma_cmd_writeb(BMDMAState *bm, uint32_t val)
>   
>   void bmdma_status_writeb(BMDMAState *bm, uint32_t val)
>   {
> -    bm->status = (val & 0x60) | (bm->status & 1) | (bm->status & ~val & 0x06);
> +    bm->status = (val & 0x60) | (bm->status & BM_STATUS_DMAING)
> +                 | (bm->status & ~val & (BM_STATUS_ERROR | BM_STATUS_INT));
>   }
>   
>   static uint64_t bmdma_addr_read(void *opaque, hwaddr addr,

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.
diff mbox series

Patch

diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 0b26a4ce9f..a25b352537 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -320,7 +320,8 @@  void bmdma_cmd_writeb(BMDMAState *bm, uint32_t val)
 
 void bmdma_status_writeb(BMDMAState *bm, uint32_t val)
 {
-    bm->status = (val & 0x60) | (bm->status & 1) | (bm->status & ~val & 0x06);
+    bm->status = (val & 0x60) | (bm->status & BM_STATUS_DMAING)
+                 | (bm->status & ~val & (BM_STATUS_ERROR | BM_STATUS_INT));
 }
 
 static uint64_t bmdma_addr_read(void *opaque, hwaddr addr,