Delete config_manager
Change-Id: Ie909c9a22750c33fcb1dd7824e8b3e51c4d86572 Reviewed-on: https://review.haiku-os.org/c/haiku/+/5208 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
parent
2b943e564a
commit
a9bd2efd90
@ -670,7 +670,6 @@ rule ArchitectureSetupWarnings architecture
|
||||
EnableWerror src add-ons kernel bus_managers acpi ;
|
||||
EnableWerror src add-ons kernel bus_managers agp_gart ;
|
||||
EnableWerror src add-ons kernel bus_managers ata ;
|
||||
EnableWerror src add-ons kernel bus_managers config_manager ;
|
||||
EnableWerror src add-ons kernel bus_managers firewire ;
|
||||
EnableWerror src add-ons kernel bus_managers ide ;
|
||||
EnableWerror src add-ons kernel bus_managers isa ;
|
||||
|
@ -26,7 +26,7 @@ if $(NET_BOOT) = 1 {
|
||||
}
|
||||
|
||||
SYSTEM_ADD_ONS_BUS_MANAGERS = [ FFilterByBuildFeatures
|
||||
acpi@x86,x86_64 ata config_manager dpc pci
|
||||
acpi@x86,x86_64 ata dpc pci
|
||||
isa@x86,x86_64 scsi $(USB_ONLY)usb fdt@arm
|
||||
] ;
|
||||
SYSTEM_ADD_ONS_FILE_SYSTEMS =
|
||||
|
@ -20,7 +20,7 @@ SYSTEM_ADD_ONS_DRIVERS_NET = [ FFilterByBuildFeatures
|
||||
] ;
|
||||
SYSTEM_ADD_ONS_BUS_MANAGERS = [ FFilterByBuildFeatures
|
||||
pci isa@x86 ata
|
||||
scsi config_manager agp_gart
|
||||
scsi agp_gart
|
||||
] ;
|
||||
SYSTEM_ADD_ONS_FILE_SYSTEMS = bfs packagefs ;
|
||||
|
||||
|
@ -225,7 +225,6 @@ SYSTEM_ADD_ONS_DRIVERS_SENSOR = [ FFilterByBuildFeatures
|
||||
|
||||
SYSTEM_ADD_ONS_BUS_MANAGERS = [ FFilterByBuildFeatures
|
||||
acpi@x86,x86_64 agp_gart@x86,x86_64 ata
|
||||
config_manager
|
||||
i2c@x86,x86_64 isa@x86,x86_64
|
||||
mmc
|
||||
scsi
|
||||
|
@ -195,7 +195,6 @@ AddFilesToPackage data KeyboardLayouts ThinkPad
|
||||
AddBootModuleSymlinksToPackage
|
||||
acpi@x86,x86_64 ahci ata ata_adapter
|
||||
bfs
|
||||
config_manager
|
||||
dpc
|
||||
efi_gpt
|
||||
generic_ide_pci
|
||||
|
@ -161,7 +161,7 @@ AddFilesToPackage data KeyboardLayouts ThinkPad
|
||||
|
||||
# boot module links
|
||||
AddBootModuleSymlinksToPackage
|
||||
acpi@x86,x86_64 ata pci isa@x86,x86_64 config_manager dpc
|
||||
acpi@x86,x86_64 ata pci isa@x86,x86_64 dpc
|
||||
scsi usb
|
||||
openpic@ppc
|
||||
ata_adapter locked_pool scsi_periph
|
||||
|
@ -1,117 +0,0 @@
|
||||
#ifndef _CONFIG_MANAGER_H
|
||||
#define _CONFIG_MANAGER_H
|
||||
|
||||
#include <module.h>
|
||||
|
||||
#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;
|
||||
|
||||
int config_manager_scan_hardcoded(struct device_info **info, int32 *count);
|
||||
|
||||
#define B_CONFIG_MANAGER_FOR_DRIVER_MODULE_NAME "bus_managers/config_manager/driver/v1"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _CONFIG_MANAGER_H */
|
@ -3,7 +3,6 @@ SubDir HAIKU_TOP src add-ons kernel bus_managers ;
|
||||
SubInclude HAIKU_TOP src add-ons kernel bus_managers acpi ;
|
||||
SubInclude HAIKU_TOP src add-ons kernel bus_managers agp_gart ;
|
||||
SubInclude HAIKU_TOP src add-ons kernel bus_managers ata ;
|
||||
SubInclude HAIKU_TOP src add-ons kernel bus_managers config_manager ;
|
||||
SubInclude HAIKU_TOP src add-ons kernel bus_managers fdt ;
|
||||
SubInclude HAIKU_TOP src add-ons kernel bus_managers firewire ;
|
||||
SubInclude HAIKU_TOP src add-ons kernel bus_managers i2c ;
|
||||
|
@ -1,11 +0,0 @@
|
||||
SubDir HAIKU_TOP src add-ons kernel bus_managers config_manager ;
|
||||
|
||||
UsePrivateHeaders kernel ;
|
||||
|
||||
KernelAddon config_manager :
|
||||
config_manager.c
|
||||
: config_manager_arch.a
|
||||
;
|
||||
|
||||
SubInclude HAIKU_TOP src add-ons kernel bus_managers config_manager arch
|
||||
$(TARGET_KERNEL_ARCH_DIR) ;
|
@ -1,8 +0,0 @@
|
||||
SubDir HAIKU_TOP src add-ons kernel bus_managers config_manager arch $(TARGET_ARCH) ;
|
||||
|
||||
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ;
|
||||
|
||||
UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ] ;
|
||||
|
||||
KernelStaticLibrary config_manager_arch :
|
||||
;
|
@ -1,8 +0,0 @@
|
||||
SubDir HAIKU_TOP src add-ons kernel bus_managers config_manager arch $(TARGET_ARCH) ;
|
||||
|
||||
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ;
|
||||
|
||||
UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ] ;
|
||||
|
||||
KernelStaticLibrary config_manager_arch :
|
||||
;
|
@ -1,12 +0,0 @@
|
||||
SubDir HAIKU_TOP src add-ons kernel bus_managers config_manager arch m68k ;
|
||||
|
||||
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ;
|
||||
|
||||
UsePrivateHeaders kernel [ FDirName kernel arch m68k ] ;
|
||||
|
||||
KernelStaticLibrary config_manager_arch :
|
||||
config_manager_arch.c
|
||||
amiga_hardcoded.c
|
||||
atari_hardcoded.c
|
||||
;
|
||||
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* arch-specific config manager
|
||||
*
|
||||
* Authors (in chronological order):
|
||||
* François Revol (revol@free.fr)
|
||||
*/
|
||||
|
||||
#include "config_manager_arch.h"
|
||||
|
||||
#if 0
|
||||
|
||||
#define DIS sizeof(struct device_info)
|
||||
#define DIF (B_DEVICE_INFO_ENABLED|B_DEVICE_INFO_CONFIGURED)
|
||||
#define DID 'm', '6', '8',
|
||||
|
||||
static struct hardcoded_device gHardcodedDevices[] = {
|
||||
/* video */
|
||||
{{DIS, DIS, B_ISA_BUS, {PCI_display, PCI_display_other, 0xff}, {DID, 0}, DIF, B_OK },
|
||||
.isa = {}},
|
||||
/* ide */
|
||||
{{DIS, DIS, B_ISA_BUS, {PCI_mass_storage, PCI_ide, 0xff}, {DID, 1}, DIF, B_OK },
|
||||
.isa = {}}
|
||||
/* scsi */
|
||||
{{DIS, DIS, B_ISA_BUS, {PCI_mass_storage, PCI_scsi, 0xff}, {DID, 2}, DIF, B_OK },
|
||||
.isa = {}}
|
||||
/* audio */
|
||||
{{DIS, DIS, B_ISA_BUS, {PCI_multimedia, 0xff, 0xff}, {DID, 3}, DIF, B_OK },
|
||||
.isa = {}}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
status_t
|
||||
amiga_hardcoded(struct device_info **info, int32 *count)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* arch-specific config manager
|
||||
*
|
||||
* Authors (in chronological order):
|
||||
* François Revol (revol@free.fr)
|
||||
*/
|
||||
|
||||
#include "config_manager_arch.h"
|
||||
|
||||
#define DIS sizeof(struct device_info)
|
||||
#define DIF (B_DEVICE_INFO_ENABLED|B_DEVICE_INFO_CONFIGURED)
|
||||
#define DID 'm68k', 'atar', 'i '
|
||||
|
||||
static struct hardcoded_device gHardcodedDevices[] = {
|
||||
/* video */
|
||||
{{DIS, DIS, B_ISA_BUS, {PCI_display, PCI_display_other, 0xff}, {DID, 0}, DIF, B_OK },
|
||||
{ .isa = {} },
|
||||
.configs = {}},
|
||||
/* ide */
|
||||
{{DIS, DIS, B_ISA_BUS, {PCI_mass_storage, PCI_ide, 0xff}, {DID, 1}, DIF, B_OK },
|
||||
{ .isa = {} },
|
||||
.configs = {}},
|
||||
/* scsi */
|
||||
{{DIS, DIS, B_ISA_BUS, {PCI_mass_storage, PCI_scsi, 0xff}, {DID, 2}, DIF, B_OK },
|
||||
{ .isa = {} },
|
||||
.configs = {}},
|
||||
/* audio */
|
||||
{{DIS, DIS, B_ISA_BUS, {PCI_multimedia, 0xff, 0xff}, {DID, 3}, DIF, B_OK },
|
||||
{ .isa = {} },
|
||||
.configs = { }},
|
||||
};
|
||||
|
||||
status_t
|
||||
atari_hardcoded(struct device_info **info, int32 *count)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* arch-specific config manager
|
||||
*
|
||||
* Authors (in chronological order):
|
||||
* François Revol (revol@free.fr)
|
||||
*/
|
||||
|
||||
#include <OS.h>
|
||||
#include <config_manager.h>
|
||||
|
||||
int config_manager_scan_hardcoded(struct device_info **info, int32 *count)
|
||||
{
|
||||
//XXX
|
||||
return atari_hardcoded(info, count);
|
||||
|
||||
count = 0;
|
||||
return B_OK;
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* arch-specific config manager
|
||||
*
|
||||
* Authors (in chronological order):
|
||||
* François Revol (revol@free.fr)
|
||||
*/
|
||||
#ifndef _CONFIG_MANAGER_ARCH_H
|
||||
#define _CONFIG_MANAGER_ARCH_H
|
||||
|
||||
#include <ISA.h>
|
||||
#include <PCI.h>
|
||||
#include <isapnp.h>
|
||||
#include <config_manager.h>
|
||||
|
||||
struct hardcoded_device {
|
||||
struct device_info info;
|
||||
union {
|
||||
struct isa_info isa;
|
||||
pci_info pci;
|
||||
//pcmcia...
|
||||
} bus;
|
||||
struct possible_device_configurations configs;
|
||||
};
|
||||
|
||||
#endif /* _CONFIG_MANAGER_ARCH_H */
|
||||
|
@ -1,10 +0,0 @@
|
||||
SubDir HAIKU_TOP src add-ons kernel bus_managers config_manager arch ppc ;
|
||||
|
||||
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ;
|
||||
|
||||
UsePrivateHeaders kernel [ FDirName kernel arch ppc ] ;
|
||||
|
||||
KernelStaticLibrary config_manager_arch :
|
||||
config_manager_arch.c
|
||||
;
|
||||
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* arch-specific config manager
|
||||
*
|
||||
* Authors (in chronological order):
|
||||
* François Revol (revol@free.fr)
|
||||
*/
|
||||
|
||||
#include <OS.h>
|
||||
#include <config_manager.h>
|
||||
|
||||
int config_manager_scan_hardcoded(struct device_info **info, int32 *count)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
SubDir HAIKU_TOP src add-ons kernel bus_managers config_manager arch $(TARGET_ARCH) ;
|
||||
|
||||
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ;
|
||||
|
||||
UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ] ;
|
||||
|
||||
KernelStaticLibrary config_manager_arch :
|
||||
config_manager_arch.c
|
||||
;
|
||||
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* arch-specific config manager
|
||||
*
|
||||
* Authors (in chronological order):
|
||||
* François Revol (revol@free.fr)
|
||||
*/
|
||||
|
||||
#include <OS.h>
|
||||
#include <config_manager.h>
|
||||
|
||||
int config_manager_scan_hardcoded(struct device_info **info, int32 *count)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
SubDir HAIKU_TOP src add-ons kernel bus_managers config_manager arch $(TARGET_ARCH) ;
|
||||
|
||||
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ;
|
||||
|
||||
UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ] ;
|
||||
|
||||
KernelStaticLibrary config_manager_arch :
|
||||
config_manager_arch.c
|
||||
;
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* arch-specific config manager
|
||||
*
|
||||
* Authors (in chronological order):
|
||||
* François Revol (revol@free.fr)
|
||||
*/
|
||||
|
||||
#include <OS.h>
|
||||
#include <config_manager.h>
|
||||
|
||||
int config_manager_scan_hardcoded(struct device_info **info, int32 *count)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
SubDir HAIKU_TOP src add-ons kernel bus_managers config_manager arch x86 ;
|
||||
|
||||
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ;
|
||||
|
||||
UsePrivateHeaders kernel [ FDirName kernel arch x86 ] ;
|
||||
|
||||
KernelStaticLibrary config_manager_arch :
|
||||
config_manager_arch.c
|
||||
;
|
||||
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* arch-specific config manager
|
||||
*
|
||||
* Authors (in chronological order):
|
||||
* François Revol (revol@free.fr)
|
||||
*/
|
||||
|
||||
#include <OS.h>
|
||||
#include <config_manager.h>
|
||||
|
||||
int config_manager_scan_hardcoded(struct device_info **info, int32 *count)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
@ -1,173 +0,0 @@
|
||||
/* Config Manager
|
||||
* provides access to device configurations
|
||||
*
|
||||
* Copyright 2002-2004, Marcus Overhagen, marcus@overhagen.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <config_manager.h>
|
||||
#include <PCI.h>
|
||||
#include <ISA.h>
|
||||
#include <bus_manager.h>
|
||||
#include <string.h>
|
||||
#include <heap.h>
|
||||
#include <KernelExport.h>
|
||||
|
||||
|
||||
static pci_module_info *gPCI = NULL;
|
||||
|
||||
#define B_CONFIG_MANAGER_FOR_BUS_MODULE_NAME "bus_managers/config_manager/bus/v1"
|
||||
|
||||
#define FUNCTION(x, y...) dprintf("%s" x, __FUNCTION__, y)
|
||||
#define TRACE(x) dprintf x
|
||||
|
||||
|
||||
// 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 = %" B_PRId64 ")\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 = %" B_PRId64 ")\n", id);
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
driver_get_size_of_current_configuration_for(uint64 id)
|
||||
{
|
||||
FUNCTION("(id = %" B_PRId64 ")\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 = %" B_PRId64 ", current = %p, size = %" B_PRIu32 ")\n", id,
|
||||
current, size);
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
driver_get_size_of_possible_configurations_for(uint64 id)
|
||||
{
|
||||
FUNCTION("(id = %" B_PRId64 ")\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 = %" B_PRId64 ", possible = %p, size = %" B_PRIu32 ")\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 = %" B_PRId32 ")\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
|
||||
};
|
@ -11,10 +11,6 @@ KernelAddon <driver>poke :
|
||||
poke.cpp
|
||||
;
|
||||
|
||||
KernelAddon <driver>config :
|
||||
config.c
|
||||
;
|
||||
|
||||
KernelAddon <driver>kdl :
|
||||
kdl.c
|
||||
;
|
||||
|
@ -1,164 +0,0 @@
|
||||
/* config driver
|
||||
* provides userland access to the device configuration manager
|
||||
*
|
||||
* Copyright 2002-2004, Axel Doerfler. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <Drivers.h>
|
||||
#include <drivers/config_manager.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "config_driver.h"
|
||||
|
||||
|
||||
#define DEVICE_NAME "misc/config"
|
||||
|
||||
int32 api_version = B_CUR_DRIVER_API_VERSION;
|
||||
|
||||
struct config_manager_for_driver_module_info *gConfigManager;
|
||||
|
||||
|
||||
// Device interface
|
||||
|
||||
|
||||
static status_t
|
||||
config_open(const char *name, uint32 flags, void **_cookie)
|
||||
{
|
||||
*_cookie = NULL;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
config_close(void *cookie)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
config_free_cookie(void *cookie)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
config_ioctl(void *cookie, uint32 op, void *buffer, size_t len)
|
||||
{
|
||||
struct cm_ioctl_data *params = (struct cm_ioctl_data *)buffer;
|
||||
|
||||
// simple check for validity of the argument
|
||||
if (params == NULL || params->magic != op)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
// ToDo: the access of the params is not safe!
|
||||
|
||||
switch (op) {
|
||||
case CM_GET_NEXT_DEVICE_INFO:
|
||||
return gConfigManager->get_next_device_info(params->bus, ¶ms->cookie,
|
||||
(struct device_info *)params->data, params->data_len);
|
||||
case CM_GET_DEVICE_INFO_FOR:
|
||||
return gConfigManager->get_device_info_for(params->cookie,
|
||||
(struct device_info *)params->data, params->data_len);
|
||||
case CM_GET_SIZE_OF_CURRENT_CONFIGURATION_FOR:
|
||||
return gConfigManager->get_size_of_current_configuration_for(params->cookie);
|
||||
case CM_GET_CURRENT_CONFIGURATION_FOR:
|
||||
return gConfigManager->get_current_configuration_for(params->cookie,
|
||||
(struct device_configuration *)params->data, params->data_len);
|
||||
case CM_GET_SIZE_OF_POSSIBLE_CONFIGURATIONS_FOR:
|
||||
return gConfigManager->get_size_of_possible_configurations_for(params->cookie);
|
||||
case CM_GET_POSSIBLE_CONFIGURATIONS_FOR:
|
||||
return gConfigManager->get_possible_configurations_for(params->cookie,
|
||||
(struct possible_device_configurations *)params->data, params->data_len);
|
||||
case CM_COUNT_RESOURCE_DESCRIPTORS_OF_TYPE:
|
||||
return gConfigManager->count_resource_descriptors_of_type(params->config, params->type);
|
||||
case CM_GET_NTH_RESOURCE_DESCRIPTOR_OF_TYPE:
|
||||
return gConfigManager->get_nth_resource_descriptor_of_type(params->config, params->n,
|
||||
params->type, (resource_descriptor *)params->data, params->data_len);
|
||||
}
|
||||
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
config_read(void * cookie, off_t pos, void *buf, size_t *_length)
|
||||
{
|
||||
*_length = 0;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
config_write(void * cookie, off_t pos, const void *buf, size_t *_length)
|
||||
{
|
||||
*_length = 0;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
// Driver interface
|
||||
|
||||
|
||||
status_t
|
||||
init_hardware()
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
const char **
|
||||
publish_devices(void)
|
||||
{
|
||||
static const char *devices[] = {
|
||||
DEVICE_NAME,
|
||||
NULL
|
||||
};
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
||||
|
||||
device_hooks *
|
||||
find_device(const char *name)
|
||||
{
|
||||
static device_hooks hooks = {
|
||||
&config_open,
|
||||
&config_close,
|
||||
&config_free_cookie,
|
||||
&config_ioctl,
|
||||
&config_read,
|
||||
&config_write,
|
||||
/* Leave select/deselect/readv/writev undefined. The kernel will
|
||||
* use its own default implementation. The basic hooks above this
|
||||
* line MUST be defined, however. */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
if (!strcmp(name, DEVICE_NAME))
|
||||
return &hooks;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
init_driver()
|
||||
{
|
||||
return get_module(B_CONFIG_MANAGER_FOR_DRIVER_MODULE_NAME, (module_info **)&gConfigManager);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
uninit_driver()
|
||||
{
|
||||
put_module(B_CONFIG_MANAGER_FOR_DRIVER_MODULE_NAME);
|
||||
}
|
||||
|
@ -1,38 +0,0 @@
|
||||
#ifndef _CONFIG_MANAGER_DRIVER_H_
|
||||
#define _CONFIG_MANAGER_DRIVER_H_
|
||||
/*
|
||||
** Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
/* definitions for the /dev/misc/config driver which provides access
|
||||
* to the config_manager via calls to ioctl().
|
||||
*
|
||||
* ToDo: This file should probably located in a publicly accessable place?!
|
||||
*/
|
||||
|
||||
/* the magic is the ioctl */
|
||||
|
||||
#define CM_GET_NEXT_DEVICE_INFO 'GNDI'
|
||||
#define CM_GET_DEVICE_INFO_FOR 'GDIF'
|
||||
#define CM_GET_SIZE_OF_CURRENT_CONFIGURATION_FOR 'GSCC'
|
||||
#define CM_GET_CURRENT_CONFIGURATION_FOR 'GCCF'
|
||||
#define CM_GET_SIZE_OF_POSSIBLE_CONFIGURATIONS_FOR 'GSPC'
|
||||
#define CM_GET_POSSIBLE_CONFIGURATIONS_FOR 'GPCF'
|
||||
|
||||
#define CM_COUNT_RESOURCE_DESCRIPTORS_OF_TYPE 'CRDT'
|
||||
#define CM_GET_NTH_RESOURCE_DESCRIPTOR_OF_TYPE 'GNRD'
|
||||
|
||||
struct cm_ioctl_data {
|
||||
uint32 magic;
|
||||
bus_type bus;
|
||||
uint64 cookie;
|
||||
void *config;
|
||||
uint32 n;
|
||||
uint32 type;
|
||||
void *data;
|
||||
uint32 data_len;
|
||||
};
|
||||
|
||||
#define CM_DEVICE_NAME "misc/config"
|
||||
|
||||
#endif /* _CONFIG_MANAGER_DRIVER_H_ */
|
Loading…
Reference in New Issue
Block a user