OK, following Eric' suggestion, let's start with a list.
Each item on the list is marked as M (mandatory), R (recommended),
O (optional), A (architecture dependent, not needed on all systems),
C (chipset dependent)
Assembly startup:
M Reset jump to start of LinuxBIOS
A Ensure CPU is in sane state (e.g. Purge I Pipeline, etc.)
A Put CPU into protected virtual memory mode
O Enable serial port debugging print
O Enable debugging prints to console graphics
O Memory test
R Set up C environment
R Jump to C code
Hardware startup:
A Configure Cache. Needed here for speed.
A Processor-dependent steps that are required, e.g. microcode patch
R Init C display variables. Required before printk()
R Init malloc memory pool
O Display processor internal details of value (e.g. intel cpuid)
O Pick a PCI method if you need to init PCI
R Size memory so you can tell Linux
A Re-config the cache so that it caches all or memory
O Configure PCI bus
A Mainboard fixup
C enabled extended NVRAM access
A Handle extended machine state (e.g. MTRR)
C Enable keyboard
C Enable floppy
A Enable tables that Linux uses on startup (e.g. SMPBLOCK)
R Set up IRQ tables for Linux
R Enable interrupts
O Final Mainboard Fixup
A Final L2 Configure
R Call non-hardware-dependent linuxbiosmain()
-----
By the way, looking back, I think intel_main was really for intel-like
systems, and linuxbiosmain was supposed to be more generic. But
linuxbiosmain() is contaminated.
Kernel startup:
O Banner
R gunzip setup
R gunzip
R Linux parameter setup
(mistake!) APIC setup
R Jump to Linux
Corrections and comments welcome.
How do we restructure?
We need a sequence of calls to functions to get the bare minimum stuff up.
What about namespace clashes for multiple superios? Linux solves this
problems with arrays of structs peppered with #ifdefs (yuck), FreeBSD
solves it with "linker sets". Another option: Since the config tool is
told which superios to use, it can easily create the array of structs in a
.h file which have pointers to the functions for the superio.
How do we create main()? If we all write our own main, over time, things
will diverge, and knowledge I gain in my main() will not propagate to
yours. Question, should main() be built by the config tool? Just one more
file to be created using a template and a Config file?
thanks
ron