From patchwork Sun May 22 18:17:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634301 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=ZjtJE4dr; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5pl20wf8z9sG2 for ; Mon, 23 May 2022 04:24:14 +1000 (AEST) Received: from localhost ([::1]:57226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqFQ-0004bW-5o for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:24:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAU-0006gf-6M; Sun, 22 May 2022 14:19:10 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47286) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAP-0003Vv-De; Sun, 22 May 2022 14:19:04 -0400 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=exnlTfS0pKIxz/Waxt0OF1ETIHTM7CRo2Ez6G0229e8=; b=ZjtJE4drOIDqHBsnfr0c7K6Xik CUqOY2pG4cW2bIojsTUhG9HllZeoSnD5ulfgvPVzC1zYbTEoqOjhfabDR2n4AfxQ6PUAqLBc2RkOG /TW+9OkIBXt0/qSmUzv7LLCZXtMth6BB0sHQcbgCdgfjZmwaAaqbUU9OeX+jmvnulkij+mC1RgQdO Aj4EVXTO9Y/5ed3xB+edQQ0SWJ4jM9k0Zbnyc0c9veujnIv6xwsSJ6qqf4pbDmn2B9Jh/+HU5gQdQ wFB2dN5GsqIwAF2OKlqnQLGsCiJEUyUoQ0aShzGVc3fSNVZ/5v5r47bF1DSY5z193kkH+gXiaXUpz 9a5Qd7i6XxBNttQG/Bzgim+wFUnKsvfylsuYDvGzvFFMZTZ7dF7lblMALMNqCqFibRf8TuiSVyFKc /Oj6K7S0UPU+JKsb0MYLV0lxQ5lByDnnKyPGTvdH/vaVtqjnBy8Pjp/U9lKBKro2QHgzJVMMQ6nen +9mHY0kcLgWacJEzkOgDau9OlWDsffUrhyIN3MHaLIdpQ7bU236nB65lqCIXWDma3UvQYxSEYpv++ 1yhBf7UOpciTnYy6ELuttG8O1euRQgLSoHOwHLaKhu46YqXM0cQ7m0pxAo5XLmwmqH/kgeqo1WY8i Pv20sKINBrSKMajeeVvHWkW5GtlGB09rB5D66Lf18=; 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 1nsq9E-0007pH-Ck; Sun, 22 May 2022 19:17:52 +0100 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: Sun, 22 May 2022 19:17:47 +0100 Message-Id: <20220522181836.864-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 01/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Mark Cave-Ayland --- 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" /* 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 mode */ /* 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 */ /* 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. */ #define MOUSE_STATUS_REMOTE 0x40 #define MOUSE_STATUS_ENABLED 0x20 @@ -436,8 +436,9 @@ static void ps2_keyboard_event(DeviceState *dev, QemuConsole *src, } } } else { - if (qcode < qemu_input_map_qcode_to_atset1_len) + if (qcode < qemu_input_map_qcode_to_atset1_len) { keycode = 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, QemuConsole *src, } } } else { - if (qcode < qemu_input_map_qcode_to_atset2_len) + if (qcode < qemu_input_map_qcode_to_atset2_len) { keycode = 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, QemuConsole *src, } } } else if (s->scancode_set == 3) { - if (qcode < qemu_input_map_qcode_to_atset3_len) + if (qcode < qemu_input_map_qcode_to_atset3_len) { keycode = qemu_input_map_qcode_to_atset3[qcode]; + } if (keycode) { /* FIXME: break code should be configured on a key by key basis */ if (!key->down) { @@ -569,8 +572,10 @@ uint32_t ps2_read_data(PS2State *s) trace_ps2_read_data(s); q = &s->queue; if (q->count == 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 = q->rptr - 1; if (index < 0) { @@ -619,10 +624,10 @@ void ps2_write_keyboard(void *opaque, int val) 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) } } -/* Set the scancode translation mode. - 0 = raw scancodes. - 1 = translated scancodes (used by qemu internally). */ +/* + * Set the scancode translation mode. + * 0 = raw scancodes. + * 1 = translated scancodes (used by qemu internally). + */ void ps2_keyboard_set_translation(void *opaque, int mode) { @@ -727,30 +734,33 @@ static int ps2_mouse_send_packet(PS2MouseState *s) dz1 = s->mouse_dz; dw1 = s->mouse_dw; /* XXX: increase range to 8 bits ? */ - if (dx1 > 127) + if (dx1 > 127) { dx1 = 127; - else if (dx1 < -127) + } else if (dx1 < -127) { dx1 = -127; - if (dy1 > 127) + } + if (dy1 > 127) { dy1 = 127; - else if (dy1 < -127) + } else if (dy1 < -127) { dy1 = -127; + } b = 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 = 0; s->mouse_dw = 0; break; case 3: - if (dz1 > 127) + if (dz1 > 127) { dz1 = 127; - else if (dz1 < -127) - dz1 = -127; + } else if (dz1 < -127) { + dz1 = -127; + } ps2_queue_noirq(&s->common, dz1 & 0xff); s->mouse_dz -= dz1; s->mouse_dw = 0; @@ -816,8 +826,9 @@ static void ps2_mouse_event(DeviceState *dev, QemuConsole *src, InputBtnEvent *btn; /* check if deltas are recorded when disabled */ - if (!(s->mouse_status & MOUSE_STATUS_ENABLED)) + if (!(s->mouse_status & MOUSE_STATUS_ENABLED)) { return; + } 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 == 0 && s->mouse_dy == 0 && s->mouse_dz == 0 && s->mouse_dw == 0) { @@ -892,7 +905,7 @@ void ps2_write_mouse(void *opaque, int val) PS2MouseState *s = (PS2MouseState *)opaque; 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 &= ~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 = val; /* detect IMPS/2 or IMEX */ - switch(s->mouse_detect_state) { + switch (s->mouse_detect_state) { default: case 0: - if (val == 200) + if (val == 200) { s->mouse_detect_state = 1; + } break; case 1: - if (val == 100) + if (val == 100) { s->mouse_detect_state = 2; - else if (val == 200) + } else if (val == 200) { s->mouse_detect_state = 3; - else + } else { s->mouse_detect_state = 0; + } break; case 2: - if (val == 80) + if (val == 80) { s->mouse_type = 3; /* IMPS/2 */ + } s->mouse_detect_state = 0; break; case 3: - if (val == 80) + if (val == 80) { s->mouse_type = 4; /* IMEX */ + } s->mouse_detect_state = 0; break; } @@ -1154,13 +1171,14 @@ static const VMStateDescription vmstate_ps2_keyboard_cqueue = { } }; -static int ps2_kbd_post_load(void* opaque, int version_id) +static int ps2_kbd_post_load(void *opaque, int version_id) { - PS2KbdState *s = (PS2KbdState*)opaque; + PS2KbdState *s = (PS2KbdState *)opaque; PS2State *ps2 = &s->common; - if (version_id == 2) - s->scancode_set=2; + if (version_id == 2) { + s->scancode_set = 2; + } ps2_common_post_load(ps2); @@ -1176,10 +1194,10 @@ static const VMStateDescription vmstate_ps2_keyboard = { VMSTATE_STRUCT(common, PS2KbdState, 0, vmstate_ps2_common, PS2State), 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 = (const VMStateDescription*[]) { + .subsections = (const VMStateDescription * []) { &vmstate_ps2_keyboard_ledstate, &vmstate_ps2_keyboard_need_high_bit, &vmstate_ps2_keyboard_cqueue, From patchwork Sun May 22 18:17:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634298 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=PoftS8Xz; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5pgK6K6bz9sG2 for ; Mon, 23 May 2022 04:21:00 +1000 (AEST) Received: from localhost ([::1]:48614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqCG-0006iM-Sr for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:20:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAV-0006gh-Vl; Sun, 22 May 2022 14:19:10 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47306) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAT-0003W9-OI; Sun, 22 May 2022 14:19:07 -0400 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=2bE7E2vhSGzWMKYL49t2npatEtQ4a6cIVgCbmSPVTSY=; b=PoftS8Xz2m7AGRWR2hCvrT4S+p bk3cCqH0lx2zitVt9K6CB4Dl2Cw8teoNE/onp6PIfPPkshege4c6i8s7zk1r7mUmmlND3VsKe2cev HajctqYXFI+y00Mfx2tDWf3SHtHMaK4ESugXHNg5wFgbQJzyKmEPESkCkTefi7EN537PmNC3Q/IT6 c0Da4CwxKdsKgg/fqQLvdAsOHZS4BtrN8mGc6HEMDrS74TL06HYYC+B9QSXj/L/TvqoujEfYGGsUK z3f5yV1RFziO7GdZkUNNGMj0b2smXS6V3GGn1bH/wdxGbbkyWrx9mtJ+gKyG/zZpYcRYgoTrSh0/3 7zX2baqwym4XCytAosoBVnV74T4E6fPLbm0Xy8gAuVO7/b2xo2eN/O26fU9KQjm6uovsqKM4p2ggp 6y4DQux7arrr88cHZ96qNC7lF2R8CHCpv6NC8XFqb2RUgY1La6tll4NTWM6GO9LI1K5gStOPodHpN MtLJypndn2jPRfXbH2v+XpWFqCBJPftOmErASITdY4UjrJ6IaE+AIu3E5iiVEGdpB7n1/zp2Bapvo HmKnKw14IZpXxeneSGB34AE0fTzHzgqAEeCuVlXAbIQAGlqqEq1RWGKJbqE+JTcscNC61T4/xvU2Z Dp5jt8UaeXD/t3y0USYtWCPC5B8UbHUbrpUKGNW8Y=; 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 1nsq9I-0007pH-Pg; Sun, 22 May 2022 19:17:56 +0100 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: Sun, 22 May 2022 19:17:48 +0100 Message-Id: <20220522181836.864-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 02/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- 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 @@ #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; 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) + 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 = DEVICE_CLASS(klass); + + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); +} + +static const TypeInfo ps2_info = { + .name = TYPE_PS2_DEVICE, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(PS2State), + .class_init = ps2_class_init, + .abstract = true +}; + +static void ps2_register_types(void) +{ + type_register_static(&ps2_info); +} + +type_init(ps2_register_types) From patchwork Sun May 22 18:17:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634305 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=ps/P3+K5; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5pr52lVtz9sG2 for ; Mon, 23 May 2022 04:28:37 +1000 (AEST) Received: from localhost ([::1]:38180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqJf-0002v3-F4 for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:28:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAZ-0006hG-KT; Sun, 22 May 2022 14:19:11 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47344) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAX-0003Wb-HJ; Sun, 22 May 2022 14:19:11 -0400 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=/5Lx0219+npv2O7VZZp7mopRQWunbxBENdxlxrQmRBI=; b=ps/P3+K5HX/Bd51am67imBQVqk 7qGSQyxMdSLi4yZMisXJl0n16mCPhKNA4EREzlIU+/f/1rtgg+Hu9VeKBgnydBVQb/KcVmuMAmz5w fuWFPR9cOvqY2w91jPt4zqwVWg5BC9MldzqF/nZRh8lqyQsH+7Agn4QcshX3r/v4A2ESwVXJkhhfN Uy7Gc2GB+a+bt4L/xPEQ3epiXZkB/Mbw/47PzQ2v40O9mnn+BxynjQforFbCeLxznZCE0Z4LksFI9 8dIjDOu7f6ooF+k06cu7tEFJ0o9QnezpIREzwWx6kteZj2DZn0rR+d3slOzzg08Nx/gBOCjdqo9cH x8EK1/KH4nbx+PSakgdFz1dm5YpOSR69T5fi9iDqYRqr3OSd6S2EDXbqv3elRLKEaTh/5c81wkeXa GHl+PeODK186zUmb+JwjqnlOLb3RiKobRHFYdWc3jyqBkNHLcGxe13UeMUKZtw6xnlqOFjRtrEaB0 ZJ99ZVqzgaVbi5+tt+T9o0Ncn0oyCDhhDSap9DM8oqRDa5evK3dtdpK/oBIDYcIiv7cmfAB7LMmXe +WnoFl9ZCOsrwFUHLeIneo7jWRU+sjkAy27IyUap0PHxJIdlzkxoeyQ8tgBCRU9Y9Ew1ZQ9qQKF6U U3Du1yTnA/7vTTUxpiGSrnNjZTUuZUNrFyOG3cnhQ=; 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 1nsq9N-0007pH-52; Sun, 22 May 2022 19:18:01 +0100 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: Sun, 22 May 2022 19:17:49 +0100 Message-Id: <20220522181836.864-4-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 03/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make PS2KbdState into a new PS2_KBD_DEVICE QOM type which inherits from the abstract PS2_DEVICE type. Signed-off-by: Mark Cave-Ayland --- 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" #include "trace.h" @@ -108,15 +109,19 @@ struct PS2State { #define TYPE_PS2_DEVICE "ps2-device" OBJECT_DECLARE_SIMPLE_TYPE(PS2State, PS2_DEVICE) -typedef struct { - PS2State common; +struct PS2KbdState { + PS2State parent_obj; + int scan_enabled; int translate; int scancode_set; /* 1=XT, 2=AT, 3=PS/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) 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 = opaque; + PS2State *ps = PS2_DEVICE(s); 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 == 0xf0) { s->need_high_bit = 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 = 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); } } @@ -617,96 +623,99 @@ static void ps2_set_ledstate(PS2KbdState *s, int ledstate) static void ps2_reset_keyboard(PS2KbdState *s) { + PS2State *ps2 = PS2_DEVICE(s); + trace_ps2_reset_keyboard(s); s->scan_enabled = 1; s->scancode_set = 2; - ps2_reset_queue(&s->common); + ps2_reset_queue(ps2); ps2_set_ledstate(s, 0); } void ps2_write_keyboard(void *opaque, int val) { PS2KbdState *s = (PS2KbdState *)opaque; + PS2State *ps2 = PS2_DEVICE(s); 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 = 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 = val; - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); + ps2->write_cmd = val; + ps2_cqueue_1(ps2, KBD_REPLY_ACK); break; case KBD_CMD_RESET_DISABLE: ps2_reset_keyboard(s); s->scan_enabled = 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 = 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 = -1; + ps2_cqueue_1(ps2, KBD_REPLY_ACK); + ps2->write_cmd = -1; break; case KBD_CMD_SCANCODE: if (val == 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 >= 1 && val <= 3) { s->scancode_set = 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 = -1; + ps2->write_cmd = -1; break; case KBD_CMD_SET_LEDS: ps2_set_ledstate(s, val); - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); - s->common.write_cmd = -1; + ps2_cqueue_1(ps2, KBD_REPLY_ACK); + ps2->write_cmd = -1; break; case KBD_CMD_SET_RATE: - ps2_cqueue_1(&s->common, KBD_REPLY_ACK); - s->common.write_cmd = -1; + ps2_cqueue_1(ps2, KBD_REPLY_ACK); + ps2->write_cmd = -1; break; } } @@ -1075,9 +1084,10 @@ static void ps2_common_post_load(PS2State *s) static void ps2_kbd_reset(void *opaque) { PS2KbdState *s = (PS2KbdState *) opaque; + PS2State *ps2 = PS2_DEVICE(s); trace_ps2_kbd_reset(opaque); - ps2_common_reset(&s->common); + ps2_common_reset(ps2); s->scan_enabled = 1; s->translate = 0; s->scancode_set = 2; @@ -1164,15 +1174,16 @@ static const VMStateDescription vmstate_ps2_keyboard_need_high_bit = { static bool ps2_keyboard_cqueue_needed(void *opaque) { PS2KbdState *s = opaque; + PS2State *ps2 = PS2_DEVICE(s); - return s->common.queue.cwptr != -1; /* the queue is mostly empty */ + return ps2->queue.cwptr != -1; /* the queue is mostly empty */ } static const VMStateDescription vmstate_ps2_keyboard_cqueue = { .name = "ps2kbd/command_reply_queue", .needed = ps2_keyboard_cqueue_needed, .fields = (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 = { static int ps2_kbd_post_load(void *opaque, int version_id) { PS2KbdState *s = (PS2KbdState *)opaque; - PS2State *ps2 = &s->common; + PS2State *ps2 = PS2_DEVICE(s); if (version_id == 2) { s->scancode_set = 2; @@ -1197,7 +1208,8 @@ static const VMStateDescription vmstate_ps2_keyboard = { .minimum_version_id = 2, .post_load = ps2_kbd_post_load, .fields = (VMStateField[]) { - VMSTATE_STRUCT(common, PS2KbdState, 0, vmstate_ps2_common, PS2State), + 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 = { void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) { - PS2KbdState *s = g_new0(PS2KbdState, 1); + DeviceState *dev; + PS2KbdState *s; + PS2State *ps2; + + dev = qdev_new(TYPE_PS2_KBD_DEVICE); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + s = PS2_KBD_DEVICE(dev); + ps2 = PS2_DEVICE(s); trace_ps2_kbd_init(s); - s->common.update_irq = update_irq; - s->common.update_arg = update_arg; + ps2->update_irq = update_irq; + ps2->update_arg = update_arg; s->scancode_set = 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; } +static const TypeInfo ps2_kbd_info = { + .name = TYPE_PS2_KBD_DEVICE, + .parent = TYPE_PS2_DEVICE, + .instance_size = sizeof(PS2KbdState), +}; + static void ps2_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -1302,6 +1327,7 @@ static const TypeInfo ps2_info = { static void ps2_register_types(void) { type_register_static(&ps2_info); + type_register_static(&ps2_kbd_info); } type_init(ps2_register_types) From patchwork Sun May 22 18:17:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634302 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=xss1StWQ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5ply2kqfz9sG2 for ; Mon, 23 May 2022 04:25:02 +1000 (AEST) Received: from localhost ([::1]:59644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqGC-0006Ff-A6 for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:25:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAd-0006l2-7w; Sun, 22 May 2022 14:19:15 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47374) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAb-0003Wt-9r; Sun, 22 May 2022 14:19:14 -0400 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=A8/sp7TtS+OgT0coauW1+D9KP8GaHCANfGwt+XEJsNI=; b=xss1StWQvD033BBzk2FRcGRi1y gkYjwvsS+xPZNfWGqopsHEN0L6NfEbBJxnasQmBJ1K5JhRCSrjpyOuQUoeO22q9bBj5xG5ZQ823HY UCyf4eIe/kH0+cxpsP8eGMmfing4qOf36o955TAhg7uoJPD6TTfxkgowxcIhP4nkHPUqbDv8BMJIH wKAgXjL4KCF4PXGz/n8RZFLHJZeeppgE6S5B/GPLGgCPNfu7+o2wybg+sSfl8w6weuP7zpRIJGdeM BTfBLsWdtLu7sRB5D1DFBXnw8LIyMhlUuAr0GvyEGA00h189CZiu1SCKZ6e0dF5C+uHYYBWn1kMKn 2gjjhcq/ByoXVKjauxMUGBq44FrStmi5Txw/1HBVFqPUpVHH56+foS6iVfGl9DJ5t8wIKDDtUGlEo uJpK6K6mSkEiIbu2o/5e8NxvhBCFNSLlHuaF7nARjRGt4tNhikH+r/ogHe5UC/ogVK9HEKp4xMTRT jHWiOOZH3KDByShIqBPyJjfHyL25xz4awUXr9V8smKjms+5hmLcxKFdhx8hnaU+1ta/7vd+pSXLT5 R0m3qGMS4oDvqSuFvEFrnYQUo1voQJRz2RaVKIyKGKHZkgnX2uLVLq+SMVdjMBxwwGsc9WvbqALEf +8iJsA0ra4u0vR/IvV0RCHmhDTkR2A2QaeSXRR+b8=; 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 1nsq9R-0007pH-GH; Sun, 22 May 2022 19:18:05 +0100 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: Sun, 22 May 2022 19:17:50 +0100 Message-Id: <20220522181836.864-5-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 04/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make PS2MouseState into a new PS2_MOUSE_DEVICE QOM type which inherits from the abstract PS2_DEVICE type. Signed-off-by: Mark Cave-Ayland --- 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) -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) static uint8_t translate_table[256] = { 0xff, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x3c, 0x58, @@ -735,12 +739,13 @@ void ps2_keyboard_set_translation(void *opaque, int mode) static int ps2_mouse_send_packet(PS2MouseState *s) { + PS2State *ps2 = PS2_DEVICE(s); /* IMPS/2 and IMEX send 4 bytes, PS2 sends 3 bytes */ const int needed = s->mouse_type ? 4 : 3; unsigned int b; int dx1, dy1, dz1, dw1; - if (PS2_QUEUE_SIZE - s->common.queue.count < needed) { + if (PS2_QUEUE_SIZE - ps2->queue.count < needed) { return 0; } @@ -760,9 +765,9 @@ static int ps2_mouse_send_packet(PS2MouseState *s) dy1 = -127; } b = 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 = -127; } - ps2_queue_noirq(&s->common, dz1 & 0xff); + ps2_queue_noirq(ps2, dz1 & 0xff); s->mouse_dz -= dz1; s->mouse_dw = 0; break; @@ -812,11 +817,11 @@ static int ps2_mouse_send_packet(PS2MouseState *s) b = (dz1 & 0x0f) | ((s->mouse_buttons & 0x18) << 1); s->mouse_dz -= dz1; } - ps2_queue_noirq(&s->common, b); + ps2_queue_noirq(ps2, b); break; } - ps2_raise_irq(&s->common); + ps2_raise_irq(ps2); 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 = (PS2MouseState *)opaque; + PS2State *ps2 = PS2_DEVICE(s); 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 == AUX_RESET_WRAP) { s->mouse_wrap = 0; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); return; } else if (val != AUX_RESET) { - ps2_queue(&s->common, val); + ps2_queue(ps2, val); return; } } switch (val) { case AUX_SET_SCALE11: s->mouse_status &= ~MOUSE_STATUS_SCALE21; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_SET_SCALE21: s->mouse_status |= MOUSE_STATUS_SCALE21; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_SET_STREAM: s->mouse_status &= ~MOUSE_STATUS_REMOTE; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_SET_WRAP: s->mouse_wrap = 1; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_SET_REMOTE: s->mouse_status |= 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 = val; - ps2_queue(&s->common, AUX_ACK); + ps2->write_cmd = 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 |= MOUSE_STATUS_ENABLED; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_DISABLE_DEV: s->mouse_status &= ~MOUSE_STATUS_ENABLED; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_SET_DEFAULT: s->mouse_sample_rate = 100; s->mouse_resolution = 2; s->mouse_status = 0; - ps2_queue(&s->common, AUX_ACK); + ps2_queue(ps2, AUX_ACK); break; case AUX_RESET: s->mouse_sample_rate = 100; s->mouse_resolution = 2; s->mouse_status = 0; s->mouse_type = 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 = 0; break; } - ps2_queue(&s->common, AUX_ACK); - s->common.write_cmd = -1; + ps2_queue(ps2, AUX_ACK); + ps2->write_cmd = -1; break; case AUX_SET_RES: s->mouse_resolution = val; - ps2_queue(&s->common, AUX_ACK); - s->common.write_cmd = -1; + ps2_queue(ps2, AUX_ACK); + ps2->write_cmd = -1; break; } } @@ -1097,9 +1103,10 @@ static void ps2_kbd_reset(void *opaque) static void ps2_mouse_reset(void *opaque) { PS2MouseState *s = (PS2MouseState *) opaque; + PS2State *ps2 = PS2_DEVICE(s); trace_ps2_mouse_reset(opaque); - ps2_common_reset(&s->common); + ps2_common_reset(ps2); s->mouse_status = 0; s->mouse_resolution = 0; s->mouse_sample_rate = 0; @@ -1226,7 +1233,7 @@ static const VMStateDescription vmstate_ps2_keyboard = { static int ps2_mouse_post_load(void *opaque, int version_id) { PS2MouseState *s = (PS2MouseState *)opaque; - PS2State *ps2 = &s->common; + PS2State *ps2 = PS2_DEVICE(s); ps2_common_post_load(ps2); @@ -1239,7 +1246,8 @@ static const VMStateDescription vmstate_ps2_mouse = { .minimum_version_id = 2, .post_load = ps2_mouse_post_load, .fields = (VMStateField[]) { - VMSTATE_STRUCT(common, PS2MouseState, 0, vmstate_ps2_common, PS2State), + 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 = { void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) { - PS2MouseState *s = g_new0(PS2MouseState, 1); + DeviceState *dev; + PS2MouseState *s; + PS2State *ps2; + + dev = qdev_new(TYPE_PS2_MOUSE_DEVICE); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + s = PS2_MOUSE_DEVICE(dev); + ps2 = PS2_DEVICE(s); trace_ps2_mouse_init(s); - s->common.update_irq = update_irq; - s->common.update_arg = update_arg; + ps2->update_irq = update_irq; + ps2->update_arg = 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 = { .instance_size = sizeof(PS2KbdState), }; +static const TypeInfo ps2_mouse_info = { + .name = TYPE_PS2_MOUSE_DEVICE, + .parent = TYPE_PS2_DEVICE, + .instance_size = sizeof(PS2MouseState), +}; + static void ps2_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = 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); } type_init(ps2_register_types) From patchwork Sun May 22 18:17:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634303 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=qYMwUVtI; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5pnV5949z9sG2 for ; Mon, 23 May 2022 04:26:21 +1000 (AEST) Received: from localhost ([::1]:33978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqHS-0007ue-4Z for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:26:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAf-0006nS-Ug; Sun, 22 May 2022 14:19:18 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47394) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAd-0003X1-AO; Sun, 22 May 2022 14:19:17 -0400 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=EeuwzG3aOL0CUSEm17zrFZyfOYglQ0a9gysDOU1lNP8=; b=qYMwUVtI6wcg1616LC+xFRT/Hp q1Eb2IG5kS+Mn7r4ZIxU1GfDNrH9Oztcxjy2AUrJTU1f9vlue75UJMTV2J/xHa/jRFbyrj1JhQ0S4 u0GEJXoiAsHsVhbsOkTEutf6BQiKaa4Ud1nhO0w1HMVMaViShhz33oepPPFK53UrniwCzms7cnC3n cZLMihTfhEgww2piI1NSPzswJU0BhUlHdL2+EI3Hl1m3qUq79PCemk/yA8PJiNpbytkZGgqLrvAgU HtoCPUJtXgsw9Sq4usDxH4TDRZGPVh5ht8soQeyKz63mQsoydlc8dR5RuOCJM1Np/ie+wRTeqb8rP BDxBZwyqIR/dLFn7TwvdyCkIEGQ8e6YrFsU3UbYEMs/jc8PTulPgKSNC9CdQGN208MbG3sBA+FSiV sFXq22xmrBmVfEqbclslrmPNsPWbe2iAWKO4/P6GoHa3HJ2FSZwtbEBZTU5CQdGJUEVRAGi47JFwy N65oAp1CGohrJBTzmFSFhVYmUq9r/n1uHwAFsfrIYZ5XwcCSfZbjQfKhRULL3MJkEyy1O8dLXhHg0 XquivYn4j5xmHuT4LBKbRovHk0zpS+5ihXdS0SkP4LevcW/mPb3EC2bMrkkpcczYiZZKTZiCeIwbr pZiy3//5CL0jUrpKsexkGADt/DImahOcUBzW9f9RY=; 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 1nsq9V-0007pH-Rz; Sun, 22 May 2022 19:18:06 +0100 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: Sun, 22 May 2022 19:17:51 +0100 Message-Id: <20220522181836.864-6-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 05/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move the QOM type definitions into the ps2.h header file to allow the new QOM types to be used by other devices. Signed-off-by: Mark Cave-Ayland --- 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 -/* - * 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 */ @@ -92,56 +87,6 @@ #define MOD_SHIFT_R (1 << 4) #define MOD_ALT_R (1 << 5) -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=XT, 2=AT, 3=PS/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 = PS2, 3 = IMPS/2, 4 = 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] = { 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 +#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 -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=XT, 2=AT, 3=PS/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 = PS2, 3 = IMPS/2, 4 = 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) /* ps2.c */ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg); From patchwork Sun May 22 18:17:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634308 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=Km7Kn9/S; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5pxx4q7Vz9sG2 for ; Mon, 23 May 2022 04:33:41 +1000 (AEST) Received: from localhost ([::1]:48470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqOZ-0001vq-On for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:33:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAf-0006nQ-Td; Sun, 22 May 2022 14:19:18 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47390) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAd-0003Wz-7z; Sun, 22 May 2022 14:19:17 -0400 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=RuPoPe8DnX9QMlugXse1vui/tj77KN5fr2keNVGuvVQ=; b=Km7Kn9/SHgbTOqWLs6JuvhVaYX K95lQklyY8aOthqH/t6SkyzlRGeoRZTwfrTN5WSMuPYgp7FdCGTVh3CIWj+pwnKWa4K8ujzNHIcXi hIRHQh3hVy/IeRApzG3IkeSTcU0FFznkJIOijAXDOwzDzKwDdH+z+Odqno5agy3Z8NfKilWvnc0Eu zuGjlYdQ9kizxVPLaDr5IiCdYvTEskBF56TIPggZa9X/bwMLa5mcQxyl32YOZo9oVPlyWuSwRB3GJ R+doAqq13aXmbfDfzCeDj2bpa9tKvIwzN4DpghbmHKrmZA7TYTLG5a3UTT/4L1ytTHYcQ7n2eEhbd 63lFAEEN+fUiHZzrre8TcRvk+OGW2d/KpMnTo70NvRCzUCufnO477/fZ4UVFcdIzgDzIjrMPZ+Njn yPIk5F5+OihgvRP2v9YXf2zFPyYoVU3uGFCL1RI2xwcXodfuwEO15EbiyJkI03XYA7Jg0mf9tEVfr qKbU5gENcWgCaRGnOCSzk+paTLHWefLsVgfLkPai9HK6wnCSaMWMdz57WHjSpfUu8+Yl5HuOvVjhG Phi/lLWwVxqnZf9VJ24IuZF9zXshYdedXhb0uENpx21Rd/okEvwcqfeAgM5n4P2thdBfzqbOVVAnZ vegVn8yAVTi3F4xFXxAZHUSFAgoGJtu+deh5WBTm8=; 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 1nsq9W-0007pH-C1; Sun, 22 May 2022 19:18:06 +0100 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: Sun, 22 May 2022 19:17:52 +0100 Message-Id: <20220522181836.864-7-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 06/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- 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); } -void ps2_write_keyboard(void *opaque, int val) +void ps2_write_keyboard(PS2KbdState *s, int val) { - PS2KbdState *s = (PS2KbdState *)opaque; PS2State *ps2 = PS2_DEVICE(s); - 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 = translated scancodes (used by qemu internally). */ -void ps2_keyboard_set_translation(void *opaque, int mode) +void ps2_keyboard_set_translation(PS2KbdState *s, int mode) { - PS2KbdState *s = (PS2KbdState *)opaque; - trace_ps2_keyboard_set_translation(opaque, mode); + trace_ps2_keyboard_set_translation(s, mode); s->translate = mode; } @@ -857,20 +855,18 @@ static void ps2_mouse_sync(DeviceState *dev) } } -void ps2_mouse_fake_event(void *opaque) +void ps2_mouse_fake_event(PS2MouseState *s) { - PS2MouseState *s = 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)); } -void ps2_write_mouse(void *opaque, int val) +void ps2_write_mouse(PS2MouseState *s, int val) { - PS2MouseState *s = (PS2MouseState *)opaque; PS2State *ps2 = PS2_DEVICE(s); - 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_DEVICE) /* 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); #endif /* HW_PS2_H */ From patchwork Sun May 22 18:17:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634310 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=nMyxJ5Rh; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5q1v6v7pz9sGH for ; Mon, 23 May 2022 04:37:06 +1000 (AEST) Received: from localhost ([::1]:57070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqRr-0008HJ-TH for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:37:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAk-0006oD-D9; Sun, 22 May 2022 14:19:22 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47404) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAf-0003XG-TK; Sun, 22 May 2022 14:19:19 -0400 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=je3lDS41Aa2q6ws8CdoU2eWSveN8fY5JhhbQYGiKCeQ=; b=nMyxJ5RhRHcl+7ICcnGB12aUba hq2pLX6XAjqQ+ey8fdtNU71jqLivJIE+O6LkmCJK6+qpOo+K7ldRLQvwjwVWrSMEWuor9dOnJIoXm kQ08vb2XwF3E4ZL0zWSLOMYu1eM2xq7c3BUFpyUOt+zgVF2VnReomZQEYb9Jhnsxp1r4dZWOwqXwh fzpcboVBr5iRwONIzQm1EKzcCjAgt8Z13LgTRv24ukF5rG6MST3U/mUlkymkFN9CrSeZJNlwEwUth /+NXumJPw/KYdsJXsqMX+7r/9zFz2GYhu8sy3h+Wlx176XyIW9U02EyHEIkoxfsklHHk+U6i3Cuyl OL8FrEYCmvVpwPUJynOF2HJJJf6v83eVaq8RBMJZpL0SoUL+tHwMFJqiA0u1R1YMaVZcylGLCYNYj MB+lUnnjJcv6GkOG+B2ZBvOAmZ28uZjDbN790/TnQlhkLNfiHxTjQcKj2kODZhv0P6kH2b+QlAcDJ JEeSzUcuUra/4JugXJVqcU5K+hZW9vbPJNxa92K6+tBjHxZXsI6Oj9PVdUrvQGWtV/c5Oqk11nzK8 doSI4q5M9dC/UAuJhxdjXWuKMEW2mQ8HpBDAi6ewgYNRPNr9k89Vp1BgZBIls/XMQOpZ2T/oYqTQo QXdH2QA+eh7tE7DXdm5/4llOc+1+JpT2gltDa5UOo=; 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 1nsq9W-0007pH-SV; Sun, 22 May 2022 19:18:11 +0100 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: Sun, 22 May 2022 19:17:53 +0100 Message-Id: <20220522181836.864-8-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 07/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This is in preparation for allowing the new PS2_KBD_DEVICE and PS2_MOUSE_DEVICE QOM types to reference the parent PS2_DEVICE device reset() function. Signed-off-by: Mark Cave-Ayland --- include/hw/input/ps2.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 1a3321d77e..0493b78812 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 +struct PS2DeviceClass { + DeviceClass parent_class; +}; + /* * PS/2 buffer size. Keep 256 bytes for compatibility with * older QEMU versions. @@ -54,7 +58,7 @@ struct PS2State { }; #define TYPE_PS2_DEVICE "ps2-device" -OBJECT_DECLARE_SIMPLE_TYPE(PS2State, PS2_DEVICE) +OBJECT_DECLARE_TYPE(PS2State, PS2DeviceClass, PS2_DEVICE) struct PS2KbdState { PS2State parent_obj; From patchwork Sun May 22 18:17:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634315 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=NpYzxKhw; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5q7r4LJ3z9sG2 for ; Mon, 23 May 2022 04:42:15 +1000 (AEST) Received: from localhost ([::1]:38228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqWm-0006IO-Os for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:42:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAm-0006px-6M; Sun, 22 May 2022 14:19:24 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAk-0003XJ-Et; Sun, 22 May 2022 14:19:23 -0400 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=zLE66DdlmGT6YsVkLhsiFf/Fxn8Oc3TVtMPzp+lJT5g=; b=NpYzxKhw0F3yvNqWhNmoFzWOoV aAHT3oPfzg/00dITVTAlPkMrrXHV+NiNhUpt+C7RVAtrzMs7WC2nf99qqDfhSXDXid4XyZixq4QX0 sw/r3FY93+J4uej2YcfpNEeDT8qYxLx2loOfZFyl6rFpU63+c44x4jXOUp6tFq7777xtSLQf8Npd/ f8QQVofzRcM2frRji5x9C3scL4H/D3o4QTyRs5owWoctuEf+kYZhsfPHVkMDRPEcvxpGu8VWNZx2z iYDDXySNdGwvcoltuefBP/PRhZemSld1t7IwP4BuC1Lv+H3pHLniVFkTisjVTJrOgQ1b6HZjoCHYN YQX8UNU0A8hBbRr4BH6tfDxqA5PMjyJIdpiYWSntoJLQNwr1HTBTRijusNEJzml49Wid+X4F96JVB o5NAonWNuPy7lkqWqiuHpKnwYfQmqIBXH3nJ2Sz2+MZ7LkZ69aRsAFs76mVh4p04JoTYCQ0xbn1to Xdvdisyinaabi6bJizaNhFA3f8IW22xNPYYz3LQC24334hi6O8let8ySvsFIc0liK/dzJ1lEPSdJe ATpjyHXyjy+B9HDenvmt7R7YBjUQ+Pp1hAnw9bJ7o/wf8jhgcN7vnOjLH42GD07ej0mjB/47RB7n6 mGXiOxEjXPXxz0Er4fWXFqE9a6SjfTZ1RjOtvmHao=; 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 1nsq9b-0007pH-78; Sun, 22 May 2022 19:18:11 +0100 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: Sun, 22 May 2022 19:17:54 +0100 Message-Id: <20220522181836.864-9-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 08/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 the 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 --- 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 3a770f3b78..5990eb6f79 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -995,8 +995,10 @@ void ps2_write_mouse(PS2MouseState *s, int val) } } -static void ps2_common_reset(PS2State *s) +static void ps2_reset(DeviceState *dev) { + PS2State *s = PS2_DEVICE(dev); + s->write_cmd = -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 = ccount ? (q->rptr + ccount) & (PS2_BUFFER_SIZE - 1) : -1; } -static void ps2_kbd_reset(void *opaque) +static void ps2_kbd_reset(DeviceState *dev) { - PS2KbdState *s = (PS2KbdState *) opaque; - PS2State *ps2 = PS2_DEVICE(s); + PS2DeviceClass *ps2dc = PS2_DEVICE_GET_CLASS(dev); + PS2KbdState *s = PS2_KBD_DEVICE(dev); + + trace_ps2_kbd_reset(s); + ps2dc->parent_reset(dev); - trace_ps2_kbd_reset(opaque); - ps2_common_reset(ps2); s->scan_enabled = 1; s->translate = 0; s->scancode_set = 2; s->modifiers = 0; } -static void ps2_mouse_reset(void *opaque) +static void ps2_mouse_reset(DeviceState *dev) { - PS2MouseState *s = (PS2MouseState *) opaque; - PS2State *ps2 = PS2_DEVICE(s); + PS2DeviceClass *ps2dc = PS2_DEVICE_GET_CLASS(dev); + PS2MouseState *s = PS2_MOUSE_DEVICE(dev); + + trace_ps2_mouse_reset(s); + ps2dc->parent_reset(dev); - trace_ps2_mouse_reset(opaque); - ps2_common_reset(ps2); s->mouse_status = 0; s->mouse_resolution = 0; s->mouse_sample_rate = 0; @@ -1227,7 +1231,6 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *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; } @@ -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; } +static void ps2_kbd_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + PS2DeviceClass *ps2dc = PS2_DEVICE_CLASS(klass); + + device_class_set_parent_reset(dc, ps2_kbd_reset, &ps2dc->parent_reset); +} + static const TypeInfo ps2_kbd_info = { .name = TYPE_PS2_KBD_DEVICE, .parent = TYPE_PS2_DEVICE, .instance_size = sizeof(PS2KbdState), + .class_init = ps2_kbd_class_init }; +static void ps2_mouse_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + PS2DeviceClass *ps2dc = PS2_DEVICE_CLASS(klass); + + device_class_set_parent_reset(dc, ps2_mouse_reset, + &ps2dc->parent_reset); +} + static const TypeInfo ps2_mouse_info = { .name = TYPE_PS2_MOUSE_DEVICE, .parent = TYPE_PS2_DEVICE, .instance_size = sizeof(PS2MouseState), + .class_init = ps2_mouse_class_init }; static void ps2_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + dc->reset = ps2_reset; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 0493b78812..4e8de912c6 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -35,6 +35,8 @@ struct PS2DeviceClass { DeviceClass parent_class; + + DeviceReset parent_reset; }; /* From patchwork Sun May 22 18:17:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634300 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=cTLE71MQ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5php57xMz9sG2 for ; Mon, 23 May 2022 04:22:18 +1000 (AEST) Received: from localhost ([::1]:52178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqDY-0001H7-PM for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:22:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAq-0006u6-VZ; Sun, 22 May 2022 14:19:32 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47458) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAm-0003Z3-7O; Sun, 22 May 2022 14:19:28 -0400 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=8Fwx/I/vPtmESsSn7/kCagHh78QfUAB1qwIAGxuaxGA=; b=cTLE71MQdd7TKJagptoK6mdTih tT8WuDy1W1+P/jY/CfHN21kCDhCGgySuS1b1ZhQYL4KXsZhJmZ+pxJiV0LajQ3M49/3rLitmnxOg1 zjc2vFwEsUqfo6CtrvCfgRe4ftafHzNKBKV9fUhlHwVeVPG4lLZ3lb8+oaGGqQ7ShERSQj3TxWMUN SCpaFTg29ppK9WW409e8lApx/4vD/D2v5NDyG47J2mzTLhnPB2JYMLZZjHzOcDdg20QDzDhOIk/ql h9bvc6zNqNpCw9wlCbH5LuqxDLKjzzCfV2+zMRtmre/o/+cNSCvFoCrZvcRw5fiHuC2CepEypSpV+ 4Ib9FdbiBM6QJFfmsmrYszBvlCAtoULfO+41m3dhqzYdpB6KGvvSBgcIy3QYaIMyZF/afzuyJYxen u4PMxzOacCP6DxPAWFVYylKRGFQ65LqTqnnOkvtZgy3t8s+VluzrB+/tZ8MaDeSz95CvDibtAfPrw /W2tOXfgpvLVmNWFicTrVMV/0ULNbrvNJUYkNA2bbbmGpgD6FMaAb00Wttw892yFh6jCx8FZia48X 1+Zi8/N9FFTiFPYDhy6gugUdjjNbFI8Xvj5onMJEOYfSETI+996DLpLfRaA4mrwGitTsA73Pvlpfh j/i0t+YUrL7Kx1/KO6hSHMiCAy4LuoTiK+K//FQV0=; 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 1nsq9b-0007pH-R1; Sun, 22 May 2022 19:18:16 +0100 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: Sun, 22 May 2022 19:17:55 +0100 Message-Id: <20220522181836.864-10-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 09/50] 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 client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The default value for scancode_set is already set in ps2_reset() so there is no need to duplicate this in ps2_kbd_init(). Signed-off-by: Mark Cave-Ayland --- hw/input/ps2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 5990eb6f79..555abb5392 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1227,7 +1227,6 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) trace_ps2_kbd_init(s); ps2->update_irq = update_irq; ps2->update_arg = update_arg; - s->scancode_set = 2; vmstate_register(NULL, 0, &vmstate_ps2_keyboard, s); qemu_input_handler_register((DeviceState *)s, &ps2_keyboard_handler); From patchwork Sun May 22 18:17:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634307 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=YE0abgVb; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5pvw4KKvz9sG2 for ; Mon, 23 May 2022 04:31:55 +1000 (AEST) Received: from localhost ([::1]:43788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqMp-00071U-Vi for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:31:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAq-0006u2-JA; Sun, 22 May 2022 14:19:32 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47498) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAp-0003ZM-5w; Sun, 22 May 2022 14:19:28 -0400 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=4Rn7s6j/2/PqPyRoJlkfv/QncADpDni4z9RRy5nqK1c=; b=YE0abgVbw3MLE9LwW3U9i/b3Ks V1UD7YV7G8Y+bhKWChfg4cshrnCdyYnHUuY4nQZ8Ma5wtPizOx/cMU+FLBEHF/4cUjYG94uJnKnVb MWzWT4LvB4TzEWBj01fAigT7bIxP1udQv29hQ/3KzVxb4+krRBoOK1KAVhRZE77kIDxmi5vroRAK2 2pUMMYnBiv1W4EBH5R2pINkTBIXR+hzPtJRYuBg0Vrc/6WaXaEP4YYz0N4AbcHKa2b83JbU4kSQP2 xeO1chcuijTXnOzebIzixU7zQx7YDbz1VlLpat0bMpvMGFDcYtTaT2c+8TBfRDztdvPilDcjLkQ8Q r2BGKxWgYI6PVfslozt74H9TF/L5nuk+0GjsiiQRcIVkx1zRE8YqosWqQtUlr8m7RXLIA9Z1/sQ2a Tf9KbyrhOz9x4KQV4f0LVEPRsIwO1ez1T1t9AUavPzHE+Ku9xZakvaCPaShhY/Nu3xdXtAOn/HhJA zLs9tkiH6ffLKlc6Z/Ax2Urq6vBdxHv1gpTbupMA0GAO3GphCS5Kox0krjHWcG82KdS8wJKpO7MYf ns4hoW7tqo6/Ttft1v4WGdvJKZmwvunjN0+Z5DsvbaVHcyO+k28YXmcKIQSg2ZJhSKx0F/RBdUj4k GxDBD4dwMC72QIT7maRV2UeiYQ/Gjo6+dFswX3sCI=; 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 1nsq9g-0007pH-6e; Sun, 22 May 2022 19:18:20 +0100 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: Sun, 22 May 2022 19:17:56 +0100 Message-Id: <20220522181836.864-11-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 10/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 doesn'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 --- 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 555abb5392..2abd6510ab 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1213,6 +1213,11 @@ static QemuInputHandler ps2_keyboard_handler = { .event = ps2_keyboard_event, }; +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), void *update_arg) ps2->update_irq = update_irq; ps2->update_arg = update_arg; vmstate_register(NULL, 0, &vmstate_ps2_keyboard, s); - qemu_input_handler_register((DeviceState *)s, - &ps2_keyboard_handler); + return s; } @@ -1265,6 +1269,7 @@ static void ps2_kbd_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); PS2DeviceClass *ps2dc = PS2_DEVICE_CLASS(klass); + dc->realize = ps2_kbd_realize; device_class_set_parent_reset(dc, ps2_kbd_reset, &ps2dc->parent_reset); } From patchwork Sun May 22 18:17:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634312 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=W4ENus2P; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5q2D3sTTz9sG2 for ; Mon, 23 May 2022 04:37:24 +1000 (AEST) Received: from localhost ([::1]:58464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqSA-0000nl-Ji for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:37:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBC-0007ST-Cd; Sun, 22 May 2022 14:19:50 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47516) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBA-0003Za-S0; Sun, 22 May 2022 14:19:50 -0400 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=7+omfs4P1N7MKohv7RCdWVxPT7B+mUaP60iTQaTpTrM=; b=W4ENus2PeUNQrfeRdHmkRcrEwB C1lgjBARK6eYVhZ8xSv3nnH66xAZvzIGB1i/YvZ7FGZa3lXzvSsUyl5OhYbRRhL5ZE3yxVkPhlLOX YqaYHG9OfpYmSjc06ydGUMh3DMAeM5Nd2yOJAdiNXheX9ImN23TClhb2HK6ORf1zowuwxsJCh+dID pEZ6QQCNHxRLuVhLYJJn1h5NRfkgII/icyaWrKJondMoAgGhq/8hWtJJB0e6GJauwA8T0Cn9VI42q TLuUXXwTX8sTF4VyfhGajL78vqoVAQtTwwfJKofkMBUrJDbZOnYLBdZW8RpFeY6sma6N88pBdBT8R GZAnv9PmLFGEk3tpCFqD7YRHT95CeW6CQxD3kfQLoTHAJxMSoegtfgqqp3W4vfAqoKgYLtheWtbPp slPjg5Mqd2/7WtUH4okmfQhnjw5vRARneUet/1mkVxhq1DsDC8glibX1x7a6FX9zSirN7luRoWWjv 0FW3RHM8UhLHQaBh1uF0lJvP7AM0wALW5WarnC+dE4SKdmKDssyMQEAsW6iGFjk6hf8MC0nKdhqFS aTb8ap6DH7IuMcoSzSToGfPFSUUCPFcBVphEK6krLY+uV0a6sU2iYRgaZOB16klzBP9vtL+Dmrlgz 8mr9SWRaQFh1aeTt8ZSDfN1A+njHmCs5UJkhabP6c=; 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 1nsq9k-0007pH-GE; Sun, 22 May 2022 19:18:20 +0100 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: Sun, 22 May 2022 19:17:57 +0100 Message-Id: <20220522181836.864-12-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 11/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 doesn'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 --- 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 2abd6510ab..1d223de59f 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1244,6 +1244,11 @@ static QemuInputHandler ps2_mouse_handler = { .sync = ps2_mouse_sync, }; +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 = update_irq; ps2->update_arg = update_arg; vmstate_register(NULL, 0, &vmstate_ps2_mouse, s); - qemu_input_handler_register((DeviceState *)s, - &ps2_mouse_handler); return s; } @@ -1285,6 +1288,7 @@ static void ps2_mouse_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); PS2DeviceClass *ps2dc = PS2_DEVICE_CLASS(klass); + dc->realize = ps2_mouse_realize; device_class_set_parent_reset(dc, ps2_mouse_reset, &ps2dc->parent_reset); } From patchwork Sun May 22 18:17:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634306 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=AgTEuPfy; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5pst2bVWz9sGH for ; Mon, 23 May 2022 04:30:10 +1000 (AEST) Received: from localhost ([::1]:41536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqLA-0005Tw-0R for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:30:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAv-0006uk-1U; Sun, 22 May 2022 14:19:33 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47510) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqAq-0003ZY-IN; Sun, 22 May 2022 14:19:29 -0400 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=3Nru0O6d8b5ve64QWJ+ZnYfsswh9BbWWpItYe9mXnFA=; b=AgTEuPfyZvNyXoLwSu3iLby5YM bRMfuGiAJhBaQL+0e9/+EzIyZgdC/Mt2ktBO7V7l9V5nrR8Y5sQtKHeQDdyW6+fkwUci8aR/o5EBW e5OPJHfO0MiBEDEJBuSCBcFmnFzMB3bw/Z51ew2GeHXxiKEOcUZVFL9oGKepiRhIBHQ8T43iOGeW+ t9zGR0C4AU5X0NS8hBsyqgL7s90hqK5PNpxn8EZjPkrO9GGr1VYujwtJRn8ONQ/qTsHQVoU7L52su KKqOlintxpROJ4+eNvEKjorQcYfJhhSn45uvCp0H/tQ4f8ryz+oqMHvWiMFcOOHJe1RnI5pGm4YyT n6158qSPqjDgOzU7Rv615uciZNKarefR0zT9zgmkJWdmHVAZl/6xXBpFGAh61yHyeOT8gES6QEMMc pGxOV9NRNc7cphXA8yqE9TFAUbCfjLCT3asazi5tEZulrSJm7C9sQNREwp+Z0U6X085q0CmwQe26H vCVZWfqDl0Rl6aBlIJKC+Kiy29knTg2xUcTxg63bGeA7bDz+na4owTf/+oTy5xpUj6yLtKQ/25/vY R5y72mcLhrRT+ZlODbI+0OuXDlHV+aDvGv4ZKlKCQzcIhzWYqZYMfWAr56/4Q1XeEPzem76anhB0b x9aZO3SkOCqfpK9l4/epAcKgMkmjI+rKmjj3JJFLY=; 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 1nsq9k-0007pH-St; Sun, 22 May 2022 19:18:21 +0100 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: Sun, 22 May 2022 19:17:58 +0100 Message-Id: <20220522181836.864-13-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 12/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since PS2_KBD_DEVICE is a qdev device then vmstate_ps2_keyboard can be registered using the DeviceClass vmsd field instead. There is no need to use qdev_set_legacy_instance_id() to ensure migration compatibility since the first 2 parameters to vmstate_register() are NULL and 0 respectively. Signed-off-by: Mark Cave-Ayland --- 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 1d223de59f..04360c7f74 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -1232,7 +1232,6 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) trace_ps2_kbd_init(s); ps2->update_irq = update_irq; ps2->update_arg = update_arg; - vmstate_register(NULL, 0, &vmstate_ps2_keyboard, s); return s; } @@ -1274,6 +1273,7 @@ static void ps2_kbd_class_init(ObjectClass *klass, void *data) dc->realize = ps2_kbd_realize; device_class_set_parent_reset(dc, ps2_kbd_reset, &ps2dc->parent_reset); + dc->vmsd = &vmstate_ps2_keyboard; } static const TypeInfo ps2_kbd_info = { From patchwork Sun May 22 18:17:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634311 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=NTmZ8VkB; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5q1v6dWnz9sG2 for ; Mon, 23 May 2022 04:37:06 +1000 (AEST) Received: from localhost ([::1]:56912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqRr-0008B6-GF for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:37:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBI-0007b5-83; Sun, 22 May 2022 14:19:56 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47530) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBF-0003Zx-34; Sun, 22 May 2022 14:19:55 -0400 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=EWNKZgKs7Hw9xnifwpxp3QQzYWeTAZiPICd9VkBsaUU=; b=NTmZ8VkBSfk9hoBrlT+qjrPRRd KDy5ldr+72e+xfWmm/LdW9p0EIadvxWERs959ONdpa1PYOp1aFC0Dwa1gUM78h0IGfD8IOZsg/crb EPSW3ImwSx5tXpro26rDIvO2+ZjaX3QSntbxCE1C+iIQU92ISSe+5W/hN8lE7NLPU/LUxhU4gQyRW MPVLQTTIyEzc7cZzerXKMnwpcrsPnrk7lWqQqOqPYBHUiA2eK0UVRvdobx2HNvYuNM3VEErne/gn0 V+z3Gi5ep4S6kgP7M6BCrVVlV+yiSP9wCaJq58qEq5ritKjhYC0z409dL84UV8ftZyFPwNIoxKwc8 cRk/jkG179h/s6c6iw237rkJrvI0WIJIeKTYXZMqZbU1ZV63lPAJz132/R8lJW11GMDkBmxjcdKet oeoap/PdtWGCKdchKT4TWO9ILVme4k18eyniCXlE8d0jAxujZVz0BloI4VpsFQFl7dyZwuh2bLdAm IfLbPQc5NATPfLybN1/iOW9hDnD33ooKK+cbPOuwEii+DzF1l+s0VWSpeWxNuRUbV+sulZan8o7Lz bG3TvYBXIHVr1vKtHqMwByuYcfBPQnuSv0MzL5ol5qZPcQfjDpdr6YHZrHl5G5Nd7XYM02f0vP8y/ EjV5CLK96xebpLPfx+MOv4KFNn9cU0vWCKgz0+AYw=; 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 1nsq9l-0007pH-8f; Sun, 22 May 2022 19:18:21 +0100 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: Sun, 22 May 2022 19:17:59 +0100 Message-Id: <20220522181836.864-14-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 13/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since PS2_MOUSE_DEVICE is a qdev device then vmstate_ps2_mouse can be registered using the DeviceClass vmsd field instead. There is no need to use qdev_set_legacy_instance_id() to ensure migration compatibility since the first 2 parameters to vmstate_register() are NULL and 0 respectively. Signed-off-by: Mark Cave-Ayland --- 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 04360c7f74..e3ee69870b 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 = update_irq; ps2->update_arg = update_arg; - vmstate_register(NULL, 0, &vmstate_ps2_mouse, s); return s; } @@ -1291,6 +1290,7 @@ static void ps2_mouse_class_init(ObjectClass *klass, void *data) dc->realize = ps2_mouse_realize; device_class_set_parent_reset(dc, ps2_mouse_reset, &ps2dc->parent_reset); + dc->vmsd = &vmstate_ps2_mouse; } static const TypeInfo ps2_mouse_info = { From patchwork Sun May 22 18:18:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634319 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=RzYcpPAh; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qF54J2rz9sG2 for ; Mon, 23 May 2022 04:46:49 +1000 (AEST) Received: from localhost ([::1]:46772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqbH-0003pI-Lf for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:46:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBH-0007VX-2E; Sun, 22 May 2022 14:19:55 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47520) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBB-0003Ze-7b; Sun, 22 May 2022 14:19:51 -0400 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=TZon0gdjzrbgysDsnUGI7Gse9qftzLFgsCYzySKFTlo=; b=RzYcpPAhGktSEdj41W/POypRYB fhMEGoJquKKNdV4RxdNclALyBh0H26ujU138eqQtVJUnvwd9AHVsNxAZH39K/JnuC7z5AN4ZntObH xCdeat/OWAMoi5OZF5nhPDI9xPv0qeFzV+1/whIOZa4gk4lbv6tyFRXa9Q6+smZRgVqrjiFcQ5ALK htq/bntByUSbQRsg+jjsXanE4LeaJPPZR1dR7u9ciD0IMSdCUnsZRQQDhSZ0jnbpEG5pf/fhjnwwg 7E4d7TBSYyP3pWDKfuUaEjZhgMhy8+4W3ygdcSKHb2WL57dVYECmwALgGs95uQVjRtZuAQgh5qCsR L+uqLvoezsMZF3W9zlONq9uWvBK5jMQ+Haaoe04OT6gufpJK1OhgzR2LdSJ0Q84uyEAIzSfDw9rXR mex0FTLdPW0lMjtPezHvutYGegk6EnBWtqtrwaGnZT3P2EDHgVQyV/oMGCY/cGfIJ39C6wGT+qIly X3QIelCh0ZK3mgruB0hC9IIsulL/8Q16v9tELSueY5b/sw31zOZ4pnscaW7pndH5gLxUtp/5kYH2Z haaXcEA2vT6pXDpTL+G+fG6P+TaqMR8+Y0QCvojoSG7ACdi2KfJ0uW+LXtRlFjF9YztAvLYZ2m+1P PFeKdToRCRxbtwV6+YCtJbavrV6Gan18+S89qqtOw=; 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 1nsq9l-0007pH-MN; Sun, 22 May 2022 19:18:22 +0100 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: Sun, 22 May 2022 19:18:00 +0100 Message-Id: <20220522181836.864-15-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 14/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This patch also includes a couple of minor spacing updates. Signed-off-by: Mark Cave-Ayland --- 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 = { #define PL050_KMIC (1 << 1) #define PL050_KMID (1 << 0) -static const unsigned char pl050_id[] = -{ 0x50, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 }; +static const unsigned char pl050_id[] = { + 0x50, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 +}; 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 = (PL050State *)opaque; - if (offset >= 0xfe0 && offset < 0x1000) + + if (offset >= 0xfe0 && offset < 0x1000) { return pl050_id[(offset - 0xfe0) >> 2]; + } switch (offset >> 2) { case 0: /* KMICR */ @@ -88,16 +91,19 @@ static uint64_t pl050_read(void *opaque, hwaddr offset, val = (val ^ (val >> 1)) & 1; stat = PL050_TXEMPTY; - if (val) + if (val) { stat |= PL050_RXPARITY; - if (s->pending) + } + if (s->pending) { stat |= PL050_RXFULL; + } return stat; } case 2: /* KMIDATA */ - if (s->pending) + if (s->pending) { s->last = 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 = (PL050State *)opaque; + switch (offset >> 2) { case 0: /* KMICR */ s->cr = value; From patchwork Sun May 22 18:18:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634316 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=0Uz5rur0; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5q8j4hzSz9sG2 for ; Mon, 23 May 2022 04:43:01 +1000 (AEST) Received: from localhost ([::1]:39964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqXb-0007Zz-NJ for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:42:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBI-0007bP-A4; Sun, 22 May 2022 14:19:56 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47536) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBF-0003a1-33; Sun, 22 May 2022 14:19:56 -0400 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=99ZsLsVSKZKYLmNzVWibXfl0svDvqCK/Kq9Rs95rMvU=; b=0Uz5rur0aiLC6yAwrMZrLrF97A mTuEdE8NZg6UVnyVZT3o1wfuYJYgd1nIPv0yaSsB30ns/GlodMhQhsqPcp0FUk8a1DFNP/YB/3BGX wo8zfkJeEyPiLIZsi1n0u+NuhQkWVa6cwU7ilCd3vdx/iL/K/eu6wLGtdeLeyo3auCbnHwAitxd2n fUvE6eokB9T8Rk8xChsJGnHMWXeV36od9G8ICAgKWHdZiFMxmNot9mzH8vMjxT4r13VtKGr3+DbSw j0pvEb7nOvL6TDvo4hEQDArmx1SvSpnfHOEQva8yvblbA/7o1bTJABKpkDiQIeS/OI2tDJZR6cZLT NaDwkjXVxiddTcK/gFKetE0mhahzblcLr0xh+lwUd3vn5HrQSV4byPNCnBUH6eubyTXUPrPKrEcyi YjvJi1x9KfZrKdAEDGgOp/KrcATTgk7BhcJ9xMJnXFipKeGEz3NFPqFK2aeexSwQzoVslIrGFBB1t bV8V2gdRmKAQWFp5+65SGltCjzS7qeY3AaKVuyFPY2CNiX181SPI4S52lVVIivpZZ8kpNV6FyC6ul npyKBQanxJYynjWIWsUD2bINRtHCxqwvT+Kld3Ybc/1HhqVCL04haFz4gJZoTWqDXvk6Uu4nuj8WK ISc8Js2X22hzUWySBdPBtdXpZePdgS1GnjlWp8XZQ=; 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 1nsq9m-0007pH-68; Sun, 22 May 2022 19:18:26 +0100 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: Sun, 22 May 2022 19:18:01 +0100 Message-Id: <20220522181836.864-16-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 15/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will soon allow pl050_set_irq() to be used as a GPIO input function. Signed-off-by: Mark Cave-Ayland --- 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[] = { 0x50, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 }; -static void pl050_update(void *opaque, int level) +static void pl050_update_irq(PL050State *s) +{ + int level = (s->pending && (s->cr & 0x10) != 0) + || (s->cr & 0x08) != 0; + + qemu_set_irq(s->irq, level); +} + +static void pl050_set_irq(void *opaque, int level) { PL050State *s = (PL050State *)opaque; - int raise; s->pending = level; - raise = (s->pending && (s->cr & 0x10) != 0) - || (s->cr & 0x08) != 0; - qemu_set_irq(s->irq, raise); + pl050_update_irq(s); } 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 = 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 **errp) sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); if (s->is_mouse) { - s->dev = ps2_mouse_init(pl050_update, s); + s->dev = ps2_mouse_init(pl050_set_irq, s); } else { - s->dev = ps2_kbd_init(pl050_update, s); + s->dev = ps2_kbd_init(pl050_set_irq, s); } } From patchwork Sun May 22 18:18:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634314 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=ZECAW4yB; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5q6Y016Rz9sG2 for ; Mon, 23 May 2022 04:41:08 +1000 (AEST) Received: from localhost ([::1]:37072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqVn-0005VL-1S for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:41:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBL-0007lv-PH; Sun, 22 May 2022 14:19:59 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47600) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBK-0003aN-7t; Sun, 22 May 2022 14:19:59 -0400 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=oBbrmboxI2bOPyV9kjKCEFJMiErNmCGv2G8E9N42jsY=; b=ZECAW4yBfvPn4dvbwclvXNZoMh o7e7oW2NWSLzcb7muSsvhaI4dXInbn7p7+01lWDMu1EdygVLUS/n9hVOM+yg+r+ETemteieK7w4bu 9OnoR6W9WQT0AiDt/mt8f+HEe2xOn3DzWwjSbV6fHv6dJtJ7V+uNzlbT8EQB1LKGw3X+rpcfZBUct q2C9wwbFtq5Z3yhu2WXLmdYDmx6LY9NloIPKgLA13dwsdtvXIm1dNRrysYvECFoYG8+X8Dr7e9tmQ htL+GTY/kBCG4kRVM3IihWD9gJTFgwQBJZ44YvTNhxafLxf52Xfn9FWyl+h2LOwaMGkCeyfFavrqc BwZLfOWx/2WuTeyGuGWtYlUyOF77NNBOs92QbrODvbeSG/bq7I2PtErm2xCYcOLq390KgzIuuGOH9 Osz1IhKDSWPNbMemgeoLSjN0cZQQ/9qoFbBX5hIfOIF4WAsjIRhvDOc8wSQgdnGW6uHQ3g8vIkt5o nKmeeLYnuGF2tlgmjRfhu8qZ5Hs7OqVeQ9WrieU5afrbMaYiztr0UrEeXGQI8PvB/UQwPkM9yTgks c+asEoJR4Zn6ECovcCNFWtRDmIPw8F8Td6oO83+Ss5WQXZp7W6KWLs064HLsVZhhwc6UlTXz5AujB 8CzX+ywWhlc1CzKDa07fenh0mZnq/vgKTAwvSh0+Q=; 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 1nsq9q-0007pH-G7; Sun, 22 May 2022 19:18:30 +0100 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: Sun, 22 May 2022 19:18:02 +0100 Message-Id: <20220522181836.864-17-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 16/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This helps improve the readability of lasips2.c. Signed-off-by: Mark Cave-Ayland --- 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 addr, unsigned size) break; case REG_PS2_STATUS: - ret = LASIPS2_STATUS_DATSHD | LASIPS2_STATUS_CLKSHD; if (port->control & LASIPS2_CONTROL_DIAG) { @@ -238,9 +237,9 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size) __func__, addr); break; } + trace_lasips2_reg_read(size, port->id, addr, lasips2_read_reg_name(addr), ret); - return ret; } @@ -257,6 +256,7 @@ static const MemoryRegionOps lasips2_reg_ops = { static void ps2dev_update_irq(void *opaque, int level) { LASIPS2Port *port = opaque; + port->irq = level; lasips2_update_irq(port->parent); } From patchwork Sun May 22 18:18:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634324 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=eehE70a0; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qKD0HLvz9sG2 for ; Mon, 23 May 2022 04:50:24 +1000 (AEST) Received: from localhost ([::1]:56514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqek-00021I-3x for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:50:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBM-0007n3-8g; Sun, 22 May 2022 14:20:00 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47602) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBK-0003aP-HZ; Sun, 22 May 2022 14:19:59 -0400 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=owJa9ksMuZrAnm+DcVyAc3XwEqhiEJAr8xpOQuSc9uE=; b=eehE70a0DizH+HnWs6iYtQOEBr V13NfyAQDYOf3GMtLQeXeXBvjs308ZqgMESZ1PvioKz8Gm0GmvY3nlXkGA7mg7YQHZUCuLCF7Yrvf IXrI0Y2/zOWRkbp3pRh32gT07XJNDMMVTD7rOm2yc3kqVDwsOyu69QZ/bIg0YYYcDqntja69L0TSH WZnyR9vXDYKyvgmh+KKhG4hl2nvblunDYS6z/fB+Y4bGIYHvbqXCBo5kOLA6YQRFmTlGjjzir57b9 /qMV8blgNQsTIBWAS/l0SXjGUS6Te3saS707Es/R5fMtbv1IgCzw9wG35/l7/kMOh9HvjMZJVz9+K vLYIol74EirJAP4t3qKQHGUpY6GCp6fmvB+KJD9djkxbsB8CVzujPjgWqKq0B+xuPNyqmN+4H7ptI U4Nn1NawTaDbHtrAjsTHljwx/V5cP0rdyjQ4AiOSPDL34CNMZdVxjjwkUz9QOnVOlvpry8DiKqfy4 kWDCdQ+1N51YQcGVIkK61/8RRu9al8sgGiT5tLBiNG/fnSMRd6Rpo4Kftm1gw6jMpyqQ/+GSyE5lh 61GvlWibOh5rg1wM4BiOKhpi8XDcV0hmyUwTQIn1M1Se1ye13Y2IJuR3p81IAFqXa9ky69q+OQxF0 Kdl+RMSVGWyhpyAjqUckBppiQ3tOAnOIYXZ/ro6aQ=; 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 1nsq9u-0007pH-Pq; Sun, 22 May 2022 19:18:31 +0100 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: Sun, 22 May 2022 19:18:03 +0100 Message-Id: <20220522181836.864-18-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 17/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This better reflects that the IRQ input opaque is a LASIPS2Port structure and not a PS2_DEVICE. Signed-off-by: Mark Cave-Ayland --- 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 = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static void ps2dev_update_irq(void *opaque, int level) +static void lasips2_port_set_irq(void *opaque, int level) { LASIPS2Port *port = opaque; @@ -275,8 +275,8 @@ void lasips2_init(MemoryRegion *address_space, vmstate_register(NULL, base, &vmstate_lasips2, s); - s->kbd.dev = ps2_kbd_init(ps2dev_update_irq, &s->kbd); - s->mouse.dev = ps2_mouse_init(ps2dev_update_irq, &s->mouse); + s->kbd.dev = ps2_kbd_init(lasips2_port_set_irq, &s->kbd); + s->mouse.dev = ps2_mouse_init(lasips2_port_set_irq, &s->mouse); memory_region_init_io(&s->kbd.reg, NULL, &lasips2_reg_ops, &s->kbd, "lasips2-kbd", 0x100); From patchwork Sun May 22 18:18:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634323 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=H247MBjE; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qJW4Zyfz9sG2 for ; Mon, 23 May 2022 04:49:47 +1000 (AEST) Received: from localhost ([::1]:55502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqe9-0001Mt-Mb for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:49:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBU-0007vX-Hw; Sun, 22 May 2022 14:20:09 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47662) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBQ-0003ax-Sk; Sun, 22 May 2022 14:20:07 -0400 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=XpaCOJXPlxmvqRE9c2eTl71mLxpI4XBIHGz3+zONkok=; b=H247MBjEuV591j3bKVfnyvYt5j 0Deyc+F+0oEJvkp7us7vOnOPE2QJtGwNtLGxqWC86BvULrzoegGWHJGuElpj/A1UFTN+7NaDkRF74 hoZWXTea30uneC8Ljvw6/rNz/LNmb7W3TsuhpnojflcDM8fZBJ4bK004FSyqm1gM76u70bbKh2AvH pu0J66+Q8KISQLyBgJ2k3tnFq5jFbTVJtxwyFjk7cekCJ8NzR0xAiUHr0dbPPCKiz9H+sXoJ5jCHe 2ChhXewl+pIC/9slOot7Ujx/afO7Xqg25H9oErF+wPfFUiMjl1kaUY5Q7azjQ9cgEo0btQugON1Xu y4f3Vx5R8WrnAa3xREko7ZXfrkskbb9UATnJ06s9RXplL7VxszAI13gxpA5NEq2W+/ObZE3NWdztg YC4d+C7SHe6QNI6xwdSgzen/l3GIXXTMsNHfoPcDfZvQDd/gyIdRBjNwn3nKBkmKxcVicfNM8Eknm YXt5qDA22RbbjdILiiFrZem00yV95qoQFOaBdKU5ZOrJ9Q310eO812wPSEDGggZJMs8nxvCFGxeBt J54AQcxWcUdat2gPv8lstOM17kCtaBR5Yf9KssD0qURXuQKk3oGlccSPp/XnjXZPo0vuMoLOIeRin eW0n+F0AHnRCbdQiVL6cObEYMIldFy0ibndIKj8tA=; 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 1nsq9v-0007pH-9P; Sun, 22 May 2022 19:18:31 +0100 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: Sun, 22 May 2022 19:18:04 +0100 Message-Id: <20220522181836.864-19-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 18/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Mark Cave-Ayland --- 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 4efdf75620..ab0d66d00d 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -39,49 +39,86 @@ #include "trace.h" -/* 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 device */ -#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 port P2. */ -#define KBD_CCMD_RESET 0xFE /* Pulse bit 0 of the output port P2 = CPU reset. */ -#define KBD_CCMD_NO_OP 0xFF /* Pulse no bits of the output port 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 = CPU reset. */ +#define KBD_CCMD_RESET 0xFE +/* Pulse no bits of the output port P2. */ +#define KBD_CCMD_NO_OP 0xFF /* 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=data) */ -#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=data) */ +#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 /* 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 keyboard 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 /* Output Port Bits */ #define KBD_OUT_RESET 0x01 /* 1=normal mode, 0=reset */ @@ -89,7 +126,8 @@ #define KBD_OUT_OBF 0x10 /* Keyboard output buffer full */ #define KBD_OUT_MOUSE_OBF 0x20 /* Mouse output buffer full */ -/* 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; -/* 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 addr, trace_pckbd_kbd_write_command(val); - /* Bits 3-0 of the output port P2 of the keyboard controller may be pulsed + /* + * Bits 3-0 of the output port P2 of the keyboard controller may be pulsed * low for approximately 6 micro seconds. Bits 3-0 of the KBD_CCMD_PULSE * 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) == KBD_CCMD_PULSE_BITS_3_0) { - if(!(val & 1)) + if ((val & KBD_CCMD_PULSE_BITS_3_0) == KBD_CCMD_PULSE_BITS_3_0) { + if (!(val & 1)) { val = KBD_CCMD_RESET; - else + } else { val = KBD_CCMD_NO_OP; + } } - 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, trace_pckbd_kbd_write_data(val); - 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 = { VMSTATE_UINT8(pending_tmp, KBDState), VMSTATE_END_OF_LIST() }, - .subsections = (const VMStateDescription*[]) { + .subsections = (const VMStateDescription * []) { &vmstate_kbd_outport, &vmstate_kbd_extended_state, NULL @@ -619,10 +661,11 @@ static uint64_t kbd_mm_readfn(void *opaque, hwaddr addr, unsigned size) { KBDState *s = opaque; - 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; + } } static void kbd_mm_writefn(void *opaque, hwaddr addr, @@ -630,10 +673,11 @@ static void kbd_mm_writefn(void *opaque, hwaddr addr, { KBDState *s = opaque; - 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); + } } From patchwork Sun May 22 18:18:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634318 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=I40BvdJZ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qDn1NJRz9sG2 for ; Mon, 23 May 2022 04:46:33 +1000 (AEST) Received: from localhost ([::1]:45610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqb1-00031m-8d for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:46:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41404) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBO-0007tF-Cy; Sun, 22 May 2022 14:20:03 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBM-0003ag-LR; Sun, 22 May 2022 14:20:02 -0400 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=xs4gvUailLLGe5qeax8Qh14bKpSzOTOlFdbaqXnmdbg=; b=I40BvdJZM5FAaW7pK9udLPILOf /arapUWdj19jj/D9t0XilXIh2cjNUli0zVGJooU3cBKQ26NlO1Nf3Ow8VcSyHR+HynzPl495w1WGW qt+Y6Rhpfgn8NJMUteOSJc/potFrg2w8hfJ2DugLLGX0jfK02Yygub+nDLInE8fHoQyMaAWvI+pnM 2fKVHyc6fhXb/osQ1qRSqSQPRL1Ug7m1IaP0XngKZ0ORyotxbB8AyY+p0thuecu7Wt/jPS434o+e4 oh2+8zcSnqp62HzVtdcfwPT+32FVu/Dj3PFe45l+bAQg6KFtXF632OLbr6YoXm2WGIEOCnC5ST2bf lf/+A7P0kqzrHX/GhoDPlV+SXP7EUDn2M3FIw9FHpG3xZ3cuJkGumYPcF8qiARcBV3kvVymrJWd4p iDgIrMpN1TgLvvFqZB96Tp6kA6OnmKCyPoYW3wtWzmEHpXphu7vIkypMQh0yoSERzUN/FA+VlgeVz Sjtmhh3tB2mwGrqaDaMHtXHPBcdSPM0s3m+4C3Zp0oYDTt80KmsVQoopnnax+eOTTseISw24B8x8D CAVR29bPJTkzR+klLpsgrzHkTAyc+Suqv9yLIeFGm+T8+WBlDDEAuDQkbHvDV9aRwzWIHk6ip9Ojg gLbn5myuelcGgdt6vSeyZ08hrdAajlvD9bXYl608s=; 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 1nsq9v-0007pH-VG; Sun, 22 May 2022 19:18:32 +0100 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: Sun, 22 May 2022 19:18:05 +0100 Message-Id: <20220522181836.864-20-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 19/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This allows the QOM types in pckbd.c to be used elsewhere by simply including i8042.h. Signed-off-by: Mark Cave-Ayland --- 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 ab0d66d00d..87e015f243 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 -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; /* * 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" +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) From patchwork Sun May 22 18:18:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634327 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=TL9llOV/; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qTq4hR8z9sG3 for ; Mon, 23 May 2022 04:57:51 +1000 (AEST) Received: from localhost ([::1]:39678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqlx-0001du-Na for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:57:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41476) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBU-0007vW-Gt; Sun, 22 May 2022 14:20:09 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47652) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBQ-0003ao-4I; Sun, 22 May 2022 14:20:05 -0400 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=ISWEG4VfSuh8z2JdLel2rveX5OtktYJr7RJtbL5goMI=; b=TL9llOV/ze6kO316bpATd16Tdz cdZnoi2fBlsNiaekqUzWF0H+NBKaQuQL6wB4+CnhnIrI5r/y2NQScWQJONWFSDcLepSCVr46k9M2v DXO32KkINZxVrW/m5uSB+OPPAiWj4SWXH5vs6LS2aHfF91MYNWYkn4uxU54nhKmXKnhC7iINBk6TZ /zrc2WwVezIuoXdKl+VrBH85/OvJI+o3WTdxEcu2o+ca/7Z0Jc3uh/hsuvX3MidyAQCKgPmyoELxI U2uVDwSJURHhgGB/8YrJIV3JdKQGl4hNbyEiJ8PL+7AjuU8VHQnDsNpsNnNYi4AgTkCUbj/kVo+mi y//+tw/eWtnmhTv0PvC7yqGd7PHXNMXyyNwe7OKwTQM3YPX2tLQreHJNJvGmSwg7+rOizU/3FSB3K RiynbpBr6/4EcVgc59YQRwWb2eXyz79+H4WR19YnX7jnIlc1ceRTPR/VFOBCGu44pXt5TPs1LWjcc xqcojNGQCWEJ4sZNEaBPRq68orpJM9c6Yow+tRGo+hiEu6nUUUKlzkHif8pLn0hmx7u/R9CKryk2i 0izPjkF/aQKncD9hxzRiV2OvsYwkhMYXHpg/tFruI4cvxWMOIygF1ep8vsyzeV0RV0aTR6Lv4iBiL xTNmyuYIGBzS5g/ke0WehrUnrA3kwFi7bWZFCsJo4=; 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 1nsq9w-0007pH-FR; Sun, 22 May 2022 19:18:36 +0100 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: Sun, 22 May 2022 19:18:06 +0100 Message-Id: <20220522181836.864-21-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 20/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This allows the QOM types in pckbd.c to be used elsewhere by simply including i8042.h. Signed-off-by: Mark Cave-Ayland --- 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 87e015f243..3a7411f799 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_irq, qemu_register_reset(kbd_reset, s); } -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 = &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) +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" From patchwork Sun May 22 18:18:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634326 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=JGXvLOzT; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qR2368nz9sG2 for ; Mon, 23 May 2022 04:55:25 +1000 (AEST) Received: from localhost ([::1]:35656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqjZ-000764-AC for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:55:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBU-0007vY-IP; Sun, 22 May 2022 14:20:09 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47664) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBQ-0003az-S0; Sun, 22 May 2022 14:20:06 -0400 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=n9qB7O7B3yGEqP/ZSrexd4Prsc3yQr2BuTu7WIeCUAM=; b=JGXvLOzT7UiPYZwRamJU1ZiWeM OiO6HJaguZtDN05Mzf8aPibLcmB1bVt2w74xK7tZJF5oxP3RBpIFE2xQkUdZxdgCpO8dhCGYgr9Dq L7F9S9KhRchiAUF1tmDntGHKtXFdZqrckdzrzHvlMrQer/uQQtLLf6+loNboyo2ALwgTw8rNS/oUO CD+gy/VzoO//qZIcIHXHZj3IyXUuHjv3Zx49aD0cUV3T1E08ta5lWuFOaBheeL152PlZMeA0nWmbr fCMgozbewqO3WnMFU7TV9i6iHZtLhwLmxvhLxTWXqbso8lAXPF8LCyuU0mKcv94H0XflAfYXCUcsl mcHBByG5fVNH+goEnNPVrTLzk4G57twA0SHvS6GaBSKJldi772my0A3frXTdivvoItdp6kFYBSUXc 3lrR7kHkWmTM5SAVl1FxEsxuD8rAjwH/Srcm1KVb1qfTp1XjJ3k9hMkNeqIN5CzxV9czxePnmEVHB fQMsCVm09lz8RNCskxJXNjYxuMU7wwBpxa2aW+Sl+jY/eMYCMzroFmRc9QlA6k84ffDWm9PWPW9R6 lF3x202mz3ndbYSZT8ujJHU3vZ8aq0RWO0DlUv/WqzrgHIJS5TsOFEys++u+nFbVNqswkNYN2ok08 XHbxAsgtqtnxYOzIhMsaU7asoHqQ4g6r1HVYlkDDc=; 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 1nsqA0-0007pH-OU; Sun, 22 May 2022 19:18:38 +0100 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: Sun, 22 May 2022 19:18:07 +0100 Message-Id: <20220522181836.864-22-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 21/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 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 3a7411f799..bbdd3bc568 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -665,11 +665,23 @@ static const MemoryRegionOps i8042_mmio_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; +static void i8042_mmio_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = 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 = g_new0(KBDState, 1); + DeviceState *dev; + KBDState *s; + + dev = qdev_new(TYPE_I8042_MMIO); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + s = &I8042_MMIO(dev)->kbd; s->irq_kbd = kbd_irq; s->irq_mouse = mouse_irq; @@ -686,6 +698,13 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, qemu_register_reset(kbd_reset, s); } +static const TypeInfo i8042_mmio_info = { + .name = TYPE_I8042_MMIO, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(MMIOKBDState), + .class_init = i8042_mmio_class_init +}; + void i8042_isa_mouse_fake_event(ISAKBDState *isa) { KBDState *s = &isa->kbd; @@ -837,6 +856,7 @@ static const TypeInfo i8042_info = { static void i8042_register_types(void) { type_register_static(&i8042_info); + type_register_static(&i8042_mmio_info); } 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 #include "hw/isa/isa.h" +#include "hw/sysbus.h" #include "qom/object.h" typedef struct KBDState { @@ -49,6 +50,15 @@ struct ISAKBDState { uint8_t mouse_irq; }; +#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" From patchwork Sun May 22 18:18:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634320 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=NAt/P7jg; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qFT3HR0z9sG2 for ; Mon, 23 May 2022 04:47:09 +1000 (AEST) Received: from localhost ([::1]:48466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqbb-00054F-HC for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:47:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBV-0007wh-RG; Sun, 22 May 2022 14:20:11 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47674) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBU-0003b2-5D; Sun, 22 May 2022 14:20:09 -0400 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=MQQj4BHZNb1SwAxzdbz1KTc16gkdRkZbxZ3rw5s/cLs=; b=NAt/P7jgqvR2sFdkjWj0d1piaD R9ZWHHAD1ccNKKAla3bqLmy0i6Qb22RCFtDK4EOx/19sSi2CGs65DKYzDC04b8ySQiPYd9qq0qaFl 4KPI6XqKJLZcY39nultNJ6bcvraYCWH6gj9HP089WoY7yzGrmvqS9HJZ1rhMa5H0wWFBamRbKZ1bT rtFBKlOhUXA45JcKik4EupVKBWrSNGBdEEuGEpnMe6LNFpznqo0CUXif554E6ED5xuuF2b6Zt/VkO wPx5yvYndJ17zbutLfK1rnb/z1m1szx68KqFBANuFWYWZPII3GB12eoz8tBnWLScWuhjGrC9Brjwh 4UDqXpI/RoyKmsyjB2sbgDCx6B50uzM/Wu+0E+Racz3LB8EEHpWL7d6eB7YMCRy2T32KWtc0Uf7fG y7HFOi0j5ctTLqBnjZi2aGkCaMjl4Z4ePpyWHbxEm0w7blOT+/Ju4C3PLGPp9Bx96utOGnwOfKrAr Er6YidW2rEDpXxGLI8VEsMTViWsffBXpzco8kfWeaCmV+OI8hx9eBSy87ZAi0fy9BOuavr/ek0chf /vPYBKYYlDCzoQGNbJmvi8ewCzBNI7uhtFA0G3ff1jU8cMakK3gsdjTy7kBUnnQaNuGCEAxgSowRl WnmodUg7xNUzPNKDztFT2vrKt8b+/Cq4+BXvVtkxc=; 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 1nsqA2-0007pH-CJ; Sun, 22 May 2022 19:18:38 +0100 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: Sun, 22 May 2022 19:18:08 +0100 Message-Id: <20220522181836.864-23-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 22/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- hw/input/pckbd.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index bbdd3bc568..df443aaff2 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -665,10 +665,20 @@ static const MemoryRegionOps i8042_mmio_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; +static void i8042_mmio_reset(DeviceState *dev) +{ + MMIOKBDState *s = I8042_MMIO(dev); + KBDState *ks = &s->kbd; + + ks->extended_state = true; + kbd_reset(ks); +} + static void i8042_mmio_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + dc->reset = i8042_mmio_reset; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } @@ -687,15 +697,12 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, s->irq_mouse = mouse_irq; s->mask = mask; - s->extended_state = true; - vmstate_register(NULL, 0, &vmstate_kbd, s); memory_region_init_io(region, NULL, &i8042_mmio_ops, s, "i8042", size); s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse = ps2_mouse_init(kbd_update_aux_irq, s); - qemu_register_reset(kbd_reset, s); } static const TypeInfo i8042_mmio_info = { From patchwork Sun May 22 18:18:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634304 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=pVbRkz0E; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5pq327MKz9sG2 for ; Mon, 23 May 2022 04:27:43 +1000 (AEST) Received: from localhost ([::1]:36310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqIn-0001MC-CF for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:27:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBi-0007y8-Ij; Sun, 22 May 2022 14:20:23 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47704) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBW-0003bw-Mb; Sun, 22 May 2022 14:20:19 -0400 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=I0VPS71VXtn5mqfuBaY8i3Y6GRXsjpQM3fNl/iuWzEQ=; b=pVbRkz0Ejst9+5YobYZb7cMKLH 5RXH0Lcu/X0qAKCT3QQFfvk7DxOzDgpg7Grj/tKO+g5vEjMVSvNRnVXmGljrrIEA4iowJwBT8Ffsk 8JOPkcXBnHxBGo0xovlYoY0XGLo34pZc6vY0BOwfBjvONn2YW1dZz9QZEwoKVm58D49fBOfMPKm9C kCC2xnzw2pXHrg/89dbDfZZ6DIFXUdeCV/eU+u842Tiz6FjpQgkWUIx3fESp4Xp7ch2UXZxbdq4Pj 5SzYLQ4Dm6Z1Pipgt3/SyWvc7jBVm4FEmJY067S2w/0RIPUZomcRhvJjzhm1IbMkNNJW2XCxcKDfL Iaq3D8yqQcu/XRo+AjwInH88MC0oo6JrtqdUSGY1wBJ3xH5+O6A+YZJo6hQAq30PLlgXPJBhwVjx+ L/RQ9+zrDLyDybl+ApPWWALbT+3KK7R6ue39fkwGJ3w1ADYhHKO2nqv+Eq9/yCHauDxhkXYJYAN+f hUtxAc/oH3Huj9chOFWdd+WiTa/O5kVsGOfoTkA2UvKxHSCpknb0LrTNna/WpukMSWLOZTY4PN22h S1ovc3N6UnR+ZPvVNJVGvBpsG/STm58tdXsTZep6MpzrB8OaAQFLsuiKOQu0hXKN/ZW6m6kiQp0uK 1LNZNalgxthC52smXTGzgISqGz24PyaChc7722iss=; 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 1nsqA2-0007pH-RT; Sun, 22 May 2022 19:18:42 +0100 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: Sun, 22 May 2022 19:18:09 +0100 Message-Id: <20220522181836.864-24-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 23/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 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 df443aaff2..9da602fb47 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -674,11 +674,17 @@ static void i8042_mmio_reset(DeviceState *dev) kbd_reset(ks); } +static Property i8042_mmio_properties[] = { + 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 = DEVICE_CLASS(klass); dc->reset = i8042_mmio_reset; + device_class_set_props(dc, i8042_mmio_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } @@ -690,12 +696,12 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, KBDState *s; dev = qdev_new(TYPE_I8042_MMIO); + qdev_prop_set_uint64(dev, "mask", mask); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s = &I8042_MMIO(dev)->kbd; s->irq_kbd = kbd_irq; s->irq_mouse = mouse_irq; - s->mask = mask; vmstate_register(NULL, 0, &vmstate_kbd, s); From patchwork Sun May 22 18:18:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634333 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=GzBSn1n4; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qjS551Gz9sG3 for ; Mon, 23 May 2022 05:07:55 +1000 (AEST) Received: from localhost ([::1]:54298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqvg-0004F1-6I for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:07:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBi-0007y9-J0; Sun, 22 May 2022 14:20:23 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47708) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBX-0003c8-Gp; Sun, 22 May 2022 14:20:20 -0400 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=ccWy+DLbu1PIuWO3Y6JNkCW/BApqMBOppBBa7UTUAAw=; b=GzBSn1n4ZdSSSnm1Y8JRWWX2UO BUuNy61ZlKq4U0ppF2Z0TPcURFRQIXs9Uw2Jp0n6aa7uZGBUH5Oqrt+cDhQjd8hP8bJUOYziR1oy2 leE03xgaopBIMiPbwdFqZzv4fp28nL+BfgiId3ueGgOF9d5Ra3C/J0YaX1KJAwLr9O+bqBKQ6IGq8 rvqvXH/s+KPCqC8J2WyFoeSJG58T42qwL6Ov2DmzYtG+w87VUzYmQkZ2WYSe1x0pPEBWGUdwPu8M2 PcPpAI/7u+1nb5mczPnImuboVVzdWgIPMyBKOhX5gg01dLg0/3FquQdmIo2yFGn+BRvRvhofoM8EQ +WWKyH8wmDN0+DRajKhBm3VW7qcHO3pRPLsFtROq3QRxkgcavdbJPUHcfCvfMuwA2BQpd3K+SFmyH jkNxuBL8iOkdyxfAHEvQLwbfnv89SMGZCQAutrHIKNHDggTJV8sjlgf0WtbR4DtrZnGBXwwo24EOm ujuKbXYTwuz79R2d6VI6/v2QSfpCejZXwnHnoAwZvYIRSfvkQDVG8sbTxsnWGEEa3+ZudpPAQ2c1y DpDTyj3fUjejiu3rn0/v3TqSpu0slSJA1CSZzzxDiztf6/TXm2iuxbtC/FJTw5XB7K1MBnHTFh5Nb v2R6P+z2pJ28l8fpC6wG2y0bKpMmMbtF6dEVEwE4I=; 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 1nsqA7-0007pH-4g; Sun, 22 May 2022 19:18:43 +0100 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: Sun, 22 May 2022 19:18:10 +0100 Message-Id: <20220522181836.864-25-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 24/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will soon be used to set the size of the register memory region using a qdev property. Signed-off-by: Mark Cave-Ayland 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 9da602fb47..e13a62bd4f 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -676,6 +676,7 @@ static void i8042_mmio_reset(DeviceState *dev) static Property i8042_mmio_properties[] = { DEFINE_PROP_UINT64("mask", MMIOKBDState, kbd.mask, UINT64_MAX), + DEFINE_PROP_UINT32("size", MMIOKBDState, size, -1), DEFINE_PROP_END_OF_LIST(), }; @@ -697,6 +698,7 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, dev = 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 = &I8042_MMIO(dev)->kbd; 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; KBDState kbd; + uint32_t size; }; #define I8042_A20_LINE "a20" From patchwork Sun May 22 18:18:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634329 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=etEXjdUx; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qXF4TLRz9sG3 for ; Mon, 23 May 2022 04:59:57 +1000 (AEST) Received: from localhost ([::1]:44864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqnz-0005Oz-Ms for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:59:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBi-0007y7-IW; Sun, 22 May 2022 14:20:23 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47724) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBb-0003cM-3u; Sun, 22 May 2022 14:20:20 -0400 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=oxVlHf98HL9bPkTIpGvX3oL4QhZPAMzaXJg3554V5Z8=; b=etEXjdUxuk+55dLKD0+g36NGk6 bJO8ngBDkBZDySVZlx247By1rguGacTaHPcYST2JT5qGcZD2jLxeVlAoeS9wDDeOqwCO1SovQTRjY 6/9fq7QkGKaCFkWjA42V3Ml3h1oi769DZn05aMXTmN0tIOvBkNi16zgP8BDPOuRV7GXX/dYVJRGIO g3N079hPeXevcWeUWbBEtdtvkygaEDQSjCrC2aT7okKRDtYJobywpiFJvLQ+92vvkZnxjbYxq9TS+ y3BsnwnjXO5/ygJTmshJ/LRN82ZUI786AG60ANuhzrBbo5i0V4gA/FuVjDcWGEukjiqfEEnWeoBkF CGV+SQ/c5K+3nI+zUxfq+zn1N1jDm7IX0+J9yTRKKhLW6vpmGdgrVrli32ZTFO/WbMGKfzzneujpr FPF/F6GXngAP8tbflLtBzJ57lB4y2meJ31w4xC+xFkhYYLvdBDveYPcr3JjDDdGLaOLjnDqMFWyR8 udcbPklgVcFjlfPV9E4RIoEw1Dy7dm2jA8uPChY9M1YNnEVDmxZRfXOAC5WJ3TjOU3zzF755iJAcO wxNlkwE0EsBKP1mwBh7FWxWWXCXAhHICGRLHLK4cO9PFry/AmHheLsuEPjHkr686vZnV/KYqI97Wv XX8Sz/9WY9CFHJ+3NDbs49rKMZdFi0lwpTioXGwwQ=; 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 1nsqA7-0007pH-Kp; Sun, 22 May 2022 19:18:47 +0100 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: Sun, 22 May 2022 19:18:11 +0100 Message-Id: <20220522181836.864-26-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 25/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move the initialisation of the register memory region to the I8042_MMIO device realize function. Signed-off-by: Mark Cave-Ayland Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 12 +++++++++++- include/hw/input/i8042.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index e13a62bd4f..addd1f058a 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -674,6 +674,15 @@ static void i8042_mmio_reset(DeviceState *dev) kbd_reset(ks); } +static void i8042_mmio_realize(DeviceState *dev, Error **errp) +{ + MMIOKBDState *s = I8042_MMIO(dev); + KBDState *ks = &s->kbd; + + memory_region_init_io(&s->region, OBJECT(dev), &i8042_mmio_ops, ks, + "i8042", s->size); +} + static Property i8042_mmio_properties[] = { DEFINE_PROP_UINT64("mask", MMIOKBDState, kbd.mask, UINT64_MAX), DEFINE_PROP_UINT32("size", MMIOKBDState, size, -1), @@ -684,6 +693,7 @@ static void i8042_mmio_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + dc->realize = i8042_mmio_realize; dc->reset = i8042_mmio_reset; device_class_set_props(dc, i8042_mmio_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); @@ -707,7 +717,7 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, vmstate_register(NULL, 0, &vmstate_kbd, s); - memory_region_init_io(region, NULL, &i8042_mmio_ops, s, "i8042", size); + region = &I8042_MMIO(dev)->region; s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse = 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 { KBDState kbd; uint32_t size; + MemoryRegion region; }; #define I8042_A20_LINE "a20" From patchwork Sun May 22 18:18:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634330 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=f+DdTag1; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qb73F1Zz9sG3 for ; Mon, 23 May 2022 05:02:26 +1000 (AEST) Received: from localhost ([::1]:47090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqqN-0006tb-3j for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:02:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBi-0007y6-IX; Sun, 22 May 2022 14:20:23 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47740) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBe-0003d0-Hm; Sun, 22 May 2022 14:20:21 -0400 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=qVffcWhZTjD2ITQoPU/MjFUySUV/A9OQ1qypPal6+Ms=; b=f+DdTag1FxD2frPEM8cm7oEH/1 t5G4gKJCiCAV5Oeb+JddLT39AiCqFWH7jEQuJoF1NJy5UUZedjV3PIx0b3j7Jhu920fP5pCK5veLQ CuOva3ym6RW0OUvHIFxt0WpFmuD8U35GNRyVrZndc3zi7XES0V6QAnPVLvjb7d/kHk3WQc0DDZE5O uwa4s0n+Bkl4IqYCi+xXUmay/cslpOiqVgMK29ZsVL2EAwzOw/CuaUzYjMpg6IMCLHkWCA03qwxFG VKaJ6zyr0R9LCWE0afO+bEi4YD0W/xaAWSpz4VV10aT6AyA9dE/GhbW+A12nA9L57zqEDebZgYBvy JiB67b6gd0kV5toojTY4nge0H7maqBYg+ozeDWDk5TNOsKx12DeVqhI/d0zzm/f/Jt2WDSusXCMxP trXP3PmKpxGXD/Znc/w1kloeiqb12T20+ZJi+os5Wn7OxAtkW/X+e7LPfk/vkDfvd6PqWtV1KgqLg b1teIAT/QMQF2dZD0RPFSd/vc3CI4PVRaQecHG3T9IYHn2bYCnEaC/rI+DYqw6jJp9PwXaEV7v3bN 2GMyMbj0i7xLDyJPqSz/M2sATgfxX1kXKhuRDkvZb89yDbrX6Bne9cY5savJANrthvy2SQOqMLEYP uMA9tC0SQB1C7QRyXUbniIE8+cp/DdRp2G3fV7zOo=; 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 1nsqAB-0007pH-Up; Sun, 22 May 2022 19:18:52 +0100 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: Sun, 22 May 2022 19:18:12 +0100 Message-Id: <20220522181836.864-27-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 26/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This enables use to expose the register memory region of the I8042_MMIO device using sysbus_init_mmio(). Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index addd1f058a..c407c082e2 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -683,6 +683,13 @@ static void i8042_mmio_realize(DeviceState *dev, Error **errp) "i8042", s->size); } +static void i8042_mmio_init(Object *obj) +{ + MMIOKBDState *s = I8042_MMIO(obj); + + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->region); +} + static Property i8042_mmio_properties[] = { DEFINE_PROP_UINT64("mask", MMIOKBDState, kbd.mask, UINT64_MAX), DEFINE_PROP_UINT32("size", MMIOKBDState, size, -1), @@ -726,6 +733,7 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, static const TypeInfo i8042_mmio_info = { .name = TYPE_I8042_MMIO, .parent = TYPE_SYS_BUS_DEVICE, + .instance_init = i8042_mmio_init, .instance_size = sizeof(MMIOKBDState), .class_init = i8042_mmio_class_init }; From patchwork Sun May 22 18:18:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634337 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=bhi3bZrf; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qqB4dFvz9sG3 for ; Mon, 23 May 2022 05:12:54 +1000 (AEST) Received: from localhost ([::1]:33698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsr0W-0001nF-Ga for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:12:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBm-0007yv-Do; Sun, 22 May 2022 14:20:33 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47834) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBk-0003e0-0A; Sun, 22 May 2022 14:20:25 -0400 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=TiKunVyuEOnENdlPtZRZIB9VgBsQdAVg6xJsfHP4w6w=; b=bhi3bZrf3nQfHobXqyWZVtEaNp ApErbVvXXhAQYDnQLlmZyB2nPpcQDKcEfo3/uCqLloCkbCifsBpMzsu7RRfyixg4M/8Q0t93jKhxD 1lZbP/K4aMRyx7JDFymmar166krVX+B9eZWGJVH385kODpDEYWh15LurhKx2iG1+vjvHrG9kfmm9z bAJmG1wOKEc9jtQW/ejI7P/Qu4fJ2egZRKWcDMABT0gqDJ8ukkXTQ/ou8NplM5s/l9+MUrwxRyp6N Fo5nSfCiyE7cAUnvYvmgi3arZ18QiMKw4O+SlP/z7Ee0iaasI8jxyPThGB5rNlPZEiqwoopRBA38b /s5dOPHSTJmFjwyqxmySpEXvZANrXmd8+NA9aV58NygjnPzE3D55lXaTizjIgRpZRNYhnkE0MbUdL 9b46yL66RnO5fzqkumIIKOTjRSk/eWJgZ5+WVWfM+4PXAorNEh3y7z+KYmk56AAtjB6jyCJR2G3Hr Bktmdny2NK35Dm1kjPLWuFbUMtVni4ajBQrU14GqAnM5Px51t0ASbb3DXtDG5Xw1SN+fFuCSB/rPC xMxQO41UyhVPElcLWLZ9Gp0mCPtnYzEvMKgLlRjZd9drAHurv12bTHuPPMUv4N14I574m3yDVTR4P 9s9tSvP2Hv58BByuVxsTDK27+3ksNbCVy1ItaiH1w=; 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 1nsqAG-0007pH-97; Sun, 22 May 2022 19:18:56 +0100 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: Sun, 22 May 2022 19:18:13 +0100 Message-Id: <20220522181836.864-28-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 27/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This exposes the I8042_MMIO device to the caller to allow the register memory region to be mapped outside of i8042_mm_init(). Signed-off-by: Mark Cave-Ayland 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 c407c082e2..a7f1439994 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -706,9 +706,9 @@ static void i8042_mmio_class_init(ObjectClass *klass, void *data) 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) +MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, + MemoryRegion *region, ram_addr_t size, + hwaddr mask) { DeviceState *dev; KBDState *s; @@ -728,6 +728,8 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse = ps2_mouse_init(kbd_update_aux_irq, s); + + return I8042_MMIO(dev); } static const TypeInfo i8042_mmio_info = { 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" -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); From patchwork Sun May 22 18:18:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634325 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=neSoNYtB; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qN21K57z9sG2 for ; Mon, 23 May 2022 04:52:50 +1000 (AEST) Received: from localhost ([::1]:60448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqh6-0004jx-9R for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:52:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBo-0007yw-8r; Sun, 22 May 2022 14:20:33 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47860) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBl-0003pG-Em; Sun, 22 May 2022 14:20:27 -0400 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=ODXTrlSiemej5p65V4ZLSxop6J+RhlnTW+zYLVGJJJc=; b=neSoNYtBZi+caLcztVpVQjipS8 VI58bSkBFiz0cxK+HR1LHgrrDbAAHdSG1iZu+Msvt2dISJjar56r2TI+IkuVPmiWRXtc83hUF8aGv 7etJzkuGdvpFchXhQlxBgjR07KlTVPO9njMI3mbpUIt2nTbRdvUxPmKslHh1HaaCzQR6/tpuOJFCV U1TLM0wsTGSEEWI6V4YZlkZOGhBMzBAO1IoXReKOgxn7tJJ4hA5UOSd9mSRw4SP0W8bGz4S3nIjct RzZYBRRINpip03BnoD+71MnP/Upa0CYhXGGfxqlnw5s9FCeyu+JFfMudrFhFg6Avwmmr3Enlfo7WM CudZMOz4EpRuFrl4IMYGCl61oyr1rOLgJ79txUmC4xwXiNat/mcldbc/UcdGyggDDApXRLV1ZvcPK OdjPpsb3+rWCbbgdz/BGPuC5PZS/aIN0/9aMFHwE586/0Ft8I0a/P1FSkawjXOvBbux4/HhFQJe/k tIVUv4cFTFFAiOLGPq0XJCTsYAjWsfVVac7TwgMQTpEIfV+h/dBTmPZ8L+RNq2sl6HUnnr0Zd44Sa CPtMQF/ckSkkn1kr4K2hg6yb7UtoscyRoR7DddY+ZYtrJhhhdX3Ba6WmbsqqG/UG8GFbQ76IPdfnX nxoHOZr0W/pCEi4TaOdggawbYQzLIZkqMTBNe7mXs=; 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 1nsqAK-0007pH-ME; Sun, 22 May 2022 19:18:57 +0100 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: Sun, 22 May 2022 19:18:14 +0100 Message-Id: <20220522181836.864-29-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 28/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Now that the register memory region is exposed as a SysBus memory region, move the mapping of the I8042_MMIO registers from i8042_mm_init() to the MIPS magnum machine (which is its only user). Signed-off-by: Mark Cave-Ayland 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 a7f1439994..eb77ad193e 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -707,8 +707,7 @@ static void i8042_mmio_class_init(ObjectClass *klass, void *data) } 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; @@ -724,8 +723,6 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, vmstate_register(NULL, 0, &vmstate_kbd, s); - region = &I8042_MMIO(dev)->region; - s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse = ps2_mouse_init(kbd_update_aux_irq, s); diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index 6598d7dddd..80c9206230 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 = g_new(MemoryRegion, 1); MemoryRegion *isa_io = g_new(MemoryRegion, 1); MemoryRegion *rtc = g_new(MemoryRegion, 1); - MemoryRegion *i8042 = g_new(MemoryRegion, 1); MemoryRegion *dma_dummy = g_new(MemoryRegion, 1); MemoryRegion *dp8393x_prom = 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); /* 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 = 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(i8042), + 0)); /* 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 { 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); From patchwork Sun May 22 18:18:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634335 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=Q7DCVcIb; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qlj3sV7z9sG3 for ; Mon, 23 May 2022 05:09:53 +1000 (AEST) Received: from localhost ([::1]:58246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqxa-0007QL-LK for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:09:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBp-0007yz-T4; Sun, 22 May 2022 14:20:33 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47862) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBo-0003pL-Fk; Sun, 22 May 2022 14:20:29 -0400 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=obfm0WA/cOM8kbIYlnDo2jKbTT3t2cD7xEJBM72jgyw=; b=Q7DCVcIb4xPA9cU5jy9ERDLbo/ JW/ITBo/iPJmt1Pg+dKVZOUDgA/Ytc+xAus7CmYTyO6oThLOfr6Zd+nVKDK2yFQTESWn0jiJbAISr Wr0D0pln2tknx7/IifGLhHsjtrAjx9Qe4FTMpha2Uo6hsTcMdpjBUyxVx3pwIFGdbzUspLrj632WB d0xamCPco1hB6fSgg0h0aSsJ1dtxDbH1vwiCcmYa1Fb6qi4GVKYVPCACGCLLfxsdW7VRxGVfFYpRC rqICC3Ox/NthPQ3pHGw5uj48nvUjlGJkpeZGIblMLiZqo1AQZPuG05R+wT12UJI8cH0C6aJxJsA/n rKd0cRMFZ44l+r6sLDHq06gJE+6Zz1DIapTdSOvVUNR3pVeEd2cig23/NYGsj1eKfzWorJUA0axMS Exwtxl56TnHxa8uLJOK6pLFOJxkPutiy94MyJJ32mssYIOBjZxLVVKq0yZyH8gCKcA39USKeDsQsv f0EChnDwl7GhrtMSaKhtLrY13PfHj8+5+wvmW9z5NVtdpZu0ftPdvgYP4aFzWjocK3V9HumGx5U4O Yo4J+ZrMVLcZy4iWlV8E14dnmmMi8kVFDkKgWw1d/f6oARGmJCv3Eye3dplfasU5MY2bwuUeh+2U6 J8NscAR6IVqUg19Zu0A3pWQ0NLKq6Ag+foE9z3u0c=; 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 1nsqAL-0007pH-Sr; Sun, 22 May 2022 19:18:58 +0100 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: Sun, 22 May 2022 19:18:15 +0100 Message-Id: <20220522181836.864-30-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 29/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- 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 eb77ad193e..7f3578aa4d 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -681,6 +681,9 @@ static void i8042_mmio_realize(DeviceState *dev, Error **errp) memory_region_init_io(&s->region, OBJECT(dev), &i8042_mmio_ops, ks, "i8042", s->size); + + /* Note we can't use dc->vmsd without breaking migration compatibility */ + vmstate_register(NULL, 0, &vmstate_kbd, ks); } static void i8042_mmio_init(Object *obj) @@ -721,8 +724,6 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, s->irq_kbd = kbd_irq; s->irq_mouse = mouse_irq; - vmstate_register(NULL, 0, &vmstate_kbd, s); - s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); s->mouse = ps2_mouse_init(kbd_update_aux_irq, s); From patchwork Sun May 22 18:18:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634332 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=IaYL6kxa; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qdb2F3wz9sFr for ; Mon, 23 May 2022 05:04:35 +1000 (AEST) Received: from localhost ([::1]:51392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqsR-0002Dn-MA for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:04:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBp-0007z0-Vg; Sun, 22 May 2022 14:20:33 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47874) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBo-0003pl-Iy; Sun, 22 May 2022 14:20:29 -0400 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=71d35CBsgISWSQOprS2V351VeSYus1+Hg2yafeitT/I=; b=IaYL6kxaISiV4DQSO6/fFWKf+Y QmfUySIvz3yv+u3b4+CoSzc19wbTmIZN/iEU4wpnh0vW2Lo1VSY9GbI/TMTfH9R4a2JbV5TO8eXnv oXPO3ieRMiKKim0gdRWq5cu1BdvwtY4GzO4RZaNl3WmpL43C3bw5sk5BF+tdp/XHhLbAVbkAUg7xG XJyFbG9KgX0V74BeL6ZnVN1ylPGhwNyy5iiHtO/LTHfw/Igwmgj/duP+mrW7Dum3VjOy/3rHduj1J yNTM75zCAVSBRfrPYFGdRV2jNnRnCfILm1LaGfgUUP0goenrd0Nffp3suVCCTdFJPkRfma4/7Vny/ C0UmJtX+FEcZCMr15tKfq0fdHfdXeb9cAzX+A44OLYLC/AqzpK6NHwVCvfBrTzDr5lxqalg/FwtCz pGxSjCj4IlqhYbsgUCmzc9xVprvG6LLKxmQ5lNtVxYGHokxxmcsMTnLzuW+4Aja+Q7+d/xS6I5Iv1 kCeqeOf8E2I8a2A2pDaGHFVTPR2Y0hwnHtzSuzVLulHal9L2WgzDugmtQoK3rJb+p6pRdZ732JJei hLh5O+M+/REu6WNxP53VOeMpqNZs8viEKa99IsqKQhS/MXWbOxQUV2Mc30n6Cknps+OBmiVSnqaBj Dswm0mSSxP/HWVN0UrSqia8/aHBnmX2GS7NnLPVfc=; 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 1nsqAM-0007pH-II; Sun, 22 May 2022 19:18:58 +0100 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: Sun, 22 May 2022 19:18:16 +0100 Message-Id: <20220522181836.864-31-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 30/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 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 7f3578aa4d..1c61c55123 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -684,6 +684,9 @@ 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); + + ks->kbd = ps2_kbd_init(kbd_update_kbd_irq, ks); + ks->mouse = ps2_mouse_init(kbd_update_aux_irq, ks); } static void i8042_mmio_init(Object *obj) @@ -724,9 +727,6 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, s->irq_kbd = kbd_irq; s->irq_mouse = mouse_irq; - s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); - s->mouse = ps2_mouse_init(kbd_update_aux_irq, s); - return I8042_MMIO(dev); } From patchwork Sun May 22 18:18:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634328 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=TsYzrmtT; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qVM5wQfz9sG3 for ; Mon, 23 May 2022 04:58:19 +1000 (AEST) Received: from localhost ([::1]:40338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqmP-00025o-Sy for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:58:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBw-00082q-G8; Sun, 22 May 2022 14:20:36 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47884) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBo-0003py-JS; Sun, 22 May 2022 14:20:36 -0400 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=PPN6jbft81bAGJphsFLXBpXRnqk5NMJmqaITu3n369E=; b=TsYzrmtTMCBvOPw5duAMbLCtmf SzvzYGeiTGa3S5ypQ3kPCA6dbcJO+GNdimqD1ncxSoWY3WywC3KQAw+k9zN0eGD/z5FERqnXOV4NJ HPZmswVWFGkCXEcXjA7CGXD04TSnCGpoExWyKlRFM+hGWCBUjls2yCONGquBnehxVhCJwzxb/NCLB Z7AwnfmGBOLn30sXsyeXzZoovbYP3kCNqoNBees76Sr+l3ECQRCxAYVO8Ft1K7JRhjNFqoMwR2OLe vr/lWB3+/UaKRhoZL25U8rGHvdbk/zKA8smWg9IOysZgho/2p+LeZh+fe8xfMLyKf/3Dlm2IEXS0z IPIjb3ENno8V7be1ovMxMLB7kEfctYWP7mgspSulSEuKNaS5+y+JrxYFIR73CV3FKtJo2/iP22yOw 1cOh4UempOhMkNjYRrT7jp075MPln7QYEjdZH9uqfvG6pGB+ec+x/971VMqa7NiISSAhplADl/6hp PI/MmfRYXrpB2UvSxaO2eWGaMzf8FHHYPN4Syy3vfsFnrwFiF3IwWA1rq4yqaVp2INtgVz/UvwBWC o+c7R/wlkV8NNLYI4YycVQqBpTu5rNibIUdSz1lGV6rtYTL6CQ4ESaJ0qKv/ZsvXUPJ8betvOwJau +CRKLwCgw7f+oDvsD05BFNFV8XWMYcboVIpwQOWmQ=; 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 1nsqAM-0007pH-V6; Sun, 22 May 2022 19:18:59 +0100 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: Sun, 22 May 2022 19:18:17 +0100 Message-Id: <20220522181836.864-32-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 31/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This function is no longer used outside of ps2.c and so can be declared static. Signed-off-by: Mark Cave-Ayland 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 e3ee69870b..8b76ce1cdc 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++; } -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 4e8de912c6..d04d291287 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); From patchwork Sun May 22 18:18:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634334 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=huIMNZoD; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qk568NMz9sG3 for ; Mon, 23 May 2022 05:08:29 +1000 (AEST) Received: from localhost ([::1]:54824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqwF-0004cD-Hc for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:08:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqC7-0008Im-7M; Sun, 22 May 2022 14:20:47 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47890) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBo-0003q6-S4; Sun, 22 May 2022 14:20:44 -0400 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=3A7i0Kme/mlZT1wSvyyrCrdhe7oXf3JQeJDZbBncgTk=; b=huIMNZoD3IXENr1h6JNf52qac9 5rUEtYH175DtqTJ1v+5/GxKCVu2SYY1GGwg5tFdU3j27gw6+nmoQp9Tm3pabUeU1MDNabWjzcCx06 NimoytEV9hgAA+8vPwBTX+oDNbcUg9ailmYh2BonPMAuHEQLesvVl+OHV3MxsxoDY4CVaw+A9Oyit oGaRwK5zbS+gVMuMFn/4cjLTYeXf0UAwCLUJ23JhWPR3HY6RYIOUxDJDelKE8b64UDYIT0JKqXZLS CseYcjD/uTeEDdH1l/8AHO9MIDczsA+WI38AQMMiJUe+hzVD7W+W6GmsM83YmECwlhLI0eMrFn4I7 pgBzZiOjhYhAghwoiMEFcNDFNfRvb9SK74AjoU7SpkY4a9jgTTVkiYfc4oGrXtezdu+6ItyY5bGeb uZ1KRvHGtIXpeH7Amu+e63wte6JMEIgfwTkISh/qbZMa2gKkgqgpAx/GUVMu6JFdUDIPBWCpIItwo 83YngRIkJ8zvX17vP8EuPgnNS8aN/CX/5NqEcgw+2aYOlh2PmQAbxpdz+1+yN+scskfh+TMEIk+MS m5pt0NQziowWOsezJcReSU0WD+ktPAffEAH30QWCfwYXPie/ONR1rPnRwahmimD2WYKejfXnLqokH /OvidLtPNnYpAVj62WalhkCCUUlwqmnGlOrxEXbyA=; 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 1nsqAN-0007pH-Hm; Sun, 22 May 2022 19:18:59 +0100 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: Sun, 22 May 2022 19:18:18 +0100 Message-Id: <20220522181836.864-33-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 32/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This consolidates the logic of raising the PS2 IRQ into one single function. Signed-off-by: Mark Cave-Ayland 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 8b76ce1cdc..55a2ac08c2 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; From patchwork Sun May 22 18:18:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634341 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=zTKmMvux; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qxw29Smz9sG3 for ; Mon, 23 May 2022 05:18:44 +1000 (AEST) Received: from localhost ([::1]:47590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsr6A-0002sl-4D for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:18:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqC7-0008IG-4C; Sun, 22 May 2022 14:20:47 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47898) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBp-0003qA-6I; Sun, 22 May 2022 14:20:40 -0400 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=AaAUTlhTqrpPSPZnLu5z09pTzeglbwj2cDCyzCng+VQ=; b=zTKmMvuxEiLZSPFdHHemaL/4vN wsLPCxLJ52fkP7YxBqNv1Sz084RaEMBTZHNT6nBQaamsMyKhP1aFqqtVc5zt+mJMdk3pAP8i1ZD95 vksPP3JZquLXxXW1IsAMtyTZ183j2BwExjowacmiu3WyXGG0TPbGgBy8pWkE3xHa33lEB+o3HmAcj aPEPPvZ/3Bx/bJyHo4aZskb3HyL0yB78mX1Ko77ncZUwlKvNxyUwHS/gWtoeWS7kf1ZAVGaIsAM2t YKPVE0dKsujryZcgjQ/IRz2nMgoptG3Ny2wsofJ+X1r3MQj/XMfbxDnTF7C6fHju7fJA1LT04EtLE 1woc3mSug/o3GgQS/diZtEiR+ziTVRp5SzvL52xfAzZkJ0rUdbIqOZTRJDJckHivOT/oVX8JSFDwE 58jmsT15DVr5dFdH6Inpwoef/KnUSLl0vxmT6PAiHQz22pok98v5rz1Edfkr2HGK0qsptUwn+mWaJ TOW9GF8qyUKiVZOCh+G9XSUcPPO/EFC35VUZo0uMURm2N6zZzuPz6RIWH2AxjDFiMjqBepHTR73Eg laiCrCI1Nvv+IHtrtqR4gyoXHIdkg9fF90pZvYXx7DisrLyV3od/akMsCcfhVDa6PlN3ojr/71nd3 vauDS8OilU/obgCHg4gMQZ8K5UZ9FvygJiRu3C9z4=; 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 1nsqAO-0007pH-21; Sun, 22 May 2022 19:19:00 +0100 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: Sun, 22 May 2022 19:18:19 +0100 Message-Id: <20220522181836.864-34-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 33/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This consolidates the logic of lowering the PS2 IRQ into one single function. Signed-off-by: Mark Cave-Ayland 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 55a2ac08c2..214dda60bf 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); } +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 = -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) s->write_cmd = -1; ps2_reset_queue(s); - s->update_irq(s->update_arg, 0); + ps2_lower_irq(s); } static void ps2_common_post_load(PS2State *s) From patchwork Sun May 22 18:18:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634309 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=IsmYHelK; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5pz93wXYz9sG2 for ; Mon, 23 May 2022 04:34:45 +1000 (AEST) Received: from localhost ([::1]:50676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqPZ-0003VD-Nh for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:34:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqC7-0008II-5U; Sun, 22 May 2022 14:20:47 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47896) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBp-0003q8-0v; Sun, 22 May 2022 14:20:44 -0400 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=lRk97FSn/zFjn/zLFI1vCEGQSUKky7kiDMJ+Xl85PTQ=; b=IsmYHelKcYPaB5QLB9Ynwo5U9q bJPB08YialFfIizV/2xrWopd3twpBZhvo48bCoByMn33IURY+YxFGpbe+ijIHb6Kr/Tl6G8WroKO9 Wm15XFNTi3stXBZHalwFP2I65mX4B6WYKWCnHLtlHN3VUBrL1hJ1Lo/xVuEwSPridU1SaHAf/IhRA nNkANf9waIVI+jQUEv6rBggrj19z1yhR1AvCOysAE5l80vM/g8fB1HeAk+LkKU/hP6eqnMzABgN+d 4U9VNUYUnDKb3q+8gFLGqr7CCWbUziFJ/PEMUHQ7ckEVRRvUZyrFVuOdjF6R9l3ODv3Tq3a9CPA9S Us+vLRLfgZh7J0CBxkrulbCT56Cf072D0mmeyxXx8SxCw42JQ584bTdirpKc73yTqD15Et+k9xwRe VP8thI1dSnIVDAv03nI2kRefxn0heUqcL5TyIT0SaZFsRY0fihhw7/M5+LXGCL9fRzJsLuryB4tDv Zs8Qh/tU8mBPXOdeBUOYDGaRtyvFZ8DrBKFz+oX6uAqDdWfenLTdAEBUnkFXxWMAIRC9jr0qDl8n2 yzUMzCMu8AZN49UOp9VK4cEcZI++XJ6P/7cFAv5++ik0WxqMD3o3Ti7PWZLnOVDXbyzY2/bESnrFF 2K0kd4MR8I2qyi1anqMx8xCs4EQmYcHJlrQxi3T4A=; 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 1nsqAO-0007pH-RM; Sun, 22 May 2022 19:19:01 +0100 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: Sun, 22 May 2022 19:18:20 +0100 Message-Id: <20220522181836.864-35-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 34/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Define the gpio for the PS2 output IRQ in ps2_init() and add logic to optionally 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_irq() function to use gpios instead. Signed-off-by: Mark Cave-Ayland 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 214dda60bf..891eb7181c 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -24,6 +24,7 @@ #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) static void ps2_raise_irq(PS2State *s) { - s->update_irq(s->update_arg, 1); + if (s->irq) { + qemu_set_irq(s->irq, 1); + } else { + s->update_irq(s->update_arg, 1); + } } static void ps2_lower_irq(PS2State *s) { - s->update_irq(s->update_arg, 0); + if (s->irq) { + qemu_set_irq(s->irq, 0); + } else { + s->update_irq(s->update_arg, 0); + } } void ps2_queue(PS2State *s, int b) @@ -1305,6 +1314,13 @@ static const TypeInfo ps2_mouse_info = { .class_init = ps2_mouse_class_init }; +static void ps2_init(Object *obj) +{ + PS2State *s = PS2_DEVICE(obj); + + qdev_init_gpio_out(DEVICE(obj), &s->irq, 1); +} + static void ps2_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -1316,6 +1332,7 @@ static void ps2_class_init(ObjectClass *klass, void *data) static const TypeInfo ps2_info = { .name = TYPE_PS2_DEVICE, .parent = TYPE_SYS_BUS_DEVICE, + .instance_init = ps2_init, .instance_size = sizeof(PS2State), .class_init = ps2_class_init, .abstract = true diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index d04d291287..6e5c404cb5 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; +/* Output IRQ */ +#define PS2_DEVICE_IRQ 0 + struct PS2State { SysBusDevice parent_obj; PS2Queue queue; int32_t write_cmd; + qemu_irq irq; void (*update_irq)(void *, int); void *update_arg; }; From patchwork Sun May 22 18:18:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634331 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=I1jUMdvC; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qbk3PYGz9sG3 for ; Mon, 23 May 2022 05:02:58 +1000 (AEST) Received: from localhost ([::1]:47794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqqu-0007PV-H6 for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:02:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqC7-0008IH-4s; Sun, 22 May 2022 14:20:47 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47904) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBp-0003qK-Hc; Sun, 22 May 2022 14:20:44 -0400 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=vmfTzBu0WqXvpdSNe78zL/FGTgctRuAw3Wsuyq2/YuE=; b=I1jUMdvCN117FwFuGrA1hE6bK2 cRweCqvz9twY6z2x4xN9ky3R1Kbzn4GOXpw/7avht5SBb/mVAYpXfaT1xHRIwvkMsctAIsW9Ofeco rpq5aZQ+OdGF9m3HoSi4hGgPkntClObgc1+G+5icrRZdh51ypoxN7og2viyudDeFPPvoqGX4dKwne ZBDThPxrlHyJ46RH2cZSjNaaxboaxRtdzl0+gEdE65sxHdCA3/kus68pJmOdRPFhkqrAO26fT2wFH sVpPuyapAE+57jklZHChVG1zqY71D4eacSOImhz/K+Emwr9hliqaVKUunVyZZ9OPNILnQecdayCaR 4uhywbFVyuftqGu2439weY4oJMx9n85svx7sMzvfY6K+X9a8zPQmDFlfLMQ2cMcoF5SO0c0ok742E MI+d2TI81Q/NZkc/bY5gXrtEK7+UdPrbacCnvvSkRTNmQt9QyDQtGguBO4LfqUweCbssjh0sz9Twu sR/g5s9pIj7w2tSPjdt79gImljyg2J/1Hf96EZNEwzaIP0qdUYD09W5WKFBGCwb53QfT0wlYknG1x eZvWywmL5gmyqWpJRM/xrl3rWJH2hR69Vnm2/BByR/84VmbheowlCmxzdsDp5f44DAYmfkVOvTKu5 cnRuwnzhFudfWi6occchNkvdYuIw6sXhRkKZDnWMo=; 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 1nsqAP-0007pH-GO; Sun, 22 May 2022 19:19:02 +0100 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: Sun, 22 May 2022 19:18:21 +0100 Message-Id: <20220522181836.864-36-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 35/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This allows both IRQs to be declared as a single qdev gpio array. Signed-off-by: Mark Cave-Ayland 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 1c61c55123..90acf0dd6a 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); } static void kbd_deassert_irq(KBDState *s) @@ -724,8 +724,8 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s = &I8042_MMIO(dev)->kbd; - s->irq_kbd = kbd_irq; - s->irq_mouse = mouse_irq; + s->irqs[I8042_KBD_IRQ] = kbd_irq; + s->irqs[I8042_MOUSE_IRQ] = mouse_irq; return I8042_MMIO(dev); } @@ -811,8 +811,8 @@ static void i8042_realizefn(DeviceState *dev, Error **errp) return; } - s->irq_kbd = isa_get_irq(isadev, isa_s->kbd_irq); - s->irq_mouse = isa_get_irq(isadev, isa_s->mouse_irq); + s->irqs[I8042_KBD_IRQ] = isa_get_irq(isadev, isa_s->kbd_irq); + s->irqs[I8042_MOUSE_IRQ] = isa_get_irq(isadev, isa_s->mouse_irq); 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" +#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; - qemu_irq irq_kbd; - qemu_irq irq_mouse; + qemu_irq irqs[2]; qemu_irq a20_out; hwaddr mask; } KBDState; From patchwork Sun May 22 18:18:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634338 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=CGlwafyV; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qtY37Vzz9sG3 for ; Mon, 23 May 2022 05:15:48 +1000 (AEST) Received: from localhost ([::1]:40198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsr3J-0006HO-87 for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:15:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqC0-00087V-7C; Sun, 22 May 2022 14:20:40 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47924) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBy-0003r4-LR; Sun, 22 May 2022 14:20:39 -0400 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=v5C0a0NiReooURhc8Z24Bys3bwXGa12fpFlV54o44Ms=; b=CGlwafyV52cPesWj4uaqP4LiCZ ku1AC5i5lh1V8CDdE5um2VbQ6YR/rYIe0rJgJ+RBpTvaL/hjUPmJTf/GZlZ/l2hl4QB0Sy3EiWkFX 1Qn1LRPTRe5B0+Q6pPRY6MrvGFI5Lbn2QB39AICJcFghLU84/rvjphb1DIdryGe+1Ehr52TtSgLwF sgujo8e37bIY3LmrineqrdLVORfCf8AXT1YMktCp9YRdYaRHcWXWblVld9Vd0AASZ+67Q9thvXswQ ppdW2bX98OMyhPQZ06uzZD+/jbsF8ypEQflTZxnX2MxNowIsy7YwnYYWocpweSXUuvCFrRxXT+LrC 6F/LiR9n75Pge41PkNGElU/oOAEeJBmlMDBx2moi9Nw8PjGmld7zJ2pqw5NXH66TiIJTEokNzxOKo E13C5paGkPY3wFT/uNtknZmYHreyharsFESqwWJuIgXgeHkIYmU8QHT3BYR+9N0kt7/wqCNykpu9t y6EOM3gyAIIJi8W3uJBrHFGZ6nxfwF8STMb1H0d5nJVuB04U5rOsUU6YjoWI5bcWDsd3/1H8vsYUB DAJa21nfTSQDuUK1lacDyiiSkBzMUMljZQmGfeqAEN0tswo5lUtyJzM3XHVFTAyHNwx2ufQpQebOD /8yPUSbJTdpj4F9XcCwPP/KZkV1MTsGLxaxFLMN0U=; 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 1nsqAQ-0007pH-Ni; Sun, 22 May 2022 19:19:07 +0100 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: Sun, 22 May 2022 19:18:22 +0100 Message-Id: <20220522181836.864-37-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 36/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add a new pl050_init() function which initialises a qdev input gpio for handling incoming PS2 IRQs, and then wire up the PS2 device 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 --- hw/input/pl050.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/hw/input/pl050.c b/hw/input/pl050.c index 66f8c20d9f..fe6a281307 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -32,6 +32,8 @@ struct PL050State { bool is_mouse; }; +#define PL050_INPUT_IRQ 0 + static const VMStateDescription vmstate_pl050 = { .name = "pl050", .version_id = 2, @@ -65,7 +67,7 @@ static void pl050_update_irq(PL050State *s) qemu_set_irq(s->irq, level); } -static void pl050_set_irq(void *opaque, int level) +static void pl050_set_irq(void *opaque, int n, int level) { PL050State *s = (PL050State *)opaque; @@ -164,10 +166,12 @@ static void pl050_realize(DeviceState *dev, Error **errp) sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); if (s->is_mouse) { - s->dev = ps2_mouse_init(pl050_set_irq, s); + s->dev = ps2_mouse_init(NULL, NULL); } else { - s->dev = ps2_kbd_init(pl050_set_irq, s); + s->dev = ps2_kbd_init(NULL, NULL); } + qdev_connect_gpio_out(DEVICE(s->dev), PS2_DEVICE_IRQ, + qdev_get_gpio_in(dev, PL050_INPUT_IRQ)); } static void pl050_keyboard_init(Object *obj) @@ -196,6 +200,11 @@ static const TypeInfo pl050_mouse_info = { .instance_init = pl050_mouse_init, }; +static void pl050_init(Object *obj) +{ + qdev_init_gpio_in(DEVICE(obj), pl050_set_irq, 1); +} + static void pl050_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); @@ -207,6 +216,7 @@ static void pl050_class_init(ObjectClass *oc, void *data) static const TypeInfo pl050_type_info = { .name = TYPE_PL050, .parent = TYPE_SYS_BUS_DEVICE, + .instance_init = pl050_init, .instance_size = sizeof(PL050State), .abstract = true, .class_init = pl050_class_init, From patchwork Sun May 22 18:18:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634343 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=OhmwKAKX; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5r1r5D97z9sG3 for ; Mon, 23 May 2022 05:22:07 +1000 (AEST) Received: from localhost ([::1]:54094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsr9Q-0007GJ-DR for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:22:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqC7-0008In-8F; Sun, 22 May 2022 14:20:47 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47942) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqBy-0003rH-Ly; Sun, 22 May 2022 14:20:41 -0400 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=CkGI+yMYz98UoKIk+686p+wq9HrH384uQjmkoONqm1M=; b=OhmwKAKXj3BwPtv+4dnZWdKSIj jXrC0TKGVlE+EZK3qBsUPEG8yWIYdaVNletjtr+pnkJK4rgrN6G9zhUR0/uVKCjPgRplFjiV8Ti0D ozu/dKVH1Z/ja4teFarx/lAn8SFHN3JYjqeWaku6dr+mrRuEIKKcf+eu2vFt6/iJjsPXGjDQf3Tef /IksOk1hdgD8reXZlk1NK3PuCUgrntneSrupNROR3VvbsRy7WlaIDrJOGYP++KTJDiu+4F1BvVjmO DivHHUgTxevXbmvGHxinUUStuerC5c8SvUtfeg15VYe1ikQHgRO2TFO1Q7PZ53R7IbOAujHDcBHM3 QUGlopDCNVdtJQKEnH4F3lkG6FHLB+rgpsU/gCKyq285bVblXvKMF8twTbodKNSzv+CIteUvVmxnw sPaqoxrDWmjYSRckCDIKqkykkjXfZNor59m6T4wHvEB9PTRH/GLtw3+aMO3X33MrhsuhGy50Rcapp fz5Hz1+W8BESW56gUuPCd68IWJnFlc+6A/dzg4RXwKoeuG3zJPuND3UeAl4Yg6fwV9R7YvHhYiEMr H1jkK3SM/Hh3RLn+RbzAy18JNWdfZ2dXjbu3pJQJxCvPV0knODN4VAQSeGHY7aINg7rOZ/fX1bg5M Xq4T07qlavKeyzaNuJESLU+671Q6QtSSZOCPG2DR4=; 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 1nsqAV-0007pH-Cc; Sun, 22 May 2022 19:19:11 +0100 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: Sun, 22 May 2022 19:18:23 +0100 Message-Id: <20220522181836.864-38-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 37/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Currently lasip2_init() creates a new LASIPS2State directly which is used by the HPPA machine. Introduce a new LASIPS2 QOM type that will soon be used to allow the HPPA machine to be wired up using standard qdev GPIOs. Signed-off-by: Mark Cave-Ayland 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" struct LASIPS2State; @@ -45,11 +47,16 @@ typedef struct LASIPS2Port { bool irq; } LASIPS2Port; -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) static const VMStateDescription vmstate_lasips2 = { .name = "lasips2", @@ -265,8 +272,11 @@ void lasips2_init(MemoryRegion *address_space, hwaddr base, qemu_irq irq) { LASIPS2State *s; + DeviceState *dev; - s = g_new0(LASIPS2State, 1); + dev = qdev_new(TYPE_LASIPS2); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + s = LASIPS2(dev); s->irq = irq; s->mouse.id = 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 = { + .name = TYPE_LASIPS2, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(LASIPS2State) +}; + +static void lasips2_register_types(void) +{ + type_register_static(&lasips2_info); +} + +type_init(lasips2_register_types) From patchwork Sun May 22 18:18:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634336 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=U782SKjS; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qpK2Czcz9sG3 for ; Mon, 23 May 2022 05:12:09 +1000 (AEST) Received: from localhost ([::1]:32932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqzm-00019v-Pn for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:12:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41876) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqC8-0008PE-EC; Sun, 22 May 2022 14:20:48 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47958) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqC2-0003rn-J7; Sun, 22 May 2022 14:20:48 -0400 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=q1mWXyKVm23D9a+kIqZwF+SZSIhBaIkVTJQEp4eeW1I=; b=U782SKjSuYvkNsiEguE9+rIq4C EiFKPj7cE51zn6VHlMYsUFC7m2ocQIX3JI+GtB0muUEYLmS/c7yWzT5AkhWdlYvOqVg4dTKOW00Ru Sd3KcyBhKap7XEOKrGXu59T+zPfuPnllpfGNIsIeas/K653NmWEeOIoKbkk4hcZlNf3LFE4MGe8jZ J0lTc2YkL/S+jYmPbysm1xQFfs8xLyQPmMDA6vgZoHciCm2AJb3l83TA4nX5g+7odkgAiaWFN5ubA whQwoJetUrVHR72dyjLWcRF8rUt2NjE7BKrRwEIra4WllY5nhNUIHcSQ3lJ8bgL2YeHXZVyMLe64T ZBVhk7OGYkO4QPxREt7S4CzEA/VNh2KNyECM+vz6vm97KRyGqf5DA57/n14KUNnFrm0ulT1K7j4Kd QhbwudJwlrHd4gtfLNDXwi3g/m+VU6y6+vRPJKDtFh0yj0peBAvkexx2BNnbMM6JXA7NrjETozYoZ 2o2Ux+m2Fd3uP6ONSZxlBm54D34zYLxEIQJ4fkwpUtEtMxDVdXrZdyiaMLZB7oQxj3AZAc9aigBQ4 XfkB8wqUKZDW0oCxN9MbYaga7g2E8zXVWuftFlSJirPpYoJRO+Nw88wA5/hkD83sDxbfqhzzvlcm+ 936woTsJ4gr2SYCC50Bw/D9u57KPpRCZVXMl58dMg=; 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 1nsqAZ-0007pH-PC; Sun, 22 May 2022 19:19:15 +0100 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: Sun, 22 May 2022 19:18:24 +0100 Message-Id: <20220522181836.864-39-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 38/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This allows the QOM types in lasips2.c to be used elsewhere by simply including lasips2.h. Signed-off-by: Mark Cave-Ayland 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" -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 = { .name = "lasips2", .version_id = 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 #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; +}; #define TYPE_LASIPS2 "lasips2" +OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2) void lasips2_init(MemoryRegion *address_space, hwaddr base, qemu_irq irq); From patchwork Sun May 22 18:18:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634313 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=p9hWrRDd; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5q3T0MZ7z9sG2 for ; Mon, 23 May 2022 04:38:29 +1000 (AEST) Received: from localhost ([::1]:60328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqTD-00025M-53 for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:38:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqC9-0008UB-Lf; Sun, 22 May 2022 14:20:49 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:47984) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqC7-0003tR-0T; Sun, 22 May 2022 14:20:49 -0400 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=4369/+BRUuRdx7Ea5h7jsV2hi+E/Iuo2IKmZnun7sfo=; b=p9hWrRDdD5Uq0Ld3CtGXWqTnTz isFDeNcO4t2OcRI8EcfLupEIWB2KUjkEKg7QDoNbSzElLvcsa7ol/P0MxWhD9d9Ek2QJeIJIsqh3u 7yspq9dU1x1qCoiHQ2Q/geFQBldS12kJnd/sjpe+Sk8mBibbrS4zM3LeUXgAa3rIJ03DDvfzQUE6b p+5/BG5O2zo828pZxALAwxF8m1Qowrte3M0hTQiRi6+91LVHEKtOtPVvNq32bvSwc/h/55D33L75W RppwX9UEnysxHKW/9PEMXIddW01gDRVKYOvrADovTrmOVh4F/+4ZWV927nZmyjTrOlt5a97zfv/Q/ IxxCOTX0XEnRkJWb0Z05Vln/JtFf00aeOyA9joR1cC/6+HXW73+iZcxQ5c2OKKEHikqC9AAcMKltw WwsrWualrSR7BsAosm3D2n7fjOdwc1NMNkqIvwtmd/U3DzjuEhQt47AxsQA/T1l5OnmLRNKY++P4C kONl/zuEoSW3ZC9Bns6S1RfLfWPBtCcsvP72ouZ/gtnVCyigyMeXcYmUz7XCaDqK7ddzs3dDns+2L brprqXbra0UOlcibeW2epe5hLv+s592KOA9ZPuACHZZNiY+Wp0fbXPCCnqLyAKqpzgIKfJvdUgCiv u7vR0EMatAcUr2d3x8EpCMF9QgUQeWyFFlOBSuuk4=; 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 1nsqAe-0007pH-32; Sun, 22 May 2022 19:19:20 +0100 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: Sun, 22 May 2022 19:18:25 +0100 Message-Id: <20220522181836.864-40-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 39/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 LASIPS2 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 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 d1e174b1f4..1fceaf2072 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -286,8 +286,8 @@ static void machine_hppa_init(MachineState *machine) } /* 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)); /* 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 level) lasips2_update_irq(port->parent); } -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; } static const TypeInfo lasips2_info = { 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) -void lasips2_init(MemoryRegion *address_space, hwaddr base, qemu_irq irq); +LASIPS2State *lasips2_initfn(MemoryRegion *address_space, hwaddr base, + qemu_irq irq); #endif /* HW_INPUT_LASIPS2_H */ From patchwork Sun May 22 18:18:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634339 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=KuUQF+bC; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qtY3tbDz9sGk for ; Mon, 23 May 2022 05:15:48 +1000 (AEST) Received: from localhost ([::1]:40296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsr3K-0006Kk-7b for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:15:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCF-0000Jz-3d; Sun, 22 May 2022 14:20:55 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:48012) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCD-0003tv-Gc; Sun, 22 May 2022 14:20:54 -0400 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=sbodoDa8JDX1gNpEqJ3MvNbpgkURXoHQmkFtJpu6OY8=; b=KuUQF+bC7jav0jH7kG7WcVBqLj ZXcEhtyXPN0zJgtiHpkLwoacUgsIi/uKTLkC3YNjmAe2sCqLkDOh8ejEKKF0NqLuRPQRLDP7/mBPL L7vRMK1sL5l/v2cI7aRI4r2psTWNj8PjlmDnvMffyKB4fgnP6LteRBAveRwvOPiSa5n++RaZRsiVF XVy4XWD3agXVfuFcWPrg1Q6ZfnOztjwA7IK2mXPAn7eFYeA4oifTn7tEnypzU8Le9nIJnCdPSYlS8 j/h8KEDQSTIdywHRdqW65r/Un1Q5eOPD1h0sE4U4E6CGLXcs1gGjmkL2rcLsFU9jXY6ChWHNzF/aL ur7tZ12gaGmjef/B2HZz3pk3/Y2e3MLmxG9trAqI2i/oBMgndk3oAQyaUVTl5XobJFrELCX9Oki27 z+0ZKt8ZIJuhLOmQfgfel6BA3M3sayq1zFxmxEhAKm1IFuqp1kJeBNMJhMdw1WZRFwLls/0mZKOAJ kmj/HKZCXxF/k+O22ZywJjH5DIVai/iUdrJWqiApPe6/AK9N8dCQJxMZArGwt7OseiU/Ilka0Dx5c nj6YJ1IMVfkEt76fQbGW4ytlQUR1oYSdsTfCVu3lW03DCpwTH8DJop9BPFbcvGdxs6/uYQ4U0R8Wk +NpfIZNV9Nyx0C2I89H/y+I14ZCQaCxuE+H6ta05s=; 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 1nsqAi-0007pH-Cq; Sun, 22 May 2022 19:19:24 +0100 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: Sun, 22 May 2022 19:18:26 +0100 Message-Id: <20220522181836.864-41-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 40/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 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_space, s->kbd.dev = ps2_kbd_init(lasips2_port_set_irq, &s->kbd); s->mouse.dev = ps2_mouse_init(lasips2_port_set_irq, &s->mouse); - 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); - 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; } +static void lasips2_init(Object *obj) +{ + LASIPS2State *s = 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 = { .name = TYPE_LASIPS2, .parent = TYPE_SYS_BUS_DEVICE, + .instance_init = lasips2_init, .instance_size = sizeof(LASIPS2State) }; From patchwork Sun May 22 18:18:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634346 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=PrQUdp3+; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5r6X1TmDz9sG3 for ; Mon, 23 May 2022 05:26:12 +1000 (AEST) Received: from localhost ([::1]:33774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsrDO-0004ej-7c for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:26:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCF-0000KV-6J; Sun, 22 May 2022 14:20:56 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:48014) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCD-0003u3-IV; Sun, 22 May 2022 14:20:54 -0400 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=5nK8g1J+aM772UuMRFtM9t2Nf56o9ekowPA8C0gSulQ=; b=PrQUdp3+BpLkaOJaoVK6Cf4/SA NBQh9btOEA2i0mKit/7k9HgosUZb48SIQGhqkvQSG/WAZ+3eC9f/s/v44tX7O1nMaYDe6+MdEepfQ 2OX64Yqk/baFsRZsRwnBFMSVBEdFp1H6ZVjuo5OfdRJ0fvM9K0fD+c4KrmMQGA+Cy7B8oYwzgr0gX AMIo8Y6qBiHp8QZatwB1E/2Ky2FZKD1x2spKcCEJfSw1WcnWScHS8sMiIQtXGCPIL6R+oJDROtUt5 UPD1VQEoaI8G15p5skkGmJLzecG1OKbNE6OvyFpwrIEdRPFxEloFeVMcUQ4Mlzwd6P2C60wZ5WAqy ecTQGtp0w4RWzBCZHiDO9Bk+ahdxkREGnPkYo2uOP/TgVsFv/K5JDqDRCx28QqzNq+20XXGh18h+I e/NZS2O9H1ZluJG0AkD4rQsF00CdkbozhpHBHY5ENOPvADbjKL1phIglQZKkmrrMUYSMitZNPCyjt /yC01ol0ugev4vHfgOCpA+jOmf5bfNW9gCf6G/RDyd5W2wwEbj5gLHkPwgUdtzvC4FO2uvHi+1lAu BxaWg3hf+A5x+kxFVvrWxe0LsR6yljWr3Uyb/yNyJHsRH55aYTSqjMUycF8xbQTuubNhrZfPVrran kVOqVIstHOTLHM0q01G/TQLnO6e3YcANsBw7mZwpA=; 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 1nsqAm-0007pH-O2; Sun, 22 May 2022 19:19:24 +0100 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: Sun, 22 May 2022 19:18:27 +0100 Message-Id: <20220522181836.864-42-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 41/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 machine (which is its only user). Signed-off-by: Mark Cave-Ayland 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 1fceaf2072..f6dd79e211 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -286,8 +286,15 @@ static void machine_hppa_init(MachineState *machine) } /* PS/2 Keyboard/Mouse */ - lasips2_initfn(addr_space, LASI_PS2KBD_HPA, - qdev_get_gpio_in(lasi_dev, LASI_IRQ_PS2KBD_HPA)); + dev = 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)); /* 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 level) lasips2_update_irq(port->parent); } -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_space, s->kbd.dev = ps2_kbd_init(lasips2_port_set_irq, &s->kbd); s->mouse.dev = ps2_mouse_init(lasips2_port_set_irq, &s->mouse); - memory_region_add_subregion(address_space, base, &s->kbd.reg); - - memory_region_add_subregion(address_space, base + 0x100, &s->mouse.reg); - return s; } 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) -LASIPS2State *lasips2_initfn(MemoryRegion *address_space, hwaddr base, - qemu_irq irq); +LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq); #endif /* HW_INPUT_LASIPS2_H */ From patchwork Sun May 22 18:18:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634347 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=X0voVORl; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5r8x5mMXz9sG3 for ; Mon, 23 May 2022 05:28:16 +1000 (AEST) Received: from localhost ([::1]:40766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsrFN-0001CG-6y for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:28:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCN-0000Z1-G9; Sun, 22 May 2022 14:21:03 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:48030) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCF-0003ug-Fy; Sun, 22 May 2022 14:20:59 -0400 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=/KiA1jjRPf96HAVP0LvSIOhp26CBxIEFK5l9CvtOXRQ=; b=X0voVORlFl0xp+ci036YHJhBRN yHC6mbbTKDtrV3qJhDuVwBmSyRCK6bmgF4SpgcTzJwQYkF3gXkOOTud+m1X+PQFfeXYxYq1YbgxGM 6KvtcOR3GMipLo/na0kdNRdr2B9cQWRua6tuyuJc0JxQ2DxJM4d+goGiWgKvei17S7+/mNNR4a3WZ T9bBh7IF9rpWsd6FkWJeVlySl3vv6dXGu/eqqKO6ePnCZCLYGLVtHbbeUSB69GixiJZU0vPQnPYK9 5YrfZNzv0+9+XlgC9BKZ/8qCnVTMEvItm3Wm4dbKt6QgNDEjtP7yCuGpKkhiD8HXtQR3117C+5ZWb M1pUqTOxHP6bxKJuVdo699ejgg2REHYuEVSYKHsz1ysDjrCUAnkhGZ/omJNOB7gdTuXVCJjshMojy 68LV9MjoTP9xCH+G6zAW9CaTl73CwKvTlg1sFIVgpQ4/Ww9a/EtOLN35rI/HOjQe1jBO7vVH2IOFE VHRq8/oahdRvq6qgIe3Uu/mBuDmQQHqMhjeT+nZ0OIShTmHjwizxlbVrnzw4qTC5PzuffmbChZQRq CrKezec9tnye46s2xzpb3OitzyCwCfBPm+9cEPqIrwDtAiaVTbVewxsU5DpmR82iJaZ20CN69DrBv kCl++GrMWbnKsqir6YTUVLL999jRinfQE5CStt/xE=; 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 1nsqAn-0007pH-4u; Sun, 22 May 2022 19:19:29 +0100 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: Sun, 22 May 2022 19:18:28 +0100 Message-Id: <20220522181836.864-43-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 42/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 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 = LASIPS2(dev); s->irq = irq; - s->mouse.id = 1; - s->kbd.parent = s; - s->mouse.parent = s; vmstate_register(NULL, base, &vmstate_lasips2, s); @@ -271,6 +268,11 @@ static void lasips2_init(Object *obj) { LASIPS2State *s = LASIPS2(obj); + s->kbd.id = 0; + s->mouse.id = 1; + s->kbd.parent = s; + s->mouse.parent = 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, From patchwork Sun May 22 18:18:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634340 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=hYc0pNLK; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qth2s14z9sG3 for ; Mon, 23 May 2022 05:15:56 +1000 (AEST) Received: from localhost ([::1]:41004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsr3S-0006ol-Ep for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:15:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCP-0000bv-CK; Sun, 22 May 2022 14:21:05 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:48094) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCN-0003vK-RQ; Sun, 22 May 2022 14:21:05 -0400 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=gDQMPCwoNsXTyxU/r6lvoHHKbKvPI1252JkwrN27jy4=; b=hYc0pNLKbXLqdGjeg6TCsAA9TO EnDj+V9xnOfPekAlAMMQZaMmv8oqI1VmZsuBBl+QCh4KFk9IpYOCHiZzXW8NyeUsHrfwV9wNhwW/Q y5gFRHqK/10aAhKTdLlzqq1i5zJ5qbis0928JWJ1x099PS9tI6+ybjPUs4ABJwzyTv+YS+n+gtNvt q/fbvAdGG88boi9//5DVgtj4RIxbscgiPuGcHbi1jWEUjHrEs6exOiBzTOZSk7wD4wAC7B/P2uylr 7I3xk0h7yuPYF473DEvIVEyRefWymO/GEf5lIcRRsecAlAFVXvqh/ISbiV/QM+2HbKipH+hK00G1p Zgc8aABvH3MbE9IWyT+eFC3I4+eQETOZzXgmjY4vGEk405vGoLBDj0MDhywOvOCsRlLnDDAWfrdRp 63tf31RHrnCP41xg/YSUh822yHk5TYslyqU5x0U4er9qckGHmV3b4p6cxX9u/siaPsAbP7vI8/LxN DecgP2egZdb3I4VqLMvyxD+cYBUjD0wTyBw7qupgY0odfkdq9Qf6vUZIUH1Cs96w6RBndLj2wnCJ2 8jGoL5J3UnJtN14W70kGXpR9CEELJ1tLccuDWtUqiACqP0/ElHEKJQ+9EIK/bR0reDF8OCoHb+dUC GiEfZMfKqUnkoSjJze6eBHgID4GLCQqXri3onuEjU=; 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 1nsqAr-0007pH-Ep; Sun, 22 May 2022 19:19:33 +0100 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: Sun, 22 May 2022 19:18:29 +0100 Message-Id: <20220522181836.864-44-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 43/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This is in preparation for handling vmstate_register() within the device. Signed-off-by: Mark Cave-Ayland 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..a7c7192c07 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; dev = qdev_new(TYPE_LASIPS2); + qdev_prop_set_uint64(dev, "base", base); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s = LASIPS2(dev); @@ -282,11 +283,25 @@ static void lasips2_init(Object *obj) sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mouse.reg); } +static Property lasips2_properties[] = { + DEFINE_PROP_UINT64("base", LASIPS2State, base, UINT64_MAX), + DEFINE_PROP_END_OF_LIST(), +}; + +static void lasips2_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + device_class_set_props(dc, lasips2_properties); + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); +} + static const TypeInfo lasips2_info = { .name = TYPE_LASIPS2, .parent = TYPE_SYS_BUS_DEVICE, .instance_init = lasips2_init, - .instance_size = sizeof(LASIPS2State) + .instance_size = sizeof(LASIPS2State), + .class_init = lasips2_class_init }; 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; + hwaddr base; LASIPS2Port kbd; LASIPS2Port mouse; qemu_irq irq; From patchwork Sun May 22 18:18:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634317 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=w/2sVlKR; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5q9L4WvMz9sG2 for ; Mon, 23 May 2022 04:43:34 +1000 (AEST) Received: from localhost ([::1]:42226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqY8-0000hw-L2 for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:43:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCV-0000mw-3r; Sun, 22 May 2022 14:21:12 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:48130) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCR-0003vj-7b; Sun, 22 May 2022 14:21:09 -0400 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=22bIroDhBreWsaaHwndPgcAMeyX+9wuBvAN28qBFq9Y=; b=w/2sVlKRI8mbXml953Tg8Zd9v2 7SEUII3Pa7Onm4HcNHI+kW+1AQ2sHb3M+f7C2atxUiHYK7Y/plWEQ1oMeZg4F+kmetoAr/He1CYfc f8HYMezcsnKbFlZSHnH2mqzH9uUyd4VWiLBbCgkCo2Ds7zx7uJJ8sL8SOwjSfo3m92YUWyG6JZTaY /3mzNPV20av2nV/JfkJmDRfuKXmreDXV1vdLskRkAmf1UsMp8x2iQX8lvArXfD2L5o4+FiuBjgq2W oH4Jzpy83DMqniISz/bMVYxCzZoGniPoAXyB7AvxqyMELs/0vUwRwnDz9sEY+GTZx6RRbSAdhqeQG 8mTUNcEF1m2TNbApIxjtm8L7MDRHblfc3RCyeFdqb6GdWAo+WkbD3Y1G6PCUMU0blys+1cDfMReHC eLqJ2G1mb//qFVn2fc+2kkECnKC7N9KgfMS9QZGPjmwZUwA/sNJA/BL+9M7Rj7YVZJ3G2UfmkqkII SgFlgx7EZk4arxu51kK2UsU1hgUCztJqVezasJT+lrqIamA9vGonnEchsfhom5S1weLQPdhcJDl5A 60WxXyO40UJP6nzCJUmsisFj0g1Xc17qh1cdNPYQeA17sxpYBlMI32bDuizdKHu40+67uBlSQfwoJ wwjsmP/L7CtvPpRmkV9Nj0htLZnJ2rZYRsju/CcPc=; 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 1nsqAv-0007pH-Or; Sun, 22 May 2022 19:19:34 +0100 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: Sun, 22 May 2022 19:18:30 +0100 Message-Id: <20220522181836.864-45-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 44/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move ps2_kbd_init() and ps2_mouse_init() from lasips2_initfn() to lasips2_realize. Signed-off-by: Mark Cave-Ayland 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 a7c7192c07..6849b71e5c 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -256,13 +256,17 @@ LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq) s = LASIPS2(dev); s->irq = irq; + return s; +} + +static void lasips2_realize(DeviceState *dev, Error **errp) +{ + LASIPS2State *s = LASIPS2(dev); - vmstate_register(NULL, base, &vmstate_lasips2, s); + vmstate_register(NULL, s->base, &vmstate_lasips2, s); s->kbd.dev = ps2_kbd_init(lasips2_port_set_irq, &s->kbd); s->mouse.dev = ps2_mouse_init(lasips2_port_set_irq, &s->mouse); - - return s; } static void lasips2_init(Object *obj) @@ -292,6 +296,7 @@ static void lasips2_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + dc->realize = lasips2_realize; device_class_set_props(dc, lasips2_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } From patchwork Sun May 22 18:18:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634344 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=Xqiy9pfV; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5r2p6X5bz9sG3 for ; Mon, 23 May 2022 05:22:58 +1000 (AEST) Received: from localhost ([::1]:55194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsrAH-0008Dw-0i for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:22:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCV-0000mx-3q; Sun, 22 May 2022 14:21:12 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:48110) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCR-0003va-7M; Sun, 22 May 2022 14:21:09 -0400 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=VB3qCQhoVg7ObfQqjCbnzZBOPcxW5skV8GfxSlxj/cY=; b=Xqiy9pfVoVwET7bheU1glHf4yS JZc1/L9HLzR/y/VljWlpRsc9jXvNQL5fCvE+gGC5K1iXy8ExsT6FWTxBIvenH47qLEGUz0Rz0TcO6 Ad7EeNYxmzWkqE3jUP2M3P4oSosdU2BLnPrQ7MpG6jY7tjvyn+np5n/s4zSCY5IY42Zd41Jo7heMJ fJQEexeofsNM69L+qbjTXB1R2bsA42U2OfZWeOdJNRV6v/Ekl+tEIv7gNJJbsIBdvU4DWw9WiO+6V XXMrCBy8VGpyYysscxWxkNvZgU4MHd8A5YFi9kOSve5dewo6NNi3kTYqX+zs2ZhyXCP434iYa6LTm ZDiIWqv6D+V/C5S99J2SPqvFDsXs3fnH5yqOj6nv+AnYhMQldequLl8xBwoXxXbkzHXm0G+oFSMZD NLOr3qJoUyev9Rd926ndtsFYPXGtmvy/79OCme/+OdY3fhaI6/KscmO0g9zRehHqjdIDDEmjiG9W4 O8BcsuEyf9z50M0CWEdcMEZmoF5WZN9mvkLgdoFxgz3Jo0K23PE9P3Ggrr1cX5Y76l0+C1kB/2CVH 9IK7ZpGwpZ4sveljZQnPlS+1WlneUf+RRCTU8XYG+JEJiipDzkcdaMimqWlzYS1Pzgsg3FRjDWPB/ dvyfRXo4VOYa9PVRAdx6CUbJ4qIKzkh+tswFFhtpM=; 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 1nsqAw-0007pH-6A; Sun, 22 May 2022 19:19:34 +0100 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: Sun, 22 May 2022 19:18:31 +0100 Message-Id: <20220522181836.864-46-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 45/50] lasips2: use qdev gpio 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This enables the IRQ to be wired up using qdev_connect_gpio_out() in lasips2_initfn(). Signed-off-by: Mark Cave-Ayland --- hw/input/lasips2.c | 8 ++++---- include/hw/input/lasips2.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 6849b71e5c..644cf70955 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -247,16 +247,14 @@ static void lasips2_port_set_irq(void *opaque, int level) LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq) { - LASIPS2State *s; DeviceState *dev; dev = qdev_new(TYPE_LASIPS2); qdev_prop_set_uint64(dev, "base", base); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - s = LASIPS2(dev); + qdev_connect_gpio_out(dev, LASIPS2_IRQ, irq); - s->irq = irq; - return s; + return LASIPS2(dev); } static void lasips2_realize(DeviceState *dev, Error **errp) @@ -285,6 +283,8 @@ static void lasips2_init(Object *obj) sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->kbd.reg); sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mouse.reg); + + qdev_init_gpio_out(DEVICE(obj), &s->irq, 1); } static Property lasips2_properties[] = { diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h index 7e4437b925..d3e9719d65 100644 --- a/include/hw/input/lasips2.h +++ b/include/hw/input/lasips2.h @@ -22,6 +22,8 @@ typedef struct LASIPS2Port { bool irq; } LASIPS2Port; +#define LASIPS2_IRQ 0 + struct LASIPS2State { SysBusDevice parent_obj; From patchwork Sun May 22 18:18:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634345 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=ZB1AX+um; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5r6R6Qn7z9sG3 for ; Mon, 23 May 2022 05:26:07 +1000 (AEST) Received: from localhost ([::1]:33534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsrDJ-0004UN-6t for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:26:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCX-0000of-4h; Sun, 22 May 2022 14:21:13 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:48126) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCR-0003vf-8a; Sun, 22 May 2022 14:21:12 -0400 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=AgQ9tl8RYsUu/xrIDuheT5/OLJSMhx+JYfeSvd2gKeI=; b=ZB1AX+umsPwc27vHIsLUaRm/qt ug5JJ32cHdjdyDsBO8kzSJ055JPxstbTyUeblWDM893Bn2Z1xtvFbb7m6M37Jc7OqV//Xap2qqtjY P3yXlQYy1OXxx0RyZVWQ1Oa9SI0fwCPGRFNedCu77yPwifXyKGjQ/jcseESKl1ndG1KCuNNNWd9VY tUzZoZX2qSvg9G3Ixy8OAIZ+4HKC7eyhDT22z9lrcOlYfNdfZfW3srE4wYdyddGrkcFIDrEry/qLp /1OJV5r2jZWS3wayjZ+BlZ2vj/C2hiqyGkzvG4iGGgz+QcXeiNXRqiVU16K8kdV88n29oyHbmPq47 R0UtXXRCYrNZvdNBTrU+LW+gl2BNnelGIssK6tZBnz363Zxg6+ef9VthPyfprEH/VdyYzPz2eFSyL FOt7sNl9lFCRBtlBNu93PvEoZJdAWaFLQnGmhBjK7m2ywtQCxnNMHiK11BulTl4qFMBjxYjPMf0y1 P/LqZbe3htHRHHiarmFoxfXVWPXgIyNFr7BoNEpP3ztwgfAiTtDQbCgzmUdLmk9yypjT+Ddd1pY79 sGVlmwS4QkO3Z+Wvu0E/lIyuLLU6X1FjZZbtlufl2DVGpHIFCt98QgvyOz6UyInzO+B4CFm9+hl0Y +bksDiyzQ1OxzwSw+Jt5enTSXmJjCWicMNFZ83Fe8=; 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 1nsqAw-0007pH-Jt; Sun, 22 May 2022 19:19:35 +0100 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: Sun, 22 May 2022 19:18:32 +0100 Message-Id: <20220522181836.864-47-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 46/50] 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 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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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(). Use 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 update_irq() function will cause a NULL pointer dereference. Signed-off-by: Mark Cave-Ayland --- hw/input/lasips2.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 644cf70955..12ff95a05f 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -117,6 +117,9 @@ static const char *lasips2_write_reg_name(uint64_t addr) } } +#define LASIPS2_KBD_INPUT_IRQ 0 +#define LASIPS2_MOUSE_INPUT_IRQ 1 + static void lasips2_update_irq(LASIPS2State *s) { trace_lasips2_intr(s->kbd.irq | s->mouse.irq); @@ -237,9 +240,10 @@ static const MemoryRegionOps lasips2_reg_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static void lasips2_port_set_irq(void *opaque, int level) +static void lasips2_set_irq(void *opaque, int n, int level) { - LASIPS2Port *port = opaque; + LASIPS2State *s = LASIPS2(opaque); + LASIPS2Port *port = (n ? &s->mouse : &s->kbd); port->irq = level; lasips2_update_irq(port->parent); @@ -263,8 +267,12 @@ static void lasips2_realize(DeviceState *dev, Error **errp) vmstate_register(NULL, s->base, &vmstate_lasips2, s); - s->kbd.dev = ps2_kbd_init(lasips2_port_set_irq, &s->kbd); - s->mouse.dev = ps2_mouse_init(lasips2_port_set_irq, &s->mouse); + s->kbd.dev = ps2_kbd_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(s->kbd.dev), PS2_DEVICE_IRQ, + qdev_get_gpio_in(dev, LASIPS2_KBD_INPUT_IRQ)); + s->mouse.dev = ps2_mouse_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(s->mouse.dev), PS2_DEVICE_IRQ, + qdev_get_gpio_in(dev, LASIPS2_MOUSE_INPUT_IRQ)); } static void lasips2_init(Object *obj) @@ -285,6 +293,7 @@ static void lasips2_init(Object *obj) sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mouse.reg); qdev_init_gpio_out(DEVICE(obj), &s->irq, 1); + qdev_init_gpio_in(DEVICE(obj), lasips2_set_irq, 2); } static Property lasips2_properties[] = { From patchwork Sun May 22 18:18:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634342 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=YuadhI64; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qyV39j2z9sG3 for ; Mon, 23 May 2022 05:19:14 +1000 (AEST) Received: from localhost ([::1]:48624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsr6e-0003Zg-Hq for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:19:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCV-0000mu-1O; Sun, 22 May 2022 14:21:12 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:48128) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCR-0003vh-7P; Sun, 22 May 2022 14:21:09 -0400 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=coIhj9ofc3YVuK1SqAVhd2kdOV1PMzgwtNYVNL9vdYA=; b=YuadhI64olPs6G88XdN23rWPuN sLcZ/7aI2NPAAbv5YoPsvdb0bO5GtoUDfVTOqDnYyuikILaKuE5kIEO3xssovASNngmnl3efhG1hD tbCV/H6U5MbGXOAs//MC6vh7xzepZ/j1O2v07tkQ9qeRMjtmY5ETnx62bz87fIzfulP0EV+ktb5Y2 qpb9t1blqXv491D/2pxVL7Z8l4liOsR2SjSHNz0rLgZ5Xk2AOrsnIFby0OvZbfryMU3DGzRS8dc9z e2XiYnLtvY7zP9PhmBK3OOsQ8K6zBlHYu+LH2LSmPtqxuh3L4auhea8ey4G65vUp0L8BlwnuvRhni v6+87EDbn0OMPfvQtqrE9ggkzxCB7+MAt0Yiv9b9iDybwlfK9m5nl2uOMOlSjdwN3f/tKe7AKtrdv rALZbZJZ4tXKr25J7oAAnRGegr96cXVMpZcgkZdsSVCV+rGeJZ2Wa/x2qCS1NppUU7+hDQ+TQPIIR Q3ukDrYqxqS5aQv6e2u03mJlM0Qr7J26PQVHkWeIeVI/HoMoYngvPY4beVwiHsG4Ck8n2m5ILGkfZ QNOCDQ8rwtrVH5JuLqpGGG0Rwxf4B6wGNMHwJ5LryfcqqkXelyF4XrEGGP1zheWupfUY4Ozx4nb+6 lg32Y4B9x0mXYPVDWJ1WTWXcSTCn/my2VehVLEGc4=; 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 1nsqAx-0007pH-AJ; Sun, 22 May 2022 19:19:35 +0100 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: Sun, 22 May 2022 19:18:33 +0100 Message-Id: <20220522181836.864-48-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 47/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 90acf0dd6a..d89efddda9 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -665,6 +665,21 @@ static const MemoryRegionOps i8042_mmio_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; +#define I8042_KBD_INPUT_IRQ 0 +#define I8042_MOUSE_INPUT_IRQ 1 + +static void i8042_mmio_set_irq(void *opaque, int n, int level) +{ + MMIOKBDState *s = I8042_MMIO(opaque); + KBDState *ks = &s->kbd; + + if (n) { + kbd_update_aux_irq(ks, level); + } else { + kbd_update_kbd_irq(ks, level); + } +} + static void i8042_mmio_reset(DeviceState *dev) { MMIOKBDState *s = I8042_MMIO(dev); @@ -685,15 +700,23 @@ 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); - ks->kbd = ps2_kbd_init(kbd_update_kbd_irq, ks); - ks->mouse = ps2_mouse_init(kbd_update_aux_irq, ks); + ks->kbd = ps2_kbd_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(ks->kbd), PS2_DEVICE_IRQ, + qdev_get_gpio_in(dev, I8042_KBD_INPUT_IRQ)); + ks->mouse = ps2_mouse_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(ks->mouse), PS2_DEVICE_IRQ, + qdev_get_gpio_in(dev, I8042_MOUSE_INPUT_IRQ)); } static void i8042_mmio_init(Object *obj) { MMIOKBDState *s = I8042_MMIO(obj); + KBDState *ks = &s->kbd; sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->region); + + qdev_init_gpio_out(DEVICE(obj), ks->irqs, 2); + qdev_init_gpio_in(DEVICE(obj), i8042_mmio_set_irq, 2); } static Property i8042_mmio_properties[] = { @@ -716,16 +739,14 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, ram_addr_t size, hwaddr mask) { DeviceState *dev; - KBDState *s; dev = 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 = &I8042_MMIO(dev)->kbd; - s->irqs[I8042_KBD_IRQ] = kbd_irq; - s->irqs[I8042_MOUSE_IRQ] = mouse_irq; + qdev_connect_gpio_out(dev, I8042_KBD_IRQ, kbd_irq); + qdev_connect_gpio_out(dev, I8042_MOUSE_IRQ, mouse_irq); return I8042_MMIO(dev); } From patchwork Sun May 22 18:18:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634348 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=pfx0CPZT; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5rF46Hnqz9sG3 for ; Mon, 23 May 2022 05:31:52 +1000 (AEST) Received: from localhost ([::1]:47098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsrIr-000675-WC for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:31:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCS-0000ja-OF; Sun, 22 May 2022 14:21:08 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:48146) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCR-0003wY-74; Sun, 22 May 2022 14:21:08 -0400 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=wIsgZdKuzxuxVIE6vIHLiUkAPJTWZ/P6Ag372fXTSq8=; b=pfx0CPZTyEi1YJihxrzf+tFZV+ II5rIbKP0UvdJ7gv28GRiC2v8fDVdLw2XZquYUzYo4KgWFUtkFjogyyUeopiNsZXtIz2FVk3+JN/U QZ9blGwkddhKN9CHiQKGyBudnILd4dDvtYyYJWuc6V+8Kiu4298CAateTaJyLM9k23dx2AAq+Nd05 6EHFWmifNWJT3qmnpVDAeFFEgFHEDV7+7hhsF+T4XTh2Kcuq4b6cVpBo451IDdHYNFZeyI3OFYnXQ 5cY7UBfIQf9pI43tT0/9FJcYjSZ0lhedJxNLDlSkLSGnqxB/GZ4RUW2ZDiBWiGdcPpL4uCV5wQhfR o3clr8ksm86y0vFBTW8IR2zPW8zQZCi6mwJy3UzBvhjXf3ximYO1S4DfpHKwjjkUnyNrNfscwQEGL 32OGoUL3+ze2pYWEoDV5esCCZYc4HKE3+tumMM6sxsEQd209Xbxtzv7+GChCJCPBb9q3nxQQCFRC6 m0xuiVbtFfA8J63uvUOC1UlKMGo15T4fm7l99jfbhLvkUVKm9DOnwQR9TRWSlzPOqOP7mSLHfLKjK ClUJnURSHhVSV0TsN5+D1dX/63bc7i+fQ4+5DXbXPrcnS8fRdewwEuLuCj8ilUtgh4uj+cSwz2qSb MgZOEO0cBpejdJ4JsKbLdThNI3sxbAPKmLVp0C8no=; 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 1nsqAx-0007pH-W9; Sun, 22 May 2022 19:19:40 +0100 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: Sun, 22 May 2022 19:18:34 +0100 Message-Id: <20220522181836.864-49-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 48/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This means that it is no longer necessary to call qemu_register_reset() manually within i8042_realizefn(). Signed-off-by: Mark Cave-Ayland 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 d89efddda9..b2fdd1c999 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -801,6 +801,14 @@ static const MemoryRegionOps i8042_cmd_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; +static void i8042_reset(DeviceState *dev) +{ + ISAKBDState *s = I8042(dev); + KBDState *ks = &s->kbd; + + kbd_reset(ks); +} + static void i8042_initfn(Object *obj) { ISAKBDState *isa_s = I8042(obj); @@ -847,7 +855,6 @@ static void i8042_realizefn(DeviceState *dev, Error **errp) s->throttle_timer = timer_new_us(QEMU_CLOCK_VIRTUAL, kbd_throttle_timeout, s); } - qemu_register_reset(kbd_reset, s); } static void i8042_build_aml(ISADevice *isadev, Aml *scope) @@ -893,6 +900,7 @@ static void i8042_class_initfn(ObjectClass *klass, void *data) ISADeviceClass *isa = ISA_DEVICE_CLASS(klass); device_class_set_props(dc, i8042_properties); + dc->reset = i8042_reset; dc->realize = i8042_realizefn; dc->vmsd = &vmstate_kbd_isa; isa->build_aml = i8042_build_aml; From patchwork Sun May 22 18:18:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634349 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=Uk25omJP; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5rHW5Jhpz9sG3 for ; Mon, 23 May 2022 05:33:58 +1000 (AEST) Received: from localhost ([::1]:50480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsrKt-0000ti-1i for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 15:33:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCU-0000k4-Rz; Sun, 22 May 2022 14:21:12 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:48148) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqCR-0003wZ-71; Sun, 22 May 2022 14:21:08 -0400 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=/7Xk7MW3L+6OR4js6piTEuV3VzyW4LoopXb+vIlieq8=; b=Uk25omJPA4uEfiy46/Qmr/oV+7 kpisCmTUMSRc3PgX/gW65hcmo1++Qmlojbz0c6rVDzXRWU55YFI0oJyKnoVYmnOiugheT5a3x989A oYejaUcmW1KInUH+ar1ibmj94CpT8ZiKMHrqdvYBGGdGcWkv2l2MfGnaF7gxBvFjnl9vNO3EKOLZk MiZyPgB3G3sF/e0B1kPfPzSk4IATbsOMT97HRTUiLYqqkRtgJTWA12fDB4HAloGu0/iLRDWEWSpSs MJEMvueZ+1qbjiP0pzfXkgMIJAVxhiWpU64MFhsZPEmoBGd2NlE1cn7epUHhZbK7EC1RHjsb44/e1 P5FiR7QSv3Y6/PK1c6TWi134CuNf67bf/o2xqT16+HcCN8Q4rcJMtCOLZ+UmQ/LueLbDiHQz+5kxH mlp94tGZv+peuiSnDHCvvQSYfKVFN+FxvkIlGHdpD1yOW9albpWT6tpubQABaAvkOmqTYELW1DRIn xmvSz9RbjsYMLjH/BSJq12KiNYeIHP6TnxoKSUy7makRvoeOSm01xSLMRfbhwumpCZHuyl+0PQ8zo SmPhPK7/z8Yr4wR413+/HGMyg4wVPccljSDuB9+EMcEB/RVtqzbVp63/3Zh5eHok7qJvs1B7pzlE7 J2xJqI8jEu3P4HnH6yUTBsmcKAhrmMXcYffvoaTxg=; 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 1nsqB2-0007pH-9c; Sun, 22 May 2022 19:19:40 +0100 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: Sun, 22 May 2022 19:18:35 +0100 Message-Id: <20220522181836.864-50-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 49/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 Reviewed-by: Peter Maydell --- hw/input/pckbd.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index b2fdd1c999..f1eeab9952 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -801,6 +801,18 @@ static const MemoryRegionOps i8042_cmd_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; +static void i8042_set_irq(void *opaque, int n, int level) +{ + ISAKBDState *s = I8042(opaque); + KBDState *ks = &s->kbd; + + if (n) { + kbd_update_aux_irq(ks, level); + } else { + kbd_update_kbd_irq(ks, level); + } +} + static void i8042_reset(DeviceState *dev) { ISAKBDState *s = I8042(dev); @@ -820,6 +832,9 @@ static void i8042_initfn(Object *obj) "i8042-cmd", 1); 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(DEVICE(obj), i8042_set_irq, 2); } static void i8042_realizefn(DeviceState *dev, Error **errp) @@ -840,14 +855,18 @@ static void i8042_realizefn(DeviceState *dev, Error **errp) return; } - s->irqs[I8042_KBD_IRQ] = isa_get_irq(isadev, isa_s->kbd_irq); - s->irqs[I8042_MOUSE_IRQ] = 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); isa_register_ioport(isadev, isa_s->io + 0, 0x60); isa_register_ioport(isadev, isa_s->io + 1, 0x64); - s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); - s->mouse = ps2_mouse_init(kbd_update_aux_irq, s); + s->kbd = ps2_kbd_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(s->kbd), PS2_DEVICE_IRQ, + qdev_get_gpio_in(dev, I8042_KBD_INPUT_IRQ)); + s->mouse = ps2_mouse_init(NULL, NULL); + qdev_connect_gpio_out(DEVICE(s->mouse), PS2_DEVICE_IRQ, + qdev_get_gpio_in(dev, I8042_MOUSE_INPUT_IRQ)); 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"); From patchwork Sun May 22 18:18:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1634322 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=P5lHKlWm; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L5qHV1ZcCz9sG2 for ; Mon, 23 May 2022 04:48:52 +1000 (AEST) Received: from localhost ([::1]:52716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsqdF-0007uo-Qu for incoming@patchwork.ozlabs.org; Sun, 22 May 2022 14:48:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqEk-0005dm-8i; Sun, 22 May 2022 14:23:30 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:48168) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsqEi-0004Gn-8C; Sun, 22 May 2022 14:23:29 -0400 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=XIPR6lFgwAQaAIhZvmGdJL2uNtDF68AKdSUAgyoWpFI=; b=P5lHKlWmAZnCs3n/WUqAQns9q5 074ZlYcGzKKfxl8Q31bPDlnLYkNx9hYNJp6oeOuJRohXsEfO48wC+XL7JPoyz0KzEqCqppiYe14cK kwaBoFRpEeBVLfKgXCwKXVq5OlX5GIukGGp8VYYSuSPsHWrEOvr3cqws7lb0/iPhdXyUaVsQcZ43h VhmJegQTzihPoJsKvYUL6bOXoQ0G5Yto/ughTtNzMCSxjh7IFPxdeLLAU2chc/nnHanTltv+a5/AX TI9gJcYjCxWrpUUCdHvTFjMCdMy2I85BPjngjR9gR0/aUoj2c2Gcflpw8jZ3pjlNbQiYrtfEXKj1r 1Zw3tpKEvUa2xS195yStmXHelhbxZDc3+3lEDTc+g553HLm3IGTLPdgpOmQceHrc/23vLpFjL6ofR hjQ4jlmeIpzTHkGh31RhKgHTnGh4Bqg6Ur/dEcdJNu49N2J8bzDZAFC4CBaQSkMMTH8GpZZ19DcKr cJdIJy5VRg7LPthzR2/hNbigSeGLqVuAEPHTKqvYj8xN4nBV+ZzeKoRsgkjyPmnb3jS5l9djGOlhU KFC21qndwvef5SIwfh6fOvBvmZRscwVHKVJHWoQWcWd5FyIovHQd3tBobl9t4ah/t4P88s/X6P5+R bOE7LujPjUlI4LzG6AdxynD5uuYsQhSsrQABh1jFc=; 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 1nsqB2-0007pH-Ro; Sun, 22 May 2022 19:19:45 +0100 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: Sun, 22 May 2022 19:18:36 +0100 Message-Id: <20220522181836.864-51-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> References: <20220522181836.864-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 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 50/50] 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Now that all the PS2 devices have been converted to use GPIOs the update_irq() 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 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 12ff95a05f..80ec9891be 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -267,10 +267,10 @@ static void lasips2_realize(DeviceState *dev, Error **errp) vmstate_register(NULL, s->base, &vmstate_lasips2, s); - s->kbd.dev = ps2_kbd_init(NULL, NULL); + s->kbd.dev = ps2_kbd_init(); qdev_connect_gpio_out(DEVICE(s->kbd.dev), PS2_DEVICE_IRQ, qdev_get_gpio_in(dev, LASIPS2_KBD_INPUT_IRQ)); - s->mouse.dev = ps2_mouse_init(NULL, NULL); + s->mouse.dev = ps2_mouse_init(); qdev_connect_gpio_out(DEVICE(s->mouse.dev), PS2_DEVICE_IRQ, qdev_get_gpio_in(dev, LASIPS2_MOUSE_INPUT_IRQ)); } diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index f1eeab9952..e53285a126 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -700,10 +700,10 @@ 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); - ks->kbd = ps2_kbd_init(NULL, NULL); + ks->kbd = ps2_kbd_init(); qdev_connect_gpio_out(DEVICE(ks->kbd), PS2_DEVICE_IRQ, qdev_get_gpio_in(dev, I8042_KBD_INPUT_IRQ)); - ks->mouse = ps2_mouse_init(NULL, NULL); + ks->mouse = ps2_mouse_init(); qdev_connect_gpio_out(DEVICE(ks->mouse), PS2_DEVICE_IRQ, qdev_get_gpio_in(dev, I8042_MOUSE_INPUT_IRQ)); } @@ -861,10 +861,10 @@ 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); - s->kbd = ps2_kbd_init(NULL, NULL); + s->kbd = ps2_kbd_init(); qdev_connect_gpio_out(DEVICE(s->kbd), PS2_DEVICE_IRQ, qdev_get_gpio_in(dev, I8042_KBD_INPUT_IRQ)); - s->mouse = ps2_mouse_init(NULL, NULL); + s->mouse = ps2_mouse_init(); qdev_connect_gpio_out(DEVICE(s->mouse), PS2_DEVICE_IRQ, qdev_get_gpio_in(dev, I8042_MOUSE_INPUT_IRQ)); if (isa_s->kbd_throttle && !isa_s->kbd.extended_state) { diff --git a/hw/input/pl050.c b/hw/input/pl050.c index fe6a281307..3e48fee92a 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -166,9 +166,9 @@ static void pl050_realize(DeviceState *dev, Error **errp) sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); if (s->is_mouse) { - s->dev = ps2_mouse_init(NULL, NULL); + s->dev = ps2_mouse_init(); } else { - s->dev = ps2_kbd_init(NULL, NULL); + s->dev = ps2_kbd_init(); } qdev_connect_gpio_out(DEVICE(s->dev), PS2_DEVICE_IRQ, qdev_get_gpio_in(dev, PL050_INPUT_IRQ)); diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 891eb7181c..9d109f019a 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -175,20 +175,12 @@ void ps2_queue_noirq(PS2State *s, int b) static void ps2_raise_irq(PS2State *s) { - if (s->irq) { - qemu_set_irq(s->irq, 1); - } else { - s->update_irq(s->update_arg, 1); - } + qemu_set_irq(s->irq, 1); } static void ps2_lower_irq(PS2State *s) { - if (s->irq) { - qemu_set_irq(s->irq, 0); - } else { - s->update_irq(s->update_arg, 0); - } + qemu_set_irq(s->irq, 0); } 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); } -void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) +void *ps2_kbd_init(void) { DeviceState *dev; PS2KbdState *s; - PS2State *ps2; dev = qdev_new(TYPE_PS2_KBD_DEVICE); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s = PS2_KBD_DEVICE(dev); - ps2 = PS2_DEVICE(s); trace_ps2_kbd_init(s); - ps2->update_irq = update_irq; - ps2->update_arg = update_arg; - return s; } @@ -1262,20 +1249,16 @@ 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) +void *ps2_mouse_init(void) { DeviceState *dev; PS2MouseState *s; - PS2State *ps2; dev = qdev_new(TYPE_PS2_MOUSE_DEVICE); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s = PS2_MOUSE_DEVICE(dev); - ps2 = PS2_DEVICE(s); trace_ps2_mouse_init(s); - ps2->update_irq = update_irq; - ps2->update_arg = update_arg; return s; } diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 6e5c404cb5..df685a54c5 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; }; #define TYPE_PS2_DEVICE "ps2-device" @@ -100,8 +98,8 @@ struct PS2MouseState { OBJECT_DECLARE_SIMPLE_TYPE(PS2MouseState, PS2_MOUSE_DEVICE) /* 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);