Subject: Re: Using same com.c driver for two devices that access serial port
To: Ian Zagorskih <ianzag@megasignal.com>
From: David Brownlee <abs@netbsd.org>
List: tech-kern
Date: 06/25/2003 17:07:44
On Wed, 25 Jun 2003, Ian Zagorskih wrote:

> AFAIU from dev/ic/com.c source code you cannot do this so simple. All
> bus_space_read_1()/write_1() calls use absolute register offset values
> defined at dev/ic/ns16550reg.h like below:
>
> ------
> #define	com_data		0	/* data register (R/W) */
> #define	com_ier		1	/* interrupt enable (W) */
> #define	com_iir		2	/* interrupt identification (R) */
> ------
>
> and used for all com-like devices. So you have to re-define this offsets
> depending on exact com device context i.e. value 1 for com_ier used for ISA
> bus and 4 for PCI bus.
>
> One sollution is to re-define bus_space_read/write specially for/in com.c
> which would fix register value depending on bus space tag and handle.
>
> But 1) doing it just looking at "PCI or ISA" bus space type obviously will
> break suitability of com.c for other PCI UART cards 2) you should to it for
> all <arch>/bus.h :)
>
> For me seems like com.c isn't suitable for your device course of different
> hardware registers mapping.

	Would it be reasonable to create a new bus type for the pciio
	attachments and have it handle the adjustment?

-- 
		David/absolute          -- www.netbsd.org: No hype required --