All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: sparclinux@vger.kernel.org
Subject: Re: Linux on Sun e10k
Date: Mon, 29 Jan 2007 17:34:25 +0000	[thread overview]
Message-ID: <20070129.093425.35015899.davem@davemloft.net> (raw)
In-Reply-To: <1169241607.30406.19.camel@duo.jes.ee>

From: "Tom 'spot' Callaway" <tcallawa@redhat.com>
Date: Mon, 29 Jan 2007 10:52:40 -0600

> This is the question I'd really like to hear the answer to. I can't find
> anything at all, either in the Sun docs or in the Internet tubes.

The starfire boxes have an SRAM area on the bootbus.

This is a shared communication area between the running system and the
SSP.  There is a receive buffer, a send buffer, and a 16-bit count for
each of those 2 buffers.  The receive side is polled, you just wait
for the count to become non-zero and that means console input is
available.

The console output buffer is 1024 bytes, the console input buffer
is 256 bytes.  However, the final 2 bytes of each of those buffers
contains the 16-bit count, so essentially you have 1022 bytes for
console output and 254 bytes for console input.

Another oddity is that the buffers are filled at the tail.  So, for
example if you have 16 characters to output, you copy them to the
final 16-bytes of the buffer area (right before the 2-byte count)
and then you write the count to be 16.

So the memory layout is essentially, offsets in bytes:

0	Console output buffer
1022	Console output buffer count, 16-bit
1024	Console input buffer
1278	Console input buffer count, 16-bit
1280	Control register, 8-bit

So, again, to write a 16-byte console output chunk, you'd
copy to the tail 16-bytes of the output buffer (offsets
1006 to 1021) and then write the 16-bit count of 16 at
offset 1022.

You can't write another console message until the SSP takes
it in, at which point the count will hit zero.  So you'll
have to have some polling scheme for output too, and I guess
a good heuristic would be to wait for a newline character or
some timeout before trying to toss things into this buffer.
But initially you can just write whatever you get.

The control register contains either zero (means nothing to do)
or another value which indicates certain events have occurred,
you poll this when you poll for console input.  The possible
values are:

0	nothing
1	Stop-A break sequence
2	SSP hung up on us and disconnected
3	Console switch to network, stop posting output bytes to SRAM
4	Console switch to SRAM, resume posting output bytes to SRAM
5	Console via network closed

Ignore values 3, 4, and 5 for now, there is a way to redirect console
output over the network with the SSP but we'll not support that yet.

drivers/serial/sunhv.c is probably a good model to start
with.

The physical address to get at the bootbus SRAM area is different on
each cpu.  It is calculated as:

	0x100f8000000 + (hwmid << 33) + 0x10000000000

hwmid is defined as:

	hwmid = ((cpuid & 0x3c) << 1) |
		((cpuid & 0x40) >> 4) |
		(cpuid & 0x3);

and cpuid is of course smp_processor_id().  You can see an existing
use of these calculations in

	arch/sparc64/kernel/starfire.c:starfire_hookup()

You can then use upa_{read,write}{b,w,l,q}() from asm/upa.h to
access this area using the physical addresses.

I don't know if the machine is OK with multiple cpus accessing
the bootbus SRAM area.  If not, it might be necessary to start
up a polling thread, which is the only entity accessing the SRAM
area, and force bind it to a particular CPU.  I don't think it
will be necessary, just something to keep in mind.

Hope this helps.

  parent reply	other threads:[~2007-01-29 17:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-19 21:20 Linux on Sun e10k Tõnu Samuel
2007-01-21 15:25 ` Meelis Roos
2007-01-26 22:05 ` Tom 'spot' Callaway
2007-01-26 22:15 ` Tom 'spot' Callaway
2007-01-26 23:12 ` Jan Engelhardt
2007-01-26 23:17 ` Tom 'spot' Callaway
2007-01-27  0:39 ` Tom 'spot' Callaway
2007-01-27  2:10 ` David Miller
2007-01-27  3:42 ` Tom 'spot' Callaway
2007-01-27  4:28 ` Tom 'spot' Callaway
2007-01-27 10:19 ` Tõnu Samuel
2007-01-27 11:17 ` Jan Engelhardt
2007-01-27 15:37 ` Tom 'spot' Callaway
2007-01-27 16:05 ` Jan Engelhardt
2007-01-27 16:31 ` Tom 'spot' Callaway
2007-01-27 16:53 ` Jan Engelhardt
2007-01-28  2:38 ` David Miller
2007-01-28 12:26 ` Jan Engelhardt
2007-01-29 15:08 ` Meelis Roos
2007-01-29 16:39 ` David Miller
2007-01-29 16:52 ` Tom 'spot' Callaway
2007-01-29 17:34 ` David Miller [this message]
2007-01-29 19:45 ` Tom 'spot' Callaway
2007-01-29 20:07 ` David Miller
2007-02-21 16:01 ` Peter Jones
2007-02-22 11:09 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070129.093425.35015899.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.