Lijian Zhao (lijian.zhao(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17181
-gerrit
commit 0032143e1add5ddb4919708a065a0b91f6872cea
Author: Lijian Zhao <lijian.zhao(a)intel.com>
Date: Fri Oct 28 11:01:09 2016 -0700
soc/intel/apollolake: Add pmc_ipc device support
A dedicated pmc_ipc DSDT entry is required for pmc_ipc kernel driver.
The ACPI mode entry includes resources for PMC_IPC1, SRAM, ACPI IO and
Punit Mailbox.
BRANCH=None
BUG=chrome-os-partner:57364
TEST=Boot up into OS successfully and check with dmesg to see the
driver has been loaded successfully without errors.
Change-Id: Ib0a300febe1e7fc1796bfeca1a04493f932640e1
Signed-off-by: Lijian Zhao <lijian.zhao(a)intel.com>
---
src/soc/intel/apollolake/acpi/pmc_ipc.asl | 60 +++++++++++++++++++++++++++
src/soc/intel/apollolake/acpi/southbridge.asl | 3 ++
2 files changed, 63 insertions(+)
diff --git a/src/soc/intel/apollolake/acpi/pmc_ipc.asl b/src/soc/intel/apollolake/acpi/pmc_ipc.asl
new file mode 100644
index 0000000..c958c16
--- /dev/null
+++ b/src/soc/intel/apollolake/acpi/pmc_ipc.asl
@@ -0,0 +1,60 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2016 Intel Corp.
+ *
+ * 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.
+ */
+
+#include <soc/iomap.h>
+
+#define MAILBOX_DATA 0x7080
+#define MAILBOX_INTF 0x7084
+#define PMIO_LENGTH 0x80
+#define PMIO_LIMIT 0x480
+
+scope (\_SB) {
+ Device (IPC1)
+ {
+ Name (_HID, "INT34D2")
+ Name (_CID, "INT34D2")
+ Name (_DDN, "Intel(R) IPC1 Controller")
+ Name (RBUF, ResourceTemplate ()
+ {
+ Memory32Fixed (ReadWrite, 0x0, 0x2000, IBAR)
+ Memory32Fixed (ReadWrite, 0x0, 0x4, MDAT)
+ Memory32Fixed (ReadWrite, 0x0, 0x4, MINF)
+ IO (Decode16, ACPI_PMIO_BASE, PMIO_LIMIT,
+ 0x04, PMIO_LENGTH)
+ Memory32Fixed (ReadWrite, 0x0, 0x2000, SBAR)
+ Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, , , )
+ {
+ PMC_INT
+ }
+ })
+
+ Method (_CRS, 0x0, NotSerialized)
+ {
+ CreateDwordField (^RBUF, ^IBAR._BAS, IBAS)
+ Store (PMC_BAR0, IBAS)
+
+ CreateDwordField (^RBUF, ^MDAT._BAS, MDBA)
+ Store (MCH_BASE_ADDR + MAILBOX_DATA, MDBA)
+ CreateDwordField (^RBUF, ^MINF._BAS, MIBA)
+ Store (MCH_BASE_ADDR + MAILBOX_INTF, MIBA)
+
+ CreateDwordField (^RBUF, ^SBAR._BAS, SBAS)
+ Store (PMC_SRAM_BASE_0, SBAS)
+
+ Return (^RBUF)
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/soc/intel/apollolake/acpi/southbridge.asl b/src/soc/intel/apollolake/acpi/southbridge.asl
index 1c10f1a..e3ee1ae 100644
--- a/src/soc/intel/apollolake/acpi/southbridge.asl
+++ b/src/soc/intel/apollolake/acpi/southbridge.asl
@@ -46,5 +46,8 @@ Scope (\_SB)
/* eMMC */
#include "scs.asl"
+/* PMC IPC controller */
+#include "pmc_ipc.asl"
+
/* PCI _OSC */
#include <soc/intel/common/acpi/pci_osc.asl>
Nico Huber (nico.h(a)gmx.de) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16951
-gerrit
commit 6e4dced10ef74db2f6ad5d6441606f5430a7a844
Author: Nico Huber <nico.huber(a)secunet.com>
Date: Wed Oct 5 17:46:49 2016 +0200
Hook up libhwbase in ramstage
It's hidden behind a configuration option `CONFIG_RAMSTAGE_LIBHWBASE`.
This also adds some glue code to use the coreboot console for debug
output and our monotonic timer framework as timer backend.
v2: Also update 3rdparty/libhwbase to the latest master commit.
Change-Id: I8e8d50271b46aac1141f95ab55ad323ac0889a8d
Signed-off-by: Nico Huber <nico.huber(a)secunet.com>
---
3rdparty/libhwbase | 2 +-
src/Kconfig | 9 +++++++
src/console/Kconfig | 9 +++++++
src/console/Makefile.inc | 4 +++
src/console/hw-debug_sink.adb | 59 +++++++++++++++++++++++++++++++++++++++++++
src/console/hw-debug_sink.ads | 24 ++++++++++++++++++
src/lib/Makefile.inc | 10 ++++++++
src/lib/gnat/Makefile.inc | 2 +-
src/lib/hw-time-timer.adb | 48 +++++++++++++++++++++++++++++++++++
9 files changed, 165 insertions(+), 2 deletions(-)
diff --git a/3rdparty/libhwbase b/3rdparty/libhwbase
index 5e9b1b5..aab715f 160000
--- a/3rdparty/libhwbase
+++ b/3rdparty/libhwbase
@@ -1 +1 @@
-Subproject commit 5e9b1b50e7ac90f68ca2ea798ef656ac863c2851
+Subproject commit aab715f166bf1b54cfbd6982e8df49248ea544d8
diff --git a/src/Kconfig b/src/Kconfig
index d6af6eb..1b915af 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -1248,3 +1248,12 @@ config RAMSTAGE_ADA
def_bool n
help
Selected by features that use Ada code in ramstage.
+
+config RAMSTAGE_LIBHWBASE
+ def_bool n
+ select RAMSTAGE_ADA
+ help
+ Selected by features that require `libhwbase` in ramstage.
+
+config HWBASE_DYNAMIC_MMIO
+ def_bool y
diff --git a/src/console/Kconfig b/src/console/Kconfig
index 8f74613..caf91ab 100644
--- a/src/console/Kconfig
+++ b/src/console/Kconfig
@@ -399,4 +399,13 @@ config NO_EARLY_BOOTBLOCK_POSTCODES
POST codes that go out before the chipset's bootblock initialization
can happen. This option suppresses those POST codes.
+config HWBASE_DEBUG_CB
+ bool
+ default y if DEFAULT_CONSOLE_LOGLEVEL_7 || DEFAULT_CONSOLE_LOGLEVEL_8
+ default n
+
+config HWBASE_DEBUG_NULL
+ def_bool y
+ depends on !HWBASE_DEBUG_CB
+
endmenu
diff --git a/src/console/Makefile.inc b/src/console/Makefile.inc
index 059dea5..aa0dbf5 100644
--- a/src/console/Makefile.inc
+++ b/src/console/Makefile.inc
@@ -2,6 +2,10 @@ ramstage-y += vtxprintf.c printk.c vsprintf.c
ramstage-y += init.c console.c
ramstage-y += post.c
ramstage-y += die.c
+ifeq ($(CONFIG_HWBASE_DEBUG_CB),y)
+ramstage-$(CONFIG_RAMSTAGE_LIBHWBASE) += hw-debug_sink.ads
+ramstage-$(CONFIG_RAMSTAGE_LIBHWBASE) += hw-debug_sink.adb
+endif
smm-$(CONFIG_DEBUG_SMI) += init.c console.c vtxprintf.c printk.c
smm-$(CONFIG_SMM_TSEG) += die.c
diff --git a/src/console/hw-debug_sink.adb b/src/console/hw-debug_sink.adb
new file mode 100644
index 0000000..5a16556
--- /dev/null
+++ b/src/console/hw-debug_sink.adb
@@ -0,0 +1,59 @@
+--
+-- This file is part of the coreboot project.
+--
+-- Copyright (C) 2015 secunet Security Networks AG
+--
+-- 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.
+--
+
+with Interfaces.C;
+
+use type Interfaces.C.int;
+
+package body HW.Debug_Sink is
+
+ Sink_Enabled : Boolean;
+
+ procedure console_tx_byte (chr : Interfaces.C.char);
+ pragma Import (C, console_tx_byte, "console_tx_byte");
+
+ procedure Put (Item : String) is
+ begin
+ if Sink_Enabled then
+ for Idx in Item'Range loop
+ console_tx_byte (Interfaces.C.To_C (Item (Idx)));
+ end loop;
+ end if;
+ end Put;
+
+ procedure Put_Char (Item : Character) is
+ begin
+ if Sink_Enabled then
+ console_tx_byte (Interfaces.C.To_C (Item));
+ end if;
+ end Put_Char;
+
+ procedure New_Line is
+ begin
+ Put_Char (Character'Val (16#0a#));
+ end New_Line;
+
+ ----------------------------------------------------------------------------
+
+ function console_log_level
+ (msg_level : Interfaces.C.int)
+ return Interfaces.C.int;
+ pragma Import (C, console_log_level, "console_log_level");
+
+ Msg_Level_BIOS_DEBUG : constant := 7;
+
+begin
+ Sink_Enabled := console_log_level (Msg_Level_BIOS_DEBUG) /= 0;
+end HW.Debug_Sink;
diff --git a/src/console/hw-debug_sink.ads b/src/console/hw-debug_sink.ads
new file mode 100644
index 0000000..322249e
--- /dev/null
+++ b/src/console/hw-debug_sink.ads
@@ -0,0 +1,24 @@
+--
+-- This file is part of the coreboot project.
+--
+-- Copyright (C) 2015 secunet Security Networks AG
+--
+-- 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.
+--
+
+package HW.Debug_Sink is
+
+ procedure Put (Item : String);
+
+ procedure Put_Char (Item : Character);
+
+ procedure New_Line;
+
+end HW.Debug_Sink;
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 67f8364..d654f27 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -261,3 +261,13 @@ $(objcbfs)/%.debug.rmod: $(objcbfs)/%.debug | $(RMODTOOL)
$(obj)/%.elf.rmod: $(obj)/%.elf | $(RMODTOOL)
$(RMODTOOL) -i $< -o $@
+
+ifeq ($(CONFIG_RAMSTAGE_LIBHWBASE),y)
+
+$(call add-special-class,hw)
+hw-handler = $(eval ramstage-srcs += $$(addprefix $(1),$(2)))
+subdirs-y += ../../3rdparty/libhwbase
+
+ramstage-$(CONFIG_HAVE_MONOTONIC_TIMER) += hw-time-timer.adb
+
+endif # CONFIG_RAMSTAGE_LIBHWBASE
diff --git a/src/lib/gnat/Makefile.inc b/src/lib/gnat/Makefile.inc
index 394c838..9c68624 100644
--- a/src/lib/gnat/Makefile.inc
+++ b/src/lib/gnat/Makefile.inc
@@ -62,5 +62,5 @@ $(foreach arch,$(standard-archs), \
$(eval $(call libgnat-template,$(arch))))
ifeq ($(CONFIG_RAMSTAGE_ADA),y)
-ramstage-libs += $$(obj)/libgnat-$(ARCH-ramstage-y)/libgnat.a
+ramstage-libs += $(obj)/libgnat-$(ARCH-ramstage-y)/libgnat.a
endif
diff --git a/src/lib/hw-time-timer.adb b/src/lib/hw-time-timer.adb
new file mode 100644
index 0000000..643cc98
--- /dev/null
+++ b/src/lib/hw-time-timer.adb
@@ -0,0 +1,48 @@
+--
+-- This file is part of the coreboot project.
+--
+-- Copyright (C) 2016 secunet Security Networks AG
+--
+-- 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.
+--
+
+with Interfaces.C;
+
+package body HW.Time.Timer
+ with Refined_State => (Timer_State => null,
+ Abstract_Time => null)
+is
+
+ procedure Timer_Monotonic_Get (MT : out Interfaces.C.long);
+ pragma Import (C, Timer_Monotonic_Get, "timer_monotonic_get");
+
+ function Raw_Value_Min return T
+ with
+ SPARK_Mode => Off
+ is
+ Microseconds : Interfaces.C.long;
+ begin
+ Timer_Monotonic_Get (Microseconds);
+ return T (Microseconds);
+ end Raw_Value_Min;
+
+ function Raw_Value_Max return T
+ is
+ begin
+ return Raw_Value_Min + 1;
+ end Raw_Value_Max;
+
+ function Hz return T
+ is
+ begin
+ return 1_000_000;
+ end Hz;
+
+end HW.Time.Timer;
Nico Huber (nico.h(a)gmx.de) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16944
-gerrit
commit 88430a483cb0fc86a1942747c6fdc9615c5e5107
Author: Nico Huber <nico.huber(a)secunet.com>
Date: Fri Oct 7 12:58:17 2016 +0200
Add option to use Ada code in ramstage
Change-Id: I11417db21f16bf3007739a097d63fd592344bce3
Signed-off-by: Nico Huber <nico.huber(a)secunet.com>
---
src/Kconfig | 5 +++++
src/include/adainit.h | 23 +++++++++++++++++++++++
src/lib/gnat/Makefile.inc | 4 ++++
src/lib/hardwaremain.c | 3 +++
4 files changed, 35 insertions(+)
diff --git a/src/Kconfig b/src/Kconfig
index e337a1a..d6af6eb 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -1243,3 +1243,8 @@ config CHECKLIST_DATA_FILE_LOCATION
symbols contained only in <stage>_complete.dat will be flagged as
required and not implemented if a weak implementation is found in the
resulting image.
+
+config RAMSTAGE_ADA
+ def_bool n
+ help
+ Selected by features that use Ada code in ramstage.
diff --git a/src/include/adainit.h b/src/include/adainit.h
new file mode 100644
index 0000000..191fff1
--- /dev/null
+++ b/src/include/adainit.h
@@ -0,0 +1,23 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * 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.
+ */
+
+#ifndef _ADAINIT_H
+#define _ADAINIT_H
+
+#if IS_ENABLED(CONFIG_RAMSTAGE_ADA)
+void ramstage_adainit(void);
+#else
+static inline void ramstage_adainit(void) {}
+#endif
+
+#endif /* _ADAINIT_H */
diff --git a/src/lib/gnat/Makefile.inc b/src/lib/gnat/Makefile.inc
index 6ba274a..394c838 100644
--- a/src/lib/gnat/Makefile.inc
+++ b/src/lib/gnat/Makefile.inc
@@ -60,3 +60,7 @@ $(foreach arch,$(standard-archs), \
$(foreach arch,$(standard-archs), \
$(eval $(call libgnat-template,$(arch))))
+
+ifeq ($(CONFIG_RAMSTAGE_ADA),y)
+ramstage-libs += $$(obj)/libgnat-$(ARCH-ramstage-y)/libgnat.a
+endif
diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c
index ab4d9f4..f529720 100644
--- a/src/lib/hardwaremain.c
+++ b/src/lib/hardwaremain.c
@@ -18,6 +18,7 @@
* C Bootstrap code for the coreboot
*/
+#include <adainit.h>
#include <arch/exception.h>
#include <bootstate.h>
#include <console/console.h>
@@ -429,6 +430,8 @@ static void boot_state_schedule_static_entries(void)
void main(void)
{
+ ramstage_adainit();
+
/* TODO: Understand why this is here and move to arch/platform code. */
/* For MMIO UART this needs to be called before any other printk. */
if (IS_ENABLED(CONFIG_ARCH_X86))