diff --git a/src/kernel/core/device_manager/device_manager.c b/src/kernel/core/device_manager/device_manager.c index f4d4e5368f..b14b63d3d1 100644 --- a/src/kernel/core/device_manager/device_manager.c +++ b/src/kernel/core/device_manager/device_manager.c @@ -1,5 +1,7 @@ /* ** Copyright 2002-04, Thomas Kurschel. All rights reserved. +** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** ** Distributed under the terms of the OpenBeOS License. */ @@ -10,14 +12,10 @@ */ #include "device_manager_private.h" +#include #include -//#include -//#include -//#include -//#include -//#include //#define TRACE_DEVICE_MANAGER #ifdef TRACE_DEVICE_MANAGER @@ -32,8 +30,6 @@ pnp_node_info *node_list; bool disable_useraddons; -//int pnp_load_wait_count; -//sem_id pnp_load_wait_sem; int pnp_resource_wait_count; sem_id pnp_resource_wait_sem; @@ -43,91 +39,32 @@ io_resource_info *io_mem_list, *io_port_list, *isa_dma_list; void check_settings() { - void *settings; + void *settings = load_driver_settings(B_SAFEMODE_DRIVER_SETTINGS); + + disable_useraddons = get_driver_boolean_parameter(settings, "disableuseraddons", 0, 1); - settings = load_driver_settings( B_SAFEMODE_DRIVER_SETTINGS ); - disable_useraddons = get_driver_boolean_parameter( settings, "disableuseraddons", 0, 1 ); unload_driver_settings(settings); - -// if( disable_useraddons ) -// SHOW_INFO0( 2, "User pnp drivers disabled" ); } #endif -static status_t -init() -{ - status_t status; - - TRACE(("device manager init\n")); - - status = id_generator_init(); - if (status < B_OK) { - panic("could not initialize ID generator\n"); - return status; - } - - status = nodes_init(); - if (status < B_OK) { - panic("could not initialize device nodes\n"); - return status; - } - - pnp_resource_wait_sem = create_sem(0, "pnp_resource_wait_sem"); - if (pnp_resource_wait_sem < 0) { - panic("could not create resource wait sem\n"); - return pnp_resource_wait_sem; - } - -// node_list = NULL; -/* pnp_load_wait_count = 0;*/ - pnp_resource_wait_count = 0; - io_mem_list = io_port_list = isa_dma_list = NULL; - pnp_fs_emulation_nesting = 0; - - return B_OK; -/* -err3: - delete_sem( pnp_load_wait_sem ); -err2: - DELETE_BEN( &node_lock ); -err: - DELETE_BEN( &generator_lock ); - return res;*/ -} - -#if 0 -static status_t -uninit() -{ - SHOW_FLOW0( 0, "" ); - - DELETE_BEN( &node_lock ); - DELETE_BEN( &generator_lock ); -/* delete_sem( pnp_load_wait_sem );*/ - delete_sem( pnp_resource_wait_sem ); - return B_OK; -} -#endif - static status_t std_ops(int32 op, ...) { - switch( op ) { - case B_MODULE_INIT: - return init(); - - case B_MODULE_UNINIT: - return B_OK; -// return uninit(); - - default: - return B_ERROR; + switch (op) { + case B_MODULE_INIT: + case B_MODULE_UNINIT: + return B_OK; + + default: + return B_ERROR; } } +// ToDo: the device manager exports these for now, so that Thomas's driver +// can work on both R5 and OpenBeOS without too much hassle + device_manager_info gDeviceManagerModule = { { DEVICE_MANAGER_MODULE_NAME, @@ -165,3 +102,40 @@ device_manager_info gDeviceManagerModule = { pnp_write_attr }; + +// #pragma mark - + + +status_t +device_manager_init(struct kernel_args *args) +{ + status_t status; + + TRACE(("device manager init\n")); + + status = id_generator_init(); + if (status < B_OK) { + panic("could not initialize ID generator\n"); + return status; + } + + status = nodes_init(); + if (status < B_OK) { + panic("could not initialize device nodes\n"); + return status; + } + + pnp_resource_wait_sem = create_sem(0, "pnp_resource_wait_sem"); + if (pnp_resource_wait_sem < 0) { + panic("could not create resource wait sem\n"); + return pnp_resource_wait_sem; + } + + pnp_resource_wait_count = 0; + io_mem_list = io_port_list = isa_dma_list = NULL; + pnp_fs_emulation_nesting = 0; + + pnp_root_init_root(); + return B_OK; +} + diff --git a/src/kernel/core/device_manager/device_manager_private.h b/src/kernel/core/device_manager/device_manager_private.h index 1b481ab9c9..c701eeb172 100644 --- a/src/kernel/core/device_manager/device_manager_private.h +++ b/src/kernel/core/device_manager/device_manager_private.h @@ -251,6 +251,11 @@ void pnp_defer_probing_of_children( pnp_node_info *node ); void pnp_probe_waiting_children_nolock( pnp_node_info *node ); void pnp_probe_waiting_children( pnp_node_info *node ); +// root_node.c + +extern void pnp_root_init_root(void); +extern void pnp_root_destroy_root(void); +extern void pnp_root_rescan_root(void); // scan.c