coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
mainboard.c File Reference
#include <acpi/acpi.h>
#include <acpi/acpigen.h>
#include <amdblocks/acpimmio.h>
#include <amdblocks/amd_pci_util.h>
#include <baseboard/variants.h>
#include <console/console.h>
#include <device/device.h>
#include <gpio.h>
#include <soc/acpi.h>
#include <variant/ec.h>
Include dependency graph for mainboard.c:

Go to the source code of this file.

Data Structures

struct  fch_irq_routing
 

Macros

#define BACKLIGHT_GPIO   GPIO_129
 
#define WWAN_AUX_RST_GPIO   GPIO_18
 
#define METHOD_BACKLIGHT_ENABLE   "\\_SB.BKEN"
 
#define METHOD_BACKLIGHT_DISABLE   "\\_SB.BKDS"
 
#define METHOD_MAINBOARD_INI   "\\_SB.MINI"
 
#define METHOD_MAINBOARD_WAK   "\\_SB.MWAK"
 
#define METHOD_MAINBOARD_PTS   "\\_SB.MPTS"
 
#define METHOD_MAINBOARD_S0X   "\\_SB.MS0X"
 

Functions

 _Static_assert (sizeof(fch_pic_routing)==sizeof(fch_apic_routing), "PIC and APIC FCH interrupt tables must be the same size")
 
static void init_tables (void)
 
static void pirq_setup (void)
 
static void mainboard_configure_gpios (void)
 
void __weak variant_devtree_update (void)
 
static void mainboard_init (void *chip_info)
 
static void mainboard_write_blken (void)
 
static void mainboard_write_blkdis (void)
 
static void mainboard_write_mini (void)
 
static void mainboard_write_mwak (void)
 
static void mainboard_write_mpts (void)
 
static void mainboard_assert_wwan_aux_reset (void)
 
static void mainboard_deassert_wwan_aux_reset (void)
 
static void mainboard_write_ms0x (void)
 
static void mainboard_fill_ssdt (const struct device *dev)
 
static void mainboard_enable (struct device *dev)
 

Variables

static uint8_t fch_pic_routing [0x80]
 
static uint8_t fch_apic_routing [0x80]
 
static const struct fch_irq_routing guybrush_fch []
 
struct chip_operations mainboard_ops
 

Macro Definition Documentation

◆ BACKLIGHT_GPIO

#define BACKLIGHT_GPIO   GPIO_129

Definition at line 14 of file mainboard.c.

◆ METHOD_BACKLIGHT_DISABLE

#define METHOD_BACKLIGHT_DISABLE   "\\_SB.BKDS"

Definition at line 17 of file mainboard.c.

◆ METHOD_BACKLIGHT_ENABLE

#define METHOD_BACKLIGHT_ENABLE   "\\_SB.BKEN"

Definition at line 16 of file mainboard.c.

◆ METHOD_MAINBOARD_INI

#define METHOD_MAINBOARD_INI   "\\_SB.MINI"

Definition at line 18 of file mainboard.c.

◆ METHOD_MAINBOARD_PTS

#define METHOD_MAINBOARD_PTS   "\\_SB.MPTS"

Definition at line 20 of file mainboard.c.

◆ METHOD_MAINBOARD_S0X

#define METHOD_MAINBOARD_S0X   "\\_SB.MS0X"

Definition at line 21 of file mainboard.c.

◆ METHOD_MAINBOARD_WAK

#define METHOD_MAINBOARD_WAK   "\\_SB.MWAK"

Definition at line 19 of file mainboard.c.

◆ WWAN_AUX_RST_GPIO

#define WWAN_AUX_RST_GPIO   GPIO_18

Definition at line 15 of file mainboard.c.

Function Documentation

◆ _Static_assert()

_Static_assert ( sizeof(fch_pic_routing = =sizeof(fch_apic_routing),
"PIC and APIC FCH interrupt tables must be the same size"   
)

◆ init_tables()

static void init_tables ( void  )
static

Definition at line 81 of file mainboard.c.

References fch_irq_routing::apic_irq_num, ARRAY_SIZE, fch_apic_routing, fch_pic_routing, guybrush_fch, fch_irq_routing::intr_index, memset(), fch_irq_routing::pic_irq_num, and PIRQ_NC.

Referenced by mainboard_enable().

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

◆ mainboard_assert_wwan_aux_reset()

static void mainboard_assert_wwan_aux_reset ( void  )
static

Definition at line 160 of file mainboard.c.

References acpigen_soc_clear_tx_gpio(), variant_has_pcie_wwan(), and WWAN_AUX_RST_GPIO.

Referenced by mainboard_write_ms0x().

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

◆ mainboard_configure_gpios()

static void mainboard_configure_gpios ( void  )
static

Definition at line 102 of file mainboard.c.

References gpio_configure_pads_with_override(), variant_base_gpio_table(), and variant_override_gpio_table().

Referenced by init_mainboard(), mainboard_init(), and mainboard_silicon_init_params().

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

◆ mainboard_deassert_wwan_aux_reset()

static void mainboard_deassert_wwan_aux_reset ( void  )
static

Definition at line 166 of file mainboard.c.

References acpigen_soc_set_tx_gpio(), variant_has_pcie_wwan(), and WWAN_AUX_RST_GPIO.

Referenced by mainboard_write_ms0x().

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

◆ mainboard_enable()

static void mainboard_enable ( struct device dev)
static

Definition at line 195 of file mainboard.c.

References BIOS_INFO, BIT, init_tables(), mainboard_fill_ssdt(), device::ops, pirq_setup(), PM_ESPI_DEV_INTR_MASK, PM_ESPI_INTR_CTRL, pm_write32(), and printk.

Here is the call graph for this function:

◆ mainboard_fill_ssdt()

static void mainboard_fill_ssdt ( const struct device dev)
static

Definition at line 185 of file mainboard.c.

References mainboard_write_blkdis(), mainboard_write_blken(), mainboard_write_mini(), mainboard_write_mpts(), mainboard_write_ms0x(), and mainboard_write_mwak().

Referenced by mainboard_enable().

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

◆ mainboard_init()

static void mainboard_init ( void chip_info)
static

Definition at line 118 of file mainboard.c.

References mainboard_configure_gpios(), mainboard_ec_init(), and variant_devtree_update().

Here is the call graph for this function:

◆ mainboard_write_blkdis()

static void mainboard_write_blkdis ( void  )
static

Definition at line 132 of file mainboard.c.

References acpigen_pop_len(), acpigen_soc_set_tx_gpio(), acpigen_write_method(), BACKLIGHT_GPIO, and METHOD_BACKLIGHT_DISABLE.

Referenced by mainboard_fill_ssdt().

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

◆ mainboard_write_blken()

static void mainboard_write_blken ( void  )
static

Definition at line 125 of file mainboard.c.

References acpigen_pop_len(), acpigen_soc_clear_tx_gpio(), acpigen_write_method(), BACKLIGHT_GPIO, and METHOD_BACKLIGHT_ENABLE.

Referenced by mainboard_fill_ssdt().

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

◆ mainboard_write_mini()

static void mainboard_write_mini ( void  )
static

Definition at line 139 of file mainboard.c.

References acpigen_emit_namestring(), acpigen_pop_len(), acpigen_write_method(), METHOD_BACKLIGHT_ENABLE, and METHOD_MAINBOARD_INI.

Referenced by mainboard_fill_ssdt().

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

◆ mainboard_write_mpts()

static void mainboard_write_mpts ( void  )
static

Definition at line 153 of file mainboard.c.

References acpigen_emit_namestring(), acpigen_pop_len(), acpigen_write_method(), METHOD_BACKLIGHT_DISABLE, and METHOD_MAINBOARD_PTS.

Referenced by mainboard_fill_ssdt().

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

◆ mainboard_write_ms0x()

static void mainboard_write_ms0x ( void  )
static

Definition at line 172 of file mainboard.c.

References acpigen_pop_len(), acpigen_write_else(), acpigen_write_if_lequal_op_int(), acpigen_write_method_serialized(), ARG0_OP, mainboard_assert_wwan_aux_reset(), mainboard_deassert_wwan_aux_reset(), and METHOD_MAINBOARD_S0X.

Referenced by mainboard_fill_ssdt().

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

◆ mainboard_write_mwak()

static void mainboard_write_mwak ( void  )
static

Definition at line 146 of file mainboard.c.

References acpigen_emit_namestring(), acpigen_pop_len(), acpigen_write_method(), METHOD_BACKLIGHT_ENABLE, and METHOD_MAINBOARD_WAK.

Referenced by mainboard_fill_ssdt().

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

◆ pirq_setup()

static void pirq_setup ( void  )
static

Definition at line 96 of file mainboard.c.

References fch_apic_routing, fch_pic_routing, intr_data_ptr, and picr_data_ptr.

Referenced by mainboard_enable().

Here is the caller graph for this function:

◆ variant_devtree_update()

void __weak variant_devtree_update ( void  )

Definition at line 114 of file mainboard.c.

Variable Documentation

◆ fch_apic_routing

uint8_t fch_apic_routing[0x80]
static

Definition at line 32 of file mainboard.c.

Referenced by init_tables(), and pirq_setup().

◆ fch_pic_routing

uint8_t fch_pic_routing[0x80]
static

Definition at line 31 of file mainboard.c.

Referenced by init_tables(), and pirq_setup().

◆ guybrush_fch

const struct fch_irq_routing guybrush_fch[]
static
Initial value:
= {
{ PIRQ_A, 12, PIRQ_NC },
{ PIRQ_B, 14, PIRQ_NC },
{ PIRQ_C, 15, PIRQ_NC },
{ PIRQ_D, 12, PIRQ_NC },
{ PIRQ_E, 14, PIRQ_NC },
{ PIRQ_F, 15, PIRQ_NC },
{ PIRQ_G, 12, PIRQ_NC },
{ PIRQ_H, 14, PIRQ_NC },
{ PIRQ_GPIO, 11, 11 },
{ PIRQ_I2C0, 10, 10 },
{ PIRQ_I2C1, 7, 7 },
{ PIRQ_I2C2, 6, 6 },
{ PIRQ_I2C3, 5, 5 },
{ PIRQ_UART0, 4, 4 },
{ PIRQ_UART1, 3, 3 },
{ PIRQ_MISC, 0xfa, 0x00 },
{ PIRQ_MISC0, 0x91, 0x00 },
{ PIRQ_HPET_L, 0x00, 0x00 },
{ PIRQ_HPET_H, 0x00, 0x00 },
}
@ PIRQ_A
Definition: acpi_pirq_gen.h:22
@ PIRQ_C
Definition: acpi_pirq_gen.h:24
@ PIRQ_G
Definition: acpi_pirq_gen.h:28
@ PIRQ_H
Definition: acpi_pirq_gen.h:29
@ PIRQ_E
Definition: acpi_pirq_gen.h:26
@ PIRQ_D
Definition: acpi_pirq_gen.h:25
@ PIRQ_F
Definition: acpi_pirq_gen.h:27
@ PIRQ_B
Definition: acpi_pirq_gen.h:23
#define ACPI_SCI_IRQ
Definition: acpi.h:11
#define PIRQ_EMMC
#define PIRQ_SATA
#define PIRQ_SDIO
#define PIRQ_I2C0
#define PIRQ_HPET_L
#define PIRQ_MISC0
#define PIRQ_SCI
#define PIRQ_MISC
#define PIRQ_SD
#define PIRQ_NC
#define PIRQ_UART0
#define PIRQ_HPET_H
#define PIRQ_I2C3
#define PIRQ_I2C2
#define PIRQ_UART1
#define PIRQ_I2C1
#define PIRQ_GPIO

Referenced by init_tables().

◆ mainboard_ops

struct chip_operations mainboard_ops
Initial value:
= {
.init = mainboard_init,
.enable_dev = mainboard_enable,
}
static void mainboard_init(void *chip_info)
Definition: mainboard.c:118
static void mainboard_enable(struct device *dev)
Definition: mainboard.c:195

Definition at line 195 of file mainboard.c.