From nobody Sat Apr 27 22:43:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630231437908474.78461848792017; Sun, 29 Aug 2021 03:03:57 -0700 (PDT) Received: from localhost ([::1]:53330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKHfP-0002oD-Qn for importer@patchew.org; Sun, 29 Aug 2021 06:03:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKHcu-0000pS-3h for qemu-devel@nongnu.org; Sun, 29 Aug 2021 06:01:20 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:52158 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKHcr-0005XY-PX for qemu-devel@nongnu.org; Sun, 29 Aug 2021 06:01:19 -0400 Received: from host86-179-186-93.range86-179.btcentralplus.com ([86.179.186.93] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKHcS-0007cB-73; Sun, 29 Aug 2021 11:00:56 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Sun, 29 Aug 2021 11:01:01 +0100 Message-Id: <20210829100103.1950-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829100103.1950-1-mark.cave-ayland@ilande.co.uk> References: <20210829100103.1950-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.179.186.93 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 1/3] escc: 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.default.ilande.bv.iomart.io) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1630231439328100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mark Cave-Ayland Reviewed-by: Peter Maydell --- hw/char/escc.c | 160 +++++++++++++++++++++++++++++-------------------- 1 file changed, 96 insertions(+), 64 deletions(-) diff --git a/hw/char/escc.c b/hw/char/escc.c index 52e7978287..63e0f15dfa 100644 --- a/hw/char/escc.c +++ b/hw/char/escc.c @@ -230,20 +230,23 @@ static uint32_t get_queue(void *opaque) q->count--; } trace_escc_get_queue(CHN_C(s), val); - if (q->count > 0) + if (q->count > 0) { serial_receive_byte(s, 0); + } return val; } =20 static int escc_update_irq_chn(ESCCChannelState *s) { if ((((s->wregs[W_INTR] & INTR_TXINT) && (s->txint =3D=3D 1)) || - // tx ints enabled, pending - ((((s->wregs[W_INTR] & INTR_RXMODEMSK) =3D=3D INTR_RXINT1ST) || - ((s->wregs[W_INTR] & INTR_RXMODEMSK) =3D=3D INTR_RXINTALL)) && - s->rxint =3D=3D 1) || // rx ints enabled, pending - ((s->wregs[W_EXTINT] & EXTINT_BRKINT) && - (s->rregs[R_STATUS] & STATUS_BRK)))) { // break int e&p + /* tx ints enabled, pending */ + ((((s->wregs[W_INTR] & INTR_RXMODEMSK) =3D=3D INTR_RXINT1ST) || + ((s->wregs[W_INTR] & INTR_RXMODEMSK) =3D=3D INTR_RXINTALL)) && + s->rxint =3D=3D 1) || + /* rx ints enabled, pending */ + ((s->wregs[W_EXTINT] & EXTINT_BRKINT) && + (s->rregs[R_STATUS] & STATUS_BRK)))) { + /* break int e&p */ return 1; } return 0; @@ -269,17 +272,22 @@ static void escc_reset_chn(ESCCChannelState *s) s->rregs[i] =3D 0; s->wregs[i] =3D 0; } - s->wregs[W_TXCTRL1] =3D TXCTRL1_1STOP; // 1X divisor, 1 stop bit, no p= arity + /* 1X divisor, 1 stop bit, no parity */ + s->wregs[W_TXCTRL1] =3D TXCTRL1_1STOP; s->wregs[W_MINTR] =3D MINTR_RST_ALL; - s->wregs[W_CLOCK] =3D CLOCK_TRXC; // Synch mode tx clock =3D TRxC - s->wregs[W_MISC2] =3D MISC2_PLLDIS; // PLL disabled + /* Synch mode tx clock =3D TRxC */ + s->wregs[W_CLOCK] =3D CLOCK_TRXC; + /* PLL disabled */ + s->wregs[W_MISC2] =3D MISC2_PLLDIS; + /* Enable most interrupts */ s->wregs[W_EXTINT] =3D EXTINT_DCD | EXTINT_SYNCINT | EXTINT_CTSINT | - EXTINT_TXUNDRN | EXTINT_BRKINT; // Enable most interrupts - if (s->disabled) + EXTINT_TXUNDRN | EXTINT_BRKINT; + if (s->disabled) { s->rregs[R_STATUS] =3D STATUS_TXEMPTY | STATUS_DCD | STATUS_SYNC | STATUS_CTS | STATUS_TXUNDRN; - else + } else { s->rregs[R_STATUS] =3D STATUS_TXEMPTY | STATUS_TXUNDRN; + } s->rregs[R_SPEC] =3D SPEC_BITS8 | SPEC_ALLSENT; =20 s->rx =3D s->tx =3D 0; @@ -300,21 +308,25 @@ static void escc_reset(DeviceState *d) static inline void set_rxint(ESCCChannelState *s) { s->rxint =3D 1; - /* XXX: missing daisy chainnig: escc_chn_b rx should have a lower prio= rity - than chn_a rx/tx/special_condition service*/ + /* + * XXX: missing daisy chainnig: escc_chn_b rx should have a lower prio= rity + * than chn_a rx/tx/special_condition service + */ s->rxint_under_svc =3D 1; if (s->chn =3D=3D escc_chn_a) { s->rregs[R_INTR] |=3D INTR_RXINTA; - if (s->wregs[W_MINTR] & MINTR_STATUSHI) + if (s->wregs[W_MINTR] & MINTR_STATUSHI) { s->otherchn->rregs[R_IVEC] =3D IVEC_HIRXINTA; - else + } else { s->otherchn->rregs[R_IVEC] =3D IVEC_LORXINTA; + } } else { s->otherchn->rregs[R_INTR] |=3D INTR_RXINTB; - if (s->wregs[W_MINTR] & MINTR_STATUSHI) + if (s->wregs[W_MINTR] & MINTR_STATUSHI) { s->rregs[R_IVEC] =3D IVEC_HIRXINTB; - else + } else { s->rregs[R_IVEC] =3D IVEC_LORXINTB; + } } escc_update_irq(s); } @@ -328,17 +340,18 @@ static inline void set_txint(ESCCChannelState *s) if (s->wregs[W_INTR] & INTR_TXINT) { s->rregs[R_INTR] |=3D INTR_TXINTA; } - if (s->wregs[W_MINTR] & MINTR_STATUSHI) + if (s->wregs[W_MINTR] & MINTR_STATUSHI) { s->otherchn->rregs[R_IVEC] =3D IVEC_HITXINTA; - else + } else { s->otherchn->rregs[R_IVEC] =3D IVEC_LOTXINTA; + } } else { s->rregs[R_IVEC] =3D IVEC_TXINTB; if (s->wregs[W_INTR] & INTR_TXINT) { s->otherchn->rregs[R_INTR] |=3D INTR_TXINTB; } } - escc_update_irq(s); + escc_update_irq(s); } } =20 @@ -347,20 +360,23 @@ static inline void clr_rxint(ESCCChannelState *s) s->rxint =3D 0; s->rxint_under_svc =3D 0; if (s->chn =3D=3D escc_chn_a) { - if (s->wregs[W_MINTR] & MINTR_STATUSHI) + if (s->wregs[W_MINTR] & MINTR_STATUSHI) { s->otherchn->rregs[R_IVEC] =3D IVEC_HINOINT; - else + } else { s->otherchn->rregs[R_IVEC] =3D IVEC_LONOINT; + } s->rregs[R_INTR] &=3D ~INTR_RXINTA; } else { - if (s->wregs[W_MINTR] & MINTR_STATUSHI) + if (s->wregs[W_MINTR] & MINTR_STATUSHI) { s->rregs[R_IVEC] =3D IVEC_HINOINT; - else + } else { s->rregs[R_IVEC] =3D IVEC_LONOINT; + } s->otherchn->rregs[R_INTR] &=3D ~INTR_RXINTB; } - if (s->txint) + if (s->txint) { set_txint(s); + } escc_update_irq(s); } =20 @@ -369,21 +385,24 @@ static inline void clr_txint(ESCCChannelState *s) s->txint =3D 0; s->txint_under_svc =3D 0; if (s->chn =3D=3D escc_chn_a) { - if (s->wregs[W_MINTR] & MINTR_STATUSHI) + if (s->wregs[W_MINTR] & MINTR_STATUSHI) { s->otherchn->rregs[R_IVEC] =3D IVEC_HINOINT; - else + } else { s->otherchn->rregs[R_IVEC] =3D IVEC_LONOINT; + } s->rregs[R_INTR] &=3D ~INTR_TXINTA; } else { s->otherchn->rregs[R_INTR] &=3D ~INTR_TXINTB; - if (s->wregs[W_MINTR] & MINTR_STATUSHI) + if (s->wregs[W_MINTR] & MINTR_STATUSHI) { s->rregs[R_IVEC] =3D IVEC_HINOINT; - else + } else { s->rregs[R_IVEC] =3D IVEC_LONOINT; + } s->otherchn->rregs[R_INTR] &=3D ~INTR_TXINTB; } - if (s->rxint) + if (s->rxint) { set_rxint(s); + } escc_update_irq(s); } =20 @@ -392,21 +411,24 @@ static void escc_update_parameters(ESCCChannelState *= s) int speed, parity, data_bits, stop_bits; QEMUSerialSetParams ssp; =20 - if (!qemu_chr_fe_backend_connected(&s->chr) || s->type !=3D escc_seria= l) + if (!qemu_chr_fe_backend_connected(&s->chr) || s->type !=3D escc_seria= l) { return; + } =20 if (s->wregs[W_TXCTRL1] & TXCTRL1_PAREN) { - if (s->wregs[W_TXCTRL1] & TXCTRL1_PAREV) + if (s->wregs[W_TXCTRL1] & TXCTRL1_PAREV) { parity =3D 'E'; - else + } else { parity =3D 'O'; + } } else { parity =3D 'N'; } - if ((s->wregs[W_TXCTRL1] & TXCTRL1_STPMSK) =3D=3D TXCTRL1_2STOP) + if ((s->wregs[W_TXCTRL1] & TXCTRL1_STPMSK) =3D=3D TXCTRL1_2STOP) { stop_bits =3D 2; - else + } else { stop_bits =3D 1; + } switch (s->wregs[W_TXCTRL2] & TXCTRL2_BITMSK) { case TXCTRL2_5BITS: data_bits =3D 5; @@ -523,10 +545,11 @@ static void escc_mem_write(void *opaque, hwaddr addr, default: break; } - if (s->reg =3D=3D 0) + if (s->reg =3D=3D 0) { s->reg =3D newreg; - else + } else { s->reg =3D 0; + } break; case SERIAL_DATA: trace_escc_mem_writeb_data(CHN_C(s), val); @@ -538,17 +561,19 @@ static void escc_mem_write(void *opaque, hwaddr addr, s->txint =3D 0; escc_update_irq(s); s->tx =3D val; - if (s->wregs[W_TXCTRL2] & TXCTRL2_TXEN) { // tx enabled + if (s->wregs[W_TXCTRL2] & TXCTRL2_TXEN) { /* tx enabled */ if (qemu_chr_fe_backend_connected(&s->chr)) { - /* XXX this blocks entire thread. Rewrite to use - * qemu_chr_fe_write and background I/O callbacks */ + /* + * XXX this blocks entire thread. Rewrite to use + * qemu_chr_fe_write and background I/O callbacks + */ qemu_chr_fe_write_all(&s->chr, &s->tx, 1); } else if (s->type =3D=3D escc_kbd && !s->disabled) { handle_kbd_command(s, val); } } - s->rregs[R_STATUS] |=3D STATUS_TXEMPTY; // Tx buffer empty - s->rregs[R_SPEC] |=3D SPEC_ALLSENT; // All sent + s->rregs[R_STATUS] |=3D STATUS_TXEMPTY; /* Tx buffer empty */ + s->rregs[R_SPEC] |=3D SPEC_ALLSENT; /* All sent */ set_txint(s); break; default: @@ -606,12 +631,13 @@ static int serial_can_receive(void *opaque) ESCCChannelState *s =3D opaque; int ret; =20 - if (((s->wregs[W_RXCTRL] & RXCTRL_RXEN) =3D=3D 0) // Rx not enabled - || ((s->rregs[R_STATUS] & STATUS_RXAV) =3D=3D STATUS_RXAV)) - // char already available + if (((s->wregs[W_RXCTRL] & RXCTRL_RXEN) =3D=3D 0) /* Rx not enabled */ + || ((s->rregs[R_STATUS] & STATUS_RXAV) =3D=3D STATUS_RXAV)) { + /* char already available */ ret =3D 0; - else + } else { ret =3D 1; + } return ret; } =20 @@ -638,12 +664,13 @@ static void serial_receive1(void *opaque, const uint8= _t *buf, int size) static void serial_event(void *opaque, QEMUChrEvent event) { ESCCChannelState *s =3D opaque; - if (event =3D=3D CHR_EVENT_BREAK) + if (event =3D=3D CHR_EVENT_BREAK) { serial_receive_break(s); + } } =20 static const VMStateDescription vmstate_escc_chn =3D { - .name =3D"escc_chn", + .name =3D "escc_chn", .version_id =3D 2, .minimum_version_id =3D 1, .fields =3D (VMStateField[]) { @@ -662,7 +689,7 @@ static const VMStateDescription vmstate_escc_chn =3D { }; =20 static const VMStateDescription vmstate_escc =3D { - .name =3D"escc", + .name =3D "escc", .version_id =3D 2, .minimum_version_id =3D 1, .fields =3D (VMStateField[]) { @@ -734,21 +761,21 @@ static QemuInputHandler sunkbd_handler =3D { static void handle_kbd_command(ESCCChannelState *s, int val) { trace_escc_kbd_command(val); - if (s->led_mode) { // Ignore led byte + if (s->led_mode) { /* Ignore led byte */ s->led_mode =3D 0; return; } switch (val) { - case 1: // Reset, return type code + case 1: /* Reset, return type code */ clear_queue(s); put_queue(s, 0xff); - put_queue(s, 4); // Type 4 + put_queue(s, 4); /* Type 4 */ put_queue(s, 0x7f); break; - case 0xe: // Set leds + case 0xe: /* Set leds */ s->led_mode =3D 1; break; - case 7: // Query layout + case 7: /* Query layout */ case 0xf: clear_queue(s); put_queue(s, 0xfe); @@ -768,34 +795,39 @@ static void sunmouse_event(void *opaque, trace_escc_sunmouse_event(dx, dy, buttons_state); ch =3D 0x80 | 0x7; /* protocol start byte, no buttons pressed */ =20 - if (buttons_state & MOUSE_EVENT_LBUTTON) + if (buttons_state & MOUSE_EVENT_LBUTTON) { ch ^=3D 0x4; - if (buttons_state & MOUSE_EVENT_MBUTTON) + } + if (buttons_state & MOUSE_EVENT_MBUTTON) { ch ^=3D 0x2; - if (buttons_state & MOUSE_EVENT_RBUTTON) + } + if (buttons_state & MOUSE_EVENT_RBUTTON) { ch ^=3D 0x1; + } =20 put_queue(s, ch); =20 ch =3D dx; =20 - if (ch > 127) + if (ch > 127) { ch =3D 127; - else if (ch < -127) + } else if (ch < -127) { ch =3D -127; + } =20 put_queue(s, ch & 0xff); =20 ch =3D -dy; =20 - if (ch > 127) + if (ch > 127) { ch =3D 127; - else if (ch < -127) + } else if (ch < -127) { ch =3D -127; + } =20 put_queue(s, ch & 0xff); =20 - // MSC protocol specify two extra motion bytes + /* MSC protocol specify two extra motion bytes */ =20 put_queue(s, 0); put_queue(s, 0); --=20 2.20.1 From nobody Sat Apr 27 22:43:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630231640896976.6196944986357; Sun, 29 Aug 2021 03:07:20 -0700 (PDT) Received: from localhost ([::1]:60216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKHih-0007Zj-V1 for importer@patchew.org; Sun, 29 Aug 2021 06:07:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35528) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKHcy-0000xl-HD for qemu-devel@nongnu.org; Sun, 29 Aug 2021 06:01:24 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:52164 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKHcw-0005bG-Ve for qemu-devel@nongnu.org; Sun, 29 Aug 2021 06:01:24 -0400 Received: from host86-179-186-93.range86-179.btcentralplus.com ([86.179.186.93] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKHcW-0007cB-FH; Sun, 29 Aug 2021 11:01:01 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Sun, 29 Aug 2021 11:01:02 +0100 Message-Id: <20210829100103.1950-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829100103.1950-1-mark.cave-ayland@ilande.co.uk> References: <20210829100103.1950-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.179.186.93 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 2/3] escc: fix R_STATUS channel reset value X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1630231642918100001 Content-Type: text/plain; charset="utf-8" According to the "Z80X30 Register Reset Values" table in the ESCC datasheet bits 2 and 6 are set whilst bits 0 and 1 are cleared during channel reset. All other bits should be left unaltered. Signed-off-by: Mark Cave-Ayland --- hw/char/escc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/char/escc.c b/hw/char/escc.c index 63e0f15dfa..0f6957ba8b 100644 --- a/hw/char/escc.c +++ b/hw/char/escc.c @@ -281,12 +281,11 @@ static void escc_reset_chn(ESCCChannelState *s) s->wregs[W_MISC2] =3D MISC2_PLLDIS; /* Enable most interrupts */ s->wregs[W_EXTINT] =3D EXTINT_DCD | EXTINT_SYNCINT | EXTINT_CTSINT | - EXTINT_TXUNDRN | EXTINT_BRKINT; + EXTINT_TXUNDRN | EXTINT_BRKINT; + s->rregs[R_STATUS] &=3D ~(STATUS_RXAV | STATUS_ZERO); + s->rregs[R_STATUS] |=3D STATUS_TXEMPTY | STATUS_TXUNDRN; if (s->disabled) { - s->rregs[R_STATUS] =3D STATUS_TXEMPTY | STATUS_DCD | STATUS_SYNC | - STATUS_CTS | STATUS_TXUNDRN; - } else { - s->rregs[R_STATUS] =3D STATUS_TXEMPTY | STATUS_TXUNDRN; + s->rregs[R_STATUS] |=3D STATUS_DCD | STATUS_CTS; } s->rregs[R_SPEC] =3D SPEC_BITS8 | SPEC_ALLSENT; =20 --=20 2.20.1 From nobody Sat Apr 27 22:43:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630231454943681.7469571465352; Sun, 29 Aug 2021 03:04:14 -0700 (PDT) Received: from localhost ([::1]:53854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKHfh-00039Q-LR for importer@patchew.org; Sun, 29 Aug 2021 06:04:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKHd1-000135-Rw for qemu-devel@nongnu.org; Sun, 29 Aug 2021 06:01:27 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:52168 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKHd0-0005eX-7e for qemu-devel@nongnu.org; Sun, 29 Aug 2021 06:01:27 -0400 Received: from host86-179-186-93.range86-179.btcentralplus.com ([86.179.186.93] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKHcb-0007cB-Kc; Sun, 29 Aug 2021 11:01:05 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Sun, 29 Aug 2021 11:01:03 +0100 Message-Id: <20210829100103.1950-4-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829100103.1950-1-mark.cave-ayland@ilande.co.uk> References: <20210829100103.1950-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.179.186.93 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 3/3] escc: fix STATUS_SYNC bit in R_STATUS register X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1630231455938100001 Content-Type: text/plain; charset="utf-8" After an SDLC "Enter hunt" command has been sent the STATUS_SYNC bit should= remain high until the flag byte has been detected. Whilst the ESCC device doesn't = yet implement SDLC mode, without this change the active low STATUS_SYNC is cons= tantly asserted causing the MacOS OpenTransport extension to hang on startup as it= thinks it is constantly receiving LocalTalk responses during its initial negotiati= on phase. Signed-off-by: Mark Cave-Ayland Reviewed-by: Peter Maydell --- hw/char/escc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/char/escc.c b/hw/char/escc.c index 0f6957ba8b..eba6b45baa 100644 --- a/hw/char/escc.c +++ b/hw/char/escc.c @@ -92,6 +92,7 @@ #define W_IVEC 2 #define W_RXCTRL 3 #define RXCTRL_RXEN 0x01 +#define RXCTRL_HUNT 0x10 #define W_TXCTRL1 4 #define TXCTRL1_PAREN 0x01 #define TXCTRL1_PAREV 0x02 @@ -508,7 +509,13 @@ static void escc_mem_write(void *opaque, hwaddr addr, break; } break; - case W_INTR ... W_RXCTRL: + case W_RXCTRL: + s->wregs[s->reg] =3D val; + if (val & RXCTRL_HUNT) { + s->rregs[R_STATUS] |=3D STATUS_SYNC; + } + break; + case W_INTR ... W_IVEC: case W_SYNC1 ... W_TXBUF: case W_MISC1 ... W_CLOCK: case W_MISC2 ... W_EXTINT: --=20 2.20.1