coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
gpio.c File Reference
#include <arch/io.h>
#include <device/mmio.h>
#include <device/pci.h>
#include <console/console.h>
#include <soc/gpio.h>
#include <soc/pm.h>
#include <soc/smm.h>
Include dependency graph for gpio.c:

Go to the source code of this file.

Functions

static void setup_gpios (const struct soc_gpio_map *gpios, const struct gpio_bank *bank)
 
static void setup_gpio_route (const struct soc_gpio_map *sus, const struct soc_gpio_map *core)
 
static void setup_dirqs (const u8 dirq[GPIO_MAX_DIRQS], const struct gpio_bank *bank)
 
void setup_soc_gpios (struct soc_gpio_config *config, u8 enable_xdp_tap)
 
struct soc_gpio_config *__weak mainboard_get_gpios (void)
 

Variables

static const u8 gpncore_gpio_to_pad [GPNCORE_COUNT]
 
static const u8 gpscore_gpio_to_pad [GPSCORE_COUNT]
 
static const u8 gpssus_gpio_to_pad [GPSSUS_COUNT]
 
static const struct gpio_bank gpncore_bank
 
static const struct gpio_bank gpscore_bank
 
static const struct gpio_bank gpssus_bank
 

Function Documentation

◆ mainboard_get_gpios()

struct soc_gpio_config* __weak mainboard_get_gpios ( void  )

Definition at line 226 of file gpio.c.

References BIOS_DEBUG, NULL, and printk.

◆ setup_dirqs()

static void setup_dirqs ( const u8  dirq[GPIO_MAX_DIRQS],
const struct gpio_bank bank 
)
static

Definition at line 183 of file gpio.c.

References BIOS_DEBUG, gpio_bank::pad_base, PAD_BASE_DIRQ_OFFSET, printk, val, and write32().

Referenced by setup_soc_gpios().

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

◆ setup_gpio_route()

static void setup_gpio_route ( const struct soc_gpio_map sus,
const struct soc_gpio_map core 
)
static

Definition at line 160 of file gpio.c.

References ROUTE_SCI, ROUTE_SMI, soc_gpio_map::sci, soc_gpio_map::smi, SMM_SAVE_PARAM_GPIO_ROUTE, and smm_southcluster_save_param().

Referenced by setup_soc_gpios().

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

◆ setup_gpios()

◆ setup_soc_gpios()

void setup_soc_gpios ( struct soc_gpio_config config,
u8  enable_xdp_tap 
)

Definition at line 202 of file gpio.c.

References BIOS_DEBUG, config, gpncore_bank, gpscore_bank, gpssus_bank, GPSSUS_PAD_BASE, printk, setup_dirqs(), setup_gpio_route(), setup_gpios(), and write32().

Referenced by baytrail_init_pre_device(), and soc_init_pre_device().

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

Variable Documentation

◆ gpncore_bank

const struct gpio_bank gpncore_bank
static
Initial value:
= {
.gpio_count = GPNCORE_COUNT,
.gpio_to_pad = gpncore_gpio_to_pad,
.legacy_base = GP_LEGACY_BASE_NONE,
.pad_base = GPNCORE_PAD_BASE,
.has_wake_en = 0,
.gpio_f1_range_start = GPNCORE_GPIO_F1_RANGE_START,
.gpio_f1_range_end = GPNCORE_GPIO_F1_RANGE_END,
}
static const u8 gpncore_gpio_to_pad[GPNCORE_COUNT]
Definition: gpio.c:12
#define GPNCORE_PAD_BASE
Definition: gpio.h:16
#define GPNCORE_GPIO_F1_RANGE_START
Definition: gpio.h:320
#define GPNCORE_GPIO_F1_RANGE_END
Definition: gpio.h:321
#define GP_LEGACY_BASE_NONE
Definition: gpio.h:31
#define GPNCORE_COUNT
Definition: gpio.h:42

Definition at line 33 of file gpio.c.

Referenced by setup_soc_gpios().

◆ gpncore_gpio_to_pad

const u8 gpncore_gpio_to_pad[GPNCORE_COUNT]
static
Initial value:
=
{ 19, 18, 17, 20, 21, 22, 24, 25,
23, 16, 14, 15, 12, 26, 27, 1,
4, 8, 11, 0, 3, 6, 10, 13,
2, 5, 9 }

Definition at line 12 of file gpio.c.

◆ gpscore_bank

const struct gpio_bank gpscore_bank
static
Initial value:
= {
.gpio_count = GPSCORE_COUNT,
.gpio_to_pad = gpscore_gpio_to_pad,
.legacy_base = GPSCORE_LEGACY_BASE,
.pad_base = GPSCORE_PAD_BASE,
.has_wake_en = 0,
.gpio_f1_range_start = GPSCORE_GPIO_F1_RANGE_START,
.gpio_f1_range_end = GPSCORE_GPIO_F1_RANGE_END,
}
static const u8 gpscore_gpio_to_pad[GPSCORE_COUNT]
Definition: gpio.c:18
#define GPSCORE_COUNT
Definition: gpio.h:43
#define GPSCORE_LEGACY_BASE
Definition: gpio.h:28
#define GPSCORE_GPIO_F1_RANGE_START
Definition: gpio.h:323
#define GPSCORE_PAD_BASE
Definition: gpio.h:15
#define GPSCORE_GPIO_F1_RANGE_END
Definition: gpio.h:324

Definition at line 33 of file gpio.c.

Referenced by setup_soc_gpios().

◆ gpscore_gpio_to_pad

const u8 gpscore_gpio_to_pad[GPSCORE_COUNT]
static
Initial value:
=
{ 85, 89, 93, 96, 99, 102, 98, 101,
34, 37, 36, 38, 39, 35, 40, 84,
62, 61, 64, 59, 54, 56, 60, 55,
63, 57, 51, 50, 53, 47, 52, 49,
48, 43, 46, 41, 45, 42, 58, 44,
95, 105, 70, 68, 67, 66, 69, 71,
65, 72, 86, 90, 88, 92, 103, 77,
79, 83, 78, 81, 80, 82, 13, 12,
15, 14, 17, 18, 19, 16, 2, 1,
0, 4, 6, 7, 9, 8, 33, 32,
31, 30, 29, 27, 25, 28, 26, 23,
21, 20, 24, 22, 5, 3, 10, 11,
106, 87, 91, 104, 97, 100 }

Definition at line 18 of file gpio.c.

◆ gpssus_bank

const struct gpio_bank gpssus_bank
static
Initial value:
= {
.gpio_count = GPSSUS_COUNT,
.gpio_to_pad = gpssus_gpio_to_pad,
.legacy_base = GPSSUS_LEGACY_BASE,
.pad_base = GPSSUS_PAD_BASE,
.has_wake_en = 1,
.gpio_f1_range_start = GPSSUS_GPIO_F1_RANGE_START,
.gpio_f1_range_end = GPSSUS_GPIO_F1_RANGE_END,
}
static const u8 gpssus_gpio_to_pad[GPSSUS_COUNT]
Definition: gpio.c:33
#define GPSSUS_LEGACY_BASE
Definition: gpio.h:29
#define GPSSUS_GPIO_F1_RANGE_END
Definition: gpio.h:327
#define GPSSUS_PAD_BASE
Definition: gpio.h:17
#define GPSSUS_COUNT
Definition: gpio.h:44
#define GPSSUS_GPIO_F1_RANGE_START
Definition: gpio.h:326

Definition at line 33 of file gpio.c.

Referenced by setup_soc_gpios().

◆ gpssus_gpio_to_pad

const u8 gpssus_gpio_to_pad[GPSSUS_COUNT]
static
Initial value:
=
{ 29, 33, 30, 31, 32, 34, 36, 35,
38, 37, 18, 7, 11, 20, 17, 1,
8, 10, 19, 12, 0, 2, 23, 39,
28, 27, 22, 21, 24, 25, 26, 51,
56, 54, 49, 55, 48, 57, 50, 58,
52, 53, 59, 40 }

Definition at line 33 of file gpio.c.