drop obsolete CONNECTION_x_y macros. Use row information instead.
authorStefan Reinauer <stepan@openbios.org>
Wed, 24 Mar 2004 22:59:47 +0000 (22:59 +0000)
committerStefan Reinauer <stepan@openbios.org>
Wed, 24 Mar 2004 22:59:47 +0000 (22:59 +0000)
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1472 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

src/mainboard/amd/quartet/auto.c
src/mainboard/ibm/e325/auto.c
src/mainboard/newisys/khepri/auto.c
src/northbridge/amd/amdk8/coherent_ht.c

index 121966dbc41ceb9f340ad75de58e79a6c3ac7b7b..b5b2e75e1db5f05d7b6c6b28c82722fe6a14b09d 100644 (file)
@@ -144,11 +144,8 @@ static void coherent_ht_mainboard(unsigned cpus)
 
 #include "northbridge/amd/amdk8/raminit.c"
 
-#define CONNECTION_0_1 UP
-#define CONNECTION_0_2 ACROSS
-#define CONNECTION_1_3 DOWN
-
 #include "northbridge/amd/amdk8/coherent_ht.c"
+
 #include "sdram/generic_sdram.c"
 
 #include "resourcemap.c" /* quartet does not want the default */
index 0767aa6d4798984d23a168147532e1b3477a1e64..7dd1fbde17dbd382f58d188d3ae50eff1a4b8242 100644 (file)
@@ -120,8 +120,6 @@ static inline int spd_read_byte(unsigned device, unsigned address)
 
 #include "northbridge/amd/amdk8/raminit.c"
 
-#define CONNECTION_0_1 DOWN
-
 #include "northbridge/amd/amdk8/coherent_ht.c"
 #include "sdram/generic_sdram.c"
 #include "mainboard/ibm/e325/resourcemap.c"
index 18e222f01ff3b0a81f430b7f459e09e0352bd6bb..2b4a2b1f845ce3b8566a26f818b7859d69fd43a9 100644 (file)
@@ -122,9 +122,8 @@ static inline int spd_read_byte(unsigned device, unsigned address)
 
 #include "northbridge/amd/amdk8/raminit.c"
 
-#define CONNECTION_0_1 DOWN
-
 #include "northbridge/amd/amdk8/coherent_ht.c"
+
 #include "sdram/generic_sdram.c"
 
 #include "resourcemap.c" /* newisys khepri does not want the default */
index b8863998f6490afc983ea5491683976a43c8cbff..baff9deb1f6cf95827ad8e609f7f9e1b92389370 100644 (file)
 #include "arch/romcc_io.h"
 #include "amdk8.h"
 
-/*
- * Until we have a completely dynamic setup we want
- * to be able to map different cpu graphs.
- */
-
-#define UP     0x00
-#define ACROSS 0x20
-#define DOWN   0x40
-
-/* 
- * set some default values. These are used if they are not
- * differently defined in the motherboard's auto.c file.
- * See src/mainboard/amd/quartet/auto.c for an example.
- */
-
-#ifndef CONNECTION_0_1 
-#define CONNECTION_0_1 ACROSS
-#endif
-
-#ifndef CONNECTION_0_2 
-#define CONNECTION_0_2 UP
-#endif
-
-#ifndef CONNECTION_1_3 
-#define CONNECTION_1_3 UP
-#endif
-
 /* when generating a temporary row configuration we
  * don't want broadcast to be enabled for that node.
  */
@@ -68,6 +41,34 @@ typedef int bool;
 #define TRUE  (-1)
 #define FALSE (0)
 
+static u8 link_to_register(int ldt)
+{
+       /*
+        * [ 0: 3] Request Route
+        *     [0] Route to this node
+        *     [1] Route to Link 0
+        *     [2] Route to Link 1
+        *     [3] Route to Link 2
+        */
+
+       if (ldt&0x08) return 0x40;
+       if (ldt&0x04) return 0x20;
+       if (ldt&0x02) return 0x00;
+       
+       /* we should never get here */
+       print_debug("Unknown Link\n");
+       return 0;
+}
+
+static int link_connection(int src, int dest)
+{
+       /* we generate the needed link information from the rows
+        * by taking the Request Route of the according row.
+        */
+       
+       return generate_row(src, dest, CONFIG_MAX_CPUS) & 0x0f;
+}
+
 static void disable_probes(void)
 {
        /* disable read/write/fill probes for uniprocessor setup
@@ -367,7 +368,7 @@ static struct setup_smp_result setup_smp(void)
        /* Setup and check a temporary connection to node 1 */
        setup_temp_row(0, 1, result.cpus);
        
-       if (!check_connection(0, 7, CONNECTION_0_1)) {
+       if (!check_connection(0, 7, link_to_register(link_connection(0,1)))) {
                print_debug("No connection to Node 1.\r\n");
                clear_temp_row(0);      /* delete temp connection */
                setup_uniprocessor();   /* and get up working     */
@@ -376,8 +377,7 @@ static struct setup_smp_result setup_smp(void)
        }
 
        /* We found 2 nodes so far */
-       result.needs_reset = 
-               optimize_connection(NODE_HT(0), 0x80 + CONNECTION_0_1, NODE_HT(7), 0x80 + CONNECTION_0_1);
+       
        setup_node(0, result.cpus);     /* Node 1 is there. Setup Node 0 correctly */
        setup_remote_node(1, result.cpus);  /* Setup the routes on the remote node */
         rename_temp_node(1);    /* Rename Node 7 to Node 1  */
@@ -385,13 +385,17 @@ static struct setup_smp_result setup_smp(void)
        
        clear_temp_row(0);      /* delete temporary connection */
        
+       result.needs_reset = optimize_connection(
+               NODE_HT(0), 0x80 + link_to_register(link_connection(0,1)),
+               NODE_HT(1), 0x80 + link_to_register(link_connection(1,0)) );
+       
 #if CONFIG_MAX_CPUS > 2
        result.cpus=4;
        
        /* Setup and check temporary connection from Node 0 to Node 2 */
        setup_temp_row(0,2, result.cpus);
 
-       if (!check_connection(0, 7, CONNECTION_0_2)) {
+       if (!check_connection(0, 7, link_to_register(link_connection(0,2))) ) {
                print_debug("No connection to Node 2.\r\n");
                clear_temp_row(0);       /* delete temp connection */
                result.cpus = 2;
@@ -405,7 +409,7 @@ static struct setup_smp_result setup_smp(void)
        setup_temp_row(0,1, result.cpus); /* temp. link between nodes 0 and 1 */
        setup_temp_row(1,3, result.cpus); /* temp. link between nodes 1 and 3 */
 
-       if (!check_connection(1, 7, CONNECTION_1_3)) {
+       if (!check_connection(1, 7, link_to_register(link_connection(1,3)))) {
                print_debug("No connection to Node 3.\r\n");
                clear_temp_row(0);       /* delete temp connection */
                clear_temp_row(1);       /* delete temp connection */
@@ -413,8 +417,6 @@ static struct setup_smp_result setup_smp(void)
                return result;
        }
 
-#warning "FIXME optimize the physical connections"
-
        /* We found 4 nodes so far. Now setup all nodes for 4p */
 
        setup_node(0, result.cpus);  /* The first 2 nodes are configured    */
@@ -436,6 +438,19 @@ static struct setup_smp_result setup_smp(void)
        clear_temp_row(2);
        clear_temp_row(3);
 
+       /* optimize physical connections - by LYH */
+       result.needs_reset = optimize_connection(
+               NODE_HT(0), 0x80 + link_to_register(link_connection(0,2)),
+               NODE_HT(2), 0x80 + link_to_register(link_connection(2,0)) );
+
+       result.needs_reset = optimize_connection(
+               NODE_HT(1), 0x80 + link_to_register(link_connection(1,3)),
+               NODE_HT(3), 0x80 + link_to_register(link_connection(3,1)) );
+
+       result.needs_reset = optimize_connection(
+               NODE_HT(2), 0x80 + link_to_register(link_connection(2,3)),
+               NODE_HT(3), 0x80 + link_to_register(link_connection(3,2)) );
+
 #endif
        print_debug_hex8(result.cpus);
        print_debug(" nodes initialized.\r\n");