[coreboot] New patch to review for coreboot: 3198466 AMD northbridges: improve appearance

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Sat Jul 7 21:55:18 CEST 2012


Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1187

-gerrit

commit 3198466a0556b6c6d8fb0b6dda23034d9c7d7e0f
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Sat Jul 7 19:28:22 2012 +0300

    AMD northbridges: improve appearance
    
    Like alloc_dev(), alloc_find_dev() will die() on allocation failure,
    so I skip test for cpu==NULL on that execution path.
    
    Change-Id: I03949722ac3a127319a0ad3f812d77ba7b8f139f
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/northbridge/amd/agesa/family10/northbridge.c   |   11 +++-----
 src/northbridge/amd/agesa/family14/northbridge.c   |   13 +++-------
 src/northbridge/amd/agesa/family15/northbridge.c   |   12 ++++-----
 src/northbridge/amd/agesa/family15tn/northbridge.c |   12 ++++-----
 src/northbridge/amd/amdfam10/northbridge.c         |   25 +++++++------------
 src/northbridge/amd/amdk8/northbridge.c            |   22 ++++++-----------
 6 files changed, 35 insertions(+), 60 deletions(-)

diff --git a/src/northbridge/amd/agesa/family10/northbridge.c b/src/northbridge/amd/agesa/family10/northbridge.c
index 616a1c1..1f7b242 100644
--- a/src/northbridge/amd/agesa/family10/northbridge.c
+++ b/src/northbridge/amd/agesa/family10/northbridge.c
@@ -1421,13 +1421,10 @@ static u32 cpu_bus_scan(device_t dev, u32 max)
 				cpu->enabled = 0;
 			}
 
-			/* Report what I have done */
-			if (cpu) {
-				cpu->path.apic.node_id = i;
-				cpu->path.apic.core_id = j;
-				printk(BIOS_DEBUG, "CPU: %s %s\n",
-					dev_path(cpu), cpu->enabled?"enabled":"disabled");
-			}
+			cpu->path.apic.node_id = i;
+			cpu->path.apic.core_id = j;
+			printk(BIOS_DEBUG, "CPU: %s %s\n",
+				dev_path(cpu), cpu->enabled?"enabled":"disabled");
 
 		} //j
 	}
diff --git a/src/northbridge/amd/agesa/family14/northbridge.c b/src/northbridge/amd/agesa/family14/northbridge.c
index f7c3b8e..de1d4a0 100644
--- a/src/northbridge/amd/agesa/family14/northbridge.c
+++ b/src/northbridge/amd/agesa/family14/northbridge.c
@@ -833,15 +833,10 @@ static u32 cpu_bus_scan(device_t dev, u32 max)
 		cpu_path.type = DEVICE_PATH_APIC;
 		cpu_path.apic.apic_id = apic_id;
 		cpu = alloc_find_dev(dev->link_list, &cpu_path);
-		if (cpu) {
-			cpu->enabled = 1;
-			cpu->path.apic.node_id = 0;
-			cpu->path.apic.core_id = apic_id;
-			printk(BIOS_DEBUG, "CPU: %s %s\n",
-					dev_path(cpu), cpu->enabled?"enabled":"disabled");
-		} else {
-			cpu->enabled = 0;
-		}
+		cpu->path.apic.node_id = 0;
+		cpu->path.apic.core_id = apic_id;
+		printk(BIOS_DEBUG, "CPU: %s %s\n",
+			dev_path(cpu), cpu->enabled?"enabled":"disabled");
 	}
 	return max;
 }
diff --git a/src/northbridge/amd/agesa/family15/northbridge.c b/src/northbridge/amd/agesa/family15/northbridge.c
index 53629ed..5b339f2 100644
--- a/src/northbridge/amd/agesa/family15/northbridge.c
+++ b/src/northbridge/amd/agesa/family15/northbridge.c
@@ -1076,13 +1076,11 @@ static u32 cpu_bus_scan(device_t dev, u32 max)
 					continue;
 				cpu->enabled = 0;
 			}
-			/* Report what I have done */
-			if (cpu) {
-				cpu->path.apic.node_id = i;
-				cpu->path.apic.core_id = j;
-				printk(BIOS_DEBUG, "CPU: %s %s\n",
-					dev_path(cpu), cpu->enabled?"enabled":"disabled");
-			}
+
+			cpu->path.apic.node_id = i;
+			cpu->path.apic.core_id = j;
+			printk(BIOS_DEBUG, "CPU: %s %s\n",
+				dev_path(cpu), cpu->enabled?"enabled":"disabled");
 		} //j
 	}
 	return max;
diff --git a/src/northbridge/amd/agesa/family15tn/northbridge.c b/src/northbridge/amd/agesa/family15tn/northbridge.c
index 73aebad..133940c 100644
--- a/src/northbridge/amd/agesa/family15tn/northbridge.c
+++ b/src/northbridge/amd/agesa/family15tn/northbridge.c
@@ -1060,13 +1060,11 @@ static u32 cpu_bus_scan(device_t dev, u32 max)
 					continue;
 				cpu->enabled = 0;
 			}
-			/* Report what I have done */
-			if (cpu) {
-				cpu->path.apic.node_id = i;
-				cpu->path.apic.core_id = j;
-				printk(BIOS_DEBUG, "CPU: %s %s\n",
-					dev_path(cpu), cpu->enabled?"enabled":"disabled");
-			}
+
+			cpu->path.apic.node_id = i;
+			cpu->path.apic.core_id = j;
+			printk(BIOS_DEBUG, "CPU: %s %s\n",
+				dev_path(cpu), cpu->enabled?"enabled":"disabled");
 		} //j
 	}
 	return max;
diff --git a/src/northbridge/amd/amdfam10/northbridge.c b/src/northbridge/amd/amdfam10/northbridge.c
index 8d654bd..4f49a0f 100644
--- a/src/northbridge/amd/amdfam10/northbridge.c
+++ b/src/northbridge/amd/amdfam10/northbridge.c
@@ -1414,24 +1414,17 @@ static u32 cpu_bus_scan(device_t dev, u32 max)
 				cpu->enabled = 0;
 			}
 
-			/* Report what I have done */
-			if (cpu) {
-				cpu->path.apic.node_id = i;
-				cpu->path.apic.core_id = j;
-	#if CONFIG_ENABLE_APIC_EXT_ID && (CONFIG_APIC_ID_OFFSET>0)
-				if(sysconf.enabled_apic_ext_id) {
-					if(sysconf.lift_bsp_apicid) {
-						cpu->path.apic.apic_id += sysconf.apicid_offset;
-					} else
-					{
-						if (cpu->path.apic.apic_id != 0)
-							cpu->path.apic.apic_id += sysconf.apicid_offset;
-					}
+#if CONFIG_ENABLE_APIC_EXT_ID && (CONFIG_APIC_ID_OFFSET>0)
+			if(sysconf.enabled_apic_ext_id) {
+				if (cpu->path.apic.apic_id != 0 || sysconf.lift_bsp_apicid) {
+					cpu->path.apic.apic_id += sysconf.apicid_offset;
 				}
-	#endif
-				printk(BIOS_DEBUG, "CPU: %s %s\n",
-					dev_path(cpu), cpu->enabled?"enabled":"disabled");
 			}
+#endif
+			cpu->path.apic.node_id = i;
+			cpu->path.apic.core_id = j;
+			printk(BIOS_DEBUG, "CPU: %s %s\n",
+				dev_path(cpu), cpu->enabled?"enabled":"disabled");
 
 		} //j
 	}
diff --git a/src/northbridge/amd/amdk8/northbridge.c b/src/northbridge/amd/amdk8/northbridge.c
index 17ea4f6..383a774 100644
--- a/src/northbridge/amd/amdk8/northbridge.c
+++ b/src/northbridge/amd/amdk8/northbridge.c
@@ -1300,23 +1300,17 @@ static u32 cpu_bus_scan(device_t dev, u32 max)
 				cpu->enabled = 0;
 			}
 
-			/* Report what I have done */
-			if (cpu) {
-				cpu->path.apic.node_id = i;
-				cpu->path.apic.core_id = j;
-				if(sysconf.enabled_apic_ext_id) {
-					if(sysconf.lift_bsp_apicid) {
-						cpu->path.apic.apic_id += sysconf.apicid_offset;
-					} else
-					{
-						if (cpu->path.apic.apic_id != 0)
-							cpu->path.apic.apic_id += sysconf.apicid_offset;
-					}
+			if(sysconf.enabled_apic_ext_id) {
+				if (cpu->path.apic.apic_id != 0 || sysconf.lift_bsp_apicid) {
+					cpu->path.apic.apic_id += sysconf.apicid_offset;
 				}
-				printk(BIOS_DEBUG, "CPU: %s %s\n",
-					dev_path(cpu), cpu->enabled?"enabled":"disabled");
 			}
 
+			cpu->path.apic.node_id = i;
+			cpu->path.apic.core_id = j;
+			printk(BIOS_DEBUG, "CPU: %s %s\n",
+				dev_path(cpu), cpu->enabled?"enabled":"disabled");
+
 		} //j
 	}
 	return max;




More information about the coreboot mailing list