src/ssx/occhw/occhw_ocb.c
/// Procedure to setup a linear window on an indirect channel
///
///
/// Since the linear window access is restricted to the SRAM region of
/// OCI space, Bits 0:4 of the base parameter are don't care and will be
/// overwritten with b'11000'
///
///
/// \todo double check SRAM region restriction
///
/// \param channel The indirect channel to use, in the range 0..2.
///
/// \param base The 32-bit PowerBus base address where the block starts.  This
/// address must be aligned to the \a log_size.
///
/// \param log_size The base 2 logarithm of the block size, in bytes. The
/// minimum size is 8B (2**3), the maximum size is 32KB (2**15)
///
///
/// \retval 0 Success
///
/// \retval OCB_INVALID_ARGUMENT_LW_INIT One or more of the parameter
/// restrictions were violated.
///
/// \retval OCB_SCOM_ERROR An attempt to write a PBA SCOM register to set up
/// the BARs produced a non-zero return code.
Procedure to setup a linear window on an indirect channel
Since the linear window access is restricted to the SRAM region of
OCI space, Bits 0:4 of the base parameter are don't care and will be
overwritten with b'11000'

\todo double check SRAM region restriction

\param channel The indirect channel to use, in the range 0..2.

\param base The 32-bit PowerBus base address where the block starts.  This
address must be aligned to the \a log_size.

\param log_size The base 2 logarithm of the block size, in bytes. The
minimum size is 8B (2**3), the maximum size is 32KB (2**15)

\retval 0 Success

\retval OCB_INVALID_ARGUMENT_LW_INIT One or more of the parameter
restrictions were violated.

\retval OCB_SCOM_ERROR An attempt to write a PBA SCOM register to set up
the BARs produced a non-zero return code.
Procedure to setup a linear window on an indirect channel Since the linear window access is restricted to the SRAM region of OCI space Bits 0 : 4 of the base parameter are don ' t care and will be overwritten with b ' 11000 ' \ todo double check SRAM region restriction \ param channel The indirect channel to use in the range 0 .. 2 . \ param base The 32 - bit PowerBus base address where the block starts . This address must be aligned to the \ a log_size . \ param log_size The base 2 logarithm of the block size in bytes . The minimum size is 8B ( 2 ** 3 ) the maximum size is 32KB ( 2 ** 15 ) \ retval 0 Success \ retval OCB_INVALID_ARGUMENT_LW_INIT One or more of the parameter restrictions were violated . \ retval OCB_SCOM_ERROR An attempt to write a PBA SCOM register to set up the BARs produced a non - zero return code .
int
ocb_linear_window_initialize(int channel, uint32_t base, int log_size)
{
    uint32_t mask ;
    ocb_ocblwcrn_t ocblwcrn;
    ocb_ocblwsbrn_t ocblwsbrn;
    mask = (0x1ull << log_size) - 1;
    if (SSX_ERROR_CHECK_API)
    {
        SSX_ERROR_IF((channel < 0) ||
                     (channel > 3) ||
                     (log_size < OCB_LW_LOG_SIZE_MIN) ||
                     (log_size > OCB_LW_LOG_SIZE_MAX) ||
                     ((base & mask) != 0),
                     OCB_INVALID_ARGUMENT_LW_INIT);
    }
    mask = ~mask;
    ocblwcrn.fields.linear_window_enable = 1;
    ocblwcrn.fields.linear_window_bar = (base >> 3) & 0x1FFFF;
    ocblwcrn.fields.linear_window_mask = (mask >> 3) & 0xFFF;
    out32(OCB_OCBLWCRN(channel), ocblwcrn.value);
    ocblwsbrn.fields.linear_window_region = 7;
    ocblwsbrn.fields.linear_window_base = (base >> 20) & 0x7F;
    out32(OCB_OCBLWSBRN(channel), ocblwsbrn.value);
    return 0 ;
}
int ocb_linear_window_initialize ( int channel , uint32_t base , int log_size ) { uint32_t mask ; ocb_ocblwcrn_t ocblwcrn ; ocb_ocblwsbrn_t ocblwsbrn ; mask = ( 0x1ull << log_size ) - 1 ; if ( SSX_ERROR_CHECK_API ) { SSX_ERROR_IF ( ( channel < 0 ) || ( channel > 3 ) || ( log_size < OCB_LW_LOG_SIZE_MIN ) || ( log_size > OCB_LW_LOG_SIZE_MAX ) || ( ( base & mask ) != 0 ) , OCB_INVALID_ARGUMENT_LW_INIT ) ; } mask = ~ mask ; ocblwcrn . fields . linear_window_enable = 1 ; ocblwcrn . fields . linear_window_bar = ( base >> 3 ) & 0x1FFFF ; ocblwcrn . fields . linear_window_mask = ( mask >> 3 ) & 0xFFF ; out32 ( OCB_OCBLWCRN ( channel ) , ocblwcrn . value ) ; ocblwsbrn . fields . linear_window_region = 7 ; ocblwsbrn . fields . linear_window_base = ( base >> 20 ) & 0x7F ; out32 ( OCB_OCBLWSBRN ( channel ) , ocblwsbrn . value ) ; return 0 ; }
Procedure to setup a linear window on an indirect channel
Since the linear window access is restricted to the SRAM region of
OCI space, Bits 0:4 of the base parameter are don't care and will be
overwritten with b'11000'
Procedure to setup a linear window on an indirect channel Since the linear window access is restricted to the SRAM region of OCI space Bits 0 : 4 of the base parameter are don ' t care and will be overwritten with b ' 11000 '
// create mask for checking // now invert mask for use in ocb linear window setup // Enable LW mode // Select bits(12:28) of OCI addr for the LW bar // Configure LW region for SRAM access // Select bits(5:11) of OCI addr for the LW base