aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/mentor-swupdate/recipes-bsp/grub/amd-wdt/Makefile.core.def7
-rw-r--r--common/mentor-swupdate/recipes-bsp/grub/amd-wdt/amd_wdt.c341
-rw-r--r--common/mentor-swupdate/recipes-bsp/grub/amd-wdt/amd_wdt.h76
-rw-r--r--common/mentor-swupdate/recipes-bsp/grub/grub-efi_2.02.bbappend26
-rw-r--r--common/mentor-swupdate/recipes-core/initrdscripts/files/0001-init-install-efi-SWU-fallback-incase-WDT-fired-SWU-p.patch28
-rw-r--r--common/mentor-swupdate/recipes-core/initrdscripts/files/0002-init-install-efi-SWU-add-setup-WDT-routine-to-enable.patch39
-rw-r--r--common/mentor-swupdate/recipes-core/initrdscripts/files/0003-init-install-efi-SWU-start-the-WDT-as-soon-as-a-menu.patch27
-rw-r--r--common/mentor-swupdate/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bbappend5
-rw-r--r--common/mentor-swupdate/recipes-kernel/amd-wdt/amd-wdt_1.0.bbappend2
-rw-r--r--common/mentor-swupdate/recipes-kernel/amd-wdt/files/0001-amd-wdt-do-not-stop-wdt-as-swupdate-implementation-n.patch31
-rw-r--r--meta-amdfalconx86/conf/local.conf.append.amdfalconx8626
-rw-r--r--meta-r1000/conf/local.conf.append.r100012
-rw-r--r--meta-r1000/conf/machine/r1000.conf4
-rw-r--r--meta-v1000/conf/local.conf.append.v100027
-rw-r--r--meta-v1000/conf/machine/v1000.conf5
-rw-r--r--meta-v1000/recipes-support/opencv/opencv_%.bbappend2
16 files changed, 637 insertions, 21 deletions
diff --git a/common/mentor-swupdate/recipes-bsp/grub/amd-wdt/Makefile.core.def b/common/mentor-swupdate/recipes-bsp/grub/amd-wdt/Makefile.core.def
new file mode 100644
index 00000000..8d562c7f
--- /dev/null
+++ b/common/mentor-swupdate/recipes-bsp/grub/amd-wdt/Makefile.core.def
@@ -0,0 +1,7 @@
+AutoGen definitions Makefile.tpl;
+
+module = {
+ name = amd-wdt;
+ common = contrib/grub-core/amd-wdt/amd_wdt.h;
+ common = contrib/grub-core/amd-wdt/amd_wdt.c;
+};
diff --git a/common/mentor-swupdate/recipes-bsp/grub/amd-wdt/amd_wdt.c b/common/mentor-swupdate/recipes-bsp/grub/amd-wdt/amd_wdt.c
new file mode 100644
index 00000000..9d2e8317
--- /dev/null
+++ b/common/mentor-swupdate/recipes-bsp/grub/amd-wdt/amd_wdt.c
@@ -0,0 +1,341 @@
+/* amd_wdt.c - AMD Watchdog Driver and API for grub cfg & console */
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2019 Mentor Graphics, a Siemens business
+ *
+ * GRUB 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, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Arsalan H. Awan <ArsalanHAwan@github>
+ * Email: Arsalan_Awan@mentor.com
+ */
+
+#include <grub/types.h>
+#include <grub/misc.h>
+#include <grub/mm.h>
+#include <grub/pci.h>
+#include <grub/err.h>
+#include <grub/dl.h>
+#include <grub/extcmd.h>
+#include <grub/i18n.h>
+#include "amd_wdt.h"
+
+#define PCI_VENDOR_ID_AMD 0x1022
+
+//#define AMD_WDT_DEBUG
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static struct
+{
+ grub_uint8_t *ptr;
+ grub_uint8_t fired;
+ int mapped;
+ grub_uint32_t base;
+ grub_pci_device_t dev;
+} watchdog;
+
+static int found = 0;
+
+static void
+writel (grub_uint32_t val, grub_uint8_t reg)
+{
+ watchdog.ptr[reg] = val & 0xff;
+ watchdog.ptr[reg + 1] = (val >> 8) & 0xff;
+ watchdog.ptr[reg + 2] = (val >> 16) & 0xff;
+ watchdog.ptr[reg + 3] = (val >> 24) & 0xff;
+}
+
+static grub_uint32_t
+readl (grub_uint8_t reg)
+{
+ return watchdog.ptr[reg] +
+ (watchdog.ptr[reg + 1] << 8) +
+ (watchdog.ptr[reg + 2] << 16) +
+ (watchdog.ptr[reg + 3] << 24);
+}
+
+static void
+amd_wdt_start (void)
+{
+ grub_uint32_t val;
+ /* Start the watchdog timer */
+ val = readl (AMD_WDT_CONTROL(0));
+ val |= AMD_WDT_START_STOP_BIT;
+ writel (val, AMD_WDT_CONTROL(0));
+}
+
+static void
+amd_wdt_stop (void)
+{
+ grub_uint32_t val;
+ /* Stop the watchdog timer */
+ val = readl (AMD_WDT_CONTROL(0));
+ val &= ~AMD_WDT_START_STOP_BIT;
+ writel (val, AMD_WDT_CONTROL(0));
+}
+
+static void
+amd_wdt_ping (void)
+{
+ grub_uint32_t val;
+ /* Trigger/Ping watchdog timer */
+ val = readl (AMD_WDT_CONTROL(0));
+ val |= AMD_WDT_TRIGGER_BIT;
+ writel (val, AMD_WDT_CONTROL(0));
+}
+
+static grub_uint16_t
+amd_wdt_get_time (void)
+{
+ /* Read watchdog COUNT register */
+ return readl (AMD_WDT_COUNT(0)) & AMD_WDT_COUNT_MASK;
+}
+
+static void
+amd_wdt_set_time (grub_uint32_t t)
+{
+ if (t < AMD_WDT_MIN_TIMEOUT)
+ t = AMD_WDT_MIN_TIMEOUT;
+ else if (t > AMD_WDT_MAX_TIMEOUT)
+ t = AMD_WDT_MAX_TIMEOUT;
+
+ /* Write new timeout value to watchdog COUNT register */
+ writel (t, AMD_WDT_COUNT(0));
+}
+
+static void
+amd_wdt_enable (void)
+{
+ grub_uint8_t val;
+ /* Enable watchdog timer */
+ grub_outb(AMD_PM_WATCHDOG_EN_REG, AMD_IO_PM_INDEX_REG);
+ val = grub_inb(AMD_IO_PM_DATA_REG);
+ val |= AMD_PM_WATCHDOG_TIMER_EN;
+ grub_outb(val, AMD_IO_PM_DATA_REG);
+}
+
+static void
+amd_wdt_disable (void)
+{
+ grub_uint8_t val;
+ /* Disable watchdog timer */
+ grub_outb(AMD_PM_WATCHDOG_EN_REG, AMD_IO_PM_INDEX_REG);
+ val = grub_inb(AMD_IO_PM_DATA_REG);
+ val &= ~AMD_PM_WATCHDOG_TIMER_EN;
+ grub_outb(val, AMD_IO_PM_DATA_REG);
+}
+
+static void
+amd_wdt_set_resolution (grub_uint8_t freq)
+{
+ grub_uint8_t val;
+ /* Set the watchdog timer resolution */
+ grub_outb(AMD_PM_WATCHDOG_CONFIG_REG, AMD_IO_PM_INDEX_REG);
+ val = grub_inb(AMD_IO_PM_DATA_REG);
+ /* Clear the previous frequency setting, if any */
+ val &= ~AMD_PM_WATCHDOG_CONFIG_MASK;
+ /* Set the new frequency value */
+ val |= freq;
+ grub_outb(val, AMD_IO_PM_DATA_REG);
+}
+
+static void
+amd_wdt_set_timeout_action (const char * action)
+{
+ grub_uint32_t val;
+ val = readl (AMD_WDT_CONTROL(0));
+
+ /*
+ * Set the watchdog timeout action.
+ *
+ * If action is specified anything other than reboot or shutdown,
+ * we default it to reboot.
+ */
+ if (grub_strncmp(action, "shutdown", 8) == 0)
+ val |= AMD_WDT_ACTION_RESET_BIT;
+ else
+ val &= ~AMD_WDT_ACTION_RESET_BIT;
+}
+
+static grub_uint8_t
+amd_wdt_check_fired (void)
+{
+ grub_uint32_t val;
+ /* Read watchdog fired bit */
+ val = readl (AMD_WDT_CONTROL(0));
+ return val & AMD_WDT_FIRED_BIT;
+}
+
+static grub_err_t
+grub_cmd_amd_wdt (grub_extcmd_context_t ctxt __attribute__ ((unused)),
+ int argc, char **args)
+{
+ if (argc < 1)
+ return grub_error (GRUB_ERR_BAD_ARGUMENT,
+ N_("usage: amd-wdt <command>\ncommands: enable disable start stop ping getstatus gettime settime"));
+
+ if (grub_strcasecmp (args[0], "enable") == 0)
+ amd_wdt_enable ();
+ else if (grub_strcasecmp (args[0], "disable") == 0)
+ amd_wdt_disable ();
+ else if (grub_strcasecmp (args[0], "start") == 0)
+ {
+ amd_wdt_start ();
+ amd_wdt_ping ();
+ }
+ else if (grub_strcasecmp (args[0], "stop") == 0)
+ amd_wdt_stop ();
+ else if (grub_strcasecmp (args[0], "ping") == 0)
+ amd_wdt_ping ();
+ else if (grub_strcasecmp (args[0], "getstatus") == 0)
+ {
+ grub_printf ("%d", watchdog.fired);
+ return watchdog.fired;
+ }
+ else if (grub_strcasecmp (args[0], "gettime") == 0)
+ grub_printf ("%d", amd_wdt_get_time ());
+ else if (grub_strcasecmp (args[0], "settime") == 0)
+ {
+ amd_wdt_set_time (grub_strtol(args[1], 0, 0));
+ amd_wdt_start ();
+ amd_wdt_ping ();
+ amd_wdt_stop ();
+ }
+ else
+ return grub_error (GRUB_ERR_BAD_ARGUMENT,
+ N_("error: unknown command"));
+
+ return GRUB_ERR_NONE;
+}
+
+/* Helper for finding AMD WDT on the PCI bus */
+static int
+find_wdt (grub_pci_device_t dev,
+ grub_pci_id_t pciid __attribute__ ((unused)),
+ void *data __attribute__ ((unused)))
+{
+ grub_pci_address_t addr;
+ grub_uint32_t device_id;
+ grub_uint32_t vendor_id;
+
+#ifdef AMD_WDT_DEBUG
+ grub_printf ("bus=%d, device=%d, function=%d\n", dev.bus, dev.device, dev.function);
+#endif
+
+ addr = grub_pci_make_address (dev, GRUB_PCI_REG_DEVICE);
+ device_id = grub_pci_read_word (addr);
+
+#ifdef AMD_WDT_DEBUG
+ grub_printf ("addr GRUB_PCI_REG_DEVICE = 0x%x\n", addr);
+#endif
+
+ addr = grub_pci_make_address (dev, GRUB_PCI_REG_VENDOR);
+ vendor_id = grub_pci_read_word (addr);
+
+#ifdef AMD_WDT_DEBUG
+ grub_printf ("addr GRUB_PCI_REG_VENDOR = 0x%x\n", addr);
+
+ grub_printf ("PCI_DEVICE_ID = 0x%x | 0x%x, PCI_VENDOR_ID = 0x%x | 0x%x\n", device_id, PCI_DEVICE_ID_AMD_CARRIZO_SMBUS, vendor_id, PCI_VENDOR_ID_AMD);
+#endif
+
+ if (device_id == PCI_DEVICE_ID_AMD_CARRIZO_SMBUS && vendor_id == PCI_VENDOR_ID_AMD)
+ {
+ watchdog.base = AMD_ACPI_MMIO_BASE + AMD_WDT_MEM_MAP_OFFSET;
+
+#ifdef AMD_WDT_DEBUG
+ grub_printf ("watchdog.base = 0x%x\n", watchdog.base);
+
+ for (grub_uint16_t i=0; i<0x100; i+=4)
+ {
+ addr = grub_pci_make_address (dev, i);
+ grub_printf ("0x%x: 0x%x\n", i, grub_pci_read (addr));
+ }
+#endif
+
+ watchdog.dev = dev;
+ found = 1;
+ return 1;
+ }
+ return 0;
+}
+
+static grub_err_t
+amd_wdt_init (void)
+{
+ grub_pci_iterate (find_wdt, NULL);
+ if (!found)
+ return grub_error (GRUB_ERR_IO, "Couldn't find watchdog timer");
+
+ watchdog.ptr = (void *) grub_pci_device_map_range (watchdog.dev,
+ watchdog.base,
+ AMD_WDT_MEM_MAP_SIZE);
+
+ watchdog.mapped = 1;
+
+#ifdef AMD_WDT_DEBUG
+ grub_printf ("watchdog.ptr = %p\n", watchdog.ptr);
+
+ for (grub_uint16_t i=0; i<AMD_WDT_MEM_MAP_SIZE; i++)
+ {
+ grub_outb(i, AMD_IO_PM_INDEX_REG);
+ grub_printf ("watchdog reg[%d] = 0x%x\n", i, grub_inb(AMD_IO_PM_DATA_REG));
+ }
+#endif
+
+ watchdog.fired = amd_wdt_check_fired ();
+
+ amd_wdt_enable ();
+ amd_wdt_set_resolution (AMD_PM_WATCHDOG_1SEC_RES);
+ amd_wdt_set_timeout_action (_("reboot"));
+ amd_wdt_stop ();
+ amd_wdt_set_time (AMD_WDT_DEFAULT_TIMEOUT);
+
+ grub_printf ("AMD Watchdog setup complete!\n");
+
+ return GRUB_ERR_NONE;
+}
+
+static grub_err_t
+amd_wdt_fini (void)
+{
+ if (watchdog.mapped)
+ grub_pci_device_unmap_range (watchdog.dev,
+ watchdog.ptr,
+ AMD_WDT_MEM_MAP_SIZE);
+
+ return GRUB_ERR_NONE;
+}
+
+static grub_extcmd_t cmd;
+
+GRUB_MOD_INIT(amd-wdt)
+{
+ amd_wdt_init ();
+
+ if (watchdog.mapped)
+ {
+ grub_printf ("watchdog reboot %sdetected\n", watchdog.fired ? "" : "not ");
+
+ cmd = grub_register_extcmd ("amd-wdt", grub_cmd_amd_wdt, 0, 0,
+ N_("AMD Watchdog Timer"), 0);
+ }
+}
+
+GRUB_MOD_FINI(amd-wdt)
+{
+ amd_wdt_fini ();
+
+ if (watchdog.mapped)
+ grub_unregister_extcmd (cmd);
+}
diff --git a/common/mentor-swupdate/recipes-bsp/grub/amd-wdt/amd_wdt.h b/common/mentor-swupdate/recipes-bsp/grub/amd-wdt/amd_wdt.h
new file mode 100644
index 00000000..db7c49a1
--- /dev/null
+++ b/common/mentor-swupdate/recipes-bsp/grub/amd-wdt/amd_wdt.h
@@ -0,0 +1,76 @@
+/*****************************************************************************
+*
+* Copyright (c) 2014, Advanced Micro Devices, Inc.
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of Advanced Micro Devices, Inc. nor the names of
+* its contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*
+***************************************************************************/
+
+#ifndef _AMD_WDT_H_
+#define _AMD_WDT_H_
+
+/* Module and version information */
+#define WDT_VERSION "1.0"
+#define WDT_MODULE_NAME "AMD watchdog timer"
+#define WDT_DRIVER_NAME WDT_MODULE_NAME ", v" WDT_VERSION
+
+#define AMD_WDT_DEFAULT_TIMEOUT 60 /* 60 units default heartbeat. */
+#define AMD_WDT_MIN_TIMEOUT 0x0001 /* minimum timeout value */
+#define AMD_WDT_MAX_TIMEOUT 0xFFFF /* maximum timeout value */
+#define MAX_LENGTH (8 + 1) /* shutdown has 8 characters + NULL character */
+
+/* Watchdog register definitions */
+#define AMD_ACPI_MMIO_BASE 0xFED80000
+#define AMD_WDT_MEM_MAP_OFFSET 0xB00
+#define AMD_WDT_MEM_MAP_SIZE 0x100
+
+#define AMD_WDT_CONTROL(base) ((base) + 0x00) /* Watchdog Control */
+ #define AMD_WDT_START_STOP_BIT (1 << 0)
+ #define AMD_WDT_FIRED_BIT (1 << 1)
+ #define AMD_WDT_ACTION_RESET_BIT (1 << 2)
+ #define AMD_WDT_DISABLE_BIT (1 << 3)
+ /* 6:4 bits Reserved */
+ #define AMD_WDT_TRIGGER_BIT (1 << 7)
+#define AMD_WDT_COUNT(base) ((base) + 0x04) /* Watchdog Count */
+ #define AMD_WDT_COUNT_MASK 0xFFFF
+
+#define AMD_PM_WATCHDOG_EN_REG 0x00
+ #define AMD_PM_WATCHDOG_TIMER_EN (0x01 << 7)
+
+#define AMD_PM_WATCHDOG_CONFIG_REG 0x03
+ #define AMD_PM_WATCHDOG_32USEC_RES 0x0
+ #define AMD_PM_WATCHDOG_10MSEC_RES 0x1
+ #define AMD_PM_WATCHDOG_100MSEC_RES 0x2
+ #define AMD_PM_WATCHDOG_1SEC_RES 0x3
+#define AMD_PM_WATCHDOG_CONFIG_MASK 0x3
+
+/* IO port address for indirect access using ACPI PM registers */
+#define AMD_IO_PM_INDEX_REG 0xCD6
+#define AMD_IO_PM_DATA_REG 0xCD7
+
+#define AMD_ACPI_MMIO_ADDR_MASK ~0x1FFF
+#define PCI_DEVICE_ID_AMD_CARRIZO_SMBUS 0x790B
+
+#endif /* _AMD_WDT_H_ */
diff --git a/common/mentor-swupdate/recipes-bsp/grub/grub-efi_2.02.bbappend b/common/mentor-swupdate/recipes-bsp/grub/grub-efi_2.02.bbappend
new file mode 100644
index 00000000..eac44868
--- /dev/null
+++ b/common/mentor-swupdate/recipes-bsp/grub/grub-efi_2.02.bbappend
@@ -0,0 +1,26 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/amd-wdt:"
+
+SRC_URI_append = " file://Makefile.core.def \
+ file://amd_wdt.h \
+ file://amd_wdt.c"
+
+# GRUB's autogen.sh uses GRUB_CONTRIB var to pick up
+# out-of-tree modules/utils for building inside GRUB
+export GRUB_CONTRIB = "${WORKDIR}/extra-modules"
+
+do_configure_grub_extra_modules () {
+ install -d ${GRUB_CONTRIB}
+ install -d ${GRUB_CONTRIB}/grub-core
+ install -d ${GRUB_CONTRIB}/grub-core/amd-wdt
+ install -m 644 ${WORKDIR}/Makefile.core.def ${GRUB_CONTRIB}/grub-core/
+ install -m 644 ${WORKDIR}/amd_wdt.h ${GRUB_CONTRIB}/grub-core/amd-wdt/
+ install -m 644 ${WORKDIR}/amd_wdt.c ${GRUB_CONTRIB}/grub-core/amd-wdt/
+}
+
+do_configure_grub_extra_modules_class-native () {
+ :
+}
+
+addtask do_configure_grub_extra_modules before do_configure after do_unpack
+
+GRUB_BUILDIN += "amd-wdt"
diff --git a/common/mentor-swupdate/recipes-core/initrdscripts/files/0001-init-install-efi-SWU-fallback-incase-WDT-fired-SWU-p.patch b/common/mentor-swupdate/recipes-core/initrdscripts/files/0001-init-install-efi-SWU-fallback-incase-WDT-fired-SWU-p.patch
new file mode 100644
index 00000000..33a458a0
--- /dev/null
+++ b/common/mentor-swupdate/recipes-core/initrdscripts/files/0001-init-install-efi-SWU-fallback-incase-WDT-fired-SWU-p.patch
@@ -0,0 +1,28 @@
+From 2b8e67eb5899962528ab821754c76abd1bc4aef3 Mon Sep 17 00:00:00 2001
+From: "Arsalan H. Awan" <Arsalan_Awan@mentor.com>
+Date: Thu, 14 Feb 2019 14:31:03 +0500
+Subject: [PATCH 1/3] init-install-efi/SWU: fallback incase WDT fired & SWU
+ performed
+
+Signed-off-by: Arsalan H. Awan <Arsalan_Awan@mentor.com>
+---
+ init-install-efi.sh | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/init-install-efi.sh b/init-install-efi.sh
+index ba0de76..e259785 100644
+--- a/init-install-efi.sh
++++ b/init-install-efi.sh
+@@ -320,6 +320,9 @@ save_env --file ${GRUBENV#\/boot} RFS
+ $cmd
+ }
+ FALL_BACK
++ # Mentor - SWUpdate - set the default boot as per the WDT and SWU status
++ # If WDT fired && SWU performed, fallback to last working state, else normal boot
++ sed -i "/default=boot/a if ! amd-wdt getstatus; then\n if test \$KERNEL != \$FB_KERNEL; then\n set default='fallback'\n fi\nfi\n" $GRUBCFG
+ fi
+
+ if [ -d /run/media/$1/loader ]; then
+--
+2.11.1
+
diff --git a/common/mentor-swupdate/recipes-core/initrdscripts/files/0002-init-install-efi-SWU-add-setup-WDT-routine-to-enable.patch b/common/mentor-swupdate/recipes-core/initrdscripts/files/0002-init-install-efi-SWU-add-setup-WDT-routine-to-enable.patch
new file mode 100644
index 00000000..22d4a626
--- /dev/null
+++ b/common/mentor-swupdate/recipes-core/initrdscripts/files/0002-init-install-efi-SWU-add-setup-WDT-routine-to-enable.patch
@@ -0,0 +1,39 @@
+From 34fb95494f01cd0adbcfae5d113f669336d8cf0c Mon Sep 17 00:00:00 2001
+From: "Arsalan H. Awan" <Arsalan_Awan@mentor.com>
+Date: Fri, 8 Mar 2019 12:05:56 +0500
+Subject: [PATCH 2/3] init-install-efi/SWU: add setup WDT routine to enable if
+ mel_wdt is 1
+
+> set WDT timeout to 60s by default to reboot in case system hangs.
+> start WDT ONLY IF mel_wdt is set to 1.
+>> this allows user to disable the WDT in case the user is doing
+ kernel debugging or so and wants the system to keep running.
+> enable WDT (set mel_wdt=1) by default
+
+Signed-off-by: Arsalan H. Awan <Arsalan_Awan@mentor.com>
+---
+ init-install-efi.sh | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/init-install-efi.sh b/init-install-efi.sh
+index e259785..270b254 100644
+--- a/init-install-efi.sh
++++ b/init-install-efi.sh
+@@ -323,6 +323,14 @@ FALL_BACK
+ # Mentor - SWUpdate - set the default boot as per the WDT and SWU status
+ # If WDT fired && SWU performed, fallback to last working state, else normal boot
+ sed -i "/default=boot/a if ! amd-wdt getstatus; then\n if test \$KERNEL != \$FB_KERNEL; then\n set default='fallback'\n fi\nfi\n" $GRUBCFG
++ # Mentor - SWUpdate - setup routine for WDT
++ sed -i "/menuentry.*boot/i function setup_wdt {\n}\n" $GRUBCFG
++ # > If mel_wdt is set to 1, ONLY THEN start the WDT
++ sed -i "/function setup_wdt/a if test \$mel_wdt -eq 1; then amd-wdt start; fi" $GRUBCFG
++ # > set WDT timeout value to 60s by default
++ sed -i "/function setup_wdt/a amd-wdt settime 60" $GRUBCFG
++ # Mentor - SWUpdate - enable WDT by default
++ sed -i "/menuentry.*boot/i set mel_wdt=1\n" $GRUBCFG
+ fi
+
+ if [ -d /run/media/$1/loader ]; then
+--
+2.11.1
+
diff --git a/common/mentor-swupdate/recipes-core/initrdscripts/files/0003-init-install-efi-SWU-start-the-WDT-as-soon-as-a-menu.patch b/common/mentor-swupdate/recipes-core/initrdscripts/files/0003-init-install-efi-SWU-start-the-WDT-as-soon-as-a-menu.patch
new file mode 100644
index 00000000..cbec24aa
--- /dev/null
+++ b/common/mentor-swupdate/recipes-core/initrdscripts/files/0003-init-install-efi-SWU-start-the-WDT-as-soon-as-a-menu.patch
@@ -0,0 +1,27 @@
+From 64dd7084103bddf314365271981bf535e863e647 Mon Sep 17 00:00:00 2001
+From: "Arsalan H. Awan" <Arsalan_Awan@mentor.com>
+Date: Fri, 8 Mar 2019 12:15:56 +0500
+Subject: [PATCH 3/3] init-install-efi/SWU: start the WDT as soon as a
+ menuentry is selected
+
+Signed-off-by: Arsalan H. Awan <Arsalan_Awan@mentor.com>
+---
+ init-install-efi.sh | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/init-install-efi.sh b/init-install-efi.sh
+index 270b254..502b0ce 100644
+--- a/init-install-efi.sh
++++ b/init-install-efi.sh
+@@ -331,6 +331,8 @@ FALL_BACK
+ sed -i "/function setup_wdt/a amd-wdt settime 60" $GRUBCFG
+ # Mentor - SWUpdate - enable WDT by default
+ sed -i "/menuentry.*boot/i set mel_wdt=1\n" $GRUBCFG
++ # Mentor - SWUpdate - start the WDT as soon as a menuentry is selected
++ sed -i "/menuentry/a setup_wdt" $GRUBCFG
+ fi
+
+ if [ -d /run/media/$1/loader ]; then
+--
+2.11.1
+
diff --git a/common/mentor-swupdate/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bbappend b/common/mentor-swupdate/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bbappend
index 86ad4e1e..60972845 100644
--- a/common/mentor-swupdate/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bbappend
+++ b/common/mentor-swupdate/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bbappend
@@ -5,4 +5,7 @@ SRC_URI += "file://0001-init-install-efi-manage-partitioning-scheme-as-per-M.pat
file://0004-init-install-efi-pick-kernel-and-rootfs-from-grub.en.patch \
file://0005-init-install-efi-create-fallback-entry.patch \
file://0006-init-install-efi-don-t-unnecessarily-set-the-rootfs-.patch \
- file://0007-init-install-efi-grub-don-t-set-a-timeout.patch"
+ file://0007-init-install-efi-grub-don-t-set-a-timeout.patch \
+ file://0001-init-install-efi-SWU-fallback-incase-WDT-fired-SWU-p.patch \
+ file://0002-init-install-efi-SWU-add-setup-WDT-routine-to-enable.patch \
+ file://0003-init-install-efi-SWU-start-the-WDT-as-soon-as-a-menu.patch"
diff --git a/common/mentor-swupdate/recipes-kernel/amd-wdt/amd-wdt_1.0.bbappend b/common/mentor-swupdate/recipes-kernel/amd-wdt/amd-wdt_1.0.bbappend
new file mode 100644
index 00000000..7add9887
--- /dev/null
+++ b/common/mentor-swupdate/recipes-kernel/amd-wdt/amd-wdt_1.0.bbappend
@@ -0,0 +1,2 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+SRC_URI_append = "file://0001-amd-wdt-do-not-stop-wdt-as-swupdate-implementation-n.patch"
diff --git a/common/mentor-swupdate/recipes-kernel/amd-wdt/files/0001-amd-wdt-do-not-stop-wdt-as-swupdate-implementation-n.patch b/common/mentor-swupdate/recipes-kernel/amd-wdt/files/0001-amd-wdt-do-not-stop-wdt-as-swupdate-implementation-n.patch
new file mode 100644
index 00000000..28b865b3
--- /dev/null
+++ b/common/mentor-swupdate/recipes-kernel/amd-wdt/files/0001-amd-wdt-do-not-stop-wdt-as-swupdate-implementation-n.patch
@@ -0,0 +1,31 @@
+From c4024f793cdd2d39e078e1c28ae5744a5808495d Mon Sep 17 00:00:00 2001
+From: "Arsalan H. Awan" <Arsalan_Awan@mentor.com>
+Date: Thu, 14 Feb 2019 11:44:30 +0500
+Subject: [PATCH] amd-wdt: do not stop wdt as swupdate implementation needs it
+
+Mentor SWUpdate as a part of its failsafe update mechanism
+implementation requires the WDT to keep running. So lets not
+disable it.
+
+Signed-off-by: Arsalan H. Awan <Arsalan_Awan@mentor.com>
+---
+ amd_wdt.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/amd_wdt.c b/amd_wdt.c
+index 94c3f57..f3bbd90 100755
+--- a/amd_wdt.c
++++ b/amd_wdt.c
+@@ -325,9 +325,6 @@ static int amd_wdt_init(struct platform_device *dev)
+ amd_wdt_dev.max_timeout = AMD_WDT_MAX_TIMEOUT;
+ watchdog_set_nowayout(&amd_wdt_dev, nowayout);
+
+- /* Make sure watchdog is not running */
+- amd_wdt_stop(&amd_wdt_dev);
+-
+ /* Set Watchdog timeout */
+ amd_wdt_set_timeout(&amd_wdt_dev, heartbeat);
+
+--
+2.11.1
+
diff --git a/meta-amdfalconx86/conf/local.conf.append.amdfalconx86 b/meta-amdfalconx86/conf/local.conf.append.amdfalconx86
index 68cf3405..224e8c60 100644
--- a/meta-amdfalconx86/conf/local.conf.append.amdfalconx86
+++ b/meta-amdfalconx86/conf/local.conf.append.amdfalconx86
@@ -43,17 +43,19 @@ COMMERCIAL_LIC_FLAGS_MULTIMEDIA = "commercial_gstreamer1.0-plugins-ugly \
LICENSE_FLAGS_WHITELIST_append = "${@' ${COMMERCIAL_LIC_FLAGS_MULTIMEDIA}' if bb.utils.to_boolean('${INCLUDE_COMMERCIAL_MULTIMEDIA}') else ''}"
CORE_IMAGE_EXTRA_INSTALL_append = "${@' packagegroup-multimedia-risky' if bb.utils.to_boolean('${INCLUDE_COMMERCIAL_MULTIMEDIA}') else ''}"
-# MEL has support for Vulkan/LunarG SDK components.
-# These components are required to run the Vulkan based applications.
-# In order to include these components in your final
-# image or generating an ADE that can be used to develop for/against these
-# please change the below define to "yes" before building the
-# image or generating ADE.
+# MEL supports various components that can be enabled by setting the corresponding
+# INCLUDE_<component> to "yes".
+# Following is a list of <components> that can be enabled if you want them to be
+# installed/available on your image.
+# Please change the required INCLUDE_<component> to "yes" before building an image, or
+# generating an ADE that can be used to develop apps for these components (if applicable):
+#
+# - VULKAN - Vulkan driver and Loader Layer.
+# It is required to run Vulkan based applications. Vulkan is a new generation graphics
+# and compute API that provides high-efficiency, cross-platform access to modern GPUs.
+#
+# - CODEXL - CodeXL remote agent and some sample applications to verify the GPU debugging
+# and profiling functionality.
+#
INCLUDE_VULKAN ??= "no"
-
-# MEL has support for CodeXL.
-# This include CodeXL remote agent and some sample applications to
-# verify the GPU debugging and profiling functionality.
-# In order to include these components in your final
-# image please change the below define to "yes" before building the image.
INCLUDE_CODEXL ??= "no"
diff --git a/meta-r1000/conf/local.conf.append.r1000 b/meta-r1000/conf/local.conf.append.r1000
new file mode 100644
index 00000000..0ce2e809
--- /dev/null
+++ b/meta-r1000/conf/local.conf.append.r1000
@@ -0,0 +1,12 @@
+# MEL supports various components that can be enabled by setting the corresponding
+# INCLUDE_<component> to "yes".
+# Following is a list of <components> that can be enabled if you want them to be
+# installed/available on your image.
+# Please change the required INCLUDE_<component> to "yes" before building an image, or
+# generating an ADE that can be used to develop apps for these components (if applicable):
+#
+# - OPENCL - The Open Computing Language.
+# Framework for writing programs that execute across heterogeneous platforms consisting
+# of CPUs, GPUs, DSPs, FPGAs and other processors or hardware accelerators.
+#
+INCLUDE_OPENCL ??= "no"
diff --git a/meta-r1000/conf/machine/r1000.conf b/meta-r1000/conf/machine/r1000.conf
index 9aa9a39f..70f9c113 100644
--- a/meta-r1000/conf/machine/r1000.conf
+++ b/meta-r1000/conf/machine/r1000.conf
@@ -14,7 +14,9 @@ require conf/machine/include/tune-r1000.inc
# Add machine specific AMD features and feature pkgs here
VULKAN_PKGS_r1000 = "amdvlk glslang spirv-tools vulkan-loader-layers rgp"
-AMD_PLATFORM_SPECIFIC_PKGS_r1000 += "opencl"
+AMD_PLATFORM_SPECIFIC_PKGS_r1000 += " \
+ ${@bb.utils.contains('INCLUDE_OPENCL', 'yes', 'opencl', '', d)} \
+ "
include conf/machine/include/amd-common-configurations.inc
include conf/machine/include/amd-customer-configurations.inc
diff --git a/meta-v1000/conf/local.conf.append.v1000 b/meta-v1000/conf/local.conf.append.v1000
index 4c5658ec..34518aa6 100644
--- a/meta-v1000/conf/local.conf.append.v1000
+++ b/meta-v1000/conf/local.conf.append.v1000
@@ -40,10 +40,25 @@ COMMERCIAL_LIC_FLAGS_MULTIMEDIA = "commercial_gstreamer1.0-plugins-ugly \
LICENSE_FLAGS_WHITELIST_append = "${@' ${COMMERCIAL_LIC_FLAGS_MULTIMEDIA}' if bb.utils.to_boolean('${INCLUDE_COMMERCIAL_MULTIMEDIA}') else ''}"
CORE_IMAGE_EXTRA_INSTALL_append = "${@' packagegroup-multimedia-risky' if bb.utils.to_boolean('${INCLUDE_COMMERCIAL_MULTIMEDIA}') else ''}"
-# MEL has support for Vulkan/LunarG SDK components.
-# These components are required to run the Vulkan based applications.
-# In order to include these components in your final
-# image or generating an ADE that can be used to develop for/against these
-# please change the below define to "yes" before building the
-# image or generating ADE.
+# MEL supports various components that can be enabled by setting the corresponding
+# INCLUDE_<component> to "yes".
+# Following is a list of <components> that can be enabled if you want them to be
+# installed/available on your image.
+# Please change the required INCLUDE_<component> to "yes" before building an image, or
+# generating an ADE that can be used to develop apps for these components (if applicable):
+#
+# - VULKAN - Vulkan driver and Loader Layer.
+# It is required to run Vulkan based applications. Vulkan is a new generation graphics
+# and compute API that provides high-efficiency, cross-platform access to modern GPUs.
+#
+# - OPENCL - The Open Computing Language.
+# Framework for writing programs that execute across heterogeneous platforms consisting
+# of CPUs, GPUs, DSPs, FPGAs and other processors or hardware accelerators.
+#
+# - OPENCV - The Open Computer Vision Library.
+# Library of programming functions mainly aimed at real-time computer vision. Used for
+# image-processing on input from image/video files and camera etc.
+#
INCLUDE_VULKAN ??= "no"
+INCLUDE_OPENCL ??= "no"
+INCLUDE_OPENCV ??= "no"
diff --git a/meta-v1000/conf/machine/v1000.conf b/meta-v1000/conf/machine/v1000.conf
index 6fd71d22..27215d63 100644
--- a/meta-v1000/conf/machine/v1000.conf
+++ b/meta-v1000/conf/machine/v1000.conf
@@ -14,7 +14,10 @@ require conf/machine/include/tune-v1000.inc
# Add machine specific AMD features and feature pkgs here
VULKAN_PKGS_v1000 = "amdvlk glslang spirv-tools vulkan-loader-layers rgp"
-AMD_PLATFORM_SPECIFIC_PKGS_v1000 += "opencl"
+AMD_PLATFORM_SPECIFIC_PKGS_v1000 += " \
+ ${@bb.utils.contains('INCLUDE_OPENCL', 'yes', 'opencl', '', d)} \
+ ${@bb.utils.contains('INCLUDE_OPENCV', 'yes', 'opencv', '', d)} \
+ "
include conf/machine/include/amd-common-configurations.inc
include conf/machine/include/amd-customer-configurations.inc
diff --git a/meta-v1000/recipes-support/opencv/opencv_%.bbappend b/meta-v1000/recipes-support/opencv/opencv_%.bbappend
new file mode 100644
index 00000000..926175c4
--- /dev/null
+++ b/meta-v1000/recipes-support/opencv/opencv_%.bbappend
@@ -0,0 +1,2 @@
+# We do not support Video4Linux
+PACKAGECONFIG_remove_v1000 = " v4l libv4l"