From 25d994668a532de29dbc5f3b5a5cc01489cf13d3 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 12 Dec 2002 05:35:03 +0000 Subject: this should get cardbus working. works in test mode, but I need to double-check the various cases of it in the morning --- loader2/pcmcia.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 3 deletions(-) (limited to 'loader2/pcmcia.c') diff --git a/loader2/pcmcia.c b/loader2/pcmcia.c index a44d852d6..69e87e040 100644 --- a/loader2/pcmcia.c +++ b/loader2/pcmcia.c @@ -16,14 +16,64 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include +#include +#include + #include "loader.h" +#include "loadermisc.h" +#include "log.h" #include "modules.h" -int pcmciaInitialize(moduleList modLoaded, moduleDeps modDeps, - moduleInfoSet modInfo, int flags) { +char * getPcicController() { + struct device ** devices; + static int probed = 0; + static char * pcic = NULL; + + if (!probed) { + probed = 1; + + devices = probeDevices(CLASS_SOCKET, BUS_PCI, PROBE_ALL); + if (devices) { + logMessage("found cardbus pci adapter"); + pcic = "yenta_socket"; + } + + /* JKFIXME: need to probe for non-cardbus adapters */ + + if (!pcic) { + logMessage("no pcic controller found"); + } + return pcic; + } else { + return pcic; + } +} + +int cardbusControllerInitialize(moduleList modLoaded, moduleDeps modDeps, + moduleInfoSet modInfo, int flags) { + char * pcic = NULL; + char * mods; + int i; + if (FL_NOPCMCIA(flags)) return 0; + + pcic = getPcicController(); + if (!pcic) + return 0; + + for (i = 0; i < modInfo->numModules ; i++) { + if (strcmp(pcic, modInfo->moduleList[i].moduleName)) { + mods = sdupprintf("pcmcia_core:%s:ds", pcic); + logMessage("going to insert %s", mods); + /* JKFIXME: this depends on a hack until pcmcia has module-info */ + mlLoadModuleSetLocation(mods, modLoaded, modDeps, modInfo, + flags, modInfo->moduleList[i].locationID); + free(mods); + break; + } + } - /* JKFIXME: obviously we need real code here... */ return 0; } -- cgit