Changeset 01595a4 in rtems for bsps


Ignore:
Timestamp:
Oct 24, 2018, 8:17:58 AM (10 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
522d4b91
Parents:
8ba76b9
git-author:
Sebastian Huber <sebastian.huber@…> (10/24/18 08:17:58)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/24/18 08:19:14)
Message:

bsp/imx: Adjust workspace according to device tree

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bsps/arm/imx/start/bspstarthooks.c

    r8ba76b9 r01595a4  
    11/*
    2  * Copyright (c) 2013, 2017 embedded brains GmbH.  All rights reserved.
     2 * Copyright (c) 2013, 2018 embedded brains GmbH.  All rights reserved.
    33 *
    44 *  embedded brains GmbH
     
    1616
    1717#include <bsp.h>
     18#include <bsp/bootcard.h>
     19#include <bsp/fdt.h>
     20#include <bsp/linker-symbols.h>
    1821#include <bsp/start.h>
    1922#include <bsp/arm-cp15-start.h>
    2023#include <bsp/arm-a9mpcore-start.h>
    2124
    22 BSP_START_DATA_SECTION static const arm_cp15_start_section_config
     25#include <libfdt.h>
     26
     27#define WORKSPACE_ENTRY_INDEX 8
     28
     29BSP_START_DATA_SECTION static arm_cp15_start_section_config
    2330imx_mmu_config_table[] = {
    2431  ARMV7_CP15_START_DEFAULT_SECTIONS,
     
    3037};
    3138
     39BSP_START_DATA_SECTION static char memory_path[] = "/memory";
     40
    3241BSP_START_TEXT_SECTION static void setup_mmu_and_cache(void)
    3342{
    34   uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache(
     43  const void *fdt;
     44  int node;
     45  uint32_t ctrl;
     46
     47  fdt = bsp_fdt_get();
     48  node = fdt_path_offset_namelen(
     49    fdt,
     50    memory_path,
     51    (int) sizeof(memory_path) - 1
     52  );
     53
     54  if (node >= 0) {
     55    int len;
     56    const void *val;
     57
     58    val = fdt_getprop(fdt, node, "reg", &len);
     59    if (len == 8) {
     60      uint32_t begin;
     61      uint32_t size;
     62
     63      begin = fdt32_to_cpu(((fdt32_t *) val)[0]);
     64      size = fdt32_to_cpu(((fdt32_t *) val)[1]);
     65
     66      imx_mmu_config_table[WORKSPACE_ENTRY_INDEX].end = begin + size;
     67    }
     68  }
     69
     70  ctrl = arm_cp15_start_setup_mmu_and_cache(
    3571    ARM_CP15_CTRL_A,
    3672    ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z
     
    66102  bsp_start_clear_bss();
    67103}
     104
     105void bsp_work_area_initialize(void)
     106{
     107  uintptr_t begin;
     108  uintptr_t end;
     109
     110  begin = imx_mmu_config_table[WORKSPACE_ENTRY_INDEX].begin;
     111  end = imx_mmu_config_table[WORKSPACE_ENTRY_INDEX].end;
     112
     113  bsp_work_area_initialize_default((void *) begin, end - begin);
     114}
Note: See TracChangeset for help on using the changeset viewer.