Subject: Using same com.c driver for two devices that access serial port differently?
To: None <tech-kern@netbsd.org>
From: Bruce Martin <brucem@cat.co.za>
List: tech-kern
Date: 06/25/2003 17:05:24
Hi all
We have recently developed a serial port card that plugs onto another one of our cards as a daughter card. What I have done, using
the puc.c driver as a reference, is written the hooks so that serial ports can attach the the isa bus (for the 2 motherboard serial
ports) or to our already exiting custom device (for the 4 serial ports on the daughtercard). So the kernel registers the following:
com0 at isa0 port ...
com1 at isa0 port ...
com2 at pciio0 port...
com3 at pciio0 port...
com4 at pciio0 port...
com5 at pciio0 port...
So all looks awell and good - the daughter card has an NS16550 compatible chipset, so it should work with the com.c driver as is -
the machine-dependent code has hooked up to com.c so that the bus_space reads and writes should access the registers.
Here's the catch: for reasons outside of our control, the serial card device on the pciio device has to be accessed via addresses
multiplied by 4. So, if we want to access the NS16550 register at 0x13, we actually have to attempt an access to 0x4C, and if we
were looking for the contents of the 16550 register at 0x1, we would need to read the offset 0x04.
So, what I need to know is: is there any way to do this kind of mapping/translation in the hooking up of the machine dependent code.
The aim would be for the following line in com.c:
bus_space_read_1(iot,ioh,0x03)
to access the register at address 0x03 for the isa com's, and to access the register at address 0x0C for the pciio com's.
Any help would be much appreciated!
Bruce Martin