From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165607825619986.26162100456145; Fri, 24 Jun 2022 06:44:16 -0700 (PDT) Received: from localhost ([::1]:47614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jbb-0002QT-19 for importer@patchew.org; Fri, 24 Jun 2022 09:44:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jYu-0006qH-Pd; Fri, 24 Jun 2022 09:41:28 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41568) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jYs-00051E-Ga; Fri, 24 Jun 2022 09:41:28 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jXX-00037t-WD; Fri, 24 Jun 2022 14:40:08 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=PzUSQdFUZIpK14vfiFRJJ+DrCAk0Khuuph/AiMQmkhk=; b=a/7rEOO5HjhgNc4BtLgaM+iR3M nZ4XphneLKF8lheKEsapdHvHgQXfJNCW4v7Lk9w1GEk/GFwuT7CgF9aWNtCHprDFi54WadjibKX+P H2eV39Mf10XCSSnBqxHXUGm0xOhSJslhFhLmlN9Mjg9EyWBX/ybKPafMoX4zGA/EM222NwBusw5B3 kXXYxfWL0m6Fh++eCLXruGY1NeHOG8zDMUwmwwF80EHtzifDVM9fwJCSJuzkaIlq8BEgOtBXuTgY4 CCZo95s6hJiaDUHT6rPDVROsxQHC7mhaZ8OrGgsiJS9dTcBF0TJTaTXXa8kYh34Ze/VfoRVC5NRhI 9NrImrFzaViO4k4jBd4Jy+di5erKUFI3kBZ+U0W65AeuD0YL+/VoGZqLcLtuO4yKiWN4+33yeaIT4 g9H38QSonBTeYetqIuQ/NPhhYp0Qp8LSEVwNrWtV9KsnExikoO4RMNdECQddMFMBdzSNE4J0lq/SP ySLdNN9lxLAEPFSajJfX12gQAHfAYfOefZj+xmz8+slsMQgvFBdqWg0cJlai/EcVx8/xT33hxv7f8 8leMM16JmdCUjxEc5Ctv+zh+q13Y6T5qHLkZ1xhwndGmuKPs5k/GDQv3z6BRoBrQQjFJNEMQxbnA/ 6mPzI9w9TiYMKpug50LGOzRtQrH7Wp5i70rpo/7gg=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:16 +0100 Message-Id: <20220624134109.881989-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 01/54] ps2: checkpatch fixes X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656078257220100001 Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/ps2.c | 154 +++++++++++++++++++++++++++---------------------- 1 file changed, 86 insertions(+), 68 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index c16df1de7a..67dd2eca84 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -34,41 +34,41 @@ #include "trace.h" =20 /* Keyboard Commands */ -#define KBD_CMD_SET_LEDS 0xED /* Set keyboard leds */ -#define KBD_CMD_ECHO 0xEE -#define KBD_CMD_SCANCODE 0xF0 /* Get/set scancode set */ -#define KBD_CMD_GET_ID 0xF2 /* get keyboard ID */ -#define KBD_CMD_SET_RATE 0xF3 /* Set typematic rate */ -#define KBD_CMD_ENABLE 0xF4 /* Enable scanning */ -#define KBD_CMD_RESET_DISABLE 0xF5 /* reset and disable scanning */ -#define KBD_CMD_RESET_ENABLE 0xF6 /* reset and enable scanning */ -#define KBD_CMD_RESET 0xFF /* Reset */ +#define KBD_CMD_SET_LEDS 0xED /* Set keyboard leds */ +#define KBD_CMD_ECHO 0xEE +#define KBD_CMD_SCANCODE 0xF0 /* Get/set scancode set */ +#define KBD_CMD_GET_ID 0xF2 /* get keyboard ID */ +#define KBD_CMD_SET_RATE 0xF3 /* Set typematic rate */ +#define KBD_CMD_ENABLE 0xF4 /* Enable scanning */ +#define KBD_CMD_RESET_DISABLE 0xF5 /* reset and disable scanning */ +#define KBD_CMD_RESET_ENABLE 0xF6 /* reset and enable scanning */ +#define KBD_CMD_RESET 0xFF /* Reset */ #define KBD_CMD_SET_MAKE_BREAK 0xFC /* Set Make and Break mode */ #define KBD_CMD_SET_TYPEMATIC 0xFA /* Set Typematic Make and Break mo= de */ =20 /* Keyboard Replies */ -#define KBD_REPLY_POR 0xAA /* Power on reset */ -#define KBD_REPLY_ID 0xAB /* Keyboard ID */ -#define KBD_REPLY_ACK 0xFA /* Command ACK */ -#define KBD_REPLY_RESEND 0xFE /* Command NACK, send the cmd again */ +#define KBD_REPLY_POR 0xAA /* Power on reset */ +#define KBD_REPLY_ID 0xAB /* Keyboard ID */ +#define KBD_REPLY_ACK 0xFA /* Command ACK */ +#define KBD_REPLY_RESEND 0xFE /* Command NACK, send the cmd again */ =20 /* Mouse Commands */ -#define AUX_SET_SCALE11 0xE6 /* Set 1:1 scaling */ -#define AUX_SET_SCALE21 0xE7 /* Set 2:1 scaling */ -#define AUX_SET_RES 0xE8 /* Set resolution */ -#define AUX_GET_SCALE 0xE9 /* Get scaling factor */ -#define AUX_SET_STREAM 0xEA /* Set stream mode */ -#define AUX_POLL 0xEB /* Poll */ -#define AUX_RESET_WRAP 0xEC /* Reset wrap mode */ -#define AUX_SET_WRAP 0xEE /* Set wrap mode */ -#define AUX_SET_REMOTE 0xF0 /* Set remote mode */ -#define AUX_GET_TYPE 0xF2 /* Get type */ -#define AUX_SET_SAMPLE 0xF3 /* Set sample rate */ -#define AUX_ENABLE_DEV 0xF4 /* Enable aux device */ -#define AUX_DISABLE_DEV 0xF5 /* Disable aux device */ -#define AUX_SET_DEFAULT 0xF6 -#define AUX_RESET 0xFF /* Reset aux device */ -#define AUX_ACK 0xFA /* Command byte ACK. */ +#define AUX_SET_SCALE11 0xE6 /* Set 1:1 scaling */ +#define AUX_SET_SCALE21 0xE7 /* Set 2:1 scaling */ +#define AUX_SET_RES 0xE8 /* Set resolution */ +#define AUX_GET_SCALE 0xE9 /* Get scaling factor */ +#define AUX_SET_STREAM 0xEA /* Set stream mode */ +#define AUX_POLL 0xEB /* Poll */ +#define AUX_RESET_WRAP 0xEC /* Reset wrap mode */ +#define AUX_SET_WRAP 0xEE /* Set wrap mode */ +#define AUX_SET_REMOTE 0xF0 /* Set remote mode */ +#define AUX_GET_TYPE 0xF2 /* Get type */ +#define AUX_SET_SAMPLE 0xF3 /* Set sample rate */ +#define AUX_ENABLE_DEV 0xF4 /* Enable aux device */ +#define AUX_DISABLE_DEV 0xF5 /* Disable aux device */ +#define AUX_SET_DEFAULT 0xF6 +#define AUX_RESET 0xFF /* Reset aux device */ +#define AUX_ACK 0xFA /* Command byte ACK. */ =20 #define MOUSE_STATUS_REMOTE 0x40 #define MOUSE_STATUS_ENABLED 0x20 @@ -436,8 +436,9 @@ static void ps2_keyboard_event(DeviceState *dev, QemuCo= nsole *src, } } } else { - if (qcode < qemu_input_map_qcode_to_atset1_len) + if (qcode < qemu_input_map_qcode_to_atset1_len) { keycode =3D qemu_input_map_qcode_to_atset1[qcode]; + } if (keycode) { if (keycode & 0xff00) { ps2_put_keycode(s, keycode >> 8); @@ -530,8 +531,9 @@ static void ps2_keyboard_event(DeviceState *dev, QemuCo= nsole *src, } } } else { - if (qcode < qemu_input_map_qcode_to_atset2_len) + if (qcode < qemu_input_map_qcode_to_atset2_len) { keycode =3D qemu_input_map_qcode_to_atset2[qcode]; + } if (keycode) { if (keycode & 0xff00) { ps2_put_keycode(s, keycode >> 8); @@ -546,8 +548,9 @@ static void ps2_keyboard_event(DeviceState *dev, QemuCo= nsole *src, } } } else if (s->scancode_set =3D=3D 3) { - if (qcode < qemu_input_map_qcode_to_atset3_len) + if (qcode < qemu_input_map_qcode_to_atset3_len) { keycode =3D qemu_input_map_qcode_to_atset3[qcode]; + } if (keycode) { /* FIXME: break code should be configured on a key by key basi= s */ if (!key->down) { @@ -569,8 +572,10 @@ uint32_t ps2_read_data(PS2State *s) trace_ps2_read_data(s); q =3D &s->queue; if (q->count =3D=3D 0) { - /* NOTE: if no data left, we return the last keyboard one - (needed for EMM386) */ + /* + * NOTE: if no data left, we return the last keyboard one + * (needed for EMM386) + */ /* XXX: need a timer to do things correctly */ index =3D q->rptr - 1; if (index < 0) { @@ -619,10 +624,10 @@ void ps2_write_keyboard(void *opaque, int val) =20 trace_ps2_write_keyboard(opaque, val); ps2_cqueue_reset(&s->common); - switch(s->common.write_cmd) { + switch (s->common.write_cmd) { default: case -1: - switch(val) { + switch (val) { case 0x00: ps2_cqueue_1(&s->common, KBD_REPLY_ACK); break; @@ -632,7 +637,7 @@ void ps2_write_keyboard(void *opaque, int val) case KBD_CMD_GET_ID: /* We emulate a MF2 AT keyboard here */ ps2_cqueue_3(&s->common, KBD_REPLY_ACK, KBD_REPLY_ID, - s->translate ? 0x41 : 0x83); + s->translate ? 0x41 : 0x83); break; case KBD_CMD_ECHO: ps2_cqueue_1(&s->common, KBD_CMD_ECHO); @@ -661,8 +666,8 @@ void ps2_write_keyboard(void *opaque, int val) case KBD_CMD_RESET: ps2_reset_keyboard(s); ps2_cqueue_2(&s->common, - KBD_REPLY_ACK, - KBD_REPLY_POR); + KBD_REPLY_ACK, + KBD_REPLY_POR); break; case KBD_CMD_SET_TYPEMATIC: ps2_cqueue_1(&s->common, KBD_REPLY_ACK); @@ -700,9 +705,11 @@ void ps2_write_keyboard(void *opaque, int val) } } =20 -/* Set the scancode translation mode. - 0 =3D raw scancodes. - 1 =3D translated scancodes (used by qemu internally). */ +/* + * Set the scancode translation mode. + * 0 =3D raw scancodes. + * 1 =3D translated scancodes (used by qemu internally). + */ =20 void ps2_keyboard_set_translation(void *opaque, int mode) { @@ -727,30 +734,33 @@ static int ps2_mouse_send_packet(PS2MouseState *s) dz1 =3D s->mouse_dz; dw1 =3D s->mouse_dw; /* XXX: increase range to 8 bits ? */ - if (dx1 > 127) + if (dx1 > 127) { dx1 =3D 127; - else if (dx1 < -127) + } else if (dx1 < -127) { dx1 =3D -127; - if (dy1 > 127) + } + if (dy1 > 127) { dy1 =3D 127; - else if (dy1 < -127) + } else if (dy1 < -127) { dy1 =3D -127; + } b =3D 0x08 | ((dx1 < 0) << 4) | ((dy1 < 0) << 5) | (s->mouse_buttons &= 0x07); ps2_queue_noirq(&s->common, b); ps2_queue_noirq(&s->common, dx1 & 0xff); ps2_queue_noirq(&s->common, dy1 & 0xff); /* extra byte for IMPS/2 or IMEX */ - switch(s->mouse_type) { + switch (s->mouse_type) { default: /* Just ignore the wheels if not supported */ s->mouse_dz =3D 0; s->mouse_dw =3D 0; break; case 3: - if (dz1 > 127) + if (dz1 > 127) { dz1 =3D 127; - else if (dz1 < -127) - dz1 =3D -127; + } else if (dz1 < -127) { + dz1 =3D -127; + } ps2_queue_noirq(&s->common, dz1 & 0xff); s->mouse_dz -=3D dz1; s->mouse_dw =3D 0; @@ -816,8 +826,9 @@ static void ps2_mouse_event(DeviceState *dev, QemuConso= le *src, InputBtnEvent *btn; =20 /* check if deltas are recorded when disabled */ - if (!(s->mouse_status & MOUSE_STATUS_ENABLED)) + if (!(s->mouse_status & MOUSE_STATUS_ENABLED)) { return; + } =20 switch (evt->type) { case INPUT_EVENT_KIND_REL: @@ -868,8 +879,10 @@ static void ps2_mouse_sync(DeviceState *dev) qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL); } if (!(s->mouse_status & MOUSE_STATUS_REMOTE)) { - /* if not remote, send event. Multiple events are sent if - too big deltas */ + /* + * if not remote, send event. Multiple events are sent if + * too big deltas + */ while (ps2_mouse_send_packet(s)) { if (s->mouse_dx =3D=3D 0 && s->mouse_dy =3D=3D 0 && s->mouse_dz =3D=3D 0 && s->mouse_dw =3D=3D 0) { @@ -892,7 +905,7 @@ void ps2_write_mouse(void *opaque, int val) PS2MouseState *s =3D (PS2MouseState *)opaque; =20 trace_ps2_write_mouse(opaque, val); - switch(s->common.write_cmd) { + switch (s->common.write_cmd) { default: case -1: /* mouse command */ @@ -906,7 +919,7 @@ void ps2_write_mouse(void *opaque, int val) return; } } - switch(val) { + switch (val) { case AUX_SET_SCALE11: s->mouse_status &=3D ~MOUSE_STATUS_SCALE21; ps2_queue(&s->common, AUX_ACK); @@ -980,28 +993,32 @@ void ps2_write_mouse(void *opaque, int val) case AUX_SET_SAMPLE: s->mouse_sample_rate =3D val; /* detect IMPS/2 or IMEX */ - switch(s->mouse_detect_state) { + switch (s->mouse_detect_state) { default: case 0: - if (val =3D=3D 200) + if (val =3D=3D 200) { s->mouse_detect_state =3D 1; + } break; case 1: - if (val =3D=3D 100) + if (val =3D=3D 100) { s->mouse_detect_state =3D 2; - else if (val =3D=3D 200) + } else if (val =3D=3D 200) { s->mouse_detect_state =3D 3; - else + } else { s->mouse_detect_state =3D 0; + } break; case 2: - if (val =3D=3D 80) + if (val =3D=3D 80) { s->mouse_type =3D 3; /* IMPS/2 */ + } s->mouse_detect_state =3D 0; break; case 3: - if (val =3D=3D 80) + if (val =3D=3D 80) { s->mouse_type =3D 4; /* IMEX */ + } s->mouse_detect_state =3D 0; break; } @@ -1154,13 +1171,14 @@ static const VMStateDescription vmstate_ps2_keyboar= d_cqueue =3D { } }; =20 -static int ps2_kbd_post_load(void* opaque, int version_id) +static int ps2_kbd_post_load(void *opaque, int version_id) { - PS2KbdState *s =3D (PS2KbdState*)opaque; + PS2KbdState *s =3D (PS2KbdState *)opaque; PS2State *ps2 =3D &s->common; =20 - if (version_id =3D=3D 2) - s->scancode_set=3D2; + if (version_id =3D=3D 2) { + s->scancode_set =3D 2; + } =20 ps2_common_post_load(ps2); =20 @@ -1176,10 +1194,10 @@ static const VMStateDescription vmstate_ps2_keyboar= d =3D { VMSTATE_STRUCT(common, PS2KbdState, 0, vmstate_ps2_common, PS2Stat= e), VMSTATE_INT32(scan_enabled, PS2KbdState), VMSTATE_INT32(translate, PS2KbdState), - VMSTATE_INT32_V(scancode_set, PS2KbdState,3), + VMSTATE_INT32_V(scancode_set, PS2KbdState, 3), VMSTATE_END_OF_LIST() }, - .subsections =3D (const VMStateDescription*[]) { + .subsections =3D (const VMStateDescription * []) { &vmstate_ps2_keyboard_ledstate, &vmstate_ps2_keyboard_need_high_bit, &vmstate_ps2_keyboard_cqueue, --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656078232479396.0049729990177; Fri, 24 Jun 2022 06:43:52 -0700 (PDT) Received: from localhost ([::1]:47002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jbD-00020a-8J for importer@patchew.org; Fri, 24 Jun 2022 09:43:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37836) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jYy-0006xz-4s; Fri, 24 Jun 2022 09:41:32 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41586) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jYw-00052Z-HF; Fri, 24 Jun 2022 09:41:31 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jXc-00037t-Dm; Fri, 24 Jun 2022 14:40:12 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=lfDuz37fOMUqZYiLyRe+MhEJbnef/mqksNzkVOXSL/M=; b=UdGEALOrXq2AhFK8uWNpWkjEEs Op3yT2+MO4pCe0GJgTGzEtK64U0IcMi5fi6c0DETqTjzCLk5pzz4bT+hL1BV/zBJShyrrYaos5OH6 iSHeqpKNSBNF1U/qhJALUw7VE4i9Deth1V18dTym0rwU8YBCJ4DyTI7iD4DIWdUc+M3o4hmFnuSki H97hhPJer8JShGc9cgeCm+ZwE67VyAlogEt1H5vRcjcefK0nGOY2MZIFt2TpfwO9D2z55rkl5ncrp jSGWhGkj5PnG8J/uqGXhaqXozojdIbFbXtX28Mx4SpF9Hm6/oQcaK2o6GL5eaPvu4cNHgb+AmfI95 qwkUs+azU1EgOpq5qi86GAGziRf7l4hHfEvuk0rgu/tL3LUsibnjh0d9XHPLQ71EzB5L7TP3+h0uS uwv7mJ2hGOK1coLze6++mbAGGLXnoQCTPnSfKZx0SXkAOMBnq2LoOlLD4PhCWOxgrUrOA/rR2jhd5 Xh9Hw4RTRpsZlUiI8xY7qYWI9rSV5WDWUl0xZNxOWgEHfyjpvkOpuZ5zeZRvLrDEQ4HBMep7RCuQX L07ZcfWHKBvj1CctfkOHtcCtbYHqUCtR7CZJQiRxy1jBri0yZ/Kbmzshemf6HsTKwcl687AsZcwvI oZJQaLjSwxdl8sQ/gRShf9ybRKhR1Bi6vQVBZ55LI=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:17 +0100 Message-Id: <20220624134109.881989-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 02/54] ps2: QOMify PS2State X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656078233179100001 Make PS2State a new abstract PS2_DEVICE QOM type to represent the common functionality shared between PS2 keyboard and mouse devices. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/ps2.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 67dd2eca84..514e55cbb6 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -24,6 +24,7 @@ =20 #include "qemu/osdep.h" #include "qemu/log.h" +#include "hw/sysbus.h" #include "hw/input/ps2.h" #include "migration/vmstate.h" #include "ui/console.h" @@ -96,12 +97,17 @@ typedef struct { } PS2Queue; =20 struct PS2State { + SysBusDevice parent_obj; + PS2Queue queue; int32_t write_cmd; void (*update_irq)(void *, int); void *update_arg; }; =20 +#define TYPE_PS2_DEVICE "ps2-device" +OBJECT_DECLARE_SIMPLE_TYPE(PS2State, PS2_DEVICE) + typedef struct { PS2State common; int scan_enabled; @@ -1277,3 +1283,25 @@ void *ps2_mouse_init(void (*update_irq)(void *, int)= , void *update_arg) qemu_register_reset(ps2_mouse_reset, s); return s; } + +static void ps2_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); +} + +static const TypeInfo ps2_info =3D { + .name =3D TYPE_PS2_DEVICE, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(PS2State), + .class_init =3D ps2_class_init, + .abstract =3D true +}; + +static void ps2_register_types(void) +{ + type_register_static(&ps2_info); +} + +type_init(ps2_register_types) --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656078577434865.3464801571924; Fri, 24 Jun 2022 06:49:37 -0700 (PDT) Received: from localhost ([::1]:55124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jgm-00083r-7e for importer@patchew.org; Fri, 24 Jun 2022 09:49:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZ4-0007A0-SY; Fri, 24 Jun 2022 09:41:38 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41604) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZ0-00054B-98; Fri, 24 Jun 2022 09:41:37 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jXg-00037t-OI; Fri, 24 Jun 2022 14:40:16 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=mvAJZ4P5Q1iTQxoa3SmGf3mWyoKSkskxl1Q/JBJZB9I=; b=hOGBR4QzebBIemSFl4nKcIyouB 0MKrveDmekyIHhe8+paYJVkgGyqVBWmooPFFMcALszRNn0evk+aZe2K3Oh81M7N0y91PoCK8JdK8T AUqUHfkFIFNNFsOG3X+aKfYJzkTaOzY7eWVyGs0UwVmdegXza3/OfNNQMb6+5+V+YvRXOIdbRTfDm VxOKhMOEuHuy089gozV1zPY2s8g0lAaEpj1Pd/DeIkRxh1KPiiEaUk7NUpte+suqJ4Uf/eiJmwEkc Zt92OXc6eJyYps4LFYseVmfDbqB8QG5vdfKFZetzLlgst97I3rLAulqd/r9EGKNIp46UO2ONObdZB +wZ0dR5rSp3faMz/vn186ae8fyZObyBBT5hXRCOJzhuv6n2RzT8z2BoDKA1c7zMqoVC4hXDmhrMNj g5+07IvpxjdY0JMa5nNeVyFAKXSFr7foD6L+5McY+Bl6p+gvqFeSVRlvxYGZIXj89GH8Xf97XfT13 k11MR2BP5ZGXO+TS5Lmibu7D61kE7XjQNakfH/vSVPE6qaZshwjwD6z/SZNeQCZ4L+oN3YHPepFPu Gw+O2IJ80plxb0xQIjNToB3W9fWI99CVo69mHXyG9Pj8MT8bwKeiB5DEPP3EMiL4+5VeYtli6VA7S 8LbvjoefoHuA7QYIzzJHf5NWkzOws4ToYkx2tuIXc=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:18 +0100 Message-Id: <20220624134109.881989-4-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 03/54] ps2: QOMify PS2KbdState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656078579221100001 Make PS2KbdState into a new PS2_KBD_DEVICE QOM type which inherits from the abstract PS2_DEVICE type. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/ps2.c | 104 ++++++++++++++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 39 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 514e55cbb6..14eb777c3f 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -31,6 +31,7 @@ #include "ui/input.h" #include "sysemu/reset.h" #include "sysemu/runstate.h" +#include "qapi/error.h" =20 #include "trace.h" =20 @@ -108,15 +109,19 @@ struct PS2State { #define TYPE_PS2_DEVICE "ps2-device" OBJECT_DECLARE_SIMPLE_TYPE(PS2State, PS2_DEVICE) =20 -typedef struct { - PS2State common; +struct PS2KbdState { + PS2State parent_obj; + int scan_enabled; int translate; int scancode_set; /* 1=3DXT, 2=3DAT, 3=3DPS/2 */ int ledstate; bool need_high_bit; unsigned int modifiers; /* bitmask of MOD_* constants above */ -} PS2KbdState; +}; + +#define TYPE_PS2_KBD_DEVICE "ps2-kbd" +OBJECT_DECLARE_SIMPLE_TYPE(PS2KbdState, PS2_KBD_DEVICE) =20 typedef struct { PS2State common; @@ -330,6 +335,7 @@ static void ps2_cqueue_reset(PS2State *s) static void ps2_put_keycode(void *opaque, int keycode) { PS2KbdState *s =3D opaque; + PS2State *ps =3D PS2_DEVICE(s); =20 trace_ps2_put_keycode(opaque, keycode); qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL); @@ -338,13 +344,13 @@ static void ps2_put_keycode(void *opaque, int keycode) if (keycode =3D=3D 0xf0) { s->need_high_bit =3D true; } else if (s->need_high_bit) { - ps2_queue(&s->common, translate_table[keycode] | 0x80); + ps2_queue(ps, translate_table[keycode] | 0x80); s->need_high_bit =3D false; } else { - ps2_queue(&s->common, translate_table[keycode]); + ps2_queue(ps, translate_table[keycode]); } } else { - ps2_queue(&s->common, keycode); + ps2_queue(ps, keycode); } } =20 @@ -617,96 +623,99 @@ static void ps2_set_ledstate(PS2KbdState *s, int leds= tate) =20 static void ps2_reset_keyboard(PS2KbdState *s) { + PS2State *ps2 =3D PS2_DEVICE(s); + trace_ps2_reset_keyboard(s); s->scan_enabled =3D 1; s->scancode_set =3D 2; - ps2_reset_queue(&s->common); + ps2_reset_queue(ps2); ps2_set_ledstate(s, 0); } =20 void ps2_write_keyboard(void *opaque, int val) { PS2KbdState *s =3D (PS2KbdState *)opaque; + PS2State *ps2 =3D PS2_DEVICE(s); =20 trace_ps2_write_keyboard(opaque, val); - ps2_cqueue_reset(&s->common); - switch (s->common.write_cmd) { + ps2_cqueue_reset(ps2); + switch (ps2->write_cmd) { default: case -1: switch (val) { case 0x00: - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); + ps2_cqueue_1(ps2, KBD_REPLY_ACK); break; case 0x05: - ps2_cqueue_1(&s->common, KBD_REPLY_RESEND); + ps2_cqueue_1(ps2, KBD_REPLY_RESEND); break; case KBD_CMD_GET_ID: /* We emulate a MF2 AT keyboard here */ - ps2_cqueue_3(&s->common, KBD_REPLY_ACK, KBD_REPLY_ID, + ps2_cqueue_3(ps2, KBD_REPLY_ACK, KBD_REPLY_ID, s->translate ? 0x41 : 0x83); break; case KBD_CMD_ECHO: - ps2_cqueue_1(&s->common, KBD_CMD_ECHO); + ps2_cqueue_1(ps2, KBD_CMD_ECHO); break; case KBD_CMD_ENABLE: s->scan_enabled =3D 1; - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); + ps2_cqueue_1(ps2, KBD_REPLY_ACK); break; case KBD_CMD_SCANCODE: case KBD_CMD_SET_LEDS: case KBD_CMD_SET_RATE: case KBD_CMD_SET_MAKE_BREAK: - s->common.write_cmd =3D val; - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); + ps2->write_cmd =3D val; + ps2_cqueue_1(ps2, KBD_REPLY_ACK); break; case KBD_CMD_RESET_DISABLE: ps2_reset_keyboard(s); s->scan_enabled =3D 0; - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); + ps2_cqueue_1(ps2, KBD_REPLY_ACK); break; case KBD_CMD_RESET_ENABLE: ps2_reset_keyboard(s); s->scan_enabled =3D 1; - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); + ps2_cqueue_1(ps2, KBD_REPLY_ACK); break; case KBD_CMD_RESET: ps2_reset_keyboard(s); - ps2_cqueue_2(&s->common, + ps2_cqueue_2(ps2, KBD_REPLY_ACK, KBD_REPLY_POR); break; case KBD_CMD_SET_TYPEMATIC: - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); + ps2_cqueue_1(ps2, KBD_REPLY_ACK); break; default: - ps2_cqueue_1(&s->common, KBD_REPLY_RESEND); + ps2_cqueue_1(ps2, KBD_REPLY_RESEND); break; } break; case KBD_CMD_SET_MAKE_BREAK: - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); - s->common.write_cmd =3D -1; + ps2_cqueue_1(ps2, KBD_REPLY_ACK); + ps2->write_cmd =3D -1; break; case KBD_CMD_SCANCODE: if (val =3D=3D 0) { - ps2_cqueue_2(&s->common, KBD_REPLY_ACK, s->translate ? + ps2_cqueue_2(ps2, KBD_REPLY_ACK, s->translate ? translate_table[s->scancode_set] : s->scancode_set); } else if (val >=3D 1 && val <=3D 3) { s->scancode_set =3D val; - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); + ps2_cqueue_1(ps2, KBD_REPLY_ACK); } else { - ps2_cqueue_1(&s->common, KBD_REPLY_RESEND); + ps2_cqueue_1(ps2, KBD_REPLY_RESEND); } - s->common.write_cmd =3D -1; + ps2->write_cmd =3D -1; break; case KBD_CMD_SET_LEDS: ps2_set_ledstate(s, val); - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); - s->common.write_cmd =3D -1; + ps2_cqueue_1(ps2, KBD_REPLY_ACK); + ps2->write_cmd =3D -1; break; case KBD_CMD_SET_RATE: - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); - s->common.write_cmd =3D -1; + ps2_cqueue_1(ps2, KBD_REPLY_ACK); + ps2->write_cmd =3D -1; break; } } @@ -1075,9 +1084,10 @@ static void ps2_common_post_load(PS2State *s) static void ps2_kbd_reset(void *opaque) { PS2KbdState *s =3D (PS2KbdState *) opaque; + PS2State *ps2 =3D PS2_DEVICE(s); =20 trace_ps2_kbd_reset(opaque); - ps2_common_reset(&s->common); + ps2_common_reset(ps2); s->scan_enabled =3D 1; s->translate =3D 0; s->scancode_set =3D 2; @@ -1164,15 +1174,16 @@ static const VMStateDescription vmstate_ps2_keyboar= d_need_high_bit =3D { static bool ps2_keyboard_cqueue_needed(void *opaque) { PS2KbdState *s =3D opaque; + PS2State *ps2 =3D PS2_DEVICE(s); =20 - return s->common.queue.cwptr !=3D -1; /* the queue is mostly empty */ + return ps2->queue.cwptr !=3D -1; /* the queue is mostly empty */ } =20 static const VMStateDescription vmstate_ps2_keyboard_cqueue =3D { .name =3D "ps2kbd/command_reply_queue", .needed =3D ps2_keyboard_cqueue_needed, .fields =3D (VMStateField[]) { - VMSTATE_INT32(common.queue.cwptr, PS2KbdState), + VMSTATE_INT32(parent_obj.queue.cwptr, PS2KbdState), VMSTATE_END_OF_LIST() } }; @@ -1180,7 +1191,7 @@ static const VMStateDescription vmstate_ps2_keyboard_= cqueue =3D { static int ps2_kbd_post_load(void *opaque, int version_id) { PS2KbdState *s =3D (PS2KbdState *)opaque; - PS2State *ps2 =3D &s->common; + PS2State *ps2 =3D PS2_DEVICE(s); =20 if (version_id =3D=3D 2) { s->scancode_set =3D 2; @@ -1197,7 +1208,8 @@ static const VMStateDescription vmstate_ps2_keyboard = =3D { .minimum_version_id =3D 2, .post_load =3D ps2_kbd_post_load, .fields =3D (VMStateField[]) { - VMSTATE_STRUCT(common, PS2KbdState, 0, vmstate_ps2_common, PS2Stat= e), + VMSTATE_STRUCT(parent_obj, PS2KbdState, 0, vmstate_ps2_common, + PS2State), VMSTATE_INT32(scan_enabled, PS2KbdState), VMSTATE_INT32(translate, PS2KbdState), VMSTATE_INT32_V(scancode_set, PS2KbdState, 3), @@ -1250,11 +1262,18 @@ static QemuInputHandler ps2_keyboard_handler =3D { =20 void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) { - PS2KbdState *s =3D g_new0(PS2KbdState, 1); + DeviceState *dev; + PS2KbdState *s; + PS2State *ps2; + + dev =3D qdev_new(TYPE_PS2_KBD_DEVICE); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + s =3D PS2_KBD_DEVICE(dev); + ps2 =3D PS2_DEVICE(s); =20 trace_ps2_kbd_init(s); - s->common.update_irq =3D update_irq; - s->common.update_arg =3D update_arg; + ps2->update_irq =3D update_irq; + ps2->update_arg =3D update_arg; s->scancode_set =3D 2; vmstate_register(NULL, 0, &vmstate_ps2_keyboard, s); qemu_input_handler_register((DeviceState *)s, @@ -1284,6 +1303,12 @@ void *ps2_mouse_init(void (*update_irq)(void *, int)= , void *update_arg) return s; } =20 +static const TypeInfo ps2_kbd_info =3D { + .name =3D TYPE_PS2_KBD_DEVICE, + .parent =3D TYPE_PS2_DEVICE, + .instance_size =3D sizeof(PS2KbdState), +}; + static void ps2_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -1302,6 +1327,7 @@ static const TypeInfo ps2_info =3D { static void ps2_register_types(void) { type_register_static(&ps2_info); + type_register_static(&ps2_kbd_info); } =20 type_init(ps2_register_types) --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656078648418369.0151908744547; Fri, 24 Jun 2022 06:50:48 -0700 (PDT) Received: from localhost ([::1]:57692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jhv-0001RY-3r for importer@patchew.org; Fri, 24 Jun 2022 09:50:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZ8-0007Gy-Cy; Fri, 24 Jun 2022 09:41:42 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41620) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZ4-00054q-VG; Fri, 24 Jun 2022 09:41:42 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jXl-00037t-5o; Fri, 24 Jun 2022 14:40:20 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=P/QxeLVFrVFIIytGO8/JUWfe6AUHvXqI9Vy+r4Gi+ug=; b=GmsA0MnuOoVL22JworLEBkZi6b m/iEWSi6xnDyDLqKzcPxNCK9WS7XxUrLjgr3dclueJofpwEuHY3zyr9jsB6BHMDReYTgHgmF6A1vZ ZWo6TsU5S9SEsx745dQE9S5g7R//GiPz9AaOq18UJmVa2yAbhw5whGiYtw4Hci/lC4O/9D+nFq4/a o5ywTptAKAVvDLZcIKhSk0jCyoLidwWcE8NHvg3BGlcri7gdwQMc1luw9WE2JhuLd9llV75YcEBRw imbPnDJOjE5k9wGqAski9awS1cmVGGkgQrvqG/HuvAsAtq9qbmAIEvn7OdosUhP6WtO51HN4IskzR UQy33DTll9PvFPC9VM3GL4g/vB8AzzVplLEWATM2a1rrRD36EbR/z4ueSeGCuUlSxYpN1W0Q3rWYT fYQxauyTph9MTMBO3BQca2vF6my9bCDjO5qdeSrBAfVWlDuv70xgEpRNW8oS/gbETIFSZcIrwnlIm 6VGX1WWDb5ywYV/V26s667Ouop70a1Qa8ALexojrMjmL0vP+jfkHvqFU7W0ATOKj5JLUFhQvK7nI1 TzkPxRCCFhdP40jtGrRSNXNVT2P4IsJh/c+pM9PbVPFoShM6wq1trIos8htajyGRg9oMYJqZdQoK1 lCATDmi3kwmf+uChjva0iPa3xr3GZq60x6dSU/CYE=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:19 +0100 Message-Id: <20220624134109.881989-5-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 04/54] ps2: QOMify PS2MouseState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656078649397100001 Make PS2MouseState into a new PS2_MOUSE_DEVICE QOM type which inherits from= the abstract PS2_DEVICE type. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/ps2.c | 98 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 60 insertions(+), 38 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 14eb777c3f..ee7c36d4f2 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -123,8 +123,9 @@ struct PS2KbdState { #define TYPE_PS2_KBD_DEVICE "ps2-kbd" OBJECT_DECLARE_SIMPLE_TYPE(PS2KbdState, PS2_KBD_DEVICE) =20 -typedef struct { - PS2State common; +struct PS2MouseState { + PS2State parent_obj; + uint8_t mouse_status; uint8_t mouse_resolution; uint8_t mouse_sample_rate; @@ -136,7 +137,10 @@ typedef struct { int mouse_dz; int mouse_dw; uint8_t mouse_buttons; -} PS2MouseState; +}; + +#define TYPE_PS2_MOUSE_DEVICE "ps2-mouse" +OBJECT_DECLARE_SIMPLE_TYPE(PS2MouseState, PS2_MOUSE_DEVICE) =20 static uint8_t translate_table[256] =3D { 0xff, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x3c, 0x58, @@ -735,12 +739,13 @@ void ps2_keyboard_set_translation(void *opaque, int m= ode) =20 static int ps2_mouse_send_packet(PS2MouseState *s) { + PS2State *ps2 =3D PS2_DEVICE(s); /* IMPS/2 and IMEX send 4 bytes, PS2 sends 3 bytes */ const int needed =3D s->mouse_type ? 4 : 3; unsigned int b; int dx1, dy1, dz1, dw1; =20 - if (PS2_QUEUE_SIZE - s->common.queue.count < needed) { + if (PS2_QUEUE_SIZE - ps2->queue.count < needed) { return 0; } =20 @@ -760,9 +765,9 @@ static int ps2_mouse_send_packet(PS2MouseState *s) dy1 =3D -127; } b =3D 0x08 | ((dx1 < 0) << 4) | ((dy1 < 0) << 5) | (s->mouse_buttons &= 0x07); - ps2_queue_noirq(&s->common, b); - ps2_queue_noirq(&s->common, dx1 & 0xff); - ps2_queue_noirq(&s->common, dy1 & 0xff); + ps2_queue_noirq(ps2, b); + ps2_queue_noirq(ps2, dx1 & 0xff); + ps2_queue_noirq(ps2, dy1 & 0xff); /* extra byte for IMPS/2 or IMEX */ switch (s->mouse_type) { default: @@ -776,7 +781,7 @@ static int ps2_mouse_send_packet(PS2MouseState *s) } else if (dz1 < -127) { dz1 =3D -127; } - ps2_queue_noirq(&s->common, dz1 & 0xff); + ps2_queue_noirq(ps2, dz1 & 0xff); s->mouse_dz -=3D dz1; s->mouse_dw =3D 0; break; @@ -812,11 +817,11 @@ static int ps2_mouse_send_packet(PS2MouseState *s) b =3D (dz1 & 0x0f) | ((s->mouse_buttons & 0x18) << 1); s->mouse_dz -=3D dz1; } - ps2_queue_noirq(&s->common, b); + ps2_queue_noirq(ps2, b); break; } =20 - ps2_raise_irq(&s->common); + ps2_raise_irq(ps2); =20 trace_ps2_mouse_send_packet(s, dx1, dy1, dz1, b); /* update deltas */ @@ -918,85 +923,86 @@ void ps2_mouse_fake_event(void *opaque) void ps2_write_mouse(void *opaque, int val) { PS2MouseState *s =3D (PS2MouseState *)opaque; + PS2State *ps2 =3D PS2_DEVICE(s); =20 trace_ps2_write_mouse(opaque, val); - switch (s->common.write_cmd) { + switch (ps2->write_cmd) { default: case -1: /* mouse command */ if (s->mouse_wrap) { if (val =3D=3D AUX_RESET_WRAP) { s->mouse_wrap =3D 0; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); return; } else if (val !=3D AUX_RESET) { - ps2_queue(&s->common, val); + ps2_queue(ps2, val); return; } } switch (val) { case AUX_SET_SCALE11: s->mouse_status &=3D ~MOUSE_STATUS_SCALE21; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_SET_SCALE21: s->mouse_status |=3D MOUSE_STATUS_SCALE21; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_SET_STREAM: s->mouse_status &=3D ~MOUSE_STATUS_REMOTE; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_SET_WRAP: s->mouse_wrap =3D 1; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_SET_REMOTE: s->mouse_status |=3D MOUSE_STATUS_REMOTE; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_GET_TYPE: - ps2_queue_2(&s->common, + ps2_queue_2(ps2, AUX_ACK, s->mouse_type); break; case AUX_SET_RES: case AUX_SET_SAMPLE: - s->common.write_cmd =3D val; - ps2_queue(&s->common, AUX_ACK); + ps2->write_cmd =3D val; + ps2_queue(ps2, AUX_ACK); break; case AUX_GET_SCALE: - ps2_queue_4(&s->common, + ps2_queue_4(ps2, AUX_ACK, s->mouse_status, s->mouse_resolution, s->mouse_sample_rate); break; case AUX_POLL: - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); ps2_mouse_send_packet(s); break; case AUX_ENABLE_DEV: s->mouse_status |=3D MOUSE_STATUS_ENABLED; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_DISABLE_DEV: s->mouse_status &=3D ~MOUSE_STATUS_ENABLED; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_SET_DEFAULT: s->mouse_sample_rate =3D 100; s->mouse_resolution =3D 2; s->mouse_status =3D 0; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_RESET: s->mouse_sample_rate =3D 100; s->mouse_resolution =3D 2; s->mouse_status =3D 0; s->mouse_type =3D 0; - ps2_reset_queue(&s->common); - ps2_queue_3(&s->common, + ps2_reset_queue(ps2); + ps2_queue_3(ps2, AUX_ACK, 0xaa, s->mouse_type); @@ -1037,13 +1043,13 @@ void ps2_write_mouse(void *opaque, int val) s->mouse_detect_state =3D 0; break; } - ps2_queue(&s->common, AUX_ACK); - s->common.write_cmd =3D -1; + ps2_queue(ps2, AUX_ACK); + ps2->write_cmd =3D -1; break; case AUX_SET_RES: s->mouse_resolution =3D val; - ps2_queue(&s->common, AUX_ACK); - s->common.write_cmd =3D -1; + ps2_queue(ps2, AUX_ACK); + ps2->write_cmd =3D -1; break; } } @@ -1097,9 +1103,10 @@ static void ps2_kbd_reset(void *opaque) static void ps2_mouse_reset(void *opaque) { PS2MouseState *s =3D (PS2MouseState *) opaque; + PS2State *ps2 =3D PS2_DEVICE(s); =20 trace_ps2_mouse_reset(opaque); - ps2_common_reset(&s->common); + ps2_common_reset(ps2); s->mouse_status =3D 0; s->mouse_resolution =3D 0; s->mouse_sample_rate =3D 0; @@ -1226,7 +1233,7 @@ static const VMStateDescription vmstate_ps2_keyboard = =3D { static int ps2_mouse_post_load(void *opaque, int version_id) { PS2MouseState *s =3D (PS2MouseState *)opaque; - PS2State *ps2 =3D &s->common; + PS2State *ps2 =3D PS2_DEVICE(s); =20 ps2_common_post_load(ps2); =20 @@ -1239,7 +1246,8 @@ static const VMStateDescription vmstate_ps2_mouse =3D= { .minimum_version_id =3D 2, .post_load =3D ps2_mouse_post_load, .fields =3D (VMStateField[]) { - VMSTATE_STRUCT(common, PS2MouseState, 0, vmstate_ps2_common, PS2St= ate), + VMSTATE_STRUCT(parent_obj, PS2MouseState, 0, vmstate_ps2_common, + PS2State), VMSTATE_UINT8(mouse_status, PS2MouseState), VMSTATE_UINT8(mouse_resolution, PS2MouseState), VMSTATE_UINT8(mouse_sample_rate, PS2MouseState), @@ -1291,11 +1299,18 @@ static QemuInputHandler ps2_mouse_handler =3D { =20 void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) { - PS2MouseState *s =3D g_new0(PS2MouseState, 1); + DeviceState *dev; + PS2MouseState *s; + PS2State *ps2; + + dev =3D qdev_new(TYPE_PS2_MOUSE_DEVICE); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + s =3D PS2_MOUSE_DEVICE(dev); + ps2 =3D PS2_DEVICE(s); =20 trace_ps2_mouse_init(s); - s->common.update_irq =3D update_irq; - s->common.update_arg =3D update_arg; + ps2->update_irq =3D update_irq; + ps2->update_arg =3D update_arg; vmstate_register(NULL, 0, &vmstate_ps2_mouse, s); qemu_input_handler_register((DeviceState *)s, &ps2_mouse_handler); @@ -1309,6 +1324,12 @@ static const TypeInfo ps2_kbd_info =3D { .instance_size =3D sizeof(PS2KbdState), }; =20 +static const TypeInfo ps2_mouse_info =3D { + .name =3D TYPE_PS2_MOUSE_DEVICE, + .parent =3D TYPE_PS2_DEVICE, + .instance_size =3D sizeof(PS2MouseState), +}; + static void ps2_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -1328,6 +1349,7 @@ static void ps2_register_types(void) { type_register_static(&ps2_info); type_register_static(&ps2_kbd_info); + type_register_static(&ps2_mouse_info); } =20 type_init(ps2_register_types) --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656078731139219.81871580077416; Fri, 24 Jun 2022 06:52:11 -0700 (PDT) Received: from localhost ([::1]:35404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jjG-0005bE-3n for importer@patchew.org; Fri, 24 Jun 2022 09:52:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37894) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZ9-0007Ij-I9; Fri, 24 Jun 2022 09:41:45 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41632) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZ7-00055H-Ko; Fri, 24 Jun 2022 09:41:43 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jXp-00037t-B4; Fri, 24 Jun 2022 14:40:24 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=RWSKun6L8MebER57mxQ4p2jMPfbaX5SY4yJS+6wIw+Y=; b=V1LUS1Xgp2NqT3hEZ9OAk4mKzT e9Z8+sWw3ZlXIIGukNITVVrH2OT5AlEauTfZ1NFy5uW/6Qn3MDtY68DuLLG8kJ2/6F4AijgJK2xkb zP/ZGbBDiOFtQG6nXaBzyqClPL4RgXROjXXhmfl4w9wAUX5ZAp1gBGFzMzJ1uqquQXJkU8DOCBYdf BfaCcn0Jj+oLP57Z5rXPCU11iBH9r12RJ7o/KGvD0Efk7T73lmss/srf4tLy/9cGh/lEfPC1bKR9+ uhqph9IDCqRMuLD1/z8UGxADje+gt7N0CGf+7XyF0Qy3VqlpGuepKhaVk+0nity4dNLV7k5QuMCx4 9gTZXzoloz81RNnBDgmQ7n/B4eAnNtp2flcSlEuhZrLQuhn/wJloEQGpDV2gj6CGvsLG88L4+NOU5 u1NYbegB7n90tuLRZnVsbDcArxclF+TyJfPtMK9j1P99ER9M8yLqKIjTmqCvH34S8aygkopnS2zQs wJxPxv9lxCh0HP4wQSSNw5LWrR08cqcesgRVoNwpWf+yWh3XKbu85vorOZKi9n+/jBnt7uc5B3J7p aK0VYfHHq5Or92RPJ3HUqOqaX8xRX8yY/kdYg5utsfaQaBBr2uF+LFKzwaBb8obAuZtA9cCCYEjL6 I49KSptuuBfstde0y4q3PgeYPp2pCYnzSWpPA38SU=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:20 +0100 Message-Id: <20220624134109.881989-6-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 05/54] ps2: move QOM type definitions from ps2.c to ps2.h X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656078731666100001 Move the QOM type definitions into the ps2.h header file to allow the new Q= OM types to be used by other devices. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/ps2.c | 55 --------------------------------------- include/hw/input/ps2.h | 58 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 56 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index ee7c36d4f2..f4bad9876a 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -76,11 +76,6 @@ #define MOUSE_STATUS_ENABLED 0x20 #define MOUSE_STATUS_SCALE21 0x10 =20 -/* - * PS/2 buffer size. Keep 256 bytes for compatibility with - * older QEMU versions. - */ -#define PS2_BUFFER_SIZE 256 #define PS2_QUEUE_SIZE 16 /* Queue size required by PS/2 protocol */ #define PS2_QUEUE_HEADROOM 8 /* Queue size for keyboard command replies= */ =20 @@ -92,56 +87,6 @@ #define MOD_SHIFT_R (1 << 4) #define MOD_ALT_R (1 << 5) =20 -typedef struct { - uint8_t data[PS2_BUFFER_SIZE]; - int rptr, wptr, cwptr, count; -} PS2Queue; - -struct PS2State { - SysBusDevice parent_obj; - - PS2Queue queue; - int32_t write_cmd; - void (*update_irq)(void *, int); - void *update_arg; -}; - -#define TYPE_PS2_DEVICE "ps2-device" -OBJECT_DECLARE_SIMPLE_TYPE(PS2State, PS2_DEVICE) - -struct PS2KbdState { - PS2State parent_obj; - - int scan_enabled; - int translate; - int scancode_set; /* 1=3DXT, 2=3DAT, 3=3DPS/2 */ - int ledstate; - bool need_high_bit; - unsigned int modifiers; /* bitmask of MOD_* constants above */ -}; - -#define TYPE_PS2_KBD_DEVICE "ps2-kbd" -OBJECT_DECLARE_SIMPLE_TYPE(PS2KbdState, PS2_KBD_DEVICE) - -struct PS2MouseState { - PS2State parent_obj; - - uint8_t mouse_status; - uint8_t mouse_resolution; - uint8_t mouse_sample_rate; - uint8_t mouse_wrap; - uint8_t mouse_type; /* 0 =3D PS2, 3 =3D IMPS/2, 4 =3D IMEX */ - uint8_t mouse_detect_state; - int mouse_dx; /* current values, needed for 'poll' mode */ - int mouse_dy; - int mouse_dz; - int mouse_dw; - uint8_t mouse_buttons; -}; - -#define TYPE_PS2_MOUSE_DEVICE "ps2-mouse" -OBJECT_DECLARE_SIMPLE_TYPE(PS2MouseState, PS2_MOUSE_DEVICE) - static uint8_t translate_table[256] =3D { 0xff, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x3c, 0x58, 0x64, 0x44, 0x42, 0x40, 0x3e, 0x0f, 0x29, 0x59, diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 35d983897a..7f2c3f6090 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -25,13 +25,69 @@ #ifndef HW_PS2_H #define HW_PS2_H =20 +#include "hw/sysbus.h" + #define PS2_MOUSE_BUTTON_LEFT 0x01 #define PS2_MOUSE_BUTTON_RIGHT 0x02 #define PS2_MOUSE_BUTTON_MIDDLE 0x04 #define PS2_MOUSE_BUTTON_SIDE 0x08 #define PS2_MOUSE_BUTTON_EXTRA 0x10 =20 -typedef struct PS2State PS2State; +/* + * PS/2 buffer size. Keep 256 bytes for compatibility with + * older QEMU versions. + */ +#define PS2_BUFFER_SIZE 256 + +typedef struct { + uint8_t data[PS2_BUFFER_SIZE]; + int rptr, wptr, cwptr, count; +} PS2Queue; + +struct PS2State { + SysBusDevice parent_obj; + + PS2Queue queue; + int32_t write_cmd; + void (*update_irq)(void *, int); + void *update_arg; +}; + +#define TYPE_PS2_DEVICE "ps2-device" +OBJECT_DECLARE_SIMPLE_TYPE(PS2State, PS2_DEVICE) + +struct PS2KbdState { + PS2State parent_obj; + + int scan_enabled; + int translate; + int scancode_set; /* 1=3DXT, 2=3DAT, 3=3DPS/2 */ + int ledstate; + bool need_high_bit; + unsigned int modifiers; /* bitmask of MOD_* constants above */ +}; + +#define TYPE_PS2_KBD_DEVICE "ps2-kbd" +OBJECT_DECLARE_SIMPLE_TYPE(PS2KbdState, PS2_KBD_DEVICE) + +struct PS2MouseState { + PS2State parent_obj; + + uint8_t mouse_status; + uint8_t mouse_resolution; + uint8_t mouse_sample_rate; + uint8_t mouse_wrap; + uint8_t mouse_type; /* 0 =3D PS2, 3 =3D IMPS/2, 4 =3D IMEX */ + uint8_t mouse_detect_state; + int mouse_dx; /* current values, needed for 'poll' mode */ + int mouse_dy; + int mouse_dz; + int mouse_dw; + uint8_t mouse_buttons; +}; + +#define TYPE_PS2_MOUSE_DEVICE "ps2-mouse" +OBJECT_DECLARE_SIMPLE_TYPE(PS2MouseState, PS2_MOUSE_DEVICE) =20 /* ps2.c */ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg); --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656078799080653.1593631436386; Fri, 24 Jun 2022 06:53:19 -0700 (PDT) Received: from localhost ([::1]:38960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jkL-000834-U0 for importer@patchew.org; Fri, 24 Jun 2022 09:53:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZG-0007Sy-4G; Fri, 24 Jun 2022 09:41:50 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41658) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZD-00055k-DR; Fri, 24 Jun 2022 09:41:49 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jXt-00037t-05; Fri, 24 Jun 2022 14:40:29 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=x4Ux/flhpbIkk1DOYNpnIWHsBEhYIKBWJPHzdRfuhRU=; b=R0CeQOSbUv7xjyMenlexQZgcCM /PUBrEKSt/OlCb3Tv+KiovoA/+Cvti41I/Lk9NzMmK5B2B7e6cGY2cFdxZjLWBl9xwiAtQ9+939JJ XWsYNGjQsqXalA+6wyMqTcrx83xZst2Nw1qUIDFsFKm6DuPRpTqwkTs5a0uCvX92c8pQe2+MnioAT GRug6pFMnkJ1/6PmRmKK2bX8D5J8TofgJ9YkTufUSV0Z37mr4inMrGONE7tOEwg3OHClt6SM/+hOZ 7Z1XzA8eI3wdo7qsicRF5mYNA3q+zv39gWxH2id5HSFPAbmsaKF3y76SslOx8azUMmA2Lk41BEr75 HrLu0EDYL661bKIIGczu1Frp2OlUmWnElaMO+KAMH3cv8ERuBTDcnrM7DeaE3NwPNmsluyxmeSsGc oCY3DqyQbu2RdWJOuzZFJnKKyCphWNJ2yOFNQYDwZ+P9yCjMc2opW68LjQ9h7RaHpwk+G4edlK2Vt 8gCQ7hrzMBD6ReFQIlrafAWK3n8LFPq1+lv2On3WJzjiRUlgQqE3G5OBRhysvXxaPpzgfmsqQL57h YuHnix0VVrg2xGNSre1rVbEgP5yIYcG3FI8HK2ienRUF+nphZug9aCe+HhhtRmPYlCEQa+3eq5EDA Y/ZfEQiChhAR7F4VUErSIXEO/OIfZPAW17R91YdgI=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:21 +0100 Message-Id: <20220624134109.881989-7-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 06/54] ps2: improve function prototypes in ps2.c and ps2.h X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656078800049100001 With the latest changes it is now possible to improve some of the function prototypes in ps2.c and ps.h to use the appropriate PS2KbdState or PS2MouseState type instead of being a void opaque. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/ps2.c | 22 +++++++++------------- include/hw/input/ps2.h | 8 ++++---- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index f4bad9876a..3a770f3b78 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -581,12 +581,11 @@ static void ps2_reset_keyboard(PS2KbdState *s) ps2_set_ledstate(s, 0); } =20 -void ps2_write_keyboard(void *opaque, int val) +void ps2_write_keyboard(PS2KbdState *s, int val) { - PS2KbdState *s =3D (PS2KbdState *)opaque; PS2State *ps2 =3D PS2_DEVICE(s); =20 - trace_ps2_write_keyboard(opaque, val); + trace_ps2_write_keyboard(s, val); ps2_cqueue_reset(ps2); switch (ps2->write_cmd) { default: @@ -675,10 +674,9 @@ void ps2_write_keyboard(void *opaque, int val) * 1 =3D translated scancodes (used by qemu internally). */ =20 -void ps2_keyboard_set_translation(void *opaque, int mode) +void ps2_keyboard_set_translation(PS2KbdState *s, int mode) { - PS2KbdState *s =3D (PS2KbdState *)opaque; - trace_ps2_keyboard_set_translation(opaque, mode); + trace_ps2_keyboard_set_translation(s, mode); s->translate =3D mode; } =20 @@ -857,20 +855,18 @@ static void ps2_mouse_sync(DeviceState *dev) } } =20 -void ps2_mouse_fake_event(void *opaque) +void ps2_mouse_fake_event(PS2MouseState *s) { - PS2MouseState *s =3D opaque; - trace_ps2_mouse_fake_event(opaque); + trace_ps2_mouse_fake_event(s); s->mouse_dx++; - ps2_mouse_sync(opaque); + ps2_mouse_sync(DEVICE(s)); } =20 -void ps2_write_mouse(void *opaque, int val) +void ps2_write_mouse(PS2MouseState *s, int val) { - PS2MouseState *s =3D (PS2MouseState *)opaque; PS2State *ps2 =3D PS2_DEVICE(s); =20 - trace_ps2_write_mouse(opaque, val); + trace_ps2_write_mouse(s, val); switch (ps2->write_cmd) { default: case -1: diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 7f2c3f6090..1a3321d77e 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -92,8 +92,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(PS2MouseState, PS2_MOUSE_DEVIC= E) /* ps2.c */ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg); void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg); -void ps2_write_mouse(void *, int val); -void ps2_write_keyboard(void *, int val); +void ps2_write_mouse(PS2MouseState *s, int val); +void ps2_write_keyboard(PS2KbdState *s, int val); uint32_t ps2_read_data(PS2State *s); void ps2_queue_noirq(PS2State *s, int b); void ps2_raise_irq(PS2State *s); @@ -101,8 +101,8 @@ void ps2_queue(PS2State *s, int b); void ps2_queue_2(PS2State *s, int b1, int b2); void ps2_queue_3(PS2State *s, int b1, int b2, int b3); void ps2_queue_4(PS2State *s, int b1, int b2, int b3, int b4); -void ps2_keyboard_set_translation(void *opaque, int mode); -void ps2_mouse_fake_event(void *opaque); +void ps2_keyboard_set_translation(PS2KbdState *s, int mode); +void ps2_mouse_fake_event(PS2MouseState *s); int ps2_queue_empty(PS2State *s); =20 #endif /* HW_PS2_H */ --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656078440580563.3124009699212; Fri, 24 Jun 2022 06:47:20 -0700 (PDT) Received: from localhost ([::1]:52452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jeX-0005t6-MI for importer@patchew.org; Fri, 24 Jun 2022 09:47:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZI-0007aR-Ca; Fri, 24 Jun 2022 09:41:52 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41676) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZG-00055q-Kh; Fri, 24 Jun 2022 09:41:52 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jXx-00037t-AM; Fri, 24 Jun 2022 14:40:33 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=pxFtoDkgL+d8Vs2txv3QdzGtbj2AZwsZOXUK0XubwIc=; b=s10v2e5PGgEz9wduw6TalRhPEp 4/MWXqgUlVLF9ElWwWwiP2xgXuKhIGvAEeGp2NUWihFr3eXg5+sZnEg/cBUl59vOOctDIGTmZqT7B MK/FCYOxAprYkSS2/ApTf1CSuLvnCC/m49gPzWimxHiNnD61bQIyKPnhIm4fjTlGxZFntARTs1fLA Y5A3VvphhiDk2OSnQqP+bS2CuTHygN3ZfInKY2T87TAsChbq30L2jmkGIe74qc22AdKm7tYFqe10p XF3g+3hnX+KgcCscIzmxAeKlpVdVFQYyM/D2SMMtkSmyjDomVWLro8LI/gA3u5bTW6q8xO24XENAF FnY6elktTu5iNHjgY2DtQ8OH45iaIG/qP4ppEyZSgz+N3RBBnMSv5ELlUYAzDEgMAjNg4P5bqDYEs NeZ66PVJuxU2+r1cVzRo5wAsc9WNQzPM88oRqYo9ZuUPjYednX1SZjD3U1istR9mfqX7D6RDkEYzJ Sd5EqK8k/cvQnNQUTkoOHUY4Jc82+rrimI40kyBB1i272zTcKArG0DrHyRcPX0Mj5DN4hnbbC/H10 ASl3/m6mGKAGsEa0qM2dbNrMs9voNZNmvX1XrsW4wWawdV+y+pRrxIOyGtUoWITXzv5VTAlfWDaqF VE4L0fLNAEwB3PAinUTI8NABgeseoiMu8Fl9ZOpSM=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:22 +0100 Message-Id: <20220624134109.881989-8-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 07/54] ps2: introduce PS2DeviceClass X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656078442209100001 This is in preparation for allowing the new PS2_KBD_DEVICE and PS2_MOUSE_DE= VICE QOM types to reference the parent PS2_DEVICE device reset() function. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/ps2.c | 1 + include/hw/input/ps2.h | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 3a770f3b78..fd5236690a 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1283,6 +1283,7 @@ static const TypeInfo ps2_info =3D { .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(PS2State), .class_init =3D ps2_class_init, + .class_size =3D sizeof(PS2DeviceClass), .abstract =3D true }; =20 diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 1a3321d77e..aef892b5e6 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -33,6 +33,10 @@ #define PS2_MOUSE_BUTTON_SIDE 0x08 #define PS2_MOUSE_BUTTON_EXTRA 0x10 =20 +struct PS2DeviceClass { + SysBusDeviceClass parent_class; +}; + /* * PS/2 buffer size. Keep 256 bytes for compatibility with * older QEMU versions. @@ -54,7 +58,7 @@ struct PS2State { }; =20 #define TYPE_PS2_DEVICE "ps2-device" -OBJECT_DECLARE_SIMPLE_TYPE(PS2State, PS2_DEVICE) +OBJECT_DECLARE_TYPE(PS2State, PS2DeviceClass, PS2_DEVICE) =20 struct PS2KbdState { PS2State parent_obj; --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079071376887.3668425766971; Fri, 24 Jun 2022 06:57:51 -0700 (PDT) Received: from localhost ([::1]:48524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jok-0006Id-8Q for importer@patchew.org; Fri, 24 Jun 2022 09:57:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZM-0007oB-LA; Fri, 24 Jun 2022 09:41:56 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41694) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZK-00056A-UV; Fri, 24 Jun 2022 09:41:56 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jY1-00037t-G2; Fri, 24 Jun 2022 14:40:37 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=iJHx1KzN+frYJabby4L2TTcxcb7fJYorC8rQY39CQB0=; b=woHbWkhd9k6adNf4D8Erv0q4Q8 w9xnnhfaFbciMw2ifDKbq20lBcVg6ZbqQX4AZ88OCa2HMHwOW7ONPkOwDVlJvsfNEebgwQiDKPfqw pTiDWqAjZ+jnZYXz8HFi123VXmW2opNGG2cWHN3eEfF6BHZszDkZx6m0a4aN3xlCy3VqDWoiCSmpx srWN7Trh4yKgF5VAZQpQ9yAVIarntS3xnsoU9uNS4R+XsZCJx2v38Uk/p4ZtQaA7GcFK1htHP91aI Wd2DIsxeLATZZaQB4QprDTHmstbYghCFwjQRzag0hmparHfSKWUMf6PfPSp0OCMwXEk15jnQwKvX8 5B1V9Ytvr7kPp36vkfmilj4x0v2VZ99VoNx1rvv9Gy8uUYK7QFw9RG1DUcITSi2aH8pW1+GJ9vzTl FIA2ooWzTMdMODDKcAva8wDmHusarc8bl/rMV+agzKRRvWUnyajIYb+q8A3uQDTI4d8Wt5/QLYqNX HNKQ48ZHDYSapY1mzPH0333cgRfc9SyrlavD0shj5KB3Q2ssTgdIxOkJBl7TmwHlaiz6R60VaLP2H wNPPB1UbYhwKLXcBlrLK0KmbNeVLK/wWkOdvAmlJSC7MXe0SilY7ayFB7YghxSHg9+dueookgDK28 sdUqrEMovOR72oxmy00tvhPbK2Tav0R8Srjct+C6o=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:23 +0100 Message-Id: <20220624134109.881989-9-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 08/54] ps2: implement ps2_reset() for the PS2_DEVICE QOM type based upon ps2_common_reset() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079072629100001 The functionality of ps2_common_reset() can be moved into a new ps2_reset()= function for the PS2_DEVICE QOM type. Update PS2DeviceClass to hold a reference to t= he parent reset function and update the PS2_KBD_DEVICE and PS2_MOUSE_DEVICE types to = use device_class_set_parent_reset() accordingly. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/ps2.c | 48 ++++++++++++++++++++++++++++++------------ include/hw/input/ps2.h | 2 ++ 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index fd5236690a..f6f5514f0b 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -995,8 +995,10 @@ void ps2_write_mouse(PS2MouseState *s, int val) } } =20 -static void ps2_common_reset(PS2State *s) +static void ps2_reset(DeviceState *dev) { + PS2State *s =3D PS2_DEVICE(dev); + s->write_cmd =3D -1; ps2_reset_queue(s); s->update_irq(s->update_arg, 0); @@ -1028,26 +1030,28 @@ static void ps2_common_post_load(PS2State *s) q->cwptr =3D ccount ? (q->rptr + ccount) & (PS2_BUFFER_SIZE - 1) : -1; } =20 -static void ps2_kbd_reset(void *opaque) +static void ps2_kbd_reset(DeviceState *dev) { - PS2KbdState *s =3D (PS2KbdState *) opaque; - PS2State *ps2 =3D PS2_DEVICE(s); + PS2DeviceClass *ps2dc =3D PS2_DEVICE_GET_CLASS(dev); + PS2KbdState *s =3D PS2_KBD_DEVICE(dev); + + trace_ps2_kbd_reset(s); + ps2dc->parent_reset(dev); =20 - trace_ps2_kbd_reset(opaque); - ps2_common_reset(ps2); s->scan_enabled =3D 1; s->translate =3D 0; s->scancode_set =3D 2; s->modifiers =3D 0; } =20 -static void ps2_mouse_reset(void *opaque) +static void ps2_mouse_reset(DeviceState *dev) { - PS2MouseState *s =3D (PS2MouseState *) opaque; - PS2State *ps2 =3D PS2_DEVICE(s); + PS2DeviceClass *ps2dc =3D PS2_DEVICE_GET_CLASS(dev); + PS2MouseState *s =3D PS2_MOUSE_DEVICE(dev); + + trace_ps2_mouse_reset(s); + ps2dc->parent_reset(dev); =20 - trace_ps2_mouse_reset(opaque); - ps2_common_reset(ps2); s->mouse_status =3D 0; s->mouse_resolution =3D 0; s->mouse_sample_rate =3D 0; @@ -1227,7 +1231,6 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), v= oid *update_arg) vmstate_register(NULL, 0, &vmstate_ps2_keyboard, s); qemu_input_handler_register((DeviceState *)s, &ps2_keyboard_handler); - qemu_register_reset(ps2_kbd_reset, s); return s; } =20 @@ -1255,26 +1258,45 @@ void *ps2_mouse_init(void (*update_irq)(void *, int= ), void *update_arg) vmstate_register(NULL, 0, &vmstate_ps2_mouse, s); qemu_input_handler_register((DeviceState *)s, &ps2_mouse_handler); - qemu_register_reset(ps2_mouse_reset, s); return s; } =20 +static void ps2_kbd_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + PS2DeviceClass *ps2dc =3D PS2_DEVICE_CLASS(klass); + + device_class_set_parent_reset(dc, ps2_kbd_reset, &ps2dc->parent_reset); +} + static const TypeInfo ps2_kbd_info =3D { .name =3D TYPE_PS2_KBD_DEVICE, .parent =3D TYPE_PS2_DEVICE, .instance_size =3D sizeof(PS2KbdState), + .class_init =3D ps2_kbd_class_init }; =20 +static void ps2_mouse_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + PS2DeviceClass *ps2dc =3D PS2_DEVICE_CLASS(klass); + + device_class_set_parent_reset(dc, ps2_mouse_reset, + &ps2dc->parent_reset); +} + static const TypeInfo ps2_mouse_info =3D { .name =3D TYPE_PS2_MOUSE_DEVICE, .parent =3D TYPE_PS2_DEVICE, .instance_size =3D sizeof(PS2MouseState), + .class_init =3D ps2_mouse_class_init }; =20 static void ps2_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 + dc->reset =3D ps2_reset; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } =20 diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index aef892b5e6..4be27de316 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -35,6 +35,8 @@ =20 struct PS2DeviceClass { SysBusDeviceClass parent_class; + + DeviceReset parent_reset; }; =20 /* --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656078644058706.4821896184288; Fri, 24 Jun 2022 06:50:44 -0700 (PDT) Received: from localhost ([::1]:57298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jhr-0001C5-0N for importer@patchew.org; Fri, 24 Jun 2022 09:50:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZU-00089J-9E; Fri, 24 Jun 2022 09:42:04 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41726) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZQ-00056T-M0; Fri, 24 Jun 2022 09:42:01 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jY5-00037t-Ps; Fri, 24 Jun 2022 14:40:41 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=3GMYTZq/oG6w9IgbD4uu+eD8m6J8IC0/qUwZbwO8zGM=; b=Pcql3pZAT8HMTKLD9bTABJCQcV L7gu+4EYmqZWbhcjK7x5RzKP5/qm8i1oCTjp5KuQmI7e8lt/JWwkIcFshb6+x/I4dZLi8xqHX33JW CfG1obXYzpSowA3zy3BrLFTyiLQsH3QZjhUb5unu0nWkqVy4roZpLT77Zm1edDt4rkxpUuqkkjPts 7QxeFatFnZhXAUGL02VU4ZzL9MbSjJwPwoCsEBlgOtculSeWQaGWARmSX4MkTMMg2Z8Yhrs8uh2EV Rv/JC4Y5LyfZnC3IjFHSd133qCFelj46IagSdhTvvs03Yv/dWaAIS2FcpxS/vEBnpu3pUxPSqP0F2 g4xst+/0xGU+ORdTVWWNpTQZGLayPoztqH1lf6yRjYtrcLA4Tv2gUvCI/8DAeFMw/XvMralST6PNs BXoe9LWejWBeVhQcSsiaDM5vTdwIMxFNHAS+/TBYwqZW2RtJ4s1yLbZACQ3jkoj684sd/RdLQ4hKB maFX+EopIDvoC+afyKr1JZLqQE44Amet2SF8Oi2iwBMW/m/QqSl4cYISDgdIlESh3Nm66+imh/1V9 3pgpuwUUnymwYSnh5RK1tz1wZGjrmdWSJA3dbYb/dv8YlQczqfAeQo8XCUWF5C3gYLK95c7pqUJZy 3SjeOALMlZTCWssg5LGLwloF2RvEalUHsGaz2C9ms=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:24 +0100 Message-Id: <20220624134109.881989-10-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 09/54] ps2: remove duplicate setting of scancode_set in ps2_kbd_init() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656078645273100001 The default value for scancode_set is already set in ps2_kbd_reset() so the= re is no need to duplicate this in ps2_kbd_init(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/ps2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index f6f5514f0b..8018e39b17 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1227,7 +1227,6 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), v= oid *update_arg) trace_ps2_kbd_init(s); ps2->update_irq =3D update_irq; ps2->update_arg =3D update_arg; - s->scancode_set =3D 2; vmstate_register(NULL, 0, &vmstate_ps2_keyboard, s); qemu_input_handler_register((DeviceState *)s, &ps2_keyboard_handler); --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656078764676983.0674057917483; Fri, 24 Jun 2022 06:52:44 -0700 (PDT) Received: from localhost ([::1]:37556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jjn-00076f-Mi for importer@patchew.org; Fri, 24 Jun 2022 09:52:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZV-0008Et-TK; Fri, 24 Jun 2022 09:42:05 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41748) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZU-00057p-2t; Fri, 24 Jun 2022 09:42:05 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jY9-00037t-Tw; Fri, 24 Jun 2022 14:40:45 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=yeLu2oRmt3UGTUqEcmBuoRQNtMMWs/MeC3rK6Hj2YAM=; b=QuMmRxTt7GgpkrfInVwRVTQdnx Z+YUYzuJvwAX89YYcF7E3nJqy2NFao3t9jHpcvg8nTnbuI2a7a14OJ1kvuOwS+pnVj1ZOTZQnJNmd gfLNwYXC0QSXNGmQP6JyppHYAVJ4XiflFuMOy9K44+AFvNUvjadzUdytNbE5Ouk47BK4XVStG3PjK 00S7K94rJ4ojYSO5tXgrSDAUN5mSuCBMKbXnHTKZ8MhhWfNLiaGSQGOuI9EZCIq1+GPCVv93IK8Qo UE10cBNcfP15lOViRiTruS1yNPzxFufreccFZ4emRgPeHvr9XOIfyKNUblqTkIe6yK3KYk/ocVnq6 1M07KX00nQJhRqDWGGzKaCHuyIQbp85hqbN1e3v2SrZhU64g2S9r+u75iPDnKaDV2fbYDgsIA9Gm3 O+I1ckXi0Mdx0tX+H7qDsqgshVdCWxiwX+L3rj39CwcsD9v13vpZ5P95BnOIxBS+fLp5GnN7ho0W/ S4gNtDct8NQFF0z4iwkho96tzQD16MrFuqUOdXfrC464Fy76dJvUFCUbHFDMZYPdm9HnCAbg6SWsS 2p3V8We+g/KIX0KHVLKHmNL3QAlyg2i1IUugDFUryzctY2RcYGmCCf92GBce3QU2SgCnyLzf2mmMd j2AsboLzt+VrXVmGN5mvRmcUWMHqvXtUHDs+9N38c=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:25 +0100 Message-Id: <20220624134109.881989-11-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 10/54] ps2: implement ps2_kbd_realize() and use it to register ps2_keyboard_handler X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656078765843100001 Move the registration of ps2_keyboard_handler from ps2_kbd_init() to a new ps2_kbd_realize() function. Since the abstract PS2_DEVICE parent class does= n't have a realize() function then it is not necessary to store the reference to it in PS2DeviceClass and use device_class_set_parent_realize(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/ps2.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 8018e39b17..62ea4c228b 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1213,6 +1213,11 @@ static QemuInputHandler ps2_keyboard_handler =3D { .event =3D ps2_keyboard_event, }; =20 +static void ps2_kbd_realize(DeviceState *dev, Error **errp) +{ + qemu_input_handler_register(dev, &ps2_keyboard_handler); +} + void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) { DeviceState *dev; @@ -1228,8 +1233,7 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), v= oid *update_arg) ps2->update_irq =3D update_irq; ps2->update_arg =3D update_arg; vmstate_register(NULL, 0, &vmstate_ps2_keyboard, s); - qemu_input_handler_register((DeviceState *)s, - &ps2_keyboard_handler); + return s; } =20 @@ -1265,6 +1269,7 @@ static void ps2_kbd_class_init(ObjectClass *klass, vo= id *data) DeviceClass *dc =3D DEVICE_CLASS(klass); PS2DeviceClass *ps2dc =3D PS2_DEVICE_CLASS(klass); =20 + dc->realize =3D ps2_kbd_realize; device_class_set_parent_reset(dc, ps2_kbd_reset, &ps2dc->parent_reset); } =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656078692684523.0151922651133; Fri, 24 Jun 2022 06:51:32 -0700 (PDT) Received: from localhost ([::1]:60934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jid-0003m9-04 for importer@patchew.org; Fri, 24 Jun 2022 09:51:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37992) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZU-0008A4-GW; Fri, 24 Jun 2022 09:42:04 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41740) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZS-00056e-RK; Fri, 24 Jun 2022 09:42:04 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jYD-00037t-LM; Fri, 24 Jun 2022 14:40:46 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=qpyYJsUslD7HcPHbBvR0JXi4478xZf387fDV2B8cdeg=; b=JVsy1wLAZQMl3iirglEv7oNIBh xg9XyUwZicTq09M2SFLoGx9m3fWXf9JA2G01UNoXftJipEGT+WatbFZY+iJSpIXj8+xU3/99K6kya bUTtyur4rnWdvBAgunmAfP8QvzQK6s3Ol/JMIehRip8Z6Asrotnml49IsZlCP8KnPbvk9jBt49/L9 TR+Y15nDO0I4T36l12g8RjEWIE986rLW5tDCA9QjfjjaLVFTRpf2VjAVBcCVhbmz5ZkH8EPllEA0t dhs4yvYaO3IXmWV3TkW4md6tO3ddrIsJAzeTzz8aYy8ZkMo23FnZrfeg/V50YURqNh5nrZvHaOYvB frouaOTvt7mLPk4MDVxcJQCdkG9terxpnrjf8rPZQcGvUb8RTYBeGw4Gbx669Uk848dsXlSQM8U5I 6HbhTdi8Q+uoQZoNmzg8Hxh6wnAgMH90eU/PeI1xKEh6xlp3Tznfn87MGesl59D3Mcr219Pqu142J gEIYTe07z/rWXP4+LOxIVC5GQTZv7zxe3VJ85sJqOv1KYTtPn5mgbfau3fIMlvqHG1Eg0pHEOYRlm xLO4QfhE5iuRHgaCoY/obZUhbc9QZlpK6MVCTjEs2NJVMfiaOe2L34wQ5RgdGHMaLp/XWWtqwUMif dk6bTA5wGPNqbqzV0GFoeHZ2veLla+BZDjTW1huwU=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:26 +0100 Message-Id: <20220624134109.881989-12-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 11/54] ps2: implement ps2_mouse_realize() and use it to register ps2_mouse_handler X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656078693523100001 Move the registration of ps2_mouse_handler from ps2_mouse_init() to a new ps2_mouse_realize() function. Since the abstract PS2_DEVICE parent class do= esn't have a realize() function then it is not necessary to store the reference to it in PS2DeviceClass and use device_class_set_parent_realize(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/ps2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 62ea4c228b..eae7df2096 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1244,6 +1244,11 @@ static QemuInputHandler ps2_mouse_handler =3D { .sync =3D ps2_mouse_sync, }; =20 +static void ps2_mouse_realize(DeviceState *dev, Error **errp) +{ + qemu_input_handler_register(dev, &ps2_mouse_handler); +} + void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) { DeviceState *dev; @@ -1259,8 +1264,6 @@ void *ps2_mouse_init(void (*update_irq)(void *, int),= void *update_arg) ps2->update_irq =3D update_irq; ps2->update_arg =3D update_arg; vmstate_register(NULL, 0, &vmstate_ps2_mouse, s); - qemu_input_handler_register((DeviceState *)s, - &ps2_mouse_handler); return s; } =20 @@ -1285,6 +1288,7 @@ static void ps2_mouse_class_init(ObjectClass *klass, = void *data) DeviceClass *dc =3D DEVICE_CLASS(klass); PS2DeviceClass *ps2dc =3D PS2_DEVICE_CLASS(klass); =20 + dc->realize =3D ps2_mouse_realize; device_class_set_parent_reset(dc, ps2_mouse_reset, &ps2dc->parent_reset); } --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079012793355.3394229323627; Fri, 24 Jun 2022 06:56:52 -0700 (PDT) Received: from localhost ([::1]:46306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jnn-0004nA-Pb for importer@patchew.org; Fri, 24 Jun 2022 09:56:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZY-0008P4-Gu; Fri, 24 Jun 2022 09:42:08 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41766) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZW-00058B-UD; Fri, 24 Jun 2022 09:42:08 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jYE-00037t-7i; Fri, 24 Jun 2022 14:40:50 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=eOPw1kWpdkn/vwpylukOqUCehgCzJr4tYfEfjjP1ZSw=; b=Ai37ZG6YqXd2nrSM9+Rmfizzvw C/AT1+vVM6R6cbdzybakHR2ykAwvdmenBPHAd+QtzWiRaRZctUTAS8Xg6nPPWTmyqDIdrYHwm0bPU pyvsOxjPbhI8FEA8KwJa5+sxIk8BnhluCbF7zWjjoqLMTTUMCoQlKlbyw5tkZUbzkXqlD/0Cr/TqJ JReCi5al4C1GpGVWUox6erJmbgCSKogUcRGwvmqz0skhDRa2OmR7KXngD3YM1skqsQU2bIFZQ50If i1umxLoTTmYK6fNDuvqVKgGjU3odb2+2RFI0ZxHZZZ7yvz4s/VbzlwX4eHy+SV8FJDnKDEpM/qtpz Wg0e1EOkNSX0Kw19djajU2Mi/CHTWHGPpVH9IZDz19kuEqLmeVnKQAUFTtml+ON4kGevuMbC8BZq/ tY8Rv9DvYeY370+ubPfsGdZRBPd3TJhIUmxDlFTYi1uTLdCEJyV60jrH9Z72WaNHO3RtBEwxq5Byy Qf1gX94w4A+YdtNj1yC3zrgCl72vsYCxanwrMGRR9sxkPYsu/rQ+u+sSbhX0hQu7hpcEXm7lhw389 mCY7IHOHQ90wpifvZJ1dNwOtSo2kO4XfY396uj021lsUeb8yke4kUA5xtqFYkJu4Ka4Ky70NGgXvH PL16Au5xtcNT+abautY/32xfYxa0Zo/JjtOY3psoU=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:27 +0100 Message-Id: <20220624134109.881989-13-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 12/54] ps2: don't use vmstate_register() in ps2_kbd_init() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079013241100001 Since PS2_KBD_DEVICE is a qdev device then vmstate_ps2_keyboard can be regi= stered using the DeviceClass vmsd field instead. There is no need to use qdev_set_legacy_instance_id() to ensure migration compatibility since the f= irst 2 parameters to vmstate_register() are NULL and 0 respectively. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/ps2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index eae7df2096..97e9172ba5 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1232,7 +1232,6 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), v= oid *update_arg) trace_ps2_kbd_init(s); ps2->update_irq =3D update_irq; ps2->update_arg =3D update_arg; - vmstate_register(NULL, 0, &vmstate_ps2_keyboard, s); =20 return s; } @@ -1274,6 +1273,7 @@ static void ps2_kbd_class_init(ObjectClass *klass, vo= id *data) =20 dc->realize =3D ps2_kbd_realize; device_class_set_parent_reset(dc, ps2_kbd_reset, &ps2dc->parent_reset); + dc->vmsd =3D &vmstate_ps2_keyboard; } =20 static const TypeInfo ps2_kbd_info =3D { --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656078957546497.9824648676986; Fri, 24 Jun 2022 06:55:57 -0700 (PDT) Received: from localhost ([::1]:43356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jmu-0002hc-B5 for importer@patchew.org; Fri, 24 Jun 2022 09:55:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZc-0000BM-Tq; Fri, 24 Jun 2022 09:42:12 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41784) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZb-00058W-DQ; Fri, 24 Jun 2022 09:42:12 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jYI-00037t-Gt; Fri, 24 Jun 2022 14:40:54 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=a8F3n3uv6MV8pmOJNkaC6JXhX8L6AW0fQIKif43imy0=; b=BM6BSQx0U9Z3LSMBTpn9yhm1Aa wEKCPdiwdHl8fNADOUbnN+gCA0CDoqRRQsATeyYBMh99sKl5t/2lI2FburECLjaUBnB1OKonLayrq 1Cbyhdqa+/Mho8pNuDXVR1dU2JSwMagMHVL2pi5SESZnh4Kxj2k2YgqBq8sWYYckvHKbBBDj/GS8e UyCt7lXv82W4O5SbZNhSelKwuLk4cBcJXn1V+8FZqAdZayhWoQ7ZwDtF3ZlqZOjsuQWfT3M5GFCQq H3uSILOCW98+6lG9o7iHstPvpXLJNjAXuboM4rFp3T2ZqXGNX0WizTF81/pBvQXUOGWxHIflbg1Sk jqf4NLti2UdVqj3BoBfFSGJ3l5VE/5jxakSeyWSNO3P8QWHmKlp9m2R4V8DXT2wyy9tz91IygJg0e K03pAmpmqr9+dK9wHz/n5/2aAiy788j3ddJMlVBYCd5IqMefUMNV30PdDGJ1o54sDvu6bcSTCH1Aw ry0KTdoDXD2PCOhDK8KXanspkwa4JhUdAxKtj6jpKb6DV8iGMMtFEiBqauhcSqVDdlj84dGWyMYGK TqDpQPRTJ9CRRTGBrqw/L8K0ZCl+sMN533IDhUjMhbsPUeIuxJN2dNNDsJ6Wp7f37ZckJwbo26Ts0 TRzyY8TdaaFay5W3uFs0SbkwqMfyG08K1qX/r/D44=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:28 +0100 Message-Id: <20220624134109.881989-14-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 13/54] ps2: don't use vmstate_register() in ps2_mouse_init() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656078959230100001 Since PS2_MOUSE_DEVICE is a qdev device then vmstate_ps2_mouse can be regis= tered using the DeviceClass vmsd field instead. There is no need to use qdev_set_legacy_instance_id() to ensure migration compatibility since the f= irst 2 parameters to vmstate_register() are NULL and 0 respectively. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/ps2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 97e9172ba5..9c046ac500 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1262,7 +1262,6 @@ void *ps2_mouse_init(void (*update_irq)(void *, int),= void *update_arg) trace_ps2_mouse_init(s); ps2->update_irq =3D update_irq; ps2->update_arg =3D update_arg; - vmstate_register(NULL, 0, &vmstate_ps2_mouse, s); return s; } =20 @@ -1291,6 +1290,7 @@ static void ps2_mouse_class_init(ObjectClass *klass, = void *data) dc->realize =3D ps2_mouse_realize; device_class_set_parent_reset(dc, ps2_mouse_reset, &ps2dc->parent_reset); + dc->vmsd =3D &vmstate_ps2_mouse; } =20 static const TypeInfo ps2_mouse_info =3D { --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079029138354.1208097460359; Fri, 24 Jun 2022 06:57:09 -0700 (PDT) Received: from localhost ([::1]:47012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jo1-0005HW-8U for importer@patchew.org; Fri, 24 Jun 2022 09:57:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4ja0-00018E-81; Fri, 24 Jun 2022 09:42:36 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41802) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jZy-00058k-M4; Fri, 24 Jun 2022 09:42:35 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jYM-00037t-80; Fri, 24 Jun 2022 14:40:57 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=iJeZHKd2ESfTdLxK3gngrDHiZnVgxD1i9JMP8ahasbE=; b=u/sZyxJ8w7dvgIh6YPb5F1mupt H5sehCNdI6t4roXt1VtFgdFzezhUUbp2jEu28dgBi7GGRCxtwlTSiPp9X/a+Srk0ORtwyp0wOF1kR nn+vrjvaVlL01UBazD6hBzCTl9tPt4uIpArooyzs7Rw0ceAmItxLlsEMvYulZytx2wpkvIYjWV7lg ZnTSmNjweTwt9JhYb+Kv7za20nQ4tfU/lIjLawoq7REzgS8JwanXQiyOJkxe9nt3S+DJ6JCpcPhsF UjDTEdWAh8dTyrmdF+T8mNCPnJmQq9IGaTvOET7D1ZV81PDFVaSIZKP611UKveumHR8oRzN+NYn7b u3+S0EtcxYnZ00LGNKV15XIymHCLRBEBAQh0MiqrrQJKQGtuNJjx9tB/3JKYZA1bJYblV9cZ6zyUi diQ1Cct6qJCY+VVZbt3D6VNtICwvvzwhiNXwGMeZIgyPHRIo/Aq/9CKFMN60+WUPTEvpkcFGSfm/s t6llJQT6+G6aSUukdDvgX+b64h7QmNoCQ8K0Ym33sWEWfQIJQ/Wd7Yi4ojrDbxW/+GtoZw9dJfkTg RdhuvCcDTFB+VwZxBBw3mkCMh10xP3+Mbjx+otC/gn5ctEf/PJE0kf1XAAUw7NjeOvvWHaOhwia+s XL/Qe/vKp7V12XhwoLn7+3qmkZXH9zZBpXsMwgkXA=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:29 +0100 Message-Id: <20220624134109.881989-15-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 14/54] pl050: checkpatch fixes X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079031305100001 This patch also includes a couple of minor spacing updates. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/pl050.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/hw/input/pl050.c b/hw/input/pl050.c index d279b6c148..889a0674d3 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -53,8 +53,9 @@ static const VMStateDescription vmstate_pl050 =3D { #define PL050_KMIC (1 << 1) #define PL050_KMID (1 << 0) =20 -static const unsigned char pl050_id[] =3D -{ 0x50, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 }; +static const unsigned char pl050_id[] =3D { + 0x50, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 +}; =20 static void pl050_update(void *opaque, int level) { @@ -71,8 +72,10 @@ static uint64_t pl050_read(void *opaque, hwaddr offset, unsigned size) { PL050State *s =3D (PL050State *)opaque; - if (offset >=3D 0xfe0 && offset < 0x1000) + + if (offset >=3D 0xfe0 && offset < 0x1000) { return pl050_id[(offset - 0xfe0) >> 2]; + } =20 switch (offset >> 2) { case 0: /* KMICR */ @@ -88,16 +91,19 @@ static uint64_t pl050_read(void *opaque, hwaddr offset, val =3D (val ^ (val >> 1)) & 1; =20 stat =3D PL050_TXEMPTY; - if (val) + if (val) { stat |=3D PL050_RXPARITY; - if (s->pending) + } + if (s->pending) { stat |=3D PL050_RXFULL; + } =20 return stat; } case 2: /* KMIDATA */ - if (s->pending) + if (s->pending) { s->last =3D ps2_read_data(s->dev); + } return s->last; case 3: /* KMICLKDIV */ return s->clk; @@ -114,6 +120,7 @@ static void pl050_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { PL050State *s =3D (PL050State *)opaque; + switch (offset >> 2) { case 0: /* KMICR */ s->cr =3D value; --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079273088267.45466606310356; Fri, 24 Jun 2022 07:01:13 -0700 (PDT) Received: from localhost ([::1]:58062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jry-0004NY-Qr for importer@patchew.org; Fri, 24 Jun 2022 10:01:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38118) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4ja3-0001C7-SE; Fri, 24 Jun 2022 09:42:41 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4ja2-00059c-9C; Fri, 24 Jun 2022 09:42:39 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jYP-00037t-Sj; Fri, 24 Jun 2022 14:41:01 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=YcsPtnedy787CRYrviUMvRysA7y4KFa7Jb53DABOCoc=; b=ouWEs6uFDIzVJLzpNxdVcSWAup BKQXikYHWBXDR0KfglDcE6ewvJeLtqeQQBsxA0/5QqqB2pdH7G7GWvC9J7hzr5kxY3xn5V7KeAXDP eo3Vcq3WF6jneXWdYndD1iR+bcHj10q1uRUBflO7Ajsg6tLTfBSyHP2xAmqnY7qw9+cyam55zKMYz wU8kTwXoGTc+Wf5Sk6a0r0zxyq2Ub5+slKRQKx7Necw5DQS/+YdES6SEPYZui4OFhZ5rUuVkB4m+T 9EPxI3OgzO9wt4vvZbQ1cK9iNkWkkJpej2UNO7vedTbBMcEohltaUjJBUN9QA8ZtGS+nsUwKAwNn9 snTe0Mss1bgW57Scq0LRhpctEbFdjbNHw9BV/Zkq0ScasoZ2Z+5MDbxOTB6PxmVfg7oOHTcU0EOeN t75jsnJ7nnN84zKBW/KEZ7w1ETiIjhKNuzS0hk0hN6sDp1NuDtud1nefBM5DaFf5ZhTKIAF1Z4Kf9 5RtklxMfKUnGZScYsuMz4RMjuYOfAsVcl3+PlGI4ZGtQJ6elb4hl0Rx5wIzq0zJjUBMXFZT6VmJU3 lWiIkNEU+85BnWxeXIkVlYDqCm3YmL4ZcvH761A/sP33LQhbf9LPQDFW+ZFSIyixGYq0SU+nu/Iwe zOJrPM1ZGlqbnVVINywdWE23UaTUoH1S3Gc+hmKMU=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:30 +0100 Message-Id: <20220624134109.881989-16-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 15/54] pl050: split pl050_update_irq() into separate pl050_set_irq() and pl050_update_irq() functions X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079273598100001 This will soon allow pl050_set_irq() to be used as a GPIO input function. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/pl050.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/hw/input/pl050.c b/hw/input/pl050.c index 889a0674d3..66f8c20d9f 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -57,15 +57,20 @@ static const unsigned char pl050_id[] =3D { 0x50, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 }; =20 -static void pl050_update(void *opaque, int level) +static void pl050_update_irq(PL050State *s) +{ + int level =3D (s->pending && (s->cr & 0x10) !=3D 0) + || (s->cr & 0x08) !=3D 0; + + qemu_set_irq(s->irq, level); +} + +static void pl050_set_irq(void *opaque, int level) { PL050State *s =3D (PL050State *)opaque; - int raise; =20 s->pending =3D level; - raise =3D (s->pending && (s->cr & 0x10) !=3D 0) - || (s->cr & 0x08) !=3D 0; - qemu_set_irq(s->irq, raise); + pl050_update_irq(s); } =20 static uint64_t pl050_read(void *opaque, hwaddr offset, @@ -124,7 +129,7 @@ static void pl050_write(void *opaque, hwaddr offset, switch (offset >> 2) { case 0: /* KMICR */ s->cr =3D value; - pl050_update(s, s->pending); + pl050_update_irq(s); /* ??? Need to implement the enable/disable bit. */ break; case 2: /* KMIDATA */ @@ -159,9 +164,9 @@ static void pl050_realize(DeviceState *dev, Error **err= p) sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); if (s->is_mouse) { - s->dev =3D ps2_mouse_init(pl050_update, s); + s->dev =3D ps2_mouse_init(pl050_set_irq, s); } else { - s->dev =3D ps2_kbd_init(pl050_update, s); + s->dev =3D ps2_kbd_init(pl050_set_irq, s); } } =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165607915964956.84822209076037; Fri, 24 Jun 2022 06:59:19 -0700 (PDT) Received: from localhost ([::1]:54646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jq9-00025L-Vi for importer@patchew.org; Fri, 24 Jun 2022 09:59:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4ja9-0001EO-Er; Fri, 24 Jun 2022 09:42:45 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41840) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4ja7-0005Cu-VT; Fri, 24 Jun 2022 09:42:45 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jYU-00037t-JJ; Fri, 24 Jun 2022 14:41:06 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=d091GelZN55eLOKLN7CO3SRnApYux7pBjnrtS2LpbW0=; b=0TEsVdnCgxyaEIQLrsjZj424lo YOtE0Qpf1lU3IdaDSdkk6aK8YvMU2or2YWHBBh6VXx8haI6hYDYizD6hAX3CH6KcCgr0rNJq7ZYs8 00NTLci6+yvlDrueKK20ceRqwISyby1wdD7NE6nIQnm7wNT4o7GHqvDeeVWrywwHnWD50k732rQ2c O6U03orHi/hWRSbXaBHBgaLFyTMF4gJg1xWhlXD4hg8wH7CSu62Itim2TZ72Rv7Sr2w/u6THUNgSv 3gzIOgxVbVC8SYKTPwxnzcHw9A7iEDnk1AfIyD4Dxigag/OYzcVhWzM0gDkC3rHCTpEJraO3ZJ68z 6nn1pkWDAsJTwNfWoaMMTfipdraiyEmZOAXDBgJZKWD6xb7cNQB2gqbbtwltwNltScBb62yW3/vNA K4XxTvxAOx0xhgmtqdKClYVW4UX8EnekndK5om+RBQikQhPoW/2p4ZZpuXp+PwG3BxqiS+3jvwBPd +D8x9E4HYba72G7xBHowcSwOFrhzvOY8/cbZzXKhrbod+HS/nhmn52rQZBBa2vuAkYvyUijr3Vv34 TphhpMr4BVn19gRXeIkcEfrAwX4TGNO04dOhRNk6NisEfWFUr8tIRMFvTB8AWEFXOr/6T+1HxO908 ROd6xtlL9jubPMShfks27nlVmt6IOIyaitLMUDePA=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:31 +0100 Message-Id: <20220624134109.881989-17-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 16/54] lasips2: spacing fixes X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079160619100001 This helps improve the readability of lasips2.c. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/lasips2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 94f18be4cd..2ac3433014 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -205,7 +205,6 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr a= ddr, unsigned size) break; =20 case REG_PS2_STATUS: - ret =3D LASIPS2_STATUS_DATSHD | LASIPS2_STATUS_CLKSHD; =20 if (port->control & LASIPS2_CONTROL_DIAG) { @@ -238,9 +237,9 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr a= ddr, unsigned size) __func__, addr); break; } + trace_lasips2_reg_read(size, port->id, addr, lasips2_read_reg_name(addr), ret); - return ret; } =20 @@ -257,6 +256,7 @@ static const MemoryRegionOps lasips2_reg_ops =3D { static void ps2dev_update_irq(void *opaque, int level) { LASIPS2Port *port =3D opaque; + port->irq =3D level; lasips2_update_irq(port->parent); } --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079503515381.727589292713; Fri, 24 Jun 2022 07:05:03 -0700 (PDT) Received: from localhost ([::1]:38296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jvh-0002Jt-Sy for importer@patchew.org; Fri, 24 Jun 2022 10:05:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaE-0001Iz-SY; Fri, 24 Jun 2022 09:42:51 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41860) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaB-0005EJ-Ou; Fri, 24 Jun 2022 09:42:50 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jYZ-00037t-0y; Fri, 24 Jun 2022 14:41:10 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=/D3x0EPgbd1rsMLyHkuf/aV6SyVyhXgHYMBz9CwlEVE=; b=vXhbFhtR5er3uzbOdjUXJGAu9z GCOyWnOdA0ab7TRnE8D75eXkM4/NE85YO4IU4RTYdpkYubvB3Qh5e/JjCONEQwAcXeUtcDh0XKOO2 jwiiHWXdTtkg2bsVb/swICcBJeHh14p2WJyDGZ/jtZBCFRAJ/YMF3hJAcqwOFerFQVRVOov37tuMw q/0mki3EJJ2rLZN3W4ygnlnvylCUcdDqKTNAArEYy0xY5VQW9apu0/qLkcQhH01IqmZxNzwLDXsF2 3+9KPhbXeUBVv8Ybt9No0zGNVWkxaMKBVN1OjIDXEyb5/+tkhhoa/JEc9iu16uySqCH5uRx9hYzTo o9wE7oCmB32HzsvmY1pAl2AbjacJDNAF3w5/Y4c/xZP+jqchvl/RY/S5ZNmBuU8gHCLqE378sfKo0 BDZAnPr5tDnGC62gn3mZzx5x2OOfgtbGxnKEcOJxeJzzdwgVocjGUyLeKgaGGzVYbLxidQsfS6t05 1gfLduuNAwiA67+kNXqPkxQ4iZnDfhL2mIPjY4DV1ywnbx01P8Dv7EaH5O6tf0khzQqS/PWGj531J AcK9GjgO/EWqR48KuDAYUdB/fh+qvcd2AQtrjvPbAmSSbVfz4cYOS11h838s0QDHP1GzBd8ubwkDT F5845J5Lch3Tr/T+vtWUrybF046O1KnRcrvhLCmOE=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:32 +0100 Message-Id: <20220624134109.881989-18-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 17/54] lasips2: rename ps2dev_update_irq() to lasips2_port_set_irq() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079504811100001 This better reflects that the IRQ input opaque is a LASIPS2Port structure and not a PS2_DEVICE. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/lasips2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 2ac3433014..adfde1684f 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -253,7 +253,7 @@ static const MemoryRegionOps lasips2_reg_ops =3D { .endianness =3D DEVICE_NATIVE_ENDIAN, }; =20 -static void ps2dev_update_irq(void *opaque, int level) +static void lasips2_port_set_irq(void *opaque, int level) { LASIPS2Port *port =3D opaque; =20 @@ -275,8 +275,8 @@ void lasips2_init(MemoryRegion *address_space, =20 vmstate_register(NULL, base, &vmstate_lasips2, s); =20 - s->kbd.dev =3D ps2_kbd_init(ps2dev_update_irq, &s->kbd); - s->mouse.dev =3D ps2_mouse_init(ps2dev_update_irq, &s->mouse); + s->kbd.dev =3D ps2_kbd_init(lasips2_port_set_irq, &s->kbd); + s->mouse.dev =3D ps2_mouse_init(lasips2_port_set_irq, &s->mouse); =20 memory_region_init_io(&s->kbd.reg, NULL, &lasips2_reg_ops, &s->kbd, "lasips2-kbd", 0x100); --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079201861932.2958010427939; Fri, 24 Jun 2022 07:00:01 -0700 (PDT) Received: from localhost ([::1]:56700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jqq-0003Ti-7R for importer@patchew.org; Fri, 24 Jun 2022 10:00:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaI-0001KB-Im; Fri, 24 Jun 2022 09:42:57 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41876) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaE-0005EU-Oy; Fri, 24 Jun 2022 09:42:53 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jYc-00037t-W0; Fri, 24 Jun 2022 14:41:13 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=KxPiyT4+eRrpWOcWb0WtwmhI9LLkN92G6Bk9HNizYxo=; b=EWAIzjs/g1/EuxQu+HQyf6YKjc LWjhG+GYzDt9cIzrRKOQMw2oCnw2vGZk1btCkTbYrsLMaDQlCNa4ajAbOxHz7ZJha1BXHVcgVLj49 NLzV8eFHsLvX+eL7OvaWY0gCl4JL1EXxXETt6SsNNOtlCvaqMbd2syS0bty6QqmxRbowUpv5U3Vgf X8MaJ1gtRXnNQkKtMVSogtET5sSrXZs6ysY0/xntGlTVkpHUr8MleFojV68Ij4Wm/QtZS7hzC4NSB dFf0zKjUA8Su+3kp2jSzVMiSCnaRW05TtS8mbWiLH2Zvfb30EQ/es1pcaBt1m1s1F1l7UIWM3GV4F OHXi2XDyHg76pYAp7GHR2F29GzcI8OdLjM/pE3LuV6hS2Q6lHZ/BrT9pvtU0Hppk/W3MF+UKfJco4 0dsSk7vEHlo4MAS1x1Pn1eFy5biJUdFj1G1uQnmK3HkDIClD3E1U1yZ1F3frsv2stgMbmuwMuQUVZ ++nnOqYXrUucpkb6wqgcFsJBaGiD7w8zptDtvNaXzD17Vg8+mgzHrcE8ZhM76cZV/kf29fIIhj2UG grilV97XqqCEyDLizDi7ea28SSbY6JJihjfjdnU9knsOBlf4HN79VxVA1eT923pTD7CJ38OXSKNYv iRiqyrEpy7YoHQHYo9bdBOGXJcl+9kaDHTxvtF18M=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:33 +0100 Message-Id: <20220624134109.881989-19-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 18/54] pckbd: checkpatch fixes X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079202865100001 Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/pckbd.c | 150 ++++++++++++++++++++++++++++++----------------- 1 file changed, 97 insertions(+), 53 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 45c40fe3f3..c18a1a7fae 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -39,49 +39,86 @@ =20 #include "trace.h" =20 -/* Keyboard Controller Commands */ -#define KBD_CCMD_READ_MODE 0x20 /* Read mode bits */ -#define KBD_CCMD_WRITE_MODE 0x60 /* Write mode bits */ -#define KBD_CCMD_GET_VERSION 0xA1 /* Get controller version */ -#define KBD_CCMD_MOUSE_DISABLE 0xA7 /* Disable mouse interface */ -#define KBD_CCMD_MOUSE_ENABLE 0xA8 /* Enable mouse interface */ -#define KBD_CCMD_TEST_MOUSE 0xA9 /* Mouse interface test */ -#define KBD_CCMD_SELF_TEST 0xAA /* Controller self test */ -#define KBD_CCMD_KBD_TEST 0xAB /* Keyboard interface test */ -#define KBD_CCMD_KBD_DISABLE 0xAD /* Keyboard interface disable */ -#define KBD_CCMD_KBD_ENABLE 0xAE /* Keyboard interface enable */ -#define KBD_CCMD_READ_INPORT 0xC0 /* read input port */ -#define KBD_CCMD_READ_OUTPORT 0xD0 /* read output port */ -#define KBD_CCMD_WRITE_OUTPORT 0xD1 /* write output port */ -#define KBD_CCMD_WRITE_OBUF 0xD2 -#define KBD_CCMD_WRITE_AUX_OBUF 0xD3 /* Write to output buffer as if - initiated by the auxiliary devi= ce */ -#define KBD_CCMD_WRITE_MOUSE 0xD4 /* Write the following byte to the mouse= */ -#define KBD_CCMD_DISABLE_A20 0xDD /* HP vectra only ? */ -#define KBD_CCMD_ENABLE_A20 0xDF /* HP vectra only ? */ -#define KBD_CCMD_PULSE_BITS_3_0 0xF0 /* Pulse bits 3-0 of the output po= rt P2. */ -#define KBD_CCMD_RESET 0xFE /* Pulse bit 0 of the output port = P2 =3D CPU reset. */ -#define KBD_CCMD_NO_OP 0xFF /* Pulse no bits of the output por= t P2. */ +/* Keyboard Controller Commands */ + +/* Read mode bits */ +#define KBD_CCMD_READ_MODE 0x20 +/* Write mode bits */ +#define KBD_CCMD_WRITE_MODE 0x60 +/* Get controller version */ +#define KBD_CCMD_GET_VERSION 0xA1 +/* Disable mouse interface */ +#define KBD_CCMD_MOUSE_DISABLE 0xA7 +/* Enable mouse interface */ +#define KBD_CCMD_MOUSE_ENABLE 0xA8 +/* Mouse interface test */ +#define KBD_CCMD_TEST_MOUSE 0xA9 +/* Controller self test */ +#define KBD_CCMD_SELF_TEST 0xAA +/* Keyboard interface test */ +#define KBD_CCMD_KBD_TEST 0xAB +/* Keyboard interface disable */ +#define KBD_CCMD_KBD_DISABLE 0xAD +/* Keyboard interface enable */ +#define KBD_CCMD_KBD_ENABLE 0xAE +/* read input port */ +#define KBD_CCMD_READ_INPORT 0xC0 +/* read output port */ +#define KBD_CCMD_READ_OUTPORT 0xD0 +/* write output port */ +#define KBD_CCMD_WRITE_OUTPORT 0xD1 +#define KBD_CCMD_WRITE_OBUF 0xD2 +/* Write to output buffer as if initiated by the auxiliary device */ +#define KBD_CCMD_WRITE_AUX_OBUF 0xD3 +/* Write the following byte to the mouse */ +#define KBD_CCMD_WRITE_MOUSE 0xD4 +/* HP vectra only ? */ +#define KBD_CCMD_DISABLE_A20 0xDD +/* HP vectra only ? */ +#define KBD_CCMD_ENABLE_A20 0xDF +/* Pulse bits 3-0 of the output port P2. */ +#define KBD_CCMD_PULSE_BITS_3_0 0xF0 +/* Pulse bit 0 of the output port P2 =3D CPU reset. */ +#define KBD_CCMD_RESET 0xFE +/* Pulse no bits of the output port P2. */ +#define KBD_CCMD_NO_OP 0xFF =20 /* Status Register Bits */ -#define KBD_STAT_OBF 0x01 /* Keyboard output buffer full */ -#define KBD_STAT_IBF 0x02 /* Keyboard input buffer full */ -#define KBD_STAT_SELFTEST 0x04 /* Self test successful */ -#define KBD_STAT_CMD 0x08 /* Last write was a command write (0=3Ddata) */ -#define KBD_STAT_UNLOCKED 0x10 /* Zero if keyboard locked */ -#define KBD_STAT_MOUSE_OBF 0x20 /* Mouse output buffer full */ -#define KBD_STAT_GTO 0x40 /* General receive/xmit timeout */ -#define KBD_STAT_PERR 0x80 /* Parity error */ + +/* Keyboard output buffer full */ +#define KBD_STAT_OBF 0x01 +/* Keyboard input buffer full */ +#define KBD_STAT_IBF 0x02 +/* Self test successful */ +#define KBD_STAT_SELFTEST 0x04 +/* Last write was a command write (0=3Ddata) */ +#define KBD_STAT_CMD 0x08 +/* Zero if keyboard locked */ +#define KBD_STAT_UNLOCKED 0x10 +/* Mouse output buffer full */ +#define KBD_STAT_MOUSE_OBF 0x20 +/* General receive/xmit timeout */ +#define KBD_STAT_GTO 0x40 +/* Parity error */ +#define KBD_STAT_PERR 0x80 =20 /* Controller Mode Register Bits */ -#define KBD_MODE_KBD_INT 0x01 /* Keyboard data generate IRQ1 */ -#define KBD_MODE_MOUSE_INT 0x02 /* Mouse data generate IRQ12 */ -#define KBD_MODE_SYS 0x04 /* The system flag (?) */ -#define KBD_MODE_NO_KEYLOCK 0x08 /* The keylock doesn't affect the keyboar= d if set */ -#define KBD_MODE_DISABLE_KBD 0x10 /* Disable keyboard interface */ -#define KBD_MODE_DISABLE_MOUSE 0x20 /* Disable mouse interface */ -#define KBD_MODE_KCC 0x40 /* Scan code conversion to PC format */ -#define KBD_MODE_RFU 0x80 + +/* Keyboard data generate IRQ1 */ +#define KBD_MODE_KBD_INT 0x01 +/* Mouse data generate IRQ12 */ +#define KBD_MODE_MOUSE_INT 0x02 +/* The system flag (?) */ +#define KBD_MODE_SYS 0x04 +/* The keylock doesn't affect the keyboard if set */ +#define KBD_MODE_NO_KEYLOCK 0x08 +/* Disable keyboard interface */ +#define KBD_MODE_DISABLE_KBD 0x10 +/* Disable mouse interface */ +#define KBD_MODE_DISABLE_MOUSE 0x20 +/* Scan code conversion to PC format */ +#define KBD_MODE_KCC 0x40 +#define KBD_MODE_RFU 0x80 =20 /* Output Port Bits */ #define KBD_OUT_RESET 0x01 /* 1=3Dnormal mode, 0=3Dreset */ @@ -89,7 +126,8 @@ #define KBD_OUT_OBF 0x10 /* Keyboard output buffer full */ #define KBD_OUT_MOUSE_OBF 0x20 /* Mouse output buffer full */ =20 -/* OSes typically write 0xdd/0xdf to turn the A20 line off and on. +/* + * OSes typically write 0xdd/0xdf to turn the A20 line off and on. * We make the default value of the outport include these four bits, * so that the subsection is rarely necessary. */ @@ -133,8 +171,10 @@ typedef struct KBDState { hwaddr mask; } KBDState; =20 -/* XXX: not generating the irqs if KBD_MODE_DISABLE_KBD is set may be - incorrect, but it avoids having to simulate exact delays */ +/* + * XXX: not generating the irqs if KBD_MODE_DISABLE_KBD is set may be + * incorrect, but it avoids having to simulate exact delays + */ static void kbd_update_irq_lines(KBDState *s) { int irq_kbd_level, irq_mouse_level; @@ -302,21 +342,23 @@ static void kbd_write_command(void *opaque, hwaddr ad= dr, =20 trace_pckbd_kbd_write_command(val); =20 - /* Bits 3-0 of the output port P2 of the keyboard controller may be pu= lsed + /* + * Bits 3-0 of the output port P2 of the keyboard controller may be pu= lsed * low for approximately 6 micro seconds. Bits 3-0 of the KBD_CCMD_PUL= SE * command specify the output port bits to be pulsed. * 0: Bit should be pulsed. 1: Bit should not be modified. * The only useful version of this command is pulsing bit 0, * which does a CPU reset. */ - if((val & KBD_CCMD_PULSE_BITS_3_0) =3D=3D KBD_CCMD_PULSE_BITS_3_0) { - if(!(val & 1)) + if ((val & KBD_CCMD_PULSE_BITS_3_0) =3D=3D KBD_CCMD_PULSE_BITS_3_0) { + if (!(val & 1)) { val =3D KBD_CCMD_RESET; - else + } else { val =3D KBD_CCMD_NO_OP; + } } =20 - switch(val) { + switch (val) { case KBD_CCMD_READ_MODE: kbd_queue(s, s->mode, 0); break; @@ -409,7 +451,7 @@ static void kbd_write_data(void *opaque, hwaddr addr, =20 trace_pckbd_kbd_write_data(val); =20 - switch(s->write_cmd) { + switch (s->write_cmd) { case 0: ps2_write_keyboard(s->kbd, val); /* sending data to the keyboard reenables PS/2 communication */ @@ -607,7 +649,7 @@ static const VMStateDescription vmstate_kbd =3D { VMSTATE_UINT8(pending_tmp, KBDState), VMSTATE_END_OF_LIST() }, - .subsections =3D (const VMStateDescription*[]) { + .subsections =3D (const VMStateDescription * []) { &vmstate_kbd_outport, &vmstate_kbd_extended_state, NULL @@ -619,10 +661,11 @@ static uint64_t kbd_mm_readfn(void *opaque, hwaddr ad= dr, unsigned size) { KBDState *s =3D opaque; =20 - if (addr & s->mask) + if (addr & s->mask) { return kbd_read_status(s, 0, 1) & 0xff; - else + } else { return kbd_read_data(s, 0, 1) & 0xff; + } } =20 static void kbd_mm_writefn(void *opaque, hwaddr addr, @@ -630,10 +673,11 @@ static void kbd_mm_writefn(void *opaque, hwaddr addr, { KBDState *s =3D opaque; =20 - if (addr & s->mask) + if (addr & s->mask) { kbd_write_command(s, 0, value & 0xff, 1); - else + } else { kbd_write_data(s, 0, value & 0xff, 1); + } } =20 =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079454613680.7813398776431; Fri, 24 Jun 2022 07:04:14 -0700 (PDT) Received: from localhost ([::1]:36054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4juu-0000kw-MV for importer@patchew.org; Fri, 24 Jun 2022 10:04:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaI-0001KN-QS; Fri, 24 Jun 2022 09:42:57 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41890) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaH-0005Eb-9i; Fri, 24 Jun 2022 09:42:54 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jYf-00037t-Pi; Fri, 24 Jun 2022 14:41:17 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=AFbbUAzjgac/ZmziWUEJTg0l2q+ZflJgQ34UTmWNZms=; b=n77N9iU32lucTv7ItQFrkOPeRn yyfS25IHwri5nD7peqf0zR8z5bgVCEyLv/lbUEOt+CmFm23WSPCBBFEQ8vh7PghqOVsc6VzNH1XwA V1MPkOjn2V9sxkR+993DnR9hjOsr8ukyAjABGaVqwL5wxzTiYWFc2i8fUj9HX2piRXaKIOnLahrPV qAoLK/1QWEJsbgCx/NJ55mEJVxhIMmGTJ/35FEfJhLO+a13zW1zixz+0dj+C2J3jGUhhkVRY3Nr93 x69SN6YMjBKkPLsUapwWmp6C2lDUAQADRLhgdqL8NnNOWAH53gixDiLbltP3N0N44NpPFTxUMRlE1 S9mQduwssFme47P/4JHX/0xmAIiy33dxMPsu0CtzUyzeXBBnR3iLomtDRIulJVmnNdaQcIJ7jqlFA H5GKdcgcpvs6JQXZIoekhtewxTvZUss98s757fYwUeIcPs1/XlxgIcXuh6g2mFkWJ+RhkWrtfVint iSnJpWDkJdTk8wssAswLnd1NancViah7Z6PCIkxrIl9ezR3eZ0fTiDEvi9mQq0NC2Jf3OZFLtlpbh FcN+fZo6+XwuWrd16esGSIaM6ynIdNIK7gTBpoPxSA/zllj1chX+OIwduZqNzmqfuY96+bX2snuNa 97goHO54MryO1L8YGpxSdQmYsnmVtnRB7WyiRs1ZY=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:34 +0100 Message-Id: <20220624134109.881989-20-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 19/54] pckbd: move KBDState from pckbd.c to i8042.h X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079456620100001 This allows the QOM types in pckbd.c to be used elsewhere by simply includi= ng i8042.h. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/pckbd.c | 24 ------------------------ include/hw/input/i8042.h | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index c18a1a7fae..7b14cd007e 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -146,30 +146,6 @@ #define KBD_OBSRC_MOUSE 0x02 #define KBD_OBSRC_CTRL 0x04 =20 -typedef struct KBDState { - uint8_t write_cmd; /* if non zero, write data to port 60 is expected */ - uint8_t status; - uint8_t mode; - uint8_t outport; - uint32_t migration_flags; - uint32_t obsrc; - bool outport_present; - bool extended_state; - bool extended_state_loaded; - /* Bitmask of devices with data available. */ - uint8_t pending; - uint8_t obdata; - uint8_t cbdata; - uint8_t pending_tmp; - void *kbd; - void *mouse; - QEMUTimer *throttle_timer; - - qemu_irq irq_kbd; - qemu_irq irq_mouse; - qemu_irq a20_out; - hwaddr mask; -} KBDState; =20 /* * XXX: not generating the irqs if KBD_MODE_DISABLE_KBD is set may be diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index e070f546e4..84b5aa7f23 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -11,6 +11,31 @@ #include "hw/isa/isa.h" #include "qom/object.h" =20 +typedef struct KBDState { + uint8_t write_cmd; /* if non zero, write data to port 60 is expected */ + uint8_t status; + uint8_t mode; + uint8_t outport; + uint32_t migration_flags; + uint32_t obsrc; + bool outport_present; + bool extended_state; + bool extended_state_loaded; + /* Bitmask of devices with data available. */ + uint8_t pending; + uint8_t obdata; + uint8_t cbdata; + uint8_t pending_tmp; + void *kbd; + void *mouse; + QEMUTimer *throttle_timer; + + qemu_irq irq_kbd; + qemu_irq irq_mouse; + qemu_irq a20_out; + hwaddr mask; +} KBDState; + #define TYPE_I8042 "i8042" OBJECT_DECLARE_SIMPLE_TYPE(ISAKBDState, I8042) =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079477467840.7318520842991; Fri, 24 Jun 2022 07:04:37 -0700 (PDT) Received: from localhost ([::1]:36996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jvI-0001QA-Ar for importer@patchew.org; Fri, 24 Jun 2022 10:04:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaO-0001Mc-PD; Fri, 24 Jun 2022 09:43:01 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41920) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaL-0005Ex-R4; Fri, 24 Jun 2022 09:42:59 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jYj-00037t-FY; Fri, 24 Jun 2022 14:41:20 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=eMm3zc2ggsmpnF30OFxvoiRVnJIgdRorq+sG6jZDxbs=; b=0QP4vNZcRsbCxLWiPEBAaaueWD KIvY0rWQh/CCfWphwe3NG4x/DyxQrHpSAczY4gZx9nqx2n9XtbK5aW7jsWPKooINHJVJ1G6BdQ4IN NKQziuDC1cltf2Z3QqZ+5BS1tKn5SxgSaONF/qeXpwNZvKZQJNF6ZkaowOxAppsergnS5pUncCqFA 9jajKicjB2KxrkHBg4YYaPCIBNrAJXUr4MbQudWKst7XUxmcxCfvuH0iMu45GrofBqQFaf0NBflOQ sV89PEZjf2g/Jidhi1BXssiS4bII/e0jthcSzVFm9e87VyUf3aMqc1EIrHEpUaRGJUldI/1a0Ui1a OxoYB/NCRwom0+ysiFOCoDxuEtY+y8jqfGW10WrvTp9DXtkZi7+ZoUJ6iX55qSB/qWzZmwVgvdHd4 bkX4WkjoUPQ1ZjdXvD4WOjteDEObduTZsX2oseWv/KalP+dWrjoFXtBEPiojLfsGaP3K5yXvQFke2 cCL5TngFU+4QsBYFxz6QnEhXvjzENDPxdJV5FkP26kdLd11GzrWNu0r5Wn2J37oRSGrPyopv3TsqR mx/PO+kUT3n/dXH5+RtDBGB5T181ggEvEsF+XcbfYeuc4Xd+ZmkumUbsYu3vtuGGlVybkH572atT/ uB4x6zilccn32xnb9xAMLa3IE/It+tLTitgaJWJuE=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:35 +0100 Message-Id: <20220624134109.881989-21-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 20/54] pckbd: move ISAKBDState from pckbd.c to i8042.h X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079478663100001 This allows the QOM types in pckbd.c to be used elsewhere by simply includi= ng i8042.h. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Helge Deller --- hw/input/pckbd.c | 10 ---------- include/hw/input/i8042.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 7b14cd007e..f99e10cfcf 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -686,16 +686,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_ir= q, qemu_register_reset(kbd_reset, s); } =20 -struct ISAKBDState { - ISADevice parent_obj; - - KBDState kbd; - bool kbd_throttle; - MemoryRegion io[2]; - uint8_t kbd_irq; - uint8_t mouse_irq; -}; - void i8042_isa_mouse_fake_event(ISAKBDState *isa) { KBDState *s =3D &isa->kbd; diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index 84b5aa7f23..a246250d1f 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -39,6 +39,16 @@ typedef struct KBDState { #define TYPE_I8042 "i8042" OBJECT_DECLARE_SIMPLE_TYPE(ISAKBDState, I8042) =20 +struct ISAKBDState { + ISADevice parent_obj; + + KBDState kbd; + bool kbd_throttle; + MemoryRegion io[2]; + uint8_t kbd_irq; + uint8_t mouse_irq; +}; + #define I8042_A20_LINE "a20" =20 =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079623753751.5339794150875; Fri, 24 Jun 2022 07:07:03 -0700 (PDT) Received: from localhost ([::1]:45776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jxe-0007Ps-En for importer@patchew.org; Fri, 24 Jun 2022 10:07:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaT-0001QJ-6F; Fri, 24 Jun 2022 09:43:05 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41944) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaQ-0005FK-3O; Fri, 24 Jun 2022 09:43:03 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jYn-00037t-4x; Fri, 24 Jun 2022 14:41:24 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=shXzR4RW99BCzkfYBhf/duWH5beI9dd02mUMMo9ssG8=; b=LG5iF73spawH7eWf1wthH1LebU mk2osnQGj305MoJoJLkZsQSxXBvb956vcpEv5wXt5YcDv8bVMd7N2aC7RWK7utJdxAlQ4huKqsykU Xpl6BrMW2fhwjcHJL9xEUKwaScLIgzYZUpLDr8mHYTnckfsCi0z8juhthNCmSxGuw3Omh1/bMTWR6 e6Pgdssozfa1FuMcf750dYFm0qrVLgArO7f8yesNPoO7JVlFKKMPTwnQWe5hXmwA8fQGd4x9RyG2C JsKa4KFwkCnXqogbDS64zduFDGcUNc3F6is/wkU2ZaPsGHB2KoaQ3Sr/cVKum0bC8LX7uGjq2Bfvk ZLSp+j93cxWAqo6fvREpUYNfQxTW+5Xt4yp8lAOfX8fcT3Jgdn/n8IOLfWZQXjVrOAJ2Ja+FTGZu9 oTm6IUhaUIRxxlRefKgiPJoB4QUPkYwG5eEuNzi+tCdmDxlI7z59X65+Ro0NBwuUBdwRNT/5kTqps zjzn/HWZAVvAVqY1Ya1vaMOHK8QpXCx6nS1D0dXod5wkJ3FlzvWYAycqyyRIPJsGemM75n+Y022z7 TP+GjF2nuJH3GIdpzVT5B405NZ4t/NLMoXn2BTjcP69Nnnt70e8sK7B3Za7vELjcBYvsLiEFek9Aj Vh6vcIToEhCukBpK5Tn58lOaoJo8wKzp4m4ItMMDY=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:36 +0100 Message-Id: <20220624134109.881989-22-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 21/54] pckbd: introduce new I8042_MMIO QOM type X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079625689100001 Content-Type: text/plain; charset="utf-8" Currently i8042_mm_init() creates a new KBDState directly which is used by = the MIPS magnum machine. Introduce a new I8042_MMIO QOM type that will soon be used = to allow the MIPS magnum machine to be wired up using standard qdev GPIOs. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 22 +++++++++++++++++++++- include/hw/input/i8042.h | 10 ++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index f99e10cfcf..89a41ed566 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -665,11 +665,23 @@ static const MemoryRegionOps i8042_mmio_ops =3D { .endianness =3D DEVICE_NATIVE_ENDIAN, }; =20 +static void i8042_mmio_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); +} + void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, MemoryRegion *region, ram_addr_t size, hwaddr mask) { - KBDState *s =3D g_new0(KBDState, 1); + DeviceState *dev; + KBDState *s; + + dev =3D qdev_new(TYPE_I8042_MMIO); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + s =3D &I8042_MMIO(dev)->kbd; =20 s->irq_kbd =3D kbd_irq; s->irq_mouse =3D mouse_irq; @@ -686,6 +698,13 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_ir= q, qemu_register_reset(kbd_reset, s); } =20 +static const TypeInfo i8042_mmio_info =3D { + .name =3D TYPE_I8042_MMIO, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(MMIOKBDState), + .class_init =3D i8042_mmio_class_init +}; + void i8042_isa_mouse_fake_event(ISAKBDState *isa) { KBDState *s =3D &isa->kbd; @@ -841,6 +860,7 @@ static const TypeInfo i8042_info =3D { static void i8042_register_types(void) { type_register_static(&i8042_info); + type_register_static(&i8042_mmio_info); } =20 type_init(i8042_register_types) diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index a246250d1f..b7df9ace6e 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -9,6 +9,7 @@ #define HW_INPUT_I8042_H =20 #include "hw/isa/isa.h" +#include "hw/sysbus.h" #include "qom/object.h" =20 typedef struct KBDState { @@ -49,6 +50,15 @@ struct ISAKBDState { uint8_t mouse_irq; }; =20 +#define TYPE_I8042_MMIO "i8042-mmio" +OBJECT_DECLARE_SIMPLE_TYPE(MMIOKBDState, I8042_MMIO) + +struct MMIOKBDState { + SysBusDevice parent_obj; + + KBDState kbd; +}; + #define I8042_A20_LINE "a20" =20 =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165607979683848.824057455582306; Fri, 24 Jun 2022 07:09:56 -0700 (PDT) Received: from localhost ([::1]:54100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4k0Q-0004h9-Vj for importer@patchew.org; Fri, 24 Jun 2022 10:09:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaW-0001Rm-Gu; Fri, 24 Jun 2022 09:43:08 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41948) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaR-0005FR-9Q; Fri, 24 Jun 2022 09:43:08 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jYr-00037t-4v; Fri, 24 Jun 2022 14:41:25 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=DKty+RL/HfeLQYbktID6JL6wjBgh3DFMrE602y3f6wY=; b=L2ftVy2AliOqLGU93tGDdE54+R RVBXl/DeSeUbBXwqBnITc8g5UY078E4b2SQ4VQeBDf1EPchkExE/9DglxKWNq6+0yytYYJgUj4ijd usRyTK7flsnctCHSELwVNu/KZEpx3+CvqDXfbuATykarVEsjsRe4cKbSEmy387X/NqVOb7UjL8PP/ yQ140kJ/uYADhHBchSQrZ8amO9phCtlYTHkGwh6AuQvvjXznsRvmg0vmw4QD52j6gmLyuYlVJbF5R ELTSYEYCrtjl5v0R8/p+7Y2aBWqPRfDEh7M72Bx6teKW4XRhqJV+fhm49yaKovvRl1NmV44yhumj2 0Gci3mbrJJBjU5L31JoWYEwsU7nJdDVhwNiN5w5EJBvPJudHKCIu9TWidLyzHKxJn8+XKWuekjcQR zPoF1oVxmw3ClIUoVwgu+22zZgU3fwPXLhjo6xvdCaYcGd95IQEUb3L0fQjp/28dpHOqGlIOoHUGP HcWtakDvOaIl+3J7FaYNHf99rylHEiFFnlOwUZ6LSIc+NOecvnPWgJ8Ft2rwGCQl6j5zaFBvtRkgS EauqoiclJKHRMhk752MLo5p1Itkrp3xiD/iZudo67d/DfqzNXWrsvO+/PUIjBhN6kWhSqY/RMyvH0 DRECMjnlfr61W1p0gBhm3aGn3239D9wOPiocMXTjw=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:37 +0100 Message-Id: <20220624134109.881989-23-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 22/54] pckbd: implement i8042_mmio_reset() for I8042_MMIO device X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079797567100001 Content-Type: text/plain; charset="utf-8" This allows the I8042_MMIO reset function to be registered directly within = the DeviceClass rather than using qemu_register_reset() directly. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 89a41ed566..7b520d0eb4 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -665,10 +665,19 @@ static const MemoryRegionOps i8042_mmio_ops =3D { .endianness =3D DEVICE_NATIVE_ENDIAN, }; =20 +static void i8042_mmio_reset(DeviceState *dev) +{ + MMIOKBDState *s =3D I8042_MMIO(dev); + KBDState *ks =3D &s->kbd; + + kbd_reset(ks); +} + static void i8042_mmio_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 + dc->reset =3D i8042_mmio_reset; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } =20 @@ -695,7 +704,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, =20 s->kbd =3D ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse =3D ps2_mouse_init(kbd_update_aux_irq, s); - qemu_register_reset(kbd_reset, s); } =20 static const TypeInfo i8042_mmio_info =3D { --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165607920619248.7963417606619; Fri, 24 Jun 2022 07:00:06 -0700 (PDT) Received: from localhost ([::1]:56488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jqv-0003LO-39 for importer@patchew.org; Fri, 24 Jun 2022 10:00:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaX-0001SU-BL; Fri, 24 Jun 2022 09:43:09 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41958) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaT-0005FY-FN; Fri, 24 Jun 2022 09:43:09 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jYr-00037t-IQ; Fri, 24 Jun 2022 14:41:29 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ltZ3+GgmUYaGJn2M/PGmFQmXCQadV/DJAVJw9ttqRfM=; b=b0EIeHVE9Q3Hxo2l2HAJveXco2 YsYd0E5uTqj0OY0QGKxh8Oju7rKx1Aj11EHgyIbPHjRtAik8vYSXJeI62AxROFeowSzHBKU9xtoUD ubCeXadVWm+BxCSCZkKVq06PVMhCNdDVD6oT0DjGU5zCmKNl0ocyFYhX3sjIHEwhP9bHMWld8UYMt S8F9s4FY77EEof5U+AGXgvMmijQdAoudQGJq//JSw3LyLO4hvemL3wET65m63bHFo9EE0tWfTjLok DebBWmdocxz+8Hjd1J0tW3VEG2IFsqkrC4giAUKHj0FKBBFKMLINldnobYdlFdgKlgvO1k4UckEM6 9dRcNI0HPpo3Rz4TV20jghnuRc71VYRr3MkZAxWxeRc3WLxdICKzcNPDstI+Bts00eDDZOfKWLo3p 8Rl8VZldiNzjMNYU+OL6Axtq2U84ZGI4TqagQ4VZdJtcG2GNC1aFzXplYVr5M//7/35sMmQkXfScG CqezXiPZswoyBqey1OD5necXgZ90mEewR4qRmsp1SGv1hptGTlESp5dx2RPRIhMBwGCNBkz40mLeX UgWh7oaubejThmAhV6rkwdnFkbnIMl5bfT2l1vTN58PXIC8GscItmBx2JiAJpDT3eOKuWI3k9nVXH LGMMPXOAwdMw/usxGa4VpAMEMLDr+6RfagI+ZlI/Q=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:38 +0100 Message-Id: <20220624134109.881989-24-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 23/54] pckbd: add mask qdev property to I8042_MMIO device X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079206919100001 Content-Type: text/plain; charset="utf-8" This allows the KBDState mask value to be set using a qdev property rather than directly in i8042_mm_init(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 7b520d0eb4..c04a2c587e 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -673,11 +673,17 @@ static void i8042_mmio_reset(DeviceState *dev) kbd_reset(ks); } =20 +static Property i8042_mmio_properties[] =3D { + DEFINE_PROP_UINT64("mask", MMIOKBDState, kbd.mask, UINT64_MAX), + DEFINE_PROP_END_OF_LIST(), +}; + static void i8042_mmio_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->reset =3D i8042_mmio_reset; + device_class_set_props(dc, i8042_mmio_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } =20 @@ -689,12 +695,12 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_i= rq, KBDState *s; =20 dev =3D qdev_new(TYPE_I8042_MMIO); + qdev_prop_set_uint64(dev, "mask", mask); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s =3D &I8042_MMIO(dev)->kbd; =20 s->irq_kbd =3D kbd_irq; s->irq_mouse =3D mouse_irq; - s->mask =3D mask; =20 s->extended_state =3D true; =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079756130806.9669237597889; Fri, 24 Jun 2022 07:09:16 -0700 (PDT) Received: from localhost ([::1]:52118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jzn-0003Id-1b for importer@patchew.org; Fri, 24 Jun 2022 10:09:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jad-0001ci-W1; Fri, 24 Jun 2022 09:43:16 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41984) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaZ-0005Fp-Cx; Fri, 24 Jun 2022 09:43:13 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jYv-00037t-Hm; Fri, 24 Jun 2022 14:41:33 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=dt7e6dZP+plvG7eZHWsBoI0OW/XkGr3/9iptYsdQ8kc=; b=Od5SRoc5KiJeGrCks4IsqCYmgO mauanM7LsvVlnMJ+qoxpl60BM5M+mruPDiC8aLcNNBu800Twn1WrDCwx5HLArGUx5zrjdM973z7r8 WktMgTuUJ/YDsOCWPmQCX/U5pl8rz2qvO1XPAQoemsjkkSk3xxHOFiuct3D7I73VRPd8+EcAFSQsw GI7P6xDEfDvfnA0EW2VZApqLhp5i2R2I+PU7qg56zu4IAF1JSWSgT1WEczEJ9N6DR3BnMx5hQ37tq Pi4S1LEuuRnMS5kBxC8MsSlTeqFPd/NjCw7S1PIiAdteAI35W0qeuIuQ00HNKXR7/qwwzUmquBXS3 ZpKGRvBesT3tkLAlB1+9tKxkDocWfHYCUPBU1YjtwUa/6GTMypArSpQVabEf0t2DojjqyxhiIXRcN H0EwoLVBKLC/NKVBPu7/X0muav5BSUuRC1TqJCpCWpZ85C7zflTrCdKB8WrPxeFZGv1u0nYv+48r9 hj5oG8hyKEGW7stpmxz5H0Dxq8HyaB/qJ+CrziukEEhUDGQxCb0joiosW+3lEozglB4/SlKL+e9r5 nzqnwWt8W/qm4boVn3C8TfSQPKciqi0byyR4wGcpFkA2HCkkd3wJIze+ztP/tqCDwMoTsgkevnsE7 nOfw2Qy+o4ZD3ys2pDBd6muEysA80tknY//f0HpVc=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:39 +0100 Message-Id: <20220624134109.881989-25-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 24/54] pckbd: add size qdev property to I8042_MMIO device X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079758262100001 Content-Type: text/plain; charset="utf-8" This will soon be used to set the size of the register memory region using a qdev property. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 2 ++ include/hw/input/i8042.h | 1 + 2 files changed, 3 insertions(+) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index c04a2c587e..a70442e0f8 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -675,6 +675,7 @@ static void i8042_mmio_reset(DeviceState *dev) =20 static Property i8042_mmio_properties[] =3D { DEFINE_PROP_UINT64("mask", MMIOKBDState, kbd.mask, UINT64_MAX), + DEFINE_PROP_UINT32("size", MMIOKBDState, size, -1), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -696,6 +697,7 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, =20 dev =3D qdev_new(TYPE_I8042_MMIO); qdev_prop_set_uint64(dev, "mask", mask); + qdev_prop_set_uint32(dev, "size", size); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s =3D &I8042_MMIO(dev)->kbd; =20 diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index b7df9ace6e..ac4098b957 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -57,6 +57,7 @@ struct MMIOKBDState { SysBusDevice parent_obj; =20 KBDState kbd; + uint32_t size; }; =20 #define I8042_A20_LINE "a20" --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079669764555.9188523950329; Fri, 24 Jun 2022 07:07:49 -0700 (PDT) Received: from localhost ([::1]:48532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jyO-0000qn-I0 for importer@patchew.org; Fri, 24 Jun 2022 10:07:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaf-0001fx-6X; Fri, 24 Jun 2022 09:43:17 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41998) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jac-0005G7-Ku; Fri, 24 Jun 2022 09:43:16 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jYz-00037t-TM; Fri, 24 Jun 2022 14:41:37 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Ds29DQKfo+WciKWPiKwA+SY/YM6305wwN7hD6NZSA7g=; b=zdcY1Kel84mnwOAS18FxypBmeA ueejuCwRj/QpUmJK+Ix/h/uuVe4Hph4vW+zS/YQ7Jc7vJchZkfl5/2hArtflVkuZGxlbchg0tjEv6 vRvIUhemgg9kL6DKoji9eH5zFafHgsToyEsJLQalAu6IXtscRFdyd/LvA0zPwD/AaFgIgwN0rLmqK +DRD+YjsNQkgMLp02XQ8uyXQB/c9mf3EkMUvZrQGf2FvncJxG6Nf41tWxA47xXx1lEde0vx9bOcjq YzadyLYrT71ruceE35JhbALN0cQkhwOjPDKPjIZdgL0y+1uHeLH2xjIsQCnO/HV2ttTScFUANWNQm affOA7Axwkw6I6T95ygIw/9IokWFPuGdRJ8JUFhCeudqippHBjT7Ctf5qI/IOcSnzdk0bTFXdPdQ8 jTomMsWjEwYyqXTNOlygYIc+udoCeMSmRqzmygDRTp9IJePoTDNZoMeaJsoSE4b5ForvWBwQek9PG ktBkGvqy9JEvNCmJmsYSD/Ir9V0JJOV0qlPl57TSV3I8sKldHHvHUspC/L8/wixZpdtGAHbXkkEm0 61ROIl6HDQGlU0xus+3fU7P4e8d/0jHlPuN1C3AcqBJ37v9gDYrgej7uTYRjIpLyfRWjXvl9zcWih nsdtSVdn1kd/rSGJEZoUTsEURG+v8M9sVKjHIMI9w=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:40 +0100 Message-Id: <20220624134109.881989-26-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 25/54] pckbd: implement i8042_mmio_realize() function X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079671698100001 Content-Type: text/plain; charset="utf-8" Move the initialisation of the register memory region to the I8042_MMIO dev= ice realize function and expose it using sysbus_init_mmio(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 14 +++++++++++++- include/hw/input/i8042.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index a70442e0f8..bc51f7eedd 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -673,6 +673,17 @@ static void i8042_mmio_reset(DeviceState *dev) kbd_reset(ks); } =20 +static void i8042_mmio_realize(DeviceState *dev, Error **errp) +{ + MMIOKBDState *s =3D I8042_MMIO(dev); + KBDState *ks =3D &s->kbd; + + memory_region_init_io(&s->region, OBJECT(dev), &i8042_mmio_ops, ks, + "i8042", s->size); + + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->region); +} + static Property i8042_mmio_properties[] =3D { DEFINE_PROP_UINT64("mask", MMIOKBDState, kbd.mask, UINT64_MAX), DEFINE_PROP_UINT32("size", MMIOKBDState, size, -1), @@ -683,6 +694,7 @@ static void i8042_mmio_class_init(ObjectClass *klass, v= oid *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 + dc->realize =3D i8042_mmio_realize; dc->reset =3D i8042_mmio_reset; device_class_set_props(dc, i8042_mmio_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); @@ -708,7 +720,7 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, =20 vmstate_register(NULL, 0, &vmstate_kbd, s); =20 - memory_region_init_io(region, NULL, &i8042_mmio_ops, s, "i8042", size); + region =3D &I8042_MMIO(dev)->region; =20 s->kbd =3D ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse =3D ps2_mouse_init(kbd_update_aux_irq, s); diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index ac4098b957..59d695a9dd 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -58,6 +58,7 @@ struct MMIOKBDState { =20 KBDState kbd; uint32_t size; + MemoryRegion region; }; =20 #define I8042_A20_LINE "a20" --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079543987462.488992914867; Fri, 24 Jun 2022 07:05:43 -0700 (PDT) Received: from localhost ([::1]:39422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jwM-00034n-BU for importer@patchew.org; Fri, 24 Jun 2022 10:05:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaj-0001rY-Rk; Fri, 24 Jun 2022 09:43:21 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42018) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jag-0005GX-Di; Fri, 24 Jun 2022 09:43:21 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZ3-00037t-KD; Fri, 24 Jun 2022 14:41:41 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TJVbzcOHsgxqs5i7fi+Gogmj4a0olFvR0c/lHpv3bf0=; b=c1XlIyhvf2ZJY7vlq7In2veUX5 lvUJOG8AkBXI3tP3WZ5wMCoFui6fT5q1137XqUkXjqSh1BaLVblnkAFyJkq38rSRatwG/mzdl5i+c fbttMO2q19H8IR2nxHShQ3kw0kPeSMzVxsRSOX7DkNQyD/qaRXtwLrBnKXQgvL5tZT0s8wHvbrZ5D ZwzCONK9Tk5yGn65UPVqOL+57t8R88VR8SOEQPxtJx/p8wjhUfcYCDYrFX29tHCQmxWJS3tDb74nb hpcKyFfHCdPMoXBaXzCGRi9KBWTyD2kMADU/LtgMfKHWZgsnAsrqBSv1jWL5n2vywtROwnkrRiLZ1 0yvRet+wXruLG62CRWKAgTfEVyKY7bbZ8H230SF01i3D9kOize2bHY3mW5UzvxHXuTDFrX58KyK4q asjkLGIZCaOKJdA2baMaqJGQ27JZFEZW2YAFJGr3l/oxYQL2622jkmvFzv91nNuZknwOqInliiW6i gOKib2VV1eDHrplwEj7710Y16Y3WT9bCGR3MlzogvERkWYhImkVwWB8t9QKjrPoAPwWtM6C3R0YS2 JDAZ3+sevMwgF+bwiT1Dpxv90mQl54gK2F/lxpvKCjNRd097sM2H4cjFSLTdVDHfq576J9ZeVM7zd kYa5moH9QNZjqey3E77a8faixWQVmzrS6ZTUjwLv0=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:41 +0100 Message-Id: <20220624134109.881989-27-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 26/54] pckbd: implement i8042_mmio_init() function X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079545307100003 Content-Type: text/plain; charset="utf-8" This enables use to set the required value of extended_state directly during device init rather than in i8042_mm_init(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index bc51f7eedd..b8623d2f9a 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -684,6 +684,14 @@ static void i8042_mmio_realize(DeviceState *dev, Error= **errp) sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->region); } =20 +static void i8042_mmio_init(Object *obj) +{ + MMIOKBDState *s =3D I8042_MMIO(obj); + KBDState *ks =3D &s->kbd; + + ks->extended_state =3D true; +} + static Property i8042_mmio_properties[] =3D { DEFINE_PROP_UINT64("mask", MMIOKBDState, kbd.mask, UINT64_MAX), DEFINE_PROP_UINT32("size", MMIOKBDState, size, -1), @@ -716,8 +724,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, s->irq_kbd =3D kbd_irq; s->irq_mouse =3D mouse_irq; =20 - s->extended_state =3D true; - vmstate_register(NULL, 0, &vmstate_kbd, s); =20 region =3D &I8042_MMIO(dev)->region; @@ -729,6 +735,7 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, static const TypeInfo i8042_mmio_info =3D { .name =3D TYPE_I8042_MMIO, .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_init =3D i8042_mmio_init, .instance_size =3D sizeof(MMIOKBDState), .class_init =3D i8042_mmio_class_init }; --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079952951700.5671202358573; Fri, 24 Jun 2022 07:12:32 -0700 (PDT) Received: from localhost ([::1]:60718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4k2x-0000tV-O8 for importer@patchew.org; Fri, 24 Jun 2022 10:12:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jam-00020P-TY; Fri, 24 Jun 2022 09:43:24 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42038) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jal-0005Gp-CT; Fri, 24 Jun 2022 09:43:24 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZ7-00037t-F9; Fri, 24 Jun 2022 14:41:45 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=f20XAKlV73C1AtBoFgDM7PTELLB03NW7scoQvrrrph8=; b=xYOpeQBzeCKVA8xiS0FPBUqCuO pFTA4YqwVDCMhDZD6Tg5YBU+DNyw52GpGoiALIRBCq/pV+Wojt8Yt/TQIHgh8V8CwkWIgZv/rq6lH 5NjaKAdwoxQLinpPz2j+IBqTQMqFM5Hom2i/h+9/CNg8zf4JpNs0b0LR8xotn7qH2IO7AIYyZD9UM 3pdmYoRc8XiE3/Hyri9mM3FrVu3X3fvo7udgdKwXdaBZxOIJ2Q09/qI4ffxJ9lGyrSVNYUGwDxEh1 fhcg71sfDOiPKUEHHKm1aN/insyNmPid0J8n0T6rWHUQ8Ojxo9fqcsTekgJIlj24ru7aAgJnNK6FI +Kfm+bHsHWCEifvyF0ismcG8Zq1M3l0jOCbtQqE1lMUCbObqkBTMuoSkpga22SwtgRh4jEzPabTzi 2CPFZ2u+lzk/gZ1HA5PnurWxlqtx5LOGAYTbCAKqC1lk8q2D0xqdzw4kPsQ03ez1kDFYi9U/X0qaC s6/lK0fv2CYQKzs3OhxNsnMp+NyCRkfEiaiyRhDnvemokOokor1yVQYnS18p6Dxe3iw4R8MhXGC8r 9nx8mRlaj8bzPJBMfQ/dMbBOAu0K7pYAEUlh/Ai15o3D7SI8tLFNpiw4Z4EsiySA09GaqxMxmiWwN exMCAfwcwg0t8al5F+1S3sqmNha6A/A3sPoF3Fm6M=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:42 +0100 Message-Id: <20220624134109.881989-28-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 27/54] pckbd: alter i8042_mm_init() to return a I8042_MMIO device X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079954630100002 Content-Type: text/plain; charset="utf-8" This exposes the I8042_MMIO device to the caller to allow the register memo= ry region to be mapped outside of i8042_mm_init(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 8 +++++--- include/hw/input/i8042.h | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index b8623d2f9a..702dab056c 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -708,9 +708,9 @@ static void i8042_mmio_class_init(ObjectClass *klass, v= oid *data) set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } =20 -void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, - MemoryRegion *region, ram_addr_t size, - hwaddr mask) +MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, + MemoryRegion *region, ram_addr_t size, + hwaddr mask) { DeviceState *dev; KBDState *s; @@ -730,6 +730,8 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, =20 s->kbd =3D ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse =3D ps2_mouse_init(kbd_update_aux_irq, s); + + return I8042_MMIO(dev); } =20 static const TypeInfo i8042_mmio_info =3D { diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index 59d695a9dd..d05cd33e3c 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -64,9 +64,9 @@ struct MMIOKBDState { #define I8042_A20_LINE "a20" =20 =20 -void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, - MemoryRegion *region, ram_addr_t size, - hwaddr mask); +MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, + MemoryRegion *region, ram_addr_t size, + hwaddr mask); void i8042_isa_mouse_fake_event(ISAKBDState *isa); void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out); =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079994645132.82135267720696; Fri, 24 Jun 2022 07:13:14 -0700 (PDT) Received: from localhost ([::1]:35060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4k3d-0002hE-KO for importer@patchew.org; Fri, 24 Jun 2022 10:13:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jap-0002CG-NU; Fri, 24 Jun 2022 09:43:27 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42054) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jao-0005IC-7N; Fri, 24 Jun 2022 09:43:27 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZB-00037t-Ed; Fri, 24 Jun 2022 14:41:48 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/X9Dr4htGi4L5rm6MsDj2GRiW1/0QY1igL7ix8ThnGw=; b=ztmSlKO4Y/EBrH0kWFcm8Bm3iC /yKZ+IYEElWa/1gzyQiB9bNhcpTQzpx29zr5Ncz0TpDW4KkUdugy0qCrmNDfiF/GedcRFrBzlrr8J 45TjaFYY0saxPyg5CI2K/LrXDKj7MUSAdfEZWQ+qRcZLJvDdGTigv8+a13lCgE5rx7VBY7UrUn3kI Nc7AZp2kXyh+kc7SqpmB8BUcLnLBLa4cH0MVIm+VEGhzcxJ6Qp+qU26+o8Lkfyx8X8NqjsLjvNuyR OwCYDHCp2bG29VVptlGikbmJsuQyaORa/aTNcYRvIgOfPbTowV3FBUTh9m7TPCiUt/uFv70RDDhdJ fA6CXNeq9/YAuqy4yEDfVW2QEH4VfXaDLhs+QahOCcUez7qOx81Uez7dS6mjtbFeuO/1s1XLEthe3 U1J7QEVNJcBzbtJ0PQdhqFWH+qDFXbE1+fzyI0UD6VsNiEoYVbtdjqfgtRAWb6aAxVy+C9j05Ml1r liPr0ds1MqQgL1A//URuYmMgYEEewvbr5dKFJYmGE/1mTOI2fMW/BChOsIIgUR5kKHTiy6gPbW3KM zwwZXmliL3hQe04+AvWok0/ebsS5NDVLkm+VQi43xwHvLGbLat5cfFf8VHdyv9DdgRyEf5Zs2sFj0 td+iLX0KyfmJR6WaycUoyjqCHXeC1qMnUcF46uEMY=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:43 +0100 Message-Id: <20220624134109.881989-29-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 28/54] pckbd: move mapping of I8042_MMIO registers to MIPS magnum machine X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079996606100001 Content-Type: text/plain; charset="utf-8" Now that the register memory region is exposed as a SysBus memory region, m= ove the mapping of the I8042_MMIO registers from i8042_mm_init() to the MIPS ma= gnum machine (which is its only user). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 5 +---- hw/mips/jazz.c | 11 +++++++---- include/hw/input/i8042.h | 3 +-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 702dab056c..8708595eed 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -709,8 +709,7 @@ static void i8042_mmio_class_init(ObjectClass *klass, v= oid *data) } =20 MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, - MemoryRegion *region, ram_addr_t size, - hwaddr mask) + ram_addr_t size, hwaddr mask) { DeviceState *dev; KBDState *s; @@ -726,8 +725,6 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq = mouse_irq, =20 vmstate_register(NULL, 0, &vmstate_kbd, s); =20 - region =3D &I8042_MMIO(dev)->region; - s->kbd =3D ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse =3D ps2_mouse_init(kbd_update_aux_irq, s); =20 diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index 96dc6ab32d..1eb8bd5018 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -136,11 +136,11 @@ static void mips_jazz_init(MachineState *machine, MemoryRegion *isa_mem =3D g_new(MemoryRegion, 1); MemoryRegion *isa_io =3D g_new(MemoryRegion, 1); MemoryRegion *rtc =3D g_new(MemoryRegion, 1); - MemoryRegion *i8042 =3D g_new(MemoryRegion, 1); MemoryRegion *dma_dummy =3D g_new(MemoryRegion, 1); MemoryRegion *dp8393x_prom =3D g_new(MemoryRegion, 1); NICInfo *nd; DeviceState *dev, *rc4030; + MMIOKBDState *i8042; SysBusDevice *sysbus; ISABus *isa_bus; ISADevice *pit; @@ -361,9 +361,12 @@ static void mips_jazz_init(MachineState *machine, memory_region_add_subregion(address_space, 0x80004000, rtc); =20 /* Keyboard (i8042) */ - i8042_mm_init(qdev_get_gpio_in(rc4030, 6), qdev_get_gpio_in(rc4030, 7), - i8042, 0x1000, 0x1); - memory_region_add_subregion(address_space, 0x80005000, i8042); + i8042 =3D i8042_mm_init(qdev_get_gpio_in(rc4030, 6), + qdev_get_gpio_in(rc4030, 7), + 0x1000, 0x1); + memory_region_add_subregion(address_space, 0x80005000, + sysbus_mmio_get_region(SYS_BUS_DEVICE(i804= 2), + 0)); =20 /* Serial ports */ serial_mm_init(address_space, 0x80006000, 0, diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index d05cd33e3c..9d1f8af964 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -65,8 +65,7 @@ struct MMIOKBDState { =20 =20 MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, - MemoryRegion *region, ram_addr_t size, - hwaddr mask); + ram_addr_t size, hwaddr mask); void i8042_isa_mouse_fake_event(ISAKBDState *isa); void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out); =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079676586589.9554434640809; Fri, 24 Jun 2022 07:07:56 -0700 (PDT) Received: from localhost ([::1]:49240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4jyU-0001K5-UE for importer@patchew.org; Fri, 24 Jun 2022 10:07:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jat-0002Pk-Ai; Fri, 24 Jun 2022 09:43:31 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42074) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jar-0005IU-QB; Fri, 24 Jun 2022 09:43:31 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZF-00037t-5q; Fri, 24 Jun 2022 14:41:52 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=nUCE8pBe50IIjO3hRcaQ95siTMKex3l9jFQQyIhNLvQ=; b=aZIbUXqXqV4Zct/lgYA2oME/8q bnE1yQPusbHf0a9UEenQHCTzlixSwyvdRZWIo0JT1M2lekSU1ZQ7VD6moXOHrgXzs8+mdtaLyu95T 9YdB46PZ74aC3hKITbYK7J4Fdw2zjRW90nD57BV1z3O4/Hq0ObrQoQQdJNYjv9//1hh+naRDzvTqq hmGX8GaWB8qpgJ+pPCR7ACHkUo1+8/K7GJEt87gbB/a1nINE1ULh0KKpFGMYxNzuXEy5KH7uNVK6z xX7G1leNRGcRGiiFeNBTOIhiVir1SoUWwYPfB8LizfvxZF/9VEwEgfnC9IgqYE9lR/dcxiRyf67mj bPIDsdbN1HI80GOao1c2viYJtMuoacM9v+91gczwiD0AO+jI4FDKQOFuNc99stvxiVH7cDbtncrX5 nY32WqF43wVjAi5kgRtAJVlo4KaLNqxBIY4b4XOsS6yCqXwAiQSH6teTBEhkqdmBaYaj8WVmiLZSK RpQR9SZlgA5gCSV/O5UDAx3CbWy3SA8dGmnyXwsEFqBX2a9qUvsXmByNHnXrddP6v/UExOjQ9rufZ X0YSa5F8v/1EoVF/qYve3TiLsPDKL4AP9vI9SsO7Ra3qpUrhS++/tbC34r2c6Cd0W7IOamn2kFlhD EkwU0Z5I0n/NepwFzrISe4U7ypB9EKNJ0JJstLeNc=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:44 +0100 Message-Id: <20220624134109.881989-30-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 29/54] pckbd: more vmstate_register() from i8042_mm_init() to i8042_mmio_realize() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079677659100001 Content-Type: text/plain; charset="utf-8" Note in this case it is not possible to register a (new) VMStateDescription= in the DeviceClass without breaking migration compatibility for the MIPS magnum machine. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 8708595eed..1ab76793ea 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -682,6 +682,9 @@ static void i8042_mmio_realize(DeviceState *dev, Error = **errp) "i8042", s->size); =20 sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->region); + + /* Note we can't use dc->vmsd without breaking migration compatibility= */ + vmstate_register(NULL, 0, &vmstate_kbd, ks); } =20 static void i8042_mmio_init(Object *obj) @@ -723,8 +726,6 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq = mouse_irq, s->irq_kbd =3D kbd_irq; s->irq_mouse =3D mouse_irq; =20 - vmstate_register(NULL, 0, &vmstate_kbd, s); - s->kbd =3D ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse =3D ps2_mouse_init(kbd_update_aux_irq, s); =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656080187644196.06153538403794; Fri, 24 Jun 2022 07:16:27 -0700 (PDT) Received: from localhost ([::1]:43848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4k6k-0000Dx-KB for importer@patchew.org; Fri, 24 Jun 2022 10:16:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jay-0002dD-VH; Fri, 24 Jun 2022 09:43:36 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42090) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jaw-0005Is-Eg; Fri, 24 Jun 2022 09:43:35 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZI-00037t-Vq; Fri, 24 Jun 2022 14:41:56 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Z4qA3/1hYsiS6ZW/BnMtqinTFQCNOn+Y9xsOxn0ZmaU=; b=ItWC8fac3aXz+XADHNME1iC1x3 w4sNLjFXmb+BH+1l5lnjg6k/hljjmAW1Q0Y6mCLVz3EMN83nOnCg6NQuphOERPmSWQGSPg4yUGr6Z Hj3/Sa65WX/DYoVpsS26wTyGDOXWDu3qV6S+N6GE0aZwvCNIsWhLBigSqkeHOI9rftj1jtx8GbKlw 6N45jhYcERLarv/qnHLc3XxwTTiBzea68nbuF4IWoJhdrqMT0lvp6oSvfvpmslEclUXxwmhNEKW9Z vjEr44Ox6jNC7VQnPqcwt5DwpgylAwqwjwpRAIDO8aED/j+i47RBj+QCuOfsojH183LxoJ+nuwHCi 0AypYX/KQ9gX3frWv6AlPQoW8t2XyXeOIGUq+sh6G49TyLQy6FScxaLX/6znQf9dlMwYKss5tjeO/ DJ/251Jkebhz9po/Hf4DmKQYzBD78yRqBTL7gEX5GqP5Ue7Uuqeem0B+I/5OClWvrj1brc6+1RczB PfmQUenMHxtNGx5+cQpdgBMzcUqI1aecRii2l8q5iVUI8q4+2FmcaHxQ9uXx2eX/rMAOBOjuuuW4x 8mQohMP1SXhanWSCAUYdLz8VsINy6EGjWO3EHaoTvs7soev2+3yqwh9Es42TaVT86+mimiCQrmN/c fl+r09Jb5CC/vAsnH6zxNH//5NuE8q+i4pY7irLMw=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:45 +0100 Message-Id: <20220624134109.881989-31-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 30/54] pckbd: move ps2_kbd_init() and ps2_mouse_init() to i8042_mmio_realize() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656080189591100001 Content-Type: text/plain; charset="utf-8" Move ps2_kbd_init() and ps2_mouse_init() from i8042_mm_init() to i8042_mmio_realize() to further reduce the initialisation logic done in i8042_mm_init(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 1ab76793ea..72843f770e 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -685,6 +685,9 @@ static void i8042_mmio_realize(DeviceState *dev, Error = **errp) =20 /* Note we can't use dc->vmsd without breaking migration compatibility= */ vmstate_register(NULL, 0, &vmstate_kbd, ks); + + ks->kbd =3D ps2_kbd_init(kbd_update_kbd_irq, ks); + ks->mouse =3D ps2_mouse_init(kbd_update_aux_irq, ks); } =20 static void i8042_mmio_init(Object *obj) @@ -726,9 +729,6 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq = mouse_irq, s->irq_kbd =3D kbd_irq; s->irq_mouse =3D mouse_irq; =20 - s->kbd =3D ps2_kbd_init(kbd_update_kbd_irq, s); - s->mouse =3D ps2_mouse_init(kbd_update_aux_irq, s); - return I8042_MMIO(dev); } =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656080377510546.3570646093425; Fri, 24 Jun 2022 07:19:37 -0700 (PDT) Received: from localhost ([::1]:52358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4k9n-0006Rr-VK for importer@patchew.org; Fri, 24 Jun 2022 10:19:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jb2-0002n2-59; Fri, 24 Jun 2022 09:43:40 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42122) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jb0-0005JB-ML; Fri, 24 Jun 2022 09:43:39 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZM-00037t-VI; Fri, 24 Jun 2022 14:42:00 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=LwyoZBVsYzQeSm/McZkS4IHxvxDWIUKEHGFPER2PilQ=; b=xtMo8w2jwlXOONGWBiJ99pElPM n66+2ZRFb/XXZuYLeGVCwZ7s8lJJh5kTWjPWER5sGHQ+3KtLJGT+jXCGiw4nAg3F0EI3V2lFt855F d+hmVjOYj1s5tO3maXFU+hvY79J0F76v2Q5dIEiRlM8SrWpJydVAmPsY8qA4/BNzZ08uo9qtR6NUS 8gqu3RSvMx505eFIlwSAXz40O+e1My6abDUVKljAWNl4hV/qvqgj6XRYo6HvDZXOdvy/oTmDzYPj0 fPF3ytAKOS7MNKxtKVZhkclfkEqGFW8r+a+8LH6VZMPMCgcRlf6+Zo4/TO7jjEVPzpjI5Ag1A3RLw gpLHQ0yyjyaixijGKDZS/rK+GJcl04ZBo5bOIjkUBzrmjfU3VKRMlNPrCWw9o1S79/4XxAqqzrbAK USq08tKiHSwlARuHcbLAyQu+Prz+zWsu7cqhv4zgiqgwlzAv0aMuQQBXoFiXYrwvQ04MeaEHrLs/H UqwaJQ8/zPxQigYDbjL0TL3E1j76bcwYkvTM/OpUc/6c42IjPXwIVjbsqkyQuPitnsfFOca3VbCxQ t/d0hr1mDXh6JtVretAagrtURVtvzeJJCUleUIW8kfR8bHKtX44rNJVFLbYcNt+d5685dxvROQDFs smrtrh4zCoF6XYQ841rKepyVYTHiRnj4jKmjLs94g=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:46 +0100 Message-Id: <20220624134109.881989-32-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 31/54] ps2: make ps2_raise_irq() function static X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656080378778100001 Content-Type: text/plain; charset="utf-8" This function is no longer used outside of ps2.c and so can be declared sta= tic. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/ps2.c | 2 +- include/hw/input/ps2.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 9c046ac500..24c9853d37 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -172,7 +172,7 @@ void ps2_queue_noirq(PS2State *s, int b) q->count++; } =20 -void ps2_raise_irq(PS2State *s) +static void ps2_raise_irq(PS2State *s) { s->update_irq(s->update_arg, 1); } diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 4be27de316..410ec66baf 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -102,7 +102,6 @@ void ps2_write_mouse(PS2MouseState *s, int val); void ps2_write_keyboard(PS2KbdState *s, int val); uint32_t ps2_read_data(PS2State *s); void ps2_queue_noirq(PS2State *s, int b); -void ps2_raise_irq(PS2State *s); void ps2_queue(PS2State *s, int b); void ps2_queue_2(PS2State *s, int b1, int b2); void ps2_queue_3(PS2State *s, int b1, int b2, int b3); --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656080592308745.336061113679; Fri, 24 Jun 2022 07:23:12 -0700 (PDT) Received: from localhost ([::1]:60782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kDH-0004JA-7L for importer@patchew.org; Fri, 24 Jun 2022 10:23:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jb3-0002sB-Qa; Fri, 24 Jun 2022 09:43:41 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42136) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jb2-0005JY-AC; Fri, 24 Jun 2022 09:43:41 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZQ-00037t-Lk; Fri, 24 Jun 2022 14:42:04 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=fX2YWydvz3qBtZHdqqwv5PDkps8PSQHCcwTqVmy00qM=; b=FxCDTA+zkfbLxkE6rKzlWQKOme U6P1KjzZwzhKQ0Rb+7no4uuXBufTpvhTii+zSgps6HUfOTXpJS6hh3ZmQxov+hvq/nYroGATWQ5iJ 9jFL0XhVhTh+Mx+2jXh4sSK6M2Yb+ltpy4RzT60iki+TbjKlosA1GtdPeL70jetqWsvm++aTmuG5d PpYJRoocIkZcNycBltgHZUR2v3inWE6BUGKjTKlVoVEXhmT0hmESatimzkTD8tBwwsWBAlcWTkMe8 kTrd87yXFGBPomDU7W+RsG+VoKBcIh6QXRuesHToCaDBzoW3O6AeiD+1WQ0HFw7GbZGXY3KvSW6mI nRvJqq95p3BJ/l68Gj1KmaQ2CoYfopnb9Dj5AhTTONC4e1WNRkjFE5LbCy3EUR9aavMOJQ5ap9WaD iAZ5YLCg1DDKl4MZpJyDirmY+LX5ujTO1mN3lPCC4ybBfBigysEiBFEHJO4o1aQp5dDDNspCZP0FF rJ8/el6zk32MQqsfU9hUwC8diwWa2fY/3zeFuV2dcuFaFKG6k1cso6CNRo7rsenvGQWoLuG68q7qU Wd77zL4X7gmYOTo1ihhZDiLnqQOMMh821sgDvKRN1C232tAmGT0dBEe/yvxUhzhtDn4leAJw7ziRi 5h2luKwAjYp2P+tpvaC51ONnaHlszB5ByYvmAt4XU=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:47 +0100 Message-Id: <20220624134109.881989-33-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 32/54] ps2: use ps2_raise_irq() instead of calling update_irq() directly X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656080593867100001 Content-Type: text/plain; charset="utf-8" This consolidates the logic of raising the PS2 IRQ into one single function. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/ps2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 24c9853d37..a14281bc54 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -557,7 +557,7 @@ uint32_t ps2_read_data(PS2State *s) s->update_irq(s->update_arg, 0); /* reassert IRQs if data left */ if (q->count) { - s->update_irq(s->update_arg, 1); + ps2_raise_irq(s); } } return val; --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656080178792824.8530673939955; Fri, 24 Jun 2022 07:16:18 -0700 (PDT) Received: from localhost ([::1]:43626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4k6b-0008V9-2B for importer@patchew.org; Fri, 24 Jun 2022 10:16:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jb4-0002vz-Ny; Fri, 24 Jun 2022 09:43:42 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42140) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jb3-0005Jg-A9; Fri, 24 Jun 2022 09:43:42 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZU-00037t-Kc; Fri, 24 Jun 2022 14:42:04 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=zg0t8VdiNRtLycCcEYbqAdy/8pY2GIqdnnIop5Qoibo=; b=kSK+IV0jL8wS1wwF8Wv/tZYARM MDxcnKAgYzFYiAVOvF3QeVfVTVHYZ2BWsmxJHyrJf5+049iEnaz0UC7GjLKeFLIiXBMPyNEuDhl9N HLoqEXYrIwlM/prylT4T6TpvjRYvWzLOqoqcJX4DzdFsc47XivjjEhy1+w1JIwqbYyHsTob+Y2TDd F3eZ0uDBRHNov5cNoRE8J3lpCr7Iy7WTR/8Lh78gHsa2Y2UTUBuunpr0PrFxw4s96TmX1DQRz9w8W tIdpOcx4iN/KDLwzbBn8nGZ+sLDZ3hNIAhu3IiLkjR0ljNjZnPxxQNQQSrVevXV+H7F+jqoeydOzx 6obdCL9klMZUBqJ38d7NBXLSsLBMnOyBODYN+ytm2k22JFymO0+cr/QONAaUWva0RMdEWEN5vlL6t BKy3CvE+XiinijQ1B/X4+J6wWIvAdDS3VX7dFeMutJpKeg8JvUma3Lu//KhYjR1HVj/e7djhVnwiQ YVKatJK27WBhLYGbX7hNMgS2JSdZTVGIF/Gzf0Xxp2MZIvUpmqySrZ8+5m2/rCL7fPfQAV15KtmqN mjGuAySy2ji2lHuSZyHqJFbMf18F93GYcdtFmpjQqXkif2yhutsznrcbUdpO2OLSNGj2qEbelMvJE DHNyjRmPdp7Hr9yYNG1uXCJUQEgp/U8DSlCZIoKfA=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:48 +0100 Message-Id: <20220624134109.881989-34-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 33/54] ps2: introduce ps2_lower_irq() instead of calling update_irq() directly X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656080179502100001 Content-Type: text/plain; charset="utf-8" This consolidates the logic of lowering the PS2 IRQ into one single functio= n. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/ps2.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index a14281bc54..bc0bcf1789 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -177,6 +177,11 @@ static void ps2_raise_irq(PS2State *s) s->update_irq(s->update_arg, 1); } =20 +static void ps2_lower_irq(PS2State *s) +{ + s->update_irq(s->update_arg, 0); +} + void ps2_queue(PS2State *s, int b) { if (PS2_QUEUE_SIZE - s->queue.count < 1) { @@ -554,7 +559,7 @@ uint32_t ps2_read_data(PS2State *s) q->cwptr =3D -1; } /* reading deasserts IRQ */ - s->update_irq(s->update_arg, 0); + ps2_lower_irq(s); /* reassert IRQs if data left */ if (q->count) { ps2_raise_irq(s); @@ -1001,7 +1006,7 @@ static void ps2_reset(DeviceState *dev) =20 s->write_cmd =3D -1; ps2_reset_queue(s); - s->update_irq(s->update_arg, 0); + ps2_lower_irq(s); } =20 static void ps2_common_post_load(PS2State *s) --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079952530958.7899317304585; Fri, 24 Jun 2022 07:12:32 -0700 (PDT) Received: from localhost ([::1]:60606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4k2w-0000og-IK for importer@patchew.org; Fri, 24 Jun 2022 10:12:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbA-0003EF-3k; Fri, 24 Jun 2022 09:43:48 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42166) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jb8-0005KI-Co; Fri, 24 Jun 2022 09:43:47 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZV-00037t-3H; Fri, 24 Jun 2022 14:42:08 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=uN402QgSw/Cr83OhPai4+mtyu5uxvKgWxkPyPh9lHLE=; b=c7y+2/gS3fntWGZ9Q9yiPPtgdJ 5bvn1U9hz3Dg0IUAXIzJQJXTctUG/Q3BKTTicY5yxSvkVkNa930ieuZxwp10/kVjM5Nn5HlJHvkfL 9sTUlPC67MJZcOGmnOtgFng+CipQ92aIJGVEvkKcAckArz1wtOWHtpn4orFs+xr6HBr2C4gLGKhEh Vkgo9ATBlu555WdIHX0UtGKGqaKn5EhW7gO+H4LUmmG+oOjpgWgsLykjhzhMyOaKVlzAW+HW03Jii +cG3SAXZqIGEkBCDavx+L9V19NADGTg426LBmfL3/eDRAsICkjdaHfEL+2uf5QQKHTRydGjwJvrr3 zEbyEntc4FcE8LAxPKRhm4nZMbf8pjCgLgw2KXXdUAY52S5/tVe0/CYa6uPGd/FeHwMvo8P3KMewo IrPN647KgLg164EGYrfI1mP47yB+Bq9gaC9BKYLVftiKZKZZwCiCCPdGpEn67JRoP8VdzSWhsbGuN wyezhact1S1iYdKclAmd7mbTL1Pz7lrvi+6jUsSacAt5NVTB463O7B4d43rux4klxNm6+20+phMxG SzAsexKnXjU4IvKq8Np/qPPKdfyfa0KNTxvWuU7e4ZZ9Y4b2ZT70UALkc9kIpKdjbHdlIZgJbrmoP 6T7R5F+8kVg7uOsMPufPow4EWkuIBQkR9HXzUBQIk=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:49 +0100 Message-Id: <20220624134109.881989-35-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 34/54] ps2: add gpio for output IRQ and optionally use it in ps2_raise_irq() and ps2_lower_irq() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079954622100001 Content-Type: text/plain; charset="utf-8" Define the gpio for the PS2 output IRQ in ps2_init() and add logic to optio= nally use it in ps2_raise_irq() and ps2_lower_irq() if the gpio is connected. If = the gpio is not connected then call the legacy update_irq() function as before. This allows the incremental conversion of devices from the legacy update_ir= q() function to use gpios instead. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/ps2.c | 21 +++++++++++++++++++-- include/hw/input/ps2.h | 4 ++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index bc0bcf1789..98c6206fb8 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -24,6 +24,7 @@ =20 #include "qemu/osdep.h" #include "qemu/log.h" +#include "hw/irq.h" #include "hw/sysbus.h" #include "hw/input/ps2.h" #include "migration/vmstate.h" @@ -174,12 +175,20 @@ void ps2_queue_noirq(PS2State *s, int b) =20 static void ps2_raise_irq(PS2State *s) { - s->update_irq(s->update_arg, 1); + if (qemu_irq_is_connected(s->irq)) { + qemu_set_irq(s->irq, 1); + } else { + s->update_irq(s->update_arg, 1); + } } =20 static void ps2_lower_irq(PS2State *s) { - s->update_irq(s->update_arg, 0); + if (qemu_irq_is_connected(s->irq)) { + qemu_set_irq(s->irq, 0); + } else { + s->update_irq(s->update_arg, 0); + } } =20 void ps2_queue(PS2State *s, int b) @@ -1305,6 +1314,13 @@ static const TypeInfo ps2_mouse_info =3D { .class_init =3D ps2_mouse_class_init }; =20 +static void ps2_init(Object *obj) +{ + PS2State *s =3D PS2_DEVICE(obj); + + qdev_init_gpio_out(DEVICE(obj), &s->irq, 1); +} + static void ps2_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -1316,6 +1332,7 @@ static void ps2_class_init(ObjectClass *klass, void *= data) static const TypeInfo ps2_info =3D { .name =3D TYPE_PS2_DEVICE, .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_init =3D ps2_init, .instance_size =3D sizeof(PS2State), .class_init =3D ps2_class_init, .class_size =3D sizeof(PS2DeviceClass), diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 410ec66baf..5422aee9aa 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -50,11 +50,15 @@ typedef struct { int rptr, wptr, cwptr, count; } PS2Queue; =20 +/* Output IRQ */ +#define PS2_DEVICE_IRQ 0 + struct PS2State { SysBusDevice parent_obj; =20 PS2Queue queue; int32_t write_cmd; + qemu_irq irq; void (*update_irq)(void *, int); void *update_arg; }; --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656080345994183.2893616593384; Fri, 24 Jun 2022 07:19:05 -0700 (PDT) Received: from localhost ([::1]:51900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4k9I-00068r-Qu for importer@patchew.org; Fri, 24 Jun 2022 10:19:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbE-0003LQ-U6; Fri, 24 Jun 2022 09:43:53 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42190) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbC-0005Ko-3J; Fri, 24 Jun 2022 09:43:51 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZZ-00037t-71; Fri, 24 Jun 2022 14:42:13 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4z3Ocvu+kc8B3MXIQntPOHtEYVDKyoKAzRpbWIjQwlY=; b=Le1HP1KjbFPh6avY+9wDJGWGOK tcAOSDWxUQId4vdqFJgUFlYn4WURn+sqIHPmzu9jSTyYPK896L+WeA+7hKZ65Hs0R1ZZi5uugWPo9 swDuj0VtyqplxD1ttCMQsM283XCP08EXwReOGYQp1wqaVd1fBmIBEOmq/GdJWAixaYd1SfY+G1NHb x1sPyk9hV2V1InIdHgTFxnX873DwdAqIqSTaLY+HMNQEcwrt+214rq+ukpJZE8My3PGbZvidTEEkj pM4tISz+U3xEdidaqovtnSbCUj6e5/dopRMSfaU1hYRfGv66YhaxV5SoyvTz33YKt6Nn68/wc9jU7 zMB3NeiYiuFYgiFgt3bx+dO6Nshd+XzRkILsJrMHMJZUZCx+Z8hDkvGVo7PfRgJ78TJ0jnr8gRagT yWHFEyFQ67NitfK+xA/RD7YYGx/i5EiVjvLXjOgQibEoaAy6erprbP5Ms2lULEgjxJItQVJL4mXA7 T7pNNZ8TgsKDpN3rmaBKJMW6p4b2WEIJxz9Yz5rPfjEZvq24ca5cbJdKD20V3+MbwWri0dGSwE46o 32uhSpnv7+LaVVhghf5kvaRMdXmFAesMSi38tZk39ymFO6ddP7LXOuq07RueUo0GyJJ9rNcLEJ2qc a6XK5G8KQhEiDLklSZpTJBRcgUwglOu3JLnswTabc=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:50 +0100 Message-Id: <20220624134109.881989-36-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 35/54] pckbd: replace irq_kbd and irq_mouse with qemu_irq array in KBDState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656080346223100001 Content-Type: text/plain; charset="utf-8" This allows both IRQs to be declared as a single qdev gpio array. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 12 ++++++------ include/hw/input/i8042.h | 6 ++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 72843f770e..5d7c969fc6 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -170,8 +170,8 @@ static void kbd_update_irq_lines(KBDState *s) } } } - qemu_set_irq(s->irq_kbd, irq_kbd_level); - qemu_set_irq(s->irq_mouse, irq_mouse_level); + qemu_set_irq(s->irqs[I8042_KBD_IRQ], irq_kbd_level); + qemu_set_irq(s->irqs[I8042_MOUSE_IRQ], irq_mouse_level); } =20 static void kbd_deassert_irq(KBDState *s) @@ -726,8 +726,8 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq = mouse_irq, sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s =3D &I8042_MMIO(dev)->kbd; =20 - s->irq_kbd =3D kbd_irq; - s->irq_mouse =3D mouse_irq; + s->irqs[I8042_KBD_IRQ] =3D kbd_irq; + s->irqs[I8042_MOUSE_IRQ] =3D mouse_irq; =20 return I8042_MMIO(dev); } @@ -813,8 +813,8 @@ static void i8042_realizefn(DeviceState *dev, Error **e= rrp) return; } =20 - s->irq_kbd =3D isa_get_irq(isadev, isa_s->kbd_irq); - s->irq_mouse =3D isa_get_irq(isadev, isa_s->mouse_irq); + s->irqs[I8042_KBD_IRQ] =3D isa_get_irq(isadev, isa_s->kbd_irq); + s->irqs[I8042_MOUSE_IRQ] =3D isa_get_irq(isadev, isa_s->mouse_irq); =20 isa_register_ioport(isadev, isa_s->io + 0, 0x60); isa_register_ioport(isadev, isa_s->io + 1, 0x64); diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index 9d1f8af964..4ba2664377 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -12,6 +12,9 @@ #include "hw/sysbus.h" #include "qom/object.h" =20 +#define I8042_KBD_IRQ 0 +#define I8042_MOUSE_IRQ 1 + typedef struct KBDState { uint8_t write_cmd; /* if non zero, write data to port 60 is expected */ uint8_t status; @@ -31,8 +34,7 @@ typedef struct KBDState { void *mouse; QEMUTimer *throttle_timer; =20 - qemu_irq irq_kbd; - qemu_irq irq_mouse; + qemu_irq irqs[2]; qemu_irq a20_out; hwaddr mask; } KBDState; --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656080751234379.8071610641972; Fri, 24 Jun 2022 07:25:51 -0700 (PDT) Received: from localhost ([::1]:40950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kFp-0001tI-Q5 for importer@patchew.org; Fri, 24 Jun 2022 10:25:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbG-0003MG-Ty; Fri, 24 Jun 2022 09:43:55 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42208) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbF-0005L8-Fu; Fri, 24 Jun 2022 09:43:54 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZd-00037t-6F; Fri, 24 Jun 2022 14:42:17 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=UjCk8nbDxOm4YyqZIvcD6JDjQvWB3UJaiziOYbgdFpY=; b=Xh3KrhTQBNLUsD8nI9XSmbRy1g clwyaGGqAJrueb8jsfCCVf4x3ipqvY9UImvILPoTWiOSTT+6JNWnXgWTZ7zpDhWYp94EiNwyLul7C usurWXYcx/MC06gnjaKaqHcVJwNC5nQVeOc6OTsCQ777noJ/2XzoxX3kf+Aq94siKVcAIpHIz0/Ye Bfc1+fF9YVLTAVpA4X7g9zcmiMg0iZWPZeZ/SshhbKkI9r0Umlj9IfUG2l4aU8RwmGQ5T+lFc9r0C mt/q6lWj9boGOY8oJGbTkTVm8j4BNHeCC23Agv5NTPl42webgeW0EHNAnud/0iHDJz+8vGb7Jm0fM sTclcJZ1xGOz7zZz9Z6qwpUG5i4MbQ4YSYOuaVtHt8HvoGp/dZGLXFPbwEHRWcqDqAdMbS87VN5B5 tad4q12YKghBi6z2meLU/U/2edl0lemnOcgs/hK13R2OclGINLBtSMYLB0d7XZQ48Jg1Dpzfp6M/f +IWii0THUqAafqF+utnoPaHW1ZzUqt5BwE7PEFvrxa2x1fAdeF7iEiv/MxNR1r6KvVW2AO3knZMM8 txmSxmtDiVvxGpnSPYSGP4LQQEXlazi4H+lh3qNWm70o1ImNcCaX8w94Bsf0L/zZoxtKlKaWTptg7 GQkANkyCloErm/CqbQmeqNlwyrXrXGbN4CEnmEBlU=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:51 +0100 Message-Id: <20220624134109.881989-37-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 36/54] pl050: switch over from update_irq() function to PS2 device gpio X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656080752180100001 Content-Type: text/plain; charset="utf-8" Add a new pl050_init() function which initialises a qdev input gpio for han= dling incoming PS2 IRQs, and then wire up the PS2 device to use it. At the same t= ime set update_irq() and update_arg to NULL in ps2_kbd_init() and ps2_mouse_ini= t() to ensure that any accidental attempt to use the legacy update_irq() functi= on will cause a NULL pointer dereference. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/pl050.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/hw/input/pl050.c b/hw/input/pl050.c index 66f8c20d9f..c665a4fc99 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -65,7 +65,7 @@ static void pl050_update_irq(PL050State *s) qemu_set_irq(s->irq, level); } =20 -static void pl050_set_irq(void *opaque, int level) +static void pl050_set_irq(void *opaque, int n, int level) { PL050State *s =3D (PL050State *)opaque; =20 @@ -164,10 +164,12 @@ static void pl050_realize(DeviceState *dev, Error **e= rrp) sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); if (s->is_mouse) { - s->dev =3D ps2_mouse_init(pl050_set_irq, s); + s->dev =3D ps2_mouse_init(NULL, NULL); } else { - s->dev =3D ps2_kbd_init(pl050_set_irq, s); + s->dev =3D ps2_kbd_init(NULL, NULL); } + qdev_connect_gpio_out(DEVICE(s->dev), PS2_DEVICE_IRQ, + qdev_get_gpio_in_named(dev, "ps2-input-irq", 0)); } =20 static void pl050_keyboard_init(Object *obj) @@ -196,6 +198,11 @@ static const TypeInfo pl050_mouse_info =3D { .instance_init =3D pl050_mouse_init, }; =20 +static void pl050_init(Object *obj) +{ + qdev_init_gpio_in_named(DEVICE(obj), pl050_set_irq, "ps2-input-irq", 1= ); +} + static void pl050_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); @@ -207,6 +214,7 @@ static void pl050_class_init(ObjectClass *oc, void *dat= a) static const TypeInfo pl050_type_info =3D { .name =3D TYPE_PL050, .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_init =3D pl050_init, .instance_size =3D sizeof(PL050State), .abstract =3D true, .class_init =3D pl050_class_init, --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656079997956820.5261759630904; Fri, 24 Jun 2022 07:13:17 -0700 (PDT) Received: from localhost ([::1]:35318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4k3g-0002ra-Ud for importer@patchew.org; Fri, 24 Jun 2022 10:13:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbG-0003MR-WD; Fri, 24 Jun 2022 09:43:55 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42210) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbF-0005L9-FR; Fri, 24 Jun 2022 09:43:54 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZh-00037t-OW; Fri, 24 Jun 2022 14:42:17 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=luDz1ZXPN+WGigbs9Pbnm8iuZlTciBSqREre8wp1GDA=; b=cGk8Xur6oire/NL8/FTpFEFN28 +AeyXf9E5r+9tgfFjLG/8xlH04bvJH4qZxqlYg3ZT9aYBcoJrB9q28goP9DnHmvDXIBPLzlg3q6yV merScdJ6MKYWF7UpiBPVXNzmXPROyc0dB85T8Xk9tf/uez7Npq8uuKnv2vHJodBDAVUhZkAPhFGTB lGfUr5oppcCkl6EVieHakSpe+hdClWwdGzU+kGUZEascSKMnvJfzNRA6Fz/J7SwbwfHT8YuXpgGhg KssH117l4Civ3dotTcypemoMOb6b0HDBTR9T/vvz94iU0un2DJ+KkiFc82FwVbmgzEIUzznbOCRcx UYUVkdsn2qVrJ1dMmsV81HU4qgCcoRlayLi6aLZaYrE+ZAtniBIN0JlMP6+9CFezaJ4HGF5LC9wbJ T8GwJoAhOyY9lUeONM19iNM2oMeryNhNE+Huy9kjRO9/kmifME8jONruNMFW4ImZbGad4T9JsEMRB Gxq2TGLjnVZS+gcgpS9TJ3r/qPNkJR9MWZN53Se9GR1DtGpe3h+4rEjC2Tv8joBzcYwW3kg6IC83C aVmUSmpq4R+4BMJiYXbo7S99nMJh8MBcCGc+GogILi/yRzckhfociANu/Kba0PnBk+xKdjU9oOeF+ 6IUBBUVA/Zn1Hzm+tRRMsCBF+97+vI++5SAJ00Hao=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:52 +0100 Message-Id: <20220624134109.881989-38-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 37/54] pl050: add QEMU interface comment X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656079998599100003 Content-Type: text/plain; charset="utf-8" This describes the PL050 device interface implemented within QEMU. Signed-off-by: Mark Cave-Ayland Reviewed-by: Peter Maydell --- hw/input/pl050.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/input/pl050.c b/hw/input/pl050.c index c665a4fc99..ffaa72dea4 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -7,6 +7,14 @@ * This code is licensed under the GPL. */ =20 +/* + * QEMU interface: + * + sysbus MMIO region 0: MemoryRegion defining the PL050 registers + * + Named GPIO input "ps2-input-irq": set to 1 if the downstream PS2 devi= ce + * has asserted its irq + * + sysbus IRQ 0: PL050 output irq + */ + #include "qemu/osdep.h" #include "hw/sysbus.h" #include "migration/vmstate.h" --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656080128469339.06027909422164; Fri, 24 Jun 2022 07:15:28 -0700 (PDT) Received: from localhost ([::1]:42556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4k5n-0007lU-0r for importer@patchew.org; Fri, 24 Jun 2022 10:15:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbM-0003PM-6s; Fri, 24 Jun 2022 09:44:00 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42238) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbK-0005MA-NV; Fri, 24 Jun 2022 09:43:59 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZi-00037t-DP; Fri, 24 Jun 2022 14:42:21 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=So3b8ugD9000B6KIzOxsUi39XCaCnOF33+YE+QwSWns=; b=tR1LX5CYds9GgzRrFX63iMf+U6 vaUW9lWzzl/6u7j1aTCHK39leuVMD/0HD5kniTi0YI2EVcDs9+jdyH0BEe8qwNsLgfhdAxdP2jP2d U5gu6HxOAH3m/IClp3uPmFW9R0FONMj27BvtIX9lHptR5hVmwbW9wNCqG1Bx+qfsKhOYFskTMqCoh eYNoU6Y43ArIWgClq/TKbixFJu9EWYgN7Qg6SNKdfOZ61KYfOPrkf2+yIQtLaTaOrmMX6K8Fw2P0D Z0SvrnqoIy4AU8txWE2gWJ5wV/GjWVTrl116gr2d3jFEbTdwvZ93fUt3Mj3Z94YjzCbBCgCDpkR1X onWmRT70oth3wcKeK0PZex2ifLOFINqOHbmO1Kk65FK8Y5YZ47Fd1ATqI7FIZAEhWLrJTcwD5Z/6f r0WWoK1yMDKAdJ7svK0HPR6LfmqPnpsSKE03QJYSxXffdeLSmG82WvY83IA1o5Q/uQ5uFBi0o7LcI mShEHnBlcSpe/HBMGgbX8/Y+YeiFbCIqagf1ml2aPFp/w49KeC1kN+agG844GcRB78R8taD9MlxBi NZXeZTDiwqBtIW3Cd2iSK9dPdUaCnteURlTSOTp58EnFIBiqncKpSlqRR7bvneBYbQsqBAH1zZ7Zy PJXHJMKT6qn9tlsmVUZ2H8Jr3pe10Zq+5kknK5Av4=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:53 +0100 Message-Id: <20220624134109.881989-39-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 38/54] lasips2: QOMify LASIPS2State X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656080129523100001 Content-Type: text/plain; charset="utf-8" Currently lasip2_init() creates a new LASIPS2State directly which is used b= y the HPPA machine. Introduce a new LASIPS2 QOM type that will soon be used to allow t= he HPPA machine to be wired up using standard qdev GPIOs. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/lasips2.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index adfde1684f..db0a791e6c 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -24,6 +24,7 @@ #include "qemu/osdep.h" #include "qemu/log.h" #include "hw/qdev-properties.h" +#include "hw/sysbus.h" #include "hw/input/ps2.h" #include "hw/input/lasips2.h" #include "exec/hwaddr.h" @@ -31,6 +32,7 @@ #include "exec/address-spaces.h" #include "migration/vmstate.h" #include "hw/irq.h" +#include "qapi/error.h" =20 =20 struct LASIPS2State; @@ -45,11 +47,16 @@ typedef struct LASIPS2Port { bool irq; } LASIPS2Port; =20 -typedef struct LASIPS2State { +struct LASIPS2State { + SysBusDevice parent_obj; + LASIPS2Port kbd; LASIPS2Port mouse; qemu_irq irq; -} LASIPS2State; +}; + +#define TYPE_LASIPS2 "lasips2" +OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2) =20 static const VMStateDescription vmstate_lasips2 =3D { .name =3D "lasips2", @@ -265,8 +272,11 @@ void lasips2_init(MemoryRegion *address_space, hwaddr base, qemu_irq irq) { LASIPS2State *s; + DeviceState *dev; =20 - s =3D g_new0(LASIPS2State, 1); + dev =3D qdev_new(TYPE_LASIPS2); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + s =3D LASIPS2(dev); =20 s->irq =3D irq; s->mouse.id =3D 1; @@ -286,3 +296,16 @@ void lasips2_init(MemoryRegion *address_space, "lasips2-mouse", 0x100); memory_region_add_subregion(address_space, base + 0x100, &s->mouse.reg= ); } + +static const TypeInfo lasips2_info =3D { + .name =3D TYPE_LASIPS2, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(LASIPS2State) +}; + +static void lasips2_register_types(void) +{ + type_register_static(&lasips2_info); +} + +type_init(lasips2_register_types) --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656080339179367.69306258097845; Fri, 24 Jun 2022 07:18:59 -0700 (PDT) Received: from localhost ([::1]:51228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4k9B-0005g0-VB for importer@patchew.org; Fri, 24 Jun 2022 10:18:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38708) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbP-0003SL-Us; Fri, 24 Jun 2022 09:44:04 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42250) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbO-0005MY-88; Fri, 24 Jun 2022 09:44:03 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZm-00037t-1P; Fri, 24 Jun 2022 14:42:25 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=wby1Pq/oqMaNmEyBRu06KxgR42dc/l6kP7ARriQsA2k=; b=M0QWCLkG/BZfHy3yt5DSOFHJYv rFJlDmmpknk3aNFImgMvDin3289Dv+oCDYIOgI1I9ACLmGERaPC1v2zsEarePR6k75b9g0WHW2YAi ZGTao7fjbOQhRqbULC8v9ggbwDfpzX6dCHJvMaqaudeFafLOnp/BaGoN1Sfh9Q9D0gIyziGgTSFM8 bR0cWl8wiCQEQRvkX/x1+UGSPQMQMlo5rMNwMf8nJkQ+prO+GGhv/ehwLw/3ckCmGZpudKr3bTaGj V2UsMm9OjsGgXnBCf06/YBQI0JHvhy8a/lxST1B6k8QL6X8rBZfKmABO9IdJmSX0EDuiWM2UgmzTa 9ipXtvs8A46MdpplPopTjsqWHytfoJFG8dFNddet7McXnBQXfOsbkTTsXqXBMmRVJiSR+XBHwtGu+ 2SAVUWWvaATGy0LDkBGkpBsFEsr94GUGHLdJlkeBslK3N17VPcWVi8JqMRiVhDaVw2CSgJ3Kjc0NN MVyDtPcbi252xbMmxJo1wKzGyX7AQRxFNN2UXIZ8BwWLYl3mxD08mzAhu5jlalwX0f5KWoyfXWIeF LAcXf9msR2F1TgI69fapGJ9E7g7n7bWbgIGmYYPApOIw/GrNQvYJE0wGXhT+zWUI2MD2YOO2AxK1x nHLFE4MXK8dkJWtnN2c16VGqv6muEb+2YIi435A+s=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:54 +0100 Message-Id: <20220624134109.881989-40-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 39/54] lasips2: move lasips2 QOM types from lasips2.c to lasips2.h X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656080340192100001 Content-Type: text/plain; charset="utf-8" This allows the QOM types in lasips2.c to be used elsewhere by simply inclu= ding lasips2.h. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/lasips2.c | 23 ----------------------- include/hw/input/lasips2.h | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index db0a791e6c..2caa80bd3c 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -35,29 +35,6 @@ #include "qapi/error.h" =20 =20 -struct LASIPS2State; -typedef struct LASIPS2Port { - struct LASIPS2State *parent; - MemoryRegion reg; - void *dev; - uint8_t id; - uint8_t control; - uint8_t buf; - bool loopback_rbne; - bool irq; -} LASIPS2Port; - -struct LASIPS2State { - SysBusDevice parent_obj; - - LASIPS2Port kbd; - LASIPS2Port mouse; - qemu_irq irq; -}; - -#define TYPE_LASIPS2 "lasips2" -OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2) - static const VMStateDescription vmstate_lasips2 =3D { .name =3D "lasips2", .version_id =3D 0, diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h index 0cd7b59064..ddcea74c14 100644 --- a/include/hw/input/lasips2.h +++ b/include/hw/input/lasips2.h @@ -8,8 +8,30 @@ #define HW_INPUT_LASIPS2_H =20 #include "exec/hwaddr.h" +#include "hw/sysbus.h" + +struct LASIPS2State; +typedef struct LASIPS2Port { + struct LASIPS2State *parent; + MemoryRegion reg; + void *dev; + uint8_t id; + uint8_t control; + uint8_t buf; + bool loopback_rbne; + bool irq; +} LASIPS2Port; + +struct LASIPS2State { + SysBusDevice parent_obj; + + LASIPS2Port kbd; + LASIPS2Port mouse; + qemu_irq irq; +}; =20 #define TYPE_LASIPS2 "lasips2" +OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2) =20 void lasips2_init(MemoryRegion *address_space, hwaddr base, qemu_irq irq); =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656081015697833.2646845934664; Fri, 24 Jun 2022 07:30:15 -0700 (PDT) Received: from localhost ([::1]:50862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kK5-0000BR-IB for importer@patchew.org; Fri, 24 Jun 2022 10:30:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbV-0003Wr-33; Fri, 24 Jun 2022 09:44:09 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42268) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbS-0005N2-IJ; Fri, 24 Jun 2022 09:44:08 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZp-00037t-UH; Fri, 24 Jun 2022 14:42:30 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+5UR+S6icrtzaPmXzvPoyQy1bdWF8ctZ6s36H7Jtc9w=; b=kBLixgvUBtBqqhI/II+gQ7fHNX tA03XDpknIlkQhqI/ewhy4ZHAuojb54gyj3x/lgFYx6eNl+IUD3k+60op2dHnxUZdRCVK6K/RQJSn knDW4gunGsk+JSL5ljsOCdmzAMeyFLPfwa3aPznir5ocg8EMvejQTrS4y9Ynvu8f+8dLDLSmhrltX tOG48/p+Msx2YAJM8Md/0gfbHGioNzsMPPesHaYLqshb7inirMA3g6idlk0CQKH8wSZD5+7Ifcei5 G/jzbnLw19pL5tB0BDE4AtLlDO45ObndSdDsB/CV5VCAlGQ5DpRr0JaNqRmcFn6Gd50sjyK23opx/ FwfDB5/aCNaVocbRDE4qrwv9zkl4YZOvKCH0HWJCdTV8n/e/gD+QV5RnEFOSOuJiT6zw8LrXnk/qP XLz0sW742hFc0sQvq2tQa8XBqgSJ4urtyVJmJo44Ug4wNh94Kx3Fvpc2sX8mK6u3i8UcIUB8CHHHc 65pF9NbFvIazxI2tCBsYyoOIzVxuWdeZg4fV/SBUA3Edsa7wwV5E6dvoAUbstSSQTKawYK7qWLgTL Mu22CvisEuKnjJbjhU7ntgyry3KwTee2w9fU8n62eBdmBFdVNCFnrLBld7DBgouJ+fXbq6pAhBadE bJumiJmT8blQw7lduS2n5ZR2YmlG31YGi7nWa6YNA=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:55 +0100 Message-Id: <20220624134109.881989-41-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 40/54] lasips2: rename lasips2_init() to lasips2_initfn() and update it to return the LASIPS2 device X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656081017607100001 Content-Type: text/plain; charset="utf-8" When QOMifying a device it is typical to use _init() as the suffix for an instance_init function, however this name is already in use by the legacy L= ASIPS2 wrapper function. Eventually the wrapper function will be removed, but for = now rename it to lasips2_initfn() to avoid a naming collision. At the same time update lasips2_initfn() return the LASIPS2 device so that = it can later be accessed using qdev APIs by the HPPA machine. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/hppa/machine.c | 4 ++-- hw/input/lasips2.c | 6 ++++-- include/hw/input/lasips2.h | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 63b9dd2396..72677aeb2a 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -280,8 +280,8 @@ static void machine_hppa_init(MachineState *machine) } =20 /* PS/2 Keyboard/Mouse */ - lasips2_init(addr_space, LASI_PS2KBD_HPA, - qdev_get_gpio_in(lasi_dev, LASI_IRQ_PS2KBD_HPA)); + lasips2_initfn(addr_space, LASI_PS2KBD_HPA, + qdev_get_gpio_in(lasi_dev, LASI_IRQ_PS2KBD_HPA)); =20 /* register power switch emulation */ qemu_register_powerdown_notifier(&hppa_system_powerdown_notifier); diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 2caa80bd3c..85da4081e3 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -245,8 +245,8 @@ static void lasips2_port_set_irq(void *opaque, int leve= l) lasips2_update_irq(port->parent); } =20 -void lasips2_init(MemoryRegion *address_space, - hwaddr base, qemu_irq irq) +LASIPS2State *lasips2_initfn(MemoryRegion *address_space, + hwaddr base, qemu_irq irq) { LASIPS2State *s; DeviceState *dev; @@ -272,6 +272,8 @@ void lasips2_init(MemoryRegion *address_space, memory_region_init_io(&s->mouse.reg, NULL, &lasips2_reg_ops, &s->mouse, "lasips2-mouse", 0x100); memory_region_add_subregion(address_space, base + 0x100, &s->mouse.reg= ); + + return s; } =20 static const TypeInfo lasips2_info =3D { diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h index ddcea74c14..5a35c22f73 100644 --- a/include/hw/input/lasips2.h +++ b/include/hw/input/lasips2.h @@ -33,6 +33,7 @@ struct LASIPS2State { #define TYPE_LASIPS2 "lasips2" OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2) =20 -void lasips2_init(MemoryRegion *address_space, hwaddr base, qemu_irq irq); +LASIPS2State *lasips2_initfn(MemoryRegion *address_space, hwaddr base, + qemu_irq irq); =20 #endif /* HW_INPUT_LASIPS2_H */ --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16560806317941012.5334140436672; Fri, 24 Jun 2022 07:23:51 -0700 (PDT) Received: from localhost ([::1]:34332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kDu-0005cs-Oc for importer@patchew.org; Fri, 24 Jun 2022 10:23:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbc-0003qi-Ht; Fri, 24 Jun 2022 09:44:16 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42294) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbZ-0005Od-0V; Fri, 24 Jun 2022 09:44:15 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZu-00037t-Ui; Fri, 24 Jun 2022 14:42:34 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TGianUMkJuqH8Nj3HFHjcvnyfGx/mgAtFsGV2iwvZIs=; b=Z7bijtPWtQR+Ktp9pFQwIGbpEk gvod5z0UP/Qkab84N/pVclLCAF4lDGJ+2T2samBg62WH/no273skn2JD/tlggV65iU2BXtAS0t9QA 5pPcgLtMYpiXv9BiL4jWkpqgl3XjOPP6Ne9VrbtrAe+9kLN7E90sBsR2E7RgHrQESMkLcZydfEsTW e1yy3bErVEKKDxZIDlTJPlwfsUkktHunZmsdGkuJvSs+Sy9WBFBe1tTiLwvQNiRFfSImT3f6c6hgS yAzKnD0aO8S3Rtv7QIDG2pUPza+56wY/nZDAgL9yKBo6QJ55wfo68HWKiDswx/dqFiuhXUymJbDqi /FbXxWvfoX1WYzcJRoWGYIBVupP0hbTkQcUlErd4BsMjxBVt1ZHMuDgqqSQpLdpvwT/G04bpizNO0 48+k+9ppvN8YYoyXR2Ye2SgMtScGWkSKfh6INlr/Lr5ueytilDTr2KMyHAbYO4tR92G8mE/ArldhJ kAZ6AIKqwfWwDjIqjBsYVQHmee/KU5xeyM98SrAMf2W09UMcIaJpPDUwM1uiW/aA7l79VE7hVRu7K MzvyxH+xhRSjkq8VtMW5c5C1WhmIrTIUZs8WfPBmBfbELX+5X81ftCWt/8zUZu0D33yPZD8T7D8Nw 8jr1r2NVPXLjrz66vi9WSNCA2ENBiNPL6TW11pZaM=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:56 +0100 Message-Id: <20220624134109.881989-42-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 41/54] lasips2: implement lasips2_init() function X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656080633507100001 Content-Type: text/plain; charset="utf-8" Move the initialisation of the keyboard and mouse memory regions to lasips2= _init() and expose them as SysBus memory regions. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/lasips2.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 85da4081e3..8d3a2d88e8 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -265,20 +265,30 @@ LASIPS2State *lasips2_initfn(MemoryRegion *address_sp= ace, s->kbd.dev =3D ps2_kbd_init(lasips2_port_set_irq, &s->kbd); s->mouse.dev =3D ps2_mouse_init(lasips2_port_set_irq, &s->mouse); =20 - memory_region_init_io(&s->kbd.reg, NULL, &lasips2_reg_ops, &s->kbd, - "lasips2-kbd", 0x100); memory_region_add_subregion(address_space, base, &s->kbd.reg); =20 - memory_region_init_io(&s->mouse.reg, NULL, &lasips2_reg_ops, &s->mouse, - "lasips2-mouse", 0x100); memory_region_add_subregion(address_space, base + 0x100, &s->mouse.reg= ); =20 return s; } =20 +static void lasips2_init(Object *obj) +{ + LASIPS2State *s =3D LASIPS2(obj); + + memory_region_init_io(&s->kbd.reg, obj, &lasips2_reg_ops, &s->kbd, + "lasips2-kbd", 0x100); + memory_region_init_io(&s->mouse.reg, obj, &lasips2_reg_ops, &s->mouse, + "lasips2-mouse", 0x100); + + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->kbd.reg); + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mouse.reg); +} + static const TypeInfo lasips2_info =3D { .name =3D TYPE_LASIPS2, .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_init =3D lasips2_init, .instance_size =3D sizeof(LASIPS2State) }; =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656080433944516.877835108592; Fri, 24 Jun 2022 07:20:33 -0700 (PDT) Received: from localhost ([::1]:54012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kAi-0007hO-N1 for importer@patchew.org; Fri, 24 Jun 2022 10:20:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbr-0004SZ-0D; Fri, 24 Jun 2022 09:44:31 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42312) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbb-0005P4-H1; Fri, 24 Jun 2022 09:44:30 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jZz-00037t-1n; Fri, 24 Jun 2022 14:42:38 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Bvp6XXGU++FDy/tKBWDnrR5MOKQeX9OJrQgvuTcNXMQ=; b=i1yGt658Ez592Dvw8EXEIjPtHa hdwtEjGak769S7XW27IjCNeKfuIfKMHJWtrFfmCAgSRk3NiJRgqww6iadEyOTw/jhtLMFKBo9KrUt RolgttBihrFcIWlLsEgVoo+0P+2DXnHFsW5VDeH44ZQ0dF5YPbMUEIDiYGkDBXuzN3+tjZnUoYGuj 5Bpqh7MBMGrxD3ijsM9d8Bei8lQYAPP3N+byHhmvx9Nivg51/1zrjzq+FqN/JUB1BgtnpIz/SNlLd e8i2Qpwai753YZfSyu300RFh1S0LEIlXwhbLbfIJcaBaHxIS5ebAbq7XY48QAFRhprTXYcCBc3Psl uyYRX1jp6MYsQ6bASpNakOMkiO7e7N9inj7inPQuYxp2kz+cRNfpZJVNEgJ1nVjiCRjbzAoD3uO2u Da5R5ofjKDUdrvquGTFZcpEaF6Aqe6v9h6kwEyYaGpvDkfwFaJ5H0whG9bxsHXV4m7UUmC315Lp90 2IGvtKjbba2uiXVadHETcuFUIf5X3JXC8AJPXrczRXlcyso9ydvDCGj5NQjHwoFy4a+ll16inWUcd 1SBiEfzSnKPrNynD3ns5e6MgvPf2cdEzl3DMLcRHuQdeE88AaoaG11smzZefAPW3hgvd+34StMJ+W 3msfCIpV2NRHK8sUIdq9Z148ZP/BigkAXckbbBkZQ=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:57 +0100 Message-Id: <20220624134109.881989-43-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 42/54] lasips2: move mapping of LASIPS2 registers to HPPA machine X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656080434840100001 Content-Type: text/plain; charset="utf-8" Now that the register memory regions are exposed as SysBus memory regions, = move the mapping of the LASIPS2 registers from lasips2_initfn() to the HPPA mach= ine (which is its only user). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/hppa/machine.c | 11 +++++++++-- hw/input/lasips2.c | 7 +------ include/hw/input/lasips2.h | 3 +-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 72677aeb2a..44ecd446c3 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -280,8 +280,15 @@ static void machine_hppa_init(MachineState *machine) } =20 /* PS/2 Keyboard/Mouse */ - lasips2_initfn(addr_space, LASI_PS2KBD_HPA, - qdev_get_gpio_in(lasi_dev, LASI_IRQ_PS2KBD_HPA)); + dev =3D DEVICE(lasips2_initfn(LASI_PS2KBD_HPA, + qdev_get_gpio_in(lasi_dev, + LASI_IRQ_PS2KBD_HPA))); + memory_region_add_subregion(addr_space, LASI_PS2KBD_HPA, + sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), + 0)); + memory_region_add_subregion(addr_space, LASI_PS2KBD_HPA + 0x100, + sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), + 1)); =20 /* register power switch emulation */ qemu_register_powerdown_notifier(&hppa_system_powerdown_notifier); diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 8d3a2d88e8..84e7a1feee 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -245,8 +245,7 @@ static void lasips2_port_set_irq(void *opaque, int leve= l) lasips2_update_irq(port->parent); } =20 -LASIPS2State *lasips2_initfn(MemoryRegion *address_space, - hwaddr base, qemu_irq irq) +LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq) { LASIPS2State *s; DeviceState *dev; @@ -265,10 +264,6 @@ LASIPS2State *lasips2_initfn(MemoryRegion *address_spa= ce, s->kbd.dev =3D ps2_kbd_init(lasips2_port_set_irq, &s->kbd); s->mouse.dev =3D ps2_mouse_init(lasips2_port_set_irq, &s->mouse); =20 - memory_region_add_subregion(address_space, base, &s->kbd.reg); - - memory_region_add_subregion(address_space, base + 0x100, &s->mouse.reg= ); - return s; } =20 diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h index 5a35c22f73..b9723073e1 100644 --- a/include/hw/input/lasips2.h +++ b/include/hw/input/lasips2.h @@ -33,7 +33,6 @@ struct LASIPS2State { #define TYPE_LASIPS2 "lasips2" OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2) =20 -LASIPS2State *lasips2_initfn(MemoryRegion *address_space, hwaddr base, - qemu_irq irq); +LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq); =20 #endif /* HW_INPUT_LASIPS2_H */ --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656080907581107.19659511593284; Fri, 24 Jun 2022 07:28:27 -0700 (PDT) Received: from localhost ([::1]:45814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kIM-0005De-42 for importer@patchew.org; Fri, 24 Jun 2022 10:28:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbl-0004AA-2Q; Fri, 24 Jun 2022 09:44:25 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42330) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbg-0005Qd-KS; Fri, 24 Jun 2022 09:44:24 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4ja2-00037t-NC; Fri, 24 Jun 2022 14:42:42 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jnjxPls9g2ECTzO9SOuC6rjP7WJZ1e0cvCvq+d4ChmI=; b=boO/pkSUB049eVR4w9tWS9lxxX 1yxw8oi+jVI1uqWGLBiOd4vXE9LBzgx0f+lMRlc0RQKDD8Ce8wI3zLYXU/3ktnm3OqkkDhNy0WPHu aQXq0CKiCRbvHVIShnbMmCNCKVnUnYlF5+4aprVcCIuXYUtpwgikDGoDBQcXRfg7duiAsIKYBG10e wBJetthZHcX58uiJN9GlN87uvqI+860gZqpHLzLTPT7zdO5PHt9by1j6ciRaW0MUW6ZE0v4IjYsCq S2aXITGhbV9tA2/M1qS7DzlN99Zv3MqxkjOLW3DCbv6jDIylKNePr81b+gVI2MkNk1Zz/4BdhXKzZ cUVmdNUlutQ43Z/i+etisOTn/iuAdsQZLbNPWTbEqmJEMQf9mnoy6g68woDlqhlB5odLcY3eTqTUA a9D1CTHhNRCjEjiH+Dz+AJ/mv2bH+iFhod9lkDLL+CmU7ltW/4MoOoxgxH4RWke8BReoanRSDO7sM 7X7sDK15Z7SzN9VsrgzBQslz6HcGj0xb3Ct09kpg+MB5jJQksPczZYqSv87yH+g4CJReK+6wUilpj repRZwHJ7E7rOqIpteY+U0MmFZqQJPFkTkJlz01FA2WoxCxkQRzuJXhSzmSW7oKXxhNN10uJTppdO UMNKnGa1d9QR+/bvs1H6opvtxSt8GNTR3O2yzcGOQ=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:58 +0100 Message-Id: <20220624134109.881989-44-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 43/54] lasips2: move initialisation of PS2 ports from lasi_initfn() to lasi_init() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656080909280100001 Content-Type: text/plain; charset="utf-8" This can be improved once the ps2_kbd_init() and ps2_mouse_init() functions= have been removed, but for now move the existing logic from lasi_initfn() to lasi_init(). At the same time explicitly set keyboard port id to 0, even if= it isn't technically required. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/lasips2.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 84e7a1feee..bd89c03996 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -255,9 +255,6 @@ LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq) s =3D LASIPS2(dev); =20 s->irq =3D irq; - s->mouse.id =3D 1; - s->kbd.parent =3D s; - s->mouse.parent =3D s; =20 vmstate_register(NULL, base, &vmstate_lasips2, s); =20 @@ -271,6 +268,11 @@ static void lasips2_init(Object *obj) { LASIPS2State *s =3D LASIPS2(obj); =20 + s->kbd.id =3D 0; + s->mouse.id =3D 1; + s->kbd.parent =3D s; + s->mouse.parent =3D s; + memory_region_init_io(&s->kbd.reg, obj, &lasips2_reg_ops, &s->kbd, "lasips2-kbd", 0x100); memory_region_init_io(&s->mouse.reg, obj, &lasips2_reg_ops, &s->mouse, --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656081581539956.5813836090819; Fri, 24 Jun 2022 07:39:41 -0700 (PDT) Received: from localhost ([::1]:47388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kTE-0008QX-AY for importer@patchew.org; Fri, 24 Jun 2022 10:39:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jc3-0004yg-2T; Fri, 24 Jun 2022 09:44:43 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42354) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbn-0005Uj-Ue; Fri, 24 Jun 2022 09:44:42 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4ja7-00037t-1U; Fri, 24 Jun 2022 14:42:46 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6+A4fscENQVrrzKzFju9A8QlEGskcjgDeLN7mdXBr4E=; b=CEKTrqI9ABjiKbTNPvA3H8/YFU qdw1bth5R+5RI68cogM+I96kfGDRQdjUibbFbDwqGGOiEFmb0DlNjlnuhLbgJxjg/04CoBGGtFsT/ aQhhp6Bc+Lc9MkPhK3GEoEMNEGbYAZzGnk7GJvz8e/TazgWjuWc2Fl+mxqJlsa7eIiG9Ebn3K/Aix xoC/9aoUOnP4KbDQ4OVyyYLOPtLZtJNGoNNnFUXNbyxqj5JhF1bCJ0OeX7aUioxOUi16rSgoIqy4Q 83bHMD70I++74Rfq4Xv4jyCY6a6RQIItwgTa8na+RkuZWyhnNLhD2/0tm7PgfR3t7eXw6DCaeN0K9 S5hQeCfo7Hxqaml1qXEKn38Sx4JPAoJVWTLj/4zy86ZxDhpnqNlkS7RLEiH7WuLsOt0OZb9x3A8fJ ppW+585wlfSi8xH/5hiWRS93Z9572W/NiizDlyDwRvirmnWWAlKwSyIRJOMUaA4XK/pqw9Ci2eVeo yBkGYdjaISy8hiEUFK8rdkT+oF4GTDCk5J+Ltt6Kqe/bpoYCX1HH2Zvdxogsp092j19mn/A5xtRGI ImkmYtOqSAG/vjCL8/I/193gxsqNYAo/PIkBr7Z9uBKPrivQ4Wp/SKpjcNA9SzQ6uLBLmq0b6oJcF F/jaczoLkS4gCfOKIL3NNemSosPRecaa7h0d8j7jg=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:40:59 +0100 Message-Id: <20220624134109.881989-45-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 44/54] lasips2: add base property X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656081583059100001 Content-Type: text/plain; charset="utf-8" This is in preparation for handling vmstate_register() within the device. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/lasips2.c | 17 ++++++++++++++++- include/hw/input/lasips2.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index bd89c03996..81beb5b614 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -251,6 +251,7 @@ LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq) DeviceState *dev; =20 dev =3D qdev_new(TYPE_LASIPS2); + qdev_prop_set_uint64(dev, "base", base); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s =3D LASIPS2(dev); =20 @@ -282,11 +283,25 @@ static void lasips2_init(Object *obj) sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mouse.reg); } =20 +static Property lasips2_properties[] =3D { + DEFINE_PROP_UINT64("base", LASIPS2State, base, UINT64_MAX), + DEFINE_PROP_END_OF_LIST(), +}; + +static void lasips2_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + device_class_set_props(dc, lasips2_properties); + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); +} + static const TypeInfo lasips2_info =3D { .name =3D TYPE_LASIPS2, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_init =3D lasips2_init, - .instance_size =3D sizeof(LASIPS2State) + .instance_size =3D sizeof(LASIPS2State), + .class_init =3D lasips2_class_init, }; =20 static void lasips2_register_types(void) diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h index b9723073e1..7e4437b925 100644 --- a/include/hw/input/lasips2.h +++ b/include/hw/input/lasips2.h @@ -25,6 +25,7 @@ typedef struct LASIPS2Port { struct LASIPS2State { SysBusDevice parent_obj; =20 + hwaddr base; LASIPS2Port kbd; LASIPS2Port mouse; qemu_irq irq; --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656080238130588.4387502677988; Fri, 24 Jun 2022 07:17:18 -0700 (PDT) Received: from localhost ([::1]:45588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4k7Z-0001Z3-4W for importer@patchew.org; Fri, 24 Jun 2022 10:17:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbq-0004Rr-RN; Fri, 24 Jun 2022 09:44:30 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42366) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbo-0005Ve-9G; Fri, 24 Jun 2022 09:44:30 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jaA-00037t-Rg; Fri, 24 Jun 2022 14:42:50 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=HBCOYvabOINYa5baTi0qYlEdjWm3DadgDrJ7OM7KRGU=; b=sfGfjHKoIxavpe/145iOVhS6Tl e0GjCVPzrKwQzi0fP9dhzBpOrbemfSdSYyb2vBs6jQ3alPl3uNZv3W9U2C53HXZI6R5FEt5grl1Gw vEKIZXyfwWYGhUAdBAfoqJVZQfpsrpdTujajmQ8CiPxjlZVeZ+zkbz3UkFr0xLQZb0kcHYPirjQoz Hmx5jCAA85OfuWnWO0mUrhSOi90PDG063EDMhL5SpKMDIZWbOrCfmFLzJRIRFVRrBVHM1SGd37/Yy lxlQtzq6Yh1xA7Goy3wL1STmMkBzP47ocf347Pxs6m7VKzwaum4RF0pcjNTtbcbAqJCBExqu1+chX t1UWAHN1PSJTw4R9k+exICgiePFu7u4KyVShVmlFbc3o/hnn+7sbM5IU66iFgzYfyFvz/DzkkG3vi 8Vj1Z2yRBvpovV8qCjyFp5njlz9Efa2THRL5uCe4c7l08pFl7h9RPnS+JWziMX9JwSngDlNOrl3q2 6eqkGBheZPBex14bsGhHyfk7PHCYOxBm9JLHn11Kfs+s9c9j2mSETdVXBp9Lj1th8IwL1xS/PMjxY P0BFGkPV1gIYbQVDoEnMlKCFacVFNosb2swOMwVdav1G5zBtwKuBjRFauGhuVyi2sU4eMSwtxxoac 62ipfNwbWHhev7Wsk7ugihxn9f5CSmgn6qCVvsp9I=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:41:00 +0100 Message-Id: <20220624134109.881989-46-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 45/54] lasips2: implement lasips2_realize() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656080239785100001 Content-Type: text/plain; charset="utf-8" Move ps2_kbd_init() and ps2_mouse_init() from lasips2_initfn() to lasips2_r= ealize. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/lasips2.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 81beb5b614..49405191cb 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -256,13 +256,17 @@ LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq ir= q) s =3D LASIPS2(dev); =20 s->irq =3D irq; + return s; +} + +static void lasips2_realize(DeviceState *dev, Error **errp) +{ + LASIPS2State *s =3D LASIPS2(dev); =20 - vmstate_register(NULL, base, &vmstate_lasips2, s); + vmstate_register(NULL, s->base, &vmstate_lasips2, s); =20 s->kbd.dev =3D ps2_kbd_init(lasips2_port_set_irq, &s->kbd); s->mouse.dev =3D ps2_mouse_init(lasips2_port_set_irq, &s->mouse); - - return s; } =20 static void lasips2_init(Object *obj) @@ -292,6 +296,7 @@ static void lasips2_class_init(ObjectClass *klass, void= *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 + dc->realize =3D lasips2_realize; device_class_set_props(dc, lasips2_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656081236555378.286460242241; Fri, 24 Jun 2022 07:33:56 -0700 (PDT) Received: from localhost ([::1]:57128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kNf-0004OW-DW for importer@patchew.org; Fri, 24 Jun 2022 10:33:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38992) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbt-0004b6-Pc; Fri, 24 Jun 2022 09:44:36 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42392) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbs-0005X5-7w; Fri, 24 Jun 2022 09:44:33 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jaF-00037t-5y; Fri, 24 Jun 2022 14:42:54 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=aTe6B8EoIVLhFLb93AWNsfsTKMaSIKi3WCmBzmOY49A=; b=ct9GSwOXNWJ2POTb+WQgpeFlgE aeOQDCcNjoeZFgI0Xe8xt8DIlmHQ+6VTFaU77A7kEvg5pQzSpvva5DswwnsQPLKaPWfjFaSjklndB 15kJBBKqVtWwBARYNB9TJeuxB/y+h90rZh10zrBTFtbrBXQwpDeDp+I1zpJHR19AadtyHlk/gwgwY gpTt80bKwLsqtpF8bbSNYr80U4X9OyVGhbj6rIebUuanoE6RB9vgbYHivXf4kRjyvMp5vpx88Sl+7 1dq55oqg9TgKaoLrMqKNH0lNK6hV4AevEjn7InlYdeEQwD8zBRlWEwkUMgW29fRgHwomIOrZsGgJO FgoGtoZmlEYlS4qOVPQtm6F+n/9z2DvlrLY5UicZLr2UguT4F3cLv9/eWL6sHo3Li/XKy59RJe/Oo TLZMs1jHaxhkpCXza5TWYRZjswKkqm0qcRgZd4uHO9fYYBlpTQzvOk8f1bAFsbM1nTbFlAHj7fecx neYm0O65w2W3eh+Ei2TfPXg7gm5VkI9aIWeH/iexH79O3Uc6s4vvsIJnPlAEZOUWQtxyiMwUWiAfH TDH4hRAXKu53K5GfC8Y2PsD2iQp7hpOfP6qCenVYYLKH0wjY70+65NCp4N3fb9VPBFxc/M80fJCj5 6S0/WN0tJSP2F/t+W5BBGY1O08GSsC+0a93B93u7I=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:41:01 +0100 Message-Id: <20220624134109.881989-47-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 46/54] lasips2: use sysbus IRQ for output IRQ X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656081237620100001 Content-Type: text/plain; charset="utf-8" This enables the IRQ to be wired up using sysbus_connect_irq() in lasips2_initfn(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/lasips2.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 49405191cb..bd72505411 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -247,16 +247,15 @@ static void lasips2_port_set_irq(void *opaque, int le= vel) =20 LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq) { - LASIPS2State *s; DeviceState *dev; =20 dev =3D qdev_new(TYPE_LASIPS2); qdev_prop_set_uint64(dev, "base", base); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - s =3D LASIPS2(dev); =20 - s->irq =3D irq; - return s; + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq); + + return LASIPS2(dev); } =20 static void lasips2_realize(DeviceState *dev, Error **errp) @@ -285,6 +284,8 @@ static void lasips2_init(Object *obj) =20 sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->kbd.reg); sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mouse.reg); + + sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); } =20 static Property lasips2_properties[] =3D { --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656081409150579.3379502803859; Fri, 24 Jun 2022 07:36:49 -0700 (PDT) Received: from localhost ([::1]:38834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kQS-0002mE-4i for importer@patchew.org; Fri, 24 Jun 2022 10:36:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jby-0004kJ-TF; Fri, 24 Jun 2022 09:44:38 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42424) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbx-0005YF-8t; Fri, 24 Jun 2022 09:44:38 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jaJ-00037t-3a; Fri, 24 Jun 2022 14:42:59 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=o/lW2eWZx4LqE1DvQuo0JJdSeAJLLCYY4C0qv1ETs9Y=; b=y7l2y4G6zbtwZy1PPEaU34Rk7g 5kBYx+FuVzmoBtMdSrevLmjX+UKZ9C20guH40pWJu4WoXIHNhBDlfO02CUniojbDATAtHsSmRu3Hw BU912vHlE3b0ncO71k/SB0tMNa11Yu1E27fm/biUq3jmk+BZZbcmTGAhh8rJNBXPgg/gd8JMbx0oN OgXYSAaRlqKDDnpsf4IJNQVWGE0DlisKM2/gD5nErgMQ7gnMvTsfH9XehpdaVylY3d+wY7aei54Vb 2Tg/CxvZNspU7mAAVFskU2kvbrQ2TwNarLWE9t9gvQW65nt3JA2pzukpKMGEWb/S0JuMZ9eqd9P7e fwqOIwAFOCrvR2kw2v5lRzy5wcN3xM61CL33q62eOAPHbYeUypcYMea/vNnHpx8zAVn1ECY+/IzP8 PljZXdrRDT9mAO+otixp0KOXYay1i+D2puVtCfV+7QXV2QWcMmQliFug3hpMaIvOA8bo4d36G+QOO qunLR2lwZAMgQm682ymsEMK2ewQEifEVbSgG9ZiF2bnvbeps6zQbDuStatHziocUxbXNnKQaJ0sFF 3tDkCyqsCOdoDVGWsdAKqcXEl7yhf/W+T/ZH9gVlzHGHAok5ylfMXA2Y0mCIYycoCSb9JRTsh6Q4W ZAHPMz1ZNHd/WByjYt8gw4JTjrizBX1bSecLDiKPw=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:41:02 +0100 Message-Id: <20220624134109.881989-48-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 47/54] lasips2: switch over from update_irq() function to PS2 device gpio X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656081410208100001 Content-Type: text/plain; charset="utf-8" Add a qdev gpio input in lasips2_init() by taking the existing lasips2_port= _set_irq() function, updating it accordingly and then renaming to lasips2_set_irq(). U= se these new qdev gpio inputs to wire up the PS2 keyboard and mouse devices. At the same time set update_irq() and update_arg to NULL in ps2_kbd_init() = and ps2_mouse_init() to ensure that any accidental attempt to use the legacy up= date_irq() function will cause a NULL pointer dereference. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/lasips2.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index bd72505411..e1a8a7e34b 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -237,9 +237,19 @@ static const MemoryRegionOps lasips2_reg_ops =3D { .endianness =3D DEVICE_NATIVE_ENDIAN, }; =20 -static void lasips2_port_set_irq(void *opaque, int level) +static void lasips2_set_kbd_irq(void *opaque, int n, int level) { - LASIPS2Port *port =3D opaque; + LASIPS2State *s =3D LASIPS2(opaque); + LASIPS2Port *port =3D &s->kbd; + + port->irq =3D level; + lasips2_update_irq(port->parent); +} + +static void lasips2_set_mouse_irq(void *opaque, int n, int level) +{ + LASIPS2State *s =3D LASIPS2(opaque); + LASIPS2Port *port =3D &s->mouse; =20 port->irq =3D level; lasips2_update_irq(port->parent); @@ -264,8 +274,14 @@ static void lasips2_realize(DeviceState *dev, Error **= errp) =20 vmstate_register(NULL, s->base, &vmstate_lasips2, s); =20 - s->kbd.dev =3D ps2_kbd_init(lasips2_port_set_irq, &s->kbd); - s->mouse.dev =3D ps2_mouse_init(lasips2_port_set_irq, &s->mouse); + s->kbd.dev =3D ps2_kbd_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(s->kbd.dev), PS2_DEVICE_IRQ, + qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq", + 0)); + s->mouse.dev =3D ps2_mouse_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(s->mouse.dev), PS2_DEVICE_IRQ, + qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq= ", + 0)); } =20 static void lasips2_init(Object *obj) @@ -286,6 +302,12 @@ static void lasips2_init(Object *obj) sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mouse.reg); =20 sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); + + qdev_init_gpio_out(DEVICE(obj), &s->irq, 1); + qdev_init_gpio_in_named(DEVICE(obj), lasips2_set_kbd_irq, + "ps2-kbd-input-irq", 1); + qdev_init_gpio_in_named(DEVICE(obj), lasips2_set_mouse_irq, + "ps2-mouse-input-irq", 1); } =20 static Property lasips2_properties[] =3D { --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656081343959164.30323926503513; Fri, 24 Jun 2022 07:35:43 -0700 (PDT) Received: from localhost ([::1]:33776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kPO-0007mw-PS for importer@patchew.org; Fri, 24 Jun 2022 10:35:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbz-0004kn-2Z; Fri, 24 Jun 2022 09:44:39 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42434) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jbx-0005Yp-JR; Fri, 24 Jun 2022 09:44:38 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jaN-00037t-Fz; Fri, 24 Jun 2022 14:42:59 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=pRgYgcKMk+LVeHplmBy38/Am3SUcdxIiwa0Zs40FFZo=; b=F+MtvwHxZHCtRXcyzZ6g28u6he PLQYpQX5WaDxwjcZiBDUJ6Yp29o+9e00pk8oH5xxbp25kel9hpCFJY49EV0S2RChImT6K7LoQEH30 tFx7XpHV2hSSdyu6SgP8fwF29oFcF0bAlG02ZViLo9ycVoVElU4S06CK0X7s4ZIs68ND/3+b8whhJ F17sPrM2IpnaDp5mulFPZ3TWPfHMimbPhsUzIXwYMdKuVWVp6OIUnx/98H9PPSkgRDqX5oHVkqIs4 QCoSKvIW1o02ZIODdqiAZ3h62micyU503EPSLbt66+4MtCLiaEweV45nuR1Gi/ViLUjKe36sS2rwt vNhW71t84odoZHS7OrR5B1zCNT5RL1TtB/c/NyfVUmHaXhf+MuUTzBFNtpirWcuHzi7wjQuU7XjcV MGE77eT1Ko0huQP+Xz4OtQ5WCmufvshWs2gE/Me0FbkOb6le+og411qdSsEIJ5+rxegV7l9b20TzL E0dnx9NP6TbvKDQJ48YOfu3nBhWSyrbGN96S8ThAIVxMIWTt5BXVBG6sXQRE7yED5FzdcXCJhVC5W 5TVede+x09k2repZr8YzaDJsCAA9pkGaCbB/+8g9FW5MMvrtoT179nX6XrEqc+W4cUZ0V+FQnQdBU Drc3AJKbJGJkDyVXDtf8p3VRNYMmbNjhoDZVIE/v8=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:41:03 +0100 Message-Id: <20220624134109.881989-49-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 48/54] lasips2: add QEMU interface comment X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656081345943100001 Content-Type: text/plain; charset="utf-8" This describes the LASI PS2 device interface implemented within QEMU. Signed-off-by: Mark Cave-Ayland Reviewed-by: Peter Maydell --- include/hw/input/lasips2.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h index 7e4437b925..03f0c9e9f9 100644 --- a/include/hw/input/lasips2.h +++ b/include/hw/input/lasips2.h @@ -4,6 +4,20 @@ * Copyright (c) 2019 Sven Schnelle * */ + +/* + * QEMU interface: + * + sysbus MMIO region 0: MemoryRegion defining the LASI PS2 keyboard + * registers + * + sysbus MMIO region 1: MemoryRegion defining the LASI PS2 mouse + * registers + * + sysbus IRQ 0: LASI PS2 output irq + * + Named GPIO input "ps2-kbd-input-irq": set to 1 if the downstream PS2 + * keyboard device has asserted its irq + * + Named GPIO input "ps2-mouse-input-irq": set to 1 if the downstream PS2 + * mouse device has asserted its irq + */ + #ifndef HW_INPUT_LASIPS2_H #define HW_INPUT_LASIPS2_H =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165608076443892.38155366645344; Fri, 24 Jun 2022 07:26:04 -0700 (PDT) Received: from localhost ([::1]:42106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kG3-0002ea-A2 for importer@patchew.org; Fri, 24 Jun 2022 10:26:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jc0-0004q5-Bl; Fri, 24 Jun 2022 09:44:40 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42436) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jby-0005ZG-E3; Fri, 24 Jun 2022 09:44:40 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jaN-00037t-U9; Fri, 24 Jun 2022 14:43:00 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=1ziIIUpFc5E35r0AnNosnNGeFEOoSVqErikcGd+BEFg=; b=O/uJGN3TZzAXelT2mwiRbqZcBf dFa/9LZ6E0FeamDAS81IHFf8sADcPCOKiUu4xheCWpsQwxOryfFyWJTiZMh26PWQYynKbD21zIzRG eDS8UtR82MkATaI022BHvW899hpLPufPexKuJADockNZPWi6ui76HkilsP6xLaKtX+hTw43AKF0pq JmwuwpkUfJynrDBV3JpwBldT1LXp+v3TOiqPuZPiY3BWfFFGUSbt5Oy93xesdjyvxAztgKn81nTWf lNpTq6ogD6vZ0vTzdwkYumQk7Z+nfPJiXNyL44OSuXj6zlZ3aknd1pfOkmzHz4r5VzSH9so7xhnOX B9CR7MBu8Ph7MrJzlVW1qj/spZkCOUVNMJp0D0olH9oI/wGLwjcLKfCa4th2K3cmZDjhVflC8Ribs mhDITa6SzI89h1d8x+dyspbvzYKvbjwd6Kitq9FT6sjnEqBGrmMzWfQjPFU6J//wJ6o9qMlgdT4bv ZVzOkfVmDBvOhDMGxmSo+ZwqXNGn9wHorAv9AA3RSGymCs+veE/ro1xbMTr+kSvGKzpo55YyRgHYq YeTT9wvFfF3jzjWHGxvs9DF0oMZ62Cf8JcEdA8lrwIGFUXnpPMl9KEUuiwOZy/5PE5Tg9+xWc+8Sf EkFntA/22DUH4aIwSZ0W+Wul3YEDlfT71dPKhwD0s=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:41:04 +0100 Message-Id: <20220624134109.881989-50-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 49/54] pckbd: switch I8042_MMIO device from update_irq() function to PS2 device gpio X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656080766128100001 Content-Type: text/plain; charset="utf-8" Define a new qdev input gpio for handling incoming PS2 IRQs, and then wire = up the PS2 keyboard and mouse devices to use it. At the same time set update_irq()= and update_arg to NULL in ps2_kbd_init() and ps2_mouse_init() to ensure that any accidental attempt to use the legacy update_irq() function will cause a NULL pointer dereference. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 5d7c969fc6..ee306428a3 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -665,6 +665,22 @@ static const MemoryRegionOps i8042_mmio_ops =3D { .endianness =3D DEVICE_NATIVE_ENDIAN, }; =20 +static void i8042_mmio_set_kbd_irq(void *opaque, int n, int level) +{ + MMIOKBDState *s =3D I8042_MMIO(opaque); + KBDState *ks =3D &s->kbd; + + kbd_update_kbd_irq(ks, level); +} + +static void i8042_mmio_set_mouse_irq(void *opaque, int n, int level) +{ + MMIOKBDState *s =3D I8042_MMIO(opaque); + KBDState *ks =3D &s->kbd; + + kbd_update_aux_irq(ks, level); +} + static void i8042_mmio_reset(DeviceState *dev) { MMIOKBDState *s =3D I8042_MMIO(dev); @@ -686,8 +702,14 @@ static void i8042_mmio_realize(DeviceState *dev, Error= **errp) /* Note we can't use dc->vmsd without breaking migration compatibility= */ vmstate_register(NULL, 0, &vmstate_kbd, ks); =20 - ks->kbd =3D ps2_kbd_init(kbd_update_kbd_irq, ks); - ks->mouse =3D ps2_mouse_init(kbd_update_aux_irq, ks); + ks->kbd =3D ps2_kbd_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(ks->kbd), PS2_DEVICE_IRQ, + qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq", + 0)); + ks->mouse =3D ps2_mouse_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(ks->mouse), PS2_DEVICE_IRQ, + qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq= ", + 0)); } =20 static void i8042_mmio_init(Object *obj) @@ -696,6 +718,12 @@ static void i8042_mmio_init(Object *obj) KBDState *ks =3D &s->kbd; =20 ks->extended_state =3D true; + + qdev_init_gpio_out(DEVICE(obj), ks->irqs, 2); + qdev_init_gpio_in_named(DEVICE(obj), i8042_mmio_set_kbd_irq, + "ps2-kbd-input-irq", 1); + qdev_init_gpio_in_named(DEVICE(obj), i8042_mmio_set_mouse_irq, + "ps2-mouse-input-irq", 1); } =20 static Property i8042_mmio_properties[] =3D { @@ -718,16 +746,14 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_ir= q mouse_irq, ram_addr_t size, hwaddr mask) { DeviceState *dev; - KBDState *s; =20 dev =3D qdev_new(TYPE_I8042_MMIO); qdev_prop_set_uint64(dev, "mask", mask); qdev_prop_set_uint32(dev, "size", size); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - s =3D &I8042_MMIO(dev)->kbd; =20 - s->irqs[I8042_KBD_IRQ] =3D kbd_irq; - s->irqs[I8042_MOUSE_IRQ] =3D mouse_irq; + qdev_connect_gpio_out(dev, I8042_KBD_IRQ, kbd_irq); + qdev_connect_gpio_out(dev, I8042_MOUSE_IRQ, mouse_irq); =20 return I8042_MMIO(dev); } --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656081785282699.1300200673314; Fri, 24 Jun 2022 07:43:05 -0700 (PDT) Received: from localhost ([::1]:54278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kWV-0004ki-S2 for importer@patchew.org; Fri, 24 Jun 2022 10:43:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jkm-0001c6-RH; Fri, 24 Jun 2022 09:53:46 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42480) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jkk-0006wY-W8; Fri, 24 Jun 2022 09:53:44 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jaO-00037t-Ko; Fri, 24 Jun 2022 14:43:01 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=HwuYxJXmMxIUIsMZlBhsDz2pYSqDKUVRHYRn/I4psUM=; b=SSQX671yNkslfxjls931yPyVKe YTgEJhi6oJzyLD+DSLEDPoIebSY9v2DHA1DLQ3J5hLhcM95CUkICC7GQVGyo++8ECl9v+Uj1Rf6L1 xWH4GPWBtdgA/XmlsMeXEY9rSbbZd1ibp66QaoDAlrnJ/+fO8XChwuLyDJFiRpw6rOSorbCEAnr/Z GGA/5yv7+3nJ2aQOyEFuN/crF9Xbd9vbDo6/dWHwJgECNsawZEIdpVs/KtgA7rqLl7q4oBne5KetW HM/tXJeaf2IcNBA99A3lLR3vXnKvL9Kn+da+82ZYnKHwAqtUamGU/0cNLCfyE9YbzVQOnas9EPKWO 96meBQ6DQtUS8i0vR2kDO0hoNjY7gxIyrEvX+zBaUCsbQ04Gtw3MvHj1Ol+Wf4g8z+OoIyTF2iwD7 rZsiHvqwI6GPuPyzZ71wDRh98bqkxjkddddtwog5JEmCGNTunfNkMFGwqpTVFNg9EgNjJoDgpDGNn oLExUPD2Hk2KPNwkYyuqrf8ChpeCkAIaVdWLRt8D3Ia+cSG4wPz9DUVS85ppSd4hKTdRPcV39xjpt zzajjtSkK+xPktrvdZTStyD9yjH+U5ek6PA/n8HPIK7xnBqo8MdUyCMu8u9+F3UXqIjfrLRZlSZqn TuYZcc0eBCLi3GPA8lXLWUelYiMa5NPFUnL3MPWMU=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:41:05 +0100 Message-Id: <20220624134109.881989-51-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 50/54] pckbd: add QEMU interface comment for I8042_MMIO device X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656081787391100001 Content-Type: text/plain; charset="utf-8" This describes the I8042_MMIO device interface implemented within QEMU. Signed-off-by: Mark Cave-Ayland Reviewed-by: Peter Maydell --- include/hw/input/i8042.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index 4ba2664377..d4747b62b8 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -52,6 +52,17 @@ struct ISAKBDState { uint8_t mouse_irq; }; =20 +/* + * QEMU interface: + * + sysbus MMIO region 0: MemoryRegion defining the command/status/data + * registers (access determined by mask property and access type) + * + Named GPIO input "ps2-kbd-input-irq": set to 1 if the downstream PS2 + * keyboard device has asserted its irq + * + Named GPIO input "ps2-mouse-input-irq": set to 1 if the downstream PS2 + * mouse device has asserted its irq + * + Unnamed GPIO output 0-1: i8042 output irqs for keyboard (0) or mouse = (1) + */ + #define TYPE_I8042_MMIO "i8042-mmio" OBJECT_DECLARE_SIMPLE_TYPE(MMIOKBDState, I8042_MMIO) =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656080697349412.74859429492335; Fri, 24 Jun 2022 07:24:57 -0700 (PDT) Received: from localhost ([::1]:37744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kEx-00081A-Ki for importer@patchew.org; Fri, 24 Jun 2022 10:24:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jl2-0001hY-My; Fri, 24 Jun 2022 09:54:01 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42496) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jkx-0006xI-3Q; Fri, 24 Jun 2022 09:53:59 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jaP-00037t-65; Fri, 24 Jun 2022 14:43:04 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=iV2Q14gLvY52gsjGJcm1OZ7i8cWdQxAoNfO3V+1B1/Y=; b=nkHG1tPUSjgv5VD64wRkmxeMGu 919W6gbUtQEmbpqTVqNcBhwMMR4yNScpNOfY+6TzTOdYOa8yyy0Tab97hnnGy9rWgGUQeYh1zxndE 4XWNIUcZIbslcq9GIR8VsIkEcGDNAcBeT53XuKyYw2LswEDvSmHyt/stG8+rNEF7GslZ9vWyF9lr4 ir14kmVvQY9fBr7pDZbSBOHZjze8cmSEabBp0aeXeMsN/fbHLztEDGonxJFFwqmXLE1zlx6eeQXAe QX1vxPMFqoRrvJyFvFN5WxDIod5G1+FLiZeYbFfca6+amQdkMBvGterNQJBo1Gb1HxJpQgnRfdUjw KRIRd3qb57sRkfGz7cbmjBu7t3qPr7Nw+zBWboYMHgbLXrcPkZord7zhFXQwa0YpCU0hcoj08ac0L mz9SXWWbW0jHxQxQrdu6GEwr6rZVlE5ylZjXXxoCIZvxbDe5EkwnHFeFwJLeAdzmFEIOwMnvXSPeE z0N+9ttvc6oOBGU8jAuZVVcnGwJoa6AtRgH581AiruSXphL5bQID4y0sPGFbYABuExyatI0kYeV+2 7FgSSX/Ifpqa14GgN/Ny6IM4Qt36o2h0k0Y6M3sH4VnadzxdAImTyHS+uLVwpJdiH0HJ00J39tiQv n0tQ+W15yz36Nv2BcSfVGT0Uh8BnfbOeSVU5+PbMI=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:41:06 +0100 Message-Id: <20220624134109.881989-52-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 51/54] pckbd: add i8042_reset() function to I8042 device X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656080697900100001 Content-Type: text/plain; charset="utf-8" This means that it is no longer necessary to call qemu_register_reset() man= ually within i8042_realizefn(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index ee306428a3..ff76c0636d 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -808,6 +808,14 @@ static const MemoryRegionOps i8042_cmd_ops =3D { .endianness =3D DEVICE_LITTLE_ENDIAN, }; =20 +static void i8042_reset(DeviceState *dev) +{ + ISAKBDState *s =3D I8042(dev); + KBDState *ks =3D &s->kbd; + + kbd_reset(ks); +} + static void i8042_initfn(Object *obj) { ISAKBDState *isa_s =3D I8042(obj); @@ -854,7 +862,6 @@ static void i8042_realizefn(DeviceState *dev, Error **e= rrp) s->throttle_timer =3D timer_new_us(QEMU_CLOCK_VIRTUAL, kbd_throttle_timeout, s); } - qemu_register_reset(kbd_reset, s); } =20 static void i8042_build_aml(AcpiDevAmlIf *adev, Aml *scope) @@ -900,6 +907,7 @@ static void i8042_class_initfn(ObjectClass *klass, void= *data) AcpiDevAmlIfClass *adevc =3D ACPI_DEV_AML_IF_CLASS(klass); =20 device_class_set_props(dc, i8042_properties); + dc->reset =3D i8042_reset; dc->realize =3D i8042_realizefn; dc->vmsd =3D &vmstate_kbd_isa; adevc->build_dev_aml =3D i8042_build_aml; --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656081102550543.3560297938708; Fri, 24 Jun 2022 07:31:42 -0700 (PDT) Received: from localhost ([::1]:54244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kLV-0002Uq-E1 for importer@patchew.org; Fri, 24 Jun 2022 10:31:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jlC-0001pD-9C; Fri, 24 Jun 2022 09:54:10 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42512) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jlA-000708-Ma; Fri, 24 Jun 2022 09:54:10 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jaS-00037t-S2; Fri, 24 Jun 2022 14:43:05 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=eH7hkdl2ISoZCCcIwkBaDuhaHgBX+ivlSlQA/a1XMq4=; b=wiTCFruB/j/zQJR6iskXeWOtHG KI3QvLzkvrJPm4Vx2plCBuDQinriqB1lcSnryG4v99h81NC5aItq8Rpht8rgGW8bvgpR+ItzCR5zc xdNL8nTOuM5CiG/Uv3UWKD29yib5QzbT9RgaLjhwSpAZiYUMsSijGeINKn1kZshraeJmJTvBZHeue Fgltz6BgdUks5184lMA5ul5ldCLkg9r2bpKNTZFilx/EXU0778d/F+gBL07rqOSEseZBuAqRuIaOu NpFhazSanzlnoUB9zY9xdAy2ZVWx+18NyY8ZiGZUwV60P7FDXlY1rZ7HAtJuzFqxfPPxDw1JaiIGU d5M7DVT4zSgNaHy5SZ9YxOcNVGGagZUZGjLbmTXyXM0mINcqgua3BC1j6tf5oLteIUAMuljYFrjas yrBZZhOc3kHUGdEWdtwjxkyNeQIBRjS7SHherCyERXPeTWF2jEn8qum8xX2IeIglPyP6f29zttwAS 61QMuDpXvVzqHo19AuGBAamCa27+KqE9UarnxnaFBtyE5I2SKi/mJNLFQBn8ECwdrQhfYpd228QOG wFieLFECR48hFT4Duf4LvVDdo5K7NVDI9n9nx0Y7Gm/KYDINte7roEnHoP2nkTlh21dYFP6nl8M/P qsgElvK4K+BxppQ/+kwBC5oLQHOFRbADQwnCOvrjg=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:41:07 +0100 Message-Id: <20220624134109.881989-53-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 52/54] pckbd: switch I8042 device from update_irq() function to PS2 device gpio X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656081104016100001 Content-Type: text/plain; charset="utf-8" Define a new qdev input gpio for handling incoming PS2 IRQs, and then wire = up the PS2 keyboard and mouse devices to use it. At the same time set update_irq()= and update_arg to NULL in ps2_kbd_init() and ps2_mouse_init() to ensure that any accidental attempt to use the legacy update_irq() function will cause a NULL pointer dereference. Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index ff76c0636d..18f27abc58 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -808,6 +808,23 @@ static const MemoryRegionOps i8042_cmd_ops =3D { .endianness =3D DEVICE_LITTLE_ENDIAN, }; =20 +static void i8042_set_kbd_irq(void *opaque, int n, int level) +{ + ISAKBDState *s =3D I8042(opaque); + KBDState *ks =3D &s->kbd; + + kbd_update_kbd_irq(ks, level); +} + +static void i8042_set_mouse_irq(void *opaque, int n, int level) +{ + ISAKBDState *s =3D I8042(opaque); + KBDState *ks =3D &s->kbd; + + kbd_update_aux_irq(ks, level); +} + + static void i8042_reset(DeviceState *dev) { ISAKBDState *s =3D I8042(dev); @@ -827,6 +844,12 @@ static void i8042_initfn(Object *obj) "i8042-cmd", 1); =20 qdev_init_gpio_out_named(DEVICE(obj), &s->a20_out, I8042_A20_LINE, 1); + + qdev_init_gpio_out(DEVICE(obj), s->irqs, 2); + qdev_init_gpio_in_named(DEVICE(obj), i8042_set_kbd_irq, + "ps2-kbd-input-irq", 1); + qdev_init_gpio_in_named(DEVICE(obj), i8042_set_mouse_irq, + "ps2-mouse-input-irq", 1); } =20 static void i8042_realizefn(DeviceState *dev, Error **errp) @@ -847,14 +870,20 @@ static void i8042_realizefn(DeviceState *dev, Error *= *errp) return; } =20 - s->irqs[I8042_KBD_IRQ] =3D isa_get_irq(isadev, isa_s->kbd_irq); - s->irqs[I8042_MOUSE_IRQ] =3D isa_get_irq(isadev, isa_s->mouse_irq); + isa_connect_gpio_out(isadev, I8042_KBD_IRQ, isa_s->kbd_irq); + isa_connect_gpio_out(isadev, I8042_MOUSE_IRQ, isa_s->mouse_irq); =20 isa_register_ioport(isadev, isa_s->io + 0, 0x60); isa_register_ioport(isadev, isa_s->io + 1, 0x64); =20 - s->kbd =3D ps2_kbd_init(kbd_update_kbd_irq, s); - s->mouse =3D ps2_mouse_init(kbd_update_aux_irq, s); + s->kbd =3D ps2_kbd_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(s->kbd), PS2_DEVICE_IRQ, + qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq", + 0)); + s->mouse =3D ps2_mouse_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(s->mouse), PS2_DEVICE_IRQ, + qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq= ", + 0)); if (isa_s->kbd_throttle && !isa_s->kbd.extended_state) { warn_report(TYPE_I8042 ": can't enable kbd-throttle without" " extended-state, disabling kbd-throttle"); --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656080951395131.58854174138844; Fri, 24 Jun 2022 07:29:11 -0700 (PDT) Received: from localhost ([::1]:47636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kJ4-0006U2-Bn for importer@patchew.org; Fri, 24 Jun 2022 10:29:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jlL-00028g-2E; Fri, 24 Jun 2022 09:54:19 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42532) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jlJ-00070h-J2; Fri, 24 Jun 2022 09:54:18 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jaT-00037t-D6; Fri, 24 Jun 2022 14:43:05 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6Hphajeow5XmypenLR8EsWskzKd53PSyFRVp74G44H0=; b=yeWM3RE3UiJwEZHz3MlsVa9Dik xI1MWPKSq8IFwCXKL1rQo4YTfks8k8OzH9RLpwnbPyi0g6mwEqbn21odtjjfVbZY6oAvj/ox6LxBV 1wJfhhEzKkVOUwAgp3s4nCEEatdqhIgMVY+X2IQK3TeJWD/EVWU2EFr3tMc0XnUhrT69qkdhsyNWN Caq4LeaHbbtLsP2IN7Den5H3lX3lmePwvwvCcqZSZz6V+GS2D4QJOEjtFUG7HdXUwBWzJOOJbVt7x jWo1l76ZA/MUqAC3t+Sab3Haxuc64x+fyQwPmJwwdadOqnXP2dYTl/PTuZH1Cu5Fits08OZxovBgp wtdZmH5kqAxK/U5BZG/tKfOIQGpUJqrGPpvKLOZtqe0b9tEhzS1Zjg+YXGr9puh1muT/BEBBnh5YG /pliVP48mJqP7x67OaJ1Yg9ggvh7GjZ6zzTPMQuyTiyBnHqUUUlYqVYLaSICo3YytJgZwkBAqD4A/ z8SDGQY+PUgtcHyMWz4pxHNJ45davxzhTvp7ODEAfRc2IohwTn74cz6cq7fDh0q6PEwy48pL8PJVx 7HXSJRfCHxUw8ExbHufv7MUT19McF/hG9Nv4Io5yrNet7vziIrjOLgtc9/AbcH08OhdikdPbHD5+q WQ8ERPx1ZWpcXVbMUDfSaXQSgvjxgL3+Web3jlSa4=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:41:08 +0100 Message-Id: <20220624134109.881989-54-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 53/54] pckbd: add QEMU interface comment for I8042 device X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656080953249100001 Content-Type: text/plain; charset="utf-8" This describes the I8042 device interface implemented within QEMU. Signed-off-by: Mark Cave-Ayland Reviewed-by: Peter Maydell --- include/hw/input/i8042.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index d4747b62b8..ca933d8e1b 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -39,6 +39,16 @@ typedef struct KBDState { hwaddr mask; } KBDState; =20 +/* + * QEMU interface: + * + Named GPIO input "ps2-kbd-input-irq": set to 1 if the downstream PS2 + * keyboard device has asserted its irq + * + Named GPIO input "ps2-mouse-input-irq": set to 1 if the downstream PS2 + * mouse device has asserted its irq + * + Named GPIO output "a20": A20 line for x86 PCs + * + Unnamed GPIO output 0-1: i8042 output irqs for keyboard (0) or mouse = (1) + */ + #define TYPE_I8042 "i8042" OBJECT_DECLARE_SIMPLE_TYPE(ISAKBDState, I8042) =20 --=20 2.30.2 From nobody Fri May 17 03:54:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656081226548916.6094000860269; Fri, 24 Jun 2022 07:33:46 -0700 (PDT) Received: from localhost ([::1]:56474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4kNV-0003yb-8x for importer@patchew.org; Fri, 24 Jun 2022 10:33:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jlT-0002Lj-Ni; Fri, 24 Jun 2022 09:54:29 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:42548) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4jlR-00071Z-Sn; Fri, 24 Jun 2022 09:54:27 -0400 Received: from [2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4jaT-00037t-Ph; Fri, 24 Jun 2022 14:43:06 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZTPwjT1Vm+ZYEp3lbyW2wgQOHxqIGZbSYppQ6jGYf54=; b=Y2hRAyfhFXqOetKgJWXo/wTSuC gABHk4spC5RXbyTtrtrxm8855YR+9jPoRCa/4az7qVMDQ3E2SyZXBVz6uhFZUPaVUjSg8Bqx/+4XO XkbL3KJHk7kBMrsCACOBrZeLWc3sX7QR+0FNGTGJGXfEijP+KQVbAbatxdAEBF5TjzbrP90obhrZh WJ+OUn83XiplfD/syXrdLSOnY11eq4ix7pq/nz3wqYo4R3iKVZJt+ipiGbX9OBOx2Zb5HORy2KBKz 1jpQtP9LRXT64hf9yWGv45c6RPX8MtucPPlAXuWVWzbiUwuzY2bsCun+anU0DirOlsdXaNLnY7t3y Vm29TQRgbVf0+EWcPEWY77gNBOBWejpdY4/sEOeyT4SSFkWOEO+tEZNG7hRScUvYa2G9pLwQJKsy5 PiYZLmuntfq4dCxB9HvVu/yEcP8jATY/DJfdwzT6kag5h6LC0GVPo43h5LhgjixSq6fUZaGqC/eap yl2JkB8Xbphk0o3Y7N4NZQtU6z3OCIudHuM5RgpOlRcBo3yDdikbvJdmJw1yFuQCdJFaf8irPjA+v bm7EuTtPVdmlc7+A5NI4ttw8Tcv6VmUwZpq1IBQlYKvpys2ZzSABf2SXng5P6BGyrPOSmU1kPczPu EB2cQaQuHaBQQpblL9h47BS3OwZ3kFME+qVTv32Ro=; From: Mark Cave-Ayland To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com, pbonzini@redhat.com, peter.maydell@linaro.org, hpoussin@reactos.org, aleksandar.rikalo@syrmia.com, f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Fri, 24 Jun 2022 14:41:09 +0100 Message-Id: <20220624134109.881989-55-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> References: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba4:e500:b82f:56f9:46d7:80ab X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 54/54] ps2: remove update_irq() function and update_arg parameter X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1656081227871100001 Content-Type: text/plain; charset="utf-8" Now that all the PS2 devices have been converted to use GPIOs the update_ir= q() callback function and the update_arg parameter can be removed. This allows these arguments to be completely removed from ps2_kbd_init() and ps2_mouse_init(), along with the transitional logic that was added to ps2_raise_irq() and ps2_lower_irq(). Signed-off-by: Mark Cave-Ayland Acked-by: Helge Deller Reviewed-by: Peter Maydell --- hw/input/lasips2.c | 4 ++-- hw/input/pckbd.c | 8 ++++---- hw/input/pl050.c | 4 ++-- hw/input/ps2.c | 25 ++++--------------------- include/hw/input/ps2.h | 6 ++---- 5 files changed, 14 insertions(+), 33 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index e1a8a7e34b..eae1953681 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -274,11 +274,11 @@ static void lasips2_realize(DeviceState *dev, Error *= *errp) =20 vmstate_register(NULL, s->base, &vmstate_lasips2, s); =20 - s->kbd.dev =3D ps2_kbd_init(NULL, NULL); + s->kbd.dev =3D ps2_kbd_init(); qdev_connect_gpio_out(DEVICE(s->kbd.dev), PS2_DEVICE_IRQ, qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq", 0)); - s->mouse.dev =3D ps2_mouse_init(NULL, NULL); + s->mouse.dev =3D ps2_mouse_init(); qdev_connect_gpio_out(DEVICE(s->mouse.dev), PS2_DEVICE_IRQ, qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq= ", 0)); diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 18f27abc58..9184411c3e 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -702,11 +702,11 @@ static void i8042_mmio_realize(DeviceState *dev, Erro= r **errp) /* Note we can't use dc->vmsd without breaking migration compatibility= */ vmstate_register(NULL, 0, &vmstate_kbd, ks); =20 - ks->kbd =3D ps2_kbd_init(NULL, NULL); + ks->kbd =3D ps2_kbd_init(); qdev_connect_gpio_out(DEVICE(ks->kbd), PS2_DEVICE_IRQ, qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq", 0)); - ks->mouse =3D ps2_mouse_init(NULL, NULL); + ks->mouse =3D ps2_mouse_init(); qdev_connect_gpio_out(DEVICE(ks->mouse), PS2_DEVICE_IRQ, qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq= ", 0)); @@ -876,11 +876,11 @@ static void i8042_realizefn(DeviceState *dev, Error *= *errp) isa_register_ioport(isadev, isa_s->io + 0, 0x60); isa_register_ioport(isadev, isa_s->io + 1, 0x64); =20 - s->kbd =3D ps2_kbd_init(NULL, NULL); + s->kbd =3D ps2_kbd_init(); qdev_connect_gpio_out(DEVICE(s->kbd), PS2_DEVICE_IRQ, qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq", 0)); - s->mouse =3D ps2_mouse_init(NULL, NULL); + s->mouse =3D ps2_mouse_init(); qdev_connect_gpio_out(DEVICE(s->mouse), PS2_DEVICE_IRQ, qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq= ", 0)); diff --git a/hw/input/pl050.c b/hw/input/pl050.c index ffaa72dea4..209cc001cf 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -172,9 +172,9 @@ static void pl050_realize(DeviceState *dev, Error **err= p) sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); if (s->is_mouse) { - s->dev =3D ps2_mouse_init(NULL, NULL); + s->dev =3D ps2_mouse_init(); } else { - s->dev =3D ps2_kbd_init(NULL, NULL); + s->dev =3D ps2_kbd_init(); } qdev_connect_gpio_out(DEVICE(s->dev), PS2_DEVICE_IRQ, qdev_get_gpio_in_named(dev, "ps2-input-irq", 0)); diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 98c6206fb8..59bac28ac8 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -175,20 +175,12 @@ void ps2_queue_noirq(PS2State *s, int b) =20 static void ps2_raise_irq(PS2State *s) { - if (qemu_irq_is_connected(s->irq)) { - qemu_set_irq(s->irq, 1); - } else { - s->update_irq(s->update_arg, 1); - } + qemu_set_irq(s->irq, 1); } =20 static void ps2_lower_irq(PS2State *s) { - if (qemu_irq_is_connected(s->irq)) { - qemu_set_irq(s->irq, 0); - } else { - s->update_irq(s->update_arg, 0); - } + qemu_set_irq(s->irq, 0); } =20 void ps2_queue(PS2State *s, int b) @@ -1232,21 +1224,16 @@ static void ps2_kbd_realize(DeviceState *dev, Error= **errp) qemu_input_handler_register(dev, &ps2_keyboard_handler); } =20 -void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) +void *ps2_kbd_init(void) { DeviceState *dev; PS2KbdState *s; - PS2State *ps2; =20 dev =3D qdev_new(TYPE_PS2_KBD_DEVICE); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s =3D PS2_KBD_DEVICE(dev); - ps2 =3D PS2_DEVICE(s); =20 trace_ps2_kbd_init(s); - ps2->update_irq =3D update_irq; - ps2->update_arg =3D update_arg; - return s; } =20 @@ -1262,20 +1249,16 @@ static void ps2_mouse_realize(DeviceState *dev, Err= or **errp) qemu_input_handler_register(dev, &ps2_mouse_handler); } =20 -void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) +void *ps2_mouse_init(void) { DeviceState *dev; PS2MouseState *s; - PS2State *ps2; =20 dev =3D qdev_new(TYPE_PS2_MOUSE_DEVICE); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s =3D PS2_MOUSE_DEVICE(dev); - ps2 =3D PS2_DEVICE(s); =20 trace_ps2_mouse_init(s); - ps2->update_irq =3D update_irq; - ps2->update_arg =3D update_arg; return s; } =20 diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 5422aee9aa..a78619d8cb 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -59,8 +59,6 @@ struct PS2State { PS2Queue queue; int32_t write_cmd; qemu_irq irq; - void (*update_irq)(void *, int); - void *update_arg; }; =20 #define TYPE_PS2_DEVICE "ps2-device" @@ -100,8 +98,8 @@ struct PS2MouseState { OBJECT_DECLARE_SIMPLE_TYPE(PS2MouseState, PS2_MOUSE_DEVICE) =20 /* ps2.c */ -void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg); -void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg); +void *ps2_kbd_init(void); +void *ps2_mouse_init(void); void ps2_write_mouse(PS2MouseState *s, int val); void ps2_write_keyboard(PS2KbdState *s, int val); uint32_t ps2_read_data(PS2State *s); --=20 2.30.2