20a87c0bed
Add 'pci_map_bus' function and PCIE_MEDIATEK config for MediaTek platform. TEST=Build pass and boot up to kernel successfully via SSD on Dojo board, here is the SSD information in boot log: == NVME IDENTIFY CONTROLLER DATA == PCI VID : 0x15b7 PCI SSVID : 0x15b7 SN : 21517J440114 MN : WDC PC SN530 SDBPTPZ-256G-1006 RAB : 0x4 AERL : 0x7 SQES : 0x66 CQES : 0x44 NN : 0x1 Identified NVMe model WDC PC SN530 SDBPTPZ-256G-1006 BUG=b:178565024 BRANCH=cherry Signed-off-by: Jianjun Wang <jianjun.wang@mediatek.com> Change-Id: I9ea7d111fed6b816fa2352fe93c268116519a577 Reviewed-on: https://review.coreboot.org/c/coreboot/+/56794 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
20 lines
627 B
C
20 lines
627 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
#include <libpayload.h>
|
|
#include <pci.h>
|
|
|
|
#define PCIE_CFGNUM_REG 0x140
|
|
#define PCIE_CFG_DEVFN(devfn) ((devfn) & GENMASK(7, 0))
|
|
#define PCIE_CFG_BUS(bus) (((bus) << 8) & GENMASK(15, 8))
|
|
#define PCIE_CFG_OFFSET_ADDR 0x1000
|
|
#define PCIE_CFG_HEADER(bus, devfn) \
|
|
(PCIE_CFG_BUS(bus) | PCIE_CFG_DEVFN(devfn))
|
|
|
|
uintptr_t pci_map_bus(pcidev_t dev)
|
|
{
|
|
u32 devfn = (PCI_SLOT(dev) << 3) | PCI_FUNC(dev);
|
|
u32 val = PCIE_CFG_HEADER(PCI_BUS(dev), devfn);
|
|
write32((void *)(lib_sysinfo.pcie_ctrl_base + PCIE_CFGNUM_REG), val);
|
|
|
|
return lib_sysinfo.pcie_ctrl_base + PCIE_CFG_OFFSET_ADDR;
|
|
}
|