coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
endian.h File Reference
#include <stddef.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for endian.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static uint8_t read_ble8 (const void *src)
 
static uint8_t read_at_ble8 (const void *src, size_t offset)
 
static void write_ble8 (void *dest, uint8_t val)
 
static void write_at_ble8 (void *dest, uint8_t val, size_t offset)
 
static uint8_t read_be8 (const void *src)
 
static uint8_t read_at_be8 (const void *src, size_t offset)
 
static void write_be8 (void *dest, uint8_t val)
 
static void write_at_be8 (void *dest, uint8_t val, size_t offset)
 
static uint16_t read_be16 (const void *src)
 
static uint16_t read_at_be16 (const void *src, size_t offset)
 
static void write_be16 (void *dest, uint16_t val)
 
static void write_at_be16 (void *dest, uint16_t val, size_t offset)
 
static uint32_t read_be32 (const void *src)
 
static uint32_t read_at_be32 (const void *src, size_t offset)
 
static void write_be32 (void *dest, uint32_t val)
 
static void write_at_be32 (void *dest, uint32_t val, size_t offset)
 
static uint64_t read_be64 (const void *src)
 
static uint64_t read_at_be64 (const void *src, size_t offset)
 
static void write_be64 (void *dest, uint64_t val)
 
static void write_at_be64 (void *dest, uint64_t val, size_t offset)
 
static uint8_t read_le8 (const void *src)
 
static uint8_t read_at_le8 (const void *src, size_t offset)
 
static void write_le8 (void *dest, uint8_t val)
 
static void write_at_le8 (void *dest, uint8_t val, size_t offset)
 
static uint16_t read_le16 (const void *src)
 
static uint16_t read_at_le16 (const void *src, size_t offset)
 
static void write_le16 (void *dest, uint16_t val)
 
static void write_at_le16 (void *dest, uint16_t val, size_t offset)
 
static uint32_t read_le32 (const void *src)
 
static uint32_t read_at_le32 (const void *src, size_t offset)
 
static void write_le32 (void *dest, uint32_t val)
 
static void write_at_le32 (void *dest, uint32_t val, size_t offset)
 
static uint64_t read_le64 (const void *src)
 
static uint64_t read_at_le64 (const void *src, size_t offset)
 
static void write_le64 (void *dest, uint64_t val)
 
static void write_at_le64 (void *dest, uint64_t val, size_t offset)
 
static void zero_n (void *dest, size_t n)
 

Function Documentation

◆ read_at_be16()

static uint16_t read_at_be16 ( const void src,
size_t  offset 
)
inlinestatic

Definition at line 65 of file endian.h.

References offset, read_be16(), and s.

Referenced by ibuf_read_be16().

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

◆ read_at_be32()

static uint32_t read_at_be32 ( const void src,
size_t  offset 
)
inlinestatic

Definition at line 92 of file endian.h.

References offset, read_be32(), and s.

Referenced by ibuf_read_be32(), read_be64(), and tis_sendrecv().

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

◆ read_at_be64()

static uint64_t read_at_be64 ( const void src,
size_t  offset 
)
inlinestatic

Definition at line 121 of file endian.h.

References offset, read_be64(), and s.

Referenced by ibuf_read_be64().

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

◆ read_at_be8()

static uint8_t read_at_be8 ( const void src,
size_t  offset 
)
inlinestatic

Definition at line 44 of file endian.h.

References offset, and read_at_ble8().

Referenced by ibuf_read_be8().

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

◆ read_at_ble8()

static uint8_t read_at_ble8 ( const void src,
size_t  offset 
)
inlinestatic

Definition at line 18 of file endian.h.

References offset, read_ble8(), and s.

Referenced by read_at_be8(), and read_at_le8().

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

◆ read_at_le16()

static uint16_t read_at_le16 ( const void src,
size_t  offset 
)
inlinestatic

Definition at line 169 of file endian.h.

References offset, read_le16(), and s.

Referenced by ibuf_read_le16().

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

◆ read_at_le32()

static uint32_t read_at_le32 ( const void src,
size_t  offset 
)
inlinestatic

Definition at line 196 of file endian.h.

References offset, read_le32(), and s.

Referenced by ibuf_read_le32(), and read_le64().

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

◆ read_at_le64()

static uint64_t read_at_le64 ( const void src,
size_t  offset 
)
inlinestatic

Definition at line 225 of file endian.h.

References offset, read_le64(), and s.

Referenced by ibuf_read_le64().

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

◆ read_at_le8()

static uint8_t read_at_le8 ( const void src,
size_t  offset 
)
inlinestatic

Definition at line 148 of file endian.h.

References offset, and read_at_ble8().

Referenced by ibuf_read_le8().

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

◆ read_be16()

static uint16_t read_be16 ( const void src)
inlinestatic

Definition at line 59 of file endian.h.

References s.

Referenced by read_at_be16().

Here is the caller graph for this function:

◆ read_be32()

static uint32_t read_be32 ( const void src)
inlinestatic

Definition at line 85 of file endian.h.

References s.

Referenced by cbfs_decode_payload_segment(), cr50_i2c_tis_recv(), last_loadable_segment(), read_at_be32(), read_be64(), and tis_vendor_read().

Here is the caller graph for this function:

◆ read_be64()

static uint64_t read_be64 ( const void src)
inlinestatic

Definition at line 112 of file endian.h.

References read_at_be32(), read_be32(), and val.

Referenced by cbfs_decode_payload_segment(), and read_at_be64().

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

◆ read_be8()

static uint8_t read_be8 ( const void src)
inlinestatic

Definition at line 39 of file endian.h.

References read_ble8().

Here is the call graph for this function:

◆ read_ble8()

static uint8_t read_ble8 ( const void src)
inlinestatic

Definition at line 12 of file endian.h.

References s.

Referenced by read_at_ble8(), read_be8(), and read_le8().

Here is the caller graph for this function:

◆ read_le16()

static uint16_t read_le16 ( const void src)
inlinestatic

Definition at line 163 of file endian.h.

References s.

Referenced by cr50_i2c_wait_burststs(), guid_compare(), read_at_le16(), relocate_fvh(), relocate_patch_table(), and te_relocate().

Here is the caller graph for this function:

◆ read_le32()

static uint32_t read_le32 ( const void src)
inlinestatic

Definition at line 189 of file endian.h.

References s.

Referenced by ffs_file_size(), fw_cfg_acpi_tables(), guid_compare(), read_at_le32(), read_le64(), relocate_fvh(), relocate_patch_table(), relocate_remaining_items(), section_data_size(), and te_relocate().

Here is the caller graph for this function:

◆ read_le64()

static uint64_t read_le64 ( const void src)
inlinestatic

Definition at line 216 of file endian.h.

References read_at_le32(), read_le32(), and val.

Referenced by fw_cfg_acpi_tables(), read_at_le64(), relocate_fvh(), and te_relocate().

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

◆ read_le8()

static uint8_t read_le8 ( const void src)
inlinestatic

Definition at line 143 of file endian.h.

References read_ble8().

Referenced by csh_size(), ffs_file_size(), relocate_fvh(), and relocate_remaining_items().

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

◆ write_at_be16()

static void write_at_be16 ( void dest,
uint16_t  val,
size_t  offset 
)
inlinestatic

Definition at line 78 of file endian.h.

References offset, val, and write_be16().

Referenced by obuf_write_be16(), and write_be32().

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

◆ write_at_be32()

static void write_at_be32 ( void dest,
uint32_t  val,
size_t  offset 
)
inlinestatic

Definition at line 105 of file endian.h.

References offset, val, and write_be32().

Referenced by obuf_write_be32(), and write_be64().

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

◆ write_at_be64()

static void write_at_be64 ( void dest,
uint64_t  val,
size_t  offset 
)
inlinestatic

Definition at line 134 of file endian.h.

References offset, val, and write_be64().

Referenced by obuf_write_be64().

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

◆ write_at_be8()

static void write_at_be8 ( void dest,
uint8_t  val,
size_t  offset 
)
inlinestatic

Definition at line 54 of file endian.h.

References offset, val, and write_at_ble8().

Referenced by obuf_write_be8(), and write_be16().

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

◆ write_at_ble8()

static void write_at_ble8 ( void dest,
uint8_t  val,
size_t  offset 
)
inlinestatic

Definition at line 30 of file endian.h.

References offset, val, and write_ble8().

Referenced by write_at_be8(), and write_at_le8().

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

◆ write_at_le16()

static void write_at_le16 ( void dest,
uint16_t  val,
size_t  offset 
)
inlinestatic

Definition at line 182 of file endian.h.

References offset, val, and write_le16().

Referenced by obuf_write_le16(), and write_le32().

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

◆ write_at_le32()

static void write_at_le32 ( void dest,
uint32_t  val,
size_t  offset 
)
inlinestatic

Definition at line 209 of file endian.h.

References offset, val, and write_le32().

Referenced by obuf_write_le32(), and write_le64().

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

◆ write_at_le64()

static void write_at_le64 ( void dest,
uint64_t  val,
size_t  offset 
)
inlinestatic

Definition at line 238 of file endian.h.

References offset, val, and write_le64().

Referenced by obuf_write_le64().

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

◆ write_at_le8()

static void write_at_le8 ( void dest,
uint8_t  val,
size_t  offset 
)
inlinestatic

Definition at line 158 of file endian.h.

References offset, val, and write_at_ble8().

Referenced by obuf_write_le8(), and write_le16().

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

◆ write_be16()

static void write_be16 ( void dest,
uint16_t  val 
)
inlinestatic

Definition at line 72 of file endian.h.

References val, write_at_be8(), and write_be8().

Referenced by i2c_dev_read_at16(), write_at_be16(), and write_be32().

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

◆ write_be32()

static void write_be32 ( void dest,
uint32_t  val 
)
inlinestatic

Definition at line 99 of file endian.h.

References val, write_at_be16(), and write_be16().

Referenced by write_at_be32(), and write_be64().

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

◆ write_be64()

static void write_be64 ( void dest,
uint64_t  val 
)
inlinestatic

Definition at line 128 of file endian.h.

References val, write_at_be32(), and write_be32().

Referenced by write_at_be64().

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

◆ write_be8()

static void write_be8 ( void dest,
uint8_t  val 
)
inlinestatic

Definition at line 49 of file endian.h.

References val, and write_ble8().

Referenced by write_be16().

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

◆ write_ble8()

static void write_ble8 ( void dest,
uint8_t  val 
)
inlinestatic

Definition at line 25 of file endian.h.

References val.

Referenced by write_at_ble8(), write_be8(), and write_le8().

Here is the caller graph for this function:

◆ write_le16()

static void write_le16 ( void dest,
uint16_t  val 
)
inlinestatic

Definition at line 176 of file endian.h.

References val, write_at_le8(), and write_le8().

Referenced by ser16(), setup_ebda(), write_at_le16(), and write_le32().

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

◆ write_le32()

static void write_le32 ( void dest,
uint32_t  val 
)
inlinestatic

Definition at line 203 of file endian.h.

References val, write_at_le16(), and write_le16().

Referenced by fw_cfg_acpi_tables(), nhlt_serialize_oem_overrides(), relocate_patch_table(), relocate_remaining_items(), ser32(), te_relocate(), write_at_le32(), and write_le64().

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

◆ write_le64()

static void write_le64 ( void dest,
uint64_t  val 
)
inlinestatic

Definition at line 232 of file endian.h.

References val, write_at_le32(), and write_le32().

Referenced by fw_cfg_acpi_tables(), te_relocate(), and write_at_le64().

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

◆ write_le8()

static void write_le8 ( void dest,
uint8_t  val 
)
inlinestatic

Definition at line 153 of file endian.h.

References val, and write_ble8().

Referenced by fw_cfg_acpi_tables(), nhlt_serialize_oem_overrides(), ser8(), and write_le16().

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

◆ zero_n()

static void zero_n ( void dest,
size_t  n 
)
inlinestatic

Definition at line 245 of file endian.h.

References memset().

Referenced by setup_ebda().

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