/* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ /* $Source: src/usr/lpc/lpcdd.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ /* Contributors Listed Below - COPYRIGHT 2014,2015 */ /* [+] Google Inc. */ /* [+] 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 __LPC_LPCDD_H #define __LPC_LPCDD_H #include #include #include #include #include /** @file lpcdd.H * @brief Provides the interfaces to the LPC Device Driver */ /** * @brief LPC Device Driver Class * Provides access to the LPC bus for a specific Processor */ class LpcDD { public: /** * @brief Performs a LPC Read Operation * * @param i_trans LPC transaction type * @param i_address LPC address * @param o_buffer Buffer to read data into * @param io_buflen Input: Number of bytes to read, * Output: Number of bytes actually read * * @return Error from operation */ errlHndl_t readLPC(LPC::TransType i_type, uint32_t i_address, void* o_buffer, size_t& io_buflen); /** * @brief Performs a LPC Write Operation * * @param i_trans LPC transaction type * @param i_address LPC address * @param i_buffer Buffer to write data from * @param io_buflen Input: Number of bytes to write, * Output: Number of bytes actually written * * @return Error from operation */ errlHndl_t writeLPC(LPC::TransType i_type, uint32_t i_address, const void* i_buffer, size_t& io_buflen); /** * @brief Enums for different levels of resetting PNOR communication levels */ enum ResetLevels { RESET_CLEAR = 0x00000000, /**< Clear Reset Level */ RESET_ECCB = 0x00000001, /**< ECCB FW Logic */ RESET_OPB_LPCHC_SOFT = 0x00000002, /**< OPB LPCHC Clear Errors */ RESET_OPB_LPCHC_HARD = 0x00000004, /**< OPB LPCHC Reset Logic */ RESET_INIT = 0x00000008, /**< Initial HW setup */ }; /** * @brief Reset hardware to get into clean state * * @parm i_resetLevel How much LPC logic to reset * * @return errlHndl_t NULL on success, else error log */ errlHndl_t hwReset( ResetLevels i_resetLevel ); /** * @brief Get the target associated with this dd instance * * @return Pointer to target */ TARGETING::Target* getProc( void ) { return iv_proc; }; /** * @brief Constructor * @param[in] Processor target associated with the ECCB logic */ LpcDD( TARGETING::Target* i_proc = TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL ); /** * @brief Destructor */ ~LpcDD(); protected: /** * @brief LPC HC Registers * These are offsets within the LPC Host Controller Register Space */ enum LpcRegAddr { LPC_REG_BAR0 = 0x00, /**< BAR0 : OPB register */ LPC_REG_BAR1 = 0x04, /**< BAR1 : LPC I/O space */ LPC_REG_BAR2 = 0x08, /**< BAR2 : LPC Memory space */ LPC_REG_BAR3 = 0x0C, /**< BAR3 : LPC Firmware space */ LPC_REG_ABRTCNT = 0x2C, /**< ABORT COUNT */ }; /** * @brief Some general constants * */ enum { LPCHC_FW_SPACE = 0xF0000000, /**< LPC Host Controller FW Space */ LPCHC_MEM_SPACE = 0xE0000000, /**< LPC Host Controller Mem Space */ LPCHC_IO_SPACE = 0xD0010000, /**< LPC Host Controller I/O Space */ LPCHC_REG_SPACE = 0xC0012000, /**< LPC Host Ctlr Register Space */ ECCB_NON_FW_RESET_REG = 0x000B0001, /**< ECCB Reset Reg (non-FW) */ ECCB_CTL_REG = 0x000B0020, /**< ECCB Control Reg (FW) */ ECCB_RESET_REG = 0x000B0021, /**< ECCB Reset Reg (FW) */ ECCB_STAT_REG = 0x000B0022, /**< ECCB Status Reg (FW) */ ECCB_DATA_REG = 0x000B0023, /**< ECCB Data Reg (FW) */ // Default Values to set for all operations // 1101.0100.0000.000x.0000.0001.0000.0000.
ECCB_CTL_REG_DEFAULT = 0xD400010000000000, // Error bits: 41-43, 56 (52=cmd complete) (not 57: only non-fw use) ECCB_STAT_REG_ERROR_MASK = 0x0000000000700080, /**< Error Bits */ /**< OPB LPCM Sync FIR Reg - used to read the FIR*/ OPB_LPCM_FIR_REG = 0x01010C00, /**< OPB LPCM Sync FIR Reg WOX_AND - used to clear the FIR */ OPB_LPCM_FIR_WOX_AND_REG = 0x01010C01, /**< OPB LPCM Sync FIR Mask Reg WO_OR - used to set the mask */ OPB_LPCM_FIR_MASK_WO_OR_REG = 0x01010C05, OPB_LPCM_FIR_ERROR_MASK = 0xFF00000000000000, /**< Error Bits MASK */ // LPCHC reset-related registers OPB_MASTER_LS_CONTROL_REG = 0x008, /**