FreeBSD/sys/mips/rmi/fmn.c
/*
 * Initialize the messaging subsystem.
 * 
 * Message Stations are shared among all threads in a cpu core, this 
 * has to be called once from every core which is online.
 */
Initialize the messaging subsystem.

Message Stations are shared among all threads in a cpu core, this
has to be called once from every core which is online.
Initialize the messaging subsystem . Message Stations are shared among all threads in a cpu core this has to be called once from every core which is online .
void 
xlr_msgring_cpu_init(void)
{
	struct stn_cc *cc_config;
	struct bucket_size *bucket_sizes;
	uint32_t flags;
	int id;
	KASSERT(xlr_thr_id() == 0,
		("xlr_msgring_cpu_init from non-zero thread"));
	id = xlr_core_id();
	bucket_sizes = xlr_board_info.bucket_sizes;
	cc_config = xlr_board_info.credit_configs[id];
	flags = msgrng_access_enable();
	msgrng_write_bucksize(0, bucket_sizes->bucket[id * 8 + 0]);
	msgrng_write_bucksize(1, bucket_sizes->bucket[id * 8 + 1]);
	msgrng_write_bucksize(2, bucket_sizes->bucket[id * 8 + 2]);
	msgrng_write_bucksize(3, bucket_sizes->bucket[id * 8 + 3]);
	msgrng_write_bucksize(4, bucket_sizes->bucket[id * 8 + 4]);
	msgrng_write_bucksize(5, bucket_sizes->bucket[id * 8 + 5]);
	msgrng_write_bucksize(6, bucket_sizes->bucket[id * 8 + 6]);
	msgrng_write_bucksize(7, bucket_sizes->bucket[id * 8 + 7]);
	MSGRNG_CC_INIT_CPU_DEST(0,  cc_config->counters);
	MSGRNG_CC_INIT_CPU_DEST(1,  cc_config->counters);
	MSGRNG_CC_INIT_CPU_DEST(2,  cc_config->counters);
	MSGRNG_CC_INIT_CPU_DEST(3,  cc_config->counters);
	MSGRNG_CC_INIT_CPU_DEST(4,  cc_config->counters);
	MSGRNG_CC_INIT_CPU_DEST(5,  cc_config->counters);
	MSGRNG_CC_INIT_CPU_DEST(6,  cc_config->counters);
	MSGRNG_CC_INIT_CPU_DEST(7,  cc_config->counters);
	MSGRNG_CC_INIT_CPU_DEST(8,  cc_config->counters);
	MSGRNG_CC_INIT_CPU_DEST(9,  cc_config->counters);
	MSGRNG_CC_INIT_CPU_DEST(10, cc_config->counters);
	MSGRNG_CC_INIT_CPU_DEST(11, cc_config->counters);
	MSGRNG_CC_INIT_CPU_DEST(12, cc_config->counters);
	MSGRNG_CC_INIT_CPU_DEST(13, cc_config->counters);
	MSGRNG_CC_INIT_CPU_DEST(14, cc_config->counters);
	MSGRNG_CC_INIT_CPU_DEST(15, cc_config->counters);
	msgrng_restore(flags);
}
void xlr_msgring_cpu_init ( void ) { struct stn_cc * cc_config ; struct bucket_size * bucket_sizes ; uint32_t flags ; int id ; KASSERT ( xlr_thr_id ( ) == 0 , ( " " ) ) ; id = xlr_core_id ( ) ; bucket_sizes = xlr_board_info . bucket_sizes ; cc_config = xlr_board_info . credit_configs [ id ] ; flags = msgrng_access_enable ( ) ; msgrng_write_bucksize ( 0 , bucket_sizes -> bucket [ id * 8 + 0 ] ) ; msgrng_write_bucksize ( 1 , bucket_sizes -> bucket [ id * 8 + 1 ] ) ; msgrng_write_bucksize ( 2 , bucket_sizes -> bucket [ id * 8 + 2 ] ) ; msgrng_write_bucksize ( 3 , bucket_sizes -> bucket [ id * 8 + 3 ] ) ; msgrng_write_bucksize ( 4 , bucket_sizes -> bucket [ id * 8 + 4 ] ) ; msgrng_write_bucksize ( 5 , bucket_sizes -> bucket [ id * 8 + 5 ] ) ; msgrng_write_bucksize ( 6 , bucket_sizes -> bucket [ id * 8 + 6 ] ) ; msgrng_write_bucksize ( 7 , bucket_sizes -> bucket [ id * 8 + 7 ] ) ; MSGRNG_CC_INIT_CPU_DEST ( 0 , cc_config -> counters ) ; MSGRNG_CC_INIT_CPU_DEST ( 1 , cc_config -> counters ) ; MSGRNG_CC_INIT_CPU_DEST ( 2 , cc_config -> counters ) ; MSGRNG_CC_INIT_CPU_DEST ( 3 , cc_config -> counters ) ; MSGRNG_CC_INIT_CPU_DEST ( 4 , cc_config -> counters ) ; MSGRNG_CC_INIT_CPU_DEST ( 5 , cc_config -> counters ) ; MSGRNG_CC_INIT_CPU_DEST ( 6 , cc_config -> counters ) ; MSGRNG_CC_INIT_CPU_DEST ( 7 , cc_config -> counters ) ; MSGRNG_CC_INIT_CPU_DEST ( 8 , cc_config -> counters ) ; MSGRNG_CC_INIT_CPU_DEST ( 9 , cc_config -> counters ) ; MSGRNG_CC_INIT_CPU_DEST ( 10 , cc_config -> counters ) ; MSGRNG_CC_INIT_CPU_DEST ( 11 , cc_config -> counters ) ; MSGRNG_CC_INIT_CPU_DEST ( 12 , cc_config -> counters ) ; MSGRNG_CC_INIT_CPU_DEST ( 13 , cc_config -> counters ) ; MSGRNG_CC_INIT_CPU_DEST ( 14 , cc_config -> counters ) ; MSGRNG_CC_INIT_CPU_DEST ( 15 , cc_config -> counters ) ; msgrng_restore ( flags ) ; }
Initialize the messaging subsystem.
Initialize the messaging subsystem .
/*
	 * FMN messages are received in 8 buckets per core, set up
	 * the bucket sizes for each bucket
	 */ /* 
	 * For sending FMN messages, we need credits on the destination
	 * bucket.  Program the credits this core has on the 128 possible
	 * destination buckets.
	 * We cannot use a loop here, because the first argument has
	 * to be a constant integer value.
	 */