soc/fsp_broadwell_de: Add devhide functionality
Add function to hide IIO PCIe root ports. TEST=On OCP Monolake, hide built-in NIC PCIe root port [0.2.2 and 0.2.3] and make sure OS does not detect built-in NIC. Change-Id: I2fcac5b7d9a7a52a2801c010bfccf247f2a44581 Signed-off-by: Andrey Petrov <anpetrov@fb.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/35321 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: David Hendricks <david.hendricks@gmail.com> Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
This commit is contained in:
parent
8dc95ddbd4
commit
2fa4938796
|
@ -15,6 +15,7 @@ romstage-y += gpio.c
|
||||||
romstage-y += memmap.c
|
romstage-y += memmap.c
|
||||||
romstage-y += tsc_freq.c
|
romstage-y += tsc_freq.c
|
||||||
romstage-y += smbus-imc.c
|
romstage-y += smbus-imc.c
|
||||||
|
romstage-y += ubox.c
|
||||||
|
|
||||||
postcar-y += tsc_freq.c
|
postcar-y += tsc_freq.c
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ ramstage-y += smi.c
|
||||||
ramstage-y += southcluster.c
|
ramstage-y += southcluster.c
|
||||||
ramstage-y += tsc_freq.c
|
ramstage-y += tsc_freq.c
|
||||||
ramstage-y += vtd.c
|
ramstage-y += vtd.c
|
||||||
|
ramstage-y += ubox.c
|
||||||
ramstage-$(CONFIG_HAVE_SMI_HANDLER) += pmutil.c
|
ramstage-$(CONFIG_HAVE_SMI_HANDLER) += pmutil.c
|
||||||
ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smmrelocate.c
|
ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smmrelocate.c
|
||||||
|
|
||||||
|
|
|
@ -20,106 +20,130 @@
|
||||||
|
|
||||||
#include <device/pci_def.h>
|
#include <device/pci_def.h>
|
||||||
|
|
||||||
#define BUS0 0
|
#define BUS0 0
|
||||||
|
|
||||||
#define SOC_DEV 0
|
#define SOC_DEV 0
|
||||||
#define SOC_FUNC 0
|
#define SOC_FUNC 0
|
||||||
#define SOC_DEVID 0x2F00
|
#define SOC_DEVID 0x2F00
|
||||||
#define SOC_DEVID_ES2 0x6F00
|
#define SOC_DEVID_ES2 0x6F00
|
||||||
#define SOC_DEV_FUNC PCI_DEVFN(SOC_DEV, SOC_FUNC)
|
#define SOC_DEV_FUNC PCI_DEVFN(SOC_DEV, SOC_FUNC)
|
||||||
|
|
||||||
#define VTD_DEV 5
|
/* DMI2/PCIe link to PCH */
|
||||||
#define VTD_FUNC 0
|
#define PCIE_IIO_PORT_0_DEV 0x00
|
||||||
#define VTD_DEVID 0x6f28
|
#define PCIE_IIO_PORT_0_FUNC 0x00
|
||||||
#define VTD_DEV_FUNC PCI_DEVFN(VTD_DEV, VTD_FUNC)
|
|
||||||
#define VTD_PCI_DEV PCI_DEV(BUS0, VTD_DEV, VTD_FUNC)
|
|
||||||
|
|
||||||
#define LPC_DEV 31
|
/* IOU2, x8 PCIe Gen3 port */
|
||||||
#define LPC_FUNC 0
|
#define PCIE_IIO_PORT_1_DEV 0x01
|
||||||
#define LPC_DEVID 0x8C42
|
#define PCIE_IIO_PORT_1A_FUNC 0x00
|
||||||
#define LPC_DEVID_ES2 0x8C54
|
#define PCIE_IIO_PORT_1B_FUNC 0x01
|
||||||
#define LPC_DEV_FUNC PCI_DEVFN(LPC_DEV, LPC_FUNC)
|
|
||||||
|
|
||||||
#define SATA_DEV 31
|
/* IOU0: Internal IOSF bridge to 10 GbE and CBDMA */
|
||||||
#define SATA_FUNC 2
|
#define PCIE_IIO_PORT_2_DEV 0x02
|
||||||
#define AHCI_DEVID 0x8C02
|
#define PCIE_IIO_PORT_2A_FUNC 0x00
|
||||||
#define SATA_DEV_FUNC PCI_DEVFN(SATA_DEV, SATA_FUNC)
|
#define PCIE_IIO_PORT_2B_FUNC 0x01
|
||||||
|
#define PCIE_IIO_PORT_2C_FUNC 0x02
|
||||||
|
#define PCIE_IIO_PORT_2D_FUNC 0x03
|
||||||
|
|
||||||
#define SMBUS_DEV 31
|
/* IOU1: x16 PCIe Gen3 port */
|
||||||
#define SMBUS_FUNC 3
|
#define PCIE_IIO_PORT_3_DEV 0x03
|
||||||
#define SMBUS_DEVID 0x8C22
|
#define PCIE_IIO_PORT_3A_FUNC 0x00
|
||||||
#define SMBUS_DEV_FUNC PCI_DEVFN(SMBUS_DEV, SMBUS_FUNC)
|
#define PCIE_IIO_PORT_3B_FUNC 0x01
|
||||||
|
#define PCIE_IIO_PORT_3C_FUNC 0x02
|
||||||
|
#define PCIE_IIO_PORT_3D_FUNC 0x03
|
||||||
|
|
||||||
#define SATA2_DEV 31
|
#define VTD_DEV 5
|
||||||
#define SATA2_FUNC 5
|
#define VTD_FUNC 0
|
||||||
#define SATA2_DEV_FUNC PCI_DEVFN(SATA2_DEV, SATA2_FUNC)
|
#define VTD_DEVID 0x6f28
|
||||||
|
#define VTD_DEV_FUNC PCI_DEVFN(VTD_DEV, VTD_FUNC)
|
||||||
|
#define VTD_PCI_DEV PCI_DEV(BUS0, VTD_DEV, VTD_FUNC)
|
||||||
|
|
||||||
#define EHCI1_DEV 29
|
#define LPC_DEV 31
|
||||||
#define EHCI1_FUNC 0
|
#define LPC_FUNC 0
|
||||||
#define EHCI1_DEVID 0x8C26
|
#define LPC_DEVID 0x8C42
|
||||||
#define EHCI1_DEV_FUNC PCI_DEVFN(EHCI_DEV1, EHCI_FUNC1)
|
#define LPC_DEVID_ES2 0x8C54
|
||||||
|
#define LPC_DEV_FUNC PCI_DEVFN(LPC_DEV, LPC_FUNC)
|
||||||
|
|
||||||
#define EHCI2_DEV 26
|
#define SATA_DEV 31
|
||||||
#define EHCI2_FUNC 0
|
#define SATA_FUNC 2
|
||||||
#define EHCI2_DEVID 0x8C2D
|
#define AHCI_DEVID 0x8C02
|
||||||
#define EHCI2_DEV_FUNC PCI_DEVFN(EHCI_DEV2, EHCI_FUNC2)
|
#define SATA_DEV_FUNC PCI_DEVFN(SATA_DEV, SATA_FUNC)
|
||||||
|
|
||||||
#define XHCI_DEV 20
|
#define SMBUS_DEV 31
|
||||||
#define XHCI_FUNC 0
|
#define SMBUS_FUNC 3
|
||||||
#define XHCI_DEVID 0x8C31
|
#define SMBUS_DEVID 0x8C22
|
||||||
#define XHCI_FUS_REG 0xE0
|
#define SMBUS_DEV_FUNC PCI_DEVFN(SMBUS_DEV, SMBUS_FUNC)
|
||||||
#define XHCI_FUNC_DISABLE (1 << 0)
|
|
||||||
#define XHCI_USB2PR_REG 0xD0
|
|
||||||
#define XHCI_DEV_FUNC PCI_DEVFN(XHCI_DEV, XHCI_FUNC)
|
|
||||||
|
|
||||||
#define GBE_DEV 25
|
#define SATA2_DEV 31
|
||||||
#define GBE_FUNC 0
|
#define SATA2_FUNC 5
|
||||||
#define GBE_DEVID 0x8C33
|
#define SATA2_DEV_FUNC PCI_DEVFN(SATA2_DEV, SATA2_FUNC)
|
||||||
#define GBE_DEV_FUNC PCI_DEVFN(GBE_DEV, GBE_FUNC)
|
|
||||||
|
|
||||||
#define ME_DEV 22
|
#define EHCI1_DEV 29
|
||||||
#define ME_FUNC 0
|
#define EHCI1_FUNC 0
|
||||||
#define ME_DEVID 0x8C3A
|
#define EHCI1_DEVID 0x8C26
|
||||||
#define ME_DEV_FUNC PCI_DEVFN(ME_DEV, ME_FUNC)
|
#define EHCI1_DEV_FUNC PCI_DEVFN(EHCI_DEV1, EHCI_FUNC1)
|
||||||
|
|
||||||
#define HDA_DEV 27
|
#define EHCI2_DEV 26
|
||||||
#define HDA_FUNC 0
|
#define EHCI2_FUNC 0
|
||||||
#define HDA_DEVID 0x8C20
|
#define EHCI2_DEVID 0x8C2D
|
||||||
#define HDA_DEV_FUNC PCI_DEVFN(HDA_DEV, HDA_FUNC)
|
#define EHCI2_DEV_FUNC PCI_DEVFN(EHCI_DEV2, EHCI_FUNC2)
|
||||||
|
|
||||||
#define PCIE_DEV 28
|
#define XHCI_DEV 20
|
||||||
#define PCIE_PORT1_DEV PCIE_DEV
|
#define XHCI_FUNC 0
|
||||||
#define PCIE_PORT1_FUNC 0
|
#define XHCI_DEVID 0x8C31
|
||||||
#define PCIE_PORT1_DEVID 0x8C10
|
#define XHCI_FUS_REG 0xE0
|
||||||
#define PCIE_PORT2_DEV PCIE_DEV
|
#define XHCI_FUNC_DISABLE (1 << 0)
|
||||||
#define PCIE_PORT2_FUNC 1
|
#define XHCI_USB2PR_REG 0xD0
|
||||||
#define PCIE_PORT2_DEVID 0x8C12
|
#define XHCI_DEV_FUNC PCI_DEVFN(XHCI_DEV, XHCI_FUNC)
|
||||||
#define PCIE_PORT3_DEV PCIE_DEV
|
|
||||||
#define PCIE_PORT3_FUNC 2
|
#define GBE_DEV 25
|
||||||
#define PCIE_PORT3_DEVID 0x8C14
|
#define GBE_FUNC 0
|
||||||
#define PCIE_PORT4_DEV PCIE_DEV
|
#define GBE_DEVID 0x8C33
|
||||||
#define PCIE_PORT4_FUNC 3
|
#define GBE_DEV_FUNC PCI_DEVFN(GBE_DEV, GBE_FUNC)
|
||||||
#define PCIE_PORT4_DEVID 0x8C16
|
|
||||||
#define PCIE_PORT5_DEV PCIE_DEV
|
#define ME_DEV 22
|
||||||
#define PCIE_PORT5_FUNC 4
|
#define ME_FUNC 0
|
||||||
#define PCIE_PORT5_DEVID 0x8C18
|
#define ME_DEVID 0x8C3A
|
||||||
#define PCIE_PORT6_DEV PCIE_DEV
|
#define ME_DEV_FUNC PCI_DEVFN(ME_DEV, ME_FUNC)
|
||||||
#define PCIE_PORT6_FUNC 5
|
|
||||||
#define PCIE_PORT6_DEVID 0x8C1A
|
#define HDA_DEV 27
|
||||||
#define PCIE_PORT7_DEV PCIE_DEV
|
#define HDA_FUNC 0
|
||||||
#define PCIE_PORT7_FUNC 6
|
#define HDA_DEVID 0x8C20
|
||||||
#define PCIE_PORT7_DEVID 0x8C1C
|
#define HDA_DEV_FUNC PCI_DEVFN(HDA_DEV, HDA_FUNC)
|
||||||
#define PCIE_PORT8_DEV PCIE_DEV
|
|
||||||
#define PCIE_PORT8_FUNC 7
|
/* Ports from PCH block with adjustable burification settings */
|
||||||
#define PCIE_PORT8_DEVID 0x8C1E
|
#define PCIE_DEV 28
|
||||||
#define PCIE_PORT1_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT1_FUNC)
|
#define PCIE_PORT1_DEV PCIE_DEV
|
||||||
#define PCIE_PORT2_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT2_FUNC)
|
#define PCIE_PORT1_FUNC 0
|
||||||
#define PCIE_PORT3_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT3_FUNC)
|
#define PCIE_PORT1_DEVID 0x8C10
|
||||||
#define PCIE_PORT4_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT4_FUNC)
|
#define PCIE_PORT2_DEV PCIE_DEV
|
||||||
#define PCIE_PORT5_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT5_FUNC)
|
#define PCIE_PORT2_FUNC 1
|
||||||
#define PCIE_PORT6_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT6_FUNC)
|
#define PCIE_PORT2_DEVID 0x8C12
|
||||||
#define PCIE_PORT7_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT7_FUNC)
|
#define PCIE_PORT3_DEV PCIE_DEV
|
||||||
#define PCIE_PORT8_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT8_FUNC)
|
#define PCIE_PORT3_FUNC 2
|
||||||
|
#define PCIE_PORT3_DEVID 0x8C14
|
||||||
|
#define PCIE_PORT4_DEV PCIE_DEV
|
||||||
|
#define PCIE_PORT4_FUNC 3
|
||||||
|
#define PCIE_PORT4_DEVID 0x8C16
|
||||||
|
#define PCIE_PORT5_DEV PCIE_DEV
|
||||||
|
#define PCIE_PORT5_FUNC 4
|
||||||
|
#define PCIE_PORT5_DEVID 0x8C18
|
||||||
|
#define PCIE_PORT6_DEV PCIE_DEV
|
||||||
|
#define PCIE_PORT6_FUNC 5
|
||||||
|
#define PCIE_PORT6_DEVID 0x8C1A
|
||||||
|
#define PCIE_PORT7_DEV PCIE_DEV
|
||||||
|
#define PCIE_PORT7_FUNC 6
|
||||||
|
#define PCIE_PORT7_DEVID 0x8C1C
|
||||||
|
#define PCIE_PORT8_DEV PCIE_DEV
|
||||||
|
#define PCIE_PORT8_FUNC 7
|
||||||
|
#define PCIE_PORT8_DEVID 0x8C1E
|
||||||
|
#define PCIE_PORT1_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT1_FUNC)
|
||||||
|
#define PCIE_PORT2_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT2_FUNC)
|
||||||
|
#define PCIE_PORT3_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT3_FUNC)
|
||||||
|
#define PCIE_PORT4_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT4_FUNC)
|
||||||
|
#define PCIE_PORT5_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT5_FUNC)
|
||||||
|
#define PCIE_PORT6_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT6_FUNC)
|
||||||
|
#define PCIE_PORT7_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT7_FUNC)
|
||||||
|
#define PCIE_PORT8_DEV_FUNC PCI_DEVFN(PCIE_DEV, PCIE_PORT8_FUNC)
|
||||||
|
|
||||||
/* The SMM device is located on bus 0xff (QPI) */
|
/* The SMM device is located on bus 0xff (QPI) */
|
||||||
#define QPI_BUS 0xff
|
#define QPI_BUS 0xff
|
||||||
|
|
|
@ -27,10 +27,19 @@
|
||||||
#ifndef _BROADWELL_UBOX_H_
|
#ifndef _BROADWELL_UBOX_H_
|
||||||
#define _BROADWELL_UBOX_H_
|
#define _BROADWELL_UBOX_H_
|
||||||
|
|
||||||
|
#include <device/pci_ops.h>
|
||||||
|
#include <soc/pci_devs.h>
|
||||||
|
#include <soc/vtd.h>
|
||||||
|
|
||||||
#define UBOX_UART_ENABLE 0xf8
|
#define UBOX_UART_ENABLE 0xf8
|
||||||
#define UBOX_UART_ENABLE_PORT0 (1u << 0)
|
#define UBOX_UART_ENABLE_PORT0 (1u << 0)
|
||||||
#define UBOX_UART_ENABLE_PORT1 (1u << 1)
|
#define UBOX_UART_ENABLE_PORT1 (1u << 1)
|
||||||
|
|
||||||
#define UBOX_SC_RESET_STATUS 0xc8
|
#define UBOX_SC_RESET_STATUS 0xc8
|
||||||
#define UBOX_SC_BYPASS (1u << 3)
|
#define UBOX_SC_BYPASS (1u << 3)
|
||||||
|
|
||||||
|
#define UBOX_DEVHIDE0 0xb0
|
||||||
|
|
||||||
|
void iio_hide(const uint8_t devno, const uint8_t funcno);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <soc/pci_devs.h>
|
#include <soc/pci_devs.h>
|
||||||
#include <soc/ramstage.h>
|
#include <soc/ramstage.h>
|
||||||
#include <soc/acpi.h>
|
#include <soc/acpi.h>
|
||||||
|
#include <soc/ubox.h>
|
||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
|
|
||||||
typedef struct soc_intel_fsp_broadwell_de_config config_t;
|
typedef struct soc_intel_fsp_broadwell_de_config config_t;
|
||||||
|
@ -250,12 +251,25 @@ void southcluster_enable_dev(struct device *dev)
|
||||||
{
|
{
|
||||||
uint32_t reg32;
|
uint32_t reg32;
|
||||||
|
|
||||||
if (!dev->enabled) {
|
if (dev->enabled)
|
||||||
int slot = PCI_SLOT(dev->path.pci.devfn);
|
return;
|
||||||
int func = PCI_FUNC(dev->path.pci.devfn);
|
|
||||||
printk(BIOS_DEBUG, "%s: Disabling device: %02x.%01x\n",
|
|
||||||
dev_path(dev), slot, func);
|
|
||||||
|
|
||||||
|
const int slot = PCI_SLOT(dev->path.pci.devfn);
|
||||||
|
const int func = PCI_FUNC(dev->path.pci.devfn);
|
||||||
|
|
||||||
|
switch (slot) {
|
||||||
|
case PCIE_IIO_PORT_0_DEV:
|
||||||
|
die("should not hide PCH link");
|
||||||
|
case PCIE_IIO_PORT_1_DEV: /* fallthrough */
|
||||||
|
case PCIE_IIO_PORT_2_DEV: /* fallthrough */
|
||||||
|
case PCIE_IIO_PORT_3_DEV: /* fallthrough */
|
||||||
|
printk(BIOS_DEBUG, "%s: Disabling IOU bridge %02x.%01x\n", dev_path(dev), slot,
|
||||||
|
func);
|
||||||
|
iio_hide(slot, func);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printk(BIOS_DEBUG, "%s: Disabling device: %02x.%01x\n", dev_path(dev), slot,
|
||||||
|
func);
|
||||||
/* Ensure memory, io, and bus master are all disabled */
|
/* Ensure memory, io, and bus master are all disabled */
|
||||||
reg32 = pci_read_config32(dev, PCI_COMMAND);
|
reg32 = pci_read_config32(dev, PCI_COMMAND);
|
||||||
reg32 &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
|
reg32 &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the coreboot project.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2019 Facebook Inc.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; version 2 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define __SIMPLE_DEVICE__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <soc/ubox.h>
|
||||||
|
|
||||||
|
void iio_hide(const uint8_t devno, const uint8_t funcno)
|
||||||
|
{
|
||||||
|
pci_devfn_t ubox_dev;
|
||||||
|
|
||||||
|
ubox_dev = PCI_DEV(get_busno1(), UBOX_DEV, UBOX_FUNC);
|
||||||
|
pci_or_config32(ubox_dev, UBOX_DEVHIDE0 + funcno * 4, 1 << devno);
|
||||||
|
}
|
Loading…
Reference in New Issue