coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
pcie.c File Reference
#include <assert.h>
#include <commonlib/helpers.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_def.h>
#include <device/pciexp.h>
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include "iobp.h"
#include "pch.h"
#include <southbridge/intel/common/gpio.h>
#include <stdint.h>
#include "chip.h"
Include dependency graph for pcie.c:

Go to the source code of this file.

Data Structures

struct  root_port_config
 

Macros

#define MAX_NUM_ROOT_PORTS   8
 

Functions

static int max_root_ports (void)
 
static int root_port_is_first (struct device *dev)
 
static int root_port_is_last (struct device *dev)
 
static int root_port_number (struct device *dev)
 
static bool is_rp_enabled (int rp)
 
static void root_port_config_update_gbe_port (void)
 
static void update_num_ports (void)
 
static void root_port_init_config (struct device *dev)
 
static void pch_pcie_device_set_func (int index, int pci_func)
 
static void pcie_enable_clock_gating (void)
 
static void root_port_commit_config (void)
 
static void root_port_mark_disable (struct device *dev)
 
static void root_port_check_disable (struct device *dev)
 
static void pcie_add_0x0202000_iobp (u32 reg)
 
static void pch_pcie_early (struct device *dev)
 
static void pch_pcie_init (struct device *dev)
 
static void pch_pcie_enable (struct device *dev)
 

Variables

static struct root_port_config rpc
 
static struct device_operations device_ops
 
static const unsigned short pci_device_ids []
 
static const struct pci_driver pch_pcie __pci_driver
 

Macro Definition Documentation

◆ MAX_NUM_ROOT_PORTS

#define MAX_NUM_ROOT_PORTS   8

Definition at line 18 of file pcie.c.

Function Documentation

◆ is_rp_enabled()

static bool is_rp_enabled ( int  rp)
static

Definition at line 63 of file pcie.c.

References ARRAY_SIZE, ASSERT, device::enabled, NULL, root_port_config::ports, and rpc.

Referenced by pcie_enable_clock_gating(), and root_port_commit_config().

Here is the caller graph for this function:

◆ max_root_ports()

static int max_root_ports ( void  )
inlinestatic

Definition at line 39 of file pcie.c.

References pch_is_lp(), pch_silicon_id(), and PCI_DID_INTEL_LPT_H81.

Referenced by root_port_init_config().

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

◆ pch_pcie_device_set_func()

static void pch_pcie_device_set_func ( int  index,
int  pci_func 
)
static

◆ pch_pcie_early()

◆ pch_pcie_enable()

static void pch_pcie_enable ( struct device dev)
static

Definition at line 721 of file pcie.c.

◆ pch_pcie_init()

static void pch_pcie_init ( struct device dev)
static

◆ pcie_add_0x0202000_iobp()

static void pcie_add_0x0202000_iobp ( u32  reg)
static

Definition at line 493 of file pcie.c.

References pch_iobp_read(), and pch_iobp_write().

Referenced by pch_pcie_early().

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

◆ pcie_enable_clock_gating()

static void pcie_enable_clock_gating ( void  )
static

Definition at line 215 of file pcie.c.

References gpio_is_native(), is_rp_enabled(), root_port_config::num_ports, pch_is_lp(), pci_or_config32(), pci_or_config8(), pci_update_config8(), root_port_config::ports, root_port_number(), and rpc.

Referenced by root_port_commit_config().

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

◆ root_port_check_disable()

static void root_port_check_disable ( struct device dev)
static

◆ root_port_commit_config()

◆ root_port_config_update_gbe_port()

static void root_port_config_update_gbe_port ( void  )
static

Definition at line 73 of file pcie.c.

References BIOS_DEBUG, root_port_config::gbe_port, pch_is_lp(), printk, rpc, and root_port_config::strpfusecfg1.

Referenced by root_port_init_config().

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

◆ root_port_init_config()

◆ root_port_is_first()

static int root_port_is_first ( struct device dev)
inlinestatic

Definition at line 47 of file pcie.c.

References pci_path::devfn, device::path, device_path::pci, and PCI_FUNC.

Referenced by root_port_init_config().

Here is the caller graph for this function:

◆ root_port_is_last()

static int root_port_is_last ( struct device dev)
inlinestatic

◆ root_port_mark_disable()

static void root_port_mark_disable ( struct device dev)
static

Definition at line 363 of file pcie.c.

References pci_path::devfn, device::enabled, root_port_config::new_rpfn, device::path, device_path::pci, PCI_FUNC, rpc, and RPFN_HIDE.

Referenced by root_port_check_disable().

Here is the caller graph for this function:

◆ root_port_number()

static int root_port_number ( struct device dev)
inlinestatic

Definition at line 58 of file pcie.c.

References pci_path::devfn, device::path, device_path::pci, and PCI_FUNC.

Referenced by pch_pcie_early(), pcie_enable_clock_gating(), root_port_check_disable(), and root_port_init_config().

Here is the caller graph for this function:

◆ update_num_ports()

static void update_num_ports ( void  )
static

Definition at line 103 of file pcie.c.

References BIOS_DEBUG, MIN, root_port_config::num_ports, printk, rpc, and root_port_config::strpfusecfg2.

Referenced by root_port_init_config().

Here is the caller graph for this function:

Variable Documentation

◆ __pci_driver

const struct pci_driver pch_pcie __pci_driver
static
Initial value:
= {
.ops = &device_ops,
.vendor = PCI_VID_INTEL,
.devices = pci_device_ids,
}
#define PCI_VID_INTEL
Definition: pci_ids.h:2157
static struct device_operations device_ops
Definition: pcie.c:741
static const unsigned short pci_device_ids[]
Definition: pcie.c:751

Definition at line 751 of file pcie.c.

◆ device_ops

struct device_operations device_ops
static
Initial value:
= {
.read_resources = pci_bus_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_bus_enable_resources,
.init = pch_pcie_init,
.enable = pch_pcie_enable,
.scan_bus = pciexp_scan_bridge,
.ops_pci = &pci_dev_ops_pci,
}
void pci_bus_enable_resources(struct device *dev)
Definition: pci_device.c:758
void pci_bus_read_resources(struct device *dev)
Definition: pci_device.c:540
struct pci_operations pci_dev_ops_pci
Default device operation for PCI devices.
Definition: pci_device.c:911
void pci_dev_set_resources(struct device *dev)
Definition: pci_device.c:691
void pciexp_scan_bridge(struct device *dev)
static void pch_pcie_enable(struct device *dev)
Definition: pcie.c:721
static void pch_pcie_init(struct device *dev)
Definition: pcie.c:700

Definition at line 721 of file pcie.c.

◆ pci_device_ids

const unsigned short pci_device_ids[]
static
Initial value:
= {
0
}
#define PCI_DID_INTEL_LPT_H_PCIE_RP8
Definition: pci_ids.h:3096
#define PCI_DID_INTEL_LPT_H_PCIE_RP2
Definition: pci_ids.h:3090
#define PCI_DID_INTEL_LPT_LP_PCIE_RP2
Definition: pci_ids.h:3098
#define PCI_DID_INTEL_LPT_LP_PCIE_RP4
Definition: pci_ids.h:3100
#define PCI_DID_INTEL_LPT_H_PCIE_RP5
Definition: pci_ids.h:3093
#define PCI_DID_INTEL_LPT_H_PCIE_RP1
Definition: pci_ids.h:3089
#define PCI_DID_INTEL_LPT_H_PCIE_RP7
Definition: pci_ids.h:3095
#define PCI_DID_INTEL_LPT_H_PCIE_RP6
Definition: pci_ids.h:3094
#define PCI_DID_INTEL_LPT_H_PCIE_RP4
Definition: pci_ids.h:3092
#define PCI_DID_INTEL_LPT_H_PCIE_RP3
Definition: pci_ids.h:3091
#define PCI_DID_INTEL_LPT_LP_PCIE_RP3
Definition: pci_ids.h:3099
#define PCI_DID_INTEL_LPT_LP_PCIE_RP1
Definition: pci_ids.h:3097
#define PCI_DID_INTEL_LPT_LP_PCIE_RP5
Definition: pci_ids.h:3101
#define PCI_DID_INTEL_LPT_LP_PCIE_RP6
Definition: pci_ids.h:3102

Definition at line 751 of file pcie.c.

◆ rpc