From nobody Mon Feb 9 07:55:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1492772032556742.7642230674817; Fri, 21 Apr 2017 03:53:52 -0700 (PDT) Received: from localhost ([::1]:58550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1WCE-00058f-Sn for importer@patchew.org; Fri, 21 Apr 2017 06:53:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1W1N-0004Cm-3R for qemu-devel@nongnu.org; Fri, 21 Apr 2017 06:42:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1W1L-000077-8E for qemu-devel@nongnu.org; Fri, 21 Apr 2017 06:42:37 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:25234) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d1W1K-00004v-OF; Fri, 21 Apr 2017 06:42:35 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 7DD107456E4; Fri, 21 Apr 2017 12:42:32 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 76AC07456FB; Fri, 21 Apr 2017 12:42:31 +0200 (CEST) Message-Id: <636f37978052c74ffa1160d7e15dc6bb6c40ca26.1492770667.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Date: Fri, 21 Apr 2017 12:31:07 +0200 To: qemu-devel@nongnu.org, qemu-trivial@nongnu.org X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 152.66.115.2 Subject: [Qemu-devel] [PATCH v6 11/13] sm501: Add some more missing registers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Magnus Damm , Aurelien Jarno , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Peter Maydell --- 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 v4: Add reset for all 2D engine registers (although these are documented to be 0 on reset, a comment in U-Boot source suggests that they are really undefined so the previous version might have been enoug= h) hw/display/sm501.c | 126 +++++++++++++++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 125 insertions(+), 1 deletion(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 8abac8f..851c7c8 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; =20 + 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; =20 static uint32_t get_local_mem_size_index(uint32_t size) @@ -946,6 +955,10 @@ static uint64_t sm501_disp_ctrl_read(void *opaque, hwa= ddr addr, ret =3D s->dc_panel_v_sync; break; =20 + case SM501_DC_VIDEO_CONTROL: + ret =3D s->dc_video_control; + break; + case SM501_DC_CRT_CONTROL: ret =3D s->dc_crt_control; break; @@ -1061,6 +1074,10 @@ static void sm501_disp_ctrl_write(void *opaque, hwad= dr addr, s->dc_panel_hwc_color_3 =3D value & 0x0000FFFF; break; =20 + case SM501_DC_VIDEO_CONTROL: + s->dc_video_control =3D value & 0x00037FFF; + break; + case SM501_DC_CRT_CONTROL: s->dc_crt_control =3D value & 0x0003FFFF; break; @@ -1133,9 +1150,69 @@ static uint64_t sm501_2d_engine_read(void *opaque, h= waddr addr, SM501_DPRINTF("sm501 2d engine regs : read addr=3D%x\n", (int)addr); =20 switch (addr) { + case SM501_2D_SOURCE: + ret =3D s->twoD_source; + break; + case SM501_2D_DESTINATION: + ret =3D s->twoD_destination; + break; + case SM501_2D_DIMENSION: + ret =3D s->twoD_dimension; + break; + case SM501_2D_CONTROL: + ret =3D s->twoD_control; + break; + case SM501_2D_PITCH: + ret =3D s->twoD_pitch; + break; + case SM501_2D_FOREGROUND: + ret =3D s->twoD_foreground; + break; + case SM501_2D_BACKGROUND: + ret =3D s->twoD_background; + break; + case SM501_2D_STRETCH: + ret =3D s->twoD_stretch; + break; + case SM501_2D_COLOR_COMPARE: + ret =3D s->twoD_color_compare; + break; + case SM501_2D_COLOR_COMPARE_MASK: + ret =3D s->twoD_color_compare_mask; + break; + case SM501_2D_MASK: + ret =3D s->twoD_mask; + break; + case SM501_2D_CLIP_TL: + ret =3D s->twoD_clip_tl; + break; + case SM501_2D_CLIP_BR: + ret =3D s->twoD_clip_br; + break; + case SM501_2D_MONO_PATTERN_LOW: + ret =3D s->twoD_mono_pattern_low; + break; + case SM501_2D_MONO_PATTERN_HIGH: + ret =3D s->twoD_mono_pattern_high; + break; + case SM501_2D_WINDOW_WIDTH: + ret =3D s->twoD_window_width; + break; case SM501_2D_SOURCE_BASE: ret =3D s->twoD_source_base; break; + case SM501_2D_DESTINATION_BASE: + ret =3D s->twoD_destination_base; + break; + case SM501_2D_ALPHA: + ret =3D s->twoD_alpha; + break; + case SM501_2D_WRAP: + ret =3D s->twoD_wrap; + break; + case SM501_2D_STATUS: + ret =3D 0; /* Should return interrupt status */ + break; default: printf("sm501 disp ctrl : not implemented register read." " addr=3D%x\n", (int)addr); @@ -1178,15 +1255,33 @@ static void sm501_2d_engine_write(void *opaque, hwa= ddr addr, case SM501_2D_FOREGROUND: s->twoD_foreground =3D value; break; + case SM501_2D_BACKGROUND: + s->twoD_background =3D value; + break; case SM501_2D_STRETCH: s->twoD_stretch =3D value; break; + case SM501_2D_COLOR_COMPARE: + s->twoD_color_compare =3D value; + break; case SM501_2D_COLOR_COMPARE_MASK: s->twoD_color_compare_mask =3D value; break; case SM501_2D_MASK: s->twoD_mask =3D value; break; + case SM501_2D_CLIP_TL: + s->twoD_clip_tl =3D value; + break; + case SM501_2D_CLIP_BR: + s->twoD_clip_br =3D value; + break; + case SM501_2D_MONO_PATTERN_LOW: + s->twoD_mono_pattern_low =3D value; + break; + case SM501_2D_MONO_PATTERN_HIGH: + s->twoD_mono_pattern_high =3D value; + break; case SM501_2D_WINDOW_WIDTH: s->twoD_window_width =3D value; break; @@ -1196,6 +1291,15 @@ static void sm501_2d_engine_write(void *opaque, hwad= dr addr, case SM501_2D_DESTINATION_BASE: s->twoD_destination_base =3D value; break; + case SM501_2D_ALPHA: + s->twoD_alpha =3D value; + break; + case SM501_2D_WRAP: + s->twoD_wrap =3D value; + break; + case SM501_2D_STATUS: + /* ignored, writing 0 should clear interrupt status */ + break; default: printf("sm501 2d engine : not implemented register write." " addr=3D%x, val=3D%x\n", (int)addr, (unsigned)value); @@ -1454,8 +1558,28 @@ static void sm501_reset(SM501State *s) s->misc_timing =3D 0; s->power_mode_control =3D 0; s->dc_panel_control =3D 0x00010000; /* FIFO level 3 */ + s->dc_video_control =3D 0; s->dc_crt_control =3D 0x00010000; + s->twoD_source =3D 0; + s->twoD_destination =3D 0; + s->twoD_dimension =3D 0; s->twoD_control =3D 0; + s->twoD_pitch =3D 0; + s->twoD_foreground =3D 0; + s->twoD_background =3D 0; + s->twoD_stretch =3D 0; + s->twoD_color_compare =3D 0; + s->twoD_color_compare_mask =3D 0; + s->twoD_mask =3D 0; + s->twoD_clip_tl =3D 0; + s->twoD_clip_br =3D 0; + s->twoD_mono_pattern_low =3D 0; + s->twoD_mono_pattern_high =3D 0; + s->twoD_window_width =3D 0; + s->twoD_source_base =3D 0; + s->twoD_destination_base =3D 0; + s->twoD_alpha =3D 0; + s->twoD_wrap =3D 0; } =20 static void sm501_init(SM501State *s, DeviceState *dev, --=20 2.7.4