Ignore:
Timestamp:
Mar 18, 2020, 11:16:59 PM (4 years ago)
Author:
alain
Message:

Introduce remote_buf.c/.h & socket.c/.h files.
Update dev_nic.c/.h files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/tsar_mips32/drivers/soclib_mmc.c

    r654 r657  
    22 * soclib_mmc.c - soclib L2 cache driver implementation.
    33 *
    4  * Author     Alain Greiner (2016,2017,2018,2019)
     4 * Author     Alain Greiner (2016,2017,2018,2019,2020)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    1818 *
    1919 * You should have received a copy of the GNU General Public License
    20  * along with ALMOS-MKH.; if not, write to the Free Software Foundation,
     20 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
    2121 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    2222 */
    23 
    2423
    2524#include <hal_kernel_types.h>
     
    2928#include <thread.h>
    3029#include <printk.h>
    31 
    3230
    3331///////////////////////////////////////
     
    4442    *(base + (SOCLIB_MMC_ERROR_FUNC << 7) + SOCLIB_MMC_ERROR_IRQ_ENABLE) = 1;
    4543}
    46 
    4744
    4845//////////////////////////////////////////////////////////////
     
    8582
    8683        // set SOCLIB_MMC registers to start INVAL/SYNC operation
    87         hal_remote_s32( XPTR( seg_cxy , seg_ptr + SOCLIB_MMC_ADDR_LO    ) , (uint32_t)buf_ptr );
    88         hal_remote_s32( XPTR( seg_cxy , seg_ptr + SOCLIB_MMC_ADDR_HI    ) , (uint32_t)dev_cxy );
    89         hal_remote_s32( XPTR( seg_cxy , seg_ptr + SOCLIB_MMC_BUF_LENGTH ) , buf_size );
    90         hal_remote_s32( XPTR( seg_cxy , seg_ptr + SOCLIB_MMC_CMD_TYPE   ) , cc_cmd );
     84        hal_remote_s32( XPTR( seg_cxy , seg_ptr +
     85        MMC_REG( SOCLIB_MMC_CC_FUNC , SOCLIB_MMC_ADDR_LO) ) , (uint32_t)buf_ptr );
     86
     87        hal_remote_s32( XPTR( seg_cxy , seg_ptr +
     88        MMC_REG( SOCLIB_MMC_CC_FUNC , SOCLIB_MMC_ADDR_HI) ) , dev_cxy );
     89
     90        hal_remote_s32( XPTR( seg_cxy , seg_ptr +
     91        MMC_REG( SOCLIB_MMC_CC_FUNC , SOCLIB_MMC_BUF_LENGTH) ) , buf_size );
     92
     93        hal_remote_s32( XPTR( seg_cxy , seg_ptr +
     94        MMC_REG( SOCLIB_MMC_CC_FUNC , SOCLIB_MMC_CMD_TYPE) ) , cc_cmd );
    9195    }
    92     else  // (type == MMC_GET_ERROR) or (type == MMC_GET_ERROR) pr (type == MMC_GET_INSTRU )
     96    else if( (type == MMC_ERROR_GET) || (type == MMC_ERROR_SET) )
    9397    {
    9498        // get src/dst buffer local pointer and register index
    9599        reg_ptr   = (uint32_t *)hal_remote_lpt( XPTR( th_cxy , &th_ptr->mmc_cmd.reg_ptr ) );
    96         reg_index = hal_remote_l32( XPTR( th_cxy , &th_ptr->mmc_cmd.reg_index ) );
     100        reg_index =             hal_remote_l32( XPTR( th_cxy , &th_ptr->mmc_cmd.reg_index ) );
    97101
    98         // move register to/from local buffer
    99         if( (type == MMC_GET_ERROR) || (type == MMC_GET_INSTRU) )
    100         {
    101             *reg_ptr =  hal_remote_l32( XPTR( seg_cxy , seg_ptr + reg_index ) );
    102         }
    103         else  // type == MMC_SET_ERROR
    104         {
    105             hal_remote_s32( XPTR( seg_cxy , seg_ptr + reg_index ) , *reg_ptr );
    106         }
     102        // build extended pointer on relevant MMC register
     103        xptr_t mmc_reg_xp = XPTR( seg_cxy , seg_ptr +
     104                                  MMC_REG( SOCLIB_MMC_ERROR_FUNC , reg_index ) );
     105
     106        // move MMC register to/from local buffer
     107        if( type == MMC_ERROR_GET ) *reg_ptr = hal_remote_l32( mmc_reg_xp );
     108        else                        hal_remote_s32( mmc_reg_xp , *reg_ptr );
    107109    }
     110    else  // type == MMC_INSTRU_GET
     111    {
     112        // get dst buffer local pointer and register index
     113        reg_ptr   = (uint32_t *)hal_remote_lpt( XPTR( th_cxy , &th_ptr->mmc_cmd.reg_ptr ) );
     114        reg_index =             hal_remote_l32( XPTR( th_cxy , &th_ptr->mmc_cmd.reg_index ) );
     115
     116        // build extended pointer on relevant MMC register
     117        xptr_t mmc_reg_xp = XPTR( seg_cxy , seg_ptr +
     118                                  MMC_REG( SOCLIB_MMC_INSTR_FUNC , reg_index ) );
     119
     120        // move MMC register to local buffer 
     121        *reg_ptr = hal_remote_l32( mmc_reg_xp );
     122    }
     123
    108124} // end soclib_mmc_cmd()
    109125
     
    121137
    122138    // print an error message on kernel terminal
    123     printk("\n[ERROR] reported from MMC : cxy %x / cycle %d / bad address [%x,%x] / srcid %x\n",
    124     local_cxy , (uint32_t)hal_get_cycles() , paddr_hi , paddr_lo , srcid );
     139    printk("\n[ERROR] reported from MMC : bad address [%x,%x] / srcid %x / cycle %d\n",
     140    paddr_hi , paddr_lo , srcid , (uint32_t)hal_get_cycles() );
    125141
    126142    // reset MMC IRQ
     
    128144   
    129145} // end soclib_mmc_isr()
    130 
    131 
    132 
Note: See TracChangeset for help on using the changeset viewer.