| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
The C code only uses _cfuncX_ prefixes for parameters to the call32(),
stack_hop_back(), and call32_params() functions. It's simpler to use
macro wrappers around those functions which provide the required
prefix.
This also changes the parameter order of stack_hop() and
stack_hop_back() to use the more natural (func, params) ordering.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
| |
Also, update callers to rely on this feature.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
| |
Make the mouse handler stack_hop_back() code similar to the other
users that use need_stack_hop().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's not valid to pass a pointer to a stack variable through the
stack_hop() call (because the call changes the stack segment). This
bug was probably not noticed before because by default
(CONFIG_ENTRY_EXTRASTACK) SeaBIOS uses the extra stack on all 16bit
entry points, and the internal stack_hop() with that config option is
effectively a no-op.
This reverts commit d488a7683d90bf8fae7ceb8c3ad9e95fbbd92079.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
| |
Also, sort the order of include files in the c files.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
| |
Move many C files from the src/ directory to the new src/hw/ directory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The POST phase has to invoke many initialization functions, and these
functions can have complex inter-dependencies. Try to categorize the
functions into 4 classes:
preinit - functions called very early in POST where function ordering
is very important and the code has limited access to other
interfaces.
init - functions that initialize internal interfaces and standard
external interfaces. This code is generally not dependent on
particular hardware and typically does not communicate directly
with any hardware devices.
setup - functions which access hardware or are dependent on particular
hardware or platform devices.
prepboot - functions that finalize internal interfaces and that
prepare for the boot phase.
This patch attempts to normalize the suffixes - functions that used
_init(), _setup(), _finalize(), or similar that did not follow the
above pattern were renamed. Other than function name changes, there
should be no code impact to this patch.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
| |
Remove these infrequently used macros and replace with explicit
GET_BDA/SET_BDA calls.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
| |
Now that the extra stack is used for keyboard and mouse driver code,
there is no reason to set noinline (which was done to try and conserve
stack space).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Jump into the extra stack for all hardware irq handlers. This reduces
the overall stack requirements of SeaBIOS.
Replace all users of call16_simpint with call16_int. Only the
hardware irq handlers used the old call, and they need to use the new
call to ensure the extra stack is properly re-entrant.
Also, pass in a 'struct bregs' to the hardware irq handlers now. It
was not done previously to save stack space. Now that the extra stack
is used, that is no longer an issue.
Note that should an old OS invoke a hardware irq in 16bit protected
mode, then this patch could break that OS. However, the chances of
this causing a regression seem small as several existing hardware irq
handlers already do not work in 16bit protected mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
| |
Clean up includes of biosvar.h.
Rename GET/SET_EBDA2 to GET/SET_EBDA - nearly all users use the
extended form now anyway.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
| |
This simplifies the mouse.c code. It also prevents USB mouse
interaction from changing the ps2 port setup.
|
|
|
|
| |
Initial support for USB mice that follow the "boot" protocol.
|
|
|
|
|
|
| |
Route keyboard commands to a USB handler when USB keyboard is active.
Add a GETID handler for USB keyboards.
|
|
|
|
|
|
|
|
| |
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().
|
|
|
|
|
|
|
|
|
| |
This reverts commit 6f702dd6987b22e9bce472fe61910392af17416a.
That patch introduced a regression by enabling mouse interrupts by
default. It also appears that disabling interrupts by software alone
will not work well with some old DOS programs that hook the keyboard
irq.
|
|
|
|
|
|
| |
Support handling of multiple keys pressed simultanously.
Support auto-repeat via USB HID Set_Idle command.
Also, add "noinline" directives to reduce stack usage of timer irq.
|
|
|
|
|
|
| |
Disable the ps2 port irqs in software instead of hardware. This
prevents a race where an irq could get queued and later called when
not desired.
|
|
|
|
| |
Omitting "void" leads to a K&R style declaration which was not intended.
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Introduce 'struct segoff_s' to more places.
|
|
|
|
|
| |
Always disable irqs at start of each entry point.
Be consistent with clearing direction flag after disabling interrupts.
|
|
|
|
|
|
|
| |
Use custom timeouts when issuing a reset.
Handle 1-byte returns from reset in ps2 code.
Do full keyboard reset even in coreboot mode.
Send set scan mode command during reset.
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
| |
Discard reads from real-time events or from a different device.
Also, improve the kbd/mouse diagnostic messages.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
For those places that repeatedly read/write to the ebda, caching the
ebda segment improves code generation.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
Update TODO list.
Improve comments in boot.c.
Use debug port 0x0402 instead of 0x0403 (bochs prefers the latter).
Fix formatting of debug messages in kbd.c.
Use proper return check for kbd and mouse init.
|
|
|
|
|
|
| |
Some devices only respond with 1 byte - if they timeout reading the
second byte, don't fail the whole operation - just continue and
handle the 1 byte.
|
|
|
|
|
|
|
| |
Added options CONFIG_BOOT, CONFIG_SERIAL, CONFIG_LPT, CONFIG_KEYBOARD,
CONFIG_BOOTMENU.
Also extended coverage of existing options to ensure full code got
removed.
|
|
|
|
| |
Use command sending code for communicating with the ps2 port.
|
|
|
|
|
|
|
|
| |
Minor code cleanups.
Fix parenthesis imbalance in keyboard led test.
The printf() call is only used in 32bit mode - make this explicit to
the compiler - it improves the code generation.
Clear the screen after initializing the vga option rom.
|
| |
|
|
|
|
|
|
| |
Replace DEBUGF calls with dprintf calls.
Make ata calls consistently use 'int' return codes.
Make each error return code in ata.c use a unique negative number.
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
This allows one to easily enable verbose output from handlers.
|
|
|
|
|
| |
It isn't necessary to save ebp - just mark it as clobbered.
The only important flag to save/restore is irqs - manually fixup all callers.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Don't back up all registers on isr handlers - they don't read/modify
them. This saves stack space.
extended_bios_data_area_s must be packed to match ebda spec.
Enable irqs on int 08 - follows old bochs bios code.
Fix bug in int 76 -- should clear disk_interrupt_flag not
floppy_harddisk_info.
Make sure we alert in disk_ret on failure case.
int 18/19 entry points need to setup cld/%ds too.
asm in handle_1587 clobbers flags - note that in clobber list.
|
|
|
|
|
|
| |
Calling debug_exit at the end of a call doesn't help much - several of
the registers are already clobbered at this point. It also increases
stack usage because it prevents call tail optimization in many places.
|
|
|
|
|
| |
VISIBLE16 is used to mark functions externally available in 16bit code.
VISIBLE32 is for 32bit functions.
|
|
|
|
|
|
|
|
|
| |
Fix bug in post causing PIC2 to not be initialized properly.
Only run ata_detect if CONFIG_ATA enabled.
Improve debugging aids - introduce debug_isr(); move DEBUGF to each file.
Enable mouse by default.
Fix bug in floppy causing extra test of PORT_FD_STATUS on recalibrate.
Always disable/enable kbd in handle_09 event.
|
|
|
|
| |
The code doesn't work, but most things are present.
|
| |
|
|
|