Ejemplo n.º 1
0
/****************************************************************************
NAME 
  	configManagerFillPs

DESCRIPTION
  	Fill PS to the point defrag is required (for testing only)

RETURNS
  	void
*/
void configManagerFillPs(void)
{
    CONF_DEBUG(("CONF: Fill PS ")) ;
    if(theSink.rundata->defrag.key_size)
    {
        uint16 count     = PsFreeCount(theSink.rundata->defrag.key_size);
        uint16* buff     = mallocPanic(theSink.rundata->defrag.key_size);
        CONF_DEBUG(("[%d] ", count));
        if(count > theSink.rundata->defrag.key_minimum)
        {
            for(count = count - theSink.rundata->defrag.key_minimum ; count > 0; count --)
            {
                *buff = count;
                PsStore(PSKEY_CONFIGURATION_ID, buff, theSink.rundata->defrag.key_size);
            }
            PsStore(PSKEY_CONFIGURATION_ID, &theSink.config_id, sizeof(uint16));
        }
        CONF_DEBUG(("[%d]", PsFreeCount(theSink.rundata->defrag.key_size)));
    }
    CONF_DEBUG(("\n"));
}
Ejemplo n.º 2
0
/****************************************************************************
NAME 
  	configManagerDefragCheck

DESCRIPTION
  	Defrag PS if required.

RETURNS
  	void
*/
void configManagerDefragCheck(void)
{
    CONF_DEBUG(("CONF: Defrag Check ")) ;
    if(theSink.rundata->defrag.key_size)
    {
        uint16 count = PsFreeCount(theSink.rundata->defrag.key_size);
        CONF_DEBUG(("Enabled [%d] ", count)) ;
        if(count <= theSink.rundata->defrag.key_minimum)
        {
            CONF_DEBUG(("Flooding PS")) ;
            PsFlood();
            /* try to set the same boot mode; this triggers the target to reboot.*/
            BootSetMode(BootGetMode());
        }
    }
    CONF_DEBUG(("\n")) ;
}
Ejemplo n.º 3
0
/****************************************************************************
NAME
    UpgradePSSpaceForCriticalOperations

DESCRIPTION

    Checks whether there appears to be sufficient free space in the PSSTORE
    to allow upgrade PSKEY operations to complete.

RETURNS
    FALSE if insufficient space by some metric, TRUE otherwise.
*/
bool UpgradePSSpaceForCriticalOperations(void)
{
    uint16 keySize = UpgradeCtxGet()->upgrade_library_pskeyoffset 
                     + UPGRADE_PRIVATE_PSKEY_USAGE_LENGTH_WORDS;
    return (PsFreeCount(keySize) >= UPGRADE_PS_WRITES_FOR_CRITICAL_OPERATIONS);
}