1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

Use MSR abstraction in all board enables

This was forgotten in flashrom svn r677 where some handcrafted MSR accesses
were still found in board-specific code.

Corresponding to flashrom svn r683.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
This commit is contained in:
Stefan Reinauer 2009-08-12 18:25:24 +00:00 committed by Stefan Reinauer
parent 4eeb713ed2
commit b4fe6648d1

View File

@ -495,51 +495,29 @@ static int board_artecgroup_dbe6x(const char *name)
#define DBE6x_BOOT_LOC_FLASH (2) #define DBE6x_BOOT_LOC_FLASH (2)
#define DBE6x_BOOT_LOC_FWHUB (3) #define DBE6x_BOOT_LOC_FWHUB (3)
unsigned long msr[2]; msr_t msr;
int msr_fd;
unsigned long boot_loc; unsigned long boot_loc;
msr_fd = open("/dev/cpu/0/msr", O_RDWR); /* Geode only has a single core */
if (msr_fd == -1) { if (setup_cpu_msr(0))
perror("open /dev/cpu/0/msr");
return -1; return -1;
}
if (lseek(msr_fd, DBE6x_MSR_DIVIL_BALL_OPTS, SEEK_SET) == -1) { msr = rdmsr(DBE6x_MSR_DIVIL_BALL_OPTS);
perror("lseek");
close(msr_fd);
return -1;
}
if (read(msr_fd, (void *)msr, 8) != 8) { if ((msr.lo & (DBE6x_BOOT_OP_LATCHED)) ==
perror("read");
close(msr_fd);
return -1;
}
if ((msr[0] & (DBE6x_BOOT_OP_LATCHED)) ==
(DBE6x_BOOT_LOC_FWHUB << DBE6x_BOOT_OP_LATCHED_SHIFT)) (DBE6x_BOOT_LOC_FWHUB << DBE6x_BOOT_OP_LATCHED_SHIFT))
boot_loc = DBE6x_BOOT_LOC_FWHUB; boot_loc = DBE6x_BOOT_LOC_FWHUB;
else else
boot_loc = DBE6x_BOOT_LOC_FLASH; boot_loc = DBE6x_BOOT_LOC_FLASH;
msr[0] &= ~(DBE6x_PRI_BOOT_LOC | DBE6x_SEC_BOOT_LOC); msr.lo &= ~(DBE6x_PRI_BOOT_LOC | DBE6x_SEC_BOOT_LOC);
msr[0] |= ((boot_loc << DBE6x_PRI_BOOT_LOC_SHIFT) | msr.lo |= ((boot_loc << DBE6x_PRI_BOOT_LOC_SHIFT) |
(boot_loc << DBE6x_SEC_BOOT_LOC_SHIFT)); (boot_loc << DBE6x_SEC_BOOT_LOC_SHIFT));
if (lseek(msr_fd, DBE6x_MSR_DIVIL_BALL_OPTS, SEEK_SET) == -1) { wrmsr(DBE6x_MSR_DIVIL_BALL_OPTS, msr);
perror("lseek");
close(msr_fd);
return -1;
}
if (write(msr_fd, (void *)msr, 8) != 8) { cleanup_cpu_msr();
perror("write");
close(msr_fd);
return -1;
}
close(msr_fd);
return 0; return 0;
} }