summaryrefslogtreecommitdiffstats
path: root/drivers/video/fbdev/sm712.h
diff options
context:
space:
mode:
authorYifeng Li <tomli@tomli.me>2019-04-01 17:46:59 +0200
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2019-04-01 17:46:59 +0200
commit9e0e59993df0601cddb95c4f6c61aa3d5e753c00 (patch)
treefba9d9f33b69fcc61ac82dbd7022ce6f7970b168 /drivers/video/fbdev/sm712.h
parentec1587d5073f29820e358f3a383850d61601d981 (diff)
downloadlinux-stable-9e0e59993df0601cddb95c4f6c61aa3d5e753c00.tar.gz
linux-stable-9e0e59993df0601cddb95c4f6c61aa3d5e753c00.tar.bz2
linux-stable-9e0e59993df0601cddb95c4f6c61aa3d5e753c00.zip
fbdev: sm712fb: fix crashes during framebuffer writes by correctly mapping VRAM
On a Thinkpad s30 (Pentium III / i440MX, Lynx3DM), running fbtest or X will crash the machine instantly, because the VRAM/framebuffer is not mapped correctly. On SM712, the framebuffer starts at the beginning of address space, but SM720's framebuffer starts at the 1 MiB offset from the beginning. However, sm712fb fails to take this into account, as a result, writing to the framebuffer will destroy all the registers and kill the system immediately. Another problem is the driver assumes 8 MiB of VRAM for SM720, but some SM720 system, such as this IBM Thinkpad, only has 4 MiB of VRAM. Fix this problem by removing the hardcoded VRAM size, adding a function to query the amount of VRAM from register MCR76 on SM720, and adding proper framebuffer offset. Please note that the memory map may have additional problems on Big-Endian system, which is not available for testing by myself. But I highly suspect that the original code is also broken on Big-Endian machines for SM720, so at least we are not making the problem worse. More, the driver also assumed SM710/SM712 has 4 MiB of VRAM, but it has a 2 MiB version as well, and used in earlier laptops, such as IBM Thinkpad 240X, the driver would probably crash on them. I've never seen one of those machines and cannot fix it, but I have documented these problems in the comments. Signed-off-by: Yifeng Li <tomli@tomli.me> Tested-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Cc: Teddy Wang <teddy.wang@siliconmotion.com> Cc: <stable@vger.kernel.org> # v4.4+ Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Diffstat (limited to 'drivers/video/fbdev/sm712.h')
-rw-r--r--drivers/video/fbdev/sm712.h5
1 files changed, 0 insertions, 5 deletions
diff --git a/drivers/video/fbdev/sm712.h b/drivers/video/fbdev/sm712.h
index aad1cc4be34a..2cba1e73ed24 100644
--- a/drivers/video/fbdev/sm712.h
+++ b/drivers/video/fbdev/sm712.h
@@ -19,11 +19,6 @@
#define SCREEN_Y_RES 600
#define SCREEN_BPP 16
-/*Assume SM712 graphics chip has 4MB VRAM */
-#define SM712_VIDEOMEMORYSIZE 0x00400000
-/*Assume SM722 graphics chip has 8MB VRAM */
-#define SM722_VIDEOMEMORYSIZE 0x00800000
-
#define dac_reg (0x3c8)
#define dac_val (0x3c9)