From 53608d99db366587b64c42d38fadae1ec140cac2 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sun, 14 Jul 2002 16:11:11 +0000 Subject: [PATCH] Add the config_manager.h that I somehow missed from my eariler commit. Thanks to Graham MacDonald for pointing this out. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@221 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/drivers/config_manager.h | 111 ++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 headers/os/drivers/config_manager.h diff --git a/headers/os/drivers/config_manager.h b/headers/os/drivers/config_manager.h new file mode 100644 index 0000000000..c4644a799c --- /dev/null +++ b/headers/os/drivers/config_manager.h @@ -0,0 +1,111 @@ +#ifndef _CONFIG_MANAGER_H +#define _CONFIG_MANAGER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + B_ISA_BUS, + B_PCI_BUS, + B_PCMCIA_BUS, + B_UNKNOWN_BUS = 0x80 +} bus_type; + +typedef struct { + uchar base; + uchar subtype; + uchar interface; +} device_type; + +typedef struct { + uint32 mask; + uint32 flags; + uint32 cookie; +} resource_mask_descriptor; + +typedef struct { + uint32 minbase; + uint32 maxbase; + uint32 basealign; + uint32 len; + uint32 flags; + uint32 cookie; +} resource_range_descriptor; + +typedef enum { B_IRQ_RESOURCE, B_DMA_RESOURCE, + B_IO_PORT_RESOURCE, B_MEMORY_RESOURCE } resource_type; + +typedef struct { + resource_type type; + union { + resource_mask_descriptor m; + resource_range_descriptor r; + uint32 for_padding[7]; + } d; +} resource_descriptor; + +struct device_configuration { + uint32 flags; + uint32 num_resources; + resource_descriptor resources[0]; +}; + +struct possible_device_configurations { + uint32 flags; + uint32 num_possible; + struct device_configuration possible[0]; +}; + +struct device_info { + uint32 size; + uint32 bus_dependent_info_offset; + bus_type bus; + device_type devtype; + uint32 id[4]; /* unique (per-bus) normally-persistent id for device */ + uint32 flags; + status_t config_status; + + /* bus-dependent data goes here... */ +}; + +#define B_DEVICE_INFO_ENABLED 1 +#define B_DEVICE_INFO_CONFIGURED 2 +#define B_DEVICE_INFO_CAN_BE_DISABLED 4 + +typedef struct config_manager_for_driver_module_info { + module_info minfo; + + status_t (*get_next_device_info)(bus_type bus, uint64 *cookie, + struct device_info *info, uint32 len); + status_t (*get_device_info_for)(uint64 device, + struct device_info *info, uint32 len); + + status_t (*get_size_of_current_configuration_for)(uint64 device); + status_t (*get_current_configuration_for)(uint64 device, + struct device_configuration *config, uint32 len); + + status_t (*get_size_of_possible_configurations_for)(uint64 device); + status_t (*get_possible_configurations_for)(uint64 device, + struct possible_device_configurations *possible, + uint32 len); + + /* helper routines for drivers */ + status_t (*count_resource_descriptors_of_type)( + const struct device_configuration *config, + resource_type type); + status_t (*get_nth_resource_descriptor_of_type)( + const struct device_configuration *config, uint32 n, + resource_type type, resource_descriptor *descriptor, + uint32 len); +} config_manager_for_driver_module_info; + +#define B_CONFIG_MANAGER_FOR_DRIVER_MODULE_NAME "bus_managers/config_manager/driver/v1" + +#ifdef __cplusplus +} +#endif + +#endif