Factor out a few commonly duplicated functions from northbridge.c.
authorUwe Hermann <uwe@hermann-uwe.de>
Mon, 11 Oct 2010 19:36:13 +0000 (19:36 +0000)
committerUwe Hermann <uwe@hermann-uwe.de>
Mon, 11 Oct 2010 19:36:13 +0000 (19:36 +0000)
The following functions are moved to devices/device_util.c:

 - ram_resource()

 - tolm_test()

 - find_pci_tolm()

There are only two tolm_test() / find_pci_tolm() which differ from the
defaults, one of them can easily be eliminated in a follow-up patch,
maybe even both, but for now keep it simple and only eliminate the majority.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Peter Stuge <peter@stuge.se>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5937 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

25 files changed:
src/cpu/amd/sc520/sc520.c
src/devices/device_util.c
src/include/device/device.h
src/mainboard/emulation/qemu-x86/northbridge.c
src/northbridge/amd/amdfam10/northbridge.c
src/northbridge/amd/amdk8/northbridge.c
src/northbridge/amd/gx1/northbridge.c
src/northbridge/amd/gx2/northbridge.c
src/northbridge/amd/lx/northbridge.c
src/northbridge/intel/e7501/northbridge.c
src/northbridge/intel/e7520/northbridge.c
src/northbridge/intel/e7525/northbridge.c
src/northbridge/intel/i3100/northbridge.c
src/northbridge/intel/i440bx/northbridge.c
src/northbridge/intel/i440lx/northbridge.c
src/northbridge/intel/i82810/northbridge.c
src/northbridge/intel/i82830/northbridge.c
src/northbridge/intel/i855/northbridge.c
src/northbridge/intel/i945/northbridge.c
src/northbridge/via/cn400/northbridge.c
src/northbridge/via/cn700/northbridge.c
src/northbridge/via/cx700/northbridge.c
src/northbridge/via/vt8601/northbridge.c
src/northbridge/via/vt8623/northbridge.c
src/northbridge/via/vx800/northbridge.c

index 400ba6e622bc9c6267bc35834512570a54fbb39a..7c4d187037fc61ea2af6156e500c9c94afdfdf24 100644 (file)
@@ -84,47 +84,6 @@ static const struct pci_driver cpu_driver __pci_driver = {
        .device = 0x3000
 };
 
-static void ram_resource(device_t dev, unsigned long index,
-        unsigned long basek, unsigned long sizek)
-{
-        struct resource *resource;
-       printk(BIOS_SPEW, "%s sizek 0x%lx\n", __func__, sizek);
-        if (!sizek) {
-                return;
-        }
-        resource = new_resource(dev, index);
-        resource->base  = ((resource_t)basek) << 10;
-        resource->size  = ((resource_t)sizek) << 10;
-        resource->flags =  IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
-                IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static uint32_t find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       uint32_t tolm;
-  printk(BIOS_SPEW, "%s\n", __func__);
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-  printk(BIOS_SPEW, "%s returns 0x%x\n", __func__, tolm);
-       return tolm;
-}
-
 static void pci_domain_set_resources(device_t dev)
 {
        device_t mc_dev;
index c845ecd35d1d8466e1f23a9e7a6625d52ba97f08..2c46884d9e7e0c3e0fd5d5f68f03d72a29a82dd7 100644 (file)
@@ -730,3 +730,47 @@ void show_all_devs_resources(int debug_level, const char* msg)
                        show_one_resource(debug_level, dev, res, "");
        }
 }
+
+void ram_resource(device_t dev, unsigned long index,
+                 unsigned long basek, unsigned long sizek)
+{
+       struct resource *resource;
+
+       if (!sizek)
+               return;
+
+       resource = new_resource(dev, index);
+       resource->base = ((resource_t)basek) << 10;
+       resource->size = ((resource_t)sizek) << 10;
+       resource->flags = IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
+               IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
+}
+
+void tolm_test(void *gp, struct device *dev, struct resource *new)
+{
+       struct resource **best_p = gp;
+       struct resource *best;
+
+       best = *best_p;
+
+       if (!best || (best->base > new->base))
+               best = new;
+
+       *best_p = best;
+}
+
+u32 find_pci_tolm(struct bus *bus)
+{
+       struct resource *min = NULL;
+       u32 tolm;
+
+       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM,
+                            tolm_test, &min);
+
+       tolm = 0xffffffffUL;
+
+       if (min && tolm > min->base)
+               tolm = min->base;
+
+       return tolm;
+}
index fde64304b666239dac9494b43155260010d92faa..1b978b1540ab674bafd58518c7b368e26deb94a5 100644 (file)
@@ -146,4 +146,10 @@ extern struct device_operations default_dev_ops_root;
 void pci_domain_read_resources(struct device *dev);
 unsigned int pci_domain_scan_bus(struct device *dev, unsigned int max);
 unsigned int scan_static_bus(device_t bus, unsigned int max);
+
+void ram_resource(device_t dev, unsigned long index,
+                 unsigned long basek, unsigned long sizek);
+void tolm_test(void *gp, struct device *dev, struct resource *new);
+u32 find_pci_tolm(struct bus *bus);
+
 #endif /* DEVICE_H */
index fa7b192cf50addb30415bdf2507437de69faec1d..cca56204ab5ab36e353e11687e5932456ba62525 100644 (file)
@@ -9,45 +9,6 @@
 #include "chip.h"
 #include <delay.h>
 
-static void ram_resource(device_t dev, unsigned long index,
-       unsigned long basek, unsigned long sizek)
-{
-       struct resource *resource;
-
-       if (!sizek) {
-               return;
-       }
-       resource = new_resource(dev, index);
-       resource->base  = ((resource_t)basek) << 10;
-       resource->size  = ((resource_t)sizek) << 10;
-       resource->flags =  IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
-               IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static uint32_t find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       uint32_t tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-       return tolm;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 #define HIGH_TABLES_SIZE 64    // maximum size of high tables in KB
 extern uint64_t high_tables_base, high_tables_size;
index 28ccbfd16402646bb06eabe3bba4a352a391fc92..f8c8f26439dff655dfd67fefa0c1ad2436099fac 100644 (file)
@@ -689,33 +689,7 @@ static void amdfam10_domain_read_resources(device_t dev)
 #endif
 }
 
-static void ram_resource(device_t dev, unsigned long index,
-       resource_t basek, resource_t sizek)
-{
-       struct resource *resource;
-
-       if (!sizek) {
-               return;
-       }
-       resource = new_resource(dev, index);
-       resource->base = basek << 10;
-       resource->size = sizek << 10;
-       resource->flags =  IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
-               IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static u32 find_pci_tolm(struct bus *bus, u32 tolm)
+static u32 my_find_pci_tolm(struct bus *bus, u32 tolm)
 {
        struct resource *min;
        min = 0;
@@ -951,7 +925,7 @@ static void amdfam10_domain_set_resources(device_t dev)
 
        pci_tolm = 0xffffffffUL;
        for(link = dev->link_list; link; link = link->next) {
-               pci_tolm = find_pci_tolm(link, pci_tolm);
+               pci_tolm = my_find_pci_tolm(link, pci_tolm);
        }
 
        // FIXME handle interleaved nodes. If you fix this here, please fix
index 9047d6084d36a86c5eb8b3cca79a55e3c3149f6f..263777f75105243959238a4aca7ab27bb6e88c16 100644 (file)
@@ -646,22 +646,7 @@ static void amdk8_domain_read_resources(device_t dev)
 #endif
 }
 
-static void ram_resource(device_t dev, unsigned long index,
-       unsigned long basek, unsigned long sizek)
-{
-       struct resource *resource;
-
-       if (!sizek) {
-               return;
-       }
-       resource = new_resource(dev, index);
-       resource->base = ((resource_t)basek) << 10;
-       resource->size = ((resource_t)sizek) << 10;
-       resource->flags =  IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
-               IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
+static void my_tolm_test(void *gp, struct device *dev, struct resource *new)
 {
        struct resource **best_p = gp;
        struct resource *best;
@@ -673,12 +658,12 @@ static void tolm_test(void *gp, struct device *dev, struct resource *new)
        *best_p = best;
 }
 
-static u32 find_pci_tolm(struct bus *bus)
+static u32 my_find_pci_tolm(struct bus *bus)
 {
        struct resource *min;
        u32 tolm;
        min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test, &min);
+       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, my_tolm_test, &min);
        tolm = 0xffffffffUL;
        if (min && tolm > min->base) {
                tolm = min->base;
@@ -915,7 +900,7 @@ static void amdk8_domain_set_resources(device_t dev)
        }
 #endif
 
-       pci_tolm = find_pci_tolm(dev->link_list);
+       pci_tolm = my_find_pci_tolm(dev->link_list);
 
        // FIXME handle interleaved nodes. If you fix this here, please fix
        // amdfam10, too.
index 99695521a3090f12ed2b1d576d00d99541275906..9fa5e33cff38438785a18730e49c18b8901fad0e 100644 (file)
@@ -66,45 +66,6 @@ static const struct pci_driver northbridge_driver __pci_driver = {
        .device = PCI_DEVICE_ID_CYRIX_PCI_MASTER,
 };
 
-static void ram_resource(device_t dev, unsigned long index,
-        unsigned long basek, unsigned long sizek)
-{
-        struct resource *resource;
-
-        if (!sizek) {
-                return;
-        }
-        resource = new_resource(dev, index);
-        resource->base  = ((resource_t)basek) << 10;
-        resource->size  = ((resource_t)sizek) << 10;
-        resource->flags =  IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
-                IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static uint32_t find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       uint32_t tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-       return tolm;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 #define HIGH_TABLES_SIZE 64    // maximum size of high tables in KB
 extern uint64_t high_tables_base, high_tables_size;
index 3ca24a6390139f395b4cb14ea6507d1c27f5db1e..62c1c2eaf74cfd135f797e1d24adb4da97f50f86 100644 (file)
@@ -350,47 +350,6 @@ static const struct pci_driver northbridge_driver __pci_driver = {
        .device = PCI_DEVICE_ID_NS_GX2,
 };
 
-static void ram_resource(device_t dev, unsigned long index,
-        unsigned long basek, unsigned long sizek)
-{
-        struct resource *resource;
-
-        if (!sizek) {
-                return;
-        }
-        resource = new_resource(dev, index);
-        resource->base  = ((resource_t)basek) << 10;
-        resource->size  = ((resource_t)sizek) << 10;
-        resource->flags =  IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
-                IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-#if 0
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static u32 find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       u32 tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-       return tolm;
-}
-#endif
-
 // FIXME handle UMA correctly.
 #define FRAMEBUFFERK 4096
 
index 6eedfddbe4ec75c451134e7966a0067fadd62f30..bedeaf6ea8f91170047f4a710cc3e4a06fd5476e 100644 (file)
@@ -372,21 +372,6 @@ static const struct pci_driver northbridge_driver __pci_driver = {
        .device = PCI_DEVICE_ID_AMD_LXBRIDGE,
 };
 
-static void ram_resource(device_t dev, unsigned long index,
-                        unsigned long basek, unsigned long sizek)
-{
-       struct resource *resource;
-
-       if (!sizek)
-               return;
-
-       resource = new_resource(dev, index);
-       resource->base = ((resource_t) basek) << 10;
-       resource->size = ((resource_t) sizek) << 10;
-       resource->flags = IORESOURCE_MEM | IORESOURCE_CACHEABLE |
-           IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 #define HIGH_TABLES_SIZE 64    // maximum size of high tables in KB
 extern uint64_t high_tables_base, high_tables_size;
index 545ceba1dc9a08ddd6c240c77f1cbf4f220c7ae6..90985e2699be9e71fc2d1983dccd99ac7f04bd1e 100644 (file)
@@ -9,45 +9,6 @@
 #include <bitops.h>
 #include "chip.h"
 
-static void ram_resource(device_t dev, unsigned long index,
-        unsigned long basek, unsigned long sizek)
-{
-        struct resource *resource;
-
-        if (!sizek) {
-                return;
-        }
-        resource = new_resource(dev, index);
-        resource->base  = ((resource_t)basek) << 10;
-        resource->size  = ((resource_t)sizek) << 10;
-        resource->flags =  IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
-                IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static uint32_t find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       uint32_t tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-       return tolm;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 #define HIGH_TABLES_SIZE 64    // maximum size of high tables in KB
 extern uint64_t high_tables_base, high_tables_size;
index a35f7f1ad04c67d0268aa65b89fd5e95f4dd88e6..fceceb2a470d93fc35bf67674644a32c2911bc85 100644 (file)
 
 static unsigned int max_bus;
 
-static void ram_resource(device_t dev, unsigned long index,
-       unsigned long basek, unsigned long sizek)
-{
-       struct resource *resource;
-
-       resource = new_resource(dev, index);
-       resource->base  = ((resource_t)basek) << 10;
-       resource->size  = ((resource_t)sizek) << 10;
-       resource->flags =  IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
-               IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static uint32_t find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       uint32_t tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-       return tolm;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 #define HIGH_TABLES_SIZE 64    // maximum size of high tables in KB
 extern uint64_t high_tables_base, high_tables_size;
index bccd023b8b094dc33f4687825cd2d04890d15f2d..6ffe3b1b041b2dfd32d53cf64192178a46a11899 100644 (file)
 
 static unsigned int max_bus;
 
-static void ram_resource(device_t dev, unsigned long index,
-       unsigned long basek, unsigned long sizek)
-{
-       struct resource *resource;
-
-       resource = new_resource(dev, index);
-       resource->base  = ((resource_t)basek) << 10;
-       resource->size  = ((resource_t)sizek) << 10;
-       resource->flags =  IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
-               IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static uint32_t find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       uint32_t tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-       return tolm;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 #define HIGH_TABLES_SIZE 64    // maximum size of high tables in KB
 extern uint64_t high_tables_base, high_tables_size;
index 154b124cd6b4480b5ed6a27998d89f7a9165dd40..53b1dd7bd261cd5448d3b401f891f4b3cc2917b5 100644 (file)
 
 static u32 max_bus;
 
-static void ram_resource(device_t dev, u32 index,
-       u32 basek, u32 sizek)
-{
-       struct resource *resource;
-
-       resource = new_resource(dev, index);
-       resource->base  = ((resource_t)basek) << 10;
-       resource->size  = ((resource_t)sizek) << 10;
-       resource->flags =  IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
-               IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static u32 find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       u32 tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-       return tolm;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 #define HIGH_TABLES_SIZE 64    // maximum size of high tables in KB
 extern uint64_t high_tables_base, high_tables_size;
index 55b606ee10cd15a9424cd871b7fd2a2e79a69ee0..3873d103645709e84e10795045b22ba10e044239 100644 (file)
@@ -33,45 +33,6 @@ static const struct pci_driver northbridge_driver __pci_driver = {
        .device = 0x7190,
 };
 
-static void ram_resource(device_t dev, unsigned long index,
-       unsigned long basek, unsigned long sizek)
-{
-       struct resource *resource;
-
-       if (!sizek) {
-               return;
-       }
-       resource = new_resource(dev, index);
-       resource->base  = ((resource_t)basek) << 10;
-       resource->size  = ((resource_t)sizek) << 10;
-       resource->flags =  IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
-               IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static uint32_t find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       uint32_t tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-       return tolm;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 #define HIGH_TABLES_SIZE 64    // maximum size of high tables in KB
 extern uint64_t high_tables_base, high_tables_size;
index 8342778bab2a1a17245c857e9dddffc5f94b6579..40d8b01175451a43a482deb8b28b733cf58a0013 100644 (file)
@@ -18,6 +18,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
+
 #include <console/console.h>
 #include <arch/io.h>
 #include <stdint.h>
@@ -61,45 +62,6 @@ static const struct pci_driver northbridge_driver __pci_driver = {
        .device = 0x7180,
 };
 
-static void ram_resource(device_t dev, unsigned long index,
-       unsigned long basek, unsigned long sizek)
-{
-       struct resource *resource;
-
-       if (!sizek) {
-               return;
-       }
-       resource = new_resource(dev, index);
-       resource->base  = ((resource_t)basek) << 10;
-       resource->size  = ((resource_t)sizek) << 10;
-       resource->flags =  IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
-               IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static uint32_t find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       uint32_t tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-       return tolm;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 #define HIGH_TABLES_SIZE 64    // maximum size of high tables in KB
 extern uint64_t high_tables_base, high_tables_size;
index de979d9d277643b5f4a53be3f076bcd56e48812c..4bf7d466e56a53fdd4a3002001c392c536bb3e56 100644 (file)
@@ -62,46 +62,6 @@ static const struct pci_driver i810e_northbridge_driver __pci_driver = {
        .device = 0x7124,
 };
 
-static void ram_resource(device_t dev, unsigned long index,
-                        unsigned long basek, unsigned long sizek)
-{
-       struct resource *resource;
-
-       if (!sizek) {
-               return;
-       }
-       resource = new_resource(dev, index);
-       resource->base = ((resource_t) basek) << 10;
-       resource->size = ((resource_t) sizek) << 10;
-       resource->flags = IORESOURCE_MEM | IORESOURCE_CACHEABLE |
-           IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static uint32_t find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       uint32_t tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test,
-                            &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-       return tolm;
-}
-
 /* IGD UMA memory */
 uint64_t uma_memory_base=0, uma_memory_size=0;
 
index 572c6e88a894b00bc9e67975c03a196c8f77eeb9..f2ae5fa1fd140a873cc674979c1f6e713f4a463d 100644 (file)
@@ -52,43 +52,6 @@ static const struct pci_driver northbridge_driver __pci_driver = {
        .device = 0x3575,
 };
 
-static void ram_resource(device_t dev, unsigned long index,
-                        unsigned long basek, unsigned long sizek)
-{
-       struct resource *resource;
-
-       if (!sizek)
-               return;
-       resource = new_resource(dev, index);
-       resource->base = ((resource_t) basek) << 10;
-       resource->size = ((resource_t) sizek) << 10;
-       resource->flags = IORESOURCE_MEM | IORESOURCE_CACHEABLE |
-           IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base))
-               best = new;
-       *best_p = best;
-}
-
-static uint32_t find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       uint32_t tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test,
-                            &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base)
-               tolm = min->base;
-       return tolm;
-}
-
 /* IGD memory */
 uint64_t uma_memory_base=0, uma_memory_size=0;
 
index 220f7220ce6d578069a49b6ba254fb63431940f1..e59dfd4ccb481a52c69e43d0af77bd8219dac2a0 100644 (file)
@@ -53,45 +53,6 @@ static const struct pci_driver northbridge_driver __pci_driver = {
         .device = 0x3580,
 };
 
-static void ram_resource(device_t dev, unsigned long index,
-        unsigned long basek, unsigned long sizek)
-{
-        struct resource *resource;
-
-        if (!sizek) {
-                return;
-        }
-        resource = new_resource(dev, index);
-        resource->base  = ((resource_t)basek) << 10;
-        resource->size  = ((resource_t)sizek) << 10;
-        resource->flags =  IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
-                IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static uint32_t find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       uint32_t tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-       return tolm;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 #define HIGH_TABLES_SIZE 64    // maximum size of high tables in KB
 extern uint64_t high_tables_base, high_tables_size;
index aab82bdd4aecc3d6fb97839d4511f096d84ef679..9963bed5ce3354880af78de22c09855f17e9d17d 100644 (file)
@@ -92,43 +92,6 @@ static void add_fixed_resources(struct device *dev, int index)
        }
 }
 
-static void ram_resource(device_t dev, unsigned long index, unsigned long basek,
-                        unsigned long sizek)
-{
-       struct resource *resource;
-
-       resource = new_resource(dev, index);
-       resource->base = ((resource_t) basek) << 10;
-       resource->size = ((resource_t) sizek) << 10;
-       resource->flags = IORESOURCE_MEM | IORESOURCE_CACHEABLE |
-           IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static uint32_t find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       uint32_t tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test,
-                            &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-       return tolm;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 #define HIGH_TABLES_SIZE 1024  // maximum size of high tables in KB
 extern uint64_t high_tables_base, high_tables_size;
index 2fc67c925f8c86d161a43f5691328b1063a71e88..3982c9877c73c05de56adb841fc0e8e9e8c81f10 100644 (file)
@@ -161,20 +161,6 @@ static void cn400_domain_read_resources(device_t dev)
        printk(BIOS_SPEW, "Leaving %s.\n", __func__);
 }
 
-static void ram_resource(device_t dev, unsigned long index,
-                        unsigned long basek, unsigned long sizek)
-{
-       struct resource *resource;
-
-       if (!sizek)
-               return;
-       resource = new_resource(dev, index);
-       resource->base = (resource_t) (basek << 10);
-       resource->size = (resource_t) (sizek << 10);
-       resource->flags = IORESOURCE_MEM | IORESOURCE_CACHEABLE |
-           IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
 #ifdef UNUSED_CODE
 static void ram_reservation(device_t dev, unsigned long index,
                         unsigned long base, unsigned long size)
@@ -191,35 +177,6 @@ static void ram_reservation(device_t dev, unsigned long index,
 }
 #endif
 
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-
-       best = *best_p;
-       if (!best || (best->base > new->base))
-               best = new;
-       *best_p = best;
-}
-
-static u32 find_pci_tolm(struct bus *bus)
-{
-       struct resource *min = NULL;
-       u32 tolm;
-
-       printk(BIOS_SPEW, "Entering CN400 find_pci_tolm\n");
-
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM,
-                            tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base)
-               tolm = min->base;
-
-       printk(BIOS_SPEW, "Leaving CN400 find_pci_tolm\n");
-
-       return tolm;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 /* maximum size of high tables in KB */
 #define HIGH_TABLES_SIZE 64
index dad7c468dde502dbc5e8a8915ece948b12e84a81..d0ad09515138c0d7ed539c5d0d8c3185feb91c57 100644 (file)
@@ -97,51 +97,6 @@ static const struct pci_driver memctrl_driver __pci_driver = {
        .device = PCI_DEVICE_ID_VIA_CN700_MEMCTRL,
 };
 
-static void ram_resource(device_t dev, unsigned long index,
-                        unsigned long basek, unsigned long sizek)
-{
-       struct resource *resource;
-
-       if (!sizek)
-               return;
-
-       resource = new_resource(dev, index);
-       resource->base = ((resource_t) basek) << 10;
-       resource->size = ((resource_t) sizek) << 10;
-       resource->flags = IORESOURCE_MEM | IORESOURCE_CACHEABLE |
-           IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-
-       best = *best_p;
-       if (!best || (best->base > new->base))
-               best = new;
-       *best_p = best;
-}
-
-static u32 find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       u32 tolm;
-
-       print_debug("Entering find_pci_tolm\n");
-
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM,
-                            tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base)
-               tolm = min->base;
-
-       print_debug("Leaving find_pci_tolm\n");
-
-       return tolm;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 /* maximum size of high tables in KB */
 #define HIGH_TABLES_SIZE 64
index 1c2c04cf23c561164f08330a1ccbbf479494d2b8..df9dde6e6d08fc5449fbf036cba7dcc3d390c18f 100644 (file)
 #include "chip.h"
 #include "northbridge.h"
 
-static void ram_resource(device_t dev, unsigned long index,
-                        unsigned long basek, unsigned long sizek)
-{
-       struct resource *resource;
-
-       if (!sizek) {
-               return;
-       }
-       resource = new_resource(dev, index);
-       resource->base = ((resource_t) basek) << 10;
-       resource->size = ((resource_t) sizek) << 10;
-       resource->flags = IORESOURCE_MEM | IORESOURCE_CACHEABLE |
-           IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static u32 find_pci_tolm(struct bus *bus)
-{
-       struct resource *min = NULL;
-       u32 tolm;
-
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-
-       return tolm;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 /* maximum size of high tables in KB */
 #define HIGH_TABLES_SIZE 64
index 834a57df25050db84ac1d52d98e4b6da94546215..d2731c7074b677e58448da120a6e82a21aa67837 100644 (file)
@@ -45,45 +45,6 @@ static const struct pci_driver northbridge_driver __pci_driver = {
        .device = 0x0601, /* 0x8601 is the AGP bridge? */
 };
 
-static void ram_resource(device_t dev, unsigned long index,
-        unsigned long basek, unsigned long sizek)
-{
-        struct resource *resource;
-
-        if (!sizek) {
-                return;
-        }
-        resource = new_resource(dev, index);
-        resource->base  = ((resource_t)basek) << 10;
-        resource->size  = ((resource_t)sizek) << 10;
-        resource->flags =  IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
-                IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static uint32_t find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       uint32_t tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-       return tolm;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 /* maximum size of high tables in KB */
 #define HIGH_TABLES_SIZE 64
index 86999cff6c87310c9e34ea13cb5b607165825183..f67d13c0213426b62a27397f7471a863d47559cb 100644 (file)
@@ -105,45 +105,6 @@ static const struct pci_driver agp_driver __pci_driver = {
        .device = PCI_DEVICE_ID_VIA_8633_1,
 };
 
-static void ram_resource(device_t dev, unsigned long index,
-        unsigned long basek, unsigned long sizek)
-{
-        struct resource *resource;
-
-        if (!sizek) {
-                return;
-        }
-        resource = new_resource(dev, index);
-        resource->base  = ((resource_t)basek) << 10;
-        resource->size  = ((resource_t)sizek) << 10;
-        resource->flags =  IORESOURCE_MEM | IORESOURCE_CACHEABLE | \
-                IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static uint32_t find_pci_tolm(struct bus *bus)
-{
-       struct resource *min;
-       uint32_t tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM, tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-       return tolm;
-}
-
 #if CONFIG_WRITE_HIGH_TABLES==1
 /* maximum size of high tables in KB */
 #define HIGH_TABLES_SIZE 64
index 93fa1f2160cc718fc97925e4f460b707c2103f27..f3cfa418aa56642e305df56073b3cff06294cdf1 100644 (file)
@@ -74,48 +74,6 @@ static const struct pci_driver memctrl_driver __pci_driver = {
        .device = PCI_DEVICE_ID_VIA_VX855_MEMCTRL,
 };
 
-static void ram_resource(device_t dev, unsigned long index,
-                        unsigned long basek, unsigned long sizek)
-{
-       struct resource *resource;
-
-       if (!sizek) {
-               return;
-       }
-       resource = new_resource(dev, index);
-       resource->base = ((resource_t) basek) << 10;
-       resource->size = ((resource_t) sizek) << 10;
-       resource->flags = IORESOURCE_MEM | IORESOURCE_CACHEABLE |
-           IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
-}
-
-static void tolm_test(void *gp, struct device *dev, struct resource *new)
-{
-       struct resource **best_p = gp;
-       struct resource *best;
-       best = *best_p;
-       if (!best || (best->base > new->base)) {
-               best = new;
-       }
-       *best_p = best;
-}
-
-static u32 find_pci_tolm(struct bus *bus)
-{
-       print_debug("Entering find_pci_tolm\n");
-       struct resource *min;
-       u32 tolm;
-       min = 0;
-       search_bus_resources(bus, IORESOURCE_MEM, IORESOURCE_MEM,
-                            tolm_test, &min);
-       tolm = 0xffffffffUL;
-       if (min && tolm > min->base) {
-               tolm = min->base;
-       }
-       print_debug("Leaving find_pci_tolm\n");
-       return tolm;
-}
-
 static void pci_domain_set_resources(device_t dev)
 {
        /*