Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:50

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  *  @file
0005  *
0006  *  This file contains the bsp_start() method and support.
0007  */
0008 
0009 /*
0010  *  COPYRIGHT (c) 1989-2012.
0011  *  On-Line Applications Research Corporation (OAR).
0012  *
0013  * Redistribution and use in source and binary forms, with or without
0014  * modification, are permitted provided that the following conditions
0015  * are met:
0016  * 1. Redistributions of source code must retain the above copyright
0017  *    notice, this list of conditions and the following disclaimer.
0018  * 2. Redistributions in binary form must reproduce the above copyright
0019  *    notice, this list of conditions and the following disclaimer in the
0020  *    documentation and/or other materials provided with the distribution.
0021  *
0022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0023  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0025  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0026  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0027  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0028  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0029  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0030  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0031  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0032  * POSSIBILITY OF SUCH DAMAGE.
0033  */
0034 
0035 #include <bsp.h>
0036 #include <libcpu/isr_entries.h>
0037 #include <bsp/bootcard.h>
0038 #include <rtems/pci.h>
0039 #include <bsp/irq-generic.h>
0040 #include <bsp/i8259.h>
0041 
0042 /*
0043  * STRUCTURES
0044  */
0045 
0046 /* Structure filled in by get_mem_info.  Only the size field is
0047  * actually used (to clear bss), so the others aren't even filled in.
0048  */
0049 struct s_mem
0050 {
0051   unsigned int size;
0052   unsigned int icsize;
0053   unsigned int dcsize;
0054 };
0055 
0056 
0057 /*
0058  * GLOBALS
0059  */
0060 uint32_t bsp_clicks_per_microsecond;
0061 
0062 
0063 /*
0064  * PROTOTYPES
0065  */
0066 void clear_cache( void *address, size_t n );
0067 void get_mem_info( struct s_mem *mem );
0068 
0069 /*
0070  * EXTERNs
0071  */
0072 extern int RamSize;
0073 
0074 /*
0075  *  bsp_start
0076  *
0077  *  This routine does the bulk of the system initialization.
0078  */
0079 void bsp_start( void )
0080 {
0081   /* uint32_t  board_ID = 0x420; */
0082   static    int j = 1;
0083   int       pci_init_retval;
0084 
0085   /*
0086    * Note: This is the value that works for qemu, and it was
0087    * unable to be validated on the actual hardware.
0088    */
0089   mips_set_sr( 0x04100000 );
0090 
0091   bsp_interrupt_initialize();
0092 
0093   /*
0094    *  XXX need to figure out a real value. :)
0095    *  This works for the qemu simulation, but timeing may
0096    *  be off for the actual hardware.
0097    */
0098   bsp_clicks_per_microsecond = 100;
0099 
0100   #if 1
0101   while ( j != 1 ) {
0102     int i;
0103     printk (".");
0104     for (i=0; i<1000; i++);
0105   }
0106   #endif
0107 
0108   /*
0109    * init PCI Bios interface...
0110    */
0111   pci_init_retval = pci_initialize();
0112   if (pci_init_retval != PCIB_ERR_SUCCESS) {
0113       printk("PCI bus: could not initialize PCI BIOS interface\n");
0114   }
0115 
0116   BSP_i8259s_init();
0117 
0118 }
0119 
0120 /*
0121  *  Required routine by some gcc run-times.
0122  */
0123 void clear_cache( void *address, size_t n )
0124 {
0125 }
0126 
0127 void get_mem_info(
0128   struct s_mem *mem
0129 )
0130 {
0131   mem->size = (int) (&RamSize); /* Normally 128 or 256 MB */
0132 }