From 244aa1a4c0833bc9f91585de113c5e36182e96d8 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Mon, 10 Oct 2011 22:03:12 +0200 Subject: [PATCH] minor optimizations, use RC_RCCEID to determine the core id --- arch/x86/scc/icc.c | 52 ++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/arch/x86/scc/icc.c b/arch/x86/scc/icc.c index 65d7ef62..711860e8 100644 --- a/arch/x86/scc/icc.c +++ b/arch/x86/scc/icc.c @@ -37,7 +37,6 @@ bootinfo_t* bootinfo = (bootinfo_t*) SCC_BOOTINFO; -static int num_ues, my_ue; /* PSE bit for Pentium+ equals MPE (message buffer enable) flag in RCK! So, use it to create _PAGE_MPB symbol... */ #define _CR4_MPE 0x00000800 @@ -115,15 +114,14 @@ static void icc_handler(struct state *s) iRCCE_MAIL_HEADER* header = NULL; int tmp, source; uint32_t status_low, status_high, status; - static int z, core_id = -1; + static int z = -1; volatile static uint32_t* status_addr; volatile static uint32_t* reset_addr; - if (core_id < 0) { - core_id = RC_COREID[my_ue]; - z = Z_PID(core_id); - status_addr = (volatile uint32_t*) (FPGA_BASE + IRQ_STATUS + core_id * 8); - reset_addr = (volatile uint32_t*) (FPGA_BASE + IRQ_RESET + core_id * 8); + if (z < 0) { + z = Z_PID(RC_MY_COREID); + status_addr = (volatile uint32_t*) (FPGA_BASE + IRQ_STATUS + RC_MY_COREID * 8); + reset_addr = (volatile uint32_t*) (FPGA_BASE + IRQ_RESET + RC_MY_COREID * 8); } status_low = status_addr[0]; @@ -140,15 +138,13 @@ static void icc_handler(struct state *s) status >>= 6; // shift emac bits for (source=0; status!=0; status >>= 1, ++source) { - if ( (status & 0x1) != 0 ) { - iRCCE_mail_check(source); - } + if (((status & 0x1) != 0) && (RC_RCCEID[source] >= 0)) + iRCCE_mail_check(RC_RCCEID[source]); } for (source=26, status=status_high; status!=0; status >>= 1, ++source) { - if ( (status & 0x1) != 0 ) { - iRCCE_mail_check(source); - } + if (((status & 0x1) != 0) && (RC_RCCEID[source] >= 0)) + iRCCE_mail_check(RC_RCCEID[source]); } } else iRCCE_mail_check(iRCCE_MAILBOX_ALL); @@ -213,9 +209,7 @@ int icc_init(void) // enable additional outputs //RCCE_debug_set(RCCE_DEBUG_ALL); - my_ue = RCCE_ue(); - num_ues = RCCE_num_ues(); - kprintf("Got rank %d of %d ranks\n", my_ue, num_ues); + kprintf("Got rank %d of %d ranks\n", RCCE_IAM, RCCE_NP); RCCE_barrier(&RCCE_COMM_WORLD); @@ -241,7 +235,7 @@ int icc_init(void) #endif // reset INTR/LINT0 flag - z = Z_PID(RC_COREID[my_ue]); + z = Z_PID(RC_MY_COREID); tmp=ReadConfigReg(CRB_OWN + (z==0 ? GLCFG0 : GLCFG1)); tmp &= ~(1 << GLCFG_XINTR_BIT); SetConfigReg(CRB_OWN + (z==0 ? GLCFG0 : GLCFG1), tmp); @@ -274,16 +268,16 @@ int icc_init(void) else kputs("disabled!\n"); - // set interrupt handler (INTR/LINT0) + // set interrupt handler (LINT0) irq_install_handler(124, icc_handler); // unmask interrupts - volatile uint32_t* irq_mask = (volatile uint32_t*)(FPGA_BASE + IRQ_MASK + RC_COREID[my_ue]*8); + volatile uint32_t* irq_mask = (volatile uint32_t*)(FPGA_BASE + IRQ_MASK + RC_COREID[RCCE_IAM]*8); irq_mask[0] = 0x00; //0x3F; irq_mask[1] = 0x00; // set remote interrupts to LINT 0 - volatile uint32_t* irq_config = (volatile uint32_t*)(FPGA_BASE + IRQ_CONFIG + RC_COREID[my_ue]*4); + volatile uint32_t* irq_config = (volatile uint32_t*)(FPGA_BASE + IRQ_CONFIG + RC_COREID[RCCE_IAM]*4); irq_config[0] = 0x00; kprintf( "irq_mask = 0x%x, 0x%x\n", irq_mask[0], irq_mask[1]); @@ -308,7 +302,7 @@ int icc_halt(void) #define CORE_B 1 // receiver int icc_send_gic_irq(int core_num) { - volatile uint32_t* irq_request = (volatile uint32_t*)(FPGA_BASE+IRQ_REQUEST+RC_COREID[my_ue]*8); + volatile uint32_t* irq_request = (volatile uint32_t*)(FPGA_BASE+IRQ_REQUEST+RC_MY_COREID*8); uint32_t bit_pos; if (BUILTIN_EXPECT((core_num < 0) || (core_num > 48), 0)) @@ -335,9 +329,9 @@ int icc_mail_ping(void) iRCCE_MAIL_HEADER* recv_header = NULL; /* leave function if not participating in pingpong */ - if( (my_ue != CORE_A) && (my_ue != CORE_B) ) return -1; + if( (RCCE_IAM != CORE_A) && (RCCE_IAM != CORE_B) ) return -1; - kprintf( "my_ue = %d\n", my_ue ); + kprintf( "my_ue = %d\n", RCCE_IAM); kprintf( "Hello from mail_ping ... \n" ); kprintf( "rounds = %d\n", ROUNDS ); @@ -347,7 +341,7 @@ int icc_mail_ping(void) for( i=0; i