Example #1
0
uint64_t ClockPosix::now()
{
#if defined(HAVE_POSIX_TIMERS)
  struct timespec ts;
#if defined(HAVE_PTHREAD_CONDATTR_SETCLOCK)
  clock_gettime(getClockId(), &ts);
#else
  clock_gettime(CLOCK_REALTIME, &ts);
#endif
  return toNSec(ts);
#else
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return toNSec(tv);
#endif
}
Example #2
0
/**
 * @brief   calling out active pcie osc connected to this proc
 * @param   i_chip   P8 chip
 * @param   i_sc     service data collector
 * @returns Success
 */
int32_t CalloutPllIo( ExtensibleChip * i_chip,
                      STEP_CODE_DATA_STRUCT & io_sc )
{
    #define PRDF_FUNC "[Proc::CalloutPllIo] "

    int32_t rc = SUCCESS;

    do
    {
        uint32_t oscPos = getIoOscPos( i_chip, io_sc );
        bool pllUnlockDuetoOscSwitch;
        rc = isPllUnlockCausedByPciOscFo( i_chip, oscPos,
                                          pllUnlockDuetoOscSwitch );

        if( SUCCESS != rc )
        {
            PRDF_ERR( PRDF_FUNC "PCI Osc switch analysis failed" );
            break;
        }

        if( pllUnlockDuetoOscSwitch )
        {
            // PLL unlock has occurred due to PCI OSC switchover. We can ignore
            // this error. It shall be handled seprately as PC OSC switchover
            // event.
            break;
        }

        // oscPos will be checked inside getClockId and in case
        // a connected osc is not found, will use the proc target
        // this is the hostboot path since it's used the proc
        // target and clock type.
        TargetHandle_t connectedOsc = getClockId( i_chip->GetChipHandle(),
                                                  TYPE_OSCPCICLK,
                                                  oscPos );

        if ( NULL == connectedOsc )
        {
            PRDF_ERR(PRDF_FUNC "Failed to get connected PCIe OSC for "
                 "chip 0x%08x, oscPos: %d",i_chip->GetId(), oscPos );
            connectedOsc = i_chip->GetChipHandle();
        }

        PRDF_DTRAC(PRDF_FUNC "PCIe OSC: 0x%08x connected to "
                 "proc: 0x%08x", getHuid(connectedOsc), i_chip->GetId());

        // callout the clock source
        // HB does not have the osc target modeled
        // so we need to use the proc target with
        // osc clock type to call out
        #ifndef __HOSTBOOT_MODULE
        io_sc.service_data->SetCallout(connectedOsc);
        #else
        io_sc.service_data->SetCallout(
                            PRDcallout(connectedOsc,
                            PRDcalloutData::TYPE_PCICLK));
        #endif

    } while(0);

    return rc;

    #undef PRDF_FUNC
}