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(a)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 9555dea..deceacf 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;
--
2.4.5
On Fedora, powerpc64 cross-compiler is part of the distro, not
the powerpc32 compiler.
As I'm lazy and powerpc64 cross-compiler is able to generate
32bit binaries, this patch modifies switch-arch to allow
to use cross-compiler from a list of architectures instead of
only the target architecture.
I've modified only the powerpc32 target, as I'm not able to test
the other architectures (and Fedora provides only cross-compiler
for powerpc).
Signed-off-by: Laurent Vivier <laurent(a)vivier.eu>
---
config/scripts/switch-arch | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/config/scripts/switch-arch b/config/scripts/switch-arch
index d5e2f77..7b8b457 100755
--- a/config/scripts/switch-arch
+++ b/config/scripts/switch-arch
@@ -99,23 +99,25 @@ archname()
select_prefix()
{
- TARGETS="${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi-"
+ for target_arch ; do
+ TARGETS="${target_arch}-unknown-linux-gnu- ${target_arch}-linux-gnu- ${target_arch}-linux- ${target_arch}-elf- ${target_arch}-eabi-"
- if [ x"$CROSS_COMPILE" != "x" ]; then
- TARGETS=$CROSS_COMPILE
- fi
+ if [ x"$CROSS_COMPILE" != "x" ]; then
+ TARGETS=$CROSS_COMPILE
+ fi
- for TARGET in $TARGETS
- do
- if type ${TARGET}gcc > /dev/null 2>&1
- then
+ for TARGET in $TARGETS
+ do
+ if type ${TARGET}gcc > /dev/null 2>&1
+ then
+ return
+ fi
+ done
+ if [ "$ARCH" = "$HOSTARCH" ]; then
return
fi
done
- if [ "$ARCH" = "$HOSTARCH" ]; then
- return
- fi
- echo "ERROR: no ${1} cross-compiler found !" 1>&2
+ echo "ERROR: no $* cross-compiler found !" 1>&2
exit 1
}
@@ -251,7 +253,7 @@ for ARCH in $arch_list; do
;;
ppc)
- select_prefix powerpc
+ select_prefix powerpc powerpc64
if [ "$unix" = "no" ]; then
CFLAGS="-m32 -msoft-float -fno-builtin-bcopy -fno-builtin-log2"
AS_FLAGS="-m32"
--
2.4.3
Author: mcayland
Date: Sun Jul 12 14:24:11 2015
New Revision: 1347
URL: http://tracker.coreboot.org/trac/openbios/changeset/1347
Log:
switch-arch: select 64bit compiler if 32bit compiler is not found
On Fedora, powerpc64 cross-compiler is part of the distro, not
the powerpc32 compiler.
As I'm lazy and powerpc64 cross-compiler is able to generate
32bit binaries, this patch modifies switch-arch to allow
to use cross-compiler from a list of architectures instead of
only the target architecture.
I've modified only the powerpc32 target, as I'm not able to test
the other architectures (and Fedora provides only cross-compiler
for powerpc).
Signed-off-by: Laurent Vivier <laurent(a)vivier.eu>
Sigend-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Modified:
trunk/openbios-devel/config/scripts/switch-arch
Modified: trunk/openbios-devel/config/scripts/switch-arch
==============================================================================
--- trunk/openbios-devel/config/scripts/switch-arch Sun Jun 21 20:52:51 2015 (r1346)
+++ trunk/openbios-devel/config/scripts/switch-arch Sun Jul 12 14:24:11 2015 (r1347)
@@ -99,23 +99,25 @@
select_prefix()
{
- TARGETS="${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi-"
+ for target_arch ; do
+ TARGETS="${target_arch}-unknown-linux-gnu- ${target_arch}-linux-gnu- ${target_arch}-linux- ${target_arch}-elf- ${target_arch}-eabi-"
- if [ x"$CROSS_COMPILE" != "x" ]; then
- TARGETS=$CROSS_COMPILE
- fi
+ if [ x"$CROSS_COMPILE" != "x" ]; then
+ TARGETS=$CROSS_COMPILE
+ fi
- for TARGET in $TARGETS
- do
- if type ${TARGET}gcc > /dev/null 2>&1
- then
+ for TARGET in $TARGETS
+ do
+ if type ${TARGET}gcc > /dev/null 2>&1
+ then
+ return
+ fi
+ done
+ if [ "$ARCH" = "$HOSTARCH" ]; then
return
fi
done
- if [ "$ARCH" = "$HOSTARCH" ]; then
- return
- fi
- echo "ERROR: no ${1} cross-compiler found !" 1>&2
+ echo "ERROR: no $* cross-compiler found !" 1>&2
exit 1
}
@@ -251,7 +253,7 @@
;;
ppc)
- select_prefix powerpc
+ select_prefix powerpc powerpc64
if [ "$unix" = "no" ]; then
CFLAGS="-m32 -msoft-float -fno-builtin-bcopy -fno-builtin-log2"
AS_FLAGS="-m32"