... via "%X" format string.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20200930111222.6020-2-kraxel@redhat.com
It is not necessary to call the vgabios if no vgabios has been
installed. This reduces the amount of hardware accesses on qemu when
the bios is not initializing the display hardware, and it can reduce
the boot time by a couple of milliseconds.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Split pci.c into pci.c and pcidevice.c. The low-level code that
interacts directly with the PCI devices remains in pci.c, while
functions dealing with the higher level pci_device cache move to
pcidevice.c. Only pci.c is needed in 16bit mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Handle '%pP' format descriptions as a pointer to a 'struct pci_device'
and display it in bus:device.function (%02x:%02x.%x) format.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Set the color attribute in case the SeaBIOS console code is used while
the vgabios is in a graphics mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Introduce debug_banner() and use it in all the places SeaBIOS version
is displayed for debugging purposes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The serial_debug_preinit() function disables serial interrupts so that
the OS doesn't get confused by "transmit buffer empty" interrupts
caused when seabios writes to the serial port. It's unnecessary
paranoia to keep rechecking that interrupts are disabled.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Avoid hardware specific code in output.c. This will reduce the amount
of change needed to output.c as support for more serial hardware is
added.
This patch also renames some functions to improve the naming scheme.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
Add support for logging to the coreboot cbmem console.
Limitation: only supported in 32bit mode. Use 'cbmem -c'
to see the logs (coreboot and seabios) after bootup.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Make DEBUG_IO depend on QEMU_HARDWARE instead of QEMU, so
it can be enabled for seabios builds running indirectly
(coreboot, csm) on qemu.
Add runtime check for PF_QEMU to debug port console to make
sure we don't poke on random ports on physical hardware.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
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>
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>
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>
Introduce CONFIG_DEBUG_IO_PORT config option which allow user
to choose on which port to send debug on at configure time.
Bochs users are likely to use 0x402 (default) for debugging purposes,
whereas Xen uses 0xe9, as IO port address.
Signed-off-by: Julian Pidancet <julian.pidancet@citrix.com>
debug_serial() was doing a full flush while debug_serial_flush() was
only doing a partial flush. Fix that.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The description field is only available during the POST phase - it is
confusing to have it live in a structure available through all phases.
The description was only used by the boot menu code - pass each drive
description directly to the bootlist code.
Add a helper (znprintf) to automatically malloc_tmp the required
space.
Also, fixup ramdisk handling - it was using an incorrect floppy
priority.
Fix bvprintf to respect space padding when printing hex numbers
and the caller specifies alignment without zero padding, eg. %2x
as opposed to %02x
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Create a new code blob (code32seg) with support for 32bit functions
that need to utilize explicit segment accesses.
This code blob uses global variables relative to %gs and with a
dynamic code offset (determined by get_global_offset()).
Add BIOS32 structure and code.
Add code for 32bit PCI BIOS code.
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.
The 16bit and 32bit code can't share debuginfo because it points to
code and must point to 16bit code in 16bit mode. Introduce two
separate variables - one for 32bit mode and one for 16bit mode.
This adds preliminary support for USB controllers and keyboards.
Add support for UHCI controllers.
Add support for "HID" USB keyboards.
Also, fix bug in hexdump() - len need not be power of 4.