From a4d7e4cee77d16b0e34ef543f0804e7eb2954137 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Tue, 6 Aug 2019 20:00:56 +1000 Subject: arm/raspberry: Set the workspace based on the mailbox version. - Update the linkcmd file to support configure settings - Set the workspace size based on the revision value --- bsps/arm/raspberrypi/start/bspstart.c | 93 +++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) (limited to 'bsps/arm/raspberrypi/start/bspstart.c') diff --git a/bsps/arm/raspberrypi/start/bspstart.c b/bsps/arm/raspberrypi/start/bspstart.c index c5786bfa4a..6ff286f840 100644 --- a/bsps/arm/raspberrypi/start/bspstart.c +++ b/bsps/arm/raspberrypi/start/bspstart.c @@ -22,8 +22,101 @@ #include #include #include +#include + +static const struct { + uint32_t code; + const char* label; +} rpi_codes[] = +{ + { 0x900021, "A+ 1.1 (512MB)" }, + { 0x900032, "B+ 1.2 (512MB)" }, + { 0x900092, "Zero 1.2 (512MB)" }, + { 0x900093, "Zero 1.3 (512MB)" }, + { 0x9000c1, "Zero W 1.1 (512MB)" }, + { 0x9020e0, "3A+ 1.0 (512MB)" }, + { 0x920092, "Zero 1.2 (512MB)" }, + { 0x920093, "Zero 1.3 (512MB)" }, + { 0x900061, "CM 1.1 (512MB)" }, + { 0xa01040, "2B 1.0 (1GB)" }, + { 0xa01041, "2B 1.1 (1GB)" }, + { 0xa02082, "3B 1.2 (1GB)" }, + { 0xa020a0, "CM3 1.0 (1GB)" }, + { 0xa020d3, "3B+ 1.3 (1GB)" }, + { 0xa21041, "2B 1.1 (1GB)" }, + { 0xa22042, "2B 1,2 (with BCM2837) (1GB)" }, + { 0xa22082, "3B 1.2 (1GB)" }, + { 0xa220a0, "CM3 1.0 (1GB)" }, + { 0xa32082, "3B 1.2 (1GB)" }, + { 0xa52082, "3B 1.2 (1GB)" }, + { 0xa22083, "3B 1.3 (1GB)" }, + { 0xa02100, "CM3+ 1.0 (1GB)" }, + { 0xa03111, "4B 1.1 (1GB)" }, + { 0xb03111, "4B 1.1 (2GB)" }, + { 0xc03111, "4B 1.1 (4GB)" }, +}; + +static const char* rpi_types[] = { + "A", + "B", + "A+", + "B+", + "2B", + "Alpha (early prototype)", + "CM1", + "3B", + "Zero", + "CM3", + "Zero W", + "3B+", + "3A+", + "Internal use only", + "CM3+", + "4B", +}; + +static const char* rpi_mem[] = +{ + "256MB", + "512MB", + "1GB", + "2GB", + "4GB" +}; + +#define NUMOF(_s) (sizeof(_s) / sizeof(_s[0])) void bsp_start(void) { + bcm2835_get_board_spec_entries spec = { 0 }; + + printk("\nRTEMS RPi "); + if (bcm2835_mailbox_get_board_revision( &spec ) >= 0) { + size_t i; + for (i = 0; i < NUMOF(rpi_codes); ++i) { + if (rpi_codes[i].code == spec.spec) { + printk("%s [%08x]", rpi_codes[i].label, spec.spec); + break; + } + } + if (i >= NUMOF(rpi_codes)) { + uint32_t type = (spec.spec >> 4) & 0xff; + uint32_t mem = (spec.spec >> (4 + 4 + 8 + 4)) & 0xf; + printk(" unknown code [%08x] ", spec.spec); + if (type < NUMOF(rpi_types)) + printk(rpi_types[type]); + else + printk("type: %02x", type); + if (mem < NUMOF(rpi_mem)) + printk(" %s", rpi_mem[mem]); + else + printk(" mem: %x", mem); + } + printk("\n"); + } + else { + printk(": ERROR reading mailbox\n"); + } + bsp_interrupt_initialize(); } -- cgit v1.2.3