<p>Subrata Banik has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/23590">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">soc/intel/skylake: Implement Sata SOC override as per SPT-PCH<br><br>This patch ensures soc/sata.c correctly translate pci config<br>offset 0x92 bit 0-2.<br><br>Bit 0-2<br>Port x Enabled (PxE)<br>0 = Disabled. The Port is in the 'off' state and can't detect any devices.<br>1 = Enabled. The port can detect devices.<br><br>Change-Id: I497e367f4b1dd83130c137965df906abf3b8ae0f<br>Signed-off-by: Subrata Banik <subrata.banik@intel.com><br>---<br>M src/soc/intel/skylake/Makefile.inc<br>A src/soc/intel/skylake/sata.c<br>2 files changed, 59 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/23590/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/soc/intel/skylake/Makefile.inc b/src/soc/intel/skylake/Makefile.inc</span><br><span>index ef95cf7..0c7355a 100644</span><br><span>--- a/src/soc/intel/skylake/Makefile.inc</span><br><span>+++ b/src/soc/intel/skylake/Makefile.inc</span><br><span>@@ -58,6 +58,7 @@</span><br><span> ramstage-y += pmc.c</span><br><span> ramstage-y += pmutil.c</span><br><span> ramstage-$(CONFIG_PLATFORM_USES_FSP2_0) += reset.c</span><br><span style="color: hsl(120, 100%, 40%);">+ramstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_SATA) += sata.c</span><br><span> ramstage-y += sd.c</span><br><span> ramstage-y += smmrelocate.c</span><br><span> ramstage-y += spi.c</span><br><span>diff --git a/src/soc/intel/skylake/sata.c b/src/soc/intel/skylake/sata.c</span><br><span>new file mode 100644</span><br><span>index 0000000..d7b6215</span><br><span>--- /dev/null</span><br><span>+++ b/src/soc/intel/skylake/sata.c</span><br><span>@@ -0,0 +1,58 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (C) 2018 Intel Corporation.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+ * it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(120, 100%, 40%);">+ * the Free Software Foundation; version 2 of the License.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <device/device.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <device/pci.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <device/pci_def.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <device/pci_ids.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <intelblocks/sata.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <soc/pci_devs.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define SATA_ABAR_PORT_IMPLEMENTED       0x0c</span><br><span style="color: hsl(120, 100%, 40%);">+#define SATA_PCI_CFG_PORT_CTL_STS 0x92</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static void *get_ahci_bar(device_t dev)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+    uintptr_t bar;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      bar = pci_read_config32(dev, PCI_BASE_ADDRESS_5);</span><br><span style="color: hsl(120, 100%, 40%);">+     return (void *)(bar & ~PCI_BASE_ADDRESS_MEM_ATTR_MASK);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * SATA Port control and Status. By default, the SATA ports are set (by HW)</span><br><span style="color: hsl(120, 100%, 40%);">+ * to the disabled state (e.g. bits[3:0] == '0') as a result of an initial</span><br><span style="color: hsl(120, 100%, 40%);">+ * power on reset. When enabled by software as per SATA port mapping,</span><br><span style="color: hsl(120, 100%, 40%);">+ * the ports can transition between the on, partial and slumber states</span><br><span style="color: hsl(120, 100%, 40%);">+ * and can detect devices. When disabled, the port is in the off state and</span><br><span style="color: hsl(120, 100%, 40%);">+ * can't detect any devices.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+void sata_soc_final(device_t dev)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ void *ahcibar = get_ahci_bar(dev);</span><br><span style="color: hsl(120, 100%, 40%);">+    u32 port_impl, temp;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        /* Set Bus Master */</span><br><span style="color: hsl(120, 100%, 40%);">+  temp = pci_read_config32(dev, PCI_COMMAND);</span><br><span style="color: hsl(120, 100%, 40%);">+   pci_write_config32(dev, PCI_COMMAND, temp | PCI_COMMAND_MASTER);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    /* Read Ports Implemented (GHC_PI) */</span><br><span style="color: hsl(120, 100%, 40%);">+ port_impl = read32(ahcibar + SATA_ABAR_PORT_IMPLEMENTED) & 0x07;</span><br><span style="color: hsl(120, 100%, 40%);">+  /* Port enable */</span><br><span style="color: hsl(120, 100%, 40%);">+     temp = pci_read_config32(dev, SATA_PCI_CFG_PORT_CTL_STS);</span><br><span style="color: hsl(120, 100%, 40%);">+     temp |= port_impl;</span><br><span style="color: hsl(120, 100%, 40%);">+    pci_write_config32(dev, SATA_PCI_CFG_PORT_CTL_STS, temp);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/23590">change 23590</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/23590"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I497e367f4b1dd83130c137965df906abf3b8ae0f </div>
<div style="display:none"> Gerrit-Change-Number: 23590 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Subrata Banik <subrata.banik@intel.com> </div>