coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
pcie.c File Reference
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ops.h>
#include <device/pciexp.h>
#include <device/pci_ids.h>
#include <reg_script.h>
#include <soc/pci_devs.h>
#include <soc/pcie.h>
#include <soc/ramstage.h>
#include <soc/smm.h>
#include "chip.h"
Include dependency graph for pcie.c:

Go to the source code of this file.

Functions

static int root_port_offset (struct device *dev)
 
static int is_first_port (struct device *dev)
 
static void byt_pcie_init (struct device *dev)
 
static void check_port_enabled (struct device *dev)
 
static u8 all_ports_no_dev_present (struct device *dev)
 
static void check_device_present (struct device *dev)
 
static void byt_pcie_enable (struct device *dev)
 
static void byt_pciexp_scan_bridge (struct device *dev)
 

Variables

static int pll_en_off
 
static uint32_t strpfusecfg
 
static const struct reg_script init_static_before_exit_latency []
 
static const struct reg_script init_static_after_exit_latency []
 
static const struct reg_script no_dev_behind_port []
 
static struct device_operations device_ops
 
static const unsigned short pci_device_ids []
 
static const struct pci_driver pcie_root_ports __pci_driver
 

Function Documentation

◆ all_ports_no_dev_present()

static u8 all_ports_no_dev_present ( struct device dev)
static

Definition at line 142 of file pcie.c.

References reg_script::dev, pci_path::devfn, device::path, device_path::pci, pci_read_config32(), pci_read_config8(), pci_write_config8(), PCIE_ROOT_PORT_COUNT, PDS, SI, SLCTL_SLSTS, and XCAP.

Referenced by check_device_present().

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

◆ byt_pcie_enable()

◆ byt_pcie_init()

◆ byt_pciexp_scan_bridge()

static void byt_pciexp_scan_bridge ( struct device dev)
static

Definition at line 217 of file pcie.c.

References reg_script::dev, do_pci_scan_bridge(), LCTL, pciexp_scan_bus(), REG_PCI_POLL32, REG_SCRIPT_END, and reg_script_run_on_dev().

Here is the call graph for this function:

◆ check_device_present()

static void check_device_present ( struct device dev)
static

Definition at line 171 of file pcie.c.

References all_ports_no_dev_present(), BIOS_DEBUG, reg_script::dev, device::enabled, is_first_port(), LCTL, LD, no_dev_behind_port, pci_read_config32(), pci_write_config32(), PDS, printk, reg_script_run_on_dev(), SI, SLCTL_SLSTS, and XCAP.

Referenced by byt_pcie_enable().

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

◆ check_port_enabled()

static void check_port_enabled ( struct device dev)
static

Definition at line 116 of file pcie.c.

References reg_script::dev, device::enabled, LANECFG_MASK, LANECFG_SHIFT, PCIE_PORT1_FUNC, PCIE_PORT2_FUNC, PCIE_PORT3_FUNC, PCIE_PORT4_FUNC, root_port_offset(), and strpfusecfg.

Referenced by byt_pcie_enable().

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

◆ is_first_port()

static int is_first_port ( struct device dev)
inlinestatic

Definition at line 26 of file pcie.c.

Referenced by byt_pcie_enable(), byt_pcie_init(), and check_device_present().

Here is the caller graph for this function:

◆ root_port_offset()

static int root_port_offset ( struct device dev)
inlinestatic

Definition at line 21 of file pcie.c.

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

Referenced by byt_pcie_init(), and check_port_enabled().

Here is the caller graph for this function:

Variable Documentation

◆ __pci_driver

const struct pci_driver pcie_root_ports __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:230
static const unsigned short pci_device_ids[]
Definition: pcie.c:240

Definition at line 240 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 = byt_pcie_init,
.enable = byt_pcie_enable,
.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
static void byt_pcie_enable(struct device *dev)
Definition: pcie.c:195
static void byt_pcie_init(struct device *dev)
Definition: pcie.c:75
static void byt_pciexp_scan_bridge(struct device *dev)
Definition: pcie.c:217

Definition at line 217 of file pcie.c.

◆ init_static_after_exit_latency

const struct reg_script init_static_after_exit_latency[]
static
Initial value:
= {
REG_PCI_WRITE32(NFTS, 0x743a361b),
REG_PCI_RMW32(RTP, 0xff000000, 0x854c74),
REG_PCI_RMW32(AERCH, ~0, (1 << 16) | (1 << 0)),
REG_PCI_OR32(0x34, 0),
REG_PCI_OR32(0x80, 0),
}
#define CFG2
Definition: gl9750.h:10
#define CCEL_SHIFT
Definition: pcie.h:48
#define CSREN
Definition: pcie.h:73
#define RL
Definition: pcie.h:21
#define LATGC_SHIFT
Definition: pcie.h:74
#define MPC
Definition: pcie.h:47
#define CHCFG
Definition: pcie.h:39
#define DSTS2
Definition: pcie.h:35
#define UPRS
Definition: pcie.h:42
#define AERCH
Definition: pcie.h:69
#define CTD
Definition: pcie.h:38
#define FEE
Definition: pcie.h:13
#define URE
Definition: pcie.h:12
#define DCTL_DSTS
Definition: pcie.h:11
#define LSTP
Definition: pcie.h:45
#define MPC2
Definition: pcie.h:43
#define IPF
Definition: pcie.h:44
#define NFE
Definition: pcie.h:14
#define NFTS
Definition: pcie.h:70
#define CCC
Definition: pcie.h:20
#define CEE
Definition: pcie.h:15
#define LATGC_MASK
Definition: pcie.h:75
#define UNRS
Definition: pcie.h:41
#define CCEL_MASK
Definition: pcie.h:49
#define RTP
Definition: pcie.h:80
#define UPSD
Definition: pcie.h:40
#define LCTL
Definition: pcie.h:19
#define EOIFD
Definition: pcie.h:46
#define REG_PCI_OR32(reg_, value_)
Definition: reg_script.h:187
#define REG_PCI_RMW16(reg_, mask_, value_)
Definition: reg_script.h:173
#define REG_PCI_OR16(reg_, value_)
Definition: reg_script.h:185
#define REG_PCI_RMW32(reg_, mask_, value_)
Definition: reg_script.h:175
#define REG_PCI_WRITE32(reg_, value_)
Definition: reg_script.h:169
#define REG_SCRIPT_END
Definition: reg_script.h:427

Definition at line 26 of file pcie.c.

Referenced by byt_pcie_init().

◆ init_static_before_exit_latency

const struct reg_script init_static_before_exit_latency[]
static
Initial value:
= {
}
#define DCAP2
Definition: pcie.h:32
#define LTRME
Definition: pcie.h:37
#define MPS_MASK
Definition: pcie.h:10
#define TDFT
Definition: pcie.h:63
#define LTRMS
Definition: pcie.h:34
#define OBFFEN
Definition: pcie.h:36
#define PHYCTL2_IOSFBCTL
Definition: pcie.h:61
#define OBFFS
Definition: pcie.h:33
#define TXCFGCHWAIT
Definition: pcie.h:64
#define SIID
Definition: pcie.h:65
#define DCAP
Definition: pcie.h:9

Definition at line 26 of file pcie.c.

Referenced by byt_pcie_init().

◆ no_dev_behind_port

const struct reg_script no_dev_behind_port[]
static
Initial value:
= {
REG_PCI_OR32(PCIEALC, (1 << 26)),
REG_PCI_POLL32(PCIESTS1, 0x1f000000, (1 << 24), 50000),
}
#define PCIESTS1
Definition: pcie.h:78
#define SQDIS
Definition: pcie.h:82
#define PHYCTL4
Definition: pcie.h:81
#define PCIEALC
Definition: pcie.h:79
#define REG_PCI_POLL32(reg_, mask_, value_, timeout_)
Definition: reg_script.h:193

Definition at line 75 of file pcie.c.

Referenced by check_device_present().

◆ pci_device_ids

const unsigned short pci_device_ids[]
static
Initial value:
= {
0
}
#define PCIE_PORT1_DEVID
Definition: pci_devs.h:130
#define PCIE_PORT3_DEVID
Definition: pci_devs.h:132
#define PCIE_PORT2_DEVID
Definition: pci_devs.h:131
#define PCIE_PORT4_DEVID
Definition: pci_devs.h:133

Definition at line 240 of file pcie.c.

◆ pll_en_off

int pll_en_off
static

Definition at line 18 of file pcie.c.

Referenced by byt_pcie_enable(), and byt_pcie_init().

◆ strpfusecfg

uint32_t strpfusecfg
static

Definition at line 19 of file pcie.c.

Referenced by byt_pcie_enable(), and check_port_enabled().