1 2 3#include "bf_support.h" 4 5 6 7// ******************************************************************* 8// Vary basic implementation of locking 9// To be moved into separate locking implementation file 10// ******************************************************************* 11void mtx_lock(struct mtx *mp) 12{ 13 if(mp->state == 1) { 14 printf("mutex already locked!\n"); 15 abort(); 16 } 17 mp->state = 1; // lock it 18} // end function: mtx_lock 19 20void mtx_unlock(struct mtx *mp) 21{ 22 if(mp->state == 0) { 23 printf("mutex not locked!\n"); 24 abort(); 25 } 26 mp->state = 0; // lock it 27} // end function: mtx_lock 28 29 30// ********************************************************** 31// bus related functions 32// ********************************************************** 33static __inline uint32_t 34ia64_ld4(uint32_t *p) 35{ 36 assert(!"NYI"); 37 uint32_t v =0; 38// __asm volatile("ld4 %0=[%1];;": "=r"(v): "r"(p)); 39 return (v); 40} 41 42static __inline void 43ia64_st4(uint32_t *p, uint32_t v) 44{ 45 assert(!"NYI"); 46// __asm volatile("st4 [%0]=%1;;": "r"(p): "r"(v)); 47} 48 49 50__inline uint32_t 51bus_space_read_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs) 52{ 53 54 uint32_t val = 0; 55 if (bst == 0) { 56 assert(!"NYI"); 57 abort(); 58 } 59 val = ia64_ld4((void *) (bsh + ofs)); 60 return val; 61} 62 63__inline void 64bus_space_write_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, 65 uint8_t val) 66{ 67 if (bst == 0) { 68 assert(!"NYI"); 69 abort(); 70 } 71 ia64_st4((void *) (bsh + ofs), val); 72} 73 74// FIXME: temperary hack to enable compilation of sfxge_err function call 75// Ideally, it should be implemented by driver code using common library. 76struct __efsys_identifier_s; 77typedef struct __efsys_identifier_s efsys_identifier_t; 78 79void sfxge_err(efsys_identifier_t *arg, unsigned int code, uint32_t dword0, 80 uint32_t dword1); 81 82void 83sfxge_err(efsys_identifier_t *arg, unsigned int code, uint32_t dword0, 84 uint32_t dword1) 85{ 86 assert(!"NYI"); 87} 88 89