Changeset ab20575 in rtems


Ignore:
Timestamp:
Nov 4, 2005, 12:57:25 AM (14 years ago)
Author:
Till Straumann <strauman@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
be45f8e
Parents:
f3173c0
Message:

2005-11-03 <strauman@…>

  • shared/startup/pretaskinghook.c, shared/startup/zerobss.c: New files.
  • Makefile.am, shared/startup/bspstart.c: Split pretaskinghook and zerobss into separate, reusable files; Fixed #PR837 (set exception in ram flag before initializing exceptions); Setup DBATs early, they are needed to access peripherals (Allows mvme2100 to use MMU); moved VME initialization into pretasking hook so that shared interrupts can be used for VME [shared IRQ facility needs functional workspace].
Location:
c/src/lib/libbsp/powerpc
Files:
2 added
2 edited

Legend:

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

    rf3173c0 rab20575  
    5252## shared/startup
    5353EXTRA_DIST += shared/startup/bspstart.c shared/startup/pgtbl_setup.c \
    54     shared/startup/pgtbl_activate.c shared/startup/linkcmds
     54    shared/startup/pgtbl_activate.c shared/startup/linkcmds \
     55        shared/startup/zerobss.c shared/startup/pretaskinghook.c
    5556
    5657## shared/tod
  • c/src/lib/libbsp/powerpc/shared/startup/bspstart.c

    rf3173c0 rab20575  
    2929#include <bsp/openpic.h>
    3030#include <bsp/irq.h>
    31 #include <bsp/VME.h>
    3231#include <libcpu/bat.h>
    3332#include <libcpu/pte121.h>
     
    102101unsigned int BSP_mem_size;
    103102/*
     103 * Where the heap starts; is used by bsp_pretasking_hook;
     104 */
     105unsigned int BSP_heap_start;
     106/*
    104107 * PCI Bus Frequency
    105108 */
     
    149152
    150153void bsp_postdriver_hook(void);
     154void bsp_pretasking_hook(void);
    151155void bsp_libc_init( void *, uint32_t, int );
    152 
    153 /*
    154  *  Function:   bsp_pretasking_hook
    155  *  Created:    95/03/10
    156  *
    157  *  Description:
    158  *      BSP pretasking hook.  Called just before drivers are initialized.
    159  *      Used to setup libc and install any BSP extensions.
    160  *
    161  *  NOTES:
    162  *      Must not use libc (to do io) from here, since drivers are
    163  *      not yet initialized.
    164  *
    165  */
    166 
    167 void bsp_pretasking_hook(void)
    168 {
    169   uint32_t        heap_start;   
    170   uint32_t        heap_size;
    171   uint32_t        heap_sbrk_spared;
    172   extern uint32_t _bsp_sbrk_init(uint32_t, uint32_t*);
    173 
    174   heap_start = ((uint32_t) __rtems_end) +
    175                 INIT_STACK_SIZE + INTR_STACK_SIZE;
    176   if (heap_start & (CPU_ALIGNMENT-1))
    177       heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
    178 
    179   heap_size = (BSP_mem_size - heap_start) - BSP_Configuration.work_space_size;
    180   heap_sbrk_spared=_bsp_sbrk_init(heap_start, &heap_size);
    181 
    182 #ifdef SHOW_MORE_INIT_SETTINGS
    183   printk( "HEAP start %x  size %x (%x bytes spared for sbrk)\n",
    184              heap_start, heap_size, heap_sbrk_spared);
    185 #endif   
    186 
    187   bsp_libc_init((void *) 0, heap_size, heap_sbrk_spared);
    188 
    189 #ifdef RTEMS_DEBUG
    190   rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
    191 #endif
    192 }
    193 
    194 void zero_bss()
    195 {
    196   /* prevent these from being accessed in the short data areas */
    197   extern unsigned long __bss_start[], __SBSS_START__[], __SBSS_END__[];
    198   extern unsigned long __SBSS2_START__[], __SBSS2_END__[];
    199   memset(__SBSS_START__, 0, ((unsigned) __SBSS_END__) - ((unsigned)__SBSS_START__));
    200   memset(__SBSS2_START__, 0, ((unsigned) __SBSS2_END__) - ((unsigned)__SBSS2_START__));
    201   memset(__bss_start, 0, ((unsigned) __rtems_end) - ((unsigned)__bss_start));
    202 }
    203156
    204157void save_boot_params(RESIDUAL* r3, void *r4, void* r5, char *additional_boot_options)
     
    250203   * later...
    251204   */
    252   myCpu         = get_ppc_cpu_type();
     205  myCpu             = get_ppc_cpu_type();
    253206  myCpuRevision = get_ppc_cpu_revision();
    254207
     208  /*
     209   * Init MMU block address translation to enable hardware access
     210   */
     211
     212#if !defined(mvme2100)
     213  /*
     214   * PC legacy IO space used for inb/outb and all PC compatible hardware
     215   */
     216  setdbat(1, _IO_BASE, _IO_BASE, 0x10000000, IO_PAGE);
     217#endif
     218
     219  /*
     220   * PCI devices memory area. Needed to access OpenPIC features
     221   * provided by the Raven
     222   *
     223   * T. Straumann: give more PCI address space
     224   */
     225  setdbat(2, PCI_MEM_BASE+PCI_MEM_WIN0, PCI_MEM_BASE+PCI_MEM_WIN0, 0x10000000, IO_PAGE);
     226
     227  /*
     228   * Must have acces to open pic PCI ACK registers provided by the RAVEN
     229   */
     230  setdbat(3, 0xf0000000, 0xf0000000, 0x10000000, IO_PAGE);
     231
    255232#if defined(mvme2100)
     233  /* Need 0xfec00000 mapped for this */
    256234  EUMBBAR = get_eumbbar();
    257 
    258   Cpu_table.exceptions_in_RAM    = TRUE;
    259   { unsigned v = 0x3000 ; _CPU_MSR_SET(v); }
    260235#endif
    261236
     
    297272   * some settings below...
    298273   */
    299   intrStack = ((uint32_t) __rtems_end) +
    300           INIT_STACK_SIZE + INTR_STACK_SIZE - PPC_MINIMUM_STACK_FRAME_SIZE;
     274  BSP_heap_start = ((uint32_t) __rtems_end) + INIT_STACK_SIZE + INTR_STACK_SIZE;
     275
     276  /* reserve space for the marker/tag frame */
     277  intrStack      = BSP_heap_start - PPC_MINIMUM_STACK_FRAME_SIZE;
    301278
    302279  /* make sure it's properly aligned */
     
    312289  _write_SPRG0(PPC_BSP_HAS_FIXED_PR288);
    313290
     291  /* initialize_exceptions() evaluates the exceptions_in_RAM flag */
     292  Cpu_table.exceptions_in_RAM    = TRUE;
    314293  /*
    315294   * Initialize default raw exception handlers. See vectors/vectors_init.c
    316295   */
    317296  initialize_exceptions();
    318 
    319   /*
    320    * Init MMU block address translation to enable hardware access
    321    */
    322 
    323 #if !defined(mvme2100)
    324   /*
    325    * PC legacy IO space used for inb/outb and all PC compatible hardware
    326    */
    327   setdbat(1, _IO_BASE, _IO_BASE, 0x10000000, IO_PAGE);
    328 #endif
    329 
    330   /*
    331    * PCI devices memory area. Needed to access OpenPIC features
    332    * provided by the Raven
    333    *
    334    * T. Straumann: give more PCI address space
    335    */
    336   setdbat(2, PCI_MEM_BASE+PCI_MEM_WIN0, PCI_MEM_BASE+PCI_MEM_WIN0, 0x10000000, IO_PAGE);
    337 
    338   /*
    339    * Must have acces to open pic PCI ACK registers provided by the RAVEN
    340    */
    341   setdbat(3, 0xf0000000, 0xf0000000, 0x10000000, IO_PAGE);
    342297
    343298  select_console(CONSOLE_LOG);
     
    461416  Cpu_table.do_zero_of_workspace = TRUE;
    462417  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
    463   Cpu_table.clicks_per_usec      = BSP_processor_frequency/(BSP_time_base_divisor * 1000);
    464   Cpu_table.exceptions_in_RAM    = TRUE;
     418  Cpu_table.clicks_per_usec      = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
    465419
    466420#ifdef SHOW_MORE_INIT_SETTINGS
     
    494448#endif
    495449    BSP_pgtbl_activate(pt);
    496 #if !defined(mvme2100)
    497450    /* finally, switch off DBAT3 */
    498451    setdbat(3, 0, 0, 0, 0);
    499 #endif
    500452  }
    501 
    502   /*
    503    * Initialize VME bridge - needs working PCI and IRQ subsystems...
    504    */
    505 #ifdef SHOW_MORE_INIT_SETTINGS
    506   printk("Going to initialize VME bridge\n");
    507 #endif
    508 
    509   /*
    510    * VME initialization is in a separate file so apps which don't use VME or
    511    * want a different configuration may link against a customized routine.
    512    */
    513   BSP_vme_config();
    514453
    515454#if defined(DEBUG_BATS)
Note: See TracChangeset for help on using the changeset viewer.