2004-05-07 04:16:46 +04:00
|
|
|
/*
|
2005-01-12 02:28:38 +03:00
|
|
|
* Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
|
|
|
* Copyright 2002/2003, Thomas Kurschel. All rights reserved.
|
|
|
|
*
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2004-05-07 04:16:46 +04:00
|
|
|
|
2005-01-12 02:28:38 +03:00
|
|
|
/*
|
|
|
|
Part of Device Manager
|
2004-05-07 04:16:46 +04:00
|
|
|
|
2005-01-12 02:28:38 +03:00
|
|
|
Interface of device root module.
|
2004-05-07 04:16:46 +04:00
|
|
|
|
2005-01-12 02:28:38 +03:00
|
|
|
This module creates the root devices (usually PCI and ISA) to
|
|
|
|
initiate the PnP device scan.
|
2004-05-07 04:16:46 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <KernelExport.h>
|
|
|
|
#include <Drivers.h>
|
|
|
|
|
|
|
|
#include "device_manager_private.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define TRACE_ROOT_NODE
|
|
|
|
#ifdef TRACE_ROOT_NODE
|
|
|
|
# define TRACE(x) dprintf x
|
|
|
|
#else
|
|
|
|
# define TRACE(x) ;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2005-05-12 07:27:44 +04:00
|
|
|
#define PNP_ROOT_MODULE_NAME "system/devices_root/driver_v1"
|
2004-05-07 04:16:46 +04:00
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-05-12 07:27:44 +04:00
|
|
|
dm_init_root_node(void)
|
2004-05-07 04:16:46 +04:00
|
|
|
{
|
2005-01-12 02:28:38 +03:00
|
|
|
device_attr attrs[] = {
|
2005-05-12 07:27:44 +04:00
|
|
|
{ B_DRIVER_MODULE, B_STRING_TYPE, { string: PNP_ROOT_MODULE_NAME }},
|
|
|
|
{ B_DRIVER_PRETTY_NAME, B_STRING_TYPE, { string: "Devices Root" }},
|
2004-05-07 04:16:46 +04:00
|
|
|
|
2005-05-12 07:27:44 +04:00
|
|
|
{ B_DRIVER_BUS, B_STRING_TYPE, { string: "root" }},
|
2004-05-07 04:16:46 +04:00
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
2005-05-12 07:27:44 +04:00
|
|
|
if (dm_register_node(NULL, attrs, NULL, &gRootNode) != B_OK) {
|
|
|
|
// ToDo: don't panic for now
|
|
|
|
dprintf("Cannot register Devices Root Node\n");
|
|
|
|
}
|
2004-05-07 04:16:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static status_t
|
2005-05-12 07:27:44 +04:00
|
|
|
root_init_driver(device_node_handle node, void *user_cookie, void **_cookie)
|
2004-05-07 04:16:46 +04:00
|
|
|
{
|
2005-05-12 07:27:44 +04:00
|
|
|
*_cookie = NULL;
|
2004-05-07 04:16:46 +04:00
|
|
|
return B_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static status_t
|
2005-05-12 07:27:44 +04:00
|
|
|
root_uninit_driver(void *cookie)
|
2004-05-07 04:16:46 +04:00
|
|
|
{
|
|
|
|
return B_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static status_t
|
2005-05-12 07:27:44 +04:00
|
|
|
root_std_ops(int32 op, ...)
|
2004-05-07 04:16:46 +04:00
|
|
|
{
|
|
|
|
switch (op) {
|
|
|
|
case B_MODULE_INIT:
|
|
|
|
case B_MODULE_UNINIT:
|
|
|
|
return B_OK;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return B_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-12 02:28:38 +03:00
|
|
|
driver_module_info gDeviceRootModule = {
|
2004-05-07 04:16:46 +04:00
|
|
|
{
|
|
|
|
PNP_ROOT_MODULE_NAME,
|
|
|
|
0,
|
2005-05-12 07:27:44 +04:00
|
|
|
root_std_ops,
|
2004-05-07 04:16:46 +04:00
|
|
|
},
|
|
|
|
|
2005-05-12 07:27:44 +04:00
|
|
|
NULL, // supported devices
|
|
|
|
NULL, // register device
|
|
|
|
root_init_driver,
|
|
|
|
root_uninit_driver,
|
2004-05-07 04:16:46 +04:00
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|