coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
bootblock.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <arch/bootblock.h>
4 #include <assert.h>
5 #include <device/pci_ops.h>
6 #include <types.h>
7 
8 #include "ironlake.h"
9 
11 {
12  /* NOTE: Ironlake uses a different encoding for the PCIEXBAR length field */
13  switch (CONFIG_ECAM_MMCONF_BUS_NUMBER) {
14  case 256: return 0 << 1;
15  case 128: return 6 << 1;
16  case 64: return 7 << 1;
17  default: return dead_code_t(uint32_t);
18  }
19 }
20 
22 {
23  /*
24  * The QuickPath bus number is the topmost bus number, as per the value
25  * of the SAD_PCIEXBAR register. The register defaults to 256 buses on
26  * reset. Thus, hardcode the bus number when first setting up PCIEXBAR.
27  */
28  const pci_devfn_t qpi_sad = PCI_DEV(255, 0, 1);
29 
30  const uint32_t reg32 = CONFIG_ECAM_MMCONF_BASE_ADDRESS | encode_pciexbar_length() | 1;
31  pci_io_write_config32(qpi_sad, SAD_PCIEXBAR + 4, 0);
32  pci_io_write_config32(qpi_sad, SAD_PCIEXBAR, reg32);
33 }
#define dead_code_t(type)
Definition: assert.h:92
void __weak bootblock_early_northbridge_init(void)
Definition: bootblock.c:16
#define SAD_PCIEXBAR
Definition: ironlake.h:50
static uint32_t encode_pciexbar_length(void)
Definition: bootblock.c:10
static __always_inline void pci_io_write_config32(pci_devfn_t dev, uint16_t reg, uint32_t value)
Definition: pci_io_cfg.h:65
#define PCI_DEV(SEGBUS, DEV, FN)
Definition: pci_type.h:14
u32 pci_devfn_t
Definition: pci_type.h:8
unsigned int uint32_t
Definition: stdint.h:14