source: rtems/c/src/lib/libbsp/arm/raspberrypi/startup/cmdline.c @ 80a13ec4

5
Last change on this file since 80a13ec4 was 3d3ad4dc, checked in by Pavel Pisa <pisa@…>, on 07/31/16 at 09:33:06

arm/raspberrypi: VideoCore? access corrections in cache operation and more error checking.

The first, mistake in buffer size computation for cache flush
and invalidate has been corrected.

GCC attribute( ( aligned( 64 ) ) ) should work and works for local
variables. Code ensures right stack alignment. But attribute has
to be moved to type declaration to ensure that structure size is affected
by attribute. But even this seems to not work reliably for some reason.
May it be, the stack area between frame start and end of local variable buffer
accessed during context switch or some stack prefetch during resturn
such way that some cache lines belonging to buffer are filled to cache.
Extending buffer by one more cache line padding helps there.

In the longer term perspective, buffer should be moved to some static
area or cache aligned dynamic memory allocated. Concurrent calls
to the VideoCore? operations and access serialization should be added
too but problem is that some calls are required during workspace and MMU
setup so variant without need of mutex would be required as well.

Framebuffer setup code and other VideoCore? calls check more
precisely for errors and do not proceed forward with incorrect
data now.

Signed-off-by: Pavel Pisa <pisa@…>

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup raspberrypi
5 *
6 * @brief mailbox support.
7 */
8/*
9 * Copyright (c) 2015 Yang Qiao
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *
14 *  http://www.rtems.org/license/LICENSE
15 *
16 */
17
18#include <bsp.h>
19#include <bsp/vc.h>
20
21#define MAX_CMDLINE_LENGTH 1024
22static int rpi_cmdline_ready = -1;
23static char rpi_cmdline_cached[MAX_CMDLINE_LENGTH] = "force .data placement";
24static bcm2835_get_cmdline_entries rpi_cmdline_entries;
25
26const char *rpi_cmdline_get_raw(void)
27{
28  memset(&rpi_cmdline_entries, 0, sizeof(rpi_cmdline_entries));
29  if (bcm2835_mailbox_get_cmdline(&rpi_cmdline_entries) < 0)
30     return NULL;
31  return rpi_cmdline_entries.cmdline;
32}
33
34const char *rpi_cmdline_get_cached(void)
35{
36  if (rpi_cmdline_ready <= 0) {
37    const char *line = rpi_cmdline_get_raw();
38    if (line != NULL)
39      strncpy(rpi_cmdline_cached, line, MAX_CMDLINE_LENGTH - 1);
40    rpi_cmdline_cached[MAX_CMDLINE_LENGTH - 1] = 0;
41    rpi_cmdline_ready = 1;
42  }
43  return rpi_cmdline_cached;
44}
45
46const char *rpi_cmdline_get_arg(const char* arg)
47{
48  const char *opt_data;
49  opt_data = strstr(rpi_cmdline_get_cached(), arg);
50  if (opt_data)
51    opt_data += strlen(arg);
52  return opt_data;
53}
Note: See TracBrowser for help on using the repository browser.