Date: Wed, 25 May 2011 08:45:22 -0700 From: Marcel Moolenaar <marcel@xcllnt.net> To: John Baldwin <jhb@freebsd.org> Cc: freebsd-hardware@freebsd.org, "N.J. Mann" <njm@njm.me.uk> Subject: Re: Sunix 4056A PCI 4 port RS-232 card - only 2 ports configured Message-ID: <803C09E5-8E10-4289-A8B3-952E8A72C7A1@xcllnt.net> In-Reply-To: <201105250946.45653.jhb@freebsd.org> References: <20110522110002.GB91694@titania.njm.me.uk> <201105241610.49930.jhb@freebsd.org> <20110524215232.GB92553@titania.njm.me.uk> <201105250946.45653.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On May 25, 2011, at 6:46 AM, John Baldwin wrote: *snip* >> For the two devices that fail, ns8250_bus_probe() fails on the first >> call: >>=20 >> UART4 >> ----- >> ns8250_bus_probe:: entry >> ns8250_probe::uart_getreg REG_IIR =3D 1 >> ns8250_probe::uart_getreg REG_MCR =3D 64 >> ns8250_bus_probe::ns8250_probe returned 6 >>=20 >> UART5 >> ----- >> ns8250_bus_probe:: entry >> ns8250_probe::uart_getreg REG_IIR =3D 1 >> ns8250_probe::uart_getreg REG_MCR =3D 64 >> ns8250_bus_probe::ns8250_probe returned 6 >>=20 >> The value returned for the read of REG_MCR is 64, or 0x40, which = causes >> the premature exit: >>=20 >> static int >> ns8250_probe(struct uart_bas *bas) >> { >> u_char val; >>=20 >> /* Check known 0 bits that don't depend on DLAB. */ >> val =3D uart_getreg(bas, REG_IIR); >> if (val & 0x30) >> return (ENXIO); >> val =3D uart_getreg(bas, REG_MCR); >> if (val & 0xe0) >> return (ENXIO); >>=20 >> return (0); >> } >>=20 >> Do you need to know the contents of 'bas'? >=20 > This goes beyond my level of knowledge. I've cc'd Marcel (author of = uart) who=20 > can hopefully help with this more. The ns8250 family of UARTs typically have bits 5, 6 and 7 of the MCR register reserved and thus hardwired to 0. The probe function checks for that to make sure that the hardware looks enough like a UART that we can claim it without hosing the box. That said: newer chips in the family, like the ST16C850/XR16C850, have given those bits a function: bit 5 - Xon-Any enable bit 6 - Infrared enable bit 7 - Clock pre-scaler It's unclear to me whether those bits are consistently defined across the different implementations (for some reason I think not) and it's also unclear to me whether the device will work correctly with FreeBSD if we simply ignore those bits (again I don't think this is always the case). I think the first order of business from an architectural point of view is to determine how much value register probing still has on modern hardware. In the good old days, this was needed. If we think it's not really needed anymore, then it makes sense to loosen the grip so to speak. For you, the first thing is to see whether the UART ports work if you tweak the probe functions, like so: Index: uart_dev_ns8250.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- uart_dev_ns8250.c (revision 222217) +++ uart_dev_ns8250.c (working copy) @@ -243,7 +243,7 @@ if (val & 0x30) return (ENXIO); val =3D uart_getreg(bas, REG_MCR); - if (val & 0xe0) + if (val & 0xa0) return (ENXIO); =20 return (0); Secondly, I'd like to know the vendor of the Quad-port UART. Either it's Sunix's own implementation (this seems to be the case), or they simply OEM someone else's. In any case: I'd like to see the datasheet of the ASIC so as to understand the meaning/function of the bit. FYI, --=20 Marcel Moolenaar marcel@xcllnt.net
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?803C09E5-8E10-4289-A8B3-952E8A72C7A1>