This series converts the AHCI driver to run entirely in 32bit mode. Currently, ahci will only jump into 32bit mode when it needs to access the ahci device's PCI config space. However, if the code has to run anything in 32bit mode, it might as well run it all in 32bit mode. Doing this also shrinks the total SeaBIOS code size by a few KB.
In order for this to work, SeaBIOS needs to be able to transition from 32bit mode back to 16bit mode in order to use yield(). This requires tracking the stack segment when using call32() and restoring it if call16() is later called. It also requires getting off the "extra stack" if it is in use.
This series is a little bit uglier than I hoped, but I'm sending it out for further comments.
This series is also at: https://github.com/KevinOConnor/seabios/tree/testing
-Kevin
Kevin O'Connor (6): Rearrange stack_hop_back() call in wait_irq, check_irqs, and _farcall16. Minor - move call16 assembler in romlayout.S. Make __call16 use C calling convention and support two passed parameters. Update _farcall16() to pass segment of callregs explicitly. Support call16() calls after entering 32bit mode from call32(). Run ahci code entirely in 32bit mode.
Makefile | 4 +- src/block.c | 13 ++++-- src/hw/ahci.c | 15 ++----- src/hw/blockcmd.c | 5 ++- src/romlayout.S | 132 ++++++++++++++++++++++++++++++++---------------------- src/stacks.c | 78 +++++++++++++++++++------------- 6 files changed, 145 insertions(+), 102 deletions(-)