From f2d94b5f809410300fe10dc9d0786790018463a0 Mon Sep 17 00:00:00 2001 From: Shakeeb Date: Sat, 27 Aug 2016 10:50:49 -0500 Subject: SBE code restructure: sbe -> src rename Change-Id: I6e4378d0e71a00ed2b239658d43f180df2a9b748 RTC:159709 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/28875 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Reviewed-by: RAJA DAS Reviewed-by: Sachin Gupta --- src/boot/Makefile | 86 ++++++++++++++++++++++ src/boot/bootfiles.mk | 34 +++++++++ src/boot/loader_l1.S | 82 +++++++++++++++++++++ src/boot/loader_l2.c | 88 ++++++++++++++++++++++ src/boot/loader_l2_setup.S | 57 +++++++++++++++ src/boot/otprom_init.S | 178 +++++++++++++++++++++++++++++++++++++++++++++ src/boot/pibmem_repair.S | 62 ++++++++++++++++ 7 files changed, 587 insertions(+) create mode 100644 src/boot/Makefile create mode 100644 src/boot/bootfiles.mk create mode 100644 src/boot/loader_l1.S create mode 100644 src/boot/loader_l2.c create mode 100644 src/boot/loader_l2_setup.S create mode 100644 src/boot/otprom_init.S create mode 100644 src/boot/pibmem_repair.S (limited to 'src/boot') diff --git a/src/boot/Makefile b/src/boot/Makefile new file mode 100644 index 00000000..95e29143 --- /dev/null +++ b/src/boot/Makefile @@ -0,0 +1,86 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/boot/Makefile $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 +export SUB_OBJDIR = /boot + +include img_defs.mk +include bootfiles.mk + +INCLUDES += -I$(IMAGE_SRCDIR) + +OBJS := $(addprefix $(OBJDIR)/, $(BOOT_OBJECTS)) +BOOTOBJS += $(OBJS) +LINK_SCRIPT_LOADER = $(addprefix $(OBJDIR)/, linkscriptloader) +LINK_SCRIPT_OTPROM = $(addprefix $(OBJDIR)/, linkscriptotprom) + +all: $(OBJS) \ + $(OBJDIR)/$(IMAGE_LOADER_NAME).bin $(OBJDIR)/$(IMAGE_OTPROM_NAME).bin + +$(OBJS) $(OBJS:.o=.d): | $(OBJDIR) + +# Loader Objects +LOADER_OBJS := $(addprefix $(OBJDIR)/, $(BASE_LOADER_OBJECTS)) +#Otprom Loader Objects +OTPROM_LOADER_OBJS := $(addprefix $(OBJDIR)/, $(OTPROM_LOADER_OBJECTS)) +# ---- Otprom Image ------ +$(OBJDIR)/$(IMAGE_OTPROM_NAME).bin $(OBJDIR)/$(IMAGE_OTPROM_NAME).dis: $(OBJDIR)/$(IMAGE_OTPROM_NAME).out + $(OBJCOPY) -O binary $< $(OBJDIR)/$(IMAGE_OTPROM_NAME).bin `/usr/bin/nm $(OBJDIR)/$(IMAGE_OTPROM_NAME).out | grep "A _loader_end" | cut -d " " -f 1` + $(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_OTPROM_NAME).dis + +#create a linked ELF executable +$(OBJDIR)/$(IMAGE_OTPROM_NAME).out: $(OTPROM_LOADER_OBJS) $(LINK_SCRIPT_OTPROM) + $(LD) -e base_loader -T$(LINK_SCRIPT_OTPROM) -Map $(OBJDIR)/$(IMAGE_OTPROM_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_OTPROM_NAME).out $(OTPROM_LOADER_OBJS) + +# pass the link command file through the C preprocessor to evaluate macros +# and remove comments +$(LINK_SCRIPT_OTPROM): $(IMAGE_SRCDIR)/linkotprom.cmd + $(CPP) -I. -E -x c++ -P $(DEFS) $(IMAGE_SRCDIR)/linkotprom.cmd -o $(LINK_SCRIPT_OTPROM) + +# ---- Loader Image ------ +$(OBJDIR)/$(IMAGE_LOADER_NAME).bin $(OBJDIR)/$(IMAGE_LOADER_NAME).dis: $(OBJDIR)/$(IMAGE_LOADER_NAME).out + $(OBJCOPY) -O binary $< $(OBJDIR)/$(IMAGE_LOADER_NAME).bin --pad-to 0x`/usr/bin/nm $(OBJDIR)/$(IMAGE_LOADER_NAME).out | grep "A _loader_end" | cut -d " " -f 1` + $(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_LOADER_NAME).dis + +#create a linked ELF executable +$(OBJDIR)/$(IMAGE_LOADER_NAME).out: $(LOADER_OBJS) $(LINK_SCRIPT_LOADER) + $(LD) -e base_loader -T$(LINK_SCRIPT_LOADER) -Map $(OBJDIR)/$(IMAGE_LOADER_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_LOADER_NAME).out $(LOADER_OBJS) + +# pass the link command file through the C preprocessor to evaluate macros +# and remove comments +$(LINK_SCRIPT_LOADER): $(IMAGE_SRCDIR)/linkloader.cmd + $(CPP) -I. -E -x c++ -P $(DEFS) $(IMAGE_SRCDIR)/linkloader.cmd -o $(LINK_SCRIPT_LOADER) + +$(OBJDIR): + mkdir -p $(OBJDIR) + +.PHONY: clean all + +#clean the kernel directory first, then the application level clean +clean: + rm -fr $(OBJDIR) + +ifneq ($(MAKECMDGOALS),clean) +include $(OBJS:.o=.d) +endif + + diff --git a/src/boot/bootfiles.mk b/src/boot/bootfiles.mk new file mode 100644 index 00000000..0836e59f --- /dev/null +++ b/src/boot/bootfiles.mk @@ -0,0 +1,34 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/boot/bootfiles.mk $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 +BOOTTOP-S-SOURCES = loader_l1.S + +BOOT_OBJECTS += $(BOOTTOP-S-SOURCES:.S=.o) + +BASE-LOADER-C-SOURCES = loader_l2.c +BASE-LOADER-S-SOURCES = loader_l2_setup.S + +BASE_LOADER_OBJECTS = $(BASE-LOADER-C-SOURCES:.c=.o) $(BASE-LOADER-S-SOURCES:.S=.o) + +OTPROM-LOADER-S-SOURCES = otprom_init.S +OTPROM_LOADER_OBJECTS = $(OTPROM-LOADER-S-SOURCES:.S=.o) diff --git a/src/boot/loader_l1.S b/src/boot/loader_l1.S new file mode 100644 index 00000000..1699b239 --- /dev/null +++ b/src/boot/loader_l1.S @@ -0,0 +1,82 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/boot/loader_l1.S $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 */ + + .nolist +#include "pk.h" +#include "sbe_link.H" + .list + +### **************************************************************************** +### .loader_text - This section contains pm loader code +### @TODO via RTC 136315 +### It also contains vector code. We can remove vector code +### once OTPROM support for simics is in. +### **************************************************************************** + + .section .loader_text, "ax", @progbits + + .global _pibmemRepair + +__vectors: + + ############################################################ + # 0x0040 : System Reset + ############################################################ + .org __vectors + 0x0040 + +__system_reset: + b __pmLoader + + +__pmLoader: + bl _pibmemRepair + _liw %r3, SBE_LOADER_BASE_SECTION # Base Loader Section Location + _liw %r4, SBE_LOADER_BASE_ORIGIN # dest + _liw %r9, SBE_SEEPROM_BASE_ORIGIN + lwz r5, 4(r3) #size of image in bytes + li r6, 3 + srw r5, r5, r6 # Number of double word transfers + mtctr r5 # set the counter for loop + lwz r8, 0(r3) # offset of baseloader section + adde r8, r8, r9 # add base address to offset to get absolute address + +copy_loop: + lvd d28, 0(r8) + stvd d28, 0(r4) + addi r8, r8, 8 + addi r4, r4, 8 + bdnz copy_loop + + ############################################################ + # SBE entry function is 4 byte number in image header + ############################################################ + + _liw %r3, SBE_SEEPROM_BASE_ORIGIN + SBE_LOADER_ENTRY_HEADER_OFFSET + lwz r6, 0(r3) + mtlr r6 + blr + + .epilogue __pmLoader + +#include "pibmem_repair.S" diff --git a/src/boot/loader_l2.c b/src/boot/loader_l2.c new file mode 100644 index 00000000..4f575bea --- /dev/null +++ b/src/boot/loader_l2.c @@ -0,0 +1,88 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/boot/loader_l2.c $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* */ +/* */ +/* 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 */ +#include "sbeXipUtils.H" + +// Load section to destination address +int32_t loadSection( P9XipSection * i_section, uint64_t *i_destAddr ) +{ + uint32_t idx = 0; + uint64_t *seepromAddr = (uint64_t *)( g_headerAddr + i_section->iv_offset); + uint32_t sectionSize = i_section->iv_size; + for( idx = 0; idx < sectionSize; idx += 8 ) + { + *i_destAddr = *seepromAddr; + i_destAddr++; seepromAddr++; + + } + return 0; +} + +// Function to load base image into PIBMEM +int32_t base_loader() +{ + int32_t rc = 0; + P9XipHeader *hdr = getXipHdr(); + + uint64_t *pibMemAddr = (uint64_t *)g_pibMemAddr; + uint64_t *tempPibMemAddr = (uint64_t *)g_pibMemAddr; + uint64_t *pibEndAddr = (uint64_t *)(SBE_LOADER_BASE_ORIGIN); + + // Initialise complete PIBMEM with 0 + // Though this is inefficient, this is quick fix to solve the + // HW write of data which is not 8 byte alligned. All write which + // are not 8 byte alligned, translates to read-modify-write. So + // if code does a write for 4 byte, first HW will read 8 bytes. If + // there is no data written there earlier and random data is present + // it can cause ecc errors. + // TODO via RTC 158797 + // Though we may be able to optimise it, but than we have to put the + // logic in loadSection function which is not desired. So currently + // initialising all PIBMEM. If performance become concern during initial + // SBE load, we can optimise this. + // We have three options here in optimisation + // 1. Put this logic in SEEPROM loader ( pmloader ). This was we can + // reclaim space taken by base loader as stack/bss can grow in base + // loader section after image load. + // 2. Keep this code in PIBMEM. But do not initialise the memory taken + // by base image. + // 3. Do what is done in option 1 but only initialise memoty after base + // section to end of PIBMEM. This will involve some more hardcoding + // in seeprom loader. + // My preference will be option 1 but depends upon performance goals. + for( ; tempPibMemAddr < pibEndAddr; tempPibMemAddr++ ) + { + *tempPibMemAddr = 0; + } + + loadSection(&(hdr->iv_section[P9_XIP_SECTION_SBE_BASE]), pibMemAddr); + // Set the IVPR register. This is required so that interrupt vector table + // points to pk interfaces. + uint64_t data = (uint64_t)(SBE_BASE_ORIGIN) << 32; + PPE_STVD(g_ivprLoc, data); + // Jump to pk boot function + uint32_t addr = hdr->iv_kernelAddr; + JUMP_TO_ADDR(addr); + + return rc; +} diff --git a/src/boot/loader_l2_setup.S b/src/boot/loader_l2_setup.S new file mode 100644 index 00000000..99da6d5c --- /dev/null +++ b/src/boot/loader_l2_setup.S @@ -0,0 +1,57 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/boot/loader_l2_setup.S $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* */ +/* */ +/* 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 */ + .nolist +#include "pk.h" + .list + +### **************************************************************************** +### Do the initial setup for base loader +### +### **************************************************************************** + +__base_loader_setup: + + ## Set up PowerPC EABI constant registers. + + _liw %r2, _SDA2_BASE_ + _liw %r13, _SDA_BASE_ + + ## The stack pointer is initialized for use by the remainder of the + ## initialization. The linker script defines the initial stack area. + ## + ## Stacks are always 8-byte aligned. A '0' is stored at the + ## stack pointer to indicate the end of the stack chain. Stack frames + ## always consist of at least 8 bytes - the backchain pointer and the + ## slot above the backchain pointer for the callee's LR. + + _liw %r1, _BASE_LOADER_STACK_LIMIT + _clrfield %r1, %r1, 3, 29 # 8-byte align + li %r3, 0 + li %r4, 0 + stvd %r3, -8(%r1) + + ## Call the base loader + bl base_loader + + .epilogue __base_loader_setup diff --git a/src/boot/otprom_init.S b/src/boot/otprom_init.S new file mode 100644 index 00000000..719e158a --- /dev/null +++ b/src/boot/otprom_init.S @@ -0,0 +1,178 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/boot/otprom_init.S $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 +# # include "pk.h" +.set r0 , 0 +.set r1 , 1 +.set r2 , 2 +.set r3 , 3 +.set r4 , 4 +.set r5 , 5 +.set r6 , 6 +.set r7 , 7 +.set r8 , 8 +.set d0 , 0 +.set d2 , 2 +.set d7 , 7 +.global __reserved +__reserved: +############################################################# +################## OTPROM location data contents ############ +# SBE Seeprom Config_0 18068 +# SBE Seeprom Config_1 18069 +# SBE Seeprom Config_2 1806A +# SBE Seeprom Config_3 1806B +# Magic number stored in OTP 1806C +# Reserved 1806D +# Reserved 1806E +# Reserved 1806F +# 0x0040 : otprom loader +############################################################# +_start: +#lis r4 , 0x50 #dummy instruction +.org __reserved + 0x0040 +.macro .pm_otprom_fixed_system + .section .fixed, "a", @progbits +__seeprom0_config_reg: + .quad 0x80A91C7100000000 +__seeprom1_config_reg: + .quad 0x80AB1C7100001C71 +__seeprom2_config_reg: + .quad 0x80AD1C71000038E2 +__seeprom3_config_reg: + .quad 0x80AF1C7100005553 +__otprom_magic_num: + .quad 0x584950205345504D +__sbe_config_reg: + .quad 0x000A800030000000 + .endm +oos_start: #R4 --> A0000 R5 --> 5003F R6 --> C000_0818 + lis r4 , 0xA + ori r4 , r4 , 0x0 + stvd d0 , 1(r4) #Write reset reg . A0001 + lis r5 , 0x5 #Check the validity of scratch reg and then program the bit rate div + ori r5 , r5 , 0x0000 + lvd d2 , 0x3F(r5) #loads scratch_8 and updates R5 to scratch_1 + bb0wi r2 , 1 , oos_load_const_brd #checks if valid bit (bit1) is 1 if yes continue else branch + lvd d2 , 0x39(r5) + andis. r2 , r2 , 0xffff #delete last 2 bytes Confirmed first 2 bytes has Bit rate divisor + +oos_write_mode_reg: + lvd d0 , 6(r4) #D0 --> old mode reg and D2 --> has new brd + andi. r0 , r0 , 0xffff + or r0 , r0 , r2 + stvd d0 , 6(r4) #Store mode register + lis r6 , 0xc000 + ori r6 , r6, 0x0818 #Load clear address of local register FI2C_CFG + li r0 , 0xfff #Create the Clear mask + lis r1 , 0xf000 + stvd d0 , 0(r6) #write to clear register of local register + rlwinm r3, r2, 12 , 0 , 3 #First move last nibble to R3 0:3 + rlwinm r2, r2, 12 , 20, 31 #Store bit rate div in 20:35 location of local register 20:31 + stvd d2 , -8(r6) #Set register = C0000810 + b oos_write_mode_done + +oos_load_const_brd: + lis r2 , 0x3 #load constant BRD = 3 to first 2 bytes of R2 + b oos_write_mode_reg + +oos_write_mode_done: + +oos_force_stop_to_both_ports: + lis r0 , 0x8000 #load 0x80000000 for port busy register write + stvd d0 , 0xE(r4) #Write port busy register to clear + andi. r0 , r0 ,0 #stop_command = 0x1000_0020_0000_0000 + andi. r1 , r1 , 0 + oris r0 , r0 , 0x1000 + ori r0 , r0 , 0x0020 + stvd d0 , 0(r4) #Write control register with Stop command + +oos_poll_status_bit_0: + lvd d2 , 2(r4) #Read Status register + bb1wi r3 , 0xc , oos_poll_status_bit_0 + ori r0 , r0 , 0x0200 #stop_command = 0x1000_0220_0000_0000 + stvd d0 , 0(r4) #write control register with stop command to port 1 + +oos_poll_status_bit_1: + lvd d2 , 2(r4) + bb1wi r3 , 0xc , oos_poll_status_bit_1 + lis r0 , 0xd8a9 + ori r0 , r0 , 0x0090 #change the port number later after checking from the scratch register. Add the seeprom address pointer location by updating the R1 + andi. r1 , r1 , 0x0 #Chose address 0x0 of SEEPROM : 0xA8 + +oos_chk_port_num: + lvd d2 , 0x8(r5) #Read the port number from Selfboot control / status register :: + bb0wi r2 , 17 , oos_sel_prim_sprm #Check if backup seeprom select is '1' bit_17 according to Srinivas + ori r0 , r0 , 0x0200 #enable backup_sprm port + lvd d7, -24(r6) #load SBE_CONFIG local reg + oris r8 , r8 , 0x0200 #make bit 38 of sbe_config_reg bit '1'. (C0000800) + stvd d7, -24(r6) #Store SBE_CONFIG local reg + +oos_sel_prim_sprm: + stvd d0 , 0(r4) #write control register + +oos_poll_status_bit_2: + lvd d2 , 2(r4) #poll status reg + bb1wi r3 , 0xc , oos_poll_status_bit_2 + lvd d0 , 3(r4) #Read data reg to get magic number + +oss_load_constant_magic_num: #Magic number of seeprom = 0x584950205345504D + lis r2 , 0x5849 #load constant otprom magic number + ori r2 , r2 , 0x5020 + lis r3 , 0x5345 + ori r3 , r3, 0x504d + cmplwbc 0, 2, r0, r2, oos_cmp_magic_fail + cmplwbc 0, 2, r1, r3, oos_cmp_magic_fail + lis r4 , 0x0001 #OTPROM address = 0xZZZZ_YYYY PIB_addr (R4 = 18070) + ori r4 , r4 , 0x8068 + lis r5 , 0xc000 #local_reg_addr (R5 = C0000860) + ori r5 , r5 , 0x0860 + lvd d0 , 0(r4) + stvd d0 , 0(r5) #Seeprom_0 + lvd d0 , 1(r4) + stvd d0 , 32(r5) #Seeprom_1 + lvd d0 , 2(r4) + stvd d0 , 64(r5) #Seeprom_2 + lvd d0 , 3(r4) + stvd d0 , 96(r5) #Seeprom_3 + lvd d0 , 5(r4) #SBE Config + stvd d0 , -96(r5) + ##### Branch to SEEPROM ################### + lis r4 , 0x8000 #Go and fetch the branch address from 0x8000_0001 + ori r4 , r4 , 0x0008 + lvd d0 , 0(r4) + mtctr r1 + bctr #Branch to fetched address + ##### Branch to SEEPROM ################### + trap #FIXME hve to give branch to SEEPROM + +oos_cmp_magic_fail: + lis r5 , 0x5 #PIB_addr (R5 = 0x00050008) + ori r5 , r5 , 0x0000 + lvd d0 , 8(r5) + andi. r1 , r1 , 0xfff0 + ori r1 , r1 , 0x000e #59:63 : Error message : E = Magic number mismatch + stvd d0 ,8(r5) + trap + +.pm_otprom_fixed_system diff --git a/src/boot/pibmem_repair.S b/src/boot/pibmem_repair.S new file mode 100644 index 00000000..98b1ecfa --- /dev/null +++ b/src/boot/pibmem_repair.S @@ -0,0 +1,62 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/boot/pibmem_repair.S $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 */ +#include "sbe_link.H" +#include "pk.h" + +.set d0 , 0 + .text + .section .loader_text, "ax", @progbits + +_pibmemRepair: + + _liw %r3, SBE_FIXED_SECTION # Fixed Section Location + _liw %r9, SBE_SEEPROM_BASE_ORIGIN + lwz r8, 0(r3) # offset of Fixed section + adde r8, r8, r9 # add base address to offset to get absolute address + lis r5, 0x8 + ori r5, r5 , 0x800B #point to repair reg 0 addr + lis r0, 0x4000 # load repair #0 with 0x4000_0000 --> enable fence and repr_mux_sel is disabled + stvd d0, 0(r5) + lvd d0, 0(r8) # r8 was pointing to attributes + stvd d0, 1(r5) # store repair reg 1 + lvd d0, 8(r8) # r8 was pointing to attributes + stvd d0, 2(r5) # store repair reg 2 + lvd d0, 16(r8) # r8 was pointing to attributes + stvd d0, 3(r5) # store repair reg 3 + lis r0, 0x8000 # load repair #0 with 0x8000_0000 --> disable fence and repr_mux_sel is enabled + stvd d0 , 0(r5) + +################################################################### +########### Update DBG_LCL_REG to enable trace #################### +################################################################### + + lis r5, 0xc000 # local_reg_addr (R5 = C0000120) + ori r5, r5, 0x0120 + andi. r0, r0, 0x0 + andi. r1, r1, 0x0 + oris r0, r0, 0x8A00 # set the bit 0 to enable the debug blot-on + stvd d0, 0(r5) # DBG_LCL_REG + + blr # back to pm_loader + -- cgit v1.2.1