/** * @file IxFeatureCtrl.c * * @author Intel Corporation * @date 29-Jan-2003 * * @brief Feature Control Public API Implementation * * * @par * IXP400 SW Release version 2.0 * * -- Copyright Notice -- * * @par * Copyright 2001-2005, Intel Corporation. * All rights reserved. * * @par * SPDX-License-Identifier: BSD-3-Clause * @par * -- End of Copyright Notice -- */ #include "IxOsal.h" #include "IxVersionId.h" #include "IxFeatureCtrl.h" /* Macro to read from the Feature Control Register */ #define IX_FEATURE_CTRL_READ(result) \ do { \ ixFeatureCtrlExpMap(); \ (result) = IX_OSAL_READ_LONG(ixFeatureCtrlRegister); \ } while (0) /* Macro to write to the Feature Control Register */ #define IX_FEATURE_CTRL_WRITE(value) \ do { \ ixFeatureCtrlExpMap(); \ IX_OSAL_WRITE_LONG(ixFeatureCtrlRegister, (value)); \ } while (0) /* * This is the offset of the feature register relative to the base of the * Expansion Bus Controller MMR. */ #define IX_FEATURE_CTRL_REG_OFFSET (0x00000028) /* Boolean to mark the fact that the EXP_CONFIG address space was mapped */ PRIVATE BOOL ixFeatureCtrlExpCfgRegionMapped = false; /* Pointer holding the virtual address of the Feature Control Register */ PRIVATE VUINT32 *ixFeatureCtrlRegister = NULL; /* Place holder to store the software configuration */ PRIVATE BOOL swConfiguration[IX_FEATURECTRL_SWCONFIG_MAX]; /* Flag to control swConfiguration[] is initialized once */ PRIVATE BOOL swConfigurationFlag = false ; /* Array containing component mask values */ #ifdef __ixp42X UINT32 componentMask[IX_FEATURECTRL_MAX_COMPONENTS] = { (0x1<> IX_FEATURE_CTRL_DEVICE_TYPE_OFFSET) & IX_FEATURE_CTRL_DEVICE_TYPE_MASK); } /* End function ixFeatureCtrlDeviceRead */ /** * Function definition: ixFeatureCtrlSwConfigurationCheck */ IX_STATUS ixFeatureCtrlSwConfigurationCheck (IxFeatureCtrlSwConfig swConfigType) { if (swConfigType >= IX_FEATURECTRL_SWCONFIG_MAX) { ixOsalLog(IX_OSAL_LOG_LVL_WARNING, IX_OSAL_LOG_DEV_STDOUT, "FeatureCtrl: Invalid software configuraiton input.\n", 0, 0, 0, 0, 0, 0); return IX_FEATURE_CTRL_SWCONFIG_DISABLED; } /* The function will only initialize once. */ ixFeatureCtrlSwConfigurationInit(); /* Check and return software configuration */ return ((swConfiguration[(UINT32)swConfigType] == true) ? IX_FEATURE_CTRL_SWCONFIG_ENABLED: IX_FEATURE_CTRL_SWCONFIG_DISABLED); } /** * Function definition: ixFeatureCtrlSwConfigurationWrite */ void ixFeatureCtrlSwConfigurationWrite (IxFeatureCtrlSwConfig swConfigType, BOOL enabled) { if (swConfigType >= IX_FEATURECTRL_SWCONFIG_MAX) { ixOsalLog(IX_OSAL_LOG_LVL_WARNING, IX_OSAL_LOG_DEV_STDOUT, "FeatureCtrl: Invalid software configuraiton input.\n", 0, 0, 0, 0, 0, 0); return; } /* The function will only initialize once. */ ixFeatureCtrlSwConfigurationInit(); /* Write software configuration */ swConfiguration[(UINT32)swConfigType]=enabled ; } /** * Function definition: ixFeatureCtrlIxp400SwVersionShow */ void ixFeatureCtrlIxp400SwVersionShow (void) { printf ("\nIXP400 Software Release %s %s\n\n", IX_VERSION_ID, IX_VERSION_INTERNAL_ID); } /** * Function definition: ixFeatureCtrlSoftwareBuildGet */ IxFeatureCtrlBuildDevice ixFeatureCtrlSoftwareBuildGet (void) { #ifdef __ixp42X return IX_FEATURE_CTRL_SW_BUILD_IXP42X; #else return IX_FEATURE_CTRL_SW_BUILD_IXP46X; #endif }