All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Blue Swirl <blauwirbel@gmail.com>, Bob Breuer <breuerr@mc.net>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Anthony Liguori <aliguori@amazon.com>,
	Artyom Tarasenko <atar4qemu@gmail.com>
Subject: Re: [Qemu-devel] [PATCHv2 1/2] sun4m: Add Sun CG3 framebuffer and corresponding OpenBIOS FCode ROM
Date: Sun, 09 Feb 2014 15:19:37 +0000	[thread overview]
Message-ID: <52F79C89.2010204@ilande.co.uk> (raw)
In-Reply-To: <CAFEAcA9OmZBRyeYARW4cK69JTzSaEc_JZY-TuwOZo5wXVgXjfw@mail.gmail.com>

On 09/02/14 14:41, Peter Maydell wrote:

> On 8 February 2014 16:38, Mark Cave-Ayland
> <mark.cave-ayland@ilande.co.uk>  wrote:
>> The CG3 framebuffer is a simple 8-bit framebuffer for use with operating
>> systems such as early Solaris that do not have drivers for TCX.
>>
>> +static void cg3_reg_write(void *opaque, hwaddr addr, uint64_t val,
>> +                          unsigned size)
>> +{
>> +    CG3State *s = opaque;
>> +    uint8_t regval;
>> +    int i;
>> +
>> +    DPRINTF("write %02lx to reg %x size %d\n", val, (int)addr, size);
>> +
>> +    switch (addr) {
>> +    case 0:
>> +        s->dac_index = val;
>> +        s->dac_state = 0;
>> +        break;
>> +    case 4:
>> +        /* This register can be written to as either a long word or a byte.
>> +         * According to the SBus specification, byte transfers are placed
>> +         * in bits 31-28 */
>> +        if (size == 1) {
>> +            val<<= 24;
>> +        }
>
> I'm a little reluctant to start talking about endianness again :-)
> but that "if (size == 1)" comment looks a little odd to me. The SBus
> spec says that SBus is a big-endian bus (which probably means
> that the .endianness in the memops struct should be
> DEVICE_BIG_ENDIAN though for SPARC targets it won't make
> any actual difference)". So while it's true that for SBus you get
> byte transfers in data lines 31..28 (and also possibly on some of
> the other data lines if the address is not 4-aligned or if the master
> just feels like sending the byte on all four lanes at once), I don't
> think that's why you're doing this shift. The shift is presumably
> because the behaviour of this specific device is "I treat a byte
> write like a write to the most significant byte of this register",
> not because of the specifics of how SBus defines a byte transfer
> to occur.

It's been a little while since I looked, however this was my 
interpretation of the table 3-12 on p.66 of the SBus specification. 
While that particular table refers to the acknowledgment cycle from the 
slave back to the master, it seems to work here in the same way when 
transferring between the master and the slave.

One of things we do know about that card is that the DAC is a BT408, 
where the 256 * 3 shift register for the RGB values is seemingly 
controller by register 4. And I'm fairly sure that I've seen a mixture 
of byte and 4-byte accesses to the card coming from the Solaris driver 
which is why it's necessary to support both accesses in this way :/

There is also a related comment on page 80 explaining how bus sizing can 
be used to allow 8-bit framebuffer to be driven in exactly the same way 
as a 32-bit framebuffer.

FWIW I copied the .endianness part over from the TCX driver, so if you 
feel for correctness that .endianness needs to be DEVICE_BIG_ENDIAN for 
TCX too then I'm happy to submit a patch for that too.


ATB,

Mark.

  reply	other threads:[~2014-02-09 15:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-08 16:38 [Qemu-devel] [PATCHv2 0/2] sun4m: Implement Sun CG3 framebuffer for QEMU Mark Cave-Ayland
2014-02-08 16:38 ` [Qemu-devel] [PATCHv2 1/2] sun4m: Add Sun CG3 framebuffer and corresponding OpenBIOS FCode ROM Mark Cave-Ayland
2014-02-09  4:14   ` Peter Crosthwaite
2014-02-09 13:35     ` Mark Cave-Ayland
2014-02-14 14:54       ` Peter Crosthwaite
2014-02-17 12:50         ` Mark Cave-Ayland
2014-02-17 16:18           ` Bob Breuer
2014-02-09 14:41   ` Peter Maydell
2014-02-09 15:19     ` Mark Cave-Ayland [this message]
2014-02-09 15:33       ` Peter Maydell
2014-02-17 12:33         ` Mark Cave-Ayland
2014-02-09 15:10   ` Andreas Färber
2014-02-09 15:24     ` Mark Cave-Ayland
2014-02-09 15:39       ` Andreas Färber
2014-02-10  8:20       ` Paolo Bonzini
2014-02-17 12:43         ` Mark Cave-Ayland
2014-02-17 12:54           ` Paolo Bonzini
2014-02-08 16:38 ` [Qemu-devel] [PATCHv2 2/2] sun4m: Add Sun CG3 framebuffer initialisation function Mark Cave-Ayland
2014-02-09 15:32   ` Andreas Färber
2014-02-17 12:30     ` Mark Cave-Ayland
2014-02-19 21:23       ` Mark Cave-Ayland

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=52F79C89.2010204@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=aliguori@amazon.com \
    --cc=atar4qemu@gmail.com \
    --cc=blauwirbel@gmail.com \
    --cc=breuerr@mc.net \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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.