summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/probing.c
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-08-30 10:07:12 +0000
committerOlivier Blin <oblin@mandriva.org>2005-08-30 10:07:12 +0000
commitb60299721a30ae09b1da03b1acbe4557d265a530 (patch)
tree33c6e86e2b90c86c642b3ebf054785c08a1dd046 /mdk-stage1/probing.c
parent364ae96afa04d894cb820d1e7376d61ce0d5e3e3 (diff)
downloaddrakx-b60299721a30ae09b1da03b1acbe4557d265a530.tar
drakx-b60299721a30ae09b1da03b1acbe4557d265a530.tar.gz
drakx-b60299721a30ae09b1da03b1acbe4557d265a530.tar.bz2
drakx-b60299721a30ae09b1da03b1acbe4557d265a530.tar.xz
drakx-b60299721a30ae09b1da03b1acbe4557d265a530.zip
support for alternate modules (allows to load both ahci and ata_piix)
Diffstat (limited to 'mdk-stage1/probing.c')
-rw-r--r--mdk-stage1/probing.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/mdk-stage1/probing.c b/mdk-stage1/probing.c
index 88c634cbc..ecc45e9b9 100644
--- a/mdk-stage1/probing.c
+++ b/mdk-stage1/probing.c
@@ -238,6 +238,34 @@ void probing_detect_devices()
already_detected_devices = 1;
}
+#ifndef DISABLE_MEDIAS
+static const char * get_alternate_module(const char * name)
+{
+ struct alternate_mapping {
+ const char * a;
+ const char * b;
+ };
+ static struct alternate_mapping mappings[] = {
+ { "ahci", "ata_piix" },
+ };
+ int mappings_nb = sizeof(mappings) / sizeof(struct alternate_mapping);
+ int i;
+
+ for (i=0; i<mappings_nb; i++) {
+ const char * alternate = NULL;
+ if (streq(name, mappings[i].a))
+ alternate = mappings[i].b;
+ else if (streq(name, mappings[i].b))
+ alternate = mappings[i].a;
+ if (alternate) {
+ log_message("found alternate module %s for driver %s", alternate, name);
+ return alternate;
+ }
+ }
+ return NULL;
+}
+#endif
+
void discovered_device(enum driver_type type,
unsigned short vendor, unsigned short device, unsigned short subvendor, unsigned short subdevice,
const char * description, const char * driver)
@@ -246,8 +274,13 @@ void discovered_device(enum driver_type type,
log_message("PCI: device %04x %04x %04x %04x is \"%s\", driver is %s", vendor, device, subvendor, subdevice, description, driver);
#ifndef DISABLE_MEDIAS
if (type == SCSI_ADAPTERS) {
+ const char * alternate = NULL;
wait_message("Loading driver for SCSI adapter:\n \n%s", description);
failed = my_insmod(driver, SCSI_ADAPTERS, NULL, 1);
+ alternate = get_alternate_module(driver);
+ if (!IS_NOAUTO && alternate) {
+ failed = failed || my_insmod(alternate, SCSI_ADAPTERS, NULL, 1);
+ }
remove_wait_message();
warning_insmod_failed(failed);
}