coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
smbus_spd.c File Reference
#include <device/pci_def.h>
#include <device/device.h>
#include <stddef.h>
#include <OEM.h>
#include <vendorcode/amd/include/Porting.h>
#include <AGESA.h>
#include "chip.h"
#include "smbus_spd.h"
#include <northbridge/amd/agesa/dimmSpd.h>
Include dependency graph for smbus_spd.c:

Go to the source code of this file.

Functions

static UINT8 readSmbusByte (UINT16 iobase, UINT8 address, char *buffer, int offset, int initial_offset)
 Read a single SPD byte. More...
 
static void writePmReg (UINT8 reg, UINT8 data)
 
static void setupFch (UINT16 ioBase)
 
static UINT8 readspd (UINT16 iobase, UINT8 SmbusSlaveAddress, char *buffer, UINT16 count)
 Read one or more SPD bytes from a DIMM. More...
 
int smbus_readSpd (int spdAddress, char *buf, size_t len)
 

Function Documentation

◆ readSmbusByte()

static UINT8 readSmbusByte ( UINT16  iobase,
UINT8  address,
char *  buffer,
int  offset,
int  initial_offset 
)
static

Read a single SPD byte.

If the first byte is being read, set up the address and offset. Following bytes auto increment.

Definition at line 23 of file smbus_spd.c.

References address, AGESA_ERROR, AGESA_SUCCESS, buffer, HOSTBUSY_MASK, MAX_READ_TSC_COUNT, offset, READ_BIT, SMBUS_COMMAND_REG, SMBUS_CONTROL_REG, SMBUS_DATA0_REG, SMBUS_HOST_CMD_REG, SMBUS_INTERRUPT_MASK, SMBUS_READ_BYTE_COMMAND, SMBUS_READ_COMMAND, SMBUS_SLAVE_STATUS_REG, SMBUS_STATUS_REG, and STATUS__COMPLETED_SUCCESSFULLY.

Referenced by readspd().

Here is the caller graph for this function:

◆ readspd()

static UINT8 readspd ( UINT16  iobase,
UINT8  SmbusSlaveAddress,
char *  buffer,
UINT16  count 
)
static

Read one or more SPD bytes from a DIMM.

Start with offset zero and read sequentially. Reads 128 bytes in 7-8 ms at 400 KHz.

Definition at line 82 of file smbus_spd.c.

References AGESA_SUCCESS, buffer, count, readSmbusByte(), and setupFch().

Referenced by smbus_readSpd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupFch()

static void setupFch ( UINT16  ioBase)
static

Definition at line 66 of file smbus_spd.c.

References SMBUS_BAR_HIGH_BYTE, SMBUS_BAR_LOW_BYTE, SMBUS_CLOCK_REG, SMBUS_FREQUENCY_CONST, and writePmReg().

Referenced by readspd(), and smbus_readSpd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ smbus_readSpd()

int smbus_readSpd ( int  spdAddress,
char *  buf,
size_t  len 
)

Definition at line 101 of file smbus_spd.c.

References buf, readspd(), and setupFch().

Referenced by AmdMemoryReadSPD(), and sema_send_alive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writePmReg()

static void writePmReg ( UINT8  reg,
UINT8  data 
)
static

Definition at line 60 of file smbus_spd.c.

References PMIO_DATA_REG, and PMIO_INDEX_REG.

Referenced by setupFch().

Here is the caller graph for this function: