svn commit: r209707 - user/nwhitehorn/ps3/powerpc/ps3
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Mon Jul 5 01:12:41 UTC 2010
Author: nwhitehorn
Date: Mon Jul 5 01:12:41 2010
New Revision: 209707
URL: http://svn.freebsd.org/changeset/base/209707
Log:
Teach the PS3 syscons module how to reopen the framebuffer.
Modified:
user/nwhitehorn/ps3/powerpc/ps3/ps3_syscons.c
Modified: user/nwhitehorn/ps3/powerpc/ps3/ps3_syscons.c
==============================================================================
--- user/nwhitehorn/ps3/powerpc/ps3/ps3_syscons.c Mon Jul 5 01:11:41 2010 (r209706)
+++ user/nwhitehorn/ps3/powerpc/ps3/ps3_syscons.c Mon Jul 5 01:12:41 2010 (r209707)
@@ -42,20 +42,35 @@ __FBSDID("$FreeBSD$");
#include <sys/fbio.h>
#include <sys/consio.h>
+#include <vm/vm.h>
+#include <vm/pmap.h>
+
#include <machine/bus.h>
#include <machine/sc_machdep.h>
#include <machine/platform.h>
+#include <machine/pmap.h>
#include <sys/rman.h>
#include <dev/fb/fbreg.h>
#include <dev/syscons/syscons.h>
+#include "ps3-hvcall.h"
+
+#define PS3FB_SIZE (4*1024*1024)
+
+#define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_MODE_SET 0x0100
+#define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC 0x0101
+#define L1GPU_DISPLAY_SYNC_HSYNC 1
+#define L1GPU_DISPLAY_SYNC_VSYNC 2
+#define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP 0x0102
+
extern u_char dflt_font_16[];
extern u_char dflt_font_14[];
extern u_char dflt_font_8[];
static int ps3fb_configure(int flags);
+void ps3fb_remap(void);
static vi_probe_t ps3fb_probe;
static vi_init_t ps3fb_init;
@@ -210,7 +225,6 @@ static int
ps3fb_configure(int flags)
{
struct ps3fb_softc *sc;
- vm_offset_t fb_phys;
int disable;
char compatible[64];
#if 0
@@ -250,22 +264,44 @@ ps3fb_configure(int flags)
sc->sc_stride = sc->sc_width*4;
/*
- * Grab the physical address of the framebuffer, and then map it
- * into our memory space. If the MMU is not yet up, it will be
- * remapped for us when relocation turns on.
- *
- * XXX We assume #address-cells is 1 at this point.
+ * The loader puts the FB at 0x10000000, so use that for now.
*/
- fb_phys = 0x10000000;
-
- bus_space_map(&bs_be_tag, fb_phys, sc->sc_height * sc->sc_stride,
- 0, &sc->sc_addr);
+ sc->sc_addr = 0x10000000;
ps3fb_init(0, &sc->sc_va, 0);
return (0);
}
+void
+ps3fb_remap(void)
+{
+ vm_offset_t va, fb_paddr;
+ uint64_t fbhandle, fbcontext;
+
+ lv1_gpu_close();
+ lv1_gpu_open(0);
+
+ lv1_gpu_context_attribute(0, L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_MODE_SET,
+ 0,0,0,0);
+ lv1_gpu_context_attribute(0, L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_MODE_SET,
+ 0,0,1,0);
+ lv1_gpu_context_attribute(0, L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC,
+ 0,L1GPU_DISPLAY_SYNC_VSYNC,0,0);
+ lv1_gpu_context_attribute(0, L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC,
+ 1,L1GPU_DISPLAY_SYNC_VSYNC,0,0);
+ lv1_gpu_memory_allocate(PS3FB_SIZE, 0, 0, 0, 0, &fbhandle, &fb_paddr);
+ lv1_gpu_context_allocate(fbhandle, 0, &fbcontext);
+
+ lv1_gpu_context_attribute(fbcontext,
+ L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP, 0, 0, 0, 0);
+ lv1_gpu_context_attribute(fbcontext,
+ L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP, 1, 0, 0, 0);
+
+ for (va = 0; va < PS3FB_SIZE; va += PAGE_SIZE)
+ pmap_kenter(0x10000000 + va, fb_paddr + va);
+}
+
static int
ps3fb_probe(int unit, video_adapter_t **adp, void *arg, int flags)
{
More information about the svn-src-user
mailing list