summaryrefslogtreecommitdiff
path: root/src/mouse.c
Commit message (Collapse)AuthorAgeFilesLines
* stacks: Use macro wrappers for call32() and stack_hop_back()Kevin O'Connor2015-10-151-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>
* Update stack_hop_back() to jump to 16bit mode if called in 32bit mode.Kevin O'Connor2014-09-301-2/+6
| | | | | | Also, update callers to rely on this feature. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Update invoke_mouse_handler() to use need_hop_back()Kevin O'Connor2014-09-301-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>
* Revert "Use the extra stack for 16bit USB and PS2 keyboard/mouse commands."Kevin O'Connor2014-09-301-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>
* Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor2013-09-181-1/+2
| | | | | | Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move stacks.c definitions from util.h to new file stacks.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move code centered around specific hardware devices to src/hw/Kevin O'Connor2013-09-021-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>
* Normalize POST initialization function name suffixes.Kevin O'Connor2013-02-051-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>
* Minor - remove CLEARBITS_BDA and SETBITS_BDA macros.Kevin O'Connor2012-06-101-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>
* Remove "noinline" declarations from keyboard/mouse driver code.Kevin O'Connor2012-05-301-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>
* Use the extra stack for 16bit USB and PS2 keyboard/mouse commands.Kevin O'Connor2012-05-301-3/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Run all hardware irq handlers on the extra stack.Kevin O'Connor2012-05-301-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>
* EBDA cleanups.Kevin O'Connor2012-05-201-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>
* Move ps2ctr manipulation from mouse.c to ps2port.c.Kevin O'Connor2011-05-071-21/+3
| | | | | This simplifies the mouse.c code. It also prevents USB mouse interaction from changing the ps2 port setup.
* Add support for USB mice.Kevin O'Connor2010-05-011-0/+3
| | | | Initial support for USB mice that follow the "boot" protocol.
* When USB keyboard active, don't send keyboard commands to ps2 port.Kevin O'Connor2010-05-011-10/+16
| | | | | | Route keyboard commands to a USB handler when USB keyboard is active. Add a GETID handler for USB keyboards.
* Backup and restore registers when calling out to user funcs.Kevin O'Connor2010-03-131-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().
* Revert "Rework disabling of ps2 port irqs."Kevin O'Connor2010-03-131-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.
* Support USB keyboard auto-repeat.Kevin O'Connor2010-02-111-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.
* Rework disabling of ps2 port irqs.Kevin O'Connor2010-01-281-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.
* Be sure to add "void" to all function prototypes that take no args.Kevin O'Connor2010-01-031-1/+1
| | | | Omitting "void" leads to a K&R style declaration which was not intended.
* Distinguish between debug reports for unimplemented vs invalid calls.Kevin O'Connor2009-12-131-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.
* Move ps2 specific keyboard and mouse code to ps2port.c.Kevin O'Connor2009-12-091-26/+6
|
* Replace irq_enable() regions with explicit calls to check for irqs.Kevin O'Connor2009-10-241-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.
* Replace common segment/offset pairs with struct segoff_s.Kevin O'Connor2009-09-091-4/+4
| | | | Introduce 'struct segoff_s' to more places.
* Consistently disable irqs at start of each assembler entry point.Kevin O'Connor2009-03-011-2/+4
| | | | | Always disable irqs at start of each entry point. Be consistent with clearing direction flag after disabling interrupts.
* Cleanup keyboard reset handling.Kevin O'Connor2009-01-171-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.
* Change license from GPLv3 to LGPLv3.Kevin O'Connor2009-01-151-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).
* Make sure ps2 port command reads are from the desired device.Kevin O'Connor2009-01-041-11/+12
| | | | | Discard reads from real-time events or from a different device. Also, improve the kbd/mouse diagnostic messages.
* Reduce stack usage of hw irq handlers.Kevin O'Connor2009-01-011-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.
* Introduce GET/SET_EBDA2() macros - they take a cached ebda seg.Kevin O'Connor2008-12-291-22/+27
| | | | | For those places that repeatedly read/write to the ebda, caching the ebda segment improves code generation.
* Implement GET/SET_GLOBAL(...) instead of using GET/SET_VAR(CS, ...)Kevin O'Connor2008-12-131-1/+1
|
* Enable a default hw irq handler.Kevin O'Connor2008-11-261-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.
* Misc minor improvements.Kevin O'Connor2008-08-171-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.
* Support ps2 port RESET commands that respond with 1 or 2 bytes.Kevin O'Connor2008-07-211-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.
* Add additional config options to remove parts of code.Kevin O'Connor2008-07-211-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.
* Rewrite ps2 port (keyboard/mouse) handling.Kevin O'Connor2008-07-201-173/+83
| | | | Use command sending code for communicating with the ps2 port.
* Misc fixes and updates.Kevin O'Connor2008-07-191-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.
* Extract 'struct bregs' out of biosvar.h; clean up header includes.Kevin O'Connor2008-07-041-1/+2
|
* Improve some debugging output.Kevin O'Connor2008-06-281-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.
* Cleanup handling of interrupt controller (PIC).Kevin O'Connor2008-06-141-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.
* Support config driven debugging of each irq handler.Kevin O'Connor2008-06-121-2/+2
| | | | This allows one to easily enable verbose output from handlers.
* Don't save/restore flags and ebp on external calls - saves on stack space.Kevin O'Connor2008-03-111-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.
* Reduce stack usage for ISRs; minor fixes.Kevin O'Connor2008-03-111-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.
* Replace debug_exit calls with debug info while setting a failure.Kevin O'Connor2008-03-091-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.
* Rename VISIBLE macro for better control.Kevin O'Connor2008-03-051-1/+1
| | | | | VISIBLE16 is used to mark functions externally available in 16bit code. VISIBLE32 is for 32bit functions.
* Bug fixes; get mouse working.Kevin O'Connor2008-03-021-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.
* Initial support for ps/2 mouse.Kevin O'Connor2008-03-021-8/+398
| | | | The code doesn't work, but most things are present.
* Version 0.1.2rel-0.1.2Kevin O'Connor2008-02-251-0/+2
|
* Version 0.1.1rel-0.1.1Kevin O'Connor2008-02-251-0/+35