forked from Imagelibrary/rtems
powerpc: Use .machine any for some inline asm
This commit is contained in:
@@ -229,7 +229,12 @@ static inline void ppc_enforce_in_order_execution_of_io(void)
|
|||||||
{
|
{
|
||||||
RTEMS_COMPILER_MEMORY_BARRIER();
|
RTEMS_COMPILER_MEMORY_BARRIER();
|
||||||
|
|
||||||
__asm__ volatile ("eieio");
|
__asm__ volatile (
|
||||||
|
".machine \"push\"\n"
|
||||||
|
".machine \"any\"\n"
|
||||||
|
"eieio\n"
|
||||||
|
".machine \"pop\""
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ppc_data_cache_block_flush(void *addr)
|
static inline void ppc_data_cache_block_flush(void *addr)
|
||||||
|
|||||||
@@ -64,13 +64,27 @@ static inline void _write_MSR(unsigned long val)
|
|||||||
static inline unsigned long _read_SR(void * va)
|
static inline unsigned long _read_SR(void * va)
|
||||||
{
|
{
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
asm volatile("mfsrin %0,%1" : "=r" (val): "r" (va));
|
asm volatile (
|
||||||
|
".machine \"push\"\n"
|
||||||
|
".machine \"any\"\n"
|
||||||
|
"mfsrin %0,%1\n"
|
||||||
|
".machine \"pop\"" :
|
||||||
|
"=r" (val) :
|
||||||
|
"r" (va)
|
||||||
|
);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _write_SR(unsigned long val, void * va)
|
static inline void _write_SR(unsigned long val, void * va)
|
||||||
{
|
{
|
||||||
asm volatile("mtsrin %0,%1" : : "r"(val), "r" (va): "memory");
|
asm volatile (
|
||||||
|
".machine \"push\"\n"
|
||||||
|
".machine \"any\"\n"
|
||||||
|
"mtsrin %0,%1\n"
|
||||||
|
".machine \"pop\"" : :
|
||||||
|
"r" (val) , "r" (va) :
|
||||||
|
"memory"
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,12 @@ static inline uint32_t mpc55xx_count_leading_zeros( uint32_t value)
|
|||||||
static inline void mpc55xx_wait_for_interrupt(void)
|
static inline void mpc55xx_wait_for_interrupt(void)
|
||||||
{
|
{
|
||||||
#ifdef MPC55XX_HAS_WAIT_INSTRUCTION
|
#ifdef MPC55XX_HAS_WAIT_INSTRUCTION
|
||||||
__asm__ volatile ("wait");
|
__asm__ volatile (
|
||||||
|
".machine \"push\"\n"
|
||||||
|
".machine \"any\"\n"
|
||||||
|
"wait\n"
|
||||||
|
".machine \"pop\""
|
||||||
|
);
|
||||||
#else
|
#else
|
||||||
__asm__ volatile ("");
|
__asm__ volatile ("");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -364,9 +364,21 @@ VpdBufRec vpdData [] = {
|
|||||||
int i;
|
int i;
|
||||||
unsigned msr,tcr;
|
unsigned msr,tcr;
|
||||||
asm volatile("mfmsr %0":"=r"(msr));
|
asm volatile("mfmsr %0":"=r"(msr));
|
||||||
asm volatile("mftcr %0":"=r"(tcr));
|
asm volatile (
|
||||||
|
".machine \"push\"\n"
|
||||||
|
".machine \"any\"\n"
|
||||||
|
"mftcr %0\n"
|
||||||
|
".machine \"pop\"" :
|
||||||
|
"=r"(tcr)
|
||||||
|
);
|
||||||
printk("MSR is 0x%08x, TCR 0x%08x\n",msr,tcr);
|
printk("MSR is 0x%08x, TCR 0x%08x\n",msr,tcr);
|
||||||
asm volatile("mttcr %0"::"r"(0));
|
asm volatile (
|
||||||
|
".machine \"push\"\n"
|
||||||
|
".machine \"any\"\n"
|
||||||
|
"mttcr %0\n"
|
||||||
|
".machine \"pop\"" : :
|
||||||
|
"r"(0)
|
||||||
|
);
|
||||||
if (0) {
|
if (0) {
|
||||||
asm volatile("mtmsr %0"::"r"(msr|0x8000));
|
asm volatile("mtmsr %0"::"r"(msr|0x8000));
|
||||||
for (i=0; i<12; i++)
|
for (i=0; i<12; i++)
|
||||||
|
|||||||
@@ -188,9 +188,22 @@ static void ClockOn(const rtems_irq_connect_data* unused)
|
|||||||
auto_restart = true;
|
auto_restart = true;
|
||||||
|
|
||||||
#else /* ppc405 */
|
#else /* ppc405 */
|
||||||
__asm__ volatile ("mfdcr %0, 0x0b2" : "=r" (iocr)); /*405GP CPC0_CR1 */
|
__asm__ volatile (
|
||||||
|
".machine \"push\"\n"
|
||||||
|
".machine \"any\"\n"
|
||||||
|
"mfdcr %0, 0x0b2\n"
|
||||||
|
".machine \"pop\"" :
|
||||||
|
"=r" (iocr)
|
||||||
|
); /*405GP CPC0_CR1 */
|
||||||
iocr &=~0x800000; /* timer clocked from system clock CETE*/
|
iocr &=~0x800000; /* timer clocked from system clock CETE*/
|
||||||
__asm__ volatile ("mtdcr 0x0b2, %0" : "=r" (iocr) : "0" (iocr)); /* 405GP CPC0_CR1 */
|
__asm__ volatile (
|
||||||
|
".machine \"push\"\n"
|
||||||
|
".machine \"any\"\n"
|
||||||
|
"mtdcr 0x0b2, %0\n"
|
||||||
|
".machine \"pop\"" :
|
||||||
|
"=r" (iocr) :
|
||||||
|
"0" (iocr)
|
||||||
|
); /* 405GP CPC0_CR1 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable auto restart
|
* Enable auto restart
|
||||||
|
|||||||
@@ -158,7 +158,14 @@
|
|||||||
static uint32_t
|
static uint32_t
|
||||||
seg2vsid (uint32_t ea)
|
seg2vsid (uint32_t ea)
|
||||||
{
|
{
|
||||||
__asm__ volatile ("mfsrin %0, %0":"=r" (ea):"0" (ea));
|
__asm__ volatile (
|
||||||
|
".machine \"push\"\n"
|
||||||
|
".machine \"any\"\n"
|
||||||
|
"mfsrin %0, %0\n"
|
||||||
|
".machine \"pop\"" :
|
||||||
|
"=r" (ea) :
|
||||||
|
"0" (ea)
|
||||||
|
);
|
||||||
return ea & ((1 << LD_VSID_SIZE) - 1);
|
return ea & ((1 << LD_VSID_SIZE) - 1);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -620,6 +627,8 @@ triv121PgTblActivate (Triv121PgTbl pt)
|
|||||||
* - restore original MSR
|
* - restore original MSR
|
||||||
*/
|
*/
|
||||||
__asm__ __volatile (
|
__asm__ __volatile (
|
||||||
|
" .machine \"push\"\n"
|
||||||
|
" .machine \"any\"\n"
|
||||||
" mtctr %[tmp0]\n"
|
" mtctr %[tmp0]\n"
|
||||||
/* Get MSR and switch interrupts off - just in case.
|
/* Get MSR and switch interrupts off - just in case.
|
||||||
* Also switch the MMU off; the book
|
* Also switch the MMU off; the book
|
||||||
@@ -651,6 +660,7 @@ triv121PgTblActivate (Triv121PgTbl pt)
|
|||||||
/* restore original MSR */
|
/* restore original MSR */
|
||||||
" mtmsr %[tmp0]\n"
|
" mtmsr %[tmp0]\n"
|
||||||
" isync \n"
|
" isync \n"
|
||||||
|
" .machine \"pop\"\n"
|
||||||
:[tmp0]"+r&"(tmp0), [tmp1]"+b&"(tmp1), [tmp2]"+b&"(tmp2)
|
:[tmp0]"+r&"(tmp0), [tmp1]"+b&"(tmp1), [tmp2]"+b&"(tmp2)
|
||||||
:[ea_range]"i"(FLUSH_EA_RANGE), [pg_sz]"i" (1 << LD_PG_SIZE),
|
:[ea_range]"i"(FLUSH_EA_RANGE), [pg_sz]"i" (1 << LD_PG_SIZE),
|
||||||
[sdr1]"i"(SDR1), [sdr1val]"r" (sdr1)
|
[sdr1]"i"(SDR1), [sdr1val]"r" (sdr1)
|
||||||
|
|||||||
@@ -98,7 +98,13 @@ void bsp_start( void )
|
|||||||
(uintptr_t) _ISR_Stack_area_begin,
|
(uintptr_t) _ISR_Stack_area_begin,
|
||||||
virtex_exc_vector_base
|
virtex_exc_vector_base
|
||||||
);
|
);
|
||||||
__asm__ volatile ("mtevpr %0" : : "r" (virtex_exc_vector_base));
|
__asm__ volatile (
|
||||||
|
".machine \"push\"\n"
|
||||||
|
".machine \"any\"\n"
|
||||||
|
"mtevpr %0\n"
|
||||||
|
".machine \"pop\"" : :
|
||||||
|
"r" (virtex_exc_vector_base)
|
||||||
|
);
|
||||||
|
|
||||||
bsp_interrupt_initialize();
|
bsp_interrupt_initialize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,13 +133,16 @@ static void
|
|||||||
fetch(bsp_tlb_idx_t key, bsp_tlb_entry_t* tlb)
|
fetch(bsp_tlb_idx_t key, bsp_tlb_entry_t* tlb)
|
||||||
{
|
{
|
||||||
register uint32_t tmp;
|
register uint32_t tmp;
|
||||||
__asm__ volatile ("mfpid %[tmp] \n\t"
|
__asm__ volatile (".machine \"push\" \n\t"
|
||||||
|
".machine \"any\" \n\t"
|
||||||
|
"mfpid %[tmp] \n\t"
|
||||||
"stw %[tmp],0(%[tlb]) \n\t"
|
"stw %[tmp],0(%[tlb]) \n\t"
|
||||||
"tlbrehi %[tmp],%[key] \n\t"
|
"tlbrehi %[tmp],%[key] \n\t"
|
||||||
"stw %[tmp],4(%[tlb]) \n\t"
|
"stw %[tmp],4(%[tlb]) \n\t"
|
||||||
"tlbrelo %[tmp],%[key] \n\t"
|
"tlbrelo %[tmp],%[key] \n\t"
|
||||||
"stw %[tmp],8(%[tlb]) \n\t"
|
"stw %[tmp],8(%[tlb]) \n\t"
|
||||||
"sync \n\t"
|
"sync \n\t"
|
||||||
|
".machine \"pop\" \n\t"
|
||||||
: [tmp]"=&r"(tmp)
|
: [tmp]"=&r"(tmp)
|
||||||
: [key]"r"(key),
|
: [key]"r"(key),
|
||||||
[tlb]"b"(tlb)
|
[tlb]"b"(tlb)
|
||||||
@@ -151,12 +154,15 @@ static void
|
|||||||
store(bsp_tlb_idx_t key, bsp_tlb_entry_t* tlb)
|
store(bsp_tlb_idx_t key, bsp_tlb_entry_t* tlb)
|
||||||
{
|
{
|
||||||
register uint32_t tmp;
|
register uint32_t tmp;
|
||||||
__asm__ volatile ("lwz %[tmp],0(%[tlb]) \n\t"
|
__asm__ volatile (".machine \"push\" \n\t"
|
||||||
|
".machine \"any\" \n\t"
|
||||||
|
"lwz %[tmp],0(%[tlb]) \n\t"
|
||||||
"mtpid %[tmp] \n\t"
|
"mtpid %[tmp] \n\t"
|
||||||
"lwz %[tmp],4(%[tlb]) \n\t"
|
"lwz %[tmp],4(%[tlb]) \n\t"
|
||||||
"tlbwehi %[tmp],%[key] \n\t"
|
"tlbwehi %[tmp],%[key] \n\t"
|
||||||
"lwz %[tmp],8(%[tlb]) \n\t"
|
"lwz %[tmp],8(%[tlb]) \n\t"
|
||||||
"tlbwelo %[tmp],%[key] \n\t"
|
"tlbwelo %[tmp],%[key] \n\t"
|
||||||
|
".machine \"pop\" \n\t"
|
||||||
: [tmp]"=&r"(tmp)
|
: [tmp]"=&r"(tmp)
|
||||||
: [tlb]"b"(tlb),
|
: [tlb]"b"(tlb),
|
||||||
[key]"r"(key)
|
[key]"r"(key)
|
||||||
@@ -290,9 +296,12 @@ bsp_mmu_find_first_free()
|
|||||||
|
|
||||||
for (idx=0; idx<NTLBS; idx++) {
|
for (idx=0; idx<NTLBS; idx++) {
|
||||||
register uint32_t tmp;
|
register uint32_t tmp;
|
||||||
__asm__ volatile ("tlbrehi %[tmp],%[idx] \n\t"
|
__asm__ volatile (".machine \"push\" \n\t"
|
||||||
|
".machine \"any\" \n\t"
|
||||||
|
"tlbrehi %[tmp],%[idx] \n\t"
|
||||||
"stw %[tmp],4(%[tlb]) \n\t" /* entry.hi */
|
"stw %[tmp],4(%[tlb]) \n\t" /* entry.hi */
|
||||||
"sync \n\t"
|
"sync \n\t"
|
||||||
|
".machine \"pop\" \n\t"
|
||||||
: [tmp]"=&r"(tmp)
|
: [tmp]"=&r"(tmp)
|
||||||
: [idx]"r"(idx),
|
: [idx]"r"(idx),
|
||||||
[tlb]"b"(&entry)
|
[tlb]"b"(&entry)
|
||||||
@@ -489,11 +498,14 @@ bsp_mmu_find(uint32_t ea, uint32_t tid)
|
|||||||
|
|
||||||
rtems_interrupt_disable(lvl);
|
rtems_interrupt_disable(lvl);
|
||||||
|
|
||||||
__asm__ volatile ("mfpid %[pid] \n\t" /* Save PID */
|
__asm__ volatile (".machine \"push\"\n\t"
|
||||||
|
".machine \"any\"\n\t"
|
||||||
|
"mfpid %[pid] \n\t" /* Save PID */
|
||||||
"mtpid %[tid] \n\t"
|
"mtpid %[tid] \n\t"
|
||||||
"tlbsx. %[idx],0,%[ea] \n\t" /* Failure changes the index reg randomly. */
|
"tlbsx. %[idx],0,%[ea] \n\t" /* Failure changes the index reg randomly. */
|
||||||
"mfcr %[failure] \n\t"
|
"mfcr %[failure] \n\t"
|
||||||
"mtpid %[pid] \n\t" /* Restore PID */
|
"mtpid %[pid] \n\t" /* Restore PID */
|
||||||
|
".machine \"pop\"\n\t"
|
||||||
: [pid]"=r"(pid),
|
: [pid]"=r"(pid),
|
||||||
[idx]"=&r"(idx),
|
[idx]"=&r"(idx),
|
||||||
[failure]"=&r"(failure)
|
[failure]"=&r"(failure)
|
||||||
|
|||||||
Reference in New Issue
Block a user