On Wed, Aug 15, 2007 at 04:16:39PM +0200, Ingmar Schraub wrote:
Please have a look at the attached patch.
Thanks!
- unsigned char wrbuf[] = { 0x00, 0xbf, 0xf7, 0x10, 0x02, 0x80, 0xff, 0x22};
..
- lseek64(fd_msr, (off64_t)addr, SEEK_SET);
- read(fd_msr, buf, 8);
- close(fd_msr);
Do you know if it's neccessary to close and reopen?
- fd_msr = open("/dev/cpu/0/msr", O_WRONLY);
- lseek64(fd_msr, (off64_t)addr, SEEK_SET);
- write(fd_msr, wrbuf, 8);
I thought about this. I don't think we should blindly overwrite the entire MSR. The only thing we really want to do is change the MSB of this MSR (ROMRP, ROM Region Properties) by clearing bit 2 and setting either bit 1 or bit 0. (0x22 on OLPC wiki sets bit 1 but bit 0 makes more sense to me, looking at the databook. Anyway, whatever works. :)
- if (memcmp(buf, wrbuf, 8))
return -1;
Verify is good! Maybe print a success message with the current setting before returning too?
//Peter