coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
bdk-coreboot.c File Reference
#include <string.h>
#include <assert.h>
#include <device/i2c.h>
#include <device/i2c_simple.h>
#include <endian.h>
#include <soc/timer.h>
#include <libbdk-arch/bdk-numa.h>
#include <libbdk-hal/bdk-config.h>
#include <libbdk-hal/bdk-twsi.h>
#include <libbdk-boot/bdk-watchdog.h>
Include dependency graph for bdk-coreboot.c:

Go to the source code of this file.

Functions

int64_t bdk_twsix_read_ia (bdk_node_t node, int twsi_id, uint8_t dev_addr, uint16_t internal_addr, int num_bytes, int ia_width_bytes)
 Do a twsi read from a 7 bit device address using an (optional) internal address. More...
 
int bdk_twsix_write_ia (bdk_node_t node, int twsi_id, uint8_t dev_addr, uint16_t internal_addr, int num_bytes, int ia_width_bytes, uint64_t data)
 Write 1-8 bytes to a TWSI device using an internal address. More...
 
void bdk_watchdog_set (unsigned int timeout_ms)
 
void bdk_watchdog_poke (void)
 
void bdk_watchdog_disable (void)
 
int bdk_watchdog_is_running (void)
 

Function Documentation

◆ bdk_twsix_read_ia()

int64_t bdk_twsix_read_ia ( bdk_node_t  node,
int  twsi_id,
uint8_t  dev_addr,
uint16_t  internal_addr,
int  num_bytes,
int  ia_width_bytes 
)

Do a twsi read from a 7 bit device address using an (optional) internal address.

Up to 4 bytes can be read at a time.

Parameters
twsi_idwhich TWSI bus to use
dev_addrDevice address (7 bit)
internal_addrInternal address. Can be 0, 1 or 2 bytes in width
num_bytesNumber of data bytes to read (1-4)
ia_width_bytesInternal address size in bytes (0, 1, or 2)
Returns
Read data, or -1 on failure

Definition at line 35 of file bdk-coreboot.c.

References ARRAY_SIZE, assert, i2c_msg::buf, buf, i2c_msg::flags, I2C_M_RD, i2c_transfer(), i2c_msg::len, and i2c_msg::slave.

Here is the call graph for this function:

◆ bdk_twsix_write_ia()

int bdk_twsix_write_ia ( bdk_node_t  node,
int  twsi_id,
uint8_t  dev_addr,
uint16_t  internal_addr,
int  num_bytes,
int  ia_width_bytes,
uint64_t  data 
)

Write 1-8 bytes to a TWSI device using an internal address.

Parameters
twsi_idwhich TWSI interface to use
dev_addrTWSI device address (7 bit only)
internal_addrTWSI internal address (0, 8, or 16 bits)
num_bytesNumber of bytes to write (1-8)
ia_width_bytesinternal address width, in bytes (0, 1, 2)
dataData to write. Data is written MSB first on the twsi bus, and only the lower num_bytes bytes of the argument are valid. If a 2 byte write is done, only the low 2 bytes of the argument is used.
Returns
Zero on success, -1 on error

Definition at line 77 of file bdk-coreboot.c.

References assert, i2c_msg::buf, buf, i2c_msg::flags, i2c_msg::len, memcpy(), platform_i2c_transfer(), and i2c_msg::slave.

Referenced by mainboard_enable().

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

◆ bdk_watchdog_disable()

void bdk_watchdog_disable ( void  )

Definition at line 108 of file bdk-coreboot.c.

References watchdog_disable().

Here is the call graph for this function:

◆ bdk_watchdog_is_running()

int bdk_watchdog_is_running ( void  )

Definition at line 113 of file bdk-coreboot.c.

References watchdog_is_running().

Here is the call graph for this function:

◆ bdk_watchdog_poke()

void bdk_watchdog_poke ( void  )

Definition at line 103 of file bdk-coreboot.c.

References watchdog_poke().

Here is the call graph for this function:

◆ bdk_watchdog_set()

void bdk_watchdog_set ( unsigned int  timeout_ms)

Definition at line 98 of file bdk-coreboot.c.

References watchdog_set().

Here is the call graph for this function: