metalsvm/arch/x86/scc/icc.c

648 lines
15 KiB
C
Raw Permalink Normal View History

/*
* Copyright 2010 Stefan Lankes, Chair for Operating Systems,
* RWTH Aachen University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR COND */
#include <metalsvm/stdio.h>
#include <metalsvm/errno.h>
2011-03-25 20:28:43 +01:00
#include <metalsvm/processor.h>
#include <metalsvm/errno.h>
#include <asm/io.h>
#include <asm/irqflags.h>
#include <asm/irq.h>
#ifdef CONFIG_ROCKCREEK
#include <asm/RCCE.h>
#include <asm/RCCE_lib.h>
#include <asm/iRCCE.h>
#include <asm/SCC_API.h>
#include <asm/icc.h>
#include <asm/svm.h>
#include <asm/limits.h>
2011-08-09 14:54:30 -07:00
#define IRQ_STATUS 0xD000
#define IRQ_MASK 0xD200
#define IRQ_RESET 0xD400
#define IRQ_REQUEST 0xD600
#define IRQ_CONFIG 0xD800
#include <net/rckemac.h>
2011-06-29 23:00:15 +02:00
bootinfo_t* bootinfo = (bootinfo_t*) SCC_BOOTINFO;
/* PSE bit for Pentium+ equals MPE (message buffer enable) flag in RCK! So, use it to create _PAGE_MPB symbol... */
#define _CR4_MPE 0x00000800
/* maximal number of SCC's cores */
#define MAX_SCC_CORES (NUM_ROWS*NUM_COLS*NUM_CORES)
/*
* This is the modified MPB program, which is part of the RCCE distribution (src/mpb.c).
*
* This function clears the local MPB and resets the test&set register.
*/
static int scc_clear(void)
{
int tmp, x, y, z, offset;
// Initialize API
InitAPI(0);
// Find out who I am...
tmp=ReadConfigReg(CRB_OWN+MYTILEID);
x=(tmp>>3) & 0x0f; // bits 06:03
y=(tmp>>7) & 0x0f; // bits 10:07
z=(tmp ) & 0x07; // bits 02:00
// Allocate Message Passing Buffer
t_vcharp MPB;
MPBalloc(&MPB, x, y, z, 1);
if (!MPB) {
kprintf("Unable to allocate MPB for core %d of Tile x=%d, y= %d! Exiting.\n", z, x, y);
return 255;
}
// zap own MPB
for (offset=0; offset < 0x2000; offset+=8)
*(volatile unsigned long long int*)(MPB+offset) = 0;
// Clear test&set register write. Next read-access will read "1" (lock granted).
SetConfigReg(CRB_ADDR(x,y)+((z)?LOCK1:LOCK0), 1);
// frees Message Passing Buffer
MPBunalloc(&MPB);
return 0;
}
static inline void icc_mail_check_tag(iRCCE_MAIL_HEADER* mail) {
char* recv_buffer;
if(BUILTIN_EXPECT(!mail, 0))
return;
switch( mail->tag ) {
case iRCCE_ANYLENGTH:
recv_buffer = (char*)kmalloc( mail->size );
iRCCE_irecv(recv_buffer, mail->size, mail->source, NULL);
break;
case PING_REQ:
iRCCE_mail_send(0, PING_RESP, 0, NULL, mail->source);
break;
case SVM_REQ:
svm_emit_page(((size_t*) mail->payload)[1], ((size_t*) mail->payload)[0]);
break;
case SVM_RESP:
break;
case NOISE:
// kprintf( "XXX " );
default:
// kprintf( "icc_mail_check_tag: uknown tag id %d\n", mail->tag );
break;
}
}
static void icc_handler(struct state *s)
{
// reset appropriate bit in the core configuration register
iRCCE_MAIL_HEADER* header = NULL;
int tmp, source;
uint32_t status_low, status_high, status;
static int z = -1;
volatile static uint32_t* status_addr;
volatile static uint32_t* reset_addr;
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];
status_high = status_addr[1];
#ifdef CONFIG_LWIP
rckemacif_handler(s, status_low);
#endif
2011-06-29 23:00:15 +02:00
2011-10-09 21:03:31 -07:00
if ((status_low >> 6) || status_high)
{
/* determine interrupt sources */
status = status_low;
status >>= 6; // shift emac bits
for (source=0; status!=0; status >>= 1, ++source) {
if (((status & 0x1) != 0) && (RC_RCCEID[source] >= 0))
iRCCE_mail_check(RC_RCCEID[source]);
}
2011-10-09 21:03:31 -07:00
for (source=26, status=status_high; status!=0; status >>= 1, ++source) {
if (((status & 0x1) != 0) && (RC_RCCEID[source] >= 0))
iRCCE_mail_check(RC_RCCEID[source]);
}
2011-10-09 21:03:31 -07:00
} else iRCCE_mail_check(iRCCE_MAILBOX_ALL);
tmp=ReadConfigReg(CRB_OWN + (z==0 ? GLCFG0 : GLCFG1));
tmp &= ~2;
SetConfigReg(CRB_OWN + (z==0 ? GLCFG0 : GLCFG1), tmp);
/* Reset */
if (status_low)
reset_addr[0] = status_low;
if (status_high)
reset_addr[1] = status_high;
/* empty mail queue */
while( iRCCE_mail_recv(&header) == iRCCE_SUCCESS ) {
icc_mail_check_tag(header);
iRCCE_mail_release(&header);
}
}
int icc_init(void)
{
int i, z, tmp;
uint64_t start, end, ticks, freq = 533;
2011-08-10 22:44:16 -07:00
uint32_t cr4;
2012-09-11 23:50:39 -07:00
uint32_t msg;
kputs("Initialize Rock Creek!\n");
/* Enable Messagepassing in CR4 */
cr4 = read_cr4();
cr4 = cr4 | _CR4_MPE;
write_cr4(cr4);
kprintf("address of the initrd: 0x%x\n", bootinfo->addr);
kprintf("size of the initrd: %d\n", bootinfo->size);
kprintf("rcce argc = %d\n", bootinfo->argc);
for(i=0; i<bootinfo->argc; i++)
kprintf("rcce argv[%d] = %s\n", i, bootinfo->argv[i]);
if (bootinfo->argc >= 3)
freq = atoi(bootinfo->argv[2]);
kputs("Reset SCC!\n");
scc_clear();
kputs("Wait some time...\n");
mb();
start = rdtsc();
do {
mb();
end = rdtsc();
ticks = end > start ? end - start : start - end;
} while(ticks*TIMER_FREQ < 300ULL*freq*1000000ULL);
if (RCCE_init(&bootinfo->argc, &bootinfo->argv) != RCCE_SUCCESS)
2011-03-25 20:28:43 +01:00
return -ENODEV;
if (iRCCE_init() != iRCCE_SUCCESS)
return -ENODEV;
2011-03-25 20:28:43 +01:00
// enable additional outputs
//RCCE_debug_set(RCCE_DEBUG_ALL);
kprintf("Got rank %d of %d ranks\n", RCCE_IAM, RCCE_NP);
RCCE_barrier(&RCCE_COMM_WORLD);
kputs("RCCE test...\t");
2012-09-11 23:50:39 -07:00
if (!RCCE_IAM)
msg = 0x4711;
2012-09-11 23:50:39 -07:00
if ((RCCE_bcast((char*) &msg, sizeof(msg), 0, RCCE_COMM_WORLD) == RCCE_SUCCESS) && (msg == 0x4711))
kprintf("successfull! (0x%x)\n", msg);
else
kprintf("failed! (0x%x)\n", msg);
2011-06-28 07:31:23 +02:00
// reset INTR/LINT0 flag
z = Z_PID(RC_MY_COREID);
tmp=ReadConfigReg(CRB_OWN + (z==0 ? GLCFG0 : GLCFG1));
2011-08-23 06:51:25 -07:00
tmp &= ~(1 << GLCFG_XINTR_BIT);
SetConfigReg(CRB_OWN + (z==0 ? GLCFG0 : GLCFG1), tmp);
2011-08-23 06:51:25 -07:00
#if 0
// disable L2 cache
z = Z_PID(RC_COREID[my_ue]);
tmp=ReadConfigReg(CRB_OWN + (z==0 ? L2CFG0 : L2CFG1));
tmp |= (1 << L2CFG_WAYDISABLE_BIT);
SetConfigReg(CRB_OWN + (z==0 ? L2CFG0 : L2CFG1), tmp);
kprintf("set L2CFG to 0x%x\n", (uint32_t) tmp);
#endif
tmp=ReadConfigReg(CRB_OWN + (z==0 ? L2CFG0 : L2CFG1));
kputs("In the config registers is the L2 cache ");
if (tmp & (1 << L2CFG_WAYDISABLE_BIT))
kputs("disabled!\n");
else
kputs("enabled!\n");
kputs("In CR0 is caching ");
if (read_cr0() & (1 << 30))
kputs("disabled!\n");
else
kputs("enabled!\n");
kputs("In CR0 is writethrough caching ");
if (read_cr0() & (1 << 29))
kputs("enabled!\n");
else
kputs("disabled!\n");
// set interrupt handler (LINT0)
irq_install_handler(124, icc_handler);
2011-08-09 14:54:30 -07:00
// unmask interrupts
volatile uint32_t* irq_mask = (volatile uint32_t*)(FPGA_BASE + IRQ_MASK + RC_COREID[RCCE_IAM]*8);
2011-10-10 13:10:50 -07:00
irq_mask[0] = 0x3F;
irq_mask[1] = 0x00;
2011-08-09 14:54:30 -07:00
2011-08-10 00:21:21 -07:00
// set remote interrupts to LINT 0
volatile uint32_t* irq_config = (volatile uint32_t*)(FPGA_BASE + IRQ_CONFIG + RC_COREID[RCCE_IAM]*4);
irq_config[0] = 0x00;
2011-08-10 00:21:21 -07:00
kprintf( "irq_mask = 0x%x, 0x%x\n", irq_mask[0], irq_mask[1]);
kprintf( "irq_config = 0x%x\n", irq_config[0]);
2011-03-25 20:28:43 +01:00
kputs("Now, the SCC is initialized!\n");
return 0;
}
int icc_halt(void)
{
icc_mail_check();
2011-10-09 21:03:31 -07:00
//NOP1;
2011-08-17 23:32:39 -07:00
2011-10-09 21:03:31 -07:00
HALT;
return 0;
}
#define ROUNDS 20000
#define CORE_A RC_RCCEID[0] // sender
#define CORE_B RC_RCCEID[30] // receiver
2011-08-10 22:44:16 -07:00
int icc_send_gic_irq(int core_num) {
volatile uint32_t* irq_request = (volatile uint32_t*)(FPGA_BASE+IRQ_REQUEST+RC_MY_COREID*8);
uint32_t bit_pos;
2011-08-16 14:11:26 -07:00
if (BUILTIN_EXPECT((core_num < 0) || (core_num > 48), 0))
return -EINVAL;
2011-08-09 14:54:30 -07:00
// determine bit position and set according bit
if (RC_COREID[core_num] < 32) {
bit_pos = (1 << RC_COREID[core_num]);
irq_request[0] = bit_pos;
} else {
bit_pos = (1 << (RC_COREID[core_num]-32));
irq_request[1] = bit_pos;
}
2011-08-16 14:11:26 -07:00
2011-08-01 14:24:46 -07:00
return 0;
}
int icc_mail_ping(void)
{
uint32_t flags;
2011-07-02 09:09:53 -07:00
uint64_t timer = 0;
2011-07-01 15:41:41 +02:00
int i;
2011-07-23 12:27:08 -07:00
int res;
2011-07-01 15:41:41 +02:00
iRCCE_MAIL_HEADER* recv_header = NULL;
2011-06-07 12:38:35 +02:00
2011-07-23 12:27:08 -07:00
/* leave function if not participating in pingpong */
if( (RCCE_IAM != CORE_A) && (RCCE_IAM != CORE_B) ) return -1;
2011-07-23 12:27:08 -07:00
kprintf( "my rank = %d\n", RCCE_IAM);
2011-06-09 04:23:17 -07:00
kprintf( "Hello from mail_ping ... \n" );
2011-07-23 12:27:08 -07:00
kprintf( "rounds = %d\n", ROUNDS );
2011-06-08 05:07:22 -07:00
// disable interrupts
flags = irq_nested_disable();
2011-07-01 15:41:41 +02:00
for( i=0; i<ROUNDS+1; ++i ) {
2011-07-23 12:27:08 -07:00
/* senders part */
if( RCCE_IAM == CORE_A ) {
2011-07-01 15:41:41 +02:00
/* send ping request */
2011-07-23 12:27:08 -07:00
iRCCE_mail_send(0, PING_REQ, 0, NULL, CORE_B);
2011-08-21 11:38:09 -07:00
2011-07-01 15:41:41 +02:00
/* wait for response */
do {
res = iRCCE_mail_check(iRCCE_MAILBOX_ALL); //CORE_B);
2011-08-21 11:38:09 -07:00
} while( res != iRCCE_SUCCESS );
2011-07-01 15:41:41 +02:00
/* release mail */
2011-08-28 07:09:04 -07:00
iRCCE_mail_recv(&recv_header);
2011-07-01 15:41:41 +02:00
iRCCE_mail_release(&recv_header);
}
2011-07-23 12:27:08 -07:00
/* receivers part */
2011-07-01 15:41:41 +02:00
else {
/* wait for request */
do {
res = iRCCE_mail_check(iRCCE_MAILBOX_ALL); //CORE_A);
2011-08-21 11:38:09 -07:00
} while( res != iRCCE_SUCCESS );
2011-07-01 15:41:41 +02:00
2011-08-28 07:09:04 -07:00
/* check mail */
res = iRCCE_mail_recv(&recv_header);
icc_mail_check_tag(recv_header);
2011-05-31 04:29:20 -07:00
2011-07-01 15:41:41 +02:00
/* release mail */
iRCCE_mail_release(&recv_header);
}
/* start timer in first round */
if( i == 0 ) timer = rdtsc();
2011-07-01 15:41:41 +02:00
}
2011-06-07 12:38:35 +02:00
2011-07-01 15:41:41 +02:00
/* stop timer */
2011-06-07 12:38:35 +02:00
timer = rdtsc() - timer;
if( RCCE_IAM == CORE_A ) {
2011-07-23 12:27:08 -07:00
kprintf( "timer = %ld\n", timer );
2011-08-28 07:09:04 -07:00
kprintf( "mail_pingpong needs in average %d ns (%d ticks)!\n",
timer*1000/(2*ROUNDS*get_cpu_frequency()), timer/(2*ROUNDS) );
2011-06-07 12:38:35 +02:00
}
irq_nested_enable(flags);
return 0;
}
int icc_mail_ping_irq(void)
{
2011-08-24 04:25:10 -07:00
kprintf( "Hello from mail_ping_irq ... \n" );
/* return if not core A */
if( RCCE_IAM != CORE_A ) return 0;
2011-08-24 04:25:10 -07:00
2011-07-02 17:51:25 +02:00
uint32_t flags;
2011-07-02 09:09:53 -07:00
uint64_t timer = 0;
2011-07-02 17:51:25 +02:00
int i;
int res;
2011-07-02 17:51:25 +02:00
iRCCE_MAIL_HEADER* recv_header = NULL;
kprintf( "my rank = %d\n", RCCE_IAM );
2011-08-21 11:38:09 -07:00
kprintf( "rem_rank = %d\n", CORE_B );
2011-07-23 12:27:08 -07:00
kprintf( "rounds = %d\n", ROUNDS );
2011-08-13 17:14:01 -07:00
2011-07-02 17:51:25 +02:00
// disable interrupts
flags = irq_nested_disable();
2011-08-23 14:45:08 -07:00
2011-07-02 17:51:25 +02:00
for( i=0; i<ROUNDS+1; ++i ) {
/* send ping request */
2011-08-21 11:38:09 -07:00
iRCCE_mail_send(0, PING_REQ, 0, NULL, CORE_B);
/* send interrupt */
2011-08-21 11:38:09 -07:00
icc_send_gic_irq(CORE_B);
/* wait for response */
do {
2011-08-21 11:38:09 -07:00
res = iRCCE_mail_check(CORE_B);
2011-08-13 17:14:01 -07:00
} while( res != iRCCE_SUCCESS );
2011-08-23 14:45:08 -07:00
iRCCE_mail_recv(&recv_header);
iRCCE_mail_release(&recv_header);
2011-08-23 14:45:08 -07:00
2011-07-02 17:51:25 +02:00
/* start timer in first round */
if( i == 0 ) timer = rdtsc();
2011-08-13 17:14:01 -07:00
2011-07-02 17:51:25 +02:00
}
/* stop timer */
timer = rdtsc() - timer;
2011-08-20 07:09:37 -07:00
kprintf( "timer = %d\n", timer );
2011-08-27 02:31:30 -07:00
kprintf( "mail_pingpong needs in average %d nsec (%d ticks)!\n",
timer*1000/(2*ROUNDS*get_cpu_frequency()), timer/(2*ROUNDS) );
2011-07-02 17:51:25 +02:00
irq_nested_enable(flags);
return 0;
}
int icc_mail_ping_jitter(void)
{
kprintf( "Hello from jitter_test ... \n" );
/* return if not core A */
if( RCCE_IAM != CORE_A ) return 0;
uint32_t flags;
uint64_t timer = 0;
uint64_t max = 0;
uint64_t min = ULONG_MAX;
uint64_t sum = 0;
int i;
int res;
iRCCE_MAIL_HEADER* recv_header = NULL;
kprintf( "my_rank = %d\n", RCCE_IAM );
kprintf( "rem_rank = %d\n", CORE_B );
kprintf( "rounds = %d\n", ROUNDS );
// disable interrupts
flags = irq_nested_disable();
for( i=0; i<ROUNDS+1; ++i ) {
/* start timer */
timer = rdtsc();
/* send ping request */
iRCCE_mail_send(0, PING_REQ, 0, NULL, CORE_B);
/* send interrupt */
icc_send_gic_irq(CORE_B);
/* wait for response */
do {
res = iRCCE_mail_check(CORE_B);
} while( res != iRCCE_SUCCESS );
iRCCE_mail_recv(&recv_header);
iRCCE_mail_release(&recv_header);
/* stop timer and update eval values */
timer = rdtsc() - timer;
if( i > 0 ) {
max = ( max < timer )? timer : max;
min = ( min > timer )? timer : min;
sum += timer;
}
}
kprintf( "Average was: %d nsec\n", sum*1000/(2*ROUNDS*533) );
kprintf( "Maximum was: %d nsec\n", max*1000/(2*533) );
kprintf( "Minimum was: %d nsec\n", min*1000/(2*533) );
kprintf( "Jitter was: %d nsec\n", (max-min)*1000/(2*533) );
irq_nested_enable(flags);
return 0;
}
#undef _IRQ_NOISE_
#define NOISE_PRIO 1
2011-08-24 04:25:10 -07:00
int icc_mail_noise(void) {
2011-08-23 14:45:08 -07:00
int i, j, res;
int num_ranks = RCCE_num_ues();
int count = 0;
iRCCE_MAIL_HEADER* recv_mail = NULL;
2011-08-25 12:59:32 -07:00
/* timer vars */
uint64_t timer;
uint64_t tmr;
uint64_t tmr_send = 0;
uint64_t tmr_recv = 0;
uint64_t tmr_release = 0;
uint64_t tmr_chck = 0;
kprintf( "my_ue = %d\n", RCCE_IAM );
// leave function if not participating
if( (RCCE_IAM == CORE_A) || (RCCE_IAM == CORE_B) ) {
kprintf( "mail_noise: leaving" );
return -1;
}
2011-08-25 12:59:32 -07:00
2011-08-24 04:25:10 -07:00
kprintf( "Hello from icc_mail_noise: my_ue = %d\n", RCCE_IAM );
2011-08-23 14:45:08 -07:00
kprintf( "num_ues = %d\n", num_ranks );
timer = rdtsc();
for( i=0; i<40000; ++i ) {
if( !(i%1000) ) kprintf( "%d ", i );
tmr = rdtsc();
iRCCE_mail_check(iRCCE_MAILBOX_ALL);
tmr = rdtsc() - tmr;
tmr_chck += tmr;
/* send a mail to each UE */
for( j=0; j<num_ranks; ++j ) {
2011-12-13 03:39:21 -08:00
if( (j == CORE_A) || (j == CORE_B) ) continue;
2011-08-21 11:38:09 -07:00
/* send noise mail */
tmr = rdtsc();
iRCCE_mail_send(0, NOISE, NOISE_PRIO, NULL, j);
tmr = rdtsc() - tmr;
tmr_send += tmr;
tmr = rdtsc();
res = iRCCE_mail_recv(&recv_mail);
tmr = rdtsc() - tmr;
tmr_recv += tmr;
if( res == iRCCE_SUCCESS ) {
icc_mail_check_tag(recv_mail);
tmr = rdtsc();
iRCCE_mail_release(&recv_mail);
tmr = rdtsc() - tmr;
tmr_release += tmr;
count++;
}
}
2011-08-28 07:09:04 -07:00
}
2011-08-28 07:09:04 -07:00
do {
tmr = rdtsc();
2011-08-27 23:32:04 -07:00
iRCCE_mail_check(iRCCE_MAILBOX_ALL);
tmr = rdtsc() - tmr;
tmr_chck += tmr;
tmr = rdtsc();
2011-08-28 07:09:04 -07:00
res = iRCCE_mail_recv(&recv_mail);
tmr = rdtsc() - tmr;
tmr_recv += tmr;
if( res == iRCCE_SUCCESS ) {
icc_mail_check_tag(recv_mail);
tmr = rdtsc();
iRCCE_mail_release(&recv_mail);
tmr = rdtsc() - tmr;
tmr_release += tmr;
count++;
}
2011-08-28 07:09:04 -07:00
} while( res == iRCCE_SUCCESS );
2011-08-25 12:59:32 -07:00
timer = rdtsc() - timer;
kprintf( "Count = %d\n", count );
kprintf( "Time: %d ms\n", timer/(1000*get_cpu_frequency()) );
kprintf( "Time in send: %d ms\n", tmr_send/(1000*get_cpu_frequency()) );
kprintf( "Time in recv: %d ms\n", tmr_recv/(1000*get_cpu_frequency()) );
kprintf( "Time in chck: %d ms\n", tmr_chck/(1000*get_cpu_frequency()) );
kprintf( "Time in release: %d ms\n", tmr_release/(1000*get_cpu_frequency()) );
kprintf( "XXX XXX XXX" );
return 0;
}
/*
* Routine to check mailboxes.
*/
void icc_mail_check(void)
2011-06-07 12:38:35 +02:00
{
2011-11-07 12:24:11 -08:00
iRCCE_MAIL_HEADER* header = NULL;
2011-08-13 17:14:01 -07:00
uint32_t flags;
2011-08-11 09:02:49 -07:00
2011-08-13 17:14:01 -07:00
/* disable interrupts */
flags = irq_nested_disable();
iRCCE_mail_check(iRCCE_MAILBOX_ALL);
2011-08-11 09:02:49 -07:00
2011-08-13 17:14:01 -07:00
/* empty mail queue */
2011-08-24 04:25:10 -07:00
while( iRCCE_mail_recv(&header) == iRCCE_SUCCESS ) {
icc_mail_check_tag(header);
2011-06-07 12:38:35 +02:00
iRCCE_mail_release( &header );
}
/* enable interrupts */
irq_nested_enable(flags);
}
2011-11-21 13:37:15 -08:00
//uint64_t check_ticks = 0;
//uint64_t recv_ticks = 0;
2011-11-08 07:46:35 -08:00
void icc_wait(int tag)
{
iRCCE_MAIL_HEADER* header = NULL;
2011-11-07 12:24:11 -08:00
uint32_t flags;
2011-11-21 13:37:15 -08:00
//uint64_t start;
/* disable interrupts */
flags = irq_nested_disable();
2011-11-07 12:24:11 -08:00
retry:
2011-11-21 13:37:15 -08:00
//start = rdtsc();
2011-11-07 12:24:11 -08:00
iRCCE_mail_check(iRCCE_MAILBOX_ALL);
2011-11-21 13:37:15 -08:00
//check_ticks += rdtsc() - start;
2011-11-21 13:37:15 -08:00
//start = rdtsc();
2011-11-07 12:24:11 -08:00
/* empty mail queue */
2011-11-08 07:46:35 -08:00
while(iRCCE_mail_recv(&header) == iRCCE_SUCCESS ) {
2011-11-07 12:24:11 -08:00
icc_mail_check_tag(header);
if (header->tag == tag) {
iRCCE_mail_release( &header );
2011-11-07 12:24:11 -08:00
goto out;
} else iRCCE_mail_release( &header );
}
2011-11-21 13:37:15 -08:00
//recv_ticks += rdtsc() - start;
2011-11-07 12:24:11 -08:00
goto retry;
2011-11-07 12:24:11 -08:00
out:
2011-11-21 13:37:15 -08:00
//recv_ticks += rdtsc() - start;
/* enable interrupts */
irq_nested_enable(flags);
}
#endif