From 538ee6189ce15d90f0579464d0a4047dad025955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 2 Jan 2003 13:21:19 +0000 Subject: [PATCH] Moved the config_manager to the correct location and added it to the build. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2350 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/Jamfile | 1 + src/add-ons/kernel/bus_managers/Jamfile | 22 +++ .../kernel/bus_managers/config_manager.c | 172 ++++++++++++++++++ 3 files changed, 195 insertions(+) create mode 100644 src/add-ons/kernel/bus_managers/Jamfile create mode 100644 src/add-ons/kernel/bus_managers/config_manager.c diff --git a/src/add-ons/kernel/Jamfile b/src/add-ons/kernel/Jamfile index 7284cf1eb6..0f8ccea359 100644 --- a/src/add-ons/kernel/Jamfile +++ b/src/add-ons/kernel/Jamfile @@ -1,5 +1,6 @@ SubDir OBOS_TOP src add-ons kernel ; +SubInclude OBOS_TOP src add-ons kernel bus_managers ; SubInclude OBOS_TOP src add-ons kernel disk_scanner ; SubInclude OBOS_TOP src add-ons kernel drivers ; SubInclude OBOS_TOP src add-ons kernel file_systems ; diff --git a/src/add-ons/kernel/bus_managers/Jamfile b/src/add-ons/kernel/bus_managers/Jamfile new file mode 100644 index 0000000000..e829582929 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/Jamfile @@ -0,0 +1,22 @@ +SubDir OBOS_TOP src add-ons kernel bus_managers ; + +KernelObjects + config_manager.c + : + -fno-pic -D_KERNEL_MODE + ; + +KernelLd + config_manager + : + <$(SOURCE_GRIST)>config_manager.o + kernel.so + : + $(OBOS_TOP)/src/kernel/core/addons/ldscripts/$(OBOS_ARCH)/addon.ld + : + -Bdynamic -shared + : + : + addons/kernel/config_manager + ; + diff --git a/src/add-ons/kernel/bus_managers/config_manager.c b/src/add-ons/kernel/bus_managers/config_manager.c new file mode 100644 index 0000000000..797aeb0b82 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/config_manager.c @@ -0,0 +1,172 @@ +/* Config Manager +** provides access to device configurations +** +** Distributed under the terms of the OpenBeOS License. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static pci_module_info *gPCI = NULL; + +#define B_CONFIG_MANAGER_FOR_BUS_MODULE_NAME "bus_managers/config_manager/bus/v1" + +#define FUNCTION(x...) dprintf(__FUNCTION__ x) +#define TRACE(x) dprintf x + + +// #pragma mark - +// Driver module API + + +static status_t +driver_get_next_device_info(bus_type bus, uint64 *cookie, struct device_info *info, uint32 size) +{ + FUNCTION("(bus = %d, cookie = %lld)\n", bus, *cookie); + return B_ENTRY_NOT_FOUND; +} + + +static status_t +driver_get_device_info_for(uint64 id, struct device_info *info, uint32 size) +{ + FUNCTION("(id = %Ld)\n", id); + return B_ENTRY_NOT_FOUND; +} + + +static status_t +driver_get_size_of_current_configuration_for(uint64 id) +{ + FUNCTION("(id = %Ld)\n", id); + return B_ENTRY_NOT_FOUND; +} + + +static status_t +driver_get_current_configuration_for(uint64 id, struct device_configuration *current, uint32 size) +{ + FUNCTION("(id = %Ld, current = %p, size = %lu)\n", id, current, size); + return B_ENTRY_NOT_FOUND; +} + + +static status_t +driver_get_size_of_possible_configurations_for(uint64 id) +{ + FUNCTION("(id = %Ld)\n", id); + return B_ENTRY_NOT_FOUND; +} + + +static status_t +driver_get_possible_configurations_for(uint64 id, struct possible_device_configurations *possible, uint32 size) +{ + FUNCTION("(id = %Ld, possible = %p, size = %lu)\n", id, possible, size); + return B_ENTRY_NOT_FOUND; +} + + +static status_t +driver_count_resource_descriptors_of_type(const struct device_configuration *config, resource_type type) +{ + FUNCTION("(config = %p, type = %d)\n", config, type); + return B_ENTRY_NOT_FOUND; +} + + +static status_t +driver_get_nth_resource_descriptor_of_type(const struct device_configuration *config, uint32 num, + resource_type type, resource_descriptor *descr, uint32 size) +{ + FUNCTION("(config = %p, num = %ld)\n", config, num); + return B_ENTRY_NOT_FOUND; +} + + +static int32 +driver_std_ops(int32 op, ...) +{ + switch (op) { + case B_MODULE_INIT: + TRACE(("config_manager: driver module: init\n")); + + // ToDo: should not do this! Instead, iterate through all busses/config_manager/ + // modules and get them + if (get_module(B_PCI_MODULE_NAME, (module_info **)&gPCI) != 0) { + TRACE(("config_manager: failed to load PCI module\n")); + return -1; + } + break; + case B_MODULE_UNINIT: + TRACE(("config_manager: driver module: uninit\n")); + break; + default: + return EINVAL; + } + return B_OK; +} + + +// #pragma mark - +// Bus module API + + +static int32 +bus_std_ops(int32 op, ...) +{ + switch(op) { + case B_MODULE_INIT: + TRACE(("config_manager: bus module: init\n")); + break; + case B_MODULE_UNINIT: + TRACE(("config_manager: bus module: uninit\n")); + break; + default: + return EINVAL; + } + return B_OK; +} + + +struct config_manager_for_driver_module_info gDriverModuleInfo = { + { + B_CONFIG_MANAGER_FOR_DRIVER_MODULE_NAME, + B_KEEP_LOADED, + driver_std_ops + }, + + &driver_get_next_device_info, + &driver_get_device_info_for, + &driver_get_size_of_current_configuration_for, + &driver_get_current_configuration_for, + &driver_get_size_of_possible_configurations_for, + &driver_get_possible_configurations_for, + + &driver_count_resource_descriptors_of_type, + &driver_get_nth_resource_descriptor_of_type, +}; + +struct module_info gBusModuleInfo = { + //{ + B_CONFIG_MANAGER_FOR_BUS_MODULE_NAME, + B_KEEP_LOADED, + bus_std_ops + //}, + + // ToDo: find out what's in here! +}; + +module_info *modules[] = { + (module_info *)&gDriverModuleInfo, + (module_info *)&gBusModuleInfo, + NULL +};