diff mbox series

[3/4] macfb: allow larger write accesses to the DAFB_LUT register

Message ID 20231026085650.917663-4-mark.cave-ayland@ilande.co.uk
State New
Headers show
Series macfb: A/UX fixes for colour LUT | expand

Commit Message

Mark Cave-Ayland Oct. 26, 2023, 8:56 a.m. UTC
The original tests with MacOS showed that only the bottom 8 bits of the DAFB_LUT
register were used when writing to the LUT, however A/UX performs some of its
writes using 4 byte accesses. Expand the address range for the DAFB_LUT register
so that different size accesses write the correct value to the color_palette
array.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/display/macfb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Laurent Vivier Nov. 5, 2023, 2:42 p.m. UTC | #1
Le 26/10/2023 à 10:56, Mark Cave-Ayland a écrit :
> The original tests with MacOS showed that only the bottom 8 bits of the DAFB_LUT
> register were used when writing to the LUT, however A/UX performs some of its
> writes using 4 byte accesses. Expand the address range for the DAFB_LUT register
> so that different size accesses write the correct value to the color_palette
> array.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>   hw/display/macfb.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/display/macfb.c b/hw/display/macfb.c
> index eb4ce6b824..4a1c75d572 100644
> --- a/hw/display/macfb.c
> +++ b/hw/display/macfb.c
> @@ -37,7 +37,7 @@
>   #define DAFB_INTR_STAT      0x108
>   #define DAFB_INTR_CLEAR     0x10c
>   #define DAFB_LUT_INDEX      0x200
> -#define DAFB_LUT            0x213
> +#define DAFB_LUT            0x210
>   
>   #define DAFB_INTR_VBL   0x4
>   
> @@ -586,8 +586,8 @@ static void macfb_ctrl_write(void *opaque,
>       case DAFB_LUT_INDEX:
>           s->palette_current = (val & 0xff) * 3;
>           break;
> -    case DAFB_LUT:
> -        s->color_palette[s->palette_current] = val;
> +    case DAFB_LUT ... DAFB_LUT + 3:
> +        s->color_palette[s->palette_current] = val & 0xff;
>           s->palette_current = (s->palette_current + 1) %
>                                ARRAY_SIZE(s->color_palette);
>           if (s->palette_current % 3) {

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
diff mbox series

Patch

diff --git a/hw/display/macfb.c b/hw/display/macfb.c
index eb4ce6b824..4a1c75d572 100644
--- a/hw/display/macfb.c
+++ b/hw/display/macfb.c
@@ -37,7 +37,7 @@ 
 #define DAFB_INTR_STAT      0x108
 #define DAFB_INTR_CLEAR     0x10c
 #define DAFB_LUT_INDEX      0x200
-#define DAFB_LUT            0x213
+#define DAFB_LUT            0x210
 
 #define DAFB_INTR_VBL   0x4
 
@@ -586,8 +586,8 @@  static void macfb_ctrl_write(void *opaque,
     case DAFB_LUT_INDEX:
         s->palette_current = (val & 0xff) * 3;
         break;
-    case DAFB_LUT:
-        s->color_palette[s->palette_current] = val;
+    case DAFB_LUT ... DAFB_LUT + 3:
+        s->color_palette[s->palette_current] = val & 0xff;
         s->palette_current = (s->palette_current + 1) %
                              ARRAY_SIZE(s->color_palette);
         if (s->palette_current % 3) {