src/ssx/occhw/occhw_scom.c
/// putscom() through the PMC OCI/PIB bridge
///
/// \param address A standard 32-bit SCOM address, including multicast
/// addresses.
///
/// \param data The SCOM write data.
///
/// This routine executes in an SSX_CRITICAL critical section.
///
/// Unlike most other APIs, this API returns positive error
/// codes, as well as the 0 code for success.
///
/// If the transaction experiences a software timeout (controlled by the \a
/// timeout parameter), a protocol error, or a PCB error greater than the
/// configuration constant SCOM_ERROR_LIMIT this routine causes a kernel
/// panic. This may leave the PMC PIB master in a state in which it is illegal
/// to perform further SCOM access through the PMC (until the ongoing
/// transaction is finished.)
///
/// \retval 0 Success
///
/// \retval 1-7 A PCB error code.  See \c pcb_common.h
putscom() through the PMC OCI/PIB bridge
\param address A standard 32-bit SCOM address, including multicast
addresses.

\param data The SCOM write data.

This routine executes in an SSX_CRITICAL critical section.

Unlike most other APIs, this API returns positive error
codes, as well as the 0 code for success.

If the transaction experiences a software timeout (controlled by the \a
timeout parameter), a protocol error, or a PCB error greater than the
configuration constant SCOM_ERROR_LIMIT this routine causes a kernel
panic. This may leave the PMC PIB master in a state in which it is illegal
to perform further SCOM access through the PMC (until the ongoing
transaction is finished.)

\retval 0 Success

\retval 1-7 A PCB error code.
putscom () through the PMC OCI / PIB bridge \ param address A standard 32 - bit SCOM address including multicast addresses . \ param data The SCOM write data . This routine executes in an SSX_CRITICAL critical section . Unlike most other APIs this API returns positive error codes as well as the 0 code for success . If the transaction experiences a software timeout ( controlled by the \ a timeout parameter ) a protocol error or a PCB error greater than the configuration constant SCOM_ERROR_LIMIT this routine causes a kernel panic . This may leave the PMC PIB master in a state in which it is illegal to perform further SCOM access through the PMC ( until the ongoing transaction is finished . ) \ retval 0 Success \ retval 1 - 7 A PCB error code .
int
putscom(uint32_t address, uint64_t data)
{
    int rc;
    rc = _putscom(address, data, SCOM_TIMEOUT);
    if ((rc == 0) || ((rc > 0) && (rc <= SCOM_ERROR_LIMIT)))
    {
        return rc;
    }
    if (rc > 0)
    {
        switch (rc)
        {
            case 1:
                SSX_PANIC(SCOM_PCB_ERROR_1_PUTSCOM);
                break;
            case 2:
                SSX_PANIC(SCOM_PCB_ERROR_2_PUTSCOM);
                break;
            case 3:
                SSX_PANIC(SCOM_PCB_ERROR_3_PUTSCOM);
                break;
            case 4:
                SSX_PANIC(SCOM_PCB_ERROR_4_PUTSCOM);
                break;
            case 5:
                SSX_PANIC(SCOM_PCB_ERROR_5_PUTSCOM);
                break;
            case 6:
                SSX_PANIC(SCOM_PCB_ERROR_6_PUTSCOM);
                break;
            default:
                SSX_PANIC(SCOM_PCB_ERROR_7_PUTSCOM);
                break;
        }
    }
    else if (rc == -SCOM_TIMEOUT_ERROR)
    {
        SSX_PANIC(SCOM_TIMEOUT_ERROR_PUTSCOM);
    }
    else
    {
        SSX_PANIC(SCOM_PROTOCOL_ERROR_PUTSCOM);
    }
    return rc;
}
int putscom ( uint32_t address , uint64_t data ) { int rc ; rc = _putscom ( address , data , SCOM_TIMEOUT ) ; if ( ( rc == 0 ) || ( ( rc > 0 ) && ( rc <= SCOM_ERROR_LIMIT ) ) ) { return rc ; } if ( rc > 0 ) { switch ( rc ) { case 1 : SSX_PANIC ( SCOM_PCB_ERROR_1_PUTSCOM ) ; break ; case 2 : SSX_PANIC ( SCOM_PCB_ERROR_2_PUTSCOM ) ; break ; case 3 : SSX_PANIC ( SCOM_PCB_ERROR_3_PUTSCOM ) ; break ; case 4 : SSX_PANIC ( SCOM_PCB_ERROR_4_PUTSCOM ) ; break ; case 5 : SSX_PANIC ( SCOM_PCB_ERROR_5_PUTSCOM ) ; break ; case 6 : SSX_PANIC ( SCOM_PCB_ERROR_6_PUTSCOM ) ; break ; default : SSX_PANIC ( SCOM_PCB_ERROR_7_PUTSCOM ) ; break ; } } else if ( rc == - SCOM_TIMEOUT_ERROR ) { SSX_PANIC ( SCOM_TIMEOUT_ERROR_PUTSCOM ) ; } else { SSX_PANIC ( SCOM_PROTOCOL_ERROR_PUTSCOM ) ; } return rc ; }
putscom() through the PMC OCI/PIB bridge
\param address A standard 32-bit SCOM address, including multicast
addresses.
putscom () through the PMC OCI / PIB bridge \ param address A standard 32 - bit SCOM address including multicast addresses .
//printk("putscom(0x%08x, 0x%016llx) : Failed with error %d\n", //       address, data, rc);