From 882ae308c780ebbec2b28f25570b2132b8405527 Mon Sep 17 00:00:00 2001 From: jsg Date: Tue, 18 Apr 2023 09:58:06 +0000 Subject: [PATCH] Add another check to com probe With this bentley@'s Steam Deck no longer attaches these: com0 at isa0 port 0x3f8/8 irq 4: ns8250, no fifo com1 at isa0 port 0x2f8/8 irq 3: ns8250, no fifo com2 at isa0 port 0x3e8/8 irq 5: ns8250, no fifo From Matthias Drochner in NetBSD rev 1.154 ok kettenis@ --- sys/dev/ic/com.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index a5ecfdef514..79717a7f47c 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com.c,v 1.175 2022/01/11 11:51:14 uaa Exp $ */ +/* $OpenBSD: com.c,v 1.176 2023/04/18 09:58:06 jsg Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /* @@ -146,14 +146,14 @@ comspeed(long freq, long speed) int comprobe1(bus_space_tag_t iot, bus_space_handle_t ioh) { - int i, k; + int i; /* force access to id reg */ - bus_space_write_1(iot, ioh, com_lcr, 0); + bus_space_write_1(iot, ioh, com_lcr, LCR_8BITS); bus_space_write_1(iot, ioh, com_iir, 0); for (i = 0; i < 32; i++) { - k = bus_space_read_1(iot, ioh, com_iir); - if (k & 0x38) { + if ((bus_space_read_1(iot, ioh, com_lcr) != LCR_8BITS) || + (bus_space_read_1(iot, ioh, com_iir) & 0x38)) { bus_space_read_1(iot, ioh, com_data); /* cleanup */ } else break; -- 2.20.1