coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
lpc_util.c File Reference
#include <assert.h>
#include <stdint.h>
#include <device/device.h>
#include <device/pci_ops.h>
#include <device/pci_def.h>
#include <amdblocks/acpimmio.h>
#include <amdblocks/lpc.h>
#include <soc/iomap.h>
#include <soc/lpc.h>
#include <soc/southbridge.h>
Include dependency graph for lpc_util.c:

Go to the source code of this file.

Data Structures

struct  wide_io_ioport_and_bits
 

Macros

#define _LPCB_DEV   pcidev_on_root(0x14, 0x3)
 

Functions

uint16_t lpc_wideio_size (int index)
 Find the size of a particular wide IO. More...
 
int lpc_find_wideio_range (uint16_t start, uint16_t size)
 Identify if any LPC wide IO is covering the IO range. More...
 
int lpc_set_wideio_range (uint16_t start, uint16_t size)
 Program a LPC wide IO to support an IO range. More...
 
void lpc_enable_port80 (void)
 
void lpc_enable_sio_decode (const bool addr)
 
void lpc_enable_decode (uint32_t decodes)
 
void lpc_disable_decodes (void)
 
uintptr_t lpc_spibase (void)
 
void lpc_tpm_decode (void)
 
void lpc_tpm_decode_spi (void)
 
void lpc_enable_rom (void)
 
void lpc_enable_spi_prefetch (void)
 
void lpc_disable_spi_rom_sharing (void)
 
uintptr_t lpc_get_spibase (void)
 
void lpc_set_spibase (uint32_t base)
 
void lpc_enable_spi_rom (uint32_t enable)
 
static void lpc_enable_controller (void)
 
void lpc_early_init (void)
 

Variables

static const struct wide_io_ioport_and_bits wio_io_en []
 

Macro Definition Documentation

◆ _LPCB_DEV

#define _LPCB_DEV   pcidev_on_root(0x14, 0x3)

Definition at line 16 of file lpc_util.c.

Function Documentation

◆ lpc_disable_decodes()

void lpc_disable_decodes ( void  )

Definition at line 169 of file lpc_util.c.

References _LPCB_DEV, lpc_enable_decode(), LPC_IO_OR_MEM_DECODE_ENABLE, LPC_IO_PORT_DECODE_ENABLE, LPC_MEM_PORT0, LPC_MEM_PORT1, LPC_SYNC_TIMEOUT_COUNT_ENABLE, LPC_SYNC_TIMEOUT_COUNT_MASK, LPC_WIDEIO2_GENERIC_PORT, pci_read_config32(), and pci_write_config32().

Referenced by lpc_early_init().

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

◆ lpc_disable_spi_rom_sharing()

void lpc_disable_spi_rom_sharing ( void  )

Definition at line 296 of file lpc_util.c.

References _LPCB_DEV, CONFIG, dead_code, EXT_ROM_SHARING_EN, LPC_PCI_CONTROL, pci_read_config8(), pci_write_config8(), and VW_ROM_SHARING_EN.

Referenced by fch_early_init().

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

◆ lpc_early_init()

void lpc_early_init ( void  )

Definition at line 355 of file lpc_util.c.

References lpc_disable_decodes(), lpc_enable_controller(), lpc_set_spibase(), and SPI_BASE_ADDRESS.

Referenced by fch_pre_init().

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

◆ lpc_enable_controller()

static void lpc_enable_controller ( void  )
static

Definition at line 345 of file lpc_util.c.

References pm_io_read8(), pm_io_write8(), PM_LPC_ENABLE, and PM_LPC_GATING.

Referenced by lpc_early_init().

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

◆ lpc_enable_decode()

void lpc_enable_decode ( uint32_t  decodes)

Definition at line 160 of file lpc_util.c.

References _LPCB_DEV, LPC_IO_PORT_DECODE_ENABLE, and pci_write_config32().

Referenced by bootblock_mainboard_early_init(), lpc_disable_decodes(), and sb_lpc_decode().

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

◆ lpc_enable_port80()

void lpc_enable_port80 ( void  )

Definition at line 139 of file lpc_util.c.

References _LPCB_DEV, DECODE_IO_PORT_ENABLE4, LPC_IO_OR_MEM_DECODE_ENABLE, pci_read_config32(), and pci_write_config32().

Referenced by bootblock_fch_early_init(), and lpc_configure_decodes().

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

◆ lpc_enable_rom()

void lpc_enable_rom ( void  )

Definition at line 250 of file lpc_util.c.

References _LPCB_DEV, LPC_IO_OR_MEM_DECODE_ENABLE, pci_read_config8(), pci_write_config16(), pci_write_config8(), ROM_ADDRESS_RANGE1_END, ROM_ADDRESS_RANGE1_START, ROM_ADDRESS_RANGE2_END, and ROM_ADDRESS_RANGE2_START.

Referenced by bootblock_fch_early_init().

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

◆ lpc_enable_sio_decode()

void lpc_enable_sio_decode ( const bool  addr)

Definition at line 148 of file lpc_util.c.

References _LPCB_DEV, addr, DECODE_ALTERNATE_SIO_ENABLE, DECODE_SIO_ENABLE, LPC_IO_OR_MEM_DECODE_ENABLE, LPC_SELECT_SIO_2E2F, pci_read_config32(), and pci_write_config32().

Referenced by bootblock_mainboard_early_init().

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

◆ lpc_enable_spi_prefetch()

void lpc_enable_spi_prefetch ( void  )

Definition at line 287 of file lpc_util.c.

References _LPCB_DEV, LPC_ROM_DMA_EC_HOST_CONTROL, pci_read_config32(), pci_write_config32(), SPI_FROM_HOST_PREFETCH_EN, and SPI_FROM_USB_PREFETCH_EN.

Referenced by fch_spi_early_init().

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

◆ lpc_enable_spi_rom()

void lpc_enable_spi_rom ( uint32_t  enable)

Definition at line 330 of file lpc_util.c.

References _LPCB_DEV, pci_read_config32(), pci_write_config32(), SPI_BASE_ADDRESS_REGISTER, SPI_ROM_ALT_ENABLE, and SPI_ROM_ENABLE.

Referenced by fch_spi_early_init().

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

◆ lpc_find_wideio_range()

int lpc_find_wideio_range ( uint16_t  start,
uint16_t  size 
)

Identify if any LPC wide IO is covering the IO range.

Parameters
start= start of IO range
size= size of IO range
Returns
Index of wide IO covering the range or error

Definition at line 80 of file lpc_util.c.

References _LPCB_DEV, ARRAY_SIZE, lpc_wideio_size(), pci_read_config16(), WIDEIO_RANGE_ERROR, and wio_io_en.

Referenced by configure_child_lpc_windows().

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

◆ lpc_get_spibase()

uintptr_t lpc_get_spibase ( void  )

Definition at line 309 of file lpc_util.c.

References _LPCB_DEV, ALIGN_DOWN, base, pci_read_config32(), SPI_BASE_ADDRESS_REGISTER, and SPI_BASE_ALIGNMENT.

Referenced by espi_get_bar(), and spi_get_bar().

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

◆ lpc_set_spibase()

void lpc_set_spibase ( uint32_t  base)

Definition at line 318 of file lpc_util.c.

References _LPCB_DEV, ALIGN_DOWN, base, pci_read_config32(), pci_write_config32(), SPI_BASE_ADDRESS_REGISTER, and SPI_BASE_ALIGNMENT.

Referenced by bootblock_fch_early_init(), and lpc_early_init().

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

◆ lpc_set_wideio_range()

int lpc_set_wideio_range ( uint16_t  start,
uint16_t  size 
)

Program a LPC wide IO to support an IO range.

Parameters
start= start of range to be routed through wide IO
size= size of range to be routed through wide IO
Returns
Index of wide IO register used or error

Definition at line 109 of file lpc_util.c.

References _LPCB_DEV, wide_io_ioport_and_bits::alt, ARRAY_SIZE, wide_io_ioport_and_bits::enable, LPC_ALT_WIDEIO_RANGE_ENABLE, LPC_IO_OR_MEM_DECODE_ENABLE, pci_read_config32(), pci_read_config8(), pci_write_config16(), pci_write_config32(), pci_write_config8(), WIDEIO_RANGE_ERROR, and wio_io_en.

Referenced by bootblock_mainboard_early_init(), configure_child_lpc_windows(), and early_ec_init().

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

◆ lpc_spibase()

uintptr_t lpc_spibase ( void  )

Definition at line 185 of file lpc_util.c.

References _LPCB_DEV, base, pci_read_config32(), pci_write_config32(), SPI_BASE_ADDRESS, SPI_BASE_ADDRESS_REGISTER, SPI_BASE_RESERVED, SPI_PRESERVE_BITS, and SPI_ROM_ENABLE.

Here is the call graph for this function:

◆ lpc_tpm_decode()

void lpc_tpm_decode ( void  )

Definition at line 214 of file lpc_util.c.

References _LPCB_DEV, LPC_TRUSTED_PLATFORM_MODULE, pci_read_config32(), pci_write_config32(), TPM_12_EN, TPM_LEGACY_EN, and value.

Referenced by lpc_tpm_decode_spi().

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

◆ lpc_tpm_decode_spi()

void lpc_tpm_decode_spi ( void  )

Definition at line 229 of file lpc_util.c.

References _LPCB_DEV, lpc_tpm_decode(), pci_read_config32(), pci_write_config32(), ROUTE_TPM_2_SPI, and SPI_BASE_ADDRESS_REGISTER.

Referenced by bootblock_mainboard_init().

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

◆ lpc_wideio_size()

uint16_t lpc_wideio_size ( int  index)

Find the size of a particular wide IO.

Parameters
index= index of desired wide IO
Returns
size of desired wide IO

Definition at line 54 of file lpc_util.c.

References _LPCB_DEV, wide_io_ioport_and_bits::alt, ARRAY_SIZE, LPC_ALT_WIDEIO_RANGE_ENABLE, LPC_IO_OR_MEM_DECODE_ENABLE, pci_read_config32(), pci_read_config8(), and wio_io_en.

Referenced by configure_child_lpc_windows(), and lpc_find_wideio_range().

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

Variable Documentation

◆ wio_io_en

const struct wide_io_ioport_and_bits wio_io_en[]
static
Initial value:
= {
{
.enable = LPC_WIDEIO0_ENABLE,
},
{
.enable = LPC_WIDEIO1_ENABLE,
},
{
.enable = LPC_WIDEIO2_ENABLE,
}
}
#define LPC_ALT_WIDEIO0_ENABLE
Definition: lpc.h:95
#define LPC_WIDEIO1_ENABLE
Definition: lpc.h:52
#define LPC_WIDEIO2_ENABLE
Definition: lpc.h:51
#define LPC_WIDEIO1_GENERIC_PORT
Definition: lpc.h:86
#define LPC_WIDEIO_GENERIC_PORT
Definition: lpc.h:85
#define LPC_WIDEIO0_ENABLE
Definition: lpc.h:65
#define LPC_WIDEIO2_GENERIC_PORT
Definition: lpc.h:106
#define LPC_ALT_WIDEIO2_ENABLE
Definition: lpc.h:93
#define LPC_ALT_WIDEIO1_ENABLE
Definition: lpc.h:94

Referenced by lpc_find_wideio_range(), lpc_set_wideio_range(), and lpc_wideio_size().