Changeset 3 for trunk/kernel/devices/dev_iob.c
- Timestamp:
- Apr 26, 2017, 2:08:13 PM (6 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/devices/dev_iob.c
r1 r3 1 1 /* 2 * dev_io x.c - IOX(bridge to external I/O) generic device API implementation.2 * dev_iob.c - IOB (bridge to external I/O) generic device API implementation. 3 3 * 4 4 * Authors Alain Greiner (2017) … … 14 14 * ALMOS-MKH is distributed in the hope that it will be useful, but 15 15 * WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTIO XLAR PURPOSE. See the GNU16 * MERCHANTABILITY or FITNESS FOR A PARTIOBLAR PURPOSE. See the GNU 17 17 * General Public License for more details. 18 18 * … … 26 26 #include <hal_special.h> 27 27 #include <remote_spinlock.h> 28 #include < device.h>28 #include <chdev.h> 29 29 #include <printk.h> 30 30 #include <soclib_iob.h> 31 #include <dev_io x.h>31 #include <dev_iob.h> 32 32 33 ////////////////////////////////// 34 void dev_io x_init( xptr_t dev_xp)33 //////////////////////////////////// 34 void dev_iob_init( chdev_t * chdev ) 35 35 { 36 // get IOX device descriptor cluster and local pointer 37 cxy_t dev_cxy = GET_CXY( dev_xp ); 38 device_t * dev_ptr = (device_t *)GET_PTR( dev_xp ); 39 40 // get implementation from device descriptor 41 uint32_t impl = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->impl ) ); 36 // get implementation 37 uint32_t impl = chdev->impl; 42 38 43 39 // call driver init function 44 if( impl == IMPL_IO X_IOB)40 if( impl == IMPL_IOB_TSR ) 45 41 { 46 soclib_iob_init( dev_xp);42 soclib_iob_init( chdev ); 47 43 } 48 44 else 49 45 { 50 printk("\n[PANIC] in %s: undefined IOX device implementation\n", __FUNCTION__ ); 51 hal_core_sleep(); 46 assert( false , __FUNCTION__ , "undefined IOB device implementation\n" ); 52 47 } 53 48 } 54 49 55 50 ////////////////////////////////////////// 56 void dev_io x_iommu_enable( xptr_t dev_xp )51 void dev_iob_iommu_enable( xptr_t dev_xp ) 57 52 { 58 // get IO X devicedescriptor cluster and local pointer59 cxy_t 60 device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );53 // get IOB chdev descriptor cluster and local pointer 54 cxy_t dev_cxy = GET_CXY( dev_xp ); 55 chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp ); 61 56 62 // get implementation from devicedescriptor57 // get implementation from chdev descriptor 63 58 uint32_t impl = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->impl ) ); 64 59 65 60 // call driver function 66 if( impl == IMPL_IO X_IOB)61 if( impl == IMPL_IOB_TSR ) 67 62 { 68 63 remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) ); … … 72 67 else 73 68 { 74 printk("\n[PANIC] in %s: undefined IO Xdevice implementation\n", __FUNCTION__ );69 printk("\n[PANIC] in %s: undefined IOB device implementation\n", __FUNCTION__ ); 75 70 hal_core_sleep(); 76 71 } … … 78 73 79 74 /////////////////////////////////////////// 80 void dev_io x_iommu_disable( xptr_t dev_xp )75 void dev_iob_iommu_disable( xptr_t dev_xp ) 81 76 { 82 // get IO X devicedescriptor cluster and local pointer83 cxy_t 84 device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );77 // get IOB chdev descriptor cluster and local pointer 78 cxy_t dev_cxy = GET_CXY( dev_xp ); 79 chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp ); 85 80 86 // get implementation from devicedescriptor81 // get implementation from chdev descriptor 87 82 uint32_t impl = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->impl ) ); 88 83 89 84 // call driver function 90 if( impl == IMPL_IO X_IOB)85 if( impl == IMPL_IOB_TSR ) 91 86 { 92 87 remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) ); … … 96 91 else 97 92 { 98 printk("\n[PANIC] in %s: undefined IO Xdevice implementation\n", __FUNCTION__ );93 printk("\n[PANIC] in %s: undefined IOB device implementation\n", __FUNCTION__ ); 99 94 hal_core_sleep(); 100 95 } … … 102 97 103 98 //////////////////////////////////////// 104 void dev_io x_set_ptpr( xptr_t dev_xp,99 void dev_iob_set_ptpr( xptr_t dev_xp, 105 100 uint32_t wdata ) 106 101 { 107 // get IO X devicedescriptor cluster and local pointer108 cxy_t 109 device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );102 // get IOB chdev descriptor cluster and local pointer 103 cxy_t dev_cxy = GET_CXY( dev_xp ); 104 chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp ); 110 105 111 // get implementation from devicedescriptor106 // get implementation from chdev descriptor 112 107 uint32_t impl = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->impl ) ); 113 108 114 109 // call driver function 115 if( impl == IMPL_IO X_IOB)110 if( impl == IMPL_IOB_TSR ) 116 111 { 117 112 remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) ); … … 121 116 else 122 117 { 123 printk("\n[PANIC] in %s: undefined IO Xdevice implementation\n", __FUNCTION__ );118 printk("\n[PANIC] in %s: undefined IOB device implementation\n", __FUNCTION__ ); 124 119 hal_core_sleep(); 125 120 } … … 127 122 128 123 //////////////////////////////////////// 129 void dev_io x_inval_page( xptr_t dev_xp,124 void dev_iob_inval_page( xptr_t dev_xp, 130 125 vpn_t vpn ) 131 126 { 132 // get IO X devicedescriptor cluster and local pointer133 cxy_t 134 device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );127 // get IOB chdev descriptor cluster and local pointer 128 cxy_t dev_cxy = GET_CXY( dev_xp ); 129 chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp ); 135 130 136 // get implementation from devicedescriptor131 // get implementation from chdev descriptor 137 132 uint32_t impl = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->impl ) ); 138 133 139 134 // call driver function 140 if( impl == IMPL_IO X_IOB)135 if( impl == IMPL_IOB_TSR ) 141 136 { 142 137 remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) ); … … 146 141 else 147 142 { 148 printk("\n[PANIC] in %s: undefined IO Xdevice implementation\n", __FUNCTION__ );143 printk("\n[PANIC] in %s: undefined IOB device implementation\n", __FUNCTION__ ); 149 144 hal_core_sleep(); 150 145 } … … 152 147 153 148 /////////////////////////////////////////// 154 void dev_io x_get_status( xptr_t dev_xp,149 void dev_iob_get_status( xptr_t dev_xp, 155 150 uint32_t * error, 156 151 uint32_t * bvar, 157 152 uint32_t * srcid ) 158 153 { 159 // get IO X devicedescriptor cluster and local pointer160 cxy_t 161 device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );154 // get IOB chdev descriptor cluster and local pointer 155 cxy_t dev_cxy = GET_CXY( dev_xp ); 156 chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp ); 162 157 163 // get implementation from devicedescriptor158 // get implementation from chdev descriptor 164 159 uint32_t impl = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->impl ) ); 165 160 166 161 // call driver function 167 if( impl == IMPL_IO X_IOB)162 if( impl == IMPL_IOB_TSR ) 168 163 { 169 164 remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) ); … … 175 170 else 176 171 { 177 printk("\n[PANIC] in %s: undefined IO Xdevice implementation\n", __FUNCTION__ );172 printk("\n[PANIC] in %s: undefined IOB device implementation\n", __FUNCTION__ ); 178 173 hal_core_sleep(); 179 174 }
Note: See TracChangeset
for help on using the changeset viewer.