diff --git a/src/add-ons/kernel/bus_managers/pci/Jamfile b/src/add-ons/kernel/bus_managers/pci/Jamfile new file mode 100644 index 0000000000..3c6646685d --- /dev/null +++ b/src/add-ons/kernel/bus_managers/pci/Jamfile @@ -0,0 +1,18 @@ +SubDir OBOS_TOP src add-ons kernel bus_managers pci ; + +KernelStaticLibrary pci_bus_manager : +pci.c +; + +KernelLd pci : +pci_bus_manager.a +pci_arch_$(OBOS_ARCH)_bus_manager.a +kernel.so + +: $(OBOS_TOP)/src/kernel/ldscripts/$(OBOS_ARCH)/add-on.ld +: -Bdynamic -shared +: +# : add-ons/kernel/bus_managers/pci +; + +SubInclude OBOS_TOP src add-ons kernel bus_managers pci arch $(OBOS_ARCH) ; diff --git a/src/add-ons/kernel/bus_managers/pci/arch/ppc/Jamfile b/src/add-ons/kernel/bus_managers/pci/arch/ppc/Jamfile new file mode 100644 index 0000000000..6592c3fdf3 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/pci/arch/ppc/Jamfile @@ -0,0 +1,6 @@ +SubDir OBOS_TOP src add-ons kernel bus_managers pci arch ppc ; + +KernelStaticLibrary pci_arch_ppc_bus_manager : + pci_config.c + pci_io.c +; diff --git a/src/add-ons/kernel/bus_managers/pci/arch/ppc/pci_config.c b/src/add-ons/kernel/bus_managers/pci/arch/ppc/pci_config.c new file mode 100644 index 0000000000..4943b3028b --- /dev/null +++ b/src/add-ons/kernel/bus_managers/pci/arch/ppc/pci_config.c @@ -0,0 +1,20 @@ +#include "pci_priv.h" + +status_t +pci_config_init() +{ + return B_OK; +} + + +uint32 +read_pci_config(uint8 bus, uint8 device, uint8 function, uint8 offset, uint8 size) +{ + return 0; +} + + +void +write_pci_config(uint8 bus, uint8 device, uint8 function, uint8 offset, uint8 size, uint32 value) +{ +} diff --git a/src/add-ons/kernel/bus_managers/pci/arch/ppc/pci_io.c b/src/add-ons/kernel/bus_managers/pci/arch/ppc/pci_io.c new file mode 100644 index 0000000000..03ac210f20 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/pci/arch/ppc/pci_io.c @@ -0,0 +1,53 @@ +#include "pci_priv.h" + +status_t +pci_io_init() +{ + return B_OK; +} + + +uint8 +read_io_8(int mapped_io_addr) +{ + return 0; +} + + +void +write_io_8(int mapped_io_addr, uint8 value) +{ +} + + +uint16 +read_io_16(int mapped_io_addr) +{ + return 0; +} + + +void +write_io_16(int mapped_io_addr, uint16 value) +{ +} + + +uint32 +read_io_32(int mapped_io_addr) +{ + return 0; +} + + +void +write_io_32(int mapped_io_addr, uint32 value) +{ +} + + +void * +ram_address(const void *physical_address_in_system_memory) +{ + return 0; +} diff --git a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_config.c b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_config.c new file mode 100644 index 0000000000..4943b3028b --- /dev/null +++ b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_config.c @@ -0,0 +1,20 @@ +#include "pci_priv.h" + +status_t +pci_config_init() +{ + return B_OK; +} + + +uint32 +read_pci_config(uint8 bus, uint8 device, uint8 function, uint8 offset, uint8 size) +{ + return 0; +} + + +void +write_pci_config(uint8 bus, uint8 device, uint8 function, uint8 offset, uint8 size, uint32 value) +{ +} diff --git a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_io.c b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_io.c new file mode 100644 index 0000000000..03ac210f20 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_io.c @@ -0,0 +1,53 @@ +#include "pci_priv.h" + +status_t +pci_io_init() +{ + return B_OK; +} + + +uint8 +read_io_8(int mapped_io_addr) +{ + return 0; +} + + +void +write_io_8(int mapped_io_addr, uint8 value) +{ +} + + +uint16 +read_io_16(int mapped_io_addr) +{ + return 0; +} + + +void +write_io_16(int mapped_io_addr, uint16 value) +{ +} + + +uint32 +read_io_32(int mapped_io_addr) +{ + return 0; +} + + +void +write_io_32(int mapped_io_addr, uint32 value) +{ +} + + +void * +ram_address(const void *physical_address_in_system_memory) +{ + return 0; +} diff --git a/src/add-ons/kernel/bus_managers/pci/pci.c b/src/add-ons/kernel/bus_managers/pci/pci.c new file mode 100644 index 0000000000..478bbbffd6 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/pci/pci.c @@ -0,0 +1,102 @@ +#include +#include +#include +#include "pci_priv.h" + +void pci_scan_bus(uint8 bus); +long get_nth_pci_info(long index, pci_info *outInfo); +status_t pci_module_init(void); +status_t pci_module_uninit(void); +int32 std_ops(int32 op, ...); +status_t pci_module_rescan(); + + +void +pci_scan_bus(uint8 bus) +{ +} + + +long +get_nth_pci_info(long index, pci_info *outInfo) +{ + return 0; +} + + +status_t +pci_module_init(void) +{ + dprintf("PCI: pci_module_init\n"); + + if (B_OK != pci_io_init()) { + dprintf("PCI: pci_io_init failed\n"); + return B_ERROR; + } + + if (B_OK != pci_config_init()) { + dprintf("PCI: pci_config_init failed\n"); + return B_ERROR; + } + + pci_scan_bus(0); + return B_OK; +} + + +status_t +pci_module_uninit(void) +{ + dprintf("PCI: pci_module_uninit\n"); + return B_OK; +} + + +status_t +pci_module_rescan() +{ + return B_OK; +} + + +int32 +std_ops(int32 op, ...) +{ + switch (op) { + case B_MODULE_INIT: + return pci_module_init(); + + case B_MODULE_UNINIT: + return pci_module_uninit(); + } + + return EINVAL; +} + + +struct pci_module_info pci_module = { + { + { + B_PCI_MODULE_NAME, + B_KEEP_LOADED, + std_ops + }, + pci_module_rescan + }, + &read_io_8, + &write_io_8, + &read_io_16, + &write_io_16, + &read_io_32, + &write_io_32, + &get_nth_pci_info, + &read_pci_config, + &write_pci_config, + &ram_address +}; + + +module_info *modules[] = { + (module_info *)&pci_module, + NULL +};