Age | Commit message (Collapse) | Author | Files | Lines |
|
Move many C files from the src/ directory to the new src/hw/ directory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Rename the check_tsc() function to timer_check(). The CPU TSC is
often not the basis of the timer, so use a more appropriate name.
Convert all callers that were using u64 for the timers to use u32.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
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>
|
|
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>
|
|
The winxp boot loader does something curious - it sets an int 0x1c
handler, records the stack location, and then spins in place with irqs
enabled. The 0x1c handler alters the memory just past the stack
pointer so that when the timer irq returns the code jumps to a new
location and stop spinning. The winxp code relies on the fact that a
hw irq will always place 6 bytes at a specific location and that it
can alter those bytes.
The ecdc655a patch does a full backup/restore of the register state.
Unfortunately, the restore overwrites the changes made by the winxp
0x1c handler.
This patch reverts much of ecdc655a. Hardware irqs are still handled
on the extra stack, but only the essential register state is backed up
and restored.
Also, stack_hop_back is changed to only use %sp when changing states -
this enables the entry code to store just %esp instead of both %esp
and %sp.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Create a 'struct romfile_s' and populate a list of all romfiles at
start of init. Caching the romfiles both simplifies the code and
makes it more efficient.
Also, convert the ramdisk code to use romfile helpers instead of
directly accessing cbfs.
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>
|
|
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Looks like some old programs expect the keyboard irq to enable the
keyboard port at the end of the irq. This behavior was seen on an
image of "Concurrent DOS".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
Add PS2_KEYBOARD_SPINUP option to give certain keyboards more time to
initialize.
Based on report and feedback from: Sven Schnelle <svens@stackframe.org>
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.
|
|
Add several methods for rebooting a processor.
Detect a rerun of POST under coreboot and attempt to reboot the
processor.
|
|
|
|
|
|
Route keyboard commands to a USB handler when USB keyboard is active.
Add a GETID handler for USB keyboards.
|
|
Some old DOS programs will hook the keyboard irq, read the keyboard
data on irq, and then call the BIOS handler expecting it to continue
process the event. So, the BIOS can't assume it is the first to read
the data from the ps2 port.
Also, reduce window where a ps2 command could conflict with incoming
data. Disable all data during interrupt flushing, and only re-enable
the desired port just prior to sending the command.
Also, discard data from any interrupts if init hasn't completed.
|
|
This reverts commit 84f7b801ba8c0806fac568e59e85af281c0df207.
It's not possible to unify ps2 port irq processing because old DOS
apps could hook one or both of the kbd/mouse ps2 irqs.
|
|
Sometimes GETID returns two bytes, and sometimes one byte. Handle
that properly.
This fixes a failure with an msdos mouse driver.
|
|
This is an alternate to 6f702dd6987b22e9bce472fe61910392af17416a.
After disabling ps2 irqs, enable irqs to flush any queued irqs. This
should prevent irqs from triggering in the middle of the init process.
|
|
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.
|
|
Instead of passing the "u32 endp" encoding of the usb endpoint,
allocate a "struct usb_pipe" for each end point and pass that.
Allocate a control pipe for every device found. Support freeing the
pipes after they are done.
Implement pipe allocation and freeing for both UHCI and OHCI
controllers.
Also, don't define every UHCI qh to include a pipe - create a separate
structure "struct uhci_pipe". Also, be sure to clear the
USBControllers on reset. Also, convert usb_hub_init to return 0 on
success. Also, cleanup some of the USB debug messages to make them
more consistent.
|
|
There is no need for custom warnings for many common failures.
Introduce a common warning which is consistent and more visible.
|
|
The function pointer passed to run_thread() can confuse the compiler
into thinking the function needs to be emitted. Add ASSERT32FLAT() to
help the compiler eliminate this code.
|
|
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.
|
|
Unify the code for mouse and keyboard irq handling.
Support case where mouse irq fires but keyboard data present and
vice-versa.
Support data in i8042 queue while ps2 command being processed.
|
|
|
|
Fail the command on a nak - don't ignore it.
|
|
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.
|
|
Handle case where timetamp counter overflows while waiting.
|
|
For now, just ignore the nak.
|
|
Reset the RTC registers at boot time.
Add definitions for the RTC register bits and use consistently.
Don't use CMOS_CENTURY value on coreboot.
Minor - when waiting on the TSC wait until counter is greater than
desired value (not greater than or equal).
|
|
Separate out reset code - it has special timeouts throughout.
|
|
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.
|
|
|
|
The pnp bios string can't be const and VAR16_32.
Show ps2 port status when discarding data.
|
|
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.
|
|
The ps2_command() function had a cut-and-paste error.
Also, add some additional debugging functions to ps2 port code.
|
|
Calibrate the timestamp-counter using the PIT timer2 mechanism.
Implement ndelay/udelay/mdelay using tsc.
Remove obsolete sleeping mechanisms.
|
|
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.
|
|
Use command sending code for communicating with the ps2 port.
|