Changeset 5ceefe1 in rtems


Ignore:
Timestamp:
Sep 28, 2013, 8:08:25 AM (6 years ago)
Author:
Hesham AL-Matary <heshamelmatary@…>
Branches:
4.11, master
Children:
382f714
Parents:
0a9533fc
git-author:
Hesham AL-Matary <heshamelmatary@…> (09/28/13 08:08:25)
git-committer:
Gedare Bloom <gedare@…> (10/03/13 12:55:33)
Message:

Shared MMU initialization for ARM BSPs and RaspberryPi? MMU support

Add support for MMU initialization for RaspberryPi?. Introduce new shared
MMU configuration table that can be used by other BSPs that call the
arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache function.
Demonstrate the use of the generic table with RaspberryPi?.

Location:
c/src/lib/libbsp
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/raspberrypi/Makefile.am

    r0a9533fc r5ceefe1  
    2828
    2929include_bsp_HEADERS =
     30include_bsp_HEADERS += ../../../libbsp/shared/include/mm.h
    3031include_bsp_HEADERS += ../../shared/include/utility.h
    3132include_bsp_HEADERS += ../../shared/include/irq-generic.h
     
    3637include_bsp_HEADERS += ../shared/include/linker-symbols.h
    3738include_bsp_HEADERS += ../shared/include/start.h
     39include_bsp_HEADERS += ../shared/include/arm-cp15-start.h
    3840include_bsp_HEADERS += ../shared/lpc/include/lpc-timer.h
    3941include_bsp_HEADERS += ../shared/lpc/include/lpc-dma.h
     
    8486libbsp_a_SOURCES += ../shared/abort/simple_abort.c
    8587libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
    86 
     88libbsp_a_SOURCES += ../shared/arm-cp15-set-ttb-entries.c
    8789
    8890# Startup
     
    9294# IRQ
    9395libbsp_a_SOURCES += ../../shared/src/irq-default-handler.c
     96libbsp_a_SOURCES += ../shared/arm-cp15-set-exception-handler.c
    9497libbsp_a_SOURCES += ../../shared/src/irq-generic.c
    9598libbsp_a_SOURCES += ../../shared/src/irq-info.c
     
    128131libbsp_a_SOURCES += startup/bspstarthooks.c
    129132
     133# LIBMM
     134libbsp_a_SOURCES += startup/mm_config_table.c
     135libbsp_a_SOURCES += ../shared/mminit.c
     136
    130137###############################################################################
    131138# Network                                                    #
  • c/src/lib/libbsp/arm/raspberrypi/preinstall.am

    r0a9533fc r5ceefe1  
    6363PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/bootcard.h
    6464
     65$(PROJECT_INCLUDE)/bsp/mm.h: ../../../libbsp/shared/include/mm.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     66        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/mm.h
     67PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/mm.h
     68
    6569$(PROJECT_INCLUDE)/bsp/utility.h: ../../shared/include/utility.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
    6670        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/utility.h
     
    9498        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/start.h
    9599PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/start.h
     100
     101$(PROJECT_INCLUDE)/bsp/arm-cp15-start.h: ../shared/include/arm-cp15-start.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     102        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/arm-cp15-start.h
     103PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/arm-cp15-start.h
    96104
    97105$(PROJECT_INCLUDE)/bsp/lpc-timer.h: ../shared/lpc/include/lpc-timer.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
  • c/src/lib/libbsp/arm/raspberrypi/startup/bspstarthooks.c

    r0a9533fc r5ceefe1  
    88
    99/*
     10 * Copyright (c) 2013. Hesham AL-Matary
    1011 * Copyright (c) 2013 by Alan Cudmore
    1112 * based on work by:
     
    2526#include <bsp/start.h>
    2627#include <bsp/raspberrypi.h>
    27 #include <bsp/mmu.h>
    28 
    29 static void BSP_START_TEXT_SECTION raspberrypi_cache_setup(void)
    30 {
    31   uint32_t ctrl = 0;
    32 
    33   /* Disable MMU and cache, basic settings */
    34   ctrl = arm_cp15_get_control();
    35   ctrl &= ~(ARM_CP15_CTRL_I | ARM_CP15_CTRL_R | ARM_CP15_CTRL_C
    36     | ARM_CP15_CTRL_V | ARM_CP15_CTRL_M);
    37   ctrl |= ARM_CP15_CTRL_S;
    38   arm_cp15_set_control(ctrl);
    39 
    40   arm_cp15_cache_invalidate();
    41   arm_cp15_tlb_invalidate();
    42 
    43 }
    44 
     28#include <bsp/mm.h>
    4529
    4630void BSP_START_TEXT_SECTION bsp_start_hook_0(void)
    4731{
    48   raspberrypi_cache_setup();
    4932}
    5033
     
    5336{
    5437  bsp_start_copy_sections();
     38  bsp_memory_management_initialize();
    5539  bsp_start_clear_bss();
    5640}
  • c/src/lib/libbsp/arm/raspberrypi/startup/linkcmds

    r0a9533fc r5ceefe1  
    3636MEMORY {
    3737        VECTOR_RAM     (AIW) : ORIGIN = 0x0       , LENGTH = 0x8000
    38         RAM            (AIW) : ORIGIN = 0x00008000, LENGTH = 128M - 0x8000
     38        RAM            (AIW) : ORIGIN = 0x00008000, LENGTH = 128M - 48K
     39        RAM_MMU        (AIW) : ORIGIN = 128M - 16k, LENGTH = 16k
    3940}
    4041
     
    5960
    6061bsp_section_robarrier_align = DEFINED (bsp_section_robarrier_align) ? bsp_section_robarrier_align : 1M;
     62bsp_translation_table_base = ORIGIN (RAM_MMU);
    6163
    6264INCLUDE linkcmds.armv4
  • c/src/lib/libbsp/arm/shared/include/arm-cp15-start.h

    r0a9533fc r5ceefe1  
    11/*
     2 * Copyright (c) 2013 Hesham AL-Matary.
    23 * Copyright (c) 2009-2013 embedded brains GmbH.  All rights reserved.
    34 *
     
    1718
    1819#include <libcpu/arm-cp15.h>
    19 
    2020#include <bsp/start.h>
    2121
     
    2323extern "C" {
    2424#endif /* __cplusplus */
     25
     26typedef struct {
     27  uint32_t begin;
     28  uint32_t end;
     29  uint32_t flags;
     30} arm_cp15_start_section_config;
     31
     32extern const arm_cp15_start_section_config bsp_mm_config_table[];
     33extern const size_t bsp_mm_config_table_size;
    2534
    2635BSP_START_TEXT_SECTION static inline void
     
    4756BSP_START_TEXT_SECTION static inline uint32_t
    4857arm_cortex_a9_get_multiprocessor_cpu_id(void);
    49 
    50 typedef struct {
    51   uint32_t begin;
    52   uint32_t end;
    53   uint32_t flags;
    54 } arm_cp15_start_section_config;
    5558
    5659BSP_START_TEXT_SECTION static inline void
     
    8891  arm_cp15_set_translation_table_base(ttb);
    8992
    90   /* Initialize translation table with invalid entries */
     93  /* Initialize translation table with fixed-map read-write entries */
    9194  for (i = 0; i < ARM_MMU_TRANSLATION_TABLE_ENTRY_COUNT; ++i) {
    92     ttb [i] = 0;
     95    ttb [i] = (i << ARM_MMU_SECT_BASE_SHIFT) | ARMV7_MMU_DATA_READ_WRITE;
    9396  }
    9497
     
    98101
    99102  /* Enable MMU and cache */
    100   ctrl |= ARM_CP15_CTRL_I | ARM_CP15_CTRL_C | ARM_CP15_CTRL_M;
     103  ctrl |= ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_S | ARM_CP15_CTRL_I |
     104          ARM_CP15_CTRL_C | ARM_CP15_CTRL_M  | ARM_CP15_CTRL_XP;
     105
    101106  arm_cp15_set_control(ctrl);
    102107}
Note: See TracChangeset for help on using the changeset viewer.