[coreboot] New patch to review for coreboot: 231c8fa Factor out function to find driver for a CPU
Stefan Reinauer (stefan.reinauer@coreboot.org)
gerrit at coreboot.org
Thu Apr 5 21:24:01 CEST 2012
Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/868
-gerrit
commit 231c8fae7b5da973f70d9769e6076ea1885bc3e7
Author: Stefan Reinauer <reinauer at chromium.org>
Date: Tue Apr 3 16:07:56 2012 -0700
Factor out function to find driver for a CPU
This function can be used outside of the normal CPU setup
Change-Id: I810c63b8aff868a6f69d5b992bea1cfae5a5996b
Signed-off-by: Duncan Laurie <dlaurie at google.com>
Signed-off-by: Stefan Reinauer <reinauer at google.com>
---
src/arch/x86/lib/cpu.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/arch/x86/lib/cpu.c b/src/arch/x86/lib/cpu.c
index fac523f..98ede06 100644
--- a/src/arch/x86/lib/cpu.c
+++ b/src/arch/x86/lib/cpu.c
@@ -211,23 +211,27 @@ static void identify_cpu(struct device *cpu)
}
}
-static void set_cpu_ops(struct device *cpu)
+struct cpu_driver *find_cpu_driver(struct device *cpu)
{
struct cpu_driver *driver;
- cpu->ops = 0;
for (driver = cpu_drivers; driver < ecpu_drivers; driver++) {
struct cpu_device_id *id;
- for(id = driver->id_table; id->vendor != X86_VENDOR_INVALID; id++) {
+ for (id = driver->id_table;
+ id->vendor != X86_VENDOR_INVALID; id++) {
if ((cpu->vendor == id->vendor) &&
(cpu->device == id->device))
{
- goto found;
+ return driver;
}
}
}
- return;
-found:
- cpu->ops = driver->ops;
+ return NULL;
+}
+
+static void set_cpu_ops(struct device *cpu)
+{
+ struct cpu_driver *driver = find_cpu_driver(cpu);
+ cpu->ops = driver ? driver->ops : NULL;
}
void cpu_initialize(void)
More information about the coreboot
mailing list