=================================================================== RCS file: /cvs/funnyos/kern/kern_devconfig.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- funnyos/kern/kern_devconfig.c 2007/10/16 15:02:23 1.4 +++ funnyos/kern/kern_devconfig.c 2007/10/23 13:32:01 1.5 @@ -1,5 +1,5 @@ /* - * $Id: kern_devconfig.c,v 1.4 2007/10/16 14:02:23 init Exp $ + * $Id: kern_devconfig.c,v 1.5 2007/10/23 12:32:01 init Exp $ */ #include #include @@ -16,8 +16,6 @@ #define DPRINTF(x...) { } #endif -//extern struct device devlist[]; -//extern uint8_t ndevices; /* system root device */ extern struct device *rootdev; @@ -41,7 +39,6 @@ * - ...and so on. */ devconfig_attach_root(); -// devconfig_attach(&rootdev); } @@ -193,95 +190,6 @@ } -#if 0 -void -devconfig_iterate(void) -{ - struct device *devp = devlist; - - printf("Entered devconfig phase\n"); - - while(devp->dv_attach != NULL) { - /* - * Iterative attach all devices in list. - */ - if (! devp->dv_active && (devp->dv_parent->dv_active || devp->dv_parent == devp)) { - - printf("%s/%d at %s/%d loc 0x%x: ", devp->dv_name, devp->dv_minor, devp->dv_parent->dv_name, - devp->dv_parent->dv_minor, devp->dv_locator); - - /* call attach_subr and activate device if it returns 0 */ - if (devp->dv_attach(devp) == 0) { - /* driver returns okay; mark device as active */ - devp->dv_active = 1; - } - else { - /* attachment failed */ - printf("disabling %s/%d\n", devp->dv_name, devp->dv_minor); - } - } - - devp++; - } - - printf("Exited devconfig phase\n"); -} - - -int -devconfig_target(struct device *devp) -{ - /* - * Recursive attach (subtree) nodes upto already active parent or (root). - */ - - if (devp == NULL) - return(-1); - - /* attach parent if it's not (root) or not activated yet */ - if (devp->dv_parent != devp && ! devp->dv_parent->dv_active) { - - if (devconfig_target(devp->dv_parent) == -1) - return(-1); - } - - printf("%s/%d at %s/%d\n", devp->dv_name, devp->dv_minor, - devp->dv_parent->dv_name, devp->dv_parent->dv_minor); - if (devp->dv_attach(devp) == 0) { - /* attached */ - devp->dv_active = 1; - - return(0); - } - else { - /* failed */ - printf("disabling %s/%d\n", devp->dv_name, devp->dv_minor); - - /* XXX maybe it is easier to panic here? */ - /* panic(XXX) */ - - return(-1); - } -} - - -struct device -*devconfig_findbyname(const char *dv_name, const uint8_t dv_minor) -{ - /* - * Return pointer to device dv_name/dv_minor. - */ - struct device *devp = devlist; - - while(devp->dv_name) { - if (strncmp(devp->dv_name, dv_name, DVNAMELEN - 1) == 0 && devp->dv_minor == dv_minor) - return (devp); - } - - /* nothing has been found */ - return(NULL); -} -#endif /* not 0 */ struct driverinfo *devconfig_finddriverinfo(const char *dname)