Make some changes o the ISA nad PCI modules and add the start of a config
manager module. As time goes on we can start fleshing these out. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@217 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d78dd85384
commit
82610abc62
@ -1,5 +1,21 @@
|
||||
SubDir OBOS_TOP src kernel core addons 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/bus_managers/config_manager
|
||||
;
|
||||
|
||||
KernelStaticLibrary libbus :
|
||||
<$(SOURCE_GRIST)>bus_init.c
|
||||
<$(SOURCE_GRIST)>bus_man.c
|
||||
|
96
src/kernel/core/addons/bus_managers/config_manager.c
Normal file
96
src/kernel/core/addons/bus_managers/config_manager.c
Normal file
@ -0,0 +1,96 @@
|
||||
/* config_manager.c
|
||||
*
|
||||
* Module that provides access to driver modules and busses
|
||||
*/
|
||||
|
||||
#include <ktypes.h>
|
||||
#include <config_manager.h>
|
||||
#include <PCI.h>
|
||||
#include <ISA.h>
|
||||
#include <bus_manager.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define B_CONFIG_MANAGER_FOR_BUS_MODULE_NAME "bus_managers/config_manager/driver/v1"
|
||||
|
||||
static status_t get_next_device_info(bus_type bus, uint64 *cookie,
|
||||
struct device_info *info, uint32 len)
|
||||
{
|
||||
dprintf("get_next_device_info(bus = %d, cookie = %lld)\n",
|
||||
bus, *cookie);
|
||||
}
|
||||
|
||||
/* device_modules */
|
||||
static int cfdm_std_ops(int32 op, ...)
|
||||
{
|
||||
switch(op) {
|
||||
case B_MODULE_INIT:
|
||||
dprintf( "config_manager: device modules: init\n" );
|
||||
break;
|
||||
case B_MODULE_UNINIT:
|
||||
dprintf( "config_manager: device modules: uninit\n" );
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
/* bus_modules */
|
||||
static int cfbm_std_ops(int32 op, ...)
|
||||
{
|
||||
switch(op) {
|
||||
case B_MODULE_INIT:
|
||||
dprintf( "config_manager: bus modules: init\n" );
|
||||
break;
|
||||
case B_MODULE_UNINIT:
|
||||
dprintf( "config_manager: bus modules: uninit\n" );
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
/* cfdm = configuration_manager_device_modules */
|
||||
struct config_manager_for_driver_module_info cfdm = {
|
||||
{
|
||||
B_CONFIG_MANAGER_FOR_DRIVER_MODULE_NAME,
|
||||
0,
|
||||
cfdm_std_ops
|
||||
},
|
||||
|
||||
NULL, /* get_next_device_info */
|
||||
NULL, /* get_device_info_for */
|
||||
NULL, /* get_size_of_current_configuration_for */
|
||||
NULL, /* get_current_configuration_for */
|
||||
NULL, /* get_size_of_possible_configurations */
|
||||
NULL, /* get_possible_configurations_for */
|
||||
|
||||
NULL, /* count_resource_descriptors_of_type */
|
||||
NULL, /* get_nth_resource_descriptor_of_type */
|
||||
};
|
||||
|
||||
/* cfbm = configuration_manager_bus_modules */
|
||||
struct config_manager_for_driver_module_info cfbm = {
|
||||
{
|
||||
B_CONFIG_MANAGER_FOR_BUS_MODULE_NAME,
|
||||
0,
|
||||
cfbm_std_ops
|
||||
},
|
||||
|
||||
NULL, /* get_next_device_info */
|
||||
NULL, /* get_device_info_for */
|
||||
NULL, /* get_size_of_current_configuration_for */
|
||||
NULL, /* get_current_configuration_for */
|
||||
NULL, /* get_size_of_possible_configurations */
|
||||
NULL, /* get_possible_configurations_for */
|
||||
|
||||
NULL, /* count_resource_descriptors_of_type */
|
||||
NULL, /* get_nth_resource_descriptor_of_type */
|
||||
};
|
||||
|
||||
module_info *modules[] = {
|
||||
(module_info*)&cfdm,
|
||||
(module_info*)&cfbm,
|
||||
NULL
|
||||
};
|
@ -5,28 +5,16 @@
|
||||
|
||||
#include <module.h>
|
||||
#include <Errors.h>
|
||||
#include <isa.h>
|
||||
#include <ISA.h>
|
||||
#include <arch/cpu.h>
|
||||
#include <debug.h>
|
||||
|
||||
static int isa_init( void )
|
||||
{
|
||||
dprintf( "ISA: init\n" );
|
||||
return B_NO_ERROR;
|
||||
}
|
||||
|
||||
static status_t isa_rescan(void)
|
||||
{
|
||||
dprintf("isa_rescan()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int isa_uninit( void )
|
||||
{
|
||||
dprintf( "ISA: uninit\n" );
|
||||
return B_NO_ERROR;
|
||||
}
|
||||
|
||||
static uint8 isa_read_io_8(int mapped_io_addr)
|
||||
{
|
||||
return in8( mapped_io_addr );
|
||||
@ -96,21 +84,21 @@ static int std_ops(int32 op, ...)
|
||||
{
|
||||
switch(op) {
|
||||
case B_MODULE_INIT:
|
||||
isa_init();
|
||||
dprintf( "ISA: init\n" );
|
||||
break;
|
||||
case B_MODULE_UNINIT:
|
||||
isa_uninit();
|
||||
dprintf( "ISA: uninit\n" );
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
return 0;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
static isa_bus_manager isa_module = {
|
||||
static isa_module_info isa_module = {
|
||||
{
|
||||
{
|
||||
ISA_MODULE_NAME,
|
||||
B_ISA_MODULE_NAME,
|
||||
B_KEEP_LOADED,
|
||||
std_ops
|
||||
},
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <PCI.h>
|
||||
#include <bus.h>
|
||||
#include <pci_bus.h>
|
||||
|
||||
@ -54,13 +55,6 @@ static int pci_freecookie(void * cookie)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
static int pci_seek(void * cookie, off_t pos, seek_type st)
|
||||
{
|
||||
return EPERM;
|
||||
}
|
||||
*/
|
||||
|
||||
static int pci_close(void * cookie)
|
||||
{
|
||||
return 0;
|
||||
@ -112,8 +106,8 @@ device_hooks pci_hooks = {
|
||||
&pci_write,
|
||||
NULL, /* select */
|
||||
NULL, /* deselect */
|
||||
// NULL, /* readv */
|
||||
// NULL /* writev */
|
||||
NULL, /* readv */
|
||||
NULL /* writev */
|
||||
};
|
||||
|
||||
static int pci_create_config_structs()
|
||||
@ -191,3 +185,39 @@ int pci_bus_init(kernel_args *ka)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int std_ops(int32 op, ...)
|
||||
{
|
||||
switch(op) {
|
||||
case B_MODULE_INIT:
|
||||
dprintf( "PCI: init\n" );
|
||||
break;
|
||||
case B_MODULE_UNINIT:
|
||||
dprintf( "PCI: uninit\n" );
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
struct pci_module_info pci_module = {
|
||||
{
|
||||
{
|
||||
B_PCI_MODULE_NAME,
|
||||
B_KEEP_LOADED,
|
||||
std_ops
|
||||
},
|
||||
NULL// &pci_rescan
|
||||
},
|
||||
|
||||
NULL,// &read_io_8,
|
||||
NULL,// &write_io_8,
|
||||
NULL,// &read_io_16,
|
||||
NULL,// &write_io_16,
|
||||
NULL,// &read_io_32,
|
||||
NULL,// &write_io_32,
|
||||
NULL,// &get_nth_pci_info,
|
||||
NULL,// &read_pci_config,
|
||||
NULL,// &write_pci_config,
|
||||
NULL,// &ram_address
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user