Skip to content

Commit fd96795

Browse files
dilingertorvalds
authored andcommitted
gxfb/lxfb: detect framebuffer size using an MSR if VSA2 isn't available
If there's no VSA2 (ie, if we're using tinybios or OpenFirmware), use the GLIU's P2D Range Offset Descriptor to determine how much memory we have available for the framebuffer. Originally based on a patch by Jordan Crouse. Tested with OpenFirmware; Pascal informs me that tinybios has a stub that fills in P2D_RO0. Signed-off-by: Andres Salomon <dilinger@debian.org> Cc: Jordan Crouse <jordan.crouse@amd.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 61a517a commit fd96795

3 files changed

Lines changed: 35 additions & 1 deletion

File tree

‎drivers/video/geode/display_gx.c‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,23 @@ unsigned int gx_frame_buffer_size(void)
2525
{
2626
unsigned int val;
2727

28-
/* FB size is reported by a virtual register */
28+
if (!geode_has_vsa2()) {
29+
uint32_t hi, lo;
30+
31+
/* The number of pages is (PMAX - PMIN)+1 */
32+
rdmsr(MSR_GLIU_P2D_RO0, lo, hi);
33+
34+
/* PMAX */
35+
val = ((hi & 0xff) << 12) | ((lo & 0xfff00000) >> 20);
36+
/* PMIN */
37+
val -= (lo & 0x000fffff);
38+
val += 1;
39+
40+
/* The page size is 4k */
41+
return (val << 12);
42+
}
43+
44+
/* FB size can be obtained from the VSA II */
2945
/* Virtual register class = 0x02 */
3046
/* VG_MEM_SIZE(512Kb units) = 0x00 */
3147

‎drivers/video/geode/lxfb_ops.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,22 @@ unsigned int lx_framebuffer_size(void)
329329
{
330330
unsigned int val;
331331

332+
if (!geode_has_vsa2()) {
333+
uint32_t hi, lo;
334+
335+
/* The number of pages is (PMAX - PMIN)+1 */
336+
rdmsr(MSR_GLIU_P2D_RO0, lo, hi);
337+
338+
/* PMAX */
339+
val = ((hi & 0xff) << 12) | ((lo & 0xfff00000) >> 20);
340+
/* PMIN */
341+
val -= (lo & 0x000fffff);
342+
val += 1;
343+
344+
/* The page size is 4k */
345+
return (val << 12);
346+
}
347+
332348
/* The frame buffer size is reported by a VSM in VSA II */
333349
/* Virtual Register Class = 0x02 */
334350
/* VG_MEM_SIZE (1MB units) = 0x00 */

‎include/asm-x86/geode.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ extern int geode_get_dev_base(unsigned int dev);
3030

3131
/* MSRS */
3232

33+
#define MSR_GLIU_P2D_RO0 0x10000029
34+
3335
#define MSR_LX_GLD_MSR_CONFIG 0x48002001
3436
#define MSR_LX_MSR_PADSEL 0x48002011 /* NOT 0x48000011; the data
3537
* sheet has the wrong value */

0 commit comments

Comments
 (0)