aboutsummaryrefslogtreecommitdiff
path: root/src/system.c
AgeCommit message (Collapse)AuthorFilesLines
2015-10-15e820: Rename memmap.c to e820map.c and use consistent "e820_" prefixKevin O'Connor1-1/+1
Rename memmap.c to e820map.c as the code in that file only deals with maintaining the e820 map. Move all the e820 definitions to new file e820map.h and use a consistent "e820_" prefix on all exported functions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-27Use 32bit memcpy in int1587 when applicableKevin O'Connor1-13/+19
If the amount of data to be copied is an even number of four, then copy the data in four byte chunks. This 32bit copy is more efficient, in particular when copying to/from memory mapped io. This should improve the performance of framebuffer draws in cbvga SeaVGABIOS. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-15Move a20 code from system.c and ps2port.h to x86.hKevin O'Connor1-18/+2
Although the a20 functionality was originally implemented in the ps2 controller, that is just a historical artifact. It's a core feature of modern x86 cpus and the code is better located in the x86.h header. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-05-08Fix int 1589 calls when CONFIG_ENTRY_EXTRASTACK is enabled.Kevin O'Connor1-2/+2
The int 1589 call is entered in real mode and returns in protected mode. However, the code to use the "extra stack" does not support that. Fix this by never using the "extra stack" on int 1589 calls. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-05-06If an int 1587 call is made from an option rom, stay in bigreal mode.Kevin O'Connor1-4/+5
Modify the int 1587 handler to check if the POST phase is still running. If it is, use bigreal mode segment limits so that the caller remains in bigreal mode when the 1587 handler completes. This helps with SeaVGABIOS' use of "direct" framebuffer accesses (an option rom may attempt to display text during its option rom execution which can cause SeaVGABIOS to make the int 1587 calls). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-10-26vgahooks: add SM720 VGA BIOS hooks for WIN Enterprises MB-60470Jonathan A. Kollasch1-0/+1
Add vgahooks to support the SMI SM720 VGA BIOS used on the WIN Enterprises MB-60470. The response from smi_157f14() is necessary for the CRT output to turn on. The response from smi_157f02() is used to configure which connector(s) output is routed to. As I lack hardware to test LCD panel output, I've selected CRT-only output on the MB-60470 as this prevents the CRT output from being scaled to the resolution of the LCD panel. Signed-off-by: Jonathan A. Kollasch <jakllsch@kollasch.net>
2013-09-28Remove ioport.h; disperse its contents to other header files.Kevin O'Connor1-1/+2
Move the inb(), insb(), etc. code from ioport.h to x86.h. Move the PORT_* definitions to their appropriate hardware files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Move standard bda type info from biosvar.h to std/bda.h.Kevin O'Connor1-1/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor1-4/+5
Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Move malloc code from pmm.c to new files malloc.c and malloc.h.Kevin O'Connor1-0/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Rename util.c to string.c and introduce string.h.Kevin O'Connor1-1/+2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-02Move code centered around specific hardware devices to src/hw/Kevin O'Connor1-1/+1
Move many C files from the src/ directory to the new src/hw/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-07-14PIC code cleanups.Kevin O'Connor1-2/+2
Preface PIC functions with a pic_ to provide a more consistent naming. Convert the irqmask code to a more consistent pic_irqmask_read/write/mask form. Move code from pic.h to pic.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-02-19Calculate "RamSize" needed by 16bit interface dynamically.Kevin O'Connor1-2/+2
Calculate a LegacyRamSize directly from the e820 map for use by handle_1588() and handle_15e801() (the only two external interfaces that require "RamSize"). All other users of the existing RamSize (and RamSizeOver4G) variables are specific to QEMU, so move the declarations to paravirt.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-02-18Convert VAR16VISIBLE, VAR16EXPORT, and VAR32VISIBLE to VARFSEG.Kevin O'Connor1-4/+0
Convert all users of the alternative variable exports to VARFSEG. There isn't a significant distinction between the existing types of exports, so it's simpler to just use one type going forward. The new VARFSEG declaration is only emitting when in 32bit mode, so update and move some variables as needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-05-30Make sure to set dependency to segment registers in inline asm.Kevin O'Connor1-3/+3
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2010-03-15Restore segment limits in handle_1589 code.Kevin O'Connor1-0/+5
Before transitioning back to real mode, the segment registers should be reloaded so that the hidden register limits are updated.
2010-01-04Minor - better indent assembler in int1587.Kevin O'Connor1-22/+20
2010-01-04Add int1589 support.Kevin O'Connor1-2/+44
Int1589 switches into protected mode for the caller. Also, consistently use BUILD_BIOS_ADDR/SIZE in GDT macros.
2009-12-13Distinguish between debug reports for unimplemented vs invalid calls.Kevin O'Connor1-5/+5
Don't use "fail" in the debug output - as this confuses users. When reporting on an invalid parameter - use the word "invalid". When reporting on an unimplemented call - state it is unimplemented. Add separate debug levels for unimplemented vs invalid calls. Also, increase the debug level of several entry points.
2009-10-24Replace irq_enable() regions with explicit calls to check for irqs.Kevin O'Connor1-1/+1
Add new function yield() which will permit irqs to trigger. The yield() call enables irqs to occur in 32bit mode. Add [num]sleep calls that yield instead of just spinning. Rename existing int 1586 usleep call to biosusleep. Convert many calls to mdelay to msleep.
2009-09-09Rename VAR16_32 to VAR16VISIBLE.Kevin O'Connor1-2/+2
Sometimes VAR16_32 is used to export a definition to assembler, so clarify its naming.
2009-08-10Add helper macros for defining GDT descriptors.Kevin O'Connor1-35/+15
2009-05-06Minor - verify e820 request is large enough to hold response.Kevin O'Connor1-1/+2
2009-01-19Implement memcpy_far and checksum_far, and replace _fl variants.Kevin O'Connor1-3/+3
The "flat" mode variants work in real mode, but will not work in protected mode. So, replace with versions that take explicit segments.
2009-01-19Rename MAKE_FARPTR (and similar) to MAKE_FLATPTR.Kevin O'Connor1-3/+3
The term "far pointer" is used in many 16bit specs, and it is different from what MAKE_FARPTR creates. So, use the term "flat pointer" in the code to distinguish between the two meanings. Also, use the suffix "_fl" consistently when working with "flat pointers".
2009-01-17Reserve space for buffers in f-segment; don't allocate from freespace.Kevin O'Connor1-4/+5
Define the e820list as a regular array. Define a buffer for run-time built bios tables. Reserving the space in advance should help prevent run-time errors when space becomes tight.
2009-01-17Move variables from assembler to C code.Kevin O'Connor1-67/+1
Define macro VAR16FIXED for declaring a variable at a fixed location. Introduce new file src/misc.c, and move non int15 calls from system.c to it. Implement all fixed location variables in C code. Move IDT/GDT defs to misc.c. Remove unused gdt entry 1.
2009-01-15Change license from GPLv3 to LGPLv3.Kevin O'Connor1-1/+1
Change license of contributions from Kevin O'Connor from GPLv3 to LGPLv3 (or later). Since the work as a whole is based on Kevin's contributions and the "bochs bios" which has a license of LGPL (v2 or later), this effectively makes the work as a whole available under LGPLv3 (or later).
2009-01-01Reduce stack usage of hw irq handlers.Kevin O'Connor1-3/+2
Avoid using call16_int() -- it consumes too much stack space. Instead, use a new function (call16_simpint). This assumes that the handler wont corrupt regs - which should be a safe assumption, because if they did corrupt regs they wouldn't work on any bios. Avoid enabling irqs in the hw irq handlers - there are no loops in the handlers that could cause any notable latency.
2008-12-29Introduce GET/SET_EBDA2() macros - they take a cached ebda seg.Kevin O'Connor1-1/+1
For those places that repeatedly read/write to the ebda, caching the ebda segment improves code generation.
2008-12-29Add more linker protections around variables accessed from 16bit mode.Kevin O'Connor1-4/+4
Rename VAR16 to VAR16_32 -- that macro supports accesses from both 16bit and 32bit mode. Introduce a new macro VAR16 that must be present on all global variables accessed from 16bit mode.
2008-12-28Move ram size definitions from ebda to global variables.Kevin O'Connor1-2/+6
2008-12-28Add linker magic to ensure 16bit variables aren't repeated in 32bit code.Kevin O'Connor1-4/+2
Add VAR16 macro to enable a variable to be available in both 32bit and 16bit code. This reduces the occurrences of "#if MODE16". Also add ASM16 macro to reduce occurrences of "#if MODE16".
2008-12-13Implement GET/SET_GLOBAL(...) instead of using GET/SET_VAR(CS, ...)Kevin O'Connor1-2/+2
2008-12-10Various minor comment updates.Kevin O'Connor1-1/+1
2008-11-26Enable a default hw irq handler.Kevin O'Connor1-2/+1
Also, only route hw irqs to their handlers when they are enabled. (This ensures that if a subsystem is disabled that the default hwirq handler will be used.) Add helper macros to declare the extern asm handlers. Always enable the RTC hwirq at startup (as opposed to when it is first used). Fix bug in default handler - wrong bit was used for checking the cascaded irq.
2008-11-16Define bit definitions for cr0 register.Kevin O'Connor1-4/+4
Define and consistently use names for the bits in the cr0 register.
2008-11-16Cleanup a20 code.Kevin O'Connor1-4/+4
Fix two apparent bugs - set_a20() returned new status instead of old status and handle_152402() checked wrong bit. Add bit definition for the a20 enable bit: A20_ENABLE_BIT Allow ioport.h #defines to be used in romlayout.S.
2008-11-08Update e820 map in place instead of copying it.Kevin O'Connor1-4/+10
Allocate the e820 map space in the 0xf0000 segment and do all updates in place. This reduces the need to access external memory during post. Also, move e820 pointer and count from ebda to variables in 0xf0000.
2008-08-29Rename memcpy() to memcpy_far() and add regular memcpy() code.Kevin O'Connor1-1/+1
2008-08-17Add stubs for VIA vga bios callbacks to system bios.Kevin O'Connor1-0/+1
The VIA vga bios likes wants to call int 15/5f of main bios. So, add stubs to make it happy.
2008-07-04Define 16bit OFFSET_x to be 32bit addresses; introduce CONFIG_BIOS_ADDR.Kevin O'Connor1-1/+1
The rom16.o object will now have absolute (32bit applicable) addresses. Replace several 0xf0000 and 0x10000 uses with CONFIG_BIOS_ADDR/SIZE macros.
2008-07-04Extract 'struct bregs' out of biosvar.h; clean up header includes.Kevin O'Connor1-0/+1
2008-06-14Cleanup handling of interrupt controller (PIC).Kevin O'Connor1-1/+12
Add new file (pic.h) with helpers for accessing the PIC. Move irq enabling code to the files that use those interrupts. Also, don't setup for floppy if floppy support not enabled.
2008-06-12Support config driven debugging of each irq handler.Kevin O'Connor1-7/+7
This allows one to easily enable verbose output from handlers.
2008-06-08Enhance e820 memory map generation.Kevin O'Connor1-58/+11
Build e820 maps at post time; just copy the pre-built ones at runtime. Add support for populating memory and map info from coreboot.
2008-06-07Introduce set_fail_silent() helpers.Kevin O'Connor1-2/+1
These functions are equivalent to set_fail() - but don't log an error.
2008-05-18Implement usleep using real time clock.Kevin O'Connor1-10/+0
The old usleep implementation relied on ps2 port refresh bit which is not very portable. This patch also refactors some of the code in clock.c.
2008-05-18Initial support for coreboot.Kevin O'Connor1-1/+0
Add new option for targetting a coreboot payload. When in coreboot mode, configure out those parts of the code that wont work on real hardware. Don't include cmos.h in files that don't need it.