mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Oleksij Rempel <linux@rempel-privat.de>
To: barebox@lists.infradead.org
Cc: Oleksij Rempel <linux@rempel-privat.de>
Subject: [RFC PATCH 5/7] MIPS: ath79: add kexec support
Date: Sun, 29 Apr 2018 15:09:05 +0200	[thread overview]
Message-ID: <20180429130907.20506-6-linux@rempel-privat.de> (raw)
In-Reply-To: <20180429130907.20506-1-linux@rempel-privat.de>

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 arch/mips/Kconfig             |  1 +
 arch/mips/mach-ath79/Makefile |  1 +
 arch/mips/mach-ath79/reboot.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 44 insertions(+)
 create mode 100644 arch/mips/mach-ath79/reboot.c

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index c2c555dc3..2b549373a 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -73,6 +73,7 @@ config MACH_MIPS_ATH79
 	select CLKDEV_LOOKUP
 	select OFTREE
 	select GPIOLIB
+	select HAS_KEXEC
 
 config MACH_MIPS_BCM47XX
 	bool "Broadcom BCM47xx-based boards"
diff --git a/arch/mips/mach-ath79/Makefile b/arch/mips/mach-ath79/Makefile
index 3772daeba..9b8218dd6 100644
--- a/arch/mips/mach-ath79/Makefile
+++ b/arch/mips/mach-ath79/Makefile
@@ -1,2 +1,3 @@
 obj-y += reset.o
 obj-y += bbu.o
+obj-$(CONFIG_KEXEC) += reboot.o
diff --git a/arch/mips/mach-ath79/reboot.c b/arch/mips/mach-ath79/reboot.c
new file mode 100644
index 000000000..c207c58d3
--- /dev/null
+++ b/arch/mips/mach-ath79/reboot.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2018 Antony Pavlov <antonynpavlov@gmail.com>
+ *
+ * This file is part of barebox.
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * 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 <common.h>
+#include <init.h>
+#include <memory.h>
+#include <boot.h>
+#include <linux/reboot.h>
+#include <bootm.h>
+#include "../../../lib/kexec/kexec.h"
+#include <asm/io.h>
+
+int reboot(int cmd, void *opaque)
+{
+	if (cmd == LINUX_REBOOT_CMD_KEXEC) {
+		extern unsigned long reboot_code_buffer;
+		void (*kexec_code_buffer)(void);
+
+		shutdown_barebox();
+
+		kexec_code_buffer = phys_to_virt(reboot_code_buffer);
+
+		kexec_code_buffer();
+	}
+
+	return -1;
+}
+EXPORT_SYMBOL(reboot);
-- 
2.14.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-04-29 13:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-29 13:09 [RFC PATCH 0/7] provide ELF/KEXEC support for MIPS ath79 and malta Oleksij Rempel
2018-04-29 13:09 ` [RFC PATCH 1/7] resource: add create_resource() helper function Oleksij Rempel
2018-04-29 13:09 ` [RFC PATCH 2/7] filetype: add ELF type Oleksij Rempel
2018-04-29 13:09 ` [RFC PATCH 3/7] bootm: add kexec ELF support Oleksij Rempel
2018-05-04  5:54   ` Sascha Hauer
2018-05-04 10:08     ` Antony Pavlov
2018-05-04  9:53       ` Oleksij Rempel
2018-05-04 13:09         ` Antony Pavlov
2018-04-29 13:09 ` [RFC PATCH 4/7] MIPS: add kexec ELF loading support Oleksij Rempel
2018-04-29 13:09 ` Oleksij Rempel [this message]
2018-04-29 13:09 ` [RFC PATCH 6/7] MIPS: malta: enable kexec Oleksij Rempel
2018-04-29 13:09 ` [RFC PATCH 7/7] MIPS: configs: add KEXEC=y to atheros devices Oleksij Rempel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180429130907.20506-6-linux@rempel-privat.de \
    --to=linux@rempel-privat.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox