- * [PULL 1/4] macfb: don't clear interrupts when writing to DAFB_RESET
  2023-11-06  8:15 [PULL 0/4] Q800 for 8.2 patches Laurent Vivier
@ 2023-11-06  8:15 ` Laurent Vivier
  2023-11-06  8:15 ` [PULL 2/4] macfb: rename DAFB_RESET to DAFB_LUT_INDEX Laurent Vivier
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2023-11-06  8:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Laurent Vivier, Mark Cave-Ayland
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Traces from A/UX suggest that this register is only used to reset the framebuffer
LUT (colour lookup table) and not any other device state.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-ID: <20231026085650.917663-2-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/display/macfb.c | 2 --
 1 file changed, 2 deletions(-)
diff --git a/hw/display/macfb.c b/hw/display/macfb.c
index 2f8e01656640..28db2e9f246a 100644
--- a/hw/display/macfb.c
+++ b/hw/display/macfb.c
@@ -585,8 +585,6 @@ static void macfb_ctrl_write(void *opaque,
         break;
     case DAFB_RESET:
         s->palette_current = 0;
-        s->regs[DAFB_INTR_STAT >> 2] &= ~DAFB_INTR_VBL;
-        macfb_update_irq(s);
         break;
     case DAFB_LUT:
         s->color_palette[s->palette_current] = val;
-- 
2.41.0
^ permalink raw reply related	[flat|nested] 6+ messages in thread
- * [PULL 2/4] macfb: rename DAFB_RESET to DAFB_LUT_INDEX
  2023-11-06  8:15 [PULL 0/4] Q800 for 8.2 patches Laurent Vivier
  2023-11-06  8:15 ` [PULL 1/4] macfb: don't clear interrupts when writing to DAFB_RESET Laurent Vivier
@ 2023-11-06  8:15 ` Laurent Vivier
  2023-11-06  8:15 ` [PULL 3/4] macfb: allow larger write accesses to the DAFB_LUT register Laurent Vivier
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2023-11-06  8:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Laurent Vivier, Mark Cave-Ayland
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
When A/UX uses the MacOS Device Manager Status (GetEntries) call to read the
contents of the CLUT, it is easy to see that the requested index is written to
the DAFB_RESET register. Update the palette_current index with the requested
value, and rename it to DAFB_LUT_INDEX to reflect its true purpose.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-ID: <20231026085650.917663-3-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 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 28db2e9f246a..eb4ce6b824c4 100644
--- a/hw/display/macfb.c
+++ b/hw/display/macfb.c
@@ -36,7 +36,7 @@
 #define DAFB_INTR_MASK      0x104
 #define DAFB_INTR_STAT      0x108
 #define DAFB_INTR_CLEAR     0x10c
-#define DAFB_RESET          0x200
+#define DAFB_LUT_INDEX      0x200
 #define DAFB_LUT            0x213
 
 #define DAFB_INTR_VBL   0x4
@@ -583,8 +583,8 @@ static void macfb_ctrl_write(void *opaque,
         s->regs[DAFB_INTR_STAT >> 2] &= ~DAFB_INTR_VBL;
         macfb_update_irq(s);
         break;
-    case DAFB_RESET:
-        s->palette_current = 0;
+    case DAFB_LUT_INDEX:
+        s->palette_current = (val & 0xff) * 3;
         break;
     case DAFB_LUT:
         s->color_palette[s->palette_current] = val;
-- 
2.41.0
^ permalink raw reply related	[flat|nested] 6+ messages in thread
- * [PULL 3/4] macfb: allow larger write accesses to the DAFB_LUT register
  2023-11-06  8:15 [PULL 0/4] Q800 for 8.2 patches Laurent Vivier
  2023-11-06  8:15 ` [PULL 1/4] macfb: don't clear interrupts when writing to DAFB_RESET Laurent Vivier
  2023-11-06  8:15 ` [PULL 2/4] macfb: rename DAFB_RESET to DAFB_LUT_INDEX Laurent Vivier
@ 2023-11-06  8:15 ` Laurent Vivier
  2023-11-06  8:15 ` [PULL 4/4] macfb: allow reads from " Laurent Vivier
  2023-11-07  3:01 ` [PULL 0/4] Q800 for 8.2 patches Stefan Hajnoczi
  4 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2023-11-06  8:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Laurent Vivier, Mark Cave-Ayland
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
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>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-ID: <20231026085650.917663-4-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 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 eb4ce6b824c4..4a1c75d5720f 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) {
-- 
2.41.0
^ permalink raw reply related	[flat|nested] 6+ messages in thread
- * [PULL 4/4] macfb: allow reads from the DAFB_LUT register
  2023-11-06  8:15 [PULL 0/4] Q800 for 8.2 patches Laurent Vivier
                   ` (2 preceding siblings ...)
  2023-11-06  8:15 ` [PULL 3/4] macfb: allow larger write accesses to the DAFB_LUT register Laurent Vivier
@ 2023-11-06  8:15 ` Laurent Vivier
  2023-11-07  3:01 ` [PULL 0/4] Q800 for 8.2 patches Stefan Hajnoczi
  4 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2023-11-06  8:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Laurent Vivier, Mark Cave-Ayland
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
This enables A/UX to correctly retrieve the LUT entries when used with
applications that use the MacOS Device Manager Status (GetEntries) call.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-ID: <20231026085650.917663-5-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/display/macfb.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/hw/display/macfb.c b/hw/display/macfb.c
index 4a1c75d5720f..d61541ccb5d5 100644
--- a/hw/display/macfb.c
+++ b/hw/display/macfb.c
@@ -537,6 +537,11 @@ static uint64_t macfb_ctrl_read(void *opaque,
     case DAFB_MODE_SENSE:
         val = macfb_sense_read(s);
         break;
+    case DAFB_LUT ... DAFB_LUT + 3:
+        val = s->color_palette[s->palette_current];
+        s->palette_current = (s->palette_current + 1) %
+                             ARRAY_SIZE(s->color_palette);
+        break;
     default:
         if (addr < MACFB_CTRL_TOPADDR) {
             val = s->regs[addr >> 2];
-- 
2.41.0
^ permalink raw reply related	[flat|nested] 6+ messages in thread
- * Re: [PULL 0/4] Q800 for 8.2 patches
  2023-11-06  8:15 [PULL 0/4] Q800 for 8.2 patches Laurent Vivier
                   ` (3 preceding siblings ...)
  2023-11-06  8:15 ` [PULL 4/4] macfb: allow reads from " Laurent Vivier
@ 2023-11-07  3:01 ` Stefan Hajnoczi
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2023-11-07  3:01 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: qemu-devel, Laurent Vivier
[-- Attachment #1: Type: text/plain, Size: 115 bytes --]
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/8.2 for any user-visible changes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply	[flat|nested] 6+ messages in thread