summaryrefslogtreecommitdiffstats
path: root/sys/boot/common/pnp.c
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2007-01-07 22:25:45 +0000
committermarius <marius@FreeBSD.org>2007-01-07 22:25:45 +0000
commit1d842041db07130def480402fd39e9724816e4f8 (patch)
treea26bf684ee92f450497fcf3ed2222eefffb54993 /sys/boot/common/pnp.c
parent198bd4c0fc478412c60f02355042f40cb9ab32de (diff)
downloadFreeBSD-src-1d842041db07130def480402fd39e9724816e4f8.zip
FreeBSD-src-1d842041db07130def480402fd39e9724816e4f8.tar.gz
Garbage collect the code for auto-loading modules based on ISAPNP IDs,
which is #if'ed out since nearly eight years, along with its outdated database. Agreed by: ru (some months ago)
Diffstat (limited to 'sys/boot/common/pnp.c')
-rw-r--r--sys/boot/common/pnp.c198
1 files changed, 0 insertions, 198 deletions
diff --git a/sys/boot/common/pnp.c b/sys/boot/common/pnp.c
index 05cce99..589926b 100644
--- a/sys/boot/common/pnp.c
+++ b/sys/boot/common/pnp.c
@@ -82,52 +82,6 @@ pnp_scan(int argc, char *argv[])
return(CMD_OK);
}
-#if 0
-/*
- * Try to load outstanding modules (eg. after disk change)
- */
-COMMAND_SET(pnpload, "pnpload", "load modules for PnP devices", pnp_load);
-
-static int
-pnp_load(int argc, char *argv[])
-{
- struct pnpinfo *pi;
- char *modfname;
-
- /* find anything? */
- if (STAILQ_FIRST(&pnp_devices) != NULL) {
-
- /* check for kernel, assign modules handled by static drivers there */
- if (pnp_scankernel()) {
- command_errmsg = "cannot load drivers until kernel loaded";
- return(CMD_ERROR);
- }
- if (fname == NULL) {
- /* default paths */
- pnp_readconf("/boot/pnpdata.local");
- pnp_readconf("/boot/pnpdata");
- } else {
- if (pnp_readconf(fname)) {
- sprintf(command_errbuf, "can't read PnP information from '%s'", fname);
- return(CMD_ERROR);
- }
- }
-
- /* try to load any modules that have been nominated */
- STAILQ_FOREACH(pi, &pnp_devices, pi_link) {
- /* Already loaded? */
- if ((pi->pi_module != NULL) && (file_findfile(pi->pi_module, NULL) == NULL)) {
- modfname = malloc(strlen(pi->pi_module) + 4);
- sprintf(modfname, "%s.ko", pi->pi_module); /* XXX implicit knowledge of KLD module filenames */
- if (mod_load(pi->pi_module, pi->pi_argc, pi->pi_argv))
- printf("Could not load module '%s' for device '%s'\n", modfname, STAILQ_FIRST(&pi->pi_ident)->id_ident);
- free(modfname);
- }
- }
- }
- return(CMD_OK);
-}
-#endif
/*
* Throw away anything we think we know about PnP devices.
*/
@@ -142,159 +96,7 @@ pnp_discard(void)
pnp_freeinfo(pi);
}
}
-#if 0
-/*
- * The PnP configuration database consists of a flat text file with
- * entries one per line. Valid lines are:
- *
- * # <text>
- *
- * This line is a comment, and ignored.
- *
- * [<name>]
- *
- * Entries following this line are for devices connected to the
- * bus <name>, At least one such entry must be encountered
- * before identifiers are recognised.
- *
- * ident=<identifier> rev=<revision> module=<module> args=<arguments>
- *
- * This line describes an identifier:module mapping. The 'ident'
- * and 'module' fields are required; the 'rev' field is currently
- * ignored (but should be used), and the 'args' field must come
- * last.
- *
- * Comments may be appended to lines; any character including or following
- * '#' on a line is ignored.
- */
-static int
-pnp_readconf(char *path)
-{
- struct pnpinfo *pi;
- struct pnpident *id;
- int fd, line;
- char lbuf[128], *currbus, *ident, *revision, *module, *args;
- char *cp, *ep, *tp, c;
-
- /* try to open the file */
- if ((fd = open(path, O_RDONLY)) >= 0) {
- line = 0;
- currbus = NULL;
-
- while (fgetstr(lbuf, sizeof(lbuf), fd) > 0) {
- line++;
- /* Find the first non-space character on the line */
- for (cp = lbuf; (*cp != 0) && !isspace(*cp); cp++)
- ;
-
- /* keep/discard? */
- if ((*cp == 0) || (*cp == '#'))
- continue;
-
- /* cut trailing comment? */
- if ((ep = strchr(cp, '#')) != NULL)
- *ep = 0;
-
- /* bus declaration? */
- if (*cp == '[') {
- if (((ep = strchr(cp, ']')) == NULL) || ((ep - cp) < 2)) {
- printf("%s line %d: bad bus specification\n", path, line);
- } else {
- if (currbus != NULL)
- free(currbus);
- *ep = 0;
- currbus = strdup(cp + 1);
- }
- continue;
- }
-
- /* XXX should we complain? */
- if (currbus == NULL)
- continue;
-
- /* mapping */
- for (ident = module = args = revision = NULL; *cp != 0;) {
-
- /* discard leading whitespace */
- if (isspace(*cp)) {
- cp++;
- continue;
- }
-
- /* scan for terminator, separator */
- for (ep = cp; (*ep != 0) && (*ep != '=') && !isspace(*ep); ep++)
- ;
-
- if (*ep == '=') {
- *ep = 0;
- for (tp = ep + 1; (*tp != 0) && !isspace(*tp); tp++)
- ;
- c = *tp;
- *tp = 0;
- if ((ident == NULL) && !strcmp(cp, "ident")) {
- ident = ep + 1;
- } else if ((revision == NULL) && !strcmp(cp, "revision")) {
- revision = ep + 1;
- } else if ((args == NULL) && !strcmp(cp, "args")) {
- *tp = c;
- while (*tp != 0) /* skip to end of string */
- tp++;
- args = ep + 1;
- } else {
- /* XXX complain? */
- }
- cp = tp;
- continue;
- }
-
- /* it's garbage or a keyword - ignore it for now */
- cp = ep;
- }
-
- /* we must have at least ident and module set to be interesting */
- if ((ident == NULL) || (module == NULL))
- continue;
-
- /*
- * Loop looking for module/bus that might match this, but aren't already
- * assigned.
- * XXX no revision parse/test here yet.
- */
- STAILQ_FOREACH(pi, &pnp_devices, pi_link) {
-
- /* no driver assigned, bus matches OK */
- if ((pi->pi_module == NULL) &&
- !strcmp(pi->pi_handler->pp_name, currbus)) {
-
- /* scan idents, take first match */
- STAILQ_FOREACH(id, &pi->pi_ident, id_link)
- if (!strcmp(id->id_ident, ident))
- break;
-
- /* find a match? */
- if (id != NULL) {
- if (args != NULL)
- if (parse(&pi->pi_argc, &pi->pi_argv, args)) {
- printf("%s line %d: bad arguments\n", path, line);
- continue;
- }
- pi->pi_module = strdup(module);
- printf("use module '%s' for %s:%s\n", module, pi->pi_handler->pp_name, id->id_ident);
- }
- }
- }
- }
- close(fd);
- }
- return(CMD_OK);
-}
-static int
-pnp_scankernel(void)
-{
- return(CMD_OK);
-}
-#endif
/*
* Add a unique identifier to (pi)
*/
OpenPOWER on IntegriCloud