source: rtems/bsps/i386/pc386/ata/idecfg.c @ fc79b26

5
Last change on this file since fc79b26 was fc79b26, checked in by Sebastian Huber <sebastian.huber@…>, on 04/23/18 at 10:53:28

bsps: Move ATA drivers to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 3.8 KB
RevLine 
[58f7c34]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
[57be444e]26extern bool pc386_ide_show;
27
[58f7c34]28/*
[6128a4a]29 * The following table configures the functions used for IDE drivers
[58f7c34]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[] = {
[d1572bcf]40  {"/dev/ide0",
[58f7c34]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  }
[d1572bcf]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  }
[58f7c34]59};
60
[1c5ebc5]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{
[02ef5d9]77  const char* ide_disable;
78
79  ide_disable = bsp_cmdline_arg ("--ide-disable");
80
81  if (ide_disable == NULL) {
82    bool ide1 = IDE1_DEFAULT;
83    bool ide2 = IDE2_DEFAULT;
84    const char* ide;
85
[1c5ebc5]86    /*
[02ef5d9]87     * Can have:
88     *  --ide=0,1
[1c5ebc5]89     */
[02ef5d9]90    ide = bsp_cmdline_arg ("--ide=");
[359e537]91
[02ef5d9]92    if (ide)
[1c5ebc5]93    {
[02ef5d9]94      int i;
95      /*
96       * If a command line option exists remove the defaults.
97       */
98      ide1 = ide2 = false;
99
100      ide += sizeof ("--ide=") - 1;
101
102      for (i = 0; i < 3; i++)
[1c5ebc5]103      {
[02ef5d9]104        switch (ide[i])
105        {
106          case '0':
107            ide1 = true;
108            break;
109          case '1':
110            ide2 = true;
111            break;
112          case '2':
113          case '3':
114          case '4':
115          case '5':
116          case '6':
117          case '7':
118          case '8':
119          case '9':
120          case ',':
121            break;
122          default:
123            break;
124        }
[1c5ebc5]125      }
126    }
127
[02ef5d9]128    if (ide2 && !ide1)
129      IDE_Controller_Table[0] = IDE_Controller_Table[1];
[1c5ebc5]130
[02ef5d9]131    if (ide1)
132      IDE_Controller_Count++;
133    if (ide2)
134      IDE_Controller_Count++;
[57be444e]135
[02ef5d9]136    /*
137     * Allow the user to get the initialise to print probing
138     * type information.
139     */
140    ide = bsp_cmdline_arg ("--ide-show");
[359e537]141
[02ef5d9]142    if (ide)
143      pc386_ide_show = true;
144  }
[1c5ebc5]145}
Note: See TracBrowser for help on using the repository browser.