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) ...@@ -31,9 +31,10 @@ ENTRY(_start)
MEMORY MEMORY
{ {
ram : ORIGIN = 0x0000, LENGTH = 0x7000 ram : ORIGIN = 0x0000, LENGTH = 0x6800
stats : ORIGIN = 0x6800, LENGTH = 0x0800
mbox : ORIGIN = 0x7000, LENGTH = 0x1000 mbox : ORIGIN = 0x7000, LENGTH = 0x1000
stats : ORIGIN = 0x8000, LENGTH = 0x1000 stack : ORIGIN = 0x8000, LENGTH = 0x8000
} }
SECTIONS SECTIONS
...@@ -55,20 +56,31 @@ SECTIONS ...@@ -55,20 +56,31 @@ SECTIONS
_ebss = .; _ebss = .;
} > ram } > ram
.mbox : { /*
. = ALIGN(4); * Currently (2014-11) the above goes up to around 0x5a00,
_fmbox = .; * so we can "safely" place statistics at a known address.
*(.mbox) * If we need to move them later, we have a magic number
} > mbox * in there.
*/
.stats : { .stats : {
. = ALIGN(4);
_fstats = .;
*(.stats) *(.stats)
} > 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 */ /* We need to provide mprintf to ptp-noposix object files, if missing */
......
...@@ -19,10 +19,6 @@ volatile struct PPSG_WB *PPSG; ...@@ -19,10 +19,6 @@ volatile struct PPSG_WB *PPSG;
int spll_n_chan_ref, spll_n_chan_out; 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 includes below contain code (not only declarations) to enable
* the compiler to inline functions where necessary and save some CPU * the compiler to inline functions where necessary and save some CPU
...@@ -640,7 +636,6 @@ void spll_set_dac(int index, int value) ...@@ -640,7 +636,6 @@ void spll_set_dac(int index, int value)
void spll_update() void spll_update()
{ {
struct spll_stats temp_stats;
switch(softpll.mode) { switch(softpll.mode) {
case SPLL_MODE_GRAND_MASTER: case SPLL_MODE_GRAND_MASTER:
external_align_fsm(&softpll.ext); external_align_fsm(&softpll.ext);
...@@ -648,21 +643,18 @@ void spll_update() ...@@ -648,21 +643,18 @@ void spll_update()
} }
spll_update_aux_clocks(); spll_update_aux_clocks();
#if defined(CONFIG_WR_SWITCH) if (is_wr_switch) {
/* for WRS update .stat section in memory */ /* currently we have statistics only in the switch */
temp_stats.magic = 0x5b1157a7; stats.mode = softpll.mode;
temp_stats.ver = 1; stats.irq_cnt = irq_count;
temp_stats.mode = softpll.mode; stats.seq_state = softpll.seq_state;
temp_stats.irq_cnt = irq_count; stats.align_state = softpll.ext.align_state;
temp_stats.seq_state = softpll.seq_state; stats.H_lock = softpll.helper.ld.locked;
temp_stats.align_state = softpll.ext.align_state; stats.M_lock = softpll.mpll.ld.locked;
temp_stats.H_lock = softpll.helper.ld.locked; stats.H_y = softpll.helper.pi.y;
temp_stats.M_lock = softpll.mpll.ld.locked; stats.M_y = softpll.mpll.pi.y;
temp_stats.H_y = softpll.helper.pi.y; stats.del_cnt = softpll.delock_count;
temp_stats.M_y = softpll.mpll.pi.y; }
temp_stats.del_cnt = softpll.delock_count;
*stats_ptr = temp_stats;
#endif
} }
static int spll_measure_frequency(int osc) static int spll_measure_frequency(int osc)
......
...@@ -143,5 +143,8 @@ struct spll_stats { ...@@ -143,5 +143,8 @@ struct spll_stats {
int del_cnt; int del_cnt;
}; };
/* This only exists in wr-switch, but we should use it always */
extern struct spll_stats stats;
#endif // __SOFTPLL_NG_H #endif // __SOFTPLL_NG_H
...@@ -10,6 +10,15 @@ const char *build_date; ...@@ -10,6 +10,15 @@ const char *build_date;
int scb_ver = 33; //SCB version. 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) int main(void)
{ {
uint32_t start_tics = timer_get_tics(); 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