From bfdeb06f99dd96f7e0bac0b6a56b4e5b3e218a8b Mon Sep 17 00:00:00 2001 From: Martin Peschke Date: Wed, 23 Mar 2016 12:52:58 +0100 Subject: Self-Restore Image Build Flow Change-Id: I68f9d98aa94223d6ed56e0c16a5ab2a6a610505c Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/22386 Tested-by: Jenkins Server Reviewed-by: Richard J. Knight Reviewed-by: Martin Peschke --- import/tools/imageProcs/restore_image.S | 136 ++++++++++++++++++++++++++++++ import/tools/imageProcs/restore_image.cmd | 105 +++++++++++++++++++++++ import/tools/imageProcs/restore_image.mk | 29 +++++++ 3 files changed, 270 insertions(+) create mode 100644 import/tools/imageProcs/restore_image.S create mode 100644 import/tools/imageProcs/restore_image.cmd create mode 100644 import/tools/imageProcs/restore_image.mk (limited to 'import/tools') diff --git a/import/tools/imageProcs/restore_image.S b/import/tools/imageProcs/restore_image.S new file mode 100644 index 00000000..9ab82c7c --- /dev/null +++ b/import/tools/imageProcs/restore_image.S @@ -0,0 +1,136 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: import/tools/imageProcs/restore_image.S $ */ +/* */ +/* OpenPOWER HCODE Project */ +/* */ +/* COPYRIGHT 2016,2017 */ +/* [+] International Business Machines 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. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +// *INDENT-OFF* + +#include + + .macro P9XipHeader, magic, link_address, image_size + + .section .header, "a", @progbits + + //////////////////////////////////////////////////////////////////// + // First, reserve space for all the enteries in the header + // Identification - 8-byte aligned; 8 Entries; TOC-Indexed + //////////////////////////////////////////////////////////////////// + +__magic: + .quad (\magic) +__L1_LoaderAddr: + .quad 0 +__L2_LoaderAddr: + .quad 0 +__kernelAddr: + .quad 0 +__link_address: + .quad (\link_address) +__header_64_reserved: + .quad 0, 0, 0 + + .xip_toc magic, P9_XIP_UINT64, __magic + .xip_toc L1_LoaderAddr, P9_XIP_UINT64, __L1_LoaderAddr + .xip_toc L2_LoaderAddr, P9_XIP_UINT64, __L2_LoaderAddr + .xip_toc kernelAddr, P9_XIP_UINT64, __kernelAddr + .xip_toc link_address, P9_XIP_UINT64, __link_address + + //////////////////////////////////////////////////////////////////// + // Section Table - 8-byte aligned; 15 entries; Not TOC-Indexed + //////////////////////////////////////////////////////////////////// + + .xip_section header + .xip_section + .xip_section + .xip_section toc, 4 + .xip_section strings + + .xip_section cpmr, 8 + .xip_section self_restore, 8 + .xip_section spr_restore, 8 + .xip_section scom_restore, 8 + + .xip_section + .xip_section + .xip_section + .xip_section + .xip_section + .xip_section + + //////////////////////////////////////////////////////////////////// + // Other Information - 4-byte aligned; 8 entries; TOC-Indexed + //////////////////////////////////////////////////////////////////// + +__image_size: + .long (\image_size) +__build_date: + .long 0 +__build_time: + .long 0 +__header_32_reserved: + .long 0, 0, 0, 0, 0 + + .xip_toc image_size, P9_XIP_UINT32, __image_size + .xip_toc build_date, P9_XIP_UINT32, __build_date + .xip_toc build_time, P9_XIP_UINT32, __build_time + + //////////////////////////////////////////////////////////////////// + // Other Information - 1-byte aligned; 8 entries; TOC-Indexed + //////////////////////////////////////////////////////////////////// + +__header_version: + .byte P9_XIP_HEADER_VERSION +__toc_normalized: + .byte 0 +__toc_sorted: + .byte 0 +__header_8_reserved: + .byte 0, 0, 0, 0, 0 + + .xip_toc header_version, P9_XIP_UINT8, __header_version + .xip_toc toc_normalized, P9_XIP_UINT8, __toc_normalized + .xip_toc toc_sorted, P9_XIP_UINT8, __toc_sorted + + //////////////////////////////////////////////////////////////////// + // Strings; 64 characters allocated; TOC-Indexed + //////////////////////////////////////////////////////////////////// + +__build_user: + .asciz "unknown " # 16 Characters allocated +__build_host: + .asciz "unknown " # 24 characters allocated +__header_string_reserved: + .space 24, 0 + + .xip_toc build_user, P9_XIP_STRING, __build_user + .xip_toc build_host, P9_XIP_STRING, __build_host + + .endm + + .section .toc, "a", @progbits + .section .strings, "aS", @progbits + + // FIXME: start address of HW Image in PNOR + P9XipHeader P9_XIP_MAGIC_RESTORE, 0x80000000, _restore_image_size + +// *INDENT-ON* diff --git a/import/tools/imageProcs/restore_image.cmd b/import/tools/imageProcs/restore_image.cmd new file mode 100644 index 00000000..69178077 --- /dev/null +++ b/import/tools/imageProcs/restore_image.cmd @@ -0,0 +1,105 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: import/tools/imageProcs/restore_image.cmd $ */ +/* */ +/* OpenPOWER HCODE Project */ +/* */ +/* COPYRIGHT 2016,2017 */ +/* [+] International Business Machines 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. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +// Need to do this so that elf32-powerpc is not modified! +#undef powerpc + +#define RESTORE_IMAGE_ORIGIN 0x80000000 +OUTPUT_FORMAT(elf32-powerpc); + +SECTIONS +{ + . = RESTORE_IMAGE_ORIGIN; + _restore_image_origin = . - 0; + //////////////////////////////// + // Header + //////////////////////////////// + . = ALIGN(1); + _header_origin = .; + _header_offset = . - _restore_image_origin; + .header . : { *(.header) } + _header_size = . - _header_origin; + + //////////////////////////////// + // TOC + //////////////////////////////// + . = ALIGN(4); + _toc_origin = .; + _toc_offset = . - _restore_image_origin; + .toc . : { *(.toc) } + _toc_size = . - _toc_origin; + + //////////////////////////////// + // STRING + //////////////////////////////// + . = ALIGN(1); + _strings_origin = .; + _strings_offset = . - _restore_image_origin; + .strings . : { *(.strings) } + _strings_size = . - _strings_origin; + + //////////////////////////////// + // CPMR + //////////////////////////////// + . = ALIGN(8); + _cpmr_origin = .; + _cpmr_offset = . - _restore_image_origin; + .cpmr . : { *(.cpmr) } + _cpmr_size = . - _cpmr_origin; + + //////////////////////////////// + // Self-Restore + //////////////////////////////// + . = ALIGN(8); + _self_restore_origin = .; + _self_restore_offset = . - _restore_image_origin; + .self_restore . : { *(.self_restore) } + _self_restore_size = . - _self_restore_origin; + + //////////////////////////////// + // SPR Restore + //////////////////////////////// + . = ALIGN(8); + _spr_restore_origin = .; + _spr_restore_offset = . - _restore_image_origin; + .spr_restore . : { *(.spr_restore) } + _spr_restore_size = . - _spr_restore_origin; + + //////////////////////////////// + // SCOM Restore + //////////////////////////////// + . = ALIGN(8); + _scom_restore_origin = .; + _scom_restore_offset = . - _restore_image_origin; + .scom_restore . : { *(.scom_restore) } + _scom_restore_size = . - _scom_restore_origin; + + //////////////////////////////// + // end of the image + //////////////////////////////// + . = ALIGN(8); + _restore_image_size = . - _restore_image_origin; + _restore_image_end = . - 0; +} diff --git a/import/tools/imageProcs/restore_image.mk b/import/tools/imageProcs/restore_image.mk new file mode 100644 index 00000000..cdb6b934 --- /dev/null +++ b/import/tools/imageProcs/restore_image.mk @@ -0,0 +1,29 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: import/tools/imageProcs/restore_image.mk $ +# +# OpenPOWER HCODE Project +# +# COPYRIGHT 2016,2017 +# [+] International Business Machines 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. +# +# IBM_PROLOG_END_TAG +IMAGE=restore_image +$(call ADD_IMAGE_INCDIR,$(IMAGE),$(ROOTPATH)/chips/p9/xip) +#$(call XIP_TOOL,append,.cpmr,$(ROOTPATH)/chips/p9/procedures/ppe_closed/cme/stop_cme/obj/stop_cme/cpmr_header.bin) +$(call XIP_TOOL,append,.self_restore,$(ROOTPATH)/chips/p9/procedures/utils/stopreg/selfRest.bin) +$(call BUILD_IMAGE) -- cgit v1.2.1