aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
AgeCommit message (Collapse)AuthorFilesLines
2012-05-20Add mechanism to declare variables as "low mem" and use for extra stack.Kevin O'Connor1-0/+1
Add a mechanism (VARLOW declaration) to make a variable reside in the low memory (e-segment) area. This is useful for runtime variables that need to be accessed from 16bit code and need to be modifiable during runtime. Move the 16bit "extra stack" from the EBDA to the low memory area using this declaration mechanism. Also increase the size of this stack from 512 bytes to 2048 bytes. This also reworks tools/layoutrom.py a bit. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-05-13Use the e-segment instead of the 9-segment for bios "low mem".Kevin O'Connor1-1/+1
Use the e-segment for ZoneLow allocations. There is plenty of e-segment space (there has been since SeaBIOS supported code relocation), while using the 9-segment space can impact old real-mode applications. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01Add TSC emulation layer for 386/486 CPUs.Kevin O'Connor1-3/+2
Original patch from Rudolf Marek. Signed-off-by: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01Detect CPUID instruction before using it.Kevin O'Connor1-6/+6
Enable SeaBIOS to work on 386/486 machines that don't have CPUID instruction. Based on patch by Rudolf Marek. Signed-off-by: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-10-30util: add le32_to_cpu()Isaku Yamahata1-0/+5
this will be used later. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2011-07-16Run option rom visible PMM code in 32bit mode instead of 16bit mode.Kevin O'Connor1-0/+2
Use call32() to jump into handle_pmm(). This reduces the amount of 16bit code needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-07-12pci: remove old pci initilaization codeGerd Hoffmann1-29/+0
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-07-10Simplify POST entry code by moving reboot logic from post.c to resume.c.Kevin O'Connor1-0/+10
Detect a resume/reboot by inspecting HaveRunPost instead of inspecting the cmos reset code. Inspecting a global variable is both simpler and safer. Move the reboot logic from post.c to resume.c - this makes the code in post.c simpler as it is now only called once on machine startup. This also makes it easier to ensure all POST initialization code resides in the relocatable "init" sections. Also, rename _start() to handle_post() so that it is more in keeping with the entry_xxx() and handle_xxx() function naming. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-07-05Replace CONFIG_SCREEN_AND_DEBUG with "etc/screen-and-debug" file.Kevin O'Connor1-0/+1
2011-07-02Calculate vgahook responses during setup instead of in 16bit code.Kevin O'Connor1-2/+3
Do vga type and parameter detection during setup and store the necessary info in global variables for the 16bit code. This simplifies the "vgahook" 16bit code.
2011-06-19Remove dev-i440fx.c/h - move code closer to its callers.Kevin O'Connor1-7/+0
It's easier to understand the code when it is in the same file as its callers.
2011-06-13Add support for use as Xen HVM BIOS.Ian Campbell1-0/+1
SeaBIOS is called by Xen's hvmloader which does the basic platform setup (PCI, APIC, etc) and provides the various BIOS tables. Therefore avoid re-doing that setup and copy out the tables as necessary. A simple data structure is defined to pass the addresses of these tables. This patch also establishes the basic infrastructure to make hypercalls, although it currently only uses it to query the hypervisor version. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2011-06-13Move support for copying out BIOS tables into its own file.Ian Campbell1-0/+5
I'd like to use it for Xen support. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2011-01-08Move the CBFS payload setup to later in the boot.Kevin O'Connor1-0/+1
Don't try to register payloads until after malloc has been setup.
2011-01-08Extract space trimming code from ATA and use in USB and bootorder code.Kevin O'Connor1-0/+1
Introduce function nullTrailingSpace() that nulls blank characters from the end of a string. Use this function in the ATA, USB MSC, and bootorder code.
2010-12-29Remove drive->desc field.Kevin O'Connor1-0/+2
The description field is only available during the POST phase - it is confusing to have it live in a structure available through all phases. The description was only used by the boot menu code - pass each drive description directly to the bootlist code. Add a helper (znprintf) to automatically malloc_tmp the required space. Also, fixup ramdisk handling - it was using an incorrect floppy priority.
2010-12-24Add strchr() function.Kevin O'Connor1-0/+1
2010-12-05util: add memset_fl()Gerd Hoffmann1-0/+1
2010-11-25Enhance call32() to pass a parameter to called function.Kevin O'Connor1-0/+1
Support passing a parameter to the 32bit function, as well as returning the result of the function back to the 16bit code. Also, make call32 available outside of stacks.c.
2010-11-13pci: introduce pci_region to manage pci io/memory/prefmemory regions.Isaku Yamahata1-0/+29
This patch adds helper functions to manage pci area. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2010-09-25Cleanup - it's no longer necessary to manually reset global variables.Kevin O'Connor1-2/+0
Now that a soft-reboot forces a hard-reboot, it is no longer necessary to manually reset global variables.
2010-09-15Add memalign_tmp() helper function.Kevin O'Connor1-0/+9
2010-09-15Try to hard-reboot on rerun of post even on emulators.Kevin O'Connor1-1/+3
Extend the hard-reboot logic to qemu and kvm. On qemu, a reboot will not reset the memory settings for 0xc0000-0xfffff, so copy that memory area manually before rebooting. Unfortunately, kvm does not keep a pristine copy of the BIOS at 0xffff0000, so detect that case and shutdown the machine.
2010-08-25Only show bootsplash during boot menu.Kevin O'Connor1-0/+1
When the bootsplash picture is shown, it's not possible to see text. So, only display the picture while prompting the user for the boot menu.
2010-07-26Bootsplash fixes and cleanups.Kevin O'Connor1-1/+4
VESA structs must be in first 1Meg - so use malloc_tmplow(). Use 'struct segoff_s' for segment/offset pairs in vesa structs. Don't call start/finish_preempt() around jpeg_decode() - the preempt only works when calling functions in 16bit mode. Some indentation and debug output enhancements.
2010-07-25Minor - introduce GDT_GRANLIMIT macro.Kevin O'Connor1-5/+9
Add macro to improve readability of GDT limit definitions.
2010-07-24seabios: smm: move out piix4 specific smram logic to dev-i440fx.cIsaku Yamahata1-0/+4
move out piix4 specific smram logic to dev-i440fx.c. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2010-07-24seabios: shadow: make device finding more generic.Isaku Yamahata1-0/+2
pam register offset is north bridge specific. So determine the offset based on found north bridge. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2010-07-24seabios: acpi: move out endian conversion helper function.Isaku Yamahata1-0/+10
move out cpu_to_le{32, 16} from acpi.c to util.h. Those will be used by other files later. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2010-07-10seabios: pciinit: use pci device initializer helper function.Kevin O'Connor1-0/+2
This patch makes use of pci device initialization helper function to convert if/switch clause to table driven. So this makes it easier to add q35 initialization code. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2010-06-28Initial bootsplash support.Kevin O'Connor1-0/+4
Support displaying a jpeg file (stored in cbfs) during bootup. Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
2010-06-13Unify optionrom cbfs/qemu_cfg rom pulling code.Kevin O'Connor1-2/+1
Make the qemu_cfg optionrom extraction code use an interface more similar to the cbfs file interface. Introduce a set of "romfile_" wrappers that select between cbfs and qemu cfg interface. Use these new wrappers in the optionrom code.
2010-06-06Introduce memcpy_fl - a memcpy on "flat" pointers.Kevin O'Connor1-0/+1
2010-05-23Don't use RTC to time boot menu delay.Kevin O'Connor1-1/+0
It appears real machines sometimes have a flaky RTC, so avoid using the RTC irq during boot. Instead, use a delay based on the standard timer irq. This also optimizes CONFIG_THREAD_OPTIONROMS users as it is no longer necessary to use preemption - the wait_irq() call handles task switching natively.
2010-05-23Generalize timer based delay code.Kevin O'Connor1-0/+3
Move the timer based counting code in serial.c to clock.c. Rework the interface to make it similar to the tsc based timers.
2010-05-23Rename check_time() to check_tsc().Kevin O'Connor1-1/+1
2010-05-23Allow wait_irq to be called in 32bit code.Kevin O'Connor1-10/+4
If wait_irq() is called from 32bit code, then jump to 16bit mode for the wait. Have wait_irq check for threads, and have it use yield if threads are pending. This ensures threads aren't delayed if anything calls wait_irq. Use wait_irq() in 32bit mode during a failed boot.
2010-03-20Force use of indirect function calls in inline assembler.Kevin O'Connor1-1/+1
For indirect calls, place function address in a register and call it. This is less optimal when gcc can inline the code and the destination address is known at compile time. However, older gcc compilers don't do as well with inlining, and they then mess up the code generation. There doesn't seem to be a way to tell gcc how to emit the code correctly for both immediate addresses and register addresses, so fall back to a safe way. Also, reduce params to stack_hop to avoid register assignment issues.
2010-03-20Don't move EBDA while an optionrom is running (CONFIG_THREAD_OPTIONROMS).Kevin O'Connor1-0/+1
Moving the ebda while an optionrom is running could confuse it. So, avoid doing that.
2010-03-13Backup and restore registers when calling out to user funcs.Kevin O'Connor1-3/+6
Make sure to fully backup and restore register state when calling out to other interrupts and functions. Some old DOS programs don't fully restore state. Also, make sure to enable irqs in call16_simpint().
2010-02-28Introduce simple "mutex" locking code.Kevin O'Connor1-0/+3
Locks are not normally necessary because SeaBIOS uses a cooperative multitasking system. However, occasionally it is necessary to be able to lock a resource across yield calls. This patch introduces a simple mechanism for doing that.
2010-02-28Add a generic "internal error" warning function.Kevin O'Connor1-0/+3
2010-02-21Cleanup - build drive description in temp memory during init.Kevin O'Connor1-0/+6
Remove describe_drive() mechanism for calling printf with a drive description. Instead, have each drive build a description in temporary ram during drive initialization. Also, remove fields now unneeded from 'struct disk_s' - model and cntl_info.
2010-02-15Optimize ntohl() code.Kevin O'Connor1-7/+15
Use the assembler bswapl instruction if the value is not constant.
2010-02-14Introduce standard warnings for allocation failures and timeouts.Kevin O'Connor1-6/+32
There is no need for custom warnings for many common failures. Introduce a common warning which is consistent and more visible.
2010-02-13Support USB interrupt schedules on OHCI and UHCI.Kevin O'Connor1-0/+2
The existing code always checks for USB "interrupt in" events every millisecond. Although that's okay, it consumes extra bandwidth. This change interrupt checks to be scheduled according to their requested interval time.
2010-01-03Be sure to add "void" to all function prototypes that take no args.Kevin O'Connor1-35/+35
Omitting "void" leads to a K&R style declaration which was not intended.
2010-01-01Add __noreturn define for __attribute__((noreturn)).Kevin O'Connor1-3/+2
2010-01-01Implement native 32bit APM support.Kevin O'Connor1-1/+1
Add APM code to 32bit segmented code. Use 32bit APM code instead of jumping into 16bit mode.
2009-12-30Add support for 32bit PCI BIOS entry.Kevin O'Connor1-0/+1
Create a new code blob (code32seg) with support for 32bit functions that need to utilize explicit segment accesses. This code blob uses global variables relative to %gs and with a dynamic code offset (determined by get_global_offset()). Add BIOS32 structure and code. Add code for 32bit PCI BIOS code.