source: rtems/c/src/lib/libbsp/i386/pc386/startup/bspstart.c @ c3c57b1

5
Last change on this file since c3c57b1 was c3c57b1, checked in by Joel Sherrill <joel@…>, on Mar 10, 2016 at 4:33:27 PM

pc386: Improve boot command arguments for console/printk device selection

This patch adds the "--printk=" boot command line argument to specify
the printk() device. It also enhances the "--console=" boot command
line argument to match any device configured in the console device
table. The arguments are parsed as early as possible so they take
effect early. Currently, this is immediately after PCI initialization.

  • Property mode set to 100644
File size: 3.8 KB
Line 
1/*-------------------------------------------------------------------------+
2| This file contains the PC386 BSP startup package. It includes application,
3| board, and monitor specific initialization and configuration. The generic CPU
4| dependent initialization has been performed before this routine is invoked.
5+--------------------------------------------------------------------------+
6| (C) Copyright 1997 -
7| - NavIST Group - Real-Time Distributed Systems and Industrial Automation
8|
9| http://pandora.ist.utl.pt
10|
11| Instituto Superior Tecnico * Lisboa * PORTUGAL
12+--------------------------------------------------------------------------+
13| Disclaimer:
14|
15| This file is provided "AS IS" without warranty of any kind, either
16| expressed or implied.
17+--------------------------------------------------------------------------+
18| This code is based on:
19|   bspstart.c,v 1.8 1996/05/28 13:12:40 joel Exp - go32 BSP
20| With the following copyright notice:
21| **************************************************************************
22| *  COPYRIGHT (c) 1989-2008.
23| *  On-Line Applications Research Corporation (OAR).
24| *
25| *  The license and distribution terms for this file may be
26| *  found in the file LICENSE in this distribution or at
27| *  http://www.rtems.org/license/LICENSE.
28| **************************************************************************
29+--------------------------------------------------------------------------*/
30
31#include <bsp.h>
32#include <bsp/irq.h>
33#include <rtems/pci.h>
34#include <libcpu/cpuModel.h>
35
36/*
37 * PCI Bus Configuration
38 */
39rtems_pci_config_t BSP_pci_configuration = {
40  (volatile unsigned char*)0,
41  (volatile unsigned char*)0,
42  NULL
43};
44
45/*
46 * Helper to initialize the PCI Bus
47 */
48static void bsp_pci_initialize_helper(void)
49{
50#if (BSP_IS_EDISON == 0)
51  const pci_config_access_functions *pci_accessors;
52
53  pci_accessors = pci_bios_initialize();
54  if (pci_accessors != NULL) {
55    printk("PCI bus: using PCI BIOS interface\n");
56    BSP_pci_configuration.pci_functions = pci_accessors;
57    return;
58  }
59
60  pci_accessors = pci_io_initialize();
61  if (pci_accessors != NULL) {
62    printk("PCI bus: using PCI I/O interface\n");
63    BSP_pci_configuration.pci_functions = pci_accessors;
64    return;
65  }
66
67  printk("PCI bus: could not initialize PCI BIOS interface\n");
68#endif
69}
70
71/*-------------------------------------------------------------------------+
72|         Function: bsp_start
73|      Description: Called before main is invoked.
74| Global Variables: None.
75|        Arguments: None.
76|          Returns: Nothing.
77+--------------------------------------------------------------------------*/
78static void bsp_start_default( void )
79{
80  /*
81   * Turn off watchdog
82   */
83#if (BSP_IS_EDISON == 1)
84  volatile uint32_t *edison_wd = (volatile uint32_t *)0xff009000;
85  *edison_wd = 0x11f8;
86#endif
87
88  /*
89   * Calibrate variable for 1ms-loop (see timer.c)
90   */
91#if (BSP_IS_EDISON == 0)
92  Calibrate_loop_1ms();
93#endif
94
95  /*
96   * Init rtems interrupt management
97   */
98  rtems_irq_mngt_init();
99
100  /*
101   * Init rtems exceptions management
102   */
103  rtems_exception_init_mngt();
104
105  /*
106   * init PCI Bios interface...
107   */
108  bsp_pci_initialize_helper();
109
110  /*
111   * Figure out where printk() and console IO is to be directed.
112   * Do this after the PCI bus is initialized so we have a chance
113   * for those devices to be added to the set in the console driver.
114   * In general, Do it as early as possible so printk() has a chance
115   * to work early on devices found via PCI probe.
116   */
117  pc386_parse_console_arguments();
118
119#if (BSP_IS_EDISON == 0)
120  Clock_driver_install_handler();
121#endif
122
123#if BSP_ENABLE_IDE
124  bsp_ide_cmdline_init();
125#endif
126
127} /* bsp_start_default */
128
129/*
130 *  By making this a weak alias for bsp_start_default, a brave soul
131 *  can override the actual bsp_start routine used.
132 */
133void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));
Note: See TracBrowser for help on using the repository browser.