Thread (20 messages) flat view 20 messages, 3 authors, 2011-06-09
STALE5577d

[PATCH 4/6] ARM: reset: add reset functionality for jumping to a physical address

From: Will Deacon <hidden>
Date: 2011-06-08 16:05:27

On Wed, Jun 08, 2011 at 04:55:11PM +0100, Frank Hofmann wrote:

On Tue, 7 Jun 2011, Frank Hofmann wrote:
quoted

On Tue, 7 Jun 2011, Dave Martin wrote:
[ ... ]
quoted
quoted
How about:

	typeof(cpu_reset) *phys_reset =
		(typeof(cpu_reset) *)virt_to_phys(cpu_reset);
Function pointers ;-)
Thanks.
Hmmm ...

Just found a problem with this.

If you have a MULTI_CPU config, this doesn't compile. For two reasons:

1. you cannot use cpu_reset as argument to virt_to_phys because you can't
    take the address
    That bit can be fixed by changing the MULTI_CPU #define in
    <asm/proc-fns.h> not to include the macro argument.
    (There is no code in the arm tree using cpu_reset_whatever names which
    would break from that change ... still, not that nice)

2. even when you do that, you loose the "typeof()" information and the
    above still doesn't compile.

Only a manual type override,

 	void (*phys_reset)(unsigned long) = (void (*)(unsigned long))cpu_reset;

is accepted then.
Damn, yes, I assumed the MULTI_CPU case would just pointer at the structure field,
but it takes the argument as parameter for the invocation. Oh well, I'll hardcode
the type after all then!

I'll send a v2 once I've finished cleaning up the code as I've tried to make it
more useful following on from your earlier feedback.

Cheers,

Will
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help