init: use macros for init declarations and validate order level
Expanding on our effort to defining strong semantics lets be a bit
more pedantic over the order level, what gpxe calls the table
sub-index.
The ordering part of the section name can't be used on C code yet
to validate that a subordinate init routine order level unless has a
less order level. To help with this add macros to enable setting the
order level, also add an order level as part of the init sequence to
enable sanity checking of the order level at run time.
This also enables semantic parsers to be used to vet for sorting
semantics on order level at build time, reduces overal code,
and also makes it easier to modify the use of annotation as needed
without affecting users.
With this we get this error:
./main
Initializing x86 bare metal world
INVALID ORDER LEVEL! acme should have an order level <= be called before pci!
Number of init entries: 7
Initializing kasan ...
Early init for Kasan...
Completed initializing kasan !
Initializing memory ...
Completed initializing memory !
Initializing beta ...
Completed initializing beta !
Initializing alpha ...
Completed initializing alpha !
Initializing pci ...
Completed initializing pci !
Initializing acme ...
Completed initializing acme !
Booting bare metal
Calling start_kernel()...
Running setup_arch for kasan ...
Calling setup_arch work for Kasan...
Next we'll fix this.
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
9 files changed