Пример #1
0
int  mem_operation_rim_byte(int num_operations,void *seg_address,void *pattern_ptr,int trap_flag,void *seg,void *stanza,void *pattern_sz_ptr,void* seed){
    int i=0,rc=0;
    char *w_ptr = (char*)seg_address;
    char read_data;
    for (i=0; i < num_operations; i++) {
        *w_ptr = *(char*)pattern_ptr;
        read_data = *(char*)w_ptr;
        dcbf((volatile char*)w_ptr);
        read_data = *(char*)w_ptr;
        if(read_data != *(char*)pattern_ptr) {
            if(trap_flag){
                #ifndef __HTX_LINUX__
                trap(0xBEEFDEAD,i,(unsigned long)seg_address,(unsigned long)pattern_ptr,(unsigned long)w_ptr,(unsigned long)seg,(unsigned long)stanza);
                #else
                do_trap_htx64(0xBEEFDEAD,i,(unsigned long)seg_address,(unsigned long)pattern_ptr,(unsigned long)w_ptr,(unsigned long)seg,(unsigned long)stanza);
                #endif
            }

            rc = i+1;
            break;
        }
        w_ptr = w_ptr + 1;
        rc = 0;
    }
    return rc;
}
Пример #2
0
int mem_operation_write_addr_comp(int num_operations,void *seg_address,void *pattern_ptr,int trap_flag,void *seg,void *stanza,void *pattern_sz_ptr,void* seed){
    int i=0,rc=0;
    unsigned long *rw_ptr = (unsigned long *)seg_address;
    unsigned long address = *(unsigned long *)seg_address;
    unsigned long read_dw_data;
    for (i=0;i<num_operations;i++){
        *rw_ptr = address;
        dcbf((volatile unsigned long*)rw_ptr);
        read_dw_data = *(unsigned long *)rw_ptr;
        if(read_dw_data != address) {
            if(trap_flag){
                #ifndef __HTX_LINUX__
                trap(0xBEEFDEAD,i,(unsigned long)seg_address,(unsigned long)pattern_ptr,(unsigned long)rw_ptr,(unsigned long)seg,(unsigned long)stanza);
                #else
                do_trap_htx64(0xBEEFDEAD,i,(unsigned long)seg_address,(unsigned long)pattern_ptr,(unsigned long)rw_ptr,(unsigned long)seg,(unsigned long)stanza);
                #endif
            }
            rc = i+1;
            break;
        }
        rw_ptr  = rw_ptr + 1;
        address = (unsigned long)rw_ptr;
        rc = 0;
    }
    return rc;
}
Пример #3
0
static __inline__ void __bm_cl_out(struct bm_addr *bm, uintptr_t offset, uint32_t val)
{
    uint32_t    *tmp = (uint32_t *)ptr_ADD(bm->addr_ce, offset);
    WRITE_UINT32(*tmp, val);
    dcbf(tmp);
}
Пример #4
0
long int initdram (int board_type)
{
    long dram_size = 0;

#if !defined(CONFIG_RAM_AS_FLASH)
    volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);
    sys_info_t sysinfo;
    uint temp_lbcdll = 0;
#endif
#if !defined(CONFIG_RAM_AS_FLASH) || defined(CONFIG_DDR_DLL)
    volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR);
#endif

#if defined(CONFIG_DDR_DLL)
    uint temp_ddrdll = 0;

    /* Work around to stabilize DDR DLL */
    temp_ddrdll = gur->ddrdllcr;
    gur->ddrdllcr = ((temp_ddrdll & 0xff) << 16) | 0x80000000;
    asm("sync;isync;msync");
#endif

#if defined(CONFIG_SPD_EEPROM)
    dram_size = spd_sdram ();
#else
    dram_size = fixed_sdram ();
#endif

#if defined(CFG_RAMBOOT)
    return dram_size;
#endif

#if !defined(CONFIG_RAM_AS_FLASH) /* LocalBus is not emulating flash */
    get_sys_info(&sysinfo);
    /* if localbus freq is less than 66Mhz,we use bypass mode,otherwise use DLL */
    if(sysinfo.freqSystemBus/(CFG_LBC_LCRR & 0x0f) < 66000000) {
        lbc->lcrr = (CFG_LBC_LCRR & 0x0fffffff)| 0x80000000;
    } else {
        lbc->lcrr = CFG_LBC_LCRR & 0x7fffffff;
        udelay(200);
        temp_lbcdll = gur->lbcdllcr;
        gur->lbcdllcr = ((temp_lbcdll & 0xff) << 16 ) | 0x80000000;
        asm("sync;isync;msync");
    }
    lbc->or2 = CFG_OR2_PRELIM; /* 64MB SDRAM */
    lbc->br2 = CFG_BR2_PRELIM;
    lbc->lbcr = CFG_LBC_LBCR;
    lbc->lsdmr = CFG_LBC_LSDMR_1;
    asm("sync");
    * (ulong *)0 = 0x000000ff;
    lbc->lsdmr = CFG_LBC_LSDMR_2;
    asm("sync");
    * (ulong *)0 = 0x000000ff;
    lbc->lsdmr = CFG_LBC_LSDMR_3;
    asm("sync");
    * (ulong *)0 = 0x000000ff;
    lbc->lsdmr = CFG_LBC_LSDMR_4;
    asm("sync");
    * (ulong *)0 = 0x000000ff;
    lbc->lsdmr = CFG_LBC_LSDMR_5;
    asm("sync");
    lbc->lsrt = CFG_LBC_LSRT;
    asm("sync");
    lbc->mrtpr = CFG_LBC_MRTPR;
    asm("sync");
#endif

#if defined(CONFIG_DDR_ECC)
    {
        /* Initialize all of memory for ECC, then
         * enable errors */
        uint *p = 0;
        uint i = 0;
        volatile ccsr_ddr_t *ddr= (void *)(CFG_MPC85xx_DDR_ADDR);
        dma_init();
        for (*p = 0; p < (uint *)(8 * 1024); p++) {
            if (((unsigned int)p & 0x1f) == 0) {
                dcbz(p);
            }
            *p = (unsigned int)0xdeadbeef;
            if (((unsigned int)p & 0x1c) == 0x1c) {
                dcbf(p);
            }
        }

        /* 8K */
        dma_xfer((uint *)0x2000,0x2000,(uint *)0);
        /* 16K */
        dma_xfer((uint *)0x4000,0x4000,(uint *)0);
        /* 32K */
        dma_xfer((uint *)0x8000,0x8000,(uint *)0);
        /* 64K */
        dma_xfer((uint *)0x10000,0x10000,(uint *)0);
        /* 128k */
        dma_xfer((uint *)0x20000,0x20000,(uint *)0);
        /* 256k */
        dma_xfer((uint *)0x40000,0x40000,(uint *)0);
        /* 512k */
        dma_xfer((uint *)0x80000,0x80000,(uint *)0);
        /* 1M */
        dma_xfer((uint *)0x100000,0x100000,(uint *)0);
        /* 2M */
        dma_xfer((uint *)0x200000,0x200000,(uint *)0);
        /* 4M */
        dma_xfer((uint *)0x400000,0x400000,(uint *)0);

        for (i = 1; i < dram_size / 0x800000; i++) {
            dma_xfer((uint *)(0x800000*i),0x800000,(uint *)0);
        }

        /* Enable errors for ECC */
        ddr->err_disable = 0x00000000;
        asm("sync;isync;msync");
    }
#endif

    return dram_size;
}
Пример #5
0
int qbman_swp_enqueue_multiple_desc(struct qbman_swp *s,
				    const struct qbman_eq_desc *d,
				    const struct qbman_fd *fd,
				    int num_frames)
{
	uint32_t *p;
	const uint32_t *cl;
	uint32_t eqcr_ci, eqcr_pi;
	uint8_t diff;
	int i, num_enqueued = 0;
	uint64_t addr_cena;

	if (!s->eqcr.available) {
		eqcr_ci = s->eqcr.ci;
		s->eqcr.ci = qbman_cena_read_reg(&s->sys,
				QBMAN_CENA_SWP_EQCR_CI) & 0xF;
		diff = qm_cyc_diff(QBMAN_EQCR_SIZE,
				   eqcr_ci, s->eqcr.ci);
		s->eqcr.available += diff;
		if (!diff)
			return 0;
	}

	eqcr_pi = s->eqcr.pi;
	num_enqueued = (s->eqcr.available < num_frames) ?
			s->eqcr.available : num_frames;
	s->eqcr.available -= num_enqueued;
	/* Fill in the EQCR ring */
	for (i = 0; i < num_enqueued; i++) {
		p = qbman_cena_write_start_wo_shadow(&s->sys,
					QBMAN_CENA_SWP_EQCR(eqcr_pi & 7));
		cl = qb_cl(&d[i]);
		memcpy(&p[1], &cl[1], 28);
		memcpy(&p[8], &fd[i], sizeof(*fd));
		eqcr_pi++;
		eqcr_pi &= 0xF;
	}

	lwsync();

	/* Set the verb byte, have to substitute in the valid-bit */
	eqcr_pi = s->eqcr.pi;
	for (i = 0; i < num_enqueued; i++) {
		p = qbman_cena_write_start_wo_shadow(&s->sys,
					QBMAN_CENA_SWP_EQCR(eqcr_pi & 7));
		cl = qb_cl(&d[i]);
		p[0] = cl[0] | s->eqcr.pi_vb;
		eqcr_pi++;
		eqcr_pi &= 0xF;
		if (!(eqcr_pi & 7))
			s->eqcr.pi_vb ^= QB_VALID_BIT;
	}

	/* Flush all the cacheline without load/store in between */
	eqcr_pi = s->eqcr.pi;
	addr_cena = (uint64_t)s->sys.addr_cena;
	for (i = 0; i < num_enqueued; i++) {
		dcbf((uint64_t *)(addr_cena +
				QBMAN_CENA_SWP_EQCR(eqcr_pi & 7)));
		eqcr_pi++;
		eqcr_pi &= 0xF;
	}
	s->eqcr.pi = eqcr_pi;

	return num_enqueued;
}