source: rtems/c/src/lib/libbsp/i386/pc386/ide/idecfg.c @ 57be444

4.104.11
Last change on this file since 57be444 was 57be444, checked in by Chris Johns <chrisj@…>, on May 30, 2009 at 4:49:26 AM

2009-05-30 Chris Johns <chrisj@…>

  • ide/ide.c: Add initialisation code to reset the IDE devices and to probe them and display their model numbers. Also add code to display the probing to aid bring up new hardware.
  • ide/idecfg.c: Add the --ide-show command to show probing type accessing when finding devices on the configured IDE buses.
  • Property mode set to 100644
File size: 3.6 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
26extern bool pc386_ide_show;
27
28/*
29 * The following table configures the functions used for IDE drivers
30 * in this BSP.
31 */
32
33/*
34 * The following table configures the IDE drivers used in this BSP.
35 */
36extern ide_ctrl_fns_t pc386_ide_ctrl_fns;
37
38/* IDE controllers Table */
39ide_controller_bsp_table_t IDE_Controller_Table[] = {
40  {"/dev/ide0",
41   IDE_STD, /* standard IDE controller */
42   &pc386_ide_ctrl_fns,
43   NULL, /* probe for IDE standard registers */
44   FALSE, /* not (yet) initialized */
45   0x1f0,  /* base I/O address for first IDE controller */
46   FALSE,0, /* not (yet) interrupt driven */
47   NULL
48  }
49  , /* colon only needed when both interfaces present */
50  {"/dev/ide1",
51   IDE_STD, /* standard IDE controller */
52   &pc386_ide_ctrl_fns,
53   NULL, /* probe for IDE standard registers */
54   FALSE, /* not (yet) initialized */
55   0x170,  /* base I/O address for second IDE controller */
56   FALSE,0, /* not (yet) interrupt driven */
57   NULL
58  }
59};
60
61/* Number of rows in IDE_Controller_Table. Default is 0. */
62unsigned long IDE_Controller_Count;
63
64#if IDE_USE_PRIMARY_INTERFACE
65#define IDE1_DEFAULT true
66#else
67#define IDE1_DEFAULT false
68#endif
69#if IDE_USE_SECONDARY_INTERFACE
70#define IDE2_DEFAULT true
71#else
72#define IDE2_DEFAULT false
73#endif
74
75void bsp_ide_cmdline_init(void)
76{
77  bool ide1 = IDE1_DEFAULT;
78  bool ide2 = IDE2_DEFAULT;
79  const char* ide;
80 
81  /*
82   * Can have:
83   *  --ide=0,1
84   */
85  ide = bsp_cmdline_arg ("--ide=");
86 
87  if (ide)
88  {
89    int i;
90    /*
91     * If a command line option exists remove the defaults.
92     */
93    ide1 = ide2 = false;
94   
95    ide += sizeof ("--ide=") - 1;
96   
97    for (i = 0; i < 3; i++)
98    {
99      switch (ide[i])
100      {
101        case '0':
102          ide1 = true;
103          break;
104        case '1':
105          ide2 = true;
106          break;
107        case '2':
108        case '3':
109        case '4':
110        case '5':
111        case '6':
112        case '7':
113        case '8':
114        case '9':
115        case ',':
116          break;
117        default:
118          break;
119      }
120    }
121  }
122
123  if (ide2 && !ide1)
124    IDE_Controller_Table[0] = IDE_Controller_Table[1];
125
126  if (ide1)
127    IDE_Controller_Count++;
128  if (ide2)
129    IDE_Controller_Count++;
130
131  /*
132   * Allow the user to get the initialise to print probing
133   * type information.
134   */
135  ide = bsp_cmdline_arg ("--ide-show");
136 
137  if (ide)
138    pc386_ide_show = true;
139}
Note: See TracBrowser for help on using the repository browser.