summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-02-10 00:25:29 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-02-10 00:25:29 +0000
commitc713d514d56ef88397e440c107be426ab156baf4 (patch)
tree2f90c9d926cde24d5f26b10f54e0e9af3e57bc08 /sys/dev/pci/drm
parent5b78a4fb661321c76171560ac0dcfbbbb9754f7b (diff)
drm/radeon: fix endian bugs in hw i2c atom routines
From Alex Deucher c787a54be43fff3f9bd2ad5990ec2c9219417af1 in ubuntu 3.8 4543eda52113d1e2cc0e9bf416f79597e6ef1ec7 in mainline linux
Diffstat (limited to 'sys/dev/pci/drm')
-rw-r--r--sys/dev/pci/drm/radeon/atombios_dp.c10
-rw-r--r--sys/dev/pci/drm/radeon/atombios_i2c.c6
2 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/pci/drm/radeon/atombios_dp.c b/sys/dev/pci/drm/radeon/atombios_dp.c
index 50e01eb0f96..59f14d71221 100644
--- a/sys/dev/pci/drm/radeon/atombios_dp.c
+++ b/sys/dev/pci/drm/radeon/atombios_dp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atombios_dp.c,v 1.2 2014/02/10 00:02:56 jsg Exp $ */
+/* $OpenBSD: atombios_dp.c,v 1.3 2014/02/10 00:25:28 jsg Exp $ */
/*
* Copyright 2007-8 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -46,6 +46,8 @@ static char *pre_emph_names[] = {
};
#endif
+void radeon_atom_copy_swap(u8 *, u8 *, u8, bool);
+
/***** radeon AUX functions *****/
/* Atom needs data in little endian format
@@ -53,7 +55,7 @@ static char *pre_emph_names[] = {
* or from atom. Note that atom operates on
* dw units.
*/
-static void radeon_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le)
+void radeon_atom_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le)
{
#ifdef __BIG_ENDIAN
u8 src_tmp[20], dst_tmp[20]; /* used for byteswapping */
@@ -103,7 +105,7 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan,
base = (unsigned char *)(rdev->mode_info.atom_context->scratch + 1);
- radeon_copy_swap(base, send, send_bytes, true);
+ radeon_atom_copy_swap(base, send, send_bytes, true);
args.v1.lpAuxRequest = cpu_to_le16((u16)(0 + 4));
args.v1.lpDataOut = cpu_to_le16((u16)(16 + 4));
@@ -140,7 +142,7 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan,
recv_bytes = recv_size;
if (recv && recv_size)
- radeon_copy_swap(recv, base + 16, recv_bytes, false);
+ radeon_atom_copy_swap(recv, base + 16, recv_bytes, false);
return recv_bytes;
}
diff --git a/sys/dev/pci/drm/radeon/atombios_i2c.c b/sys/dev/pci/drm/radeon/atombios_i2c.c
index 2b9380c3b1b..ab9cec69f50 100644
--- a/sys/dev/pci/drm/radeon/atombios_i2c.c
+++ b/sys/dev/pci/drm/radeon/atombios_i2c.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atombios_i2c.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: atombios_i2c.c,v 1.2 2014/02/10 00:25:28 jsg Exp $ */
/*
* Copyright 2011 Advanced Micro Devices, Inc.
*
@@ -28,6 +28,8 @@
#include "radeon.h"
#include "atom.h"
+extern void radeon_atom_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le);
+
#define TARGET_HW_I2C_CLOCK 50
/* these are a limitation of ProcessI2cChannelTransaction not the hw */
@@ -83,7 +85,7 @@ radeon_process_i2c_ch(struct radeon_i2c_chan *chan,
}
if (!(flags & HW_I2C_WRITE))
- memcpy(buf, base, num);
+ radeon_atom_copy_swap(buf, base, num, false);
return 0;
}