summaryrefslogtreecommitdiff
path: root/arch/x86/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/cpu')
-rw-r--r--arch/x86/cpu/coreboot/pci.c3
-rw-r--r--arch/x86/cpu/irq.c7
-rw-r--r--arch/x86/cpu/ivybridge/bd82x6x.c47
3 files changed, 54 insertions, 3 deletions
diff --git a/arch/x86/cpu/coreboot/pci.c b/arch/x86/cpu/coreboot/pci.c
index 41e29a6086..7f5087a918 100644
--- a/arch/x86/cpu/coreboot/pci.c
+++ b/arch/x86/cpu/coreboot/pci.c
@@ -14,7 +14,8 @@
#include <pci.h>
static const struct udevice_id generic_pch_ids[] = {
- { .compatible = "intel,pch" },
+ { .compatible = "intel,pch7" },
+ { .compatible = "intel,pch9" },
{ }
};
diff --git a/arch/x86/cpu/irq.c b/arch/x86/cpu/irq.c
index 35b29f69d8..205405b95f 100644
--- a/arch/x86/cpu/irq.c
+++ b/arch/x86/cpu/irq.c
@@ -97,6 +97,7 @@ static int create_pirq_routing_table(void)
struct irq_routing_table *rt;
struct irq_info *slot, *slot_base;
int irq_entries = 0;
+ int parent;
int i;
int ret;
@@ -106,7 +107,11 @@ static int create_pirq_routing_table(void)
return -EINVAL;
}
- ret = fdtdec_get_pci_addr(blob, node, FDT_PCI_SPACE_CONFIG,
+ /* TODO(sjg@chromium.org): Drop this when PIRQ is a driver */
+ parent = fdt_parent_offset(blob, node);
+ if (parent < 0)
+ return -EINVAL;
+ ret = fdtdec_get_pci_addr(blob, parent, FDT_PCI_SPACE_CONFIG,
"reg", &addr);
if (ret)
return ret;
diff --git a/arch/x86/cpu/ivybridge/bd82x6x.c b/arch/x86/cpu/ivybridge/bd82x6x.c
index 434dfd649f..c000aca856 100644
--- a/arch/x86/cpu/ivybridge/bd82x6x.c
+++ b/arch/x86/cpu/ivybridge/bd82x6x.c
@@ -3,12 +3,12 @@
*
* SPDX-License-Identifier: GPL-2.0+
*/
-
#include <common.h>
#include <dm.h>
#include <errno.h>
#include <fdtdec.h>
#include <malloc.h>
+#include <pch.h>
#include <asm/lapic.h>
#include <asm/pci.h>
#include <asm/arch/bd82x6x.h>
@@ -16,6 +16,8 @@
#include <asm/arch/pch.h>
#include <asm/arch/sandybridge.h>
+#define BIOS_CTRL 0xdc
+
void bd82x6x_pci_init(pci_dev_t dev)
{
u16 reg16;
@@ -96,6 +98,7 @@ static int bd82x6x_probe(struct udevice *dev)
return 0;
}
+/* TODO(sjg@chromium.org): Move this to the PCH init() method */
int bd82x6x_init(void)
{
const void *blob = gd->fdt_blob;
@@ -116,6 +119,47 @@ int bd82x6x_init(void)
return 0;
}
+static int bd82x6x_pch_get_sbase(struct udevice *dev, ulong *sbasep)
+{
+ u32 rcba;
+
+ dm_pci_read_config32(dev, PCH_RCBA, &rcba);
+ /* Bits 31-14 are the base address, 13-1 are reserved, 0 is enable */
+ rcba = rcba & 0xffffc000;
+ *sbasep = rcba + 0x3800;
+
+ return 0;
+}
+
+static enum pch_version bd82x6x_pch_get_version(struct udevice *dev)
+{
+ return PCHV_9;
+}
+
+static int bd82x6x_set_spi_protect(struct udevice *dev, bool protect)
+{
+ uint8_t bios_cntl;
+
+ /* Adjust the BIOS write protect and SMM BIOS Write Protect Disable */
+ dm_pci_read_config8(dev, BIOS_CTRL, &bios_cntl);
+ if (protect) {
+ bios_cntl &= ~BIOS_CTRL_BIOSWE;
+ bios_cntl |= BIT(5);
+ } else {
+ bios_cntl |= BIOS_CTRL_BIOSWE;
+ bios_cntl &= ~BIT(5);
+ }
+ dm_pci_write_config8(dev, BIOS_CTRL, bios_cntl);
+
+ return 0;
+}
+
+static const struct pch_ops bd82x6x_pch_ops = {
+ .get_sbase = bd82x6x_pch_get_sbase,
+ .get_version = bd82x6x_pch_get_version,
+ .set_spi_protect = bd82x6x_set_spi_protect,
+};
+
static const struct udevice_id bd82x6x_ids[] = {
{ .compatible = "intel,bd82x6x" },
{ }
@@ -126,4 +170,5 @@ U_BOOT_DRIVER(bd82x6x_drv) = {
.id = UCLASS_PCH,
.of_match = bd82x6x_ids,
.probe = bd82x6x_probe,
+ .ops = &bd82x6x_pch_ops,
};