biospcichipset

How to read a byte of the Serial Presence Detect (SPD) data from the DIMM after 255(FF) bytes?


I have got SMBus Base Address Register, and program the SMBus Transmit Slave Address Register with the DIMM SMBus address, SMBBASE 04h.

Then program the SMBus Host Command Register with the DIMM’s SPD data offset to be read, SMBBASE 03h.

But the Host Command Register (HCMD)—Offset 3h is Size: 8 bits(255/FF),

So How can I read the after 255 bytes?

For example: DDR4 Serial Presence Detect (SPD) Table:

Byte 320 : Module Manufacturer ID Code

I need to read Byte 320.

My code like this

unsigned ReadByte(unsigned SMBase_addr,unsigned i)   
{
    unsigned val;   

    outportb(SMBase_addr,0x1e);   

    outportb(SMBase_addr 0x04,0xa7);   

    outportb(SMBase_addr 0x03,i);   

    outportb(SMBase_addr 0x02,0x48);   

    while((inportb(SMBase_addr))&0x01){   
        delay(10);   
    }   

    val=inportb(SMBase_addr 0x05);   

    return val;   
} 
for(i=0;i<383;i )
{
   data=ReadByte(SMBase_addr,i);
   printf("%4x",data);   
}  

and I change outportb(SMBase_addr 0x03,i);

to

outportw(SMBase_addr 0x03,i); Host Status Register return 0x44, Device Error (DERR).


Solution

  • Trying to read DDR4 SPD? They have 2 pages of 256 bytes each, and you need a dummy write to a special predefined address 0x6E to switch all SPD chips to page 1 (where your byte 320 is located), and than write to 0x6C switch them back to page 0 (to prevent an SPD read failure during next boot). Read this datasheet on page 12 for more info.