[OpenBIOS] [PATCH 4/5] ppc: fix CUDA ADB packet header format
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Wed Aug 19 21:22:45 CET 2015
On 18/08/15 19:17, Cormac O'Brien wrote:
> Previous versions of QEMU use a 2-byte header for CUDA ADB packets where it
> should have used a 3-byte one, so this commit allows cuda_adb_req() to
> differentiate between the two formats and act accordingly.
>
> Signed-off-by: Cormac O'Brien <cormac at c-obrien.org>
> ---
> drivers/cuda.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cuda.c b/drivers/cuda.c
> index f117b0b..6f5536a 100644
> --- a/drivers/cuda.c
> +++ b/drivers/cuda.c
> @@ -144,8 +144,18 @@ static int cuda_adb_req (void *host, const uint8_t *snd_buf, int len,
> // CUDA_DPRINTF("len: %d %02x\n", len, snd_buf[0]);
> len = cuda_request(host, ADB_PACKET, snd_buf, len, buffer);
> if (len > 1 && buffer[0] == ADB_PACKET) {
> - pos = buffer + 2;
> - len -= 2;
> + /* QEMU's previous model used a 2-byte header where it should use a
> + * 3-byte one, so we check to see what kind of header we ought to use.
> + */
> + if (len > 2 && buffer[2] == snd_buf[0]) {
> + /* Correct 3-byte header */
> + pos = buffer + 3;
> + len -= 3;
> + } else {
> + /* Old 2-byte header */
> + pos = buffer + 2;
> + len -= 2;
> + }
> } else {
> pos = buffer + 1;
> len = -1;
>
I think the patch is good here, but rather than "QEMU's previous model"
I'd much prefer giving a specific version e.g. QEMU < 2.5 so it's
obvious where the change occurred. In the worst case we can just
cherry-pick the ADB change for QEMU for the next release if we can't
manage to get all of the patches for QEMU upstream immediately.
ATB,
Mark.
More information about the OpenBIOS
mailing list