Changeset 76 for trunk/hal/x86_64/drivers/soclib_xcu.c
- Timestamp:
- Jun 27, 2017, 2:07:55 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/drivers/soclib_xcu.c
r75 r76 27 27 #include <chdev.h> 28 28 29 30 31 ////////////////////////////////////32 29 void soclib_xcu_init( chdev_t * icu, 33 30 lid_t lid ) 34 31 { 35 // get local ICU segment base address36 uint32_t * base = (uint32_t *)GET_PTR( icu->base );37 32 38 // disable all IRQs39 base[XCU_MSK_HWI_DISABLE << 5 | lid] = 0xFFFFFFFF;40 base[XCU_MSK_WTI_DISABLE << 5 | lid] = 0xFFFFFFFF;41 base[XCU_MSK_PTI_DISABLE << 5 | lid] = 0xFFFFFFFF;42 33 } 43 34 44 ////////////////////////////////////////////45 35 void soclib_xcu_disable_irq( chdev_t * icu, 46 36 uint32_t mask, … … 48 38 lid_t lid ) 49 39 { 50 // get XCU segment base address51 uint32_t * base = (uint32_t *)GET_PTR( icu->base );52 40 53 // write into register54 if ( type == WTI_TYPE ) base[XCU_MSK_WTI_DISABLE << 5 | lid] = mask;55 else if( type == HWI_TYPE ) base[XCU_MSK_HWI_DISABLE << 5 | lid] = mask;56 else base[XCU_MSK_PTI_DISABLE << 5 | lid] = mask;57 41 } 58 42 59 ///////////////////////////////////////////60 43 void soclib_xcu_enable_irq( chdev_t * icu, 61 44 uint32_t mask, … … 63 46 lid_t lid ) 64 47 { 65 // get XCU segment base address66 uint32_t * base = (uint32_t *)GET_PTR( icu->base );67 48 68 // write into register69 if ( type == WTI_TYPE ) base[XCU_MSK_WTI_ENABLE << 5 | lid] = mask;70 else if( type == HWI_TYPE ) base[XCU_MSK_HWI_ENABLE << 5 | lid] = mask;71 else base[XCU_MSK_PTI_ENABLE << 5 | lid] = mask;72 49 } 73 50 74 ///////////////////////////////////////////75 51 void soclib_xcu_get_masks( chdev_t * icu, 76 52 lid_t lid, … … 79 55 uint32_t * pti_mask ) 80 56 { 81 // get XCU segment base address 82 uint32_t * base = (uint32_t *)GET_PTR( icu->base ); 83 84 // get values from registers 85 *hwi_mask = base[XCU_MSK_HWI << 5 | lid]; 86 *wti_mask = base[XCU_MSK_WTI << 5 | lid]; 87 *pti_mask = base[XCU_MSK_PTI << 5 | lid]; 57 88 58 } 89 59 90 //////////////////////////////////////////91 60 void soclib_xcu_set_period( chdev_t * icu, 92 61 uint32_t index, 93 62 uint32_t period ) 94 63 { 95 // get local ICU segment base address96 uint32_t * base = (uint32_t *)GET_PTR( icu->base );97 64 98 // write into register99 base[XCU_PTI_PER << 5 | index] = period;100 65 } 101 66 102 /////////////////////////////////////////////103 67 uint32_t soclib_xcu_ack_timer( chdev_t * icu, 104 68 uint32_t index ) 105 69 { 106 // get local ICU segment base address107 uint32_t * base = (uint32_t *)GET_PTR( icu->base );108 70 109 // read from register110 return base[XCU_PTI_ACK << 5 | index];111 71 } 112 72 113 ///////////////////////////////////////////114 73 void soclib_xcu_get_status( chdev_t * icu, 115 74 lid_t lid, … … 118 77 uint32_t * pti_status ) 119 78 { 120 // get local ICU segment base address121 uint32_t * base = (uint32_t *)GET_PTR( icu->base );122 79 123 // read PRIO register124 uint32_t prio = base[XCU_PRIO << 5 | lid];125 126 *wti_status = (prio & 0x4) ? (((prio >> 24) & 0x1F) + 1) : 0;127 *hwi_status = (prio & 0x2) ? (((prio >> 16) & 0x1F) + 1) : 0;128 *pti_status = (prio & 0x1) ? (((prio >> 8) & 0x1F) + 1) : 0;129 80 } 130 81 131 /////////////////////////////////////////132 82 void soclib_xcu_send_ipi( xptr_t icu_xp, 133 83 lid_t lid ) 134 84 { 135 // get target ICU device cluster and local pointer136 cxy_t cxy_icu = GET_CXY( icu_xp );137 chdev_t * ptr_icu = (chdev_t *)GET_PTR( icu_xp );138 85 139 // get extended pointer on target ICU segment base140 xptr_t xp_base = (xptr_t)hal_remote_lwd( XPTR( cxy_icu , &ptr_icu->base ) );141 142 // get remote ICU segment local pointer143 uint32_t * base = (uint32_t *)GET_PTR( xp_base );144 145 // send IPI to remote core146 hal_remote_sw( XPTR( cxy_icu , &base[XCU_WTI_REG << 5 | lid] ) , 0 );147 86 } 148 87 149 //////////////////////////////////////////////150 88 uint32_t * soclib_xcu_wti_ptr( chdev_t * icu, 151 89 uint32_t index ) 152 90 { 153 uint32_t * base = (uint32_t *)GET_PTR( icu->base );154 91 155 return &base[XCU_WTI_REG << 5 | index];156 92 }
Note: See TracChangeset
for help on using the changeset viewer.