coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
lpc_lib.c File Reference
#include <arch/ioapic.h>
#include <assert.h>
#include <console/console.h>
#include <device/pci.h>
#include <device/pci_ops.h>
#include <intelblocks/gpmr.h>
#include <intelblocks/itss.h>
#include <intelblocks/lpc_lib.h>
#include <intelblocks/pcr.h>
#include <lib.h>
#include "lpc_def.h"
#include <soc/irq.h>
#include <soc/pci_devs.h>
#include <soc/pcr_ids.h>
#include <southbridge/intel/common/acpi_pirq_gen.h>
Include dependency graph for lpc_lib.c:

Go to the source code of this file.

Macros

#define __SIMPLE_DEVICE__
 
#define PCH_REDIR_ETR   120
 
#define PPI_PORT_B   0x61
 
#define SERR_DIS   (1 << 2)
 
#define CMOS_NMI   0x70
 
#define NMI_DIS   (1 << 7)
 

Functions

uint16_t lpc_enable_fixed_io_ranges (uint16_t io_enables)
 
uint16_t lpc_get_fixed_io_decode (void)
 
uint16_t lpc_set_fixed_io_ranges (uint16_t io_ranges, uint16_t mask)
 
static int find_unused_pmio_window (void)
 
void lpc_open_pmio_window (uint16_t base, uint16_t size)
 
void lpc_open_mmio_window (uintptr_t base, size_t size)
 
static void lpc_set_bios_control_reg (uint8_t bios_cntl_bit)
 
void lpc_set_bios_interface_lock_down (void)
 
void lpc_set_lock_enable (void)
 
void lpc_set_eiss (void)
 
static void lpc_configure_write_protect (bool status)
 
void lpc_enable_wp (void)
 
void lpc_disable_wp (void)
 
void lpc_set_serirq_mode (enum serirq_mode mode)
 
void lpc_io_setup_comm_a_b (void)
 
static void lpc_set_gen_decode_range (uint32_t gen_io_dec[LPC_NUM_GENERIC_IO_RANGES])
 
void pch_enable_lpc (void)
 
void lpc_enable_pci_clk_cntl (void)
 
void lpc_disable_clkrun (void)
 
void pch_enable_ioapic (void)
 
const uint8_tlpc_get_pic_pirq_routing (size_t *num)
 
void pch_pirq_init (void)
 
void pch_misc_init (void)
 

Variables

static const uint8_t pch_interrupt_routing [PIRQ_COUNT]
 

Macro Definition Documentation

◆ __SIMPLE_DEVICE__

#define __SIMPLE_DEVICE__

Definition at line 3 of file lpc_lib.c.

◆ CMOS_NMI

#define CMOS_NMI   0x70

Definition at line 390 of file lpc_lib.c.

◆ NMI_DIS

#define NMI_DIS   (1 << 7)

Definition at line 391 of file lpc_lib.c.

◆ PCH_REDIR_ETR

#define PCH_REDIR_ETR   120

Definition at line 304 of file lpc_lib.c.

◆ PPI_PORT_B

#define PPI_PORT_B   0x61

Definition at line 388 of file lpc_lib.c.

◆ SERR_DIS

#define SERR_DIS   (1 << 2)

Definition at line 389 of file lpc_lib.c.

Function Documentation

◆ find_unused_pmio_window()

static int find_unused_pmio_window ( void  )
static

Definition at line 56 of file lpc_lib.c.

References LPC_GENERIC_IO_RANGE, LPC_LGIR_EN, LPC_NUM_GENERIC_IO_RANGES, PCH_DEV_LPC, and pci_read_config32().

Referenced by lpc_open_pmio_window().

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

◆ lpc_configure_write_protect()

static void lpc_configure_write_protect ( bool  status)
static

Definition at line 198 of file lpc_lib.c.

References LPC_BC_WPD, LPC_BIOS_CNTL, PCH_DEV_LPC, pci_read_config8(), and pci_write_config8().

Referenced by lpc_disable_wp(), and lpc_enable_wp().

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

◆ lpc_disable_clkrun()

void lpc_disable_clkrun ( void  )

Definition at line 297 of file lpc_lib.c.

References LPC_PCCTL, LPC_PCCTL_CLKRUN_EN, PCH_DEV_LPC, pci_read_config8(), and pci_write_config8().

Here is the call graph for this function:

◆ lpc_disable_wp()

void lpc_disable_wp ( void  )

Definition at line 218 of file lpc_lib.c.

References lpc_configure_write_protect().

Here is the call graph for this function:

◆ lpc_enable_fixed_io_ranges()

uint16_t lpc_enable_fixed_io_ranges ( uint16_t  io_enables)

Definition at line 21 of file lpc_lib.c.

References CONFIG, GPMR_LPCIOE, gpmr_write32(), LPC_IO_ENABLES, PCH_DEV_LPC, pci_read_config16(), and pci_write_config16().

Referenced by bootblock_ec_init(), bootblock_soc_early_init(), lpc_io_setup_comm_a_b(), mainboard_ec_init(), mainboard_enable(), and pch_early_iorange_init().

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

◆ lpc_enable_pci_clk_cntl()

void lpc_enable_pci_clk_cntl ( void  )

Definition at line 292 of file lpc_lib.c.

References LPC_PCCTL, LPC_PCCTL_CLKRUN_EN, PCH_DEV_LPC, and pci_write_config8().

Referenced by lpc_soc_init(), and variant_mainboard_final().

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

◆ lpc_enable_wp()

void lpc_enable_wp ( void  )

Definition at line 212 of file lpc_lib.c.

References lpc_configure_write_protect().

Referenced by lpc_lockdown_config().

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

◆ lpc_get_fixed_io_decode()

uint16_t lpc_get_fixed_io_decode ( void  )

Definition at line 34 of file lpc_lib.c.

References LPC_IO_DECODE, PCH_DEV_LPC, and pci_read_config16().

Referenced by lpc_set_fixed_io_ranges().

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

◆ lpc_get_pic_pirq_routing()

const uint8_t* lpc_get_pic_pirq_routing ( size_t num)

Definition at line 326 of file lpc_lib.c.

References ARRAY_SIZE, and pch_interrupt_routing.

Referenced by generate_pin_irq_map().

Here is the caller graph for this function:

◆ lpc_io_setup_comm_a_b()

void lpc_io_setup_comm_a_b ( void  )

Definition at line 249 of file lpc_lib.c.

References CONFIG, lpc_enable_fixed_io_ranges(), LPC_IOD_COMA_RANGE, LPC_IOD_COMA_RANGE_MASK, LPC_IOD_COMB_RANGE, LPC_IOD_COMB_RANGE_MASK, LPC_IOE_COMA_EN, LPC_IOE_COMB_EN, and lpc_set_fixed_io_ranges().

Referenced by bootblock_soc_early_init(), init_cpld(), and pch_early_iorange_init().

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

◆ lpc_open_mmio_window()

void lpc_open_mmio_window ( uintptr_t  base,
size_t  size 
)

Definition at line 128 of file lpc_lib.c.

References base, BIOS_ERR, BIOS_WARNING, CONFIG, GPMR_LPCGMR, gpmr_write32(), LPC_GENERIC_MEM_RANGE, LPC_LGMR_ADDR_MASK, LPC_LGMR_EN, LPC_LGMR_WINDOW_SIZE, PCH_DEV_LPC, pci_read_config32(), pci_write_config32(), and printk.

Referenced by mainboard_init().

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

◆ lpc_open_pmio_window()

◆ lpc_set_bios_control_reg()

static void lpc_set_bios_control_reg ( uint8_t  bios_cntl_bit)
static

Definition at line 158 of file lpc_lib.c.

References assert, IS_POWER_OF_2, LPC_BIOS_CNTL, PCH_DEV_LPC, pci_read_config8(), and pci_write_config8().

Referenced by lpc_set_bios_interface_lock_down(), lpc_set_eiss(), and lpc_set_lock_enable().

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

◆ lpc_set_bios_interface_lock_down()

void lpc_set_bios_interface_lock_down ( void  )

Definition at line 177 of file lpc_lib.c.

References LPC_BC_BILD, and lpc_set_bios_control_reg().

Referenced by lpc_lockdown_config().

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

◆ lpc_set_eiss()

void lpc_set_eiss ( void  )

Definition at line 193 of file lpc_lib.c.

References LPC_BC_EISS, and lpc_set_bios_control_reg().

Referenced by lpc_lockdown_config().

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

◆ lpc_set_fixed_io_ranges()

uint16_t lpc_set_fixed_io_ranges ( uint16_t  io_ranges,
uint16_t  mask 
)

Definition at line 39 of file lpc_lib.c.

References CONFIG, GPMR_LPCIOD, gpmr_write32(), lpc_get_fixed_io_decode(), LPC_IO_DECODE, mask, PCH_DEV_LPC, and pci_write_config16().

Referenced by bootblock_soc_early_init(), lpc_io_setup_comm_a_b(), and pch_early_iorange_init().

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

◆ lpc_set_gen_decode_range()

static void lpc_set_gen_decode_range ( uint32_t  gen_io_dec[LPC_NUM_GENERIC_IO_RANGES])
static

Definition at line 269 of file lpc_lib.c.

References CONFIG, GPMR_LPCLGIR1, gpmr_write32(), LPC_GENERIC_IO_RANGE, LPC_NUM_GENERIC_IO_RANGES, PCH_DEV_LPC, and pci_write_config32().

Referenced by pch_enable_lpc().

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

◆ lpc_set_lock_enable()

void lpc_set_lock_enable ( void  )

Definition at line 185 of file lpc_lib.c.

References LPC_BC_LE, and lpc_set_bios_control_reg().

Referenced by lpc_lockdown_config().

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

◆ lpc_set_serirq_mode()

void lpc_set_serirq_mode ( enum serirq_mode  mode)

Definition at line 226 of file lpc_lib.c.

References LPC_SCNT_EN, LPC_SCNT_MODE, LPC_SERIRQ_CTL, PCH_DEV_LPC, pci_read_config8(), pci_write_config8(), SERIRQ_CONTINUOUS, SERIRQ_OFF, and SERIRQ_QUIET.

Referenced by lpc_soc_init().

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

◆ pch_enable_ioapic()

void pch_enable_ioapic ( void  )

Definition at line 307 of file lpc_lib.c.

References IO_APIC_ADDR, ioapic_set_max_vectors(), PCH_REDIR_ETR, setup_ioapic(), and VIO_APIC_VADDR.

Here is the call graph for this function:

◆ pch_enable_lpc()

void pch_enable_lpc ( void  )

Definition at line 282 of file lpc_lib.c.

◆ pch_misc_init()

void pch_misc_init ( void  )

Definition at line 394 of file lpc_lib.c.

References CMOS_NMI, inb(), NMI_DIS, outb(), PPI_PORT_B, and SERR_DIS.

Here is the call graph for this function:

◆ pch_pirq_init()

void pch_pirq_init ( void  )

Definition at line 353 of file lpc_lib.c.

References all_devices, DEVICE_PATH_PCI, device::enabled, itss_irq_init(), device::next, device::path, pch_interrupt_routing, PCH_IRQ10, PCH_IRQ11, PCI_BDF, PCI_INTERRUPT_LINE, PCI_INTERRUPT_PIN, pci_read_config8(), pci_write_config8(), and device_path::type.

Referenced by pch_enable_lpc().

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

Variable Documentation

◆ pch_interrupt_routing

const uint8_t pch_interrupt_routing[PIRQ_COUNT]
static
Initial value:
= {
[0] = PCH_IRQ11,
[1] = PCH_IRQ10,
[2] = PCH_IRQ11,
[3] = PCH_IRQ11,
[4] = PCH_IRQ11,
[5] = PCH_IRQ11,
[6] = PCH_IRQ11,
[7] = PCH_IRQ11,
}
#define PCH_IRQ10
Definition: irq.h:9
#define PCH_IRQ11
Definition: irq.h:10

Definition at line 315 of file lpc_lib.c.

Referenced by itss_irq_init(), lpc_get_pic_pirq_routing(), and pch_pirq_init().