From owner-svn-src-user@FreeBSD.ORG Mon Jul 5 01:12:41 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 802311065675; Mon, 5 Jul 2010 01:12:41 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6673F8FC18; Mon, 5 Jul 2010 01:12:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o651CfNp099797; Mon, 5 Jul 2010 01:12:41 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o651Cf5O099795; Mon, 5 Jul 2010 01:12:41 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201007050112.o651Cf5O099795@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 5 Jul 2010 01:12:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209707 - user/nwhitehorn/ps3/powerpc/ps3 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2010 01:12:41 -0000 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 #include +#include +#include + #include #include #include +#include #include #include #include +#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) {