qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Curious about this code in the ohci_service_td()


From: Peter Maydell
Subject: Re: [Qemu-devel] Curious about this code in the ohci_service_td()
Date: Sat, 18 Feb 2012 16:31:56 +0000

On 18 February 2012 16:19, Wei Yang <address@hidden> wrote:
> I am reading the code in ohci_service_td().
>
> There is a calculation of the length of the buffer.
>
>        if ((td.cbp & 0xfffff000) != (td.be & 0xfffff000)) {
>            len = (td.be & 0xfff) + 0x1001 - (td.cbp & 0xfff);
>        } else {
>            len = (td.be - td.cbp) + 1;
>        }
>
> I am curious about the first case.
> So the td.be could be less than the tb.cbp?

Yes. See the OHCI spec:
ftp://ftp.compaq.com/pub/supportinformation/papers/hcir1_0a.pdf
and specifically section 4.3: the data buffer described by a
TD may span two separate physically disjoint pages. The exact
page crossing behaviour is described more specifically in
section 4.3.1.3.1. (We don't implement it quite as described
there because we try to handle the whole data buffer at once
rather than byte-by-byte, but the effect is the same. See
also the code later on in the function under 'Transmission
succeeded' which updates td.cbp to the right value if we only
managed to send part of the data.)

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]