From f1d2752f31eed1c8621701f975cf29438cf32a26 Mon Sep 17 00:00:00 2001 From: Nathan Whitehorn Date: Mon, 5 Jan 2015 00:50:16 +0000 Subject: [PATCH] Make PS3 work with the userspace kboot loader. loader.ps3 will disappear from the tree in the near future. Done at: Hackathon --- sys/dev/vt/hw/fb/vt_fb.c | 9 +++++++++ sys/powerpc/ps3/ps3_syscons.c | 7 +++++-- sys/sys/fbio.h | 3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/sys/dev/vt/hw/fb/vt_fb.c b/sys/dev/vt/hw/fb/vt_fb.c index 422bb034bf16..044b64161099 100644 --- a/sys/dev/vt/hw/fb/vt_fb.c +++ b/sys/dev/vt/hw/fb/vt_fb.c @@ -154,6 +154,9 @@ vt_fb_setpixel(struct vt_device *vd, int x, int y, term_color_t color) c = info->fb_cmap[color]; o = info->fb_stride * y + x * FBTYPE_GET_BYTESPP(info); + if (info->fb_flags & FB_FLAG_NOWRITE) + return; + KASSERT((info->fb_vbase != 0), ("Unmapped framebuffer")); switch (FBTYPE_GET_BYTESPP(info)) { @@ -205,6 +208,9 @@ vt_fb_blank(struct vt_device *vd, term_color_t color) info = vd->vd_softc; c = info->fb_cmap[color]; + if (info->fb_flags & FB_FLAG_NOWRITE) + return; + KASSERT((info->fb_vbase != 0), ("Unmapped framebuffer")); switch (FBTYPE_GET_BYTESPP(info)) { @@ -260,6 +266,9 @@ vt_fb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw, b = m = 0; bpl = (width + 7) >> 3; /* Bytes per source line. */ + if (info->fb_flags & FB_FLAG_NOWRITE) + return; + KASSERT((info->fb_vbase != 0), ("Unmapped framebuffer")); line = (info->fb_stride * y) + (x * bpp); diff --git a/sys/powerpc/ps3/ps3_syscons.c b/sys/powerpc/ps3/ps3_syscons.c index 1b669aa3866a..29c68fd0e540 100644 --- a/sys/powerpc/ps3/ps3_syscons.c +++ b/sys/powerpc/ps3/ps3_syscons.c @@ -155,7 +155,8 @@ ps3fb_remap(void) sc->fb_info.fb_pbase = fb_paddr; for (va = 0; va < PS3FB_SIZE; va += PAGE_SIZE) pmap_kenter_attr(0x10000000 + va, fb_paddr + va, - VM_MEMATTR_WRITE_COMBINING); + VM_MEMATTR_WRITE_COMBINING); + sc->fb_info.fb_flags &= ~FB_FLAG_NOWRITE; } static int @@ -175,10 +176,12 @@ ps3fb_init(struct vt_device *vd) sc->fb_info.fb_bpp = sc->fb_info.fb_stride / sc->fb_info.fb_width * 8; /* - * The loader puts the FB at 0x10000000, so use that for now. + * Arbitrarily choose address for the framebuffer */ sc->fb_info.fb_vbase = 0x10000000; + sc->fb_info.fb_flags |= FB_FLAG_NOWRITE; /* Not available yet */ + sc->fb_info.fb_cmsize = 16; /* 32-bit VGA palette */ vt_generate_cons_palette(sc->fb_info.fb_cmap, COLOR_FORMAT_RGB, diff --git a/sys/sys/fbio.h b/sys/sys/fbio.h index a88e305a4455..c47304ac9661 100644 --- a/sys/sys/fbio.h +++ b/sys/sys/fbio.h @@ -135,9 +135,10 @@ struct fb_info { void *fb_priv; /* First argument for read/write. */ const char *fb_name; uint32_t fb_flags; +#define FB_FLAG_NOMMAP 1 /* mmap unsupported. */ +#define FB_FLAG_NOWRITE 2 /* disable writes for the time being */ int fb_stride; int fb_bpp; /* bits per pixel */ -#define FB_FLAG_NOMMAP 1 /* mmap unsupported. */ uint32_t fb_cmap[16]; };