Q: resource range for SBus oddity

Marcel Moolenaar marcel at xcllnt.net
Sun Aug 31 09:45:12 PDT 2003

On Sun, Aug 31, 2003 at 02:45:36PM +0200, Thomas Moestl wrote:
> > puc1: <Zilog Z8530 dual channel SCC> mem 0x1000000-0x1000003 irq 2024 on sbus0
> > 
> > As you can see, the memory I/O resource is 4 bytes wide. However,
> > the channel A registers on the z8530 chip are at offsets 4
> > (control) and 6 (data). This lies outside the reserved range.
> > 
> > I would think that with 2 channels and 2 addressable registers
> > per channel we would be using offsets 0-3.
> > 
> > Question: Is there an implied multiplication or division factor?
> No, the ranges should in general be correct; I've checked this with
> other devices. The register space of a single zs channel is indeed 4
> bytes, but IIRC each channel has a separate device node, and there was
> some oddity which required both channels to use the register addresses
> specified in the first one, which is why the zs driver attaches two
> zsttys to the first device, and does not attach to the second zs
> instance. Jake can probably give more details on that.

I'm not sure you understand what I mean. The firmware has given a
single zs device 4 bytes of (s)bus space. We print the I/O range
in accordance with the firmware. The zs device has 4 bus-accessable
registers (2 channels, 2 registers per channel). This matches the
I/O range given to it, provided the offsets within the range are:
	channel B control	0
	channel	B data		1
	channel A control	2
	channel A data		3

But this is not the case. The registers of a single zs device are
at the following offsets:
	channel B control	0
	channel B data		2
	channel A control	4
	channel A data		6

Thus: given the actual offsets of a single zs device, the firmware
should have assigned 8 bytes of (s)bus space to it, not 4. Unless
the I/O range is interleaved with another independent device, such
as a second zs device of course. But this is not the case.

The zstty devices you talk about are created for each channel of
a zs device. The second zs device is not attached because we only
attach the device with number 0 (see sys/dev/zs/zs_sbus.c), I think
because the second is for the keyboard and mouse?

I do something the same with uart(4), only I use puc(4) to attach
to the zs proper and attach uart(4) to each channel. The oddity
can therefore also be explained as follows:
	puc0 has 4 bytes of bus space assigned to it.
	uart0 on puc0 takes up 4 bytes of bus space.
	uart1 on puc0 takes up 4 bytes of bus space.
Thus uart0 and uart1 take up 8 bytes of bus space, even though the
parent (puc0) only have 4 bytes assigned to it.

 Marcel Moolenaar	  USPA: A-39004		 marcel at xcllnt.net

More information about the freebsd-sparc64 mailing list