From 100b0f973dd4172656707fe6659ca7679b219cbc Mon Sep 17 00:00:00 2001 From: David Reid Date: Fri, 12 Jul 2002 19:24:26 +0000 Subject: [PATCH] Fix a couple of errors we no longer have (ain't regression wonderful) Change to using device drivers for null, zero and digit Small changes to the way we init devices. NB the random driver has shown that devices are not being handled correctly, so this is something we'll ahve to live with until the vfs person fixes it. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@148 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/drivers/Jamfile | 2 -- src/kernel/drivers/dev.c | 20 ++++++++++++-------- src/kernel/drivers/devs.c | 15 --------------- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/kernel/drivers/Jamfile b/src/kernel/drivers/Jamfile index fc3864d8ff..055b61905c 100644 --- a/src/kernel/drivers/Jamfile +++ b/src/kernel/drivers/Jamfile @@ -3,8 +3,6 @@ SubDir OBOS_TOP src kernel drivers ; KernelStaticLibrary libdrivers : <$(SOURCE_GRIST)>dev.c <$(SOURCE_GRIST)>devs.c - <$(SOURCE_GRIST)>common/null.c - <$(SOURCE_GRIST)>common/zero.c <$(SOURCE_GRIST)>arch/$(OBOS_ARCH)/console/console.c <$(SOURCE_GRIST)>arch/$(OBOS_ARCH)/keyboard/keyboard.c <$(SOURCE_GRIST)>arch/$(OBOS_ARCH)/ps2mouse/ps2mouse.c diff --git a/src/kernel/drivers/dev.c b/src/kernel/drivers/dev.c index 4a104d0bde..4c6b589d2e 100755 --- a/src/kernel/drivers/dev.c +++ b/src/kernel/drivers/dev.c @@ -17,7 +17,10 @@ #include +/* These are mainly here to allow testing and this needs to be revisited */ const char *device_paths[] = { + "/boot/addons/drivers/dev", + "/boot/addons/drivers/dev/audio", "/boot/addons/drivers/dev/misc", "/boot/addons/drivers/dev/net", NULL @@ -31,7 +34,6 @@ int dev_init(kernel_args *ka) dprintf("dev_init: entry\n"); for (ptr = device_paths; (*ptr); ptr++) { -dprintf("DEV: looking at directory %s\n", *ptr); fd = sys_open(*ptr, STREAM_TYPE_DIR, 0); if(fd >= 0) { ssize_t len; @@ -53,7 +55,7 @@ image_id dev_load_dev_module(const char *name, const char *dirpath) { image_id id; status_t (*init_hardware)(void); - const char **(*publish_devices)(void); + const char **(*publish_devices)(void) = NULL; device_hooks *(*find_device)(const char *); void (*bootstrap)(); char path[SYS_MAX_PATH_LEN]; @@ -68,7 +70,7 @@ image_id dev_load_dev_module(const char *name, const char *dirpath) init_hardware = (void*)elf_lookup_symbol(id, "init_hardware"); if (init_hardware) { -// dprintf("DEV: found init_hardware in %s\n", name); + dprintf("DEV: found init_hardware in %s\n", name); if (init_hardware() != 0) { dprintf("DEV: %s: init_hardware failed :(\n", name); elf_unload_kspace(path); @@ -79,23 +81,25 @@ image_id dev_load_dev_module(const char *name, const char *dirpath) // dprintf("DEV: %s: found publish_devices\n", name); devfs_paths = publish_devices(); // dprintf("DEV: %s: publish_devices = %p\n", name, (char*)devfs_paths); - for (; *devfs_paths; devfs_paths++) { - dprintf("DEV: %s: wants to be known as %s\n", name, *devfs_paths); - } +// for (; *devfs_paths; devfs_paths++) { +// dprintf("DEV: %s: wants to be known as %s\n", name, *devfs_paths); +// } find_device = (void*)elf_lookup_symbol(id, "find_device"); if (!find_device) { elf_unload_kspace(path); - return EFTYPE; + dprintf("failed to find the find_device symbol!\n"); + return EINVAL; /* should be EFTYPE */ } /* Should really cycle through these... */ devfs_paths = publish_devices(); for (; *devfs_paths; devfs_paths++) { hooks = find_device(*devfs_paths); + dprintf("publishing %s\n", *devfs_paths); if (hooks) devfs_publish_device(*devfs_paths, NULL, hooks); } } else - return EFTYPE; + return EINVAL; /* should be FTYPE */ return id; } diff --git a/src/kernel/drivers/devs.c b/src/kernel/drivers/devs.c index 02cfbab673..8dde54ae42 100755 --- a/src/kernel/drivers/devs.c +++ b/src/kernel/drivers/devs.c @@ -4,17 +4,11 @@ */ #include #include -#include -#include - -#include #ifdef ARCH_x86 -#include #include #include #include -#include #endif #ifdef ARCH_sh4 #include @@ -22,28 +16,19 @@ #include #include #endif -#include -#include #include int devs_init(kernel_args *ka) { - null_dev_init(ka); - zero_dev_init(ka); #ifdef ARCH_x86 -// ide_bus_init(ka); keyboard_dev_init(ka); -// mouse_dev_init(ka); console_dev_init(ka); -// rtl8139_dev_init(ka); -// netblock_dev_init(ka); #endif #ifdef ARCH_sh4 maple_bus_init(ka); keyboard_dev_init(ka); -// console_dev_init(ka); rtl8139_dev_init(ka); #endif fb_console_dev_init(ka);