diff options
author | Dean Sanner <dsanner@us.ibm.com> | 2012-11-29 15:16:14 -0600 |
---|---|---|
committer | Dean Sanner <dsanner@us.ibm.com> | 2012-12-12 21:48:03 -0600 |
commit | e907de9748a821c4f2e05c65f5204507a60e7a6d (patch) | |
tree | 6c552ad7b9d44f7eae9394e49e6e275c924e2818 | |
parent | ca616b5527eaf80300fde96fa5ffd42c2160e071 (diff) | |
download | talos-hostboot-e907de9748a821c4f2e05c65f5204507a60e7a6d.tar.gz talos-hostboot-e907de9748a821c4f2e05c65f5204507a60e7a6d.zip |
Load Hostboot Base from PNOR
Add the SBE and secureboot header to the hostboot base image
and enable simics to actually pull the image from PNOR
instead of directly stuffing cache from file. Also enables
Hostboot to execute from HRMOR of 128MB and updates cit
script to handle HRMOR
Change-Id: Ie414a5f8e43dadf03538d7435f742b2d79db431b
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2473
Tested-by: Jenkins Server
Reviewed-by: Dean Sanner <dsanner@us.ibm.com>
-rw-r--r-- | src/build/buildpnor/defaultPnorLayout.xml | 5 | ||||
-rwxr-xr-x | src/build/citest/autocitest | 54 | ||||
-rwxr-xr-x | src/build/citest/etc/workarounds.postsimsetup | 25 | ||||
-rwxr-xr-x | src/build/mkrules/hbfw/img/makefile | 26 | ||||
-rwxr-xr-x | src/build/simics/combined.simics | 7 | ||||
-rwxr-xr-x | src/build/simics/standalone.simics | 6 | ||||
-rw-r--r-- | src/usr/mbox/mailboxsp.C | 18 | ||||
-rw-r--r-- | src/usr/mbox/mbox_dma_buffer.C | 45 | ||||
-rw-r--r-- | src/usr/mbox/mbox_dma_buffer.H | 29 | ||||
-rw-r--r-- | src/usr/mvpd/makefile | 2 |
10 files changed, 162 insertions, 55 deletions
diff --git a/src/build/buildpnor/defaultPnorLayout.xml b/src/build/buildpnor/defaultPnorLayout.xml index 87a05ebf3..c38033851 100644 --- a/src/build/buildpnor/defaultPnorLayout.xml +++ b/src/build/buildpnor/defaultPnorLayout.xml @@ -148,7 +148,8 @@ <section> <description>Hostboot Base (576K)</description> <eyeCatch>HBB</eyeCatch> - <physicalOffset>0x3ECA000</physicalOffset> + <!--NOTE: MUST update standalone.simics if offset changes --> + <physicalOffset>0x3ECE000</physicalOffset> <physicalRegionSize>0x90000</physicalRegionSize> <ecc>no</ecc> <source>File</source> @@ -157,7 +158,7 @@ <section> <description>Global Data (36K)</description> <eyeCatch>GLOBAL</eyeCatch> - <physicalOffset>0x3FEA000</physicalOffset> + <physicalOffset>0x3FEE000</physicalOffset> <physicalRegionSize>0x9000</physicalRegionSize> <ecc>no</ecc> <source>Blank</source> diff --git a/src/build/citest/autocitest b/src/build/citest/autocitest index 49d8240b6..7b2881387 100755 --- a/src/build/citest/autocitest +++ b/src/build/citest/autocitest @@ -1,26 +1,26 @@ #!/bin/bash -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. # -# $Source: src/build/citest/autocitest $ +# $Source: src/build/citest/autocitest $ # -# IBM CONFIDENTIAL +# IBM CONFIDENTIAL # -# COPYRIGHT International Business Machines Corp. 2011-2012 +# COPYRIGHT International Business Machines Corp. 2011,2012 # -# p1 +# p1 # -# Object Code Only (OCO) source materials -# Licensed Internal Code Source Materials -# IBM HostBoot Licensed Internal Code +# Object Code Only (OCO) source materials +# Licensed Internal Code Source Materials +# IBM HostBoot Licensed Internal Code # -# The source code for this program is not published or other- -# wise divested of its trade secrets, irrespective of what has -# been deposited with the U.S. Copyright Office. +# The source code for this program is not published or otherwise +# divested of its trade secrets, irrespective of what has been +# deposited with the U.S. Copyright Office. # -# Origin: 30 +# Origin: 30 # -# IBM_PROLOG_END_TAG +# IBM_PROLOG_END_TAG ################################################################################ ## Simics automation using autosim ## 2011-05-23 mww modified to run hostboot in simics @@ -319,7 +319,31 @@ mods_started_addr=`grep "CxxTest::g_ModulesStarted" \ ${SBXHOME}/${HBICORE_TEST_SYMS} | awk '{split($0,a,","); print a[2]}'` mods_completed_addr=`grep "CxxTest::g_ModulesCompleted" \ ${SBXHOME}/${HBICORE_TEST_SYMS} | awk '{split($0,a,","); print a[2]}'` - + +#Adjust addresses for HRMOR +HRMOR=`autosim $NOWIN --simcmd "python \"getHRMOR()\""| tr -d '\n\r'` + +temp=$(($HRMOR + 0x$printk_buffer_addr)) +printk_buffer_addr=`echo "obase=16; $temp" | bc` + +temp=$(($HRMOR + 0x$totaltests_addr)) +totaltests_addr=`echo "obase=16; $temp" | bc` + +temp=$(($HRMOR + 0x$failedtests_addr)) +failedtests_addr=`echo "obase=16; $temp" | bc` + +temp=$(($HRMOR + 0x$warnings_addr)) +warnings_addr=`echo "obase=16; $temp" | bc` + +temp=$(($HRMOR + 0x$tracecalls_addr)) +tracecalls_addr=`echo "obase=16; $temp" | bc` + +temp=$(($HRMOR + 0x$mods_started_addr)) +mods_started_addr=`echo "obase=16; $temp" | bc` + +temp=$(($HRMOR + 0x$mods_completed_addr)) +mods_completed_addr=`echo "obase=16; $temp" | bc` + ## note, don't use $VERBOSE here or you get all sorts of extra junk in the output file. echo "Wait for unit test completion." declare -i timeout=0 diff --git a/src/build/citest/etc/workarounds.postsimsetup b/src/build/citest/etc/workarounds.postsimsetup index e56c08ef5..23a4f4dc7 100755 --- a/src/build/citest/etc/workarounds.postsimsetup +++ b/src/build/citest/etc/workarounds.postsimsetup @@ -31,4 +31,27 @@ echo "+++ Update cec-chip files for Centaur maint command complete." mkdir -p $sb/simu/data/cec-chip/ cp $bb/src/simu/data/cec-chip/centaur.act $sb/simu/data/cec-chip/centaur.act patch -p0 $sb/simu/data/cec-chip/centaur.act $HOSTBOOTROOT/src/build/citest/etc/patches/centaur.act.patch -### + +#### Update config file with new variables (Remove with RTC: 59984) #### +echo "+++ Forcing SBE header usage till Fips defaults to ON" +mkdir -p $sb/simu/configs +mkdir -p $sb/simu/data/cec-chip +egrep -v "SETENV GFW_P8_MURANO_HB_BASE_IMG_USE_PNOR|SETENV GFW_P8_MURANO_HB_BASE_IMG_WITH_ECC" $BACKING_BUILD/src/simu/configs/P8_MURANO.config> $sb/simu/configs/P8_MURANO.config +egrep -v "SETENV GFW_P8_VENICE_HB_BASE_IMG_USE_PNOR|SETENV GFW_P8_VENICE_HB_BASE_IMG_WITH_ECC" $BACKING_BUILD/src/simu/configs/P8_VENICE.config> $sb/simu/configs/P8_VENICE.config +echo "SETENV GFW_P8_MURANO_HB_BASE_IMG_USE_PNOR yes" >> $sb/simu/configs/P8_MURANO.config +echo "SETENV GFW_P8_VENICE_HB_BASE_IMG_USE_PNOR yes" >> $sb/simu/configs/P8_VENICE.config +echo "SETENV GFW_P8_MURANO_HB_BASE_IMG_WITH_ECC yes" >> $sb/simu/configs/P8_MURANO.config +echo "SETENV GFW_P8_VENICE_HB_BASE_IMG_WITH_ECC yes" >> $sb/simu/configs/P8_VENICE.config + +echo "+++ Updating s1.act and p8_common.chip" +mkdir -p $sb/simu/data/cec-chip +cp $BACKING_BUILD/src/simu/data/cec-chip/s1.act $sb/simu/data/cec-chip +cp $BACKING_BUILD/src/simu/data/cec-chip/p8.act $sb/simu/data/cec-chip +sed -i -e's/sbeStart, 0x03eca000,/sbeStart, FSIMBOX(0x3A),/' $sb/simu/data/cec-chip/s1.act +sed -i -e's/sbeStart, 0x03eca000,/sbeStart, FSIMBOX(0x3A),/' $sb/simu/data/cec-chip/p8.act + +cp $BACKING_BUILD/src/simu/data/cec-chip/p8_common.chip $sb/simu/data/cec-chip +sed -i -e's/0xE0, 32 #MBOX_SCRATCH_0/0x38, 32 #MBOX_SCRATCH_0/' $sb/simu/data/cec-chip/p8_common.chip +sed -i -e's/0xE4, 32 #MBOX_SCRATCH_1/0x39, 32 #MBOX_SCRATCH_1/' $sb/simu/data/cec-chip/p8_common.chip +sed -i -e's/0xE8, 32 #MBOX_SCRATCH_2/0x3A, 32 #MBOX_SCRATCH_2/' $sb/simu/data/cec-chip/p8_common.chip +sed -i -e's/0xEC, 32 #MBOX_SCRATCH_3/0x3B, 32 #MBOX_SCRATCH_3/' $sb/simu/data/cec-chip/p8_common.chip diff --git a/src/build/mkrules/hbfw/img/makefile b/src/build/mkrules/hbfw/img/makefile index 4744085b6..0c0b231ab 100755 --- a/src/build/mkrules/hbfw/img/makefile +++ b/src/build/mkrules/hbfw/img/makefile @@ -37,7 +37,7 @@ VPATH += ../fsp DEFAULT_PATH = ${.PATH} SRCPATH = ${DEFAULT_PATH:M*src*} -OTHERS = cp_hbfiles build_pnor_images +OTHERS = cp_hbfiles build_pnor_images ################################################# # Copy Hostboot binary images to obj dir to be grabbed @@ -46,13 +46,26 @@ OTHERS = cp_hbfiles build_pnor_images # changes expected in the future which will require using OBJ version. ################################################# BASE_IMAGE = hostboot.bin -BASE_IMAGES = ${BASE_IMAGE} hostboot_extended.bin +EXT_IMAGE = hostboot_extended.bin +BASE_IMAGES = ${BASE_IMAGE} ${EXT_IMAGE} +BASE_W_HEADER_IMAGE = hostboot.header.bin +BASE_W_HEADER_ECC_IMAGE = hostboot.header.bin.ecc +BASE_ECC_IMAGE = hostboot.bin.ecc -cp_hbfiles: .SPECTARG + +cp_hbfiles: .SPECTARG ${BASE_IMAGES:@image@cp -f -u ${SRCPATH:F${image}} ${image};@} + echo "0000000000180000000000000800000000081000" | xxd -r -ps - sbe.header + dd if=/dev/zero of=secureboot.header bs=1 count=4K + cat sbe.header secureboot.header ${BASE_IMAGE} > ${BASE_W_HEADER_IMAGE} + currentsb -chain + ecc --inject ${BASE_IMAGE} --output ${BASE_ECC_IMAGE} + ecc --inject ${BASE_W_HEADER_IMAGE} --output ${BASE_W_HEADER_ECC_IMAGE} + clobber_cp_hbfiles: - rm -f ${BASE_IMAGES} + rm -f ${BASE_IMAGES} ${BASE_W_HEADER_IMAGE} {BASE_W_HEADER_ECC_IMAGE} \ + sbe.header secureboot.header ################################################# @@ -74,7 +87,7 @@ PNOR_BUILD_SCRIPT = ${buildpnor.pl:P} #so need to use tryinclude for now. .tryinclude <${.PATH:Ffips_pnor.mk}> -HOSTBOOT_DEFAULT_SECTIONS = HBB=hostboot.bin,HBI=hostboot_extended.bin +HOSTBOOT_DEFAULT_SECTIONS = HBB=${BASE_W_HEADER_ECC_IMAGE},HBI=${EXT_IMAGE} PNOR_IMG_INFO = murano.pnor:defaultPnorLayout.xml:HBD=simics_MURANO_targeting.bin,${HOSTBOOT_DEFAULT_SECTIONS} \ venice.pnor:defaultPnorLayout.xml:HBD=simics_VENICE_targeting.bin,${HOSTBOOT_DEFAULT_SECTIONS} \ @@ -115,11 +128,12 @@ clobber_build_pnor_images: #Special target to copy images to flash dir for simics ################################################# FLASH_DEST = $(MAKETOP)$(OBJECTDIRTOP)../images/$(CONTEXT)/lab/flash +FLASH_IMG = ${BASE_IMAGE} ${BASE_ECC_IMAGE} update_images_for_sandbox: build_pnor_images mkdir -p ${FLASH_DEST} #Copy hostboot base image to flash dir - ${BASE_IMAGE:@image@${baseimg:!cd ${FLASH_DEST}; cp -f ${.PATH:F${image}} ${image};!e}@} + ${FLASH_IMG:@image@${baseimg:!cd ${FLASH_DEST}; cp -f ${.PATH:F${image}} ${image};!e}@} #Copy pnor images to flash dir ${PNOR_IMG_INFO:@image@${pnorimg:!cd ${FLASH_DEST}; cp -f ${.PATH:F${image:s/:/ /g:xs/ .*//}} ${image:s/:/ /g:xs/ .*//};!e}@} diff --git a/src/build/simics/combined.simics b/src/build/simics/combined.simics index 9e66a731a..fdac091f9 100755 --- a/src/build/simics/combined.simics +++ b/src/build/simics/combined.simics @@ -26,3 +26,10 @@ try { try { fpga0.sfc_master->state_three_bytes=0 } except { echo "ERROR: Failed to run 4-byte PNOR address workaround in combined.simics." } + +# Manually set HB location till HWSV RTC 48188 is done +try { + p8Proc0.proc_lbus_map.write 0x28e8 0xFFEF0000 +} except { echo "ERROR: Failed to set HB MMIO location workaround in combined.simics." } + + diff --git a/src/build/simics/standalone.simics b/src/build/simics/standalone.simics index 7d6874cd9..530ef1ad9 100755 --- a/src/build/simics/standalone.simics +++ b/src/build/simics/standalone.simics @@ -1,5 +1,7 @@ p8Proc0.proc_fsi2host_mbox->responder_enable=1 -#Trigger the SBE start -p8Proc0.proc_lbus_map.write 0x2870 0x50000000 #SBE Vital 0x281C +#Write the PNOR MMIO addr into Scratch 2, 0x283A +#Then trigger the SBE start +p8Proc0.proc_lbus_map.write 0x28e8 0xFFEF0000 +p8Proc0.proc_lbus_map.write 0x2870 0x10000000 #SBE Vital 0x281C p8Proc0.proc_lbus_map.write 0x2870 0x90000000 #SBE Vital 0x281C diff --git a/src/usr/mbox/mailboxsp.C b/src/usr/mbox/mailboxsp.C index 9361e613e..c9b2b9822 100644 --- a/src/usr/mbox/mailboxsp.C +++ b/src/usr/mbox/mailboxsp.C @@ -161,7 +161,7 @@ errlHndl_t MailboxSp::_init() msg_t * msg = msg_allocate(); msg->type = MSG_INITIAL_DMA; msg->data[0] = 0; - msg->data[1] = reinterpret_cast<uint64_t>(iv_dmaBuffer.getDmaBufferHead()); + msg->data[1] =iv_dmaBuffer.toPhysAddr(iv_dmaBuffer.getDmaBufferHead()); msg->extra_data = NULL; MBOX::send(FSP_MAILBOX_MSGQ,msg); @@ -446,15 +446,16 @@ void MailboxSp::send_msg(mbox_msg_t * i_msg) if(payload->extra_data != NULL) { memcpy(dma_buffer,payload->extra_data,payload->data[1]); - iv_msg_to_send.msg_payload.extra_data = dma_buffer; + iv_msg_to_send.msg_payload.extra_data = + reinterpret_cast<void*>(iv_dmaBuffer.toPhysAddr(dma_buffer)); free(payload->extra_data); } else // DMA buffer request from FSP { iv_msg_to_send.msg_payload.data[0] = dma_size; // bitmap - iv_msg_to_send.msg_payload.data[1] = - reinterpret_cast<uint64_t>(dma_buffer); + iv_msg_to_send.msg_payload.data[1] = + iv_dmaBuffer.toPhysAddr(dma_buffer); } iv_sendq.pop_front(); } @@ -1151,6 +1152,15 @@ errlHndl_t MailboxSp::handleInterrupt() if(mbox_status & MBOX_DATA_PENDING) { trace_msg("RECV",mbox_msg); + //Adjust address back to Virt here if present + uint64_t l_dma = reinterpret_cast<uint64_t>( + mbox_msg.msg_payload.extra_data); + if(l_dma) + { + mbox_msg.msg_payload.extra_data = + iv_dmaBuffer.toVirtAddr(l_dma); + } + if(mbox_msg.msg_queue_id == HB_MAILBOX_MSGQ) { // msg to hb mailbox from fsp mbox diff --git a/src/usr/mbox/mbox_dma_buffer.C b/src/usr/mbox/mbox_dma_buffer.C index 0becfb168..2580aaab3 100644 --- a/src/usr/mbox/mbox_dma_buffer.C +++ b/src/usr/mbox/mbox_dma_buffer.C @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/mbox/mbox_dma_buffer.C $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2012 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/mbox/mbox_dma_buffer.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #include "mbox_dma_buffer.H" #include <stdlib.h> #include <assert.h> @@ -41,6 +41,7 @@ DmaBuffer::DmaBuffer() : iv_dir(makeMask(VmmManager::MBOX_DMA_PAGES)) { iv_head = reinterpret_cast<void*>(VmmManager::MBOX_DMA_ADDR); + iv_phys_head = mm_virt_to_phys(iv_head); } diff --git a/src/usr/mbox/mbox_dma_buffer.H b/src/usr/mbox/mbox_dma_buffer.H index ab208717d..dc4e86af3 100644 --- a/src/usr/mbox/mbox_dma_buffer.H +++ b/src/usr/mbox/mbox_dma_buffer.H @@ -108,6 +108,30 @@ namespace MBOX VmmManager::MBOX_DMA_PAGESIZE))); } + /** + * Get the physical address of DMA buf to send to the FSP + * @param[in] i_address, The HB address to translate + * @return [FSP physical address] + */ + ALWAYS_INLINE + uint64_t toPhysAddr(void * i_address) const + { + return mm_virt_to_phys(i_address); + } + + /** + * Get the virtual address of DMA buf to sent by the FSP + * @param[in] i_address, The FSP Physical address to translate + * @return [HB virtual address] + */ + ALWAYS_INLINE + void* toVirtAddr(uint64_t i_address) const + { + uint64_t base = reinterpret_cast<uint64_t>(iv_head); + return reinterpret_cast<void*>( + base + (i_address-iv_phys_head)); + } + private: /** @@ -123,8 +147,9 @@ namespace MBOX MAX_MASK_SIZE = sizeof(uint64_t) * 8, }; - void * iv_head; //!< Start of DMA memory - uint64_t iv_dir; //!< 1 bit per 1k buffer, 1 = available + void * iv_head; //!< Start of DMA memory + uint64_t iv_phys_head; //!< Physical translation of iv_head + uint64_t iv_dir; //!< 1 bit per 1k buffer, 1 = available }; }; // namespace diff --git a/src/usr/mvpd/makefile b/src/usr/mvpd/makefile index 705f9f4d5..03d6b8355 100644 --- a/src/usr/mvpd/makefile +++ b/src/usr/mvpd/makefile @@ -27,6 +27,6 @@ OBJS = mvpd.o SUBDIRS = test.d -BINARY_FILES = $(IMGDIR)/procmvpd.dat:92a31d2157813b6a2a8680f1cda2ed98d3ff1c51 +BINARY_FILES = $(IMGDIR)/procmvpd.dat:034614d95e3ffb7d0802d4edbd8fad60dc15b40d include ${ROOTPATH}/config.mk |