From f9239014db4d20349a24d31c2a0ce9cce3c76a4f Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 19 Apr 2018 06:10:18 +0200 Subject: bsps: Move pci_bus_count.c to bsps This patch is a part of the BSP source reorganization. Update #3285. --- c/src/lib/libbsp/i386/pc386/Makefile.am | 2 +- c/src/lib/libbsp/shared/pci/pci_bus_count.c | 68 ----------------------------- 2 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 c/src/lib/libbsp/shared/pci/pci_bus_count.c (limited to 'c/src/lib/libbsp') diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.am b/c/src/lib/libbsp/i386/pc386/Makefile.am index d50edebfee..c8981800b7 100644 --- a/c/src/lib/libbsp/i386/pc386/Makefile.am +++ b/c/src/lib/libbsp/i386/pc386/Makefile.am @@ -100,7 +100,7 @@ librtemsbsp_a_SOURCES += ../shared/comm/gdb_glue.c # pci librtemsbsp_a_SOURCES += ../shared/pci/pcibios.c librtemsbsp_a_SOURCES += ../shared/pci/pci_io.c -librtemsbsp_a_SOURCES += ../../shared/pci/pci_bus_count.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/pci/pci_bus_count.c librtemsbsp_a_SOURCES += ../../shared/pci/pci_find_device.c # startup diff --git a/c/src/lib/libbsp/shared/pci/pci_bus_count.c b/c/src/lib/libbsp/shared/pci/pci_bus_count.c deleted file mode 100644 index 104bf34758..0000000000 --- a/c/src/lib/libbsp/shared/pci/pci_bus_count.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This software is Copyright (C) 1998 by T.sqware - all rights limited - * It is provided in to the public domain "as is", can be freely modified - * as far as this copyight notice is kept unchanged, but does not imply - * an endorsement by T.sqware of the product in which it is included. - */ - -#include -#include -#include - -static uint8_t pci_number_of_buses = 0xff; - -unsigned char pci_bus_count(void) -{ - if ( pci_number_of_buses != 0xff ) { - return pci_number_of_buses; - } - - uint8_t bus; - uint8_t device; - uint8_t function; - uint8_t number_of_functions; - uint8_t header = 0; - uint8_t buses = 0; - uint32_t vendor = 0; - uint32_t class_rev = 0; - - pci_number_of_buses = 0; - - for (bus=0; bus < 0xff; bus++) { - for (device=0; device < PCI_MAX_DEVICES; device++) { - - pci_read_config_dword(bus, device, 0, PCI_VENDOR_ID, &vendor); - if ( vendor == -1 ) { - continue; - } - - pci_read_config_byte(bus, device, 0, PCI_HEADER_TYPE, &header); - number_of_functions = (header & 0x80) ? PCI_MAX_FUNCTIONS : 1; - - for ( function=0; function < number_of_functions; function++ ) { - pci_read_config_dword(bus, device, function, PCI_VENDOR_ID, &vendor); - if ( vendor == -1 ) { - continue; - } - - pci_read_config_dword(bus, device, function, PCI_CLASS_REVISION, &class_rev); - if ( (class_rev >> 16) == PCI_CLASS_BRIDGE_PCI ) { - pci_read_config_byte(bus, device, function, PCI_SUBORDINATE_BUS, &buses); - if ( buses > pci_number_of_buses ) { - pci_number_of_buses = buses; - } - } - } - } - } - - if ( pci_number_of_buses == 0 ) { - printk("pci_bus_count() found 0 busses, assuming 1\n"); - pci_number_of_buses = 1; - } else if ( pci_number_of_buses == 0xff ) { - printk("pci_bus_count() found 0xff busses, assuming 1\n"); - pci_number_of_buses = 1; - } - - return pci_number_of_buses; -} -- cgit v1.2.3