aboutsummaryrefslogtreecommitdiff
path: root/src/mouse.c
AgeCommit message (Collapse)AuthorFilesLines
2015-10-15stacks: Use macro wrappers for call32() and stack_hop_back()Kevin O'Connor1-2/+1
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>
2014-09-30Update stack_hop_back() to jump to 16bit mode if called in 32bit mode.Kevin O'Connor1-2/+6
Also, update callers to rely on this feature. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-09-30Update invoke_mouse_handler() to use need_hop_back()Kevin O'Connor1-2/+7
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>
2014-09-30Revert "Use the extra stack for 16bit USB and PS2 keyboard/mouse commands."Kevin O'Connor1-3/+3
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>
2013-09-18Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor1-1/+2
Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Move stacks.c definitions from util.h to new file stacks.h.Kevin O'Connor1-0/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-02Move code centered around specific hardware devices to src/hw/Kevin O'Connor1-2/+2
Move many C files from the src/ directory to the new src/hw/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-02-05Normalize POST initialization function name suffixes.Kevin O'Connor1-1/+1
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>
2012-06-10Minor - remove CLEARBITS_BDA and SETBITS_BDA macros.Kevin O'Connor1-1/+1
Remove these infrequently used macros and replace with explicit GET_BDA/SET_BDA calls. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-05-30Remove "noinline" declarations from keyboard/mouse driver code.Kevin O'Connor1-1/+1
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>
2012-05-30Use the extra stack for 16bit USB and PS2 keyboard/mouse commands.Kevin O'Connor1-3/+3
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-05-30Run all hardware irq handlers on the extra stack.Kevin O'Connor1-26/+31
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>
2012-05-20EBDA cleanups.Kevin O'Connor1-15/+16
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>
2011-05-07Move ps2ctr manipulation from mouse.c to ps2port.c.Kevin O'Connor1-21/+3
This simplifies the mouse.c code. It also prevents USB mouse interaction from changing the ps2 port setup.
2010-05-01Add support for USB mice.Kevin O'Connor1-0/+3
Initial support for USB mice that follow the "boot" protocol.
2010-05-01When USB keyboard active, don't send keyboard commands to ps2 port.Kevin O'Connor1-10/+16
Route keyboard commands to a USB handler when USB keyboard is active. Add a GETID handler for USB keyboards.
2010-03-13Backup and restore registers when calling out to user funcs.Kevin O'Connor1-4/+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-03-13Revert "Rework disabling of ps2 port irqs."Kevin O'Connor1-4/+16
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.
2010-02-11Support USB keyboard auto-repeat.Kevin O'Connor1-1/+1
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.
2010-01-28Rework disabling of ps2 port irqs.Kevin O'Connor1-16/+4
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.
2010-01-03Be sure to add "void" to all function prototypes that take no args.Kevin O'Connor1-1/+1
Omitting "void" leads to a K&R style declaration which was not intended.
2009-12-13Distinguish between debug reports for unimplemented vs invalid calls.Kevin O'Connor1-17/+17
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-12-09Move ps2 specific keyboard and mouse code to ps2port.c.Kevin O'Connor1-26/+6
2009-10-24Replace irq_enable() regions with explicit calls to check for irqs.Kevin O'Connor1-2/+0
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-09Replace common segment/offset pairs with struct segoff_s.Kevin O'Connor1-4/+4
Introduce 'struct segoff_s' to more places.
2009-03-01Consistently disable irqs at start of each assembler entry point.Kevin O'Connor1-2/+4
Always disable irqs at start of each entry point. Be consistent with clearing direction flag after disabling interrupts.
2009-01-17Cleanup keyboard reset handling.Kevin O'Connor1-1/+1
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.
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-04Make sure ps2 port command reads are from the desired device.Kevin O'Connor1-11/+12
Discard reads from real-time events or from a different device. Also, improve the kbd/mouse diagnostic messages.
2009-01-01Reduce stack usage of hw irq handlers.Kevin O'Connor1-4/+5
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-22/+27
For those places that repeatedly read/write to the ebda, caching the ebda segment improves code generation.
2008-12-13Implement GET/SET_GLOBAL(...) instead of using GET/SET_VAR(CS, ...)Kevin O'Connor1-1/+1
2008-11-26Enable a default hw irq handler.Kevin O'Connor1-3/+2
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-08-17Misc minor improvements.Kevin O'Connor1-1/+1
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.
2008-07-21Support ps2 port RESET commands that respond with 1 or 2 bytes.Kevin O'Connor1-1/+1
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.
2008-07-21Add additional config options to remove parts of code.Kevin O'Connor1-0/+3
Added options CONFIG_BOOT, CONFIG_SERIAL, CONFIG_LPT, CONFIG_KEYBOARD, CONFIG_BOOTMENU. Also extended coverage of existing options to ensure full code got removed.
2008-07-20Rewrite ps2 port (keyboard/mouse) handling.Kevin O'Connor1-173/+83
Use command sending code for communicating with the ps2 port.
2008-07-19Misc fixes and updates.Kevin O'Connor1-4/+2
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.
2008-07-04Extract 'struct bregs' out of biosvar.h; clean up header includes.Kevin O'Connor1-1/+2
2008-06-28Improve some debugging output.Kevin O'Connor1-3/+0
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.
2008-06-14Cleanup handling of interrupt controller (PIC).Kevin O'Connor1-1/+14
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-2/+2
This allows one to easily enable verbose output from handlers.
2008-03-11Don't save/restore flags and ebp on external calls - saves on stack space.Kevin O'Connor1-5/+2
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.
2008-03-11Reduce stack usage for ISRs; minor fixes.Kevin O'Connor1-2/+5
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.
2008-03-09Replace debug_exit calls with debug info while setting a failure.Kevin O'Connor1-19/+19
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.
2008-03-05Rename VISIBLE macro for better control.Kevin O'Connor1-1/+1
VISIBLE16 is used to mark functions externally available in 16bit code. VISIBLE32 is for 32bit functions.
2008-03-02Bug fixes; get mouse working.Kevin O'Connor1-4/+2
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.
2008-03-02Initial support for ps/2 mouse.Kevin O'Connor1-8/+398
The code doesn't work, but most things are present.
2008-02-25Version 0.1.2rel-0.1.2Kevin O'Connor1-0/+2
2008-02-25Version 0.1.1rel-0.1.1Kevin O'Connor1-0/+35