From patchwork Thu May 31 04:29:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 923153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40xDyx2f0tz9s1B for ; Thu, 31 May 2018 14:30:17 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UlTMDGXJ"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40xDyx152QzDrYj for ; Thu, 31 May 2018 14:30:17 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UlTMDGXJ"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::243; helo=mail-pl0-x243.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UlTMDGXJ"; dkim-atps=neutral Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40xDyd4ZPwzDr30 for ; Thu, 31 May 2018 14:30:01 +1000 (AEST) Received: by mail-pl0-x243.google.com with SMTP id c41-v6so12408457plj.10 for ; Wed, 30 May 2018 21:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=LD9BGBti5v2sKkgVm9iKiv6vvaj3QpeYV3qH0m/hmco=; b=UlTMDGXJzA1ej3U7frSA+oryDpcY9FsDPtlrDGtwa8TkmqRKExgfA8rseqSa76iBE0 M7skxX8cPiDubUFsri2N+p34aGex7Y6otxwvZLp7TIl7JfqMiUvYimFehjF5ALfcWzx9 gjr/U2hh9ObqPPfqqfExreDWVbnBTN2V7qIeyzJCj2mmvh2v6Eo7IhyJZ2TF49k1y10B 3CIuLEDI1mR1JJKoZT+OF4FYy7UTu6Lr4rpxImMuRZwKrR3YFkpHBx+p+YdiZ6V3IawK 7rKJBO7bCfKnad1UQto9Ypz10aD5RWXNkbfSkykSUnFu9R1UPeUcLdcPZ6i2neFAd/VV aE9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=LD9BGBti5v2sKkgVm9iKiv6vvaj3QpeYV3qH0m/hmco=; b=dKNY6+EbXlgBZcVWgJZZ/tOYz/sP3U6QhuI62TOJZNpSdtSFl1ZxrscSykRiBvSg16 sm7GSHY+RBlN6bORQV5j1KGwoMSBjiqOyA/1uVAEVGeCvqfANxdlOs85uRWUBBWGe6VT PdWcEfuP3EYNDgNstZtfn7qMOz+nH48VgGuLcQ8ng5y0ys6tMNPkXJyz7XyTRKQrjj8g 1Zz1Bh5K2ge7N1f2OjKMb4UNn9EENYF8ILIyYNcav+tM/tJK+U751Y/51GhKGA2YkCdJ U9fB8hJvroij9DEpy+ZIuNSfdsOR28ghDDAb80kRZw1kErYOaCfuL9x/a/xlhP2Jnfr/ KYhg== X-Gm-Message-State: ALKqPwcQbIAsj6AVLzIAfHOD450tG+VVK/35Dh6oCpmuJ+Thd2dr9ioE NCOvjVGioQCBxf4CtUe/DyPaYXHQ X-Google-Smtp-Source: ADUXVKLeIbnYHg0bNnKQp/pvx8564kBqrd0296jsuq04yukpPcwzhtn1ShgWAHh/ytM53SiocPCjgg== X-Received: by 2002:a17:902:9883:: with SMTP id s3-v6mr5526343plp.179.1527740999128; Wed, 30 May 2018 21:29:59 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.19]) by smtp.gmail.com with ESMTPSA id f189-v6sm36472434pgc.51.2018.05.30.21.29.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 May 2018 21:29:58 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Thu, 31 May 2018 13:59:52 +0930 From: Joel Stanley To: skiboot@lists.ozlabs.org Date: Thu, 31 May 2018 13:59:41 +0930 Message-Id: <20180531042943.15804-2-joel@jms.id.au> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531042943.15804-1-joel@jms.id.au> References: <20180531042943.15804-1-joel@jms.id.au> Subject: [Skiboot] [PATCH v3 1/3] core: Implement generic dump region opal call X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 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" This provides an implementation of the OPAL_REGISTER_DUMP_REGION and OPAL_UNREGISTER_DUMP_REGION calls that can be used by all systems. It enables the callbacks for the ibm-fsp machine, preserving the existing behaviour. Signed-off-by: Joel Stanley --- core/Makefile.inc | 2 +- core/dump-region.c | 39 +++++++++++++++++++++++++++++++++++++++ hw/fsp/fsp-mdst-table.c | 8 +++----- include/platform.h | 12 ++++++++++++ 4 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 core/dump-region.c diff --git a/core/Makefile.inc b/core/Makefile.inc index d36350590edb..2d2f74778f4c 100644 --- a/core/Makefile.inc +++ b/core/Makefile.inc @@ -9,7 +9,7 @@ CORE_OBJS += vpd.o hostservices.o platform.o nvram.o nvram-format.o hmi.o CORE_OBJS += console-log.o ipmi.o time-utils.o pel.o pool.o errorlog.o CORE_OBJS += timer.o i2c.o rtc.o flash.o sensor.o ipmi-opal.o CORE_OBJS += flash-subpartition.o bitmap.o buddy.o pci-quirk.o powercap.o psr.o -CORE_OBJS += pci-dt-slot.o direct-controls.o cpufeatures.o +CORE_OBJS += pci-dt-slot.o direct-controls.o cpufeatures.o dump-region.o ifeq ($(SKIBOOT_GCOV),1) CORE_OBJS += gcov-profiling.o diff --git a/core/dump-region.c b/core/dump-region.c new file mode 100644 index 000000000000..afa4c2685b89 --- /dev/null +++ b/core/dump-region.c @@ -0,0 +1,39 @@ +/* Copyright 2018 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define pr_fmt(fmt) "DUMP: " fmt + +#include +#include + +static int64_t opal_register_dump_region(uint32_t id, uint64_t addr, + uint64_t size) +{ + if (platform.register_dump_region) + return platform.register_dump_region(id, addr, size); + + return OPAL_UNSUPPORTED; +} +opal_call(OPAL_REGISTER_DUMP_REGION, opal_register_dump_region, 3); + +static int64_t opal_unregister_dump_region(uint32_t id) +{ + if (platform.unregister_dump_region) + return platform.unregister_dump_region(id); + + return OPAL_UNSUPPORTED; +} +opal_call(OPAL_UNREGISTER_DUMP_REGION, opal_unregister_dump_region, 1); diff --git a/hw/fsp/fsp-mdst-table.c b/hw/fsp/fsp-mdst-table.c index 0f145ba5551a..54d3c0613687 100644 --- a/hw/fsp/fsp-mdst-table.c +++ b/hw/fsp/fsp-mdst-table.c @@ -415,11 +415,9 @@ void fsp_mdst_table_init(void) if (!fsp_present()) return; - /* OPAL interface */ - opal_register(OPAL_REGISTER_DUMP_REGION, - fsp_opal_register_dump_region, 3); - opal_register(OPAL_UNREGISTER_DUMP_REGION, - fsp_opal_unregister_dump_region, 1); + /* Register callbacks */ + platform.register_dump_region = fsp_opal_register_dump_region; + platform.unregister_dump_region = fsp_opal_unregister_dump_region; if (!fsp_mdst_supported()) return; diff --git a/include/platform.h b/include/platform.h index a77764464001..c9b2dd88e4f6 100644 --- a/include/platform.h +++ b/include/platform.h @@ -207,6 +207,18 @@ struct platform { * OPAL terminate */ void __attribute__((noreturn)) (*terminate)(const char *msg); + + /* + * Dump region registration + * + * Allows machine specific actions to be taken when + * OPAL_REGISTER_DUMP_REGION and OPAL_UNREGISTER_DUMP_REGION + * are called. + */ + int64_t (*register_dump_region)(uint32_t id, + uint64_t addr, + uint64_t size); + int64_t (*unregister_dump_region)(uint32_t id); }; extern struct platform __platforms_start;