summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386/pc386/ide/idecfg.c
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2009-04-28 06:20:35 +0000
committerChris Johns <chrisj@rtems.org>2009-04-28 06:20:35 +0000
commit1c5ebc542167a74791cf5e82845e00b4f8ff6330 (patch)
treee0b839e0a1ef204877767c7d0b9b1f90b1f45a2e /c/src/lib/libbsp/i386/pc386/ide/idecfg.c
parent2009-04-28 Chris Johns <chrisj@rtems.org> (diff)
downloadrtems-1c5ebc542167a74791cf5e82845e00b4f8ff6330.tar.bz2
2009-04-28 Chris Johns <chrisj@rtems.org>
* 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.
Diffstat (limited to 'c/src/lib/libbsp/i386/pc386/ide/idecfg.c')
-rw-r--r--c/src/lib/libbsp/i386/pc386/ide/idecfg.c78
1 files changed, 69 insertions, 9 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/ide/idecfg.c b/c/src/lib/libbsp/i386/pc386/ide/idecfg.c
index b06682c299..8569d40eff 100644
--- a/c/src/lib/libbsp/i386/pc386/ide/idecfg.c
+++ b/c/src/lib/libbsp/i386/pc386/ide/idecfg.c
@@ -35,7 +35,6 @@ extern ide_ctrl_fns_t pc386_ide_ctrl_fns;
/* IDE controllers Table */
ide_controller_bsp_table_t IDE_Controller_Table[] = {
-#if IDE_USE_PRIMARY_INTERFACE
{"/dev/ide0",
IDE_STD, /* standard IDE controller */
&pc386_ide_ctrl_fns,
@@ -45,11 +44,7 @@ ide_controller_bsp_table_t IDE_Controller_Table[] = {
FALSE,0, /* not (yet) interrupt driven */
NULL
}
-#if IDE_USE_SECONDARY_INTERFACE
, /* colon only needed when both interfaces present */
-#endif
-#endif
-#if IDE_USE_SECONDARY_INTERFACE
{"/dev/ide1",
IDE_STD, /* standard IDE controller */
&pc386_ide_ctrl_fns,
@@ -59,9 +54,74 @@ ide_controller_bsp_table_t IDE_Controller_Table[] = {
FALSE,0, /* not (yet) interrupt driven */
NULL
}
-#endif
};
-/* Number of rows in IDE_Controller_Table */
-unsigned long IDE_Controller_Count =
- sizeof(IDE_Controller_Table)/sizeof(IDE_Controller_Table[0]);
+/* Number of rows in IDE_Controller_Table. Default is 0. */
+unsigned long IDE_Controller_Count;
+
+#if IDE_USE_PRIMARY_INTERFACE
+#define IDE1_DEFAULT true
+#else
+#define IDE1_DEFAULT false
+#endif
+#if IDE_USE_SECONDARY_INTERFACE
+#define IDE2_DEFAULT true
+#else
+#define IDE2_DEFAULT false
+#endif
+
+void bsp_ide_cmdline_init(void)
+{
+ bool ide1 = IDE1_DEFAULT;
+ bool ide2 = IDE2_DEFAULT;
+ const char* ide;
+
+ /*
+ * Can have:
+ * --ide=1,2
+ */
+ ide = bsp_cmdline_arg ("--ide=");
+
+ if (ide)
+ {
+ int i;
+ /*
+ * If a command line option exists remove the defaults.
+ */
+ ide1 = ide2 = false;
+
+ ide += sizeof ("--ide=") - 1;
+
+ for (i = 0; i < 3; i++)
+ {
+ switch (ide[i])
+ {
+ case '1':
+ ide1 = true;
+ break;
+ case '2':
+ ide2 = true;
+ break;
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case ',':
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (ide2 && !ide1)
+ IDE_Controller_Table[0] = IDE_Controller_Table[1];
+
+ if (ide1)
+ IDE_Controller_Count++;
+ if (ide2)
+ IDE_Controller_Count++;
+}