All of lore.kernel.org
 help / color / mirror / Atom feed
From: BALATON Zoltan <balaton@eik.bme.hu>
To: qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Cc: Magnus Damm <magnus.damm@gmail.com>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: [Qemu-devel] [PATCH v3 11/13] sm501: Add some more missing registers
Date: Fri, 03 Mar 2017 01:50:19 -0000	[thread overview]
Message-ID: <7be6454441c7b61a02e22aa2d6f81f0c047d4312.1488504063.git.balaton@eik.bme.hu> (raw)
In-Reply-To: <cover.1488504063.git.balaton@eik.bme.hu>

This is to allow clients to initialise these without failing as long
as no 2D engine function is called that would use the written value.
Saved values are not used yet (may get used when more of 2D engine is
added sometimes) and clients normally only write to most of these
registers, nothing is known to ever read them but they are documented
as read/write so also implement read for these.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---

v2: Fixed mask of video_control register for a read only bit
    Changed IRQ status register to write ignored as IRQ is not implemented
v3: Squashed read implementation into this patch

 hw/display/sm501.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 106 insertions(+), 1 deletion(-)

diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index 607eddc..30e39be 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -512,6 +512,8 @@ typedef struct SM501State {
     uint32_t dc_panel_hwc_color_1_2;
     uint32_t dc_panel_hwc_color_3;
 
+    uint32_t dc_video_control;
+
     uint32_t dc_crt_control;
     uint32_t dc_crt_fb_addr;
     uint32_t dc_crt_fb_offset;
@@ -531,13 +533,20 @@ typedef struct SM501State {
     uint32_t twoD_control;
     uint32_t twoD_pitch;
     uint32_t twoD_foreground;
+    uint32_t twoD_background;
     uint32_t twoD_stretch;
+    uint32_t twoD_color_compare;
     uint32_t twoD_color_compare_mask;
     uint32_t twoD_mask;
+    uint32_t twoD_clip_tl;
+    uint32_t twoD_clip_br;
+    uint32_t twoD_mono_pattern_low;
+    uint32_t twoD_mono_pattern_high;
     uint32_t twoD_window_width;
     uint32_t twoD_source_base;
     uint32_t twoD_destination_base;
-
+    uint32_t twoD_alpha;
+    uint32_t twoD_wrap;
 } SM501State;
 
 static uint32_t get_local_mem_size_index(uint32_t size)
@@ -946,6 +955,10 @@ static uint64_t sm501_disp_ctrl_read(void *opaque, hwaddr addr,
         ret = s->dc_panel_v_sync;
         break;
 
+    case SM501_DC_VIDEO_CONTROL:
+        ret = s->dc_video_control;
+        break;
+
     case SM501_DC_CRT_CONTROL:
         ret = s->dc_crt_control;
         break;
@@ -1061,6 +1074,10 @@ static void sm501_disp_ctrl_write(void *opaque, hwaddr addr,
         s->dc_panel_hwc_color_3 = value & 0x0000FFFF;
         break;
 
+    case SM501_DC_VIDEO_CONTROL:
+        s->dc_video_control = value & 0x00037FFF;
+        break;
+
     case SM501_DC_CRT_CONTROL:
         s->dc_crt_control = value & 0x0003FFFF;
         break;
@@ -1133,9 +1150,69 @@ static uint64_t sm501_2d_engine_read(void *opaque, hwaddr addr,
     SM501_DPRINTF("sm501 2d engine regs : read addr=%x\n", (int)addr);
 
     switch (addr) {
+    case SM501_2D_SOURCE:
+        ret = s->twoD_source;
+        break;
+    case SM501_2D_DESTINATION:
+        ret = s->twoD_destination;
+        break;
+    case SM501_2D_DIMENSION:
+        ret = s->twoD_dimension;
+        break;
+    case SM501_2D_CONTROL:
+        ret = s->twoD_control;
+        break;
+    case SM501_2D_PITCH:
+        ret = s->twoD_pitch;
+        break;
+    case SM501_2D_FOREGROUND:
+        ret = s->twoD_foreground;
+        break;
+    case SM501_2D_BACKGROUND:
+        ret = s->twoD_background;
+        break;
+    case SM501_2D_STRETCH:
+        ret = s->twoD_stretch;
+        break;
+    case SM501_2D_COLOR_COMPARE:
+        ret = s->twoD_color_compare;
+        break;
+    case SM501_2D_COLOR_COMPARE_MASK:
+        ret = s->twoD_color_compare_mask;
+        break;
+    case SM501_2D_MASK:
+        ret = s->twoD_mask;
+        break;
+    case SM501_2D_CLIP_TL:
+        ret = s->twoD_clip_tl;
+        break;
+    case SM501_2D_CLIP_BR:
+        ret = s->twoD_clip_br;
+        break;
+    case SM501_2D_MONO_PATTERN_LOW:
+        ret = s->twoD_mono_pattern_low;
+        break;
+    case SM501_2D_MONO_PATTERN_HIGH:
+        ret = s->twoD_mono_pattern_high;
+        break;
+    case SM501_2D_WINDOW_WIDTH:
+        ret = s->twoD_window_width;
+        break;
     case SM501_2D_SOURCE_BASE:
         ret = s->twoD_source_base;
         break;
+    case SM501_2D_DESTINATION_BASE:
+        ret = s->twoD_destination_base;
+        break;
+    case SM501_2D_ALPHA:
+        ret = s->twoD_alpha;
+        break;
+    case SM501_2D_WRAP:
+        ret = s->twoD_wrap;
+        break;
+    case SM501_2D_STATUS:
+        ret = 0; /* Should return interrupt status */
+        break;
     default:
         printf("sm501 disp ctrl : not implemented register read."
                " addr=%x\n", (int)addr);
@@ -1178,15 +1255,33 @@ static void sm501_2d_engine_write(void *opaque, hwaddr addr,
     case SM501_2D_FOREGROUND:
         s->twoD_foreground = value;
         break;
+    case SM501_2D_BACKGROUND:
+        s->twoD_background = value;
+        break;
     case SM501_2D_STRETCH:
         s->twoD_stretch = value;
         break;
+    case SM501_2D_COLOR_COMPARE:
+        s->twoD_color_compare = value;
+        break;
     case SM501_2D_COLOR_COMPARE_MASK:
         s->twoD_color_compare_mask = value;
         break;
     case SM501_2D_MASK:
         s->twoD_mask = value;
         break;
+    case SM501_2D_CLIP_TL:
+        s->twoD_clip_tl = value;
+        break;
+    case SM501_2D_CLIP_BR:
+        s->twoD_clip_br = value;
+        break;
+    case SM501_2D_MONO_PATTERN_LOW:
+        s->twoD_mono_pattern_low = value;
+        break;
+    case SM501_2D_MONO_PATTERN_HIGH:
+        s->twoD_mono_pattern_high = value;
+        break;
     case SM501_2D_WINDOW_WIDTH:
         s->twoD_window_width = value;
         break;
@@ -1196,6 +1291,15 @@ static void sm501_2d_engine_write(void *opaque, hwaddr addr,
     case SM501_2D_DESTINATION_BASE:
         s->twoD_destination_base = value;
         break;
+    case SM501_2D_ALPHA:
+        s->twoD_alpha = value;
+        break;
+    case SM501_2D_WRAP:
+        s->twoD_wrap = value;
+        break;
+    case SM501_2D_STATUS:
+        /* ignored, writing 0 should clear interrupt status */
+        break;
     default:
         printf("sm501 2d engine : not implemented register write."
                " addr=%x, val=%x\n", (int)addr, (unsigned)value);
@@ -1454,6 +1558,7 @@ static void sm501_reset(SM501State *s)
     s->misc_timing = 0;
     s->power_mode_control = 0;
     s->dc_panel_control = 0x00010000; /* FIFO level 3 */
+    s->dc_video_control = 0;
     s->dc_crt_control = 0x00010000;
     s->twoD_control = 0;
 }
-- 
2.7.4

  parent reply	other threads:[~2017-03-03  1:50 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03  1:21 [Qemu-devel] [PATCH v3 00/13] Improvements for SM501 display controller emulation BALATON Zoltan
2017-02-25 18:23 ` [Qemu-devel] [PATCH v3 05/13] sm501: Get rid of base address in draw_hwc_line BALATON Zoltan
2017-02-25 18:31 ` [Qemu-devel] [PATCH v3 06/13] sm501: Add emulation of chip connected via PCI BALATON Zoltan
2017-03-03 18:25   ` Peter Maydell
2017-02-25 18:46 ` [Qemu-devel] [PATCH v3 07/13] sm501: Fix device endianness BALATON Zoltan
2017-02-25 19:19 ` [Qemu-devel] [PATCH v3 09/13] sm501: Misc clean ups BALATON Zoltan
2017-02-25 19:25 ` [Qemu-devel] [PATCH v3 10/13] sm501: Add support for panel layer BALATON Zoltan
2017-02-25 23:53 ` [Qemu-devel] [PATCH v3 12/13] sm501: Add vmstate descriptor BALATON Zoltan
2017-03-03 18:34   ` Peter Maydell
2017-03-03  0:21 ` [Qemu-devel] [PATCH v3 02/13] sm501: Use defined constants instead of literal values where available BALATON Zoltan
2017-03-03 18:21   ` Peter Maydell
2017-03-03  1:03 ` [Qemu-devel] [PATCH v3 04/13] sm501: QOMify BALATON Zoltan
2017-03-03 18:23   ` Peter Maydell
2017-03-03 18:39   ` Peter Maydell
2017-03-03 20:56     ` BALATON Zoltan
2017-03-04 12:43       ` Peter Maydell
2017-03-03  1:50 ` [Qemu-devel] [PATCH v3 13/13] ppc: Add SM501 device in config for ppc and ppcemb targets BALATON Zoltan
2017-03-03 18:34   ` Peter Maydell
2017-03-06  7:00   ` Thomas Huth
2017-03-06  9:47     ` Peter Maydell
2017-03-06  9:52       ` Thomas Huth
2017-03-06  9:55         ` Peter Maydell
2017-03-06 18:34           ` BALATON Zoltan
2017-03-03  1:50 ` BALATON Zoltan [this message]
2017-03-03 18:33   ` [Qemu-devel] [PATCH v3 11/13] sm501: Add some more missing registers Peter Maydell
2017-03-03  1:50 ` [Qemu-devel] [PATCH v3 08/13] sm501: Fix hardware cursor BALATON Zoltan
2017-03-03 18:27   ` Peter Maydell
2017-03-03  1:50 ` [Qemu-devel] [PATCH v3 03/13] sm501: Add missing arbitration control register BALATON Zoltan
2017-03-03 18:21   ` Peter Maydell
2017-03-03  1:50 ` [Qemu-devel] [PATCH v3 01/13] sm501: Fixed code style and a few typos in comments BALATON Zoltan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7be6454441c7b61a02e22aa2d6f81f0c047d4312.1488504063.git.balaton@eik.bme.hu \
    --to=balaton@eik.bme.hu \
    --cc=aurelien@aurel32.net \
    --cc=magnus.damm@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.