Back to home page

LXR

 
 

    


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

0001 /**
0002  * @file
0003  *
0004  * This file contains the PC386 BSP startup package. It includes application,
0005  * board, and monitor specific initialization and configuration.
0006  */
0007 
0008 /*
0009  * This file was initially written by Joel Sherrill as part of the go32 BSP.
0010  * It was subsequently adapted as part of the pc386 BSP by developers from
0011  * the NavIST Group in 1997.
0012  *
0013  * Copyright (c) 2016.
0014  * Chris Johns <chrisj@rtems.org>
0015  *
0016  * COPYRIGHT (c) 1989-2008, 2016.
0017  * On-Line Applications Research Corporation (OAR).
0018  *
0019  * The license and distribution terms for this file may be
0020  * found in the file LICENSE in this distribution or at
0021  * http://www.rtems.org/license/LICENSE.
0022  *
0023  * (C) Copyright 1997 -
0024  * - NavIST Group - Real-Time Distributed Systems and Industrial Automation
0025  * Instituto Superior Tecnico * Lisboa * PORTUGAL (http://pandora.ist.utl.pt)
0026  *
0027  * NavISY Disclaimer:
0028  * This file is provided "AS IS" without warranty of any kind, either
0029  * expressed or implied.
0030  */
0031 
0032 #include <bsp.h>
0033 #include <bsp/bspimpl.h>
0034 #include <bsp/irq.h>
0035 #include <rtems/pci.h>
0036 #include <libcpu/cpuModel.h>
0037 
0038 /*
0039  * PCI Bus Configuration
0040  */
0041 rtems_pci_config_t BSP_pci_configuration = {
0042   (volatile unsigned char*)0,
0043   (volatile unsigned char*)0,
0044   NULL
0045 };
0046 
0047 /*
0048  * Helper to initialize the PCI Bus
0049  */
0050 static void bsp_pci_initialize_helper(void)
0051 {
0052   const pci_config_access_functions *pci_accessors;
0053 
0054   pci_accessors = pci_bios_initialize();
0055   if (pci_accessors != NULL) {
0056     printk("PCI bus: using PCI BIOS interface\n");
0057     BSP_pci_configuration.pci_functions = pci_accessors;
0058     return;
0059   }
0060 
0061   pci_accessors = pci_io_initialize();
0062   if (pci_accessors != NULL) {
0063     printk("PCI bus: using PCI I/O interface\n");
0064     BSP_pci_configuration.pci_functions = pci_accessors;
0065     return;
0066   }
0067 
0068   printk("PCI bus: could not initialize PCI BIOS interface\n");
0069 }
0070 
0071 /*-------------------------------------------------------------------------+
0072 |         Function: bsp_start
0073 |      Description: Called before main is invoked.
0074 | Global Variables: None.
0075 |        Arguments: None.
0076 |          Returns: Nothing.
0077 +--------------------------------------------------------------------------*/
0078 static void bsp_start_default( void )
0079 {
0080   /*
0081    * Turn off watchdog
0082    */
0083   /*
0084    * Calibrate variable for 1ms-loop (see timer.c)
0085    */
0086   Calibrate_loop_1ms();
0087 
0088   /*
0089    * Init rtems interrupt management
0090    */
0091   rtems_irq_mngt_init();
0092 
0093   /*
0094    * Init rtems exceptions management
0095    */
0096   rtems_exception_init_mngt();
0097 
0098   /*
0099    * init PCI Bios interface...
0100    */
0101   bsp_pci_initialize_helper();
0102 
0103   /*
0104    * Probe for legacy UARTs.
0105    */
0106   legacy_uart_probe();
0107 
0108   /*
0109    * Probe for UARTs on PCI.
0110    */
0111   pci_uart_probe();
0112 
0113   /*
0114    * Parse the GDB arguments and flag a serial port as not valid. This stops
0115    * the console from claming the port.
0116    */
0117 #if BSP_GDB_STUB
0118   pc386_parse_gdb_arguments();
0119 #endif
0120 
0121   /*
0122    * Figure out where printk() and console IO is to be directed.  Do this after
0123    * the legacy and PCI bus probes so we have a chance for those devices to be
0124    * added to the set in the console driver.  In general, do it as early as
0125    * possible so printk() has a chance to work early on devices found via PCI
0126    * probe.
0127    */
0128   pc386_parse_console_arguments();
0129 
0130   Clock_driver_install_handler();
0131 
0132 #if BSP_ENABLE_IDE
0133   bsp_ide_cmdline_init();
0134 #endif
0135 } /* bsp_start_default */
0136 
0137 /*
0138  *  By making this a weak alias for bsp_start_default, a brave soul
0139  *  can override the actual bsp_start routine used.
0140  */
0141 void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));