Changeset 657 for trunk/hal/tsar_mips32/drivers/soclib_mmc.c
- Timestamp:
- Mar 18, 2020, 11:16:59 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/drivers/soclib_mmc.c
r654 r657 2 2 * soclib_mmc.c - soclib L2 cache driver implementation. 3 3 * 4 * Author Alain Greiner (2016,2017,2018,2019 )4 * Author Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 18 18 * 19 19 * 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, 21 21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 22 */ 23 24 23 25 24 #include <hal_kernel_types.h> … … 29 28 #include <thread.h> 30 29 #include <printk.h> 31 32 30 33 31 /////////////////////////////////////// … … 44 42 *(base + (SOCLIB_MMC_ERROR_FUNC << 7) + SOCLIB_MMC_ERROR_IRQ_ENABLE) = 1; 45 43 } 46 47 44 48 45 ////////////////////////////////////////////////////////////// … … 85 82 86 83 // 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 ); 91 95 } 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) ) 93 97 { 94 98 // get src/dst buffer local pointer and register index 95 99 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 ) ); 97 101 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 ); 107 109 } 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 108 124 } // end soclib_mmc_cmd() 109 125 … … 121 137 122 138 // 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() ); 125 141 126 142 // reset MMC IRQ … … 128 144 129 145 } // end soclib_mmc_isr() 130 131 132
Note: See TracChangeset
for help on using the changeset viewer.