Hi, I have a main board with cs5536, and need to write the bios. During the pci devices scaning, I can found cs5536, and the device number is 9. So I use following codes to read and write MSR to configure CS5536. However, I found that I can successfully read the MSR content, but when I write the same content to the same MSR, the I/O error was happened after writing the low data to 0xf8. Then I try to write the high data first and then write the low data, I found that writing the high data will not trigger I/O error, only writing low data will trigger I/O error. Is there something else I forgot to initialize before writing MSR? and what do I do something wrong? Thank you!
#define CS5536_SB_MSR_BASE (0x00000000)
pci_write(CS5536_PCI_CONF_BASE+0xf4, CS5536_SB_MSR_BASE | 0x10) ; // OK pci_read(CS5536_PCI_CONF_BASE+0xf8, &low ) ; // OK low =00000003h pci_read(CS5536_PCI_CONF_BASE+0xfc, &hi ) ; // OK hi = 44000030h
pci_write(CS5536_PCI_CONF_BASE+0xf4, CS5536_SB_MSR_BASE | 0x10) ; // OK pci_write(CS5536_PCI_CONF_BASE+0xf8, low ) ; // I/O Error, Why? pci_write(CS5536_PCI_CONF_BASE+0xfc, hi ) ; // I/O Error, Why?
Q: Is there something else I forgot to initialize before writing MSR? and what do I do something wrong?
Hello,
Li Gen wrote:
I have a main board with cs5536,
Which CPU does it have?
and need to write the bios.
I would suggest that you use coreboot as firmware. If you require a legacy BIOS environment then you can use coreboot together with SeaBIOS. It works very well.
I use following codes to read and write MSR to configure CS5536.
Reading and writing MSRs must be done with the instructions rdmsr and wrmsr.
pci_write(CS5536_PCI_CONF_BASE+0xf4, CS5536_SB_MSR_BASE | 0x10) ; // OK pci_read(CS5536_PCI_CONF_BASE+0xf8, &low ) ; // OK low =00000003h pci_read(CS5536_PCI_CONF_BASE+0xfc, &hi ) ; // OK hi = 44000030h
Whenever you are accessing PCI config space registers, keep in mind that each access is always two operations. First write the 32-bit PCI config space register address to 0xcf8, then read or write 32-bit data to 0xcfc.
Also note that if you are not using coreboot then you may not get a lot of help here, since this mailing list is focused on coreboot. :)
//Peter