
Author: mcayland Date: Fri Oct 23 14:58:18 2015 New Revision: 1351 URL: http://tracker.coreboot.org/trac/openbios/changeset/1351 Log: ppc: fix CUDA ADB error packet detection CUDA ADB error packets contain a 3-byte payload rather than a standard 2-byte header plus payload (as seen in QEMU <= 2.4). Allow cuda_adb_req() to differentiate between the two formats and act accordingly. Signed-off-by: Cormac O'Brien <cormac@c-obrien.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Modified: trunk/openbios-devel/drivers/cuda.c Modified: trunk/openbios-devel/drivers/cuda.c ============================================================================== --- trunk/openbios-devel/drivers/cuda.c Fri Oct 23 14:58:16 2015 (r1350) +++ trunk/openbios-devel/drivers/cuda.c Fri Oct 23 14:58:18 2015 (r1351) @@ -144,8 +144,22 @@ // 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; + /* We handle 2 types of ADB packet here: + Normal: <type> <status> <data> ... + Error : <type> <status> <cmd> (<data> ...) + Ideally we should use buffer[1] (status) to determine whether this + is a normal or error packet but this requires a corresponding fix + in QEMU <= 2.4. Hence we temporarily handle it this way to ease + the transition. */ + if (len > 2 && buffer[2] == snd_buf[0]) { + /* Error */ + pos = buffer + 3; + len -= 3; + } else { + /* Normal */ + pos = buffer + 2; + len -= 2; + } } else { pos = buffer + 1; len = -1;
participants (1)
-
repository service