From patchwork Fri Feb 20 08:08:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siarhei Siamashka X-Patchwork-Id: 441884 X-Patchwork-Delegate: hdegoede@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 2CB79140077 for ; Fri, 20 Feb 2015 19:08:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B30C54B759; Fri, 20 Feb 2015 09:08:37 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ifwr_rtt08ot; Fri, 20 Feb 2015 09:08:37 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3CBD94B701; Fri, 20 Feb 2015 09:08:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 82DB04B701 for ; Fri, 20 Feb 2015 09:08:34 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7u8j1wsL1DaS for ; Fri, 20 Feb 2015 09:08:34 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com [209.85.217.172]) by theia.denx.de (Postfix) with ESMTPS id 4CE284B6F9 for ; Fri, 20 Feb 2015 09:08:31 +0100 (CET) Received: by lbdu10 with SMTP id u10so4743989lbd.7 for ; Fri, 20 Feb 2015 00:08:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=6QsUaBtYiJ9sTSfi+Y28ALR4R5RxZgzF84ZIHlC17Bk=; b=EmIgBkTxSOe0iNXD+zUPSL46ATJEPlHmNocUxoDabrowk/wPTlGJ9v+fzAmapqe03y hwp/2kxKmR/JSB7aAU6cqpdC6QXZHRVkzTm1TwMDvdcJ6qtpBYZzirgwMqYrcdicJFeD 960g44DDBKgzDBdH4xtB+it7V5f0AFIqw1hdc5FDYCXfuiobXuBqNU0mGEFOSyQ916m2 xQ0h3WNruXT5xBGJ9N7bcLlbzMpZewIhBZocO4oi5hC3PSfcpWOgCTRshGXzl1NUEbG7 s9RaCCJFzEVYgQKlgSXuLQcOP0z+4lbF0QYZtNHZRVs30egmdsYvFWwWnBPwxFPZefQx H1FQ== X-Received: by 10.112.170.100 with SMTP id al4mr7589913lbc.42.1424419711272; Fri, 20 Feb 2015 00:08:31 -0800 (PST) Received: from localhost.localdomain (85-76-116-134-nat.elisa-mobile.fi. [85.76.116.134]) by mx.google.com with ESMTPSA id ms3sm4640186lbb.4.2015.02.20.00.08.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Feb 2015 00:08:30 -0800 (PST) From: Siarhei Siamashka To: u-boot@lists.denx.de Date: Fri, 20 Feb 2015 10:08:26 +0200 Message-Id: <1424419706-4687-1-git-send-email-siarhei.siamashka@gmail.com> X-Mailer: git-send-email 2.0.5 Cc: Ian Campbell , TsvetanUsunov , Lars Doelle Subject: [U-Boot] [PATCH] sunxi: Machine id hack to prevent loading buggy sunxi-3.4 kernels X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Store the 'compatibility revision' number in the top 4 bits of the machine id and pass it to the kernel. The old buggy kernels will fail to load with a very much googlable error message on the serial console: "Error: unrecognized/unsupported machine ID (r1 = 0x100010bb)" This error message can be documented in the linux-sunxi wiki with proper explanations about how to resolve this situation and where to get the necessary bugfixes for the sunxi-3.4 kernel. The fixed sunxi-3.4 kernels can implement a revision compatibility check and clear the top 4 bits of the machine id if everything is alright. Signed-off-by: Siarhei Siamashka --- To be used together with: https://groups.google.com/forum/#!topic/linux-sunxi/LOAxP3kAYs8 include/configs/sun4i.h | 4 ++-- include/configs/sun5i.h | 4 ++-- include/configs/sun7i.h | 4 ++-- include/configs/sunxi-common.h | 7 +++++++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/include/configs/sun4i.h b/include/configs/sun4i.h index 87d269b..1537e53 100644 --- a/include/configs/sun4i.h +++ b/include/configs/sun4i.h @@ -13,8 +13,6 @@ */ #define CONFIG_CLK_FULL_SPEED 1008000000 -#define CONFIG_MACH_TYPE 4104 - #ifdef CONFIG_USB_EHCI #define CONFIG_USB_EHCI_SUNXI #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 @@ -25,4 +23,6 @@ */ #include +#define CONFIG_MACH_TYPE (4104 | ((CONFIG_MACH_TYPE_COMPAT_REV) << 28)) + #endif /* __CONFIG_H */ diff --git a/include/configs/sun5i.h b/include/configs/sun5i.h index 52e3a6f..e755531 100644 --- a/include/configs/sun5i.h +++ b/include/configs/sun5i.h @@ -13,8 +13,6 @@ */ #define CONFIG_CLK_FULL_SPEED 1008000000 -#define CONFIG_MACH_TYPE 4138 - #ifdef CONFIG_USB_EHCI #define CONFIG_USB_EHCI_SUNXI #define CONFIG_USB_MAX_CONTROLLER_COUNT 1 @@ -25,4 +23,6 @@ */ #include +#define CONFIG_MACH_TYPE (4138 | ((CONFIG_MACH_TYPE_COMPAT_REV) << 28)) + #endif /* __CONFIG_H */ diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h index 7cd7890..f817f73 100644 --- a/include/configs/sun7i.h +++ b/include/configs/sun7i.h @@ -14,8 +14,6 @@ */ #define CONFIG_CLK_FULL_SPEED 912000000 -#define CONFIG_MACH_TYPE 4283 - #ifdef CONFIG_USB_EHCI #define CONFIG_USB_EHCI_SUNXI #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 @@ -31,4 +29,6 @@ */ #include +#define CONFIG_MACH_TYPE (4283 | ((CONFIG_MACH_TYPE_COMPAT_REV) << 28)) + #endif /* __CONFIG_H */ diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 5ece020..f3e764a 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -14,6 +14,13 @@ #define _SUNXI_COMMON_CONFIG_H /* + * Compatibility guard to prevent loading old buggy sunxi-3.4 kernels. + * Only sunxi-3.4 kernels with appropriate fixes applied are able to + * pass beyond the machine id check. + */ +#define CONFIG_MACH_TYPE_COMPAT_REV 1 + +/* * High Level Configuration Options */ #define CONFIG_SUNXI /* sunxi family */