[Skiboot] [PATCH v3 1/3] core: Implement generic dump region opal call
Vasant Hegde
hegdevasant at linux.vnet.ibm.com
Thu May 31 19:08:27 AEST 2018
On 05/31/2018 09:59 AM, Joel Stanley wrote:
> 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 <joel at jms.id.au>
> ---
> 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 <opal.h>
> +#include <skiboot.h>
> +
> +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;
Better move this under DECLARE_PLATFORM() as its not going to change later?
Also looks like you missed to add these two hooks for BMC platform in patch 3.
-Vasant
More information about the Skiboot
mailing list