Rearranged the device_manager init/module stuff; it's now initialized from
main, not by getting the module any longer. It now also creates the root node directly. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7438 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2002-04, Thomas Kurschel. All rights reserved.
|
** Copyright 2002-04, Thomas Kurschel. All rights reserved.
|
||||||
|
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
|
**
|
||||||
** Distributed under the terms of the OpenBeOS License.
|
** Distributed under the terms of the OpenBeOS License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -10,14 +12,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "device_manager_private.h"
|
#include "device_manager_private.h"
|
||||||
|
#include <kdevice_manager.h>
|
||||||
|
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
//#include <driver_settings.h>
|
|
||||||
|
|
||||||
//#include <stdlib.h>
|
|
||||||
//#include <string.h>
|
|
||||||
//#include <stdio.h>
|
|
||||||
//#include <dirent.h>
|
|
||||||
|
|
||||||
//#define TRACE_DEVICE_MANAGER
|
//#define TRACE_DEVICE_MANAGER
|
||||||
#ifdef TRACE_DEVICE_MANAGER
|
#ifdef TRACE_DEVICE_MANAGER
|
||||||
@@ -32,8 +30,6 @@ pnp_node_info *node_list;
|
|||||||
|
|
||||||
bool disable_useraddons;
|
bool disable_useraddons;
|
||||||
|
|
||||||
//int pnp_load_wait_count;
|
|
||||||
//sem_id pnp_load_wait_sem;
|
|
||||||
int pnp_resource_wait_count;
|
int pnp_resource_wait_count;
|
||||||
sem_id pnp_resource_wait_sem;
|
sem_id pnp_resource_wait_sem;
|
||||||
|
|
||||||
@@ -43,91 +39,32 @@ io_resource_info *io_mem_list, *io_port_list, *isa_dma_list;
|
|||||||
void
|
void
|
||||||
check_settings()
|
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);
|
unload_driver_settings(settings);
|
||||||
|
|
||||||
// if( disable_useraddons )
|
|
||||||
// SHOW_INFO0( 2, "User pnp drivers disabled" );
|
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
static status_t
|
||||||
std_ops(int32 op, ...)
|
std_ops(int32 op, ...)
|
||||||
{
|
{
|
||||||
switch( op ) {
|
switch (op) {
|
||||||
case B_MODULE_INIT:
|
case B_MODULE_INIT:
|
||||||
return init();
|
case B_MODULE_UNINIT:
|
||||||
|
return B_OK;
|
||||||
case B_MODULE_UNINIT:
|
|
||||||
return B_OK;
|
default:
|
||||||
// return uninit();
|
return B_ERROR;
|
||||||
|
|
||||||
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_info gDeviceManagerModule = {
|
||||||
{
|
{
|
||||||
DEVICE_MANAGER_MODULE_NAME,
|
DEVICE_MANAGER_MODULE_NAME,
|
||||||
@@ -165,3 +102,40 @@ device_manager_info gDeviceManagerModule = {
|
|||||||
pnp_write_attr
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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_nolock( pnp_node_info *node );
|
||||||
void pnp_probe_waiting_children( 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
|
// scan.c
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user