From 9c5daacfac459a36a56934429a7c9e4ed43f4150 Mon Sep 17 00:00:00 2001 From: gonzo Date: Fri, 30 Oct 2015 00:24:37 +0000 Subject: [PATCH] Fix framebuffer compatibility with new RPi firmware. Framebuffer driver receives video memory address from VideoCore through property mailbox channel. Older versions of firmware (and the one that is currently part of sysutils/u-boot-rpi and sysutils/u-boot-rpi2) returned real physical address, newer one returns VideoCore bus address, so we need to convert it to actual physical address. this version works with both older and newer interface. --- sys/arm/broadcom/bcm2835/bcm2835_mbox.c | 2 +- sys/arm/broadcom/bcm2835/bcm2835_vcbus.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_mbox.c b/sys/arm/broadcom/bcm2835/bcm2835_mbox.c index 5940ad66a241..78384ebc9236 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_mbox.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_mbox.c @@ -577,7 +577,7 @@ bcm2835_mbox_fb_init(device_t dev, struct bcm2835_fb_config *fb) fb->xoffset = msg->offset.body.resp.x; fb->yoffset = msg->offset.body.resp.y; fb->pitch = msg->pitch.body.resp.pitch; - fb->base = msg->buffer.body.resp.fb_address; + fb->base = VCBUS_TO_PHYS(msg->buffer.body.resp.fb_address); fb->size = msg->buffer.body.resp.fb_size; } diff --git a/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h b/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h index 7b79b1ab5ea4..e1d44b31f76d 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h +++ b/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h @@ -67,6 +67,6 @@ * when address is returned by VC over mailbox interface. e.g. * framebuffer base */ -#define VCBUS_TO_PHYS(vca) ((vca) - BCM2835_VCBUS_SDRAM_BASE) +#define VCBUS_TO_PHYS(vca) ((vca) & ~(BCM2835_VCBUS_SDRAM_BASE)) #endif /* _BCM2835_VCBUS_H_ */ -- 2.39.5