source: rtems/c/src/lib/libbsp/i386/pc386/ide/idecfg.c @ 1c5ebc5

4.104.11
Last change on this file since 1c5ebc5 was 1c5ebc5, checked in by Chris Johns <chrisj@…>, on Apr 28, 2009 at 6:20:35 AM

2009-04-28 Chris Johns <chrisj@…>

  • Makefile.am: Add bspcmdline.c.
  • include/bsp.h: Add boot command line interfaces.
  • start/start.c: Save the multiboot command line. Pass the command line to boot_card.
  • start/start.S: Update for boot_card command line change.
  • startup/bspstart.c: Initialise the command line.
  • startup/bspcmdline.c: New.
  • console/console.c, ide/idecfg.c: Add boot command line support.
  • Property mode set to 100644
File size: 3.4 KB
Line 
1/*===============================================================*\
2| Project: RTEMS PC386 IDE harddisc driver tables                 |
3+-----------------------------------------------------------------+
4| File: idecfg.c                                                  |
5+-----------------------------------------------------------------+
6|                    Copyright (c) 2003 IMD                       |
7|      Ingenieurbuero fuer Microcomputertechnik Th. Doerfler      |
8|               <Thomas.Doerfler@imd-systems.de>                  |
9|                       all rights reserved                       |
10+-----------------------------------------------------------------+
11| this file contains the table of functions for the BSP layer     |
12| for IDE access below the libchip IDE harddisc driver            |
13|                                                                 |
14+-----------------------------------------------------------------+
15|   date                      history                        ID   |
16| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
17| 01.14.03  creation                                         doe  |
18\*===============================================================*/
19
20#include <rtems.h>
21#include <bsp.h>
22#include <libchip/ide_ctrl.h>
23#include <libchip/ide_ctrl_cfg.h>
24#include <libchip/ide_ctrl_io.h>
25
26/*
27 * The following table configures the functions used for IDE drivers
28 * in this BSP.
29 */
30
31/*
32 * The following table configures the IDE drivers used in this BSP.
33 */
34extern ide_ctrl_fns_t pc386_ide_ctrl_fns;
35
36/* IDE controllers Table */
37ide_controller_bsp_table_t IDE_Controller_Table[] = {
38  {"/dev/ide0",
39   IDE_STD, /* standard IDE controller */
40   &pc386_ide_ctrl_fns,
41   NULL, /* probe for IDE standard registers */
42   FALSE, /* not (yet) initialized */
43   0x1f0,  /* base I/O address for first IDE controller */
44   FALSE,0, /* not (yet) interrupt driven */
45   NULL
46  }
47  , /* colon only needed when both interfaces present */
48  {"/dev/ide1",
49   IDE_STD, /* standard IDE controller */
50   &pc386_ide_ctrl_fns,
51   NULL, /* probe for IDE standard registers */
52   FALSE, /* not (yet) initialized */
53   0x170,  /* base I/O address for second IDE controller */
54   FALSE,0, /* not (yet) interrupt driven */
55   NULL
56  }
57};
58
59/* Number of rows in IDE_Controller_Table. Default is 0. */
60unsigned long IDE_Controller_Count;
61
62#if IDE_USE_PRIMARY_INTERFACE
63#define IDE1_DEFAULT true
64#else
65#define IDE1_DEFAULT false
66#endif
67#if IDE_USE_SECONDARY_INTERFACE
68#define IDE2_DEFAULT true
69#else
70#define IDE2_DEFAULT false
71#endif
72
73void bsp_ide_cmdline_init(void)
74{
75  bool ide1 = IDE1_DEFAULT;
76  bool ide2 = IDE2_DEFAULT;
77  const char* ide;
78 
79  /*
80   * Can have:
81   *  --ide=1,2
82   */
83  ide = bsp_cmdline_arg ("--ide=");
84 
85  if (ide)
86  {
87    int i;
88    /*
89     * If a command line option exists remove the defaults.
90     */
91    ide1 = ide2 = false;
92   
93    ide += sizeof ("--ide=") - 1;
94   
95    for (i = 0; i < 3; i++)
96    {
97      switch (ide[i])
98      {
99        case '1':
100          ide1 = true;
101          break;
102        case '2':
103          ide2 = true;
104          break;
105        case '3':
106        case '4':
107        case '5':
108        case '6':
109        case '7':
110        case '8':
111        case '9':
112        case ',':
113          break;
114        default:
115        break;
116      }
117    }
118  }
119
120  if (ide2 && !ide1)
121    IDE_Controller_Table[0] = IDE_Controller_Table[1];
122
123  if (ide1)
124    IDE_Controller_Count++;
125  if (ide2)
126    IDE_Controller_Count++;
127}
Note: See TracBrowser for help on using the repository browser.