Commit bcbdbf02 authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Grzegorz Daniluk

stats: fix them for switch

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>

Conflicts:

	arch/lm32/ram-wrs.ld
parent 7c829ef5
......@@ -31,9 +31,10 @@ ENTRY(_start)
MEMORY
{
ram : ORIGIN = 0x0000, LENGTH = 0x7000
mbox : ORIGIN = 0x7000, LENGTH = 0x1000
stats : ORIGIN = 0x8000, LENGTH = 0x1000
ram : ORIGIN = 0x0000, LENGTH = 0x6800
stats : ORIGIN = 0x6800, LENGTH = 0x0800
mbox : ORIGIN = 0x7000, LENGTH = 0x1000
stack : ORIGIN = 0x8000, LENGTH = 0x8000
}
SECTIONS
......@@ -55,20 +56,31 @@ SECTIONS
_ebss = .;
} > ram
.mbox : {
. = ALIGN(4);
_fmbox = .;
*(.mbox)
} > mbox
/*
* Currently (2014-11) the above goes up to around 0x5a00,
* so we can "safely" place statistics at a known address.
* If we need to move them later, we have a magic number
* in there.
*/
.stats : {
. = ALIGN(4);
_fstats = .;
*(.stats)
} > stats
/* First location in stack is highest address in RAM */
PROVIDE(_fstack = ORIGIN(ram) + LENGTH(ram) - 4);
/*
* The rt IPC buffer is placed at 0x7000. The value is hardwired
* in the RPC initialization calls (minipc_server_create() and
* wr-switch-sw::wrsw_hal in minipc_client_create()). However,
* we'd better have an ELF section here, so that the compier
* will complain if we overflow the stats structure above.
* We'll be able to move this address ahead when stats move,
* by using the magic in stats (there's no magic in minipc)
*/
.mbox : {
*(.mbox)
} > mbox
/* First location in stack is highest address in RAM (stack area) */
PROVIDE(_fstack = ORIGIN(stack) + LENGTH(stack) - 4);
}
/* We need to provide mprintf to ptp-noposix object files, if missing */
......
......@@ -19,10 +19,6 @@ volatile struct PPSG_WB *PPSG;
int spll_n_chan_ref, spll_n_chan_out;
#if defined(CONFIG_WR_SWITCH)
struct spll_stats *stats_ptr = 0x8000;
#endif
/*
* The includes below contain code (not only declarations) to enable
* the compiler to inline functions where necessary and save some CPU
......@@ -640,7 +636,6 @@ void spll_set_dac(int index, int value)
void spll_update()
{
struct spll_stats temp_stats;
switch(softpll.mode) {
case SPLL_MODE_GRAND_MASTER:
external_align_fsm(&softpll.ext);
......@@ -648,21 +643,18 @@ void spll_update()
}
spll_update_aux_clocks();
#if defined(CONFIG_WR_SWITCH)
/* for WRS update .stat section in memory */
temp_stats.magic = 0x5b1157a7;
temp_stats.ver = 1;
temp_stats.mode = softpll.mode;
temp_stats.irq_cnt = irq_count;
temp_stats.seq_state = softpll.seq_state;
temp_stats.align_state = softpll.ext.align_state;
temp_stats.H_lock = softpll.helper.ld.locked;
temp_stats.M_lock = softpll.mpll.ld.locked;
temp_stats.H_y = softpll.helper.pi.y;
temp_stats.M_y = softpll.mpll.pi.y;
temp_stats.del_cnt = softpll.delock_count;
*stats_ptr = temp_stats;
#endif
if (is_wr_switch) {
/* currently we have statistics only in the switch */
stats.mode = softpll.mode;
stats.irq_cnt = irq_count;
stats.seq_state = softpll.seq_state;
stats.align_state = softpll.ext.align_state;
stats.H_lock = softpll.helper.ld.locked;
stats.M_lock = softpll.mpll.ld.locked;
stats.H_y = softpll.helper.pi.y;
stats.M_y = softpll.mpll.pi.y;
stats.del_cnt = softpll.delock_count;
}
}
static int spll_measure_frequency(int osc)
......
......@@ -143,5 +143,8 @@ struct spll_stats {
int del_cnt;
};
/* This only exists in wr-switch, but we should use it always */
extern struct spll_stats stats;
#endif // __SOFTPLL_NG_H
......@@ -10,6 +10,15 @@ const char *build_date;
int scb_ver = 33; //SCB version.
/*
* We export softpll internal status to the ARM cpu, for SNMP. Thus,
* we place this structure at a known address in the linker script
*/
struct spll_stats stats __attribute__((section(".stats"))) = {
.magic = 0x5b1157a7,
.ver = 1,
};
int main(void)
{
uint32_t start_tics = timer_get_tics();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment