src/occ_gpe1/gpe_centaur_scom.c
/**
 * Setup the PBASLVCTLN extended address and calculate the OCI scom address
 * @param[in] PBA base address
 * @param[in] The Centaur scom address
 * @returns the OCI address to scom the centaur
 * @Post The extended address field in the PBASLVCNT is set
 */
Setup the PBASLVCTLN extended address and calculate the OCI scom address
@param[in] PBA base address
@param[in] The Centaur scom address
@returns the OCI address to scom the centaur
@Post The extended address field in the PBASLVCNT is set
Setup the PBASLVCTLN extended address and calculate the OCI scom address @param [ in ] PBA base address @param [ in ] The Centaur scom address @returns the OCI address to scom the centaur @Post The extended address field in the PBASLVCNT is set
int centaur_scom_setup(CentaurConfiguration_t* i_config,
                            uint32_t i_centaur_instance,
                            uint32_t i_scom_address,
                            uint32_t *o_oci_addr)
{
    int rc = 0;
#if defined(__USE_PBASLV__)
   pba_slvctln_t slvctln;
#endif
    uint64_t pb_addr = i_config->baseAddress[i_centaur_instance];
    uint32_t local = i_scom_address & 0x00001fff;
    uint32_t port  = i_scom_address & 0x000f0000;
    uint32_t slave = i_scom_address & 0x03000000;
    uint32_t multi = i_scom_address & 0xc0000000;
    uint32_t scom_address =
        local +
        (port >> 3) +
        (slave >> 7) +
        (multi >> 11);
    pb_addr  |= 0x0000000002000000ull;
    pb_addr  |= ((uint64_t)scom_address << 3);
#if defined(__USE_PBASLV__)
    PPE_LVD((i_config->scomParms).slvctl_address, slvctln.value);
    slvctln.fields.extaddr = pb_addr >> 27;
    PPE_STVD((i_config->scomParms).slvctl_address, slvctln.value);
#else
    {
        uint64_t barMsk = 0;
        mtmsr(mfmsr() | MSR_SEM);
        rc = putscom_abs(PBA_BARN(PBA_BAR_CENTAUR), pb_addr);
        if(rc)
        {
            PK_TRACE("centaur_scom_setup. putscom fail on PBABAR."
                     " rc = %d",rc);
        }
        else
        {
            rc = putscom_abs(PBA_BARMSKN(PBA_BAR_CENTAUR), barMsk);
            if(rc)
            {
                PK_TRACE("centaur_scom_setup. putscom fail on PBABARMSK"
                         " rc = %d",rc);
            }
        }
    }
#endif
    *o_oci_addr = (uint32_t)(pb_addr & 0x07ffffffull);
    *o_oci_addr  |= ((PBA_BAR_CENTAUR | 0x8) << 28);
    PK_TRACE_DBG("Centaur OCI scom addr: %08x",*o_oci_addr);
    return rc;
}
int centaur_scom_setup ( CentaurConfiguration_t * i_config , uint32_t i_centaur_instance , uint32_t i_scom_address , uint32_t * o_oci_addr ) { int rc = 0 ; #if defined ( __USE_PBASLV__ ) pba_slvctln_t slvctln ; #endif uint64_t pb_addr = i_config -> baseAddress [ i_centaur_instance ] ; uint32_t local = i_scom_address & 0x00001fff ; uint32_t port = i_scom_address & 0x000f0000 ; uint32_t slave = i_scom_address & 0x03000000 ; uint32_t multi = i_scom_address & 0xc0000000 ; uint32_t scom_address = local + ( port >> 3 ) + ( slave >> 7 ) + ( multi >> 11 ) ; pb_addr |= 0x0000000002000000ull ; pb_addr |= ( ( uint64_t ) scom_address << 3 ) ; #if defined ( __USE_PBASLV__ ) PPE_LVD ( ( i_config -> scomParms ) . slvctl_address , slvctln . value ) ; slvctln . fields . extaddr = pb_addr >> 27 ; PPE_STVD ( ( i_config -> scomParms ) . slvctl_address , slvctln . value ) ; #else { uint64_t barMsk = 0 ; mtmsr ( mfmsr ( ) | MSR_SEM ) ; rc = putscom_abs ( PBA_BARN ( PBA_BAR_CENTAUR ) , pb_addr ) ; if ( rc ) { PK_TRACE ( " " " " , rc ) ; } else { rc = putscom_abs ( PBA_BARMSKN ( PBA_BAR_CENTAUR ) , barMsk ) ; if ( rc ) { PK_TRACE ( " " " " , rc ) ; } } } #endif * o_oci_addr = ( uint32_t ) ( pb_addr & 0x07ffffffull ) ; * o_oci_addr |= ( ( PBA_BAR_CENTAUR | 0x8 ) << 28 ) ; PK_TRACE_DBG ( " " , * o_oci_addr ) ; return rc ; }
Setup the PBASLVCTLN extended address and calculate the OCI scom address
 @param[in] PBA base address
 @param[in] The Centaur scom address
 @returns the OCI address to scom the centaur
 @Post The extended address field in the PBASLVCNT is set
Setup the PBASLVCTLN extended address and calculate the OCI scom address @param [ in ] PBA base address @param [ in ] The Centaur scom address @returns the OCI address to scom the centaur @Post The extended address field in the PBASLVCNT is set
// Break address into componets // compress to 21 bits for P9 // P9: Turn on bit 38 to indicate OCC // put bits 23:36 of address into slvctln extended addr // HW bug work-around // workaround - don't use extraddr - use pbabar. // Mask SIB from generating mck // put the PBA in the BAR // make oci address // upper nibble is PBA region and BAR_SELECT