int prefetch_randomise_dscr(unsigned long long random_number, unsigned int what, unsigned int thread_no) { /* Structure of DSCR +------------+-------+-------+-------+-------+-------+-------+-----------+-------+-------+-------+-------+-------+ | // | SWTE | HWTE | STE | LTE | SWUE | HWUE | UNIT CNT | URG | LSD | SNSE | SSE | DPFD | +------------+-------+-------+-------+-------+-------+-------+-----------+-------+-------+-------+-------+-------+ 0 3839 40 41 42 43 44 45 5455 5758 59 60 61 63 */ unsigned long long local_random_number; unsigned long long read_dscr; int rc = 0; mfspr_dscr(&read_dscr); th_array[thread_no].read_dscr_val = read_dscr; switch ( what ) { case DSCR_RANDOM: mtspr_dscr(random_number); th_array[thread_no].written_dscr_val = random_number; rc = 0; break; case DSCR_LSDISABLE: local_random_number = random_number | (0x1<<5); mtspr_dscr(random_number); th_array[thread_no].written_dscr_val = random_number; #ifdef DEBUG printf("[%d] Original random number = 0x%x , After setting 58th bit = 0x%x\n",__LINE__,random_number,local_random_number); #endif rc = 0; break; case DSCR_DEFAULT: break; default: sprintf(msg,"[%d] Wrong parameter = %d\n", __LINE__, what); hxfmsg(&h_d, -1, HTX_HE_HARD_ERROR, msg); rc = -1; break; } /*sleep (1);*/ return rc; }
int paf_dsc_set(uint64_t dscr) { /* check whether DSCR support is available */ if (*dscr_support_mask == 0) { errno = ENOSYS; return -1; } /* check whether the value to be set in DSCR is supported in this machine */ if ((dscr | *dscr_support_mask) != *dscr_support_mask) { DEBUG("Cannot set dscr 0x%" PRIx64 " (supported mask 0x%" PRIx64 ")", dscr, *dscr_support_mask); errno = EINVAL; return -1; } DEBUG("set 0x%" PRIx64, dscr); mtspr_dscr(dscr_sprn, dscr); return 0; }