/******************************************************************************* NAME hwLineLib.h VERSION %version: 16 % UPDATE DATE %date_modified: Wed May 18 20:42:50 2016 % PROGRAMMER %created_by: dhoyer % Copyright 2014-2016 NetApp, Inc. All Rights Reserved. DESCRIPTION: Provides the definitions for the library of supported functions. Each function instantiates the appropriate class and acts on it based on the requirements of the function. *******************************************************************************/ #ifndef __INChwLineLib #define __INChwLineLib #include /** * Declare the definitions of all of the supported platforms * */ #define SOYUZ_ID 0x14 #define SOYUZ_WEMB_ID 0x04 /* Only applicable in loss of power in wembley enclosure */ #define ARAPAHO_S_ID 0x28 #define ARAPAHO_B_ID 0x2D #define TITAN_ID 0x1b #define TITAN_WEMB_ID 0x0b /* Only applicable in loss of power in wembley enclosure */ #define SANDHAWK_ID 0x21 #define SANDHAWK_HILDA_OFF_ID 0x22 /** * Declare the definitions of all of the supported host cards * */ #define NONE0_HIC_ID 0x00 #define SAMOA_D_PLUS_HIC_ID 0x09 #define ACADIA_D_PLUS_HIC_ID 0x0A #define ACADIA_Q_PLUS_HIC_ID 0x0B #define ZION_PLUS_HIC_ID 0x0C #define SAMOA_Q_PLUS_HIC_ID 0x0D #define CUYAHOGA_HIC_ID 0x01 #define CASCADE_HIC_ID 0x02 #define YELLOWSTONE_HIC_ID 0x03 #define REDWOOD_HIC_ID 0x04 #define NONE_HIC_ID 0x0F #define LPM_HIC_ID 0xFF /** * Declare the definitions of all of the return codes * */ #define RETCODE_ERROR -1 #define RETCODE_OK 0 #define RETCODE_INVALID_HIC 1 #define RETCODE_NO_HIC 2 #define RETCODE_INVALID_SLOT 3 /* Controller slot definitions */ #define BOARD_SLOT_A 0 #define BOARD_SLOT_B 1 #define SEVEN_SEGMENT_MAX_PATTERNS 8 /* Max number of patterns */ #define SEVEN_SEGMENT_EXPECTED_PATTERN_LEN 3 /* Max number of characters in a code */ #define SEVEN_SEGMENT_BLANK_PATTERN_LEN 6 /* Max number of characters in a blank code */ /* This is the expected string buffer length to be passed to the routine to get the */ /* LED code string. This length is */ /* Number of code * (length of each code + 1 for the space) + null terminator + */ #define SEVEN_SEGMENT_RETURN_STR_LEN \ ((SEVEN_SEGMENT_MAX_PATTERNS * (SEVEN_SEGMENT_BLANK_PATTERN_LEN + 1)) + 1) typedef enum hwlDomain { HWL_ROOT = 1, ///< Base OS HWL_RAID = 2 ///< EOS Application. } hwlDomain_t; #ifdef __cplusplus extern "C" { #endif /** * \brief Initialize a semaphore * This method is to be run only at the boot time, and should * not be called from the CLI. * * \return RETCODE_ERROR if error and RETCODE_OK otherwise */ int hwlInit(); /** * \brief Read the Board ID * * \param[out] Value of the board Id register * \param[out] Pointer to the board Id name * If null, this is not filled in * \return RETCODE_ERROR if error and RETCODE_OK otherwise */ int hwlGetBoardId(uint32_t *boardId, const char** name); /** * \brief Read the Board Model Name * * \param[out] Pointer to the board Id name * \return RETCODE_ERROR if error and RETCODE_OK otherwise */ int hwlGetBoardModelName(const char** name); /** * \brief Set the Board ID * * \param[out] Value of the board Id to be seen by EOS * \return RETCODE_ERROR if error or function not supported for this platform * RETCODE_OK if successful */ int hwlSetBoardId(uint32_t boardId); /** * Read the Host Board ID * * \param[out] Pointer for the host board Id to be written to * \param[in] Slot of the host board Id to be read * \return RETCODE_ERROR if error * RETCODE_INVALID_HIC if invalid host board id * RETCODE_NO_HIC if no host card present * RETCODE_INVALID_SLOT if specified slot is invalid * RETCODE_OK if successful */ int hwlGetHostBoardId(uint32_t *hostBoardId, uint32_t slot); /** * Set the Host Board ID * * \param[in] Value of the host board Id to be seen by EOS * \param[in] Slot of the host board Id to be seen by EOS * \return RETCODE_ERROR if error * RETCODE_INVALID_SLOT if specified slot is invalid * RETCODE_OK if successful */ int hwlSetHostBoardId(uint32_t hostBoardId, uint32_t slot); /** * Read the Board Slot position * * \param[out] board slot position number * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlGetBoardSlot(uint32_t *boardSlot); /** * Check whether boot in low power mode * * \param[out] state of low power mode * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlIsBootInLowPower(int *state); /** * Reboot the system * * \return -1 if error */ int hwlSysReboot(); /** * Check whether alternate firmware running is asserted * * \param[out] state of alt firmware running signal * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlIsAltFWRunning(int *state); /** * Check whether alternate controller is in place * * \param[out] state of alternate in place signal * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlIsAltInPlace(int *state); /** * Start the watchdog timer * * \param[in] timeoutValue Timeout value for the WDT in milli seconds. * \param[in] domain Domain to be used for starting watchdog timer. * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlStartWDT(uint32_t timeoutValue, hwlDomain_t domain); /** * Pet the watchdog timer. It sets the watchdog timeout to the passed in value and * pacifies the watchdog for that much time. Another call must be made within this * timeout period with the new desired time out value to prevent the watchdog from * timing out. If the remaining WD timeout value is bigger than the new passed in * timeout, this call will not have any effect. * * \param[in] timeoutValue New timeout value for the WDT in milli seconds. * \param[in] domain Domain to be used for petting watchdog timer. * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlPetWDT(uint32_t timeoutValue, hwlDomain_t domain); /** * Disable the watchdog timer * * \param[in] domain Domain for which the watchdog timer to be disabled. * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlDisableWDT(hwlDomain_t domain); /** * Get the ADR bit * * \param[out] Value returned for the current ADR bit value * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlGetADR(int *state); /** * Set the ADR bit * * \param[in] Value to set the ADR bit to * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlSetADR(int state); /** * Get the FPGA version information * \param[out] hwVersion - Version of the HW per the FPGA * \param[out] fpgaVersion - Version of the FPGA * \param[out] name - Name of the FPGA * \return RETCODE_ERROR if error or not supported on this platform * RETCODE_OK if successful * */ int hwlGetFpgaInfo(uint32_t* hwVersion, uint32_t* fpgaVersion, const char** name); /** * Set the 7 segment LED code sequence * * \param[in] cnt - number of codes to set * \param[in] pattern - array of codes * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlSetLed(int cnt, char** pattern); /** * Get the 7 segment LED code sequence * * \param[out] pattern - string containing LED code in ascii * \param[in] len - size of buffer for function to fill in * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlGetLed(char* pattern, int len); /** * Get the Dual Bios Dual BIOS select bit * * \param[out] bit - The value of the BIOS select (0/1) * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlGetDualBiosSelect(uint32_t* bit); /** * Set the Dual Bios Dual BIOS select bit * * \param[out] bit - The value of the BIOS select (0/1) * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlSetDualBiosSelect(uint32_t bit); /** * Get the NVSRAM Dual Bios Select Bit value * * \param[out] bit - The value of the Dual BIOS bit from nvsram * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlGetNvsramDualBiosSelect(uint32_t* bit); /** * Set the NVSRAM Dual Bios Select Bit value * * \param[in] bit - The value to set the bit. (Zero or not zero) * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlSetNvsramDualBiosSelect(uint32_t bit); /** * Send alternate a NMI message. * * \param[in] msg Alternate NMI message * \return RETCODE_ERROR if error * RETCODE_OK if successful */ int hwlSendAltNMI(int msg); #ifdef __cplusplus } #endif #endif /* End of __INChwLineLib */