msrtool: Factor out cpuid() from target probe functions into main()

Almost all probe functions called cpuid(). Those calls are replaced
by a single cpuid() call in main() and a new parameter to the target
probe functions with the cpuid() result.

The vendor_t and struct cpuid_t definitions are moved closer to the
top of msrtool.h and the vendor_t enum is reformatted to simplify
addition of further values.

Change-Id: Icd615636207499cfa46b8b99bf819ef8ca2d97c0
Signed-off-by: Anton Kochkov <anton.kochkov@gmail.com>
Signed-off-by: Peter Stuge <peter@stuge.se>
Reviewed-on: http://review.coreboot.org/1259
Tested-by: build bot (Jenkins)
This commit is contained in:
Anton Kochkov
2012-07-21 07:29:48 +04:00
committed by Peter Stuge
parent c7fc4422a0
commit 59b36f1026
14 changed files with 41 additions and 49 deletions

View File

@ -270,6 +270,7 @@ int main(int argc, char *argv[]) {
int ret = 1;
const struct sysdef *s;
const struct targetdef *t;
const struct cpuid_t *id = cpuid();
uint8_t tn, listmsrs = 0, listknown = 0, input = 0;
uint32_t addr = 0;
const char *streamfn = NULL, *difffn = NULL;
@ -357,7 +358,7 @@ int main(int argc, char *argv[]) {
else
for (t = alltargets; !TARGET_ISEOT(*t); t++) {
printf_verbose("Probing for target %s: %s\n", t->name, t->prettyname);
if (!t->probe(t))
if (!t->probe(t, id))
continue;
printf_quiet("Detected target %s: %s\n", t->name, t->prettyname);
add_target(t);