From patchwork Wed Feb 4 05:07:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 436135 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B145D140168 for ; Wed, 4 Feb 2015 16:09:02 +1100 (AEDT) Received: from ozlabs.org (ozlabs.org [103.22.144.67]) by lists.ozlabs.org (Postfix) with ESMTP id A00B51A08E2 for ; Wed, 4 Feb 2015 16:09:02 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e23smtp07.au.ibm.com (e23smtp07.au.ibm.com [202.81.31.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id A7D3E1A08AB for ; Wed, 4 Feb 2015 16:08:56 +1100 (AEDT) Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Feb 2015 15:08:56 +1000 Received: from d23dlp03.au.ibm.com (202.81.31.214) by e23smtp07.au.ibm.com (202.81.31.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 4 Feb 2015 15:08:54 +1000 Received: from d23relay07.au.ibm.com (d23relay07.au.ibm.com [9.190.26.37]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 995953578048 for ; Wed, 4 Feb 2015 16:08:52 +1100 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay07.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t1458i9V45351090 for ; Wed, 4 Feb 2015 16:08:52 +1100 Received: from d23av04.au.ibm.com (localhost [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t1458JqQ016169 for ; Wed, 4 Feb 2015 16:08:19 +1100 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t1458JkA015663; Wed, 4 Feb 2015 16:08:19 +1100 Received: from localhost (haven.au.ibm.com [9.192.253.15]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id DC4ADA027F; Wed, 4 Feb 2015 16:07:55 +1100 (AEDT) From: Alistair Popple To: skiboot@lists.ozlabs.org Date: Wed, 4 Feb 2015 16:07:44 +1100 Message-Id: <1423026466-31386-3-git-send-email-alistair@popple.id.au> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1423026466-31386-1-git-send-email-alistair@popple.id.au> References: <1423026466-31386-1-git-send-email-alistair@popple.id.au> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15020405-0025-0000-0000-00000101E144 Subject: [Skiboot] [PATCH v2 2/4] platform: Add exit platform hook X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Add a platform hook that is called just prior to loading and running the payload. Signed-off-by: Alistair Popple Reviewed-by: Joel Stanley --- core/init.c | 3 +++ include/platform.h | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/core/init.c b/core/init.c index 2c7e30c..cffa638 100644 --- a/core/init.c +++ b/core/init.c @@ -345,6 +345,9 @@ void __noreturn load_and_boot_kernel(bool is_reboot) op_display(OP_LOG, OP_MOD_INIT, 0x000A); + if (platform.exit) + platform.exit(); + /* Load kernel LID */ if (!load_kernel()) { op_display(OP_FATAL, OP_MOD_INIT, 1); diff --git a/include/platform.h b/include/platform.h index b1aef49..44e67ef 100644 --- a/include/platform.h +++ b/include/platform.h @@ -131,6 +131,11 @@ struct platform { */ bool (*load_resource)(enum resource_id id, void *buf, size_t *len); + + /* + * Executed just prior to handing control over to the payload. + */ + void (*exit)(void); }; extern struct platform __platforms_start;