summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard J. Knight <rjknight@us.ibm.com>2015-01-28 08:14:46 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-04-09 22:04:14 -0500
commit3f60aa31636637979096fa927d273c7e09b3be48 (patch)
tree1552db505f590b7193460bac8d1078e4f1371634
parent343014b3095462dbec20efe456cbb945d4844b4e (diff)
downloadtalos-hostboot-3f60aa31636637979096fa927d273c7e09b3be48.tar.gz
talos-hostboot-3f60aa31636637979096fa927d273c7e09b3be48.zip
interpret BMC scratch registers
Change-Id: I16b631992271fc03b50f187c11911cdbf7d7c108 RTC:118752 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15430 Tested-by: Jenkins Server Reviewed-by: Brian H. Horton <brianh@linux.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: WILLIAM G. HOFFA <wghoffa@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-rw-r--r--src/HBconfig5
-rw-r--r--src/include/usr/initservice/bootconfigif.H68
-rw-r--r--src/usr/console/HBconfig8
-rw-r--r--src/usr/console/ast2400.C441
-rw-r--r--src/usr/console/makefile5
-rw-r--r--src/usr/initservice/bootconfig/bootconfig.C67
-rw-r--r--src/usr/initservice/bootconfig/bootconfig.H90
-rw-r--r--src/usr/initservice/bootconfig/bootconfig_ast2400.C394
-rw-r--r--src/usr/initservice/bootconfig/bootconfig_ast2400.H231
-rw-r--r--src/usr/initservice/bootconfig/bootconfigif.C95
-rw-r--r--src/usr/initservice/bootconfig/makefile31
-rw-r--r--src/usr/initservice/istepdispatcher/istepdispatcher.C83
-rw-r--r--src/usr/initservice/istepdispatcher/makefile9
-rw-r--r--src/usr/initservice/makefile4
14 files changed, 1439 insertions, 92 deletions
diff --git a/src/HBconfig b/src/HBconfig
index 6902e8a35..8796bfcc9 100644
--- a/src/HBconfig
+++ b/src/HBconfig
@@ -3,3 +3,8 @@ config VPO_COMPILE
default n
help
Compile and build image for VPO environment
+
+config BMC_AST2400
+ default n
+ help
+ Compile hostboot support for AST2400 based BMC
diff --git a/src/include/usr/initservice/bootconfigif.H b/src/include/usr/initservice/bootconfigif.H
new file mode 100644
index 000000000..a255c1852
--- /dev/null
+++ b/src/include/usr/initservice/bootconfigif.H
@@ -0,0 +1,68 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/initservice/bootconfigif.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015 */
+/* [+] 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 */
+#ifndef __INITSERVICE_BOOTCONFIGIF_H
+#define __INITSERVICE_BOOTCONFIGIF_H
+
+#include <trace/interface.H>
+#include <errl/errlentry.H>
+
+extern trace_desc_t *g_trac_initsvc;
+namespace INITSERVICE
+{
+namespace BOOTCONFIG
+{
+ /**
+ * @brief Identifier for the first version layout of the SIO register boot
+ * flags.
+ */
+ const uint8_t BOOT_FLAGS_VERSION_1 = 0x42;
+
+ extern uint8_t CURRENT_CONFIG_VERSION;
+
+ typedef struct
+ {
+ uint8_t istepControl;
+ uint8_t istepMajorNumber;
+ uint8_t istepMinorNumber;
+
+ }istepControl_t;
+
+ // This function will call the actual config class created, or the base
+ // class if non has been created.
+ errlHndl_t readAndProcessBootConfig();
+
+ // Calls the actual subclass or base class if no config class has been
+ // created
+ errlHndl_t readIstepControl( BOOTCONFIG::istepControl_t & o_info );
+
+ // Calls the actual subclass or base class if no config class has been
+ // created
+ errlHndl_t writeIstepControl( BOOTCONFIG::istepControl_t & i_info );
+
+};
+};// end namespace
+#endif
+
+
diff --git a/src/usr/console/HBconfig b/src/usr/console/HBconfig
index 4f667522d..e6b1ebda7 100644
--- a/src/usr/console/HBconfig
+++ b/src/usr/console/HBconfig
@@ -1,10 +1,4 @@
config CONSOLE
- default n
+ default y if BMC_AST2400
help
Enable console support.
-
-config CONSOLE_AST2400
- default y if CONSOLE
- depends on CONSOLE
- help
- Console support for AST2400 device.
diff --git a/src/usr/console/ast2400.C b/src/usr/console/ast2400.C
index db0bf40ae..b2b63c395 100644
--- a/src/usr/console/ast2400.C
+++ b/src/usr/console/ast2400.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2014 */
+/* Contributors Listed Below - COPYRIGHT 2014,2015 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -26,80 +26,235 @@
#include <devicefw/userif.H>
#include <lpc/lpcif.H>
#include <errl/errlmanager.H>
+#include <kernel/console.H>
+#include <devicefw/driverif.H>
+#include <initservice/bootconfigif.H>
namespace CONSOLE
{
+ const uint32_t VUART1_BASE = 0x1E787000;
+ const uint32_t VUART1_GCTRLA = VUART1_BASE + 0x20;
+ const uint32_t VUART1_GCTRLB = VUART1_BASE + 0x24;
+ const uint32_t VUART1_ADDRL = VUART1_BASE + 0x28;
+ const uint32_t VUART1_ADDRH = VUART1_BASE + 0x2c;
-/** Overload the base class with Ast2400 specifices.
- *
- * In initialization we need to program the SIO device on the AST2400 to
- * enable the Uart device.
- */
-class Ast2400Uart : public Uart
-{
- private:
+ const uint8_t SERIAL_IRQ = 4;
+
+ const uint8_t SIO_ADDR_REG_2E = 0x2E;
+ const uint8_t SIO_DATA_REG_2F = 0x2F;
+
+ // used to test config flags related to console outup selection
+ const uint8_t CONFIG_MASK = 0xC0;
+ /** Overload the base class with Ast2400 specifics.
+ *
+ * In initialization we need to program the SIO device on the AST2400 to
+ * enable the Uart device.
+ */
+ class Ast2400Uart : public Uart
+ {
+
+ public:
+ enum consoleConfig_t
+ {
+ NONE = 0x00, // No output selected
+ SELECT_SUART = 0x40, // SIO Uart
+ SELECT_VUART = 0x80, // SOL virtual uart
+ RESERVED = 0xc0, // Reserved
+ };
+
+ private:
+ // $TODO RTC:115576 remove these sio write functions when SIO dd code
+ // is completed
// Perform raw LPC writes to SIO region.
- errlHndl_t _writeReg(uint64_t i_addr, uint8_t i_byte)
+ errlHndl_t _writeReg(uint8_t i_addr, uint8_t i_byte)
{
size_t len = sizeof(i_byte);
return deviceWrite(TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL,
- &i_byte,
- len,
- DEVICE_LPC_ADDRESS(LPC::TRANS_IO, i_addr));
+ &i_byte,
+ len,
+ DEVICE_LPC_ADDRESS(LPC::TRANS_IO, i_addr));
}
- public:
+ // write i_data to register i_reg
+ errlHndl_t writeSIOReg( uint8_t i_reg, uint8_t i_data )
+ {
+ errlHndl_t l_err = NULL;
+
+ do{
- virtual void initialize()
+ l_err = _writeReg( SIO_ADDR_REG_2E, i_data );
+
+ if(l_err) { break; }
+
+ l_err = _writeReg( SIO_DATA_REG_2F, i_reg );
+
+ }while(0);
+
+ return l_err;
+ }
+
+ // Perform reads from the SIO register region.
+ errlHndl_t readSIOReg(uint8_t i_reg, uint8_t &o_byte)
+ {
+ errlHndl_t l_err = NULL;
+
+ size_t len = sizeof(o_byte);
+
+ do{
+ l_err = deviceWrite(
+ TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL,
+ &i_reg,
+ len,
+ DEVICE_LPC_ADDRESS(LPC::TRANS_IO, SIO_ADDR_REG_2E));
+
+ if(l_err) { break; }
+
+ l_err = deviceRead(
+ TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL,
+ &o_byte,
+ len,
+ DEVICE_LPC_ADDRESS(LPC::TRANS_IO, SIO_DATA_REG_2F));
+ }while(0);
+
+ return l_err;
+ }
+
+ // setup the AHB access
+ errlHndl_t ahbSioAddressPrep(uint32_t reg)
+ {
+ errlHndl_t l_err = NULL;
+
+ do{
+ // Select logical device D (LPC2AHB)
+ l_err = writeSIOReg( 0x07, 0x0D );
+ if( l_err ) { break; }
+
+ /* Enable iLPC->AHB */
+ l_err = writeSIOReg( 0x30, 0x01 );
+ if( l_err ) { break; }
+
+ /* Address */
+ l_err = writeSIOReg(0xF0, (reg >> 24) & 0xff);
+ if( l_err ) {break; }
+
+ l_err = writeSIOReg(0xF1, (reg >> 16) & 0xff);
+ if( l_err ) {break; }
+
+ l_err = writeSIOReg(0xF2, (reg >> 8) & 0xff);
+ if( l_err ) {break; }
+
+ l_err = writeSIOReg(0xF3, (reg ) & 0xff);
+ if( l_err ) {break; }
+
+ /* bytes per cycle type */
+ l_err = writeSIOReg(0xF8, 0x02);
+ if( l_err ) {break; }
+
+ }while(0);
+
+ return l_err;
+ }
+
+ errlHndl_t ahbSioWrite(uint32_t reg, uint32_t val )
+ {
+ errlHndl_t l_err = NULL;
+
+ do{
+
+ l_err = ahbSioAddressPrep( reg);
+ if( l_err ) { break; }
+
+ /* Write data */
+ l_err = writeSIOReg(0xF4, val >> 24);
+ if( l_err ) { break; }
+ l_err = writeSIOReg(0xF5, val >> 16);
+ if( l_err ) { break; }
+ l_err = writeSIOReg(0xF6, val >> 8);
+ if( l_err ) { break; }
+ l_err = writeSIOReg(0xF7, val);
+ if( l_err ) { break; }
+
+ /* Trigger the write with the magic number */
+ l_err = writeSIOReg(0xFe, 0xcf);
+
+ }while(0);
+
+ return l_err;
+ }
+
+ errlHndl_t ahbSioRead( uint32_t reg, uint32_t &o_data )
+ {
+ errlHndl_t l_err = NULL;
+ uint8_t tmp_data = 0;
+ o_data = 0;
+
+ do{
+
+ l_err = ahbSioAddressPrep(reg);
+ if(l_err){break;}
+
+ /* Trigger the read - ignore the output data */
+ l_err = readSIOReg(0xFE, tmp_data);
+ if(l_err){break;}
+
+ tmp_data = 0;
+
+ /* Read results */
+ l_err = readSIOReg(0xF4, tmp_data );
+ if(l_err){;break;}
+ o_data = tmp_data;
+
+ l_err = readSIOReg(0xF5, tmp_data );
+ if(l_err){break;}
+ o_data = (o_data << 8) | tmp_data;
+
+ l_err = readSIOReg(0xF6, tmp_data );
+ if(l_err){break;}
+ o_data = (o_data << 8) | tmp_data;
+
+ l_err = readSIOReg(0xF7, tmp_data );
+ if(l_err){break;}
+ o_data = (o_data << 8) | tmp_data;
+
+ }while(0);
+
+ return l_err;
+ }
+
+ private:
+
+ void initializeSUART()
{
errlHndl_t l_errl = NULL;
do
{
-
- // Unlock the SIO registers
- // (write 0xA5 password to offset 0x2E two times)
- l_errl = _writeReg( 0x2e, 0xA5 );
- if (l_errl) { break; }
- l_errl = _writeReg( 0x2e, 0xA5 );
- if (l_errl) { break; }
-
- // Select logical device 2 (SUART1) in SIO
- l_errl = _writeReg( 0x2e, 0x07 ); // select logical dev number
- if (l_errl) { break; }
- l_errl = _writeReg( 0x2f, 0x02 ); // write device 2
+ // Select logical device 2 (SUART1) in SI)
+ l_errl = writeSIOReg( 0x07, 0x02);
if (l_errl) { break; }
// Disable SUART1 to change settings
- l_errl = _writeReg( 0x2e, 0x30 ); // select SIO base enable
- if (l_errl) { break; }
- l_errl = _writeReg( 0x2f, 0x00 ); // clear enable
+ l_errl = writeSIOReg( 0x30, 0x00 );
if (l_errl) { break; }
// Set SUART1 addr to g_uartBase
- l_errl = _writeReg( 0x2e, 0x60 ); // select SIO addr[7:3]
- if (l_errl) { break; }
- l_errl = _writeReg( 0x2f, (g_uartBase >> 8) & 0xFF );
+ l_errl = writeSIOReg( 0x60, (g_uartBase >> 8) & 0xFF );
if (l_errl) { break; }
- l_errl = _writeReg( 0x2e, 0x61 ); // select SIO addr[15:8]
- if (l_errl) { break; }
- l_errl = _writeReg( 0x2f, (g_uartBase & 0xFF) );
+
+ l_errl = writeSIOReg( 61, (g_uartBase & 0xFF) );
if (l_errl) { break; }
// Set the SerIRQ
- l_errl = _writeReg( 0x2e, 0x70 );
+ l_errl = writeSIOReg( 0x70, SERIAL_IRQ );
if (l_errl) { break; }
- l_errl = _writeReg( 0x2f, 0x04 );
- if (l_errl) { break; }
- l_errl = _writeReg( 0x2e, 0x71 );
+
+ l_errl = writeSIOReg( 0x71, 0x01 );
if (l_errl) { break; }
- l_errl = _writeReg( 0x2f, 0x01 );
+
// Enable SUART1
- l_errl = _writeReg( 0x2e, 0x30 ); // select SIO base enable
- if (l_errl) { break; }
- l_errl = _writeReg( 0x2f, 0x01 ); // write enable
+ l_errl = writeSIOReg( 0x30, 0x01 ); // select SIO base enable
if (l_errl) { break; }
//@fixme-RTC:115576 - Leaving SIO unlocked for now to allow
@@ -119,8 +274,202 @@ class Ast2400Uart : public Uart
Uart::initialize();
}
-};
+ // initialize for SOL support
+ void initializeVUART()
+ {
+ errlHndl_t l_err = NULL;
+
+ do{
+ uint32_t v;
+
+ /* configure IRQ level as low */
+ l_err = ahbSioRead(VUART1_GCTRLA, v);
+ if(l_err){break;}
+ v = v & ~2u;
+ l_err = ahbSioWrite(VUART1_GCTRLA, v);
+ if(l_err){break;}
+
+ /* configure the IRQ number */
+ l_err = ahbSioRead(VUART1_GCTRLB, v);
+ if(l_err){break;}
+
+ v = (v & ~0xf0u) | ((SERIAL_IRQ << 4));
+ l_err = ahbSioWrite(VUART1_GCTRLB,v);
+ if(l_err){break;}
+
+ /* configure the address */
+ l_err = ahbSioWrite(VUART1_ADDRL, g_uartBase & 0xff);
+ if(l_err){break;}
+
+ l_err = ahbSioWrite(VUART1_ADDRH, g_uartBase >> 8);
+
+ }while(0);
+
+ if (l_err)
+ {
+ printk("VUART: config failed at\n");
+ setFailed();
+ errlCommit(l_err, CONSOLE_COMP_ID);
+ }
+ else
+ {
+ printk("VUART: config SUCCESS\n" );
+ }
+
+ Uart::initialize();
+ }
+
+ void disableVUART()
+ {
+ errlHndl_t l_err = NULL;
+
+ do{
+ // read the control reg, mask off the enabled bit
+ // and write it back
+ uint32_t reg_value = 0;
+
+ l_err = ahbSioRead(VUART1_GCTRLA, reg_value );
+ if(l_err){break;}
+
+ // mask off the low order bit to mark the vuart as disabled
+ reg_value &= 0xFE;
+ l_err = ahbSioWrite(VUART1_GCTRLA, reg_value );
+ if(l_err){break;}
+
+
+
+ }while(0);
+
+ if (l_err)
+ {
+ errlCommit(l_err, CONSOLE_COMP_ID);
+ }
+ };
+
+ void disableSUART()
+ {
+ errlHndl_t l_err = NULL;
+
+ do{
+
+ // select device 2 - UART1
+ l_err = writeSIOReg(0x07, 0x02);
+ if(l_err){break;}
+
+ // clear the uart enable from base ctl reg
+ l_err = writeSIOReg(0x30, 0);
+
+ }while(0);
+
+ if (l_err)
+ {
+ errlCommit(l_err, CONSOLE_COMP_ID);
+ }
+ };
+
+ virtual void unlockSIO()
+ {
+ errlHndl_t l_err = NULL;
+ do{
+ // Unlock the SIO registers
+ // (write 0xA5 password to offset 0x2E two times)
+ l_err = _writeReg( SIO_ADDR_REG_2E, 0xA5 );
+ if (l_err) { break; }
+
+ l_err = _writeReg( SIO_ADDR_REG_2E, 0xA5 );
+
+ }while(0);
+
+ if (l_err)
+ {
+ errlCommit(l_err, CONSOLE_COMP_ID);
+ }
+
+ }
+
+ public:
+
+ virtual void initialize()
+ {
+ // read the SIO register set by the BMC to determine uart config
+ const uint8_t expected_version =
+ INITSERVICE::BOOTCONFIG::BOOT_FLAGS_VERSION_1;
+
+ uint8_t this_version = 0x00;
+
+ errlHndl_t l_err = NULL;
+
+ uint8_t uart_config = 0x00;
+
+ do{
+ // allow access to the registers
+ unlockSIO();
+
+ // verify the boot flags version from register 0x28
+ l_err = readSIOReg( 0x28, this_version );
+
+ if (l_err) { break; }
+
+ // is it the version we expected?
+ if( expected_version == this_version )
+ {
+ l_err = readSIOReg(0x2d, uart_config);
+
+ if (l_err) { break; }
+
+ // determine which config has been selected
+ consoleConfig_t config =
+ static_cast<consoleConfig_t>(uart_config & CONFIG_MASK);
+
+ switch ( config )
+ {
+ case SELECT_SUART:
+ {
+ printk("ast2400: SUART config in process\n");
+ disableVUART();
+ initializeSUART();
+ break;
+ }
+ case SELECT_VUART:
+ {
+ printk("ast2400: VUART config in process\n");
+ disableSUART();
+ initializeVUART();
+ break;
+ }
+ case NONE:
+ {
+ // no config selected disable both
+ disableSUART();
+ disableVUART();
+ printk("ast2400: no config selected, "
+ "disable console output.\n");
+ }
+ default:
+ {
+ printk("ast2400: invalid config data"
+ " default to SUART configuration\n");
+ initializeSUART();
+ }
+ }
+ }
+ else
+ {
+ // invalid version read from SIO register 0x28
+ printk("ast2400: Invalid boot config version %d\n", this_version);
+ initializeSUART();
+ }
+
+ }while(0);
+
+ if (l_err)
+ {
+ setFailed();
+ errlCommit(l_err, CONSOLE_COMP_ID);
+ }
+ }
+ };
CONSOLE_UART_DEFINE_DEVICE(Ast2400Uart);
-}
+};
diff --git a/src/usr/console/makefile b/src/usr/console/makefile
index 2ff59d71d..b06d79edd 100644
--- a/src/usr/console/makefile
+++ b/src/usr/console/makefile
@@ -5,10 +5,9 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2014
+# Contributors Listed Below - COPYRIGHT 2014,2015
# [+] Google Inc.
# [+] International Business Machines Corp.
-# [+] Google Inc.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,6 +29,6 @@ MODULE = console
OBJS += daemon.o
OBJS += uart.o
OBJS += uartconfig.o
-OBJS += $(if $(CONFIG_CONSOLE_AST2400),ast2400.o)
+OBJS += $(if $(and $(CONFIG_CONSOLE),$(CONFIG_BMC_AST2400)), ast2400.o)
include $(ROOTPATH)/config.mk
diff --git a/src/usr/initservice/bootconfig/bootconfig.C b/src/usr/initservice/bootconfig/bootconfig.C
new file mode 100644
index 000000000..34363049f
--- /dev/null
+++ b/src/usr/initservice/bootconfig/bootconfig.C
@@ -0,0 +1,67 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/initservice/bootconfig/bootconfig.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015 */
+/* [+] 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 */
+/******************************************************************************/
+// Includes
+/******************************************************************************/
+#include <lpc/lpcif.H>
+#include <devicefw/userif.H>
+#include <config.h>
+#include <errl/errlentry.H>
+#include "bootconfig.H"
+
+namespace INITSERVICE
+{
+namespace BOOTCONFIG
+{
+
+ // declare storage for config trace
+ extern trace_desc_t * g_bc_trace;
+
+
+ BootConfig::BootConfig()
+ {};
+
+ BootConfig::~BootConfig()
+ {};
+
+ errlHndl_t BootConfig::readAndProcessBootConfig()
+ {
+ TRACFCOMP(g_bc_trace, "readAndProcessBootConfig() - Default version called no-op");
+ return NULL;
+ }
+
+ errlHndl_t BootConfig::readIstepControl(istepControl_t & o_stepInfo)
+ {
+ TRACFCOMP(g_bc_trace, "readIstepControl() - Default version called no-op");
+ return NULL;
+ }
+
+ errlHndl_t BootConfig::writeIstepControl( istepControl_t & i_stepInfo)
+ {
+ TRACFCOMP(g_bc_trace, "writeIstepControl() - Default version called no-op");
+ return NULL;
+ }
+};
+}; // end namespace
diff --git a/src/usr/initservice/bootconfig/bootconfig.H b/src/usr/initservice/bootconfig/bootconfig.H
new file mode 100644
index 000000000..7f135bc41
--- /dev/null
+++ b/src/usr/initservice/bootconfig/bootconfig.H
@@ -0,0 +1,90 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/initservice/bootconfig/bootconfig.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015 */
+/* [+] 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 */
+#ifndef __INITSERVICE_BOOTCONFIG_H
+#define __INITSERVICE_BOOTCONFIG_H
+
+#include <initservice/bootconfigif.H>
+#include <errl/errlentry.H>
+namespace INITSERVICE
+{
+namespace BOOTCONFIG
+{
+
+ extern uint8_t CURRENT_CONFIG_VERSION;
+
+/**
+ * @brief BootConfig Class
+ * This is the base class used to configure hostboot via external methods,
+ * an example is using a set of shared registers between hostboot and the
+ * BMC. The base class is a no-op, any actual configuration should be done
+ * in a subclass - see AST2400BootConfig as an example.
+
+ */
+ class BootConfig
+ {
+ public:
+
+ BootConfig();
+
+ virtual ~BootConfig();
+
+ /**
+ * @brief Read and process the Boot configuration info specific to this
+ * platform. - base class implementation is a no-op
+ */
+ virtual errlHndl_t readAndProcessBootConfig();
+
+ /**
+ * @brief Read the istep control data from the platform specific location
+ * NOTE: base class implemetation is a no-op
+ *
+ * @param[out] o_istepInfo - ISTEP control structure containing the
+ * next control action as well as next istep
+ * information.
+ */
+ virtual errlHndl_t readIstepControl(
+ BOOTCONFIG::istepControl_t & o_info);
+
+ /**
+ * @brief Write the istep control data
+ * NOTE: base class implemetation is a no-op
+ *
+ * @param[in] i_istepInfo - ISTEP control structure containing the
+ * next control action as well as next istep
+ * information.
+ */
+
+ virtual errlHndl_t writeIstepControl(
+ BOOTCONFIG::istepControl_t & i_info );
+
+ };
+
+
+};// end namespace
+};
+
+#endif
+
+
diff --git a/src/usr/initservice/bootconfig/bootconfig_ast2400.C b/src/usr/initservice/bootconfig/bootconfig_ast2400.C
new file mode 100644
index 000000000..56f6c8500
--- /dev/null
+++ b/src/usr/initservice/bootconfig/bootconfig_ast2400.C
@@ -0,0 +1,394 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/initservice/bootconfig/bootconfig_ast2400.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015 */
+/* [+] 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 */
+/******************************************************************************/
+// Includes
+/******************************************************************************/
+#include "bootconfig_ast2400.H"
+#include <lpc/lpcif.H>
+#include <devicefw/userif.H>
+#include <errl/errlentry.H>
+#include <trace/interface.H>
+#include <hwas/common/deconfigGard.H>
+#include <console/consoleif.H>
+#include <config.h>
+
+namespace INITSERVICE
+{
+namespace BOOTCONFIG
+{
+
+// declare storage for config trace
+extern trace_desc_t * g_bc_trace;
+
+AST2400BootConfig::AST2400BootConfig()
+{
+ CURRENT_CONFIG_VERSION = BOOT_FLAGS_VERSION_1;
+};
+
+
+AST2400BootConfig::~AST2400BootConfig()
+{};
+
+// ----------------------------------------------------------------------------
+// configureBootMode()
+// ----------------------------------------------------------------------------
+void AST2400BootConfig::configureBootMode(uint8_t i_bootMode )
+{
+ // assume boot mode is exclusive..
+ switch( i_bootMode )
+ {
+ case NORMAL:
+ {
+ TRACFCOMP(g_bc_trace,
+ "configureBootMode() - Boot Mode = NORMAL");
+ break;
+ }
+ // RTC:123376 - Need to investigate if any additional flags need to be
+ // set or if terminate on error is sufficient
+ case TERMINATE_ON_ERROR:
+ {
+
+ TARGETING::Target* l_pTopLevel = NULL;
+ TARGETING::targetService().getTopLevelTarget(l_pTopLevel);
+
+ TRACFCOMP(g_bc_trace,
+ "configureBootMode() - Boot Mode = TERMINATE_ON_ERROR");
+
+ l_pTopLevel->setAttr<TARGETING::ATTR_MNFG_FLAGS>
+ (TARGETING::MNFG_FLAG_SRC_TERM );
+ break;
+ }
+
+ case ISTEP_MODE:
+ {
+ TRACFCOMP(g_bc_trace,
+ "configureBootMode() - Boot Mode = ISTEP MODE");
+
+ TARGETING::Target* l_pTopLevel = NULL;
+ TARGETING::targetService().getTopLevelTarget(l_pTopLevel);
+
+ l_pTopLevel->setAttr<TARGETING::ATTR_ISTEP_MODE>(1);
+
+ break;
+ }
+
+ default:
+ TRACFCOMP(g_bc_trace,
+ "WRN>>configureBootMode() - Boot mode = "
+ "INVALID[0x%x] default to normal", i_bootMode );
+ break;
+
+ break;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// configureHbLogLevel()
+// ----------------------------------------------------------------------------
+void AST2400BootConfig::configureHbLogLevel(uint8_t i_logOptions )
+{
+
+ switch( i_logOptions )
+ {
+ case LOG_ENABLE_SCAN_TRACE:
+ {
+ TRACFCOMP(g_bc_trace,
+ "configureHbLogLevel() - Log level = enable scan trace");
+
+ // enable the scan trace for now.
+ TARGETING::Target* l_pTopLevel = NULL;
+ TARGETING::targetService().getTopLevelTarget(l_pTopLevel);
+
+ TARGETING::HbSettings hbSettings =
+ l_pTopLevel->getAttr<TARGETING::ATTR_HB_SETTINGS>();
+
+ // if its not already set, then set it.
+ if( !hbSettings.traceScanDebug )
+ {
+ hbSettings.traceScanDebug = 1;
+
+ l_pTopLevel->setAttr<
+ TARGETING::ATTR_HB_SETTINGS>(hbSettings);
+ }
+
+ break;
+ }
+
+ default:
+ {
+ // do nothing
+ TRACFCOMP(g_bc_trace,
+ "configureLogLevel() - Log level = NORMAL");
+
+ break;
+ }
+ }
+
+}
+
+// ----------------------------------------------------------------------------
+// configureBootOptions()
+// ----------------------------------------------------------------------------
+void AST2400BootConfig::configureBootOptions(uint8_t i_bootOptions )
+{
+ // clear gard records?
+ if( i_bootOptions & CLEAR_GARD_RECORDS )
+ {
+ TRACFCOMP(g_bc_trace,
+ "configureBootOptions()"
+ " clearing gard records");
+
+ errlHndl_t errl = HWAS::theDeconfigGard().clearGardRecords(NULL);
+
+ if(errl)
+ {
+ errl->collectTrace( "BOOT_CFG", 512 );
+ errlCommit(errl,INITSVC_COMP_ID);
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+// readAndProcessBootConfig()
+// ----------------------------------------------------------------------------
+errlHndl_t AST2400BootConfig::readAndProcessBootConfig()
+{
+
+ TRACDCOMP(g_bc_trace, ENTER_MRK"readAndProcessBootConfig()");
+
+ errlHndl_t l_err = NULL;
+
+ uint8_t register_data = 0;
+
+ do{
+
+ l_err = unlockSIORegisters();
+
+ if(l_err)
+ {
+ TRACFCOMP(g_bc_trace, "readAndProcessBootConfig()"
+ " call to unlock SIO registers failed");
+ break;
+ }
+
+ // read the register holding the agreed upon magic
+ // number to indicate registers have been configured
+ l_err = readSIORegister( BOOT_FLAGS_VERSION_REG, register_data );
+
+ if( l_err )
+ {
+ TRACFCOMP(g_bc_trace,"Failed reading the boot flags version, skip processing");
+ break;
+ }
+
+ if( register_data != BOOT_FLAGS_VERSION_1 )
+ {
+
+ TRACFCOMP(g_bc_trace,"WRN>>readAndProcessBootConfig() - "
+ "boot flags not correct version"
+ " 0x%x!=0x%x", register_data, BOOT_FLAGS_VERSION_1 );
+
+#ifdef CONFIG_CONSOLE
+ CONSOLE::displayf(NULL, "Ignoring boot flags, incorrect version 0x%x", register_data);
+ CONSOLE::flush();
+#endif
+
+ break;
+ }
+
+ // read the SIO register holding the boot flags
+ l_err = readSIORegister( BOOT_FLAGS_REG, register_data );
+
+ if( l_err )
+ {
+ TRACFCOMP(g_bc_trace,"Failed reading the boot flags, leave"
+ " settings at default values");
+
+ break;
+ }
+
+ processBootFlagsV1( register_data );
+
+ }while(0);
+
+ // leave SIO registers unlocked, pnor code is dependant on
+ // having access to them
+
+ TRACDCOMP(g_bc_trace, EXIT_MRK"readAndProcessBootConfig()");
+
+ return l_err;
+}
+
+// ----------------------------------------------------------------------------
+// processBootFlagsV1()
+// ----------------------------------------------------------------------------
+void AST2400BootConfig::processBootFlagsV1( uint8_t i_flags )
+{
+ configureBootMode( i_flags & BOOT_MODE_FLAGS );
+
+ configureBootOptions( i_flags & BOOT_OPTIONS_FLAGS );
+
+ configureHbLogLevel( i_flags & LOG_LEVEL_FLAGS );
+}
+
+// ----------------------------------------------------------------------------
+// readIstepControl()
+// ----------------------------------------------------------------------------
+errlHndl_t AST2400BootConfig::readIstepControl( istepControl_t &o_stepInfo )
+{
+ errlHndl_t l_err = NULL;
+
+ do
+ {
+ // read istep control from 0x2a
+ l_err = readSIORegister( ISTEP_CONTROL_REG, o_stepInfo.istepControl );
+
+ if(l_err) break;
+
+ // read major number from 0x2b
+ l_err = readSIORegister( ISTEP_MAJOR_REG, o_stepInfo.istepMajorNumber );
+ if(l_err) break;
+
+ // read minor number from 0x2c
+ l_err = readSIORegister( ISTEP_MINOR_REG, o_stepInfo.istepMinorNumber );
+ }
+ while(0);
+
+ return l_err;
+}
+
+
+// $TODO RTC:115576 remove these functions
+errlHndl_t AST2400BootConfig::readSIORegister( uint8_t i_addr,
+ uint8_t &o_data )
+{
+
+ errlHndl_t l_err = NULL;
+
+ o_data = 0;
+
+ size_t length = sizeof(o_data);
+
+ // write the value of the read register
+ l_err = deviceWrite( TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL,
+ &i_addr,
+ length,
+ DEVICE_LPC_ADDRESS(LPC::TRANS_IO, SIO_ADDR_REG));
+
+ if( l_err == NULL )
+ {
+
+ // get the register contents.
+ l_err = deviceRead(
+ TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL,
+ (void *)&o_data,
+ length,
+ DEVICE_LPC_ADDRESS(LPC::TRANS_IO, SIO_DATA_REG));
+ }
+
+ return l_err;
+
+}
+
+// $TODO RTC:115576 remove these function
+errlHndl_t AST2400BootConfig::writeSIORegister( uint8_t i_addr,
+ uint8_t i_data )
+{
+
+ size_t length = sizeof(i_data);
+
+ errlHndl_t l_err = NULL;
+
+ l_err = deviceWrite(
+ TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL,
+ &i_addr,
+ length,
+ DEVICE_LPC_ADDRESS(LPC::TRANS_IO, SIO_ADDR_REG ));
+
+ if( l_err == NULL )
+ {
+ l_err = deviceWrite(
+ TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL,
+ &i_data,
+ length,
+ DEVICE_LPC_ADDRESS(LPC::TRANS_IO, SIO_DATA_REG ));
+ }
+
+ return l_err;
+}
+
+// $TODO RTC:115576 remove these function
+errlHndl_t AST2400BootConfig::unlockSIORegisters()
+{
+ errlHndl_t l_err = NULL;
+ uint8_t key = SIO_REG_UNLOCK_KEY;
+ size_t length = sizeof(key);
+
+ do {
+
+ // Write out the register address
+ l_err = deviceWrite(
+ TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL,
+ &key,
+ length,
+ DEVICE_LPC_ADDRESS(LPC::TRANS_IO,SIO_ADDR_REG) );
+
+ if(l_err) break;
+
+ // Write out the register address
+ l_err = deviceWrite(
+ TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL,
+ &key,
+ length,
+ DEVICE_LPC_ADDRESS(LPC::TRANS_IO,SIO_ADDR_REG) );
+
+ }while(0);
+
+ return l_err;
+}
+
+// $TODO RTC:115576 remove these function
+void AST2400BootConfig::lockSIORegisters()
+{
+ // write the data to lock it back up..
+ uint8_t key = SIO_REG_LOCK_KEY;
+ size_t length = sizeof(uint8_t);
+
+ // Write out the register address
+ errlHndl_t l_err = deviceWrite(
+ TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL,
+ &key,
+ length,
+ DEVICE_LPC_ADDRESS(LPC::TRANS_IO,SIO_ADDR_REG) );
+
+ if(l_err)
+ {
+ TRACFCOMP(g_bc_trace, "FAILED locking SIO registers");
+ errlCommit(l_err, ISTEP_COMP_ID);
+ }
+}
+
+};
+};
diff --git a/src/usr/initservice/bootconfig/bootconfig_ast2400.H b/src/usr/initservice/bootconfig/bootconfig_ast2400.H
new file mode 100644
index 000000000..68c46149f
--- /dev/null
+++ b/src/usr/initservice/bootconfig/bootconfig_ast2400.H
@@ -0,0 +1,231 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/initservice/bootconfig/bootconfig_ast2400.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015 */
+/* [+] 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 */
+#ifndef __INITSERVICE_BOOTCONFIG_AST2400_H
+#define __INITSERIVCE_BOOTCONFIG_AST2400_H
+
+#include "bootconfig.H"
+namespace INITSERVICE
+{
+namespace BOOTCONFIG
+{
+
+
+/**
+ * @brief AST2400BootConfig Class
+ * This class contains all of the logic and necessary information to
+ * read the SIO registers which are shared by the AMI BMC and Hostboot.
+ * The registers are used to write configuration information which is used by
+ * Hostboot during the IPL, the registers can be updated using IPMI commands.
+ */
+class AST2400BootConfig : public BootConfig
+{
+
+ /**********************************************************************/
+ // Globals/Constants
+ /**********************************************************************/
+
+
+ /************************************************************************/
+ // Typedef/Enumerations
+ /************************************************************************/
+ enum {
+
+ // Hostboot/BMC shared register addresses.
+ BOOT_FLAGS_VERSION_REG = 0x28,
+ BOOT_FLAGS_REG = 0x29,
+ ISTEP_CONTROL_REG = 0x2a,
+ ISTEP_MAJOR_REG = 0x2b,
+ ISTEP_MINOR_REG = 0x2c,
+ PLAT_FLAGS_REG = 0x2d,
+
+ // SIO address/data register
+ SIO_ADDR_REG = 0x2e,
+ SIO_DATA_REG = 0x2f,
+
+ // lock/unlock keys for SIO register access
+ SIO_REG_UNLOCK_KEY = 0xA5,
+ SIO_REG_LOCK_KEY = 0xAA,
+ };
+
+ // masks to select flags from SIO register
+ enum bootFlagMask_t
+ {
+ LOG_LEVEL_FLAGS = 0x07,
+ RESERVED_FLAGS = 0x08,
+ BOOT_OPTIONS_FLAGS = 0x30,
+ BOOT_MODE_FLAGS = 0xC0,
+ };
+
+ // Masks to test boot mode flags from config register
+ enum bootModeFlags
+ {
+ NORMAL = 0x00,
+ TERMINATE_ON_ERROR = 0x40,
+ ISTEP_MODE = 0x80,
+ };
+
+ // Masks to test boot options flags from config register
+ enum bootOptionsFlags
+ {
+ CLEAR_GARD_RECORDS = 0x20,
+ };
+
+ // Masks to test log level flags from config register
+ enum LogLevel
+ {
+ LOG_LEVEL_NORMAL = 0x00,
+ LOG_ENABLE_SCAN_TRACE = 0x01,
+ };
+
+public:
+
+ /**
+ * @brief Default constructor
+ *
+ */
+ AST2400BootConfig();
+
+ /**
+ * @brief Destructor
+ *
+ */
+ ~AST2400BootConfig();
+
+ /**
+ * @brief Read BMC Scratch registers which contain ISTEP control
+ * information
+ *
+ * @param[out] o_istepInfo - ISTEP control structure containing the
+ * next control action as well as next istep
+ * information.
+ * @return - errlHndl_t
+ *
+ * SIO Register : Contents
+ * 0x2a Istep control
+ * 0x2b Major step number
+ * 0x2C Minor step number
+ */
+ errlHndl_t readIstepControl(istepControl_t & o_istepInfo );
+
+ /**
+ * @brief Read BMC Scratch registers containing the boot flags
+ * and process them as needed.
+ *
+ * SIO Register 0x29: Boot Flags
+ *
+ * [0:1] Boot mode:
+ * 00 : Normal
+ * 01 : Terminate on first error
+ * 10 : istep mode
+ * 11 : reserved
+ * [2:3] Boot options
+ * 00 : reserved
+ * 01 : reserved
+ * 10 : Clear gard
+ * 11 : reserved
+ * [ 4 ] Reserved
+ * [5:7] Hostboot Log level:
+ * 000 : Normal
+ * 001 : Enable Scan trace
+ * xxx : reserved
+ *
+ * @return - errlHndl_t
+ */
+ errlHndl_t readAndProcessBootConfig();
+
+ /**
+ * @brief Process the boot mode from the boot flags register.
+ *
+ * @param[i] i_mode - boot mode as set in the boot flags reg.
+ *
+ */
+ void configureBootMode( uint8_t i_mode );
+
+ /**
+ * @brief Process boot options from boot flags register
+ *
+ * @param[i] i_options - requested boot options as set in the boot flags
+ * reg.
+ *
+ */
+ void configureBootOptions( uint8_t i_options );
+
+ /**
+ * @brief Process the Hostboot logging options from boot flags register
+ *
+ * @param[i] i_logOptions - requested hb logging options
+ *
+ */
+ void configureHbLogLevel( uint8_t i_logOptions );
+
+ /**
+ * @brief process version one of the boot flags
+ * layout
+ *
+ * @param[i] i_flags - contents of SIO register 0x29
+ *
+ *
+ *
+ */
+ void processBootFlagsV1( uint8_t i_flags );
+
+ // $TODO RTC:115576 remove these temporary SIO related functions
+ /**
+ * @brief read a byte from an SIO register
+ *
+ * @param[i] i_addr - address of SIO register to read
+ * @param[o] o_data - SIO register contents
+ *
+ * @return errlHndl_t
+ */
+ errlHndl_t readSIORegister( uint8_t i_addr, uint8_t &register_value );
+
+ /**
+ * @brief Write a byte to an SIO register
+ *
+ * @param[i] i_addr - address of SIO register to write
+ * @param[i] i_data - SIO register contents
+ *
+ * @return errlHndl_t
+ */
+ errlHndl_t writeSIORegister( uint8_t i_addr, uint8_t i_data );
+
+ /**
+ * @brief Allow read/write access to the SIO registers
+ *
+ * @return errlHndl_t
+ */
+ errlHndl_t unlockSIORegisters();
+
+ /**
+ * @brief Lock the SIO registers
+ */
+ void lockSIORegisters();
+
+};
+
+};
+};
+#endif
diff --git a/src/usr/initservice/bootconfig/bootconfigif.C b/src/usr/initservice/bootconfig/bootconfigif.C
new file mode 100644
index 000000000..05c4e0e55
--- /dev/null
+++ b/src/usr/initservice/bootconfig/bootconfigif.C
@@ -0,0 +1,95 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/initservice/bootconfig/bootconfigif.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015 */
+/* [+] 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 */
+/******************************************************************************/
+// Includes
+/******************************************************************************/
+#include <lpc/lpcif.H>
+#include <devicefw/userif.H>
+#include <config.h>
+#include <errl/errlentry.H>
+#include <initservice/bootconfigif.H>
+#include "bootconfig.H"
+#include "bootconfig_ast2400.H"
+#include <config.h>
+
+namespace INITSERVICE
+{
+namespace BOOTCONFIG
+{
+ enum
+ {
+ UNINITIALIZED = 0xFE,
+ };
+
+ uint8_t CURRENT_CONFIG_VERSION = UNINITIALIZED;
+
+ // declare storage for isteps_trace!
+ trace_desc_t * g_bc_trace = NULL;
+
+ TRAC_INIT(&g_bc_trace, "BOOT_CFG", 2*KILOBYTE);
+
+ class ConfigFactory
+ {
+ public:
+
+ ~ConfigFactory(){};
+
+ static BootConfig& getConfigObject( uint8_t config_version )
+ {
+ {
+ #if CONFIG_BMC_AST2400
+ return Singleton<AST2400BootConfig>::instance();
+ #else
+ return Singleton<BootConfig>::instance();
+ #endif
+ }
+ }
+
+ private:
+ ConfigFactory(){};
+
+ };
+
+
+ errlHndl_t readAndProcessBootConfig()
+ {
+ return ConfigFactory::getConfigObject(
+ CURRENT_CONFIG_VERSION).readAndProcessBootConfig();
+ }
+
+ errlHndl_t readIstepControl( BOOTCONFIG::istepControl_t & o_stepInfo )
+ {
+ return ConfigFactory::getConfigObject(
+ CURRENT_CONFIG_VERSION ).readIstepControl(o_stepInfo);
+ }
+
+ errlHndl_t writeIstepControl( BOOTCONFIG::istepControl_t & i_stepInfo )
+ {
+ return ConfigFactory::getConfigObject(
+ CURRENT_CONFIG_VERSION ).writeIstepControl(i_stepInfo);
+ }
+
+};
+};
diff --git a/src/usr/initservice/bootconfig/makefile b/src/usr/initservice/bootconfig/makefile
new file mode 100644
index 000000000..10ddbb1d9
--- /dev/null
+++ b/src/usr/initservice/bootconfig/makefile
@@ -0,0 +1,31 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/initservice/bootconfig/makefile $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2015
+# [+] 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
+ROOTPATH = ../../../../../
+
+BOOTCFG_OBJS = bootconfig.o
+BOOTCFG_OBJS += bootconfigif.o
+BOOTCFG_OBJS += $(if $(CONFIG_BMC_AST2400),bootconfig_ast2400.o)
+
+include ${ROOTPATH}/config.mk
diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C
index a46c671df..d3581e969 100644
--- a/src/usr/initservice/istepdispatcher/istepdispatcher.C
+++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C
@@ -70,6 +70,8 @@
#include <config.h>
#include <ipmi/ipmisensor.H>
+#include <initservice/bootconfigif.H>
+
namespace ISTEPS_TRACE
{
// declare storage for isteps_trace!
@@ -124,8 +126,6 @@ IStepDispatcher::IStepDispatcher() :
TARGETING::targetService().getTopLevelTarget(l_pSys);
iv_mpiplMode = l_pSys->getAttr<TARGETING::ATTR_IS_MPIPL_HB>();
TRACFCOMP(g_trac_initsvc, "IStepDispatcher: MPIPL Mode: %d", iv_mpiplMode);
- iv_istepMode = l_pSys->getAttr<TARGETING::ATTR_ISTEP_MODE>();
- TRACFCOMP(g_trac_initsvc, "IStepDispatcher: IStep Mode: %d", iv_istepMode);
iv_spBaseServicesEnabled = spBaseServicesEnabled();
TRACFCOMP(g_trac_initsvc, "IStepDispatcher: SP base Services Enabled: %d",
iv_spBaseServicesEnabled);
@@ -181,6 +181,18 @@ void IStepDispatcher::init(errlHndl_t &io_rtaskRetErrl)
printk( "IStepDispatcher entry.\n" );
TRACFCOMP( g_trac_initsvc, "IStepDispatcher entry." );
+ // Read the and process the Hostboot configuration flags
+ BOOTCONFIG::readAndProcessBootConfig();
+
+ TARGETING::Target* l_pTopLevelTarget = NULL;
+ TARGETING::targetService().getTopLevelTarget(l_pTopLevelTarget);
+
+ assert(l_pTopLevelTarget != NULL );
+
+ iv_istepMode = l_pTopLevelTarget->getAttr<TARGETING::ATTR_ISTEP_MODE>();
+
+ TRACFCOMP(g_trac_initsvc, "IStepDispatcher: IStep Mode: %d", iv_istepMode);
+
do
{
if(iv_mailboxEnabled)
@@ -253,19 +265,9 @@ void IStepDispatcher::init(errlHndl_t &io_rtaskRetErrl)
{
// Base Services available. Figure out if HWSV has overrides
uint8_t l_attrOverridesExist = 0;
- TARGETING::Target* l_pTopLevelTarget = NULL;
- TARGETING::targetService().getTopLevelTarget(l_pTopLevelTarget);
- if (l_pTopLevelTarget == NULL)
- {
- TRACFCOMP(g_trac_initsvc,
- "init: ERROR: Top level target not found");
- }
- else
- {
- l_attrOverridesExist = l_pTopLevelTarget->
+ l_attrOverridesExist = l_pTopLevelTarget->
getAttr<TARGETING::ATTR_PLCK_IPL_ATTR_OVERRIDES_EXIST>();
- }
if (l_attrOverridesExist)
{
@@ -291,11 +293,13 @@ void IStepDispatcher::init(errlHndl_t &io_rtaskRetErrl)
}
else
{
- TRACFCOMP(g_trac_initsvc,"init: processing temporary overrides");
+ TRACFCOMP(g_trac_initsvc,"init: processing temporary "
+ "overrides");
err = TARGETING::getAttrOverrides(l_sectionInfo);
if (err)
{
- TRACFCOMP(g_trac_initsvc,"Failed getAttrOverrides: getting temporary overrides");
+ TRACFCOMP(g_trac_initsvc,"Failed getAttrOverrides: "
+ "getting temporary overrides");
break;
}
}
@@ -309,11 +313,13 @@ void IStepDispatcher::init(errlHndl_t &io_rtaskRetErrl)
}
else
{
- TRACFCOMP(g_trac_initsvc,"init: processing permanent overrides");
+ TRACFCOMP(g_trac_initsvc,"init: processing permanent"
+ " overrides");
err = TARGETING::getAttrOverrides(l_sectionInfo);
if (err)
{
- TRACFCOMP(g_trac_initsvc,"Failed getAttrOverrides: getting permanent overrides");
+ TRACFCOMP(g_trac_initsvc,"Failed getAttrOverrides: "
+ "getting permanent overrides");
break;
}
}
@@ -493,7 +499,8 @@ errlHndl_t IStepDispatcher::executeAllISteps()
errlCommit(err, INITSVC_COMP_ID);
istep = newIstep;
substep = newSubstep;
- TRACFCOMP(g_trac_initsvc, ERR_MRK"executeAllISteps: Reconfig Loop: Back to %d:%d",
+ TRACFCOMP(g_trac_initsvc, ERR_MRK"executeAllISteps: "
+ "Reconfig Loop: Back to %d:%d",
istep, substep);
continue;
}
@@ -514,8 +521,8 @@ errlHndl_t IStepDispatcher::executeAllISteps()
if (err)
{
- TRACFCOMP(g_trac_initsvc, ERR_MRK"executeAllISteps: IStep Error on %d:%d",
- istep, substep);
+ TRACFCOMP(g_trac_initsvc, ERR_MRK"executeAllISteps: "
+ "IStep Error on %d:%d", istep, substep);
break;
}
substep++;
@@ -554,8 +561,8 @@ errlHndl_t IStepDispatcher::doIstep(uint32_t i_istep,
// If the step has valid work to be done, then execute it.
if(NULL != theStep)
{
- TRACFCOMP(g_trac_initsvc,ENTER_MRK"doIstep: step %d, substep %d, task %s",
- i_istep, i_substep, theStep->taskname);
+ TRACFCOMP(g_trac_initsvc,ENTER_MRK"doIstep: step %d, substep %d, "
+ "task %s", i_istep, i_substep, theStep->taskname);
// Send progress codes if in run-all mode
if (!iv_istepMode)
@@ -651,14 +658,15 @@ errlHndl_t IStepDispatcher::doIstep(uint32_t i_istep,
{
if(isAttrSyncEnabled())
{
- TRACFCOMP(g_trac_initsvc, INFO_MRK"doIstep: sync attributes to FSP");
+ TRACFCOMP(g_trac_initsvc,
+ INFO_MRK"doIstep: sync attributes to FSP");
errlHndl_t l_errl = TARGETING::syncAllAttributesToFsp();
if(l_errl)
{
- TRACFCOMP(g_trac_initsvc, ERR_MRK"doIstep: syncattributes failed see %x for details",
- l_errl->eid());
+ TRACFCOMP(g_trac_initsvc, ERR_MRK"doIstep: sync attributes"
+ " failed see %x for details", l_errl->eid());
errlCommit(l_errl, INITSVC_COMP_ID);
}
}
@@ -681,7 +689,8 @@ errlHndl_t IStepDispatcher::doIstep(uint32_t i_istep,
if ( err )
{
- TRACFCOMP( g_trac_initsvc, ERR_MRK"doIstep: error from checkForIplAttentions");
+ TRACFCOMP( g_trac_initsvc, ERR_MRK"doIstep: error from "
+ "checkForIplAttentions");
}
}
@@ -706,7 +715,8 @@ errlHndl_t IStepDispatcher::doIstep(uint32_t i_istep,
if (HWAS::hwasPLDDetection())
{
// There was a PLD, clear any deferred deconfig records
- TRACFCOMP(g_trac_initsvc, ERR_MRK"doIstep: PLD, clearing deferred deconfig records");
+ TRACFCOMP(g_trac_initsvc, ERR_MRK"doIstep: PLD, clearing deferred "
+ "deconfig records");
HWAS::theDeconfigGard().clearDeconfigureRecords(NULL);
}
else
@@ -717,11 +727,13 @@ errlHndl_t IStepDispatcher::doIstep(uint32_t i_istep,
}
// Check if ATTR_RECONFIGURE_LOOP is non-zero
- TARGETING::ATTR_RECONFIGURE_LOOP_type l_reconfigAttr = l_pTopLevel->getAttr<TARGETING::ATTR_RECONFIGURE_LOOP>();
+ TARGETING::ATTR_RECONFIGURE_LOOP_type l_reconfigAttr =
+ l_pTopLevel->getAttr<TARGETING::ATTR_RECONFIGURE_LOOP>();
+
if (l_reconfigAttr)
{
- TRACFCOMP(g_trac_initsvc, ERR_MRK"doIstep: Reconfigure needed, ATTR_RECONFIGURE_LOOP = %d",
- l_reconfigAttr);
+ TRACFCOMP(g_trac_initsvc, ERR_MRK"doIstep: Reconfigure needed, "
+ "ATTR_RECONFIGURE_LOOP = %d", l_reconfigAttr);
o_doReconfig = true;
}
@@ -730,7 +742,8 @@ errlHndl_t IStepDispatcher::doIstep(uint32_t i_istep,
}
else
{
- TRACDCOMP( g_trac_initsvc, INFO_MRK"doIstep: Empty Istep, nothing to do!" );
+ TRACDCOMP( g_trac_initsvc,
+ INFO_MRK"doIstep: Empty Istep, nothing to do!" );
}
return err;
@@ -1816,7 +1829,7 @@ bool IStepDispatcher::checkReconfig(const uint8_t i_curIstep,
const uint16_t OUTER_START = (OUTER_START_STEP << 8) | OUTER_START_SUBSTEP;
const uint16_t OUTER_STOP = (OUTER_STOP_STEP << 8) | OUTER_STOP_SUBSTEP;
- // TODO RTC 101925. PRD enables FIRs in Istep 11. If Istep 12 deconfigures
+ // TODO RTC:101925. PRD enables FIRs in Istep 11. If Istep 12 deconfigures
// HW that is asserting FIRs and performs the Inner Reconfig Loop then PRD
// ends up logging errors when it sees FIR bits for the deconfigured HW.
// The fix is to dispense with the Inner Reconfig Loop, if the code loops
@@ -2021,7 +2034,7 @@ void IStepDispatcher::reconfigLoopTestRunner( uint8_t i_step,
{
TRACFCOMP(g_trac_initsvc, INFO_MRK"reconfigLoopTestRunner: "
"Step: %d.%d, "
- "Target HUID: 0x%08X not functional, skipping test.",
+ "Target HUID: 0x%08X not functional, skiping test.",
i_step, i_substep,
l_p_reconfigLoopTests->test[i].deconfigTargetHuid);
}
@@ -2150,6 +2163,7 @@ void IStepDispatcher::istepPauseSet(uint8_t i_step, uint8_t i_substep)
"pauseLen=0x%02X, Permanent pause enabled.",
l_p_pauseCfg->pauseLen
);
+ CONSOLE::flush();
#endif
while(1)
{
@@ -2164,4 +2178,5 @@ void IStepDispatcher::istepPauseSet(uint8_t i_step, uint8_t i_substep)
}
}
}
-} // namespace
+
+}; // namespace
diff --git a/src/usr/initservice/istepdispatcher/makefile b/src/usr/initservice/istepdispatcher/makefile
index 21f3748c0..9f47a6b8d 100644
--- a/src/usr/initservice/istepdispatcher/makefile
+++ b/src/usr/initservice/istepdispatcher/makefile
@@ -5,7 +5,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2011,2014
+# Contributors Listed Below - COPYRIGHT 2011,2015
+# [+] 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.
@@ -29,10 +31,15 @@ EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi
EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat
EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp
+VPATH = ${ROOTPATH}/src/usr/initservice/bootconfig/
+
OBJS += istepdispatcher.o
OBJS += initsvcudistep.o
OBJS += sptask.o
OBJS += splesscommon.o
+OBJS += bootconfig.o
+OBJS += bootconfigif.o
+OBJS += $(if $(CONFIG_BMC_AST2400),bootconfig_ast2400.o)
## SUBDIRS += test.d
diff --git a/src/usr/initservice/makefile b/src/usr/initservice/makefile
index 2e993d47d..968cdda7d 100644
--- a/src/usr/initservice/makefile
+++ b/src/usr/initservice/makefile
@@ -5,7 +5,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2011,2014
+# Contributors Listed Below - COPYRIGHT 2011,2015
+# [+] 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.
OpenPOWER on IntegriCloud