From c7c77ebdea1dde8db80cea43c74673b481571f15 Mon Sep 17 00:00:00 2001 From: "Sunil.Kumar" Date: Thu, 29 Sep 2016 04:04:40 -0500 Subject: Otprom changes Change-Id: I96c82731ebf63e5d3698ac3d4b807eece903d65b Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30463 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Reviewed-by: Sachin Gupta --- src/boot/otprom_init.S | 132 ++++++++++++++++++++++++++++--------------------- 1 file changed, 75 insertions(+), 57 deletions(-) (limited to 'src/boot/otprom_init.S') diff --git a/src/boot/otprom_init.S b/src/boot/otprom_init.S index 3d16f4c7..c2df21e3 100644 --- a/src/boot/otprom_init.S +++ b/src/boot/otprom_init.S @@ -1,27 +1,3 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/boot/otprom_init.S $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# [+] 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 # # include "pk.h" .set r0 , 0 .set r1 , 1 @@ -67,7 +43,36 @@ __otprom_magic_num: __sbe_config_reg: .quad 0x000A800030000000 .endm -oos_start: #R4 --> A0000 R5 --> 5003F R6 --> C000_0818 +oos_start: + +oos_load_cfg_regs: + + # Load the FI2C registers from the OTPROM. + 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) + +####################################################################################### + #R4 --> A0000 R5 --> 5003F R6 --> C000_0818 + # Write into I2CM reset register + # Check valid bit rate divisor is there in scratch_8 (5003F) + # - If yes load that value from 50039 to FI2C config reg and I2CM mode reg + # - If no then load the constant value of 0x3 into both FI2C and mode reg + +####################################################################################### + +oos_load_reg_addrs: lis r4 , 0xA ori r4 , r4 , 0x0 stvd d0 , 1(r4) #Write reset reg . A0001 @@ -78,7 +83,7 @@ oos_start: #R4 --> A0000 R5 --> 5003F lvd d2 , 0x39(r5) andis. r2 , r2 , 0xffff #delete last 2 bytes Confirmed first 2 bytes has Bit rate divisor -oos_write_mode_reg: +oos_write_i2cmmode_FI2CCFG_reg: lvd d0 , 6(r4) #D0 --> old mode reg and D2 --> has new brd andi. r0 , r0 , 0xffff or r0 , r0 , r2 @@ -95,10 +100,14 @@ oos_write_mode_reg: oos_load_const_brd: lis r2 , 0x3 #load constant BRD = 3 to first 2 bytes of R2 - b oos_write_mode_reg + b oos_write_i2cmmode_FI2CCFG_reg oos_write_mode_done: + +############################### STOP Condition #################################### +# Reset Port_busy regtister + 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 @@ -117,10 +126,17 @@ oos_poll_status_bit_0: 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 + +####################### READ Magic number from SEEPROM ###################### + +#FI2C_read lis r0 , 0xd8a9 +#FI2C_read 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 +#FI2C_read andi. r1 , r1 , 0x0 #Chose address 0x0 of SEEPROM : 0xA8 + +# Read out Selfboot control status register(50008) for port number +# Write that value into SBE config register and PIBI2CM control register to start the magic number read + 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 @@ -129,13 +145,26 @@ oos_chk_port_num: oris r8 , r8 , 0x0200 #make bit 38 of sbe_config_reg bit '1'. (C0000800) stvd d7, -24(r6) #Store SBE_CONFIG local reg + + + +#FI2C_read oos_sel_prim_sprm: +#FI2C_read stvd d0 , 0(r4) #write control register + +#FI2C_read oos_poll_status_bit_2: +#FI2C_read lvd d2 , 2(r4) #poll status reg +#FI2C_read bb1wi r3 , 0xc , oos_poll_status_bit_2 +#FI2C_read lvd d0 , 3(r4) #Read data reg to get magic number + + oos_sel_prim_sprm: - stvd d0 , 0(r4) #write control register +#Read from 0th location of SEEPROM for magic number using FI2C + lis r4 , 0x8000 + ori r4 , r4 , 0x0000 + lvd d0 , 0(r4) -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 + # compared the seeprom data with 0x584950205345504D + # If doesn't match write the error msg into 0x50009 oss_load_constant_magic_num: #Magic number of seeprom = 0x584950205345504D lis r2 , 0x5849 #load constant otprom magic number @@ -144,20 +173,7 @@ oss_load_constant_magic_num: #Magic number of seeprom = 0x 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 @@ -165,15 +181,17 @@ oss_load_constant_magic_num: #Magic number of seeprom = 0x 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 + trap #FIXME hve to give branch to SEEPROM + +#oos_cmp_magic_fail: +# lis r5 , 0x5 #PIB_addr (R5 = 0x00050009) +# ori r5 , r5 , 0x0000 +# lvd d0 , 9(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 -- cgit v1.2.1