coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
northbridge.c File Reference
#include <commonlib/helpers.h>
#include <console/console.h>
#include <acpi/acpi.h>
#include <delay.h>
#include <cpu/intel/haswell/haswell.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_def.h>
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include <boot/tables.h>
#include <security/intel/txt/txt_register.h>
#include <southbridge/intel/lynxpoint/pch.h>
#include <types.h>
#include "chip.h"
#include "haswell.h"
Include dependency graph for northbridge.c:

Go to the source code of this file.

Data Structures

struct  fixed_mmio_descriptor
 
struct  map_entry
 

Macros

#define MAP_ENTRY(reg_, is_64_, is_limit_, desc_)
 
#define MAP_ENTRY_BASE_32(reg_, desc_)   MAP_ENTRY(reg_, 0, 0, desc_)
 
#define MAP_ENTRY_BASE_64(reg_, desc_)   MAP_ENTRY(reg_, 1, 0, desc_)
 
#define MAP_ENTRY_LIMIT_64(reg_, desc_)   MAP_ENTRY(reg_, 1, 1, desc_)
 

Enumerations

enum  {
  TOM_REG , TOUUD_REG , MESEG_BASE_REG , MESEG_LIMIT_REG ,
  REMAP_BASE_REG , REMAP_LIMIT_REG , TOLUD_REG , BGSM_REG ,
  BDSM_REG , TSEG_REG , NUM_MAP_ENTRIES
}
 

Functions

static const char * northbridge_acpi_name (const struct device *dev)
 
static int get_bar (struct device *dev, unsigned int index, u32 *base, u32 *len)
 
static int get_bar_in_mchbar (struct device *dev, unsigned int index, u32 *base, u32 *len)
 
static void mc_add_fixed_mmio_resources (struct device *dev)
 
static void read_map_entry (struct device *dev, struct map_entry *entry, uint64_t *result)
 
static void mc_read_map_entries (struct device *dev, uint64_t *values)
 
static void mc_report_map_entries (struct device *dev, uint64_t *values)
 
static void mc_add_dram_resources (struct device *dev, int *resource_cnt)
 
static void mc_read_resources (struct device *dev)
 
static void disable_devices (void)
 
static void init_egress (void)
 
static void northbridge_dmi_init (void)
 
static void northbridge_topology_init (void)
 
static void northbridge_init (struct device *dev)
 
static void northbridge_final (struct device *dev)
 
static void enable_dev (struct device *dev)
 

Variables

static struct device_operations pci_domain_ops
 
struct fixed_mmio_descriptor mc_fixed_resources []
 
static struct map_entry memory_map [NUM_MAP_ENTRIES]
 
static struct device_operations mc_ops
 
static const unsigned short mc_pci_device_ids []
 
static const struct pci_driver mc_driver_hsw __pci_driver
 
static struct device_operations cpu_bus_ops
 
struct chip_operations northbridge_intel_haswell_ops
 

Macro Definition Documentation

◆ MAP_ENTRY

#define MAP_ENTRY (   reg_,
  is_64_,
  is_limit_,
  desc_ 
)
Value:
{ \
.reg = reg_, \
.is_64_bit = is_64_, \
.is_limit = is_limit_, \
.description = desc_, \
}

Definition at line 179 of file northbridge.c.

◆ MAP_ENTRY_BASE_32

#define MAP_ENTRY_BASE_32 (   reg_,
  desc_ 
)    MAP_ENTRY(reg_, 0, 0, desc_)

Definition at line 187 of file northbridge.c.

◆ MAP_ENTRY_BASE_64

#define MAP_ENTRY_BASE_64 (   reg_,
  desc_ 
)    MAP_ENTRY(reg_, 1, 0, desc_)

Definition at line 188 of file northbridge.c.

◆ MAP_ENTRY_LIMIT_64

#define MAP_ENTRY_LIMIT_64 (   reg_,
  desc_ 
)    MAP_ENTRY(reg_, 1, 1, desc_)

Definition at line 189 of file northbridge.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
TOM_REG 
TOUUD_REG 
MESEG_BASE_REG 
MESEG_LIMIT_REG 
REMAP_BASE_REG 
REMAP_LIMIT_REG 
TOLUD_REG 
BGSM_REG 
BDSM_REG 
TSEG_REG 
NUM_MAP_ENTRIES 

Definition at line 191 of file northbridge.c.

Function Documentation

◆ disable_devices()

static void disable_devices ( void  )
static

Definition at line 357 of file northbridge.c.

References ARRAY_SIZE, BIOS_DEBUG, DEVEN, DEVEN_D1F0EN, DEVEN_D1F1EN, DEVEN_D1F2EN, DEVEN_D2EN, DEVEN_D3EN, DEVEN_D4EN, DEVEN_D7EN, device::enabled, mask, name, PCI_DEVFN, pci_read_config32(), pci_write_config32(), pcidev_on_root(), pcidev_path_on_root(), and printk.

Referenced by northbridge_init().

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

◆ enable_dev()

static void enable_dev ( struct device dev)
static

◆ get_bar()

static int get_bar ( struct device dev,
unsigned int  index,
u32 base,
u32 len 
)
static

Definition at line 45 of file northbridge.c.

References base, and pci_read_config32().

Here is the call graph for this function:

◆ get_bar_in_mchbar()

static int get_bar_in_mchbar ( struct device dev,
unsigned int  index,
u32 base,
u32 len 
)
static

Definition at line 63 of file northbridge.c.

References base, and mchbar_read32().

Here is the call graph for this function:

◆ init_egress()

static void init_egress ( void  )
static

Definition at line 393 of file northbridge.c.

References epbar_read16(), epbar_write32(), EPPVCCAP1, EPVC0RCTL, EPVC1RCTL, and EPVC1RSTS.

Referenced by northbridge_init().

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

◆ mc_add_dram_resources()

static void mc_add_dram_resources ( struct device dev,
int *  resource_cnt 
)
static

◆ mc_add_fixed_mmio_resources()

static void mc_add_fixed_mmio_resources ( struct device dev)
static

◆ mc_read_map_entries()

static void mc_read_map_entries ( struct device dev,
uint64_t values 
)
static

Definition at line 219 of file northbridge.c.

References memory_map, NUM_MAP_ENTRIES, and read_map_entry().

Referenced by mc_add_dram_resources().

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

◆ mc_read_resources()

static void mc_read_resources ( struct device dev)
static

◆ mc_report_map_entries()

static void mc_report_map_entries ( struct device dev,
uint64_t values 
)
static

Definition at line 227 of file northbridge.c.

References BIOS_DEBUG, map_entry::description, GGC, memory_map, NUM_MAP_ENTRIES, pci_read_config16(), and printk.

Referenced by mc_add_dram_resources().

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

◆ northbridge_acpi_name()

static const char* northbridge_acpi_name ( const struct device dev)
static

◆ northbridge_dmi_init()

static void northbridge_dmi_init ( void  )
static

Definition at line 409 of file northbridge.c.

References CONFIG, DMI_AFE_PM_TMR, dmibar_clrsetbits32(), dmibar_setbits16, dmibar_setbits32, dmibar_write32(), DMICESTS, DMIL0SLAT, DMILCTL, DMILCTL2, DMILLTC, and DMIUESTS.

Referenced by northbridge_init().

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

◆ northbridge_final()

static void northbridge_final ( struct device dev)
static

Definition at line 505 of file northbridge.c.

◆ northbridge_init()

static void northbridge_init ( struct device dev)
static

◆ northbridge_topology_init()

static void northbridge_topology_init ( void  )
static

◆ read_map_entry()

static void read_map_entry ( struct device dev,
struct map_entry entry,
uint64_t result 
)
static

Definition at line 154 of file northbridge.c.

Referenced by mc_read_map_entries().

Here is the caller graph for this function:

Variable Documentation

◆ __pci_driver

const struct pci_driver mc_driver_hsw __pci_driver
static
Initial value:
= {
.ops = &mc_ops,
.vendor = PCI_VID_INTEL,
.devices = mc_pci_device_ids,
}
static struct device_operations mc_ops
Definition: northbridge.c:537
static const unsigned short mc_pci_device_ids[]
Definition: northbridge.c:547
#define PCI_VID_INTEL
Definition: pci_ids.h:2157

Definition at line 547 of file northbridge.c.

◆ cpu_bus_ops

struct device_operations cpu_bus_ops
static
Initial value:
= {
.read_resources = noop_read_resources,
.set_resources = noop_set_resources,
.init = mp_cpu_bus_init,
}
static void noop_read_resources(struct device *dev)
Standard device operations function pointers shims.
Definition: device.h:73
static void noop_set_resources(struct device *dev)
Definition: device.h:74
static void mp_cpu_bus_init(struct device *dev)
Definition: device.h:240

Definition at line 547 of file northbridge.c.

Referenced by enable_dev().

◆ mc_fixed_resources

struct fixed_mmio_descriptor mc_fixed_resources[]
Initial value:
= {
{ MCHBAR, MCH_BASE_SIZE, get_bar, "MCHBAR" },
{ DMIBAR, DMI_BASE_SIZE, get_bar, "DMIBAR" },
{ EPBAR, EP_BASE_SIZE, get_bar, "EPBAR" },
}
#define MCHBAR
Definition: host_bridge.h:7
#define DMIBAR
Definition: host_bridge.h:33
#define EPBAR
Definition: host_bridge.h:6
#define EDRAMBAR
Definition: mchbar.h:19
#define GDXCBAR
Definition: mchbar.h:22
#define DMI_BASE_SIZE
Definition: memmap.h:8
#define EP_BASE_SIZE
Definition: memmap.h:10
#define GDXC_BASE_SIZE
Definition: memmap.h:16
#define MCH_BASE_SIZE
Definition: memmap.h:6
#define EDRAM_BASE_SIZE
Definition: memmap.h:13
static int get_bar_in_mchbar(struct device *dev, unsigned int index, u32 *base, u32 *len)
Definition: northbridge.c:63
static int get_bar(struct device *dev, unsigned int index, u32 *base, u32 *len)
Definition: northbridge.c:45

Definition at line 63 of file northbridge.c.

Referenced by mc_add_fixed_mmio_resources().

◆ mc_ops

struct device_operations mc_ops
static
Initial value:
= {
.read_resources = mc_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.acpi_fill_ssdt = generate_cpu_entries,
.ops_pci = &pci_dev_ops_pci,
}
void generate_cpu_entries(const struct device *device)
Definition: acpi.c:334
static void mc_read_resources(struct device *dev)
Definition: northbridge.c:332
static void northbridge_final(struct device *dev)
Definition: northbridge.c:505
static void northbridge_init(struct device *dev)
Definition: northbridge.c:482
void pci_dev_enable_resources(struct device *dev)
Definition: pci_device.c:721
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

Definition at line 505 of file northbridge.c.

◆ mc_pci_device_ids

const unsigned short mc_pci_device_ids[]
static
Initial value:
= {
0x0c00,
0x0c04,
0x0a04,
0x0c08,
0x0d00,
0x0d04,
0x0d08,
0
}

Definition at line 547 of file northbridge.c.

◆ memory_map

struct map_entry memory_map[NUM_MAP_ENTRIES]
static
Initial value:
= {
}
#define REMAPLIMIT
Definition: e7505.h:36
#define REMAPBASE
Definition: e7505.h:35
#define MESEG_LIMIT
Definition: host_bridge.h:36
#define TOLUD
Definition: host_bridge.h:61
#define MESEG_BASE
Definition: host_bridge.h:35
#define TOUUD
Definition: host_bridge.h:57
#define TSEG
Definition: host_bridge.h:60
#define BDSM
Definition: host_bridge.h:58
#define TOM
Definition: host_bridge.h:56
#define BGSM
Definition: host_bridge.h:59
#define MAP_ENTRY_LIMIT_64(reg_, desc_)
Definition: northbridge.c:189
#define MAP_ENTRY_BASE_64(reg_, desc_)
Definition: northbridge.c:188
#define MAP_ENTRY_BASE_32(reg_, desc_)
Definition: northbridge.c:187
@ TOM_REG
Definition: northbridge.c:192
@ TSEG_REG
Definition: northbridge.c:201
@ BDSM_REG
Definition: northbridge.c:200
@ BGSM_REG
Definition: northbridge.c:199
@ MESEG_LIMIT_REG
Definition: northbridge.c:195
@ TOUUD_REG
Definition: northbridge.c:193
@ MESEG_BASE_REG
Definition: northbridge.c:194
@ REMAP_BASE_REG
Definition: northbridge.c:196
@ TOLUD_REG
Definition: northbridge.c:198
@ REMAP_LIMIT_REG
Definition: northbridge.c:197

Definition at line 154 of file northbridge.c.

Referenced by get_srat_memory_entries(), mc_read_map_entries(), mc_report_map_entries(), and program_total_memory_map().

◆ northbridge_intel_haswell_ops

struct chip_operations northbridge_intel_haswell_ops
Initial value:
= {
.enable_dev = enable_dev,
}
static void enable_dev(struct device *dev)
Definition: northbridge.c:570

Definition at line 570 of file northbridge.c.

◆ pci_domain_ops

struct device_operations pci_domain_ops
static
Initial value:
= {
.read_resources = pci_domain_read_resources,
.set_resources = pci_domain_set_resources,
.scan_bus = pci_domain_scan_bus,
.acpi_name = northbridge_acpi_name,
.write_acpi_tables = northbridge_write_acpi_tables,
}
unsigned long northbridge_write_acpi_tables(struct device *device, unsigned long start)
static const char * northbridge_acpi_name(const struct device *dev)
Definition: northbridge.c:21
void pci_domain_read_resources(struct device *dev)
Definition: pci_device.c:547
void pci_domain_set_resources(struct device *dev)
Definition: pci_device.c:564
void pci_domain_scan_bus(struct device *dev)
Scan a PCI domain.
Definition: pci_device.c:1610

Definition at line 21 of file northbridge.c.

Referenced by enable_dev().