[U-Boot] why uboot can access address 0 in cavium?

luyue hacklu.uboot at gmail.com
Mon Jul 4 03:55:15 CEST 2011


hi all,
I have some question in uboot of mips arch.

in my boot,it doesn't set the correct TLB of virtual address 0, but it 
go on accessing it.
maybe it had better via 0x80000000 to access address 0.

in the code,I found this:

octeon_bzero64_pfs(0, 0x100000);

and the function is:

void octeon_bzero64_pfs(uint64_t start_addr, uint64_t count)
{
     if (count == 0)
         return;

     /* 4 Cache line align start/count */
     start_addr &= ~(OCTEON_BZERO_PFS_STRIDE -1);
     count &= ~(OCTEON_BZERO_PFS_STRIDE -1);;

     volatile uint32_t count_low  = count & 0xffffffff;
     volatile uint32_t count_high = count >> 32;

     volatile uint32_t addr_low  = start_addr & 0xffffffff;
     volatile uint32_t addr_high = start_addr >> 32;
     asm volatile (
       "  .set push                   \n"
       "  .set mips64                       \n"
       "  .set noreorder                    \n"
       /* Standard twin 32 bit -> 64 bit construction */
       "  dsll  %[cnth], 32                 \n"
       "  dsll  %[cntl], 32          \n"
       "  dsrl  %[cntl], 32          \n"
       "  daddu %[cnth], %[cnth], %[cntl]   \n"
       /* Combined value is in cnth */
       /* Standard twin 32 bit -> 64 bit construction */
       "  dsll  %[addrh], 32                 \n"
       "  dsll  %[addrl], 32          \n"
       "  dsrl  %[addrl], 32          \n"
       "  daddu %[addrh], %[addrh], %[addrl]   \n"
       /* Combined value is in addrh */
         /* Now do real work..... */
       " 1:                               \n"
       "  daddi  %[cnth], -512              \n"
       "  pref 30, 0(%[addrh])      \n"
       "  pref 30, 128(%[addrh])      \n"
       "  pref 30, 256(%[addrh])      \n"
       "  pref 30, 384(%[addrh])      \n"
       "  bne   $0, %[cnth], 1b          \n"
       "  daddi  %[addrh], 512              \n"
       "  .set pop                       \n"
       : : [cnth] "r" (count_high), [cntl] "r" (count_low), [addrh] "r" 
(addr_high), [addrl] "r" (addr_low): "memory");
}

how or why it can access virtual address 0?

in other place,the boot access 0x20000000 without via 0x20000000|0x80000000.
where is the magic do that?

thanks for your attention

-- 
hacklu
just keep fighting


More information about the U-Boot mailing list