drm/nouveau/device: detect if changing endianness failed
v2: relax the checks a little Signed-off-by: Karol Herbst <kherbst@redhat.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
24d5ff40a7
commit
51c05340e4
|
@ -2924,6 +2924,20 @@ nvkm_device_del(struct nvkm_device **pdevice)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
nvkm_device_endianness(void __iomem *pri)
|
||||||
|
{
|
||||||
|
u32 boot1 = ioread32_native(pri + 0x000004) & 0x01000001;
|
||||||
|
#ifdef __BIG_ENDIAN
|
||||||
|
if (!boot1)
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
if (boot1)
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nvkm_device_ctor(const struct nvkm_device_func *func,
|
nvkm_device_ctor(const struct nvkm_device_func *func,
|
||||||
const struct nvkm_device_quirk *quirk,
|
const struct nvkm_device_quirk *quirk,
|
||||||
|
@ -2973,13 +2987,15 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
|
||||||
/* identify the chipset, and determine classes of subdev/engines */
|
/* identify the chipset, and determine classes of subdev/engines */
|
||||||
if (detect) {
|
if (detect) {
|
||||||
/* switch mmio to cpu's native endianness */
|
/* switch mmio to cpu's native endianness */
|
||||||
#ifndef __BIG_ENDIAN
|
if (!nvkm_device_endianness(map)) {
|
||||||
if (ioread32_native(map + 0x000004) != 0x00000000) {
|
|
||||||
#else
|
|
||||||
if (ioread32_native(map + 0x000004) == 0x00000000) {
|
|
||||||
#endif
|
|
||||||
iowrite32_native(0x01000001, map + 0x000004);
|
iowrite32_native(0x01000001, map + 0x000004);
|
||||||
ioread32_native(map);
|
ioread32_native(map);
|
||||||
|
if (!nvkm_device_endianness(map)) {
|
||||||
|
nvdev_error(device,
|
||||||
|
"GPU not supported on big-endian\n");
|
||||||
|
ret = -ENOSYS;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read boot0 and strapping information */
|
/* read boot0 and strapping information */
|
||||||
|
|
Loading…
Reference in New Issue