coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
reg_access.c File Reference
#include <arch/io.h>
#include <assert.h>
#include <cpu/x86/mtrr.h>
#include <cpu/x86/cr.h>
#include <console/console.h>
#include <delay.h>
#include <device/pci_ops.h>
#include <soc/pci_devs.h>
#include <soc/ramstage.h>
#include <soc/reg_access.h>
Include dependency graph for reg_access.c:

Go to the source code of this file.

Macros

#define __SIMPLE_DEVICE__
 

Functions

static uint16_t get_gpe0_address (uint32_t reg_address)
 
static uint32_tget_gpio_address (uint32_t reg_address)
 
voidget_i2c_address (void)
 
static uint16_t get_legacy_gpio_address (uint32_t reg_address)
 
static uint32_t mtrr_index_to_host_bridge_register_offset (unsigned long index)
 
void mcr_write (uint8_t opcode, uint8_t port, uint32_t reg_address)
 
uint32_t mdr_read (void)
 
void mdr_write (uint32_t value)
 
void mea_write (uint32_t reg_address)
 
uint32_t port_reg_read (uint8_t port, uint32_t offset)
 
void port_reg_write (uint8_t port, uint32_t offset, uint32_t value)
 
static CRx_TYPE reg_cpu_cr_read (uint32_t reg_address)
 
static void reg_cpu_cr_write (uint32_t reg_address, CRx_TYPE value)
 
static uint32_t reg_gpe0_read (uint32_t reg_address)
 
static void reg_gpe0_write (uint32_t reg_address, uint32_t value)
 
static uint32_t reg_gpio_read (uint32_t reg_address)
 
static void reg_gpio_write (uint32_t reg_address, uint32_t value)
 
uint32_t reg_host_bridge_unit_read (uint32_t reg_address)
 
static void reg_host_bridge_unit_write (uint32_t reg_address, uint32_t value)
 
uint32_t reg_legacy_gpio_read (uint32_t reg_address)
 
void reg_legacy_gpio_write (uint32_t reg_address, uint32_t value)
 
static uint32_t reg_pcie_afe_read (uint32_t reg_address)
 
static void reg_pcie_afe_write (uint32_t reg_address, uint32_t value)
 
uint32_t reg_rmu_temp_read (uint32_t reg_address)
 
static void reg_rmu_temp_write (uint32_t reg_address, uint32_t value)
 
static uint32_t reg_soc_unit_read (uint32_t reg_address)
 
static void reg_soc_unit_write (uint32_t reg_address, uint32_t value)
 
static uint32_t reg_usb_read (uint32_t reg_address)
 
static void reg_usb_write (uint32_t reg_address, uint32_t value)
 
static uint64_t reg_read (struct reg_script_context *ctx)
 
static void reg_write (struct reg_script_context *ctx)
 
msr_t soc_msr_read (unsigned int index)
 
void soc_msr_write (unsigned int index, msr_t msr)
 
 REG_SCRIPT_BUS_ENTRY (soc_reg_script_bus_table)
 

Variables

const struct reg_script_bus_entry soc_reg_script_bus_table
 

Macro Definition Documentation

◆ __SIMPLE_DEVICE__

#define __SIMPLE_DEVICE__

Definition at line 3 of file reg_access.c.

Function Documentation

◆ get_gpe0_address()

static uint16_t get_gpe0_address ( uint32_t  reg_address)
static

Definition at line 16 of file reg_access.c.

References ASSERT, B_QNC_LPC_GPE0BLK_MASK, LPC_BDF, pci_read_config32(), and R_QNC_LPC_GPE0BLK.

Referenced by reg_gpe0_read(), and reg_gpe0_write().

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

◆ get_gpio_address()

static uint32_t* get_gpio_address ( uint32_t  reg_address)
static

Definition at line 29 of file reg_access.c.

References ASSERT, I2CGPIO_BDF, PCI_BASE_ADDRESS_1, PCI_BASE_ADDRESS_MEM_ATTR_MASK, and pci_read_config32().

Referenced by reg_gpio_read(), and reg_gpio_write().

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

◆ get_i2c_address()

void* get_i2c_address ( void  )

Definition at line 42 of file reg_access.c.

References ASSERT, I2CGPIO_BDF, PCI_BASE_ADDRESS_0, PCI_BASE_ADDRESS_MEM_ATTR_MASK, and pci_read_config32().

Referenced by platform_i2c_read(), platform_i2c_transfer(), and platform_i2c_write().

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

◆ get_legacy_gpio_address()

static uint16_t get_legacy_gpio_address ( uint32_t  reg_address)
static

Definition at line 55 of file reg_access.c.

References ASSERT, B_QNC_LPC_GPA_BASE_MASK, LPC_BDF, pci_read_config32(), and R_QNC_LPC_GBA_BASE.

Referenced by reg_legacy_gpio_read(), and reg_legacy_gpio_write().

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

◆ mcr_write()

◆ mdr_read()

uint32_t mdr_read ( void  )

Definition at line 104 of file reg_access.c.

References MC_BDF, pci_read_config32(), and QNC_ACCESS_PORT_MDR.

Referenced by fuse_port_read(), memory_cntrl_read(), port_reg_read(), reg_host_bridge_unit_read(), reg_pcie_afe_read(), reg_rmu_temp_read(), reg_soc_unit_read(), and reg_usb_read().

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

◆ mdr_write()

void mdr_write ( uint32_t  value)

Definition at line 109 of file reg_access.c.

References MC_BDF, pci_write_config32(), QNC_ACCESS_PORT_MDR, and value.

Referenced by port_reg_write(), reg_host_bridge_unit_write(), reg_pcie_afe_write(), reg_rmu_temp_write(), reg_soc_unit_write(), and reg_usb_write().

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

◆ mea_write()

◆ mtrr_index_to_host_bridge_register_offset()

◆ port_reg_read()

uint32_t port_reg_read ( uint8_t  port,
uint32_t  offset 
)

Definition at line 120 of file reg_access.c.

References mcr_write(), mdr_read(), mea_write(), offset, and QUARK_OPCODE_READ.

Referenced by disable_rom_shadow(), and soc_msr_read().

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

◆ port_reg_write()

void port_reg_write ( uint8_t  port,
uint32_t  offset,
uint32_t  value 
)

Definition at line 128 of file reg_access.c.

References mcr_write(), mdr_write(), mea_write(), offset, QUARK_OPCODE_WRITE, and value.

Referenced by disable_rom_shadow(), and soc_msr_write().

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

◆ reg_cpu_cr_read()

static CRx_TYPE reg_cpu_cr_read ( uint32_t  reg_address)
static

Definition at line 136 of file reg_access.c.

References die(), read_cr0(), and read_cr4().

Referenced by reg_read().

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

◆ reg_cpu_cr_write()

static void reg_cpu_cr_write ( uint32_t  reg_address,
CRx_TYPE  value 
)
static

Definition at line 149 of file reg_access.c.

References die(), value, write_cr0(), and write_cr4().

Referenced by reg_write().

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

◆ reg_gpe0_read()

static uint32_t reg_gpe0_read ( uint32_t  reg_address)
static

Definition at line 166 of file reg_access.c.

References get_gpe0_address(), and inl().

Referenced by reg_read().

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

◆ reg_gpe0_write()

static void reg_gpe0_write ( uint32_t  reg_address,
uint32_t  value 
)
static

Definition at line 172 of file reg_access.c.

References get_gpe0_address(), outl(), and value.

Referenced by reg_write().

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

◆ reg_gpio_read()

static uint32_t reg_gpio_read ( uint32_t  reg_address)
static

Definition at line 178 of file reg_access.c.

References get_gpio_address().

Referenced by reg_read().

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

◆ reg_gpio_write()

static void reg_gpio_write ( uint32_t  reg_address,
uint32_t  value 
)
static

Definition at line 184 of file reg_access.c.

References get_gpio_address(), and value.

Referenced by reg_write().

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

◆ reg_host_bridge_unit_read()

uint32_t reg_host_bridge_unit_read ( uint32_t  reg_address)

Definition at line 190 of file reg_access.c.

References mcr_write(), mdr_read(), mea_write(), QUARK_NC_HOST_BRIDGE_SB_PORT_ID, and QUARK_OPCODE_READ.

Referenced by reg_read().

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

◆ reg_host_bridge_unit_write()

static void reg_host_bridge_unit_write ( uint32_t  reg_address,
uint32_t  value 
)
static

Definition at line 199 of file reg_access.c.

References mcr_write(), mdr_write(), mea_write(), QUARK_NC_HOST_BRIDGE_SB_PORT_ID, QUARK_OPCODE_WRITE, and value.

Referenced by reg_write().

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

◆ reg_legacy_gpio_read()

uint32_t reg_legacy_gpio_read ( uint32_t  reg_address)

Definition at line 208 of file reg_access.c.

References get_legacy_gpio_address(), and inl().

Referenced by car_mainboard_pre_console_init(), mainboard_gpio_i2c_init(), mainboard_gpio_pcie_reset(), reg_read(), vboot_platform_prepare_reboot(), and verstage_mainboard_init().

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

◆ reg_legacy_gpio_write()

void reg_legacy_gpio_write ( uint32_t  reg_address,
uint32_t  value 
)

Definition at line 214 of file reg_access.c.

References get_legacy_gpio_address(), outl(), and value.

Referenced by mainboard_gpio_pcie_reset(), and reg_write().

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

◆ reg_pcie_afe_read()

static uint32_t reg_pcie_afe_read ( uint32_t  reg_address)
static

Definition at line 220 of file reg_access.c.

References mcr_write(), mdr_read(), mea_write(), QUARK_OPCODE_IO_READ, and QUARK_SC_PCIE_AFE_SB_PORT_ID.

Referenced by reg_read().

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

◆ reg_pcie_afe_write()

static void reg_pcie_afe_write ( uint32_t  reg_address,
uint32_t  value 
)
static

Definition at line 229 of file reg_access.c.

References mcr_write(), mdr_write(), mea_write(), QUARK_OPCODE_IO_WRITE, QUARK_SC_PCIE_AFE_SB_PORT_ID, and value.

Referenced by reg_write().

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

◆ reg_read()

◆ reg_rmu_temp_read()

uint32_t reg_rmu_temp_read ( uint32_t  reg_address)

Definition at line 238 of file reg_access.c.

References mcr_write(), mdr_read(), mea_write(), QUARK_NC_RMU_SB_PORT_ID, and QUARK_OPCODE_READ.

Referenced by chip_init(), and reg_read().

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

◆ reg_rmu_temp_write()

static void reg_rmu_temp_write ( uint32_t  reg_address,
uint32_t  value 
)
static

Definition at line 246 of file reg_access.c.

References mcr_write(), mdr_write(), mea_write(), QUARK_NC_RMU_SB_PORT_ID, QUARK_OPCODE_WRITE, and value.

Referenced by reg_write().

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

◆ REG_SCRIPT_BUS_ENTRY()

REG_SCRIPT_BUS_ENTRY ( soc_reg_script_bus_table  )

◆ reg_soc_unit_read()

static uint32_t reg_soc_unit_read ( uint32_t  reg_address)
static

Definition at line 254 of file reg_access.c.

References mcr_write(), mdr_read(), mea_write(), QUARK_ALT_OPCODE_READ, and QUARK_SCSS_SOC_UNIT_SB_PORT_ID.

Referenced by reg_read().

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

◆ reg_soc_unit_write()

static void reg_soc_unit_write ( uint32_t  reg_address,
uint32_t  value 
)
static

Definition at line 263 of file reg_access.c.

References mcr_write(), mdr_write(), mea_write(), QUARK_ALT_OPCODE_WRITE, QUARK_SCSS_SOC_UNIT_SB_PORT_ID, and value.

Referenced by reg_write().

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

◆ reg_usb_read()

static uint32_t reg_usb_read ( uint32_t  reg_address)
static

Definition at line 272 of file reg_access.c.

References mcr_write(), mdr_read(), mea_write(), QUARK_ALT_OPCODE_READ, and QUARK_SC_USB_AFE_SB_PORT_ID.

Referenced by reg_read().

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

◆ reg_usb_write()

static void reg_usb_write ( uint32_t  reg_address,
uint32_t  value 
)
static

Definition at line 281 of file reg_access.c.

References mcr_write(), mdr_write(), mea_write(), QUARK_ALT_OPCODE_WRITE, QUARK_SC_USB_AFE_SB_PORT_ID, and value.

Referenced by reg_write().

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

◆ reg_write()

◆ soc_msr_read()

msr_t soc_msr_read ( unsigned int  index)

Definition at line 430 of file reg_access.c.

References mtrr_index_to_host_bridge_register_offset(), offset, port_reg_read(), QUARK_NC_HOST_BRIDGE_MTRR_FIX4K_F8000, QUARK_NC_HOST_BRIDGE_MTRR_FIX64K_00000, QUARK_NC_HOST_BRIDGE_SB_PORT_ID, and value.

Referenced by soc_enable_mtrrs().

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

◆ soc_msr_write()

void soc_msr_write ( unsigned int  index,
msr_t  msr 
)

Definition at line 452 of file reg_access.c.

References mtrr_index_to_host_bridge_register_offset(), offset, port_reg_write(), QUARK_NC_HOST_BRIDGE_MTRR_FIX4K_F8000, QUARK_NC_HOST_BRIDGE_MTRR_FIX64K_00000, QUARK_NC_HOST_BRIDGE_SB_PORT_ID, and value.

Referenced by soc_enable_mtrrs(), and soc_set_mtrrs().

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

Variable Documentation

◆ soc_reg_script_bus_table

const struct reg_script_bus_entry soc_reg_script_bus_table
Initial value:
= {
}
@ SOC_TYPE
Definition: reg_access.h:28
static uint64_t reg_read(struct reg_script_context *ctx)
Definition: reg_access.c:290
static void reg_write(struct reg_script_context *ctx)
Definition: reg_access.c:351

Definition at line 452 of file reg_access.c.