msrtool: Allow MSR symbols (names) to also be used as addresses.

Thanks for the idea Mart!

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3921 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Peter Stuge
2009-01-26 17:18:31 +00:00
parent c1d6ed9a21
commit 3108a12e9b
3 changed files with 19 additions and 2 deletions

View File

@ -137,6 +137,22 @@ const struct msrdef *findmsrdef(const uint32_t addr) {
return NULL;
}
const uint32_t msraddrbyname(const char *name) {
uint8_t t;
const uint32_t addr = strtoul(name, NULL, 16);
const struct msrdef *m;
if (!targets)
return 0;
for (t = 0; t < targets_found; t++)
for (m = targets[t]->msrs; !MSR_ISEOT(*m); m++) {
if (addr == m->addr)
return m->addr;
if (!strcasecmp(name, m->symbol))
return m->addr;
}
return 0;
}
void dumpmsrdefs(const struct targetdef *t) {
const struct msrdef *m;
const struct msrbits *mb;