diff --git a/src/arch/arm/include/arch/memlayout.h b/src/arch/arm/include/arch/memlayout.h index f26aa9d077..18a77d657f 100644 --- a/src/arch/arm/include/arch/memlayout.h +++ b/src/arch/arm/include/arch/memlayout.h @@ -22,6 +22,8 @@ #ifndef __ARCH_MEMLAYOUT_H #define __ARCH_MEMLAYOUT_H +#define SUPERPAGE_SIZE ((1 + IS_ENABLED(CONFIG_ARM_LPAE)) * 1M) + #define TTB(addr, size) \ REGION(ttb, addr, size, 16K) \ _ = ASSERT(size >= 16K + IS_ENABLED(CONFIG_ARM_LPAE) * 32, \ @@ -38,8 +40,13 @@ _ = ASSERT(size >= 2K, "stack should be >= 2K, see toolchain.inc"); #define DMA_COHERENT(addr, size) \ - REGION(dma_coherent, addr, size, (1 + IS_ENABLED(CONFIG_ARM_LPAE)) * 1M) \ - _ = ASSERT(size % ((1 + IS_ENABLED(CONFIG_ARM_LPAE)) * 1M) == 0, \ + REGION(dma_coherent, addr, size, SUPERPAGE_SIZE) \ + _ = ASSERT(size % SUPERPAGE_SIZE == 0, \ "DMA coherency buffer must fit exactly in full superpages!"); +#define FRAMEBUFFER(addr, size) \ + REGION(framebuffer, addr, size, SUPERPAGE_SIZE) \ + _ = ASSERT(size % SUPERPAGE_SIZE == 0, \ + "Framebuffer must fit exactly in full superpages!"); + #endif /* __ARCH_MEMLAYOUT_H */ diff --git a/src/include/symbols.h b/src/include/symbols.h index 6ba692f8b8..041f8c1d9c 100644 --- a/src/include/symbols.h +++ b/src/include/symbols.h @@ -81,4 +81,8 @@ extern u8 _dma_coherent[]; extern u8 _edma_coherent[]; #define _dma_coherent_size (_edma_coherent - _dma_coherent) +extern u8 _framebuffer[]; +extern u8 _eframebuffer[]; +#define _framebuffer_size (_eframebuffer - _framebuffer) + #endif /* __SYMBOLS_H */ diff --git a/src/soc/rockchip/rk3288/cbmem.c b/src/soc/rockchip/rk3288/cbmem.c index 1c3a902d0e..2eed97281a 100644 --- a/src/soc/rockchip/rk3288/cbmem.c +++ b/src/soc/rockchip/rk3288/cbmem.c @@ -18,11 +18,11 @@ */ #include -#include #include +#include void *cbmem_top(void) { - return (void *)(get_fb_base_kb()*KiB); + return _dram + (size_t)CONFIG_DRAM_SIZE_MB*MiB; } diff --git a/src/soc/rockchip/rk3288/include/soc/memlayout.ld b/src/soc/rockchip/rk3288/include/soc/memlayout.ld index d0073b1807..21ffc6c63e 100644 --- a/src/soc/rockchip/rk3288/include/soc/memlayout.ld +++ b/src/soc/rockchip/rk3288/include/soc/memlayout.ld @@ -31,6 +31,7 @@ SECTIONS RAMSTAGE(0x00200000, 128K) POSTRAM_CBFS_CACHE(0x01000000, 1M) DMA_COHERENT(0x10000000, 2M) + FRAMEBUFFER(0x10800000, 8M) SRAM_START(0xFF700000) TTB(0xFF700000, 16K) diff --git a/src/soc/rockchip/rk3288/include/soc/soc.h b/src/soc/rockchip/rk3288/include/soc/soc.h index 7548959be0..566802ab53 100644 --- a/src/soc/rockchip/rk3288/include/soc/soc.h +++ b/src/soc/rockchip/rk3288/include/soc/soc.h @@ -24,12 +24,4 @@ #define RK_SETBITS(set) RK_CLRSETBITS(0, set) #define RK_CLRBITS(clr) RK_CLRSETBITS(clr, 0) -#define FB_SIZE_KB 8192 -#define RAM_BASE_KB (CONFIG_SYS_SDRAM_BASE >> 10) -#define RAM_SIZE_KB (CONFIG_DRAM_SIZE_MB << 10UL) - -static inline u32 get_fb_base_kb(void) -{ - return RAM_BASE_KB + RAM_SIZE_KB - FB_SIZE_KB; -} #endif diff --git a/src/soc/rockchip/rk3288/soc.c b/src/soc/rockchip/rk3288/soc.c index f366f958fe..519351c7fa 100644 --- a/src/soc/rockchip/rk3288/soc.c +++ b/src/soc/rockchip/rk3288/soc.c @@ -23,33 +23,27 @@ #include #include #include +#include #include #include #include #include +#include #include -#include #include "chip.h" -static void soc_enable(device_t dev) -{ - -} - static void soc_init(device_t dev) { - unsigned long fb_size = FB_SIZE_KB * KiB; - u32 lcdbase = get_fb_base_kb() * KiB; - - ram_resource(dev, 0, RAM_BASE_KB, RAM_SIZE_KB); - mmio_resource(dev, 1, lcdbase / KiB, fb_size / KiB); + ram_resource(dev, 0, (uintptr_t)_dram/KiB, + CONFIG_DRAM_SIZE_MB*(MiB/KiB)); if (vboot_skip_display_init()) printk(BIOS_INFO, "Skipping display init.\n"); #if !IS_ENABLED(CONFIG_SKIP_DISPLAY_INIT_HACK) else - rk_display_init(dev, lcdbase, fb_size); + rk_display_init(dev, (uintptr_t)_framebuffer, + _framebuffer_size); #endif } @@ -61,7 +55,6 @@ static void soc_noop(device_t dev) static struct device_operations soc_ops = { .read_resources = soc_noop, .set_resources = soc_noop, - .enable_resources = soc_enable, .init = soc_init, .scan_bus = 0, };