Sunix 4056A PCI 4 port RS-232 card - only 2 ports configured

Marcel Moolenaar marcel at xcllnt.net
Wed May 25 15:56:49 UTC 2011


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:
>> 
>> UART4
>> -----
>> ns8250_bus_probe:: entry
>> ns8250_probe::uart_getreg REG_IIR = 1
>> ns8250_probe::uart_getreg REG_MCR = 64
>> ns8250_bus_probe::ns8250_probe returned 6
>> 
>> UART5
>> -----
>> ns8250_bus_probe:: entry
>> ns8250_probe::uart_getreg REG_IIR = 1
>> ns8250_probe::uart_getreg REG_MCR = 64
>> ns8250_bus_probe::ns8250_probe returned 6
>> 
>> The value returned for the read of REG_MCR is 64, or 0x40, which causes
>> the premature exit:
>> 
>> static int
>> ns8250_probe(struct uart_bas *bas)
>> {
>> 	u_char val;
>> 
>> 	/* Check known 0 bits that don't depend on DLAB. */
>> 	val = uart_getreg(bas, REG_IIR);
>> 	if (val & 0x30)
>> 		return (ENXIO);
>> 	val = uart_getreg(bas, REG_MCR);
>> 	if (val & 0xe0)
>> 		return (ENXIO);
>> 
>> 	return (0);
>> }
>> 
>> Do you need to know the contents of 'bas'?
> 
> This goes beyond my level of knowledge.  I've cc'd Marcel (author of uart) who 
> 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
===================================================================
--- uart_dev_ns8250.c	(revision 222217)
+++ uart_dev_ns8250.c	(working copy)
@@ -243,7 +243,7 @@
 	if (val & 0x30)
 		return (ENXIO);
 	val = uart_getreg(bas, REG_MCR);
-	if (val & 0xe0)
+	if (val & 0xa0)
 		return (ENXIO);
 
 	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,

-- 
Marcel Moolenaar
marcel at xcllnt.net




More information about the freebsd-hardware mailing list