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
This commit is contained in:
parent
fb8aa06112
commit
100b0f973d
@ -3,8 +3,6 @@ SubDir OBOS_TOP src kernel drivers ;
|
|||||||
KernelStaticLibrary libdrivers :
|
KernelStaticLibrary libdrivers :
|
||||||
<$(SOURCE_GRIST)>dev.c
|
<$(SOURCE_GRIST)>dev.c
|
||||||
<$(SOURCE_GRIST)>devs.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)/console/console.c
|
||||||
<$(SOURCE_GRIST)>arch/$(OBOS_ARCH)/keyboard/keyboard.c
|
<$(SOURCE_GRIST)>arch/$(OBOS_ARCH)/keyboard/keyboard.c
|
||||||
<$(SOURCE_GRIST)>arch/$(OBOS_ARCH)/ps2mouse/ps2mouse.c
|
<$(SOURCE_GRIST)>arch/$(OBOS_ARCH)/ps2mouse/ps2mouse.c
|
||||||
|
@ -17,7 +17,10 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/* These are mainly here to allow testing and this needs to be revisited */
|
||||||
const char *device_paths[] = {
|
const char *device_paths[] = {
|
||||||
|
"/boot/addons/drivers/dev",
|
||||||
|
"/boot/addons/drivers/dev/audio",
|
||||||
"/boot/addons/drivers/dev/misc",
|
"/boot/addons/drivers/dev/misc",
|
||||||
"/boot/addons/drivers/dev/net",
|
"/boot/addons/drivers/dev/net",
|
||||||
NULL
|
NULL
|
||||||
@ -31,7 +34,6 @@ int dev_init(kernel_args *ka)
|
|||||||
dprintf("dev_init: entry\n");
|
dprintf("dev_init: entry\n");
|
||||||
|
|
||||||
for (ptr = device_paths; (*ptr); ptr++) {
|
for (ptr = device_paths; (*ptr); ptr++) {
|
||||||
dprintf("DEV: looking at directory %s\n", *ptr);
|
|
||||||
fd = sys_open(*ptr, STREAM_TYPE_DIR, 0);
|
fd = sys_open(*ptr, STREAM_TYPE_DIR, 0);
|
||||||
if(fd >= 0) {
|
if(fd >= 0) {
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
@ -53,7 +55,7 @@ image_id dev_load_dev_module(const char *name, const char *dirpath)
|
|||||||
{
|
{
|
||||||
image_id id;
|
image_id id;
|
||||||
status_t (*init_hardware)(void);
|
status_t (*init_hardware)(void);
|
||||||
const char **(*publish_devices)(void);
|
const char **(*publish_devices)(void) = NULL;
|
||||||
device_hooks *(*find_device)(const char *);
|
device_hooks *(*find_device)(const char *);
|
||||||
void (*bootstrap)();
|
void (*bootstrap)();
|
||||||
char path[SYS_MAX_PATH_LEN];
|
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");
|
init_hardware = (void*)elf_lookup_symbol(id, "init_hardware");
|
||||||
if (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) {
|
if (init_hardware() != 0) {
|
||||||
dprintf("DEV: %s: init_hardware failed :(\n", name);
|
dprintf("DEV: %s: init_hardware failed :(\n", name);
|
||||||
elf_unload_kspace(path);
|
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);
|
// dprintf("DEV: %s: found publish_devices\n", name);
|
||||||
devfs_paths = publish_devices();
|
devfs_paths = publish_devices();
|
||||||
// dprintf("DEV: %s: publish_devices = %p\n", name, (char*)devfs_paths);
|
// dprintf("DEV: %s: publish_devices = %p\n", name, (char*)devfs_paths);
|
||||||
for (; *devfs_paths; devfs_paths++) {
|
// for (; *devfs_paths; devfs_paths++) {
|
||||||
dprintf("DEV: %s: wants to be known as %s\n", name, *devfs_paths);
|
// dprintf("DEV: %s: wants to be known as %s\n", name, *devfs_paths);
|
||||||
}
|
// }
|
||||||
find_device = (void*)elf_lookup_symbol(id, "find_device");
|
find_device = (void*)elf_lookup_symbol(id, "find_device");
|
||||||
if (!find_device) {
|
if (!find_device) {
|
||||||
elf_unload_kspace(path);
|
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... */
|
/* Should really cycle through these... */
|
||||||
devfs_paths = publish_devices();
|
devfs_paths = publish_devices();
|
||||||
for (; *devfs_paths; devfs_paths++) {
|
for (; *devfs_paths; devfs_paths++) {
|
||||||
hooks = find_device(*devfs_paths);
|
hooks = find_device(*devfs_paths);
|
||||||
|
dprintf("publishing %s\n", *devfs_paths);
|
||||||
if (hooks)
|
if (hooks)
|
||||||
devfs_publish_device(*devfs_paths, NULL, hooks);
|
devfs_publish_device(*devfs_paths, NULL, hooks);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
return EFTYPE;
|
return EINVAL; /* should be FTYPE */
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -4,17 +4,11 @@
|
|||||||
*/
|
*/
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <devs.h>
|
#include <devs.h>
|
||||||
#include <vfs.h>
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#ifdef ARCH_x86
|
#ifdef ARCH_x86
|
||||||
#include <arch/x86/ide_bus.h>
|
|
||||||
#include <arch/x86/console_dev.h>
|
#include <arch/x86/console_dev.h>
|
||||||
#include <arch/x86/keyboard.h>
|
#include <arch/x86/keyboard.h>
|
||||||
#include <arch/x86/ps2mouse.h>
|
#include <arch/x86/ps2mouse.h>
|
||||||
#include <arch/x86/rtl8139_dev.h>
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef ARCH_sh4
|
#ifdef ARCH_sh4
|
||||||
#include <kernel/dev/arch/sh4/maple/maple_bus.h>
|
#include <kernel/dev/arch/sh4/maple/maple_bus.h>
|
||||||
@ -22,28 +16,19 @@
|
|||||||
#include <kernel/dev/arch/sh4/console/console_dev.h>
|
#include <kernel/dev/arch/sh4/console/console_dev.h>
|
||||||
#include <kernel/dev/arch/sh4/rtl8139/rtl8139_dev.h>
|
#include <kernel/dev/arch/sh4/rtl8139/rtl8139_dev.h>
|
||||||
#endif
|
#endif
|
||||||
#include <null.h>
|
|
||||||
#include <zero.h>
|
|
||||||
#include <fb_console.h>
|
#include <fb_console.h>
|
||||||
|
|
||||||
int devs_init(kernel_args *ka)
|
int devs_init(kernel_args *ka)
|
||||||
{
|
{
|
||||||
|
|
||||||
null_dev_init(ka);
|
|
||||||
zero_dev_init(ka);
|
|
||||||
#ifdef ARCH_x86
|
#ifdef ARCH_x86
|
||||||
// ide_bus_init(ka);
|
|
||||||
keyboard_dev_init(ka);
|
keyboard_dev_init(ka);
|
||||||
// mouse_dev_init(ka);
|
|
||||||
console_dev_init(ka);
|
console_dev_init(ka);
|
||||||
// rtl8139_dev_init(ka);
|
|
||||||
// netblock_dev_init(ka);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ARCH_sh4
|
#ifdef ARCH_sh4
|
||||||
maple_bus_init(ka);
|
maple_bus_init(ka);
|
||||||
keyboard_dev_init(ka);
|
keyboard_dev_init(ka);
|
||||||
// console_dev_init(ka);
|
|
||||||
rtl8139_dev_init(ka);
|
rtl8139_dev_init(ka);
|
||||||
#endif
|
#endif
|
||||||
fb_console_dev_init(ka);
|
fb_console_dev_init(ka);
|
||||||
|
Loading…
Reference in New Issue
Block a user