Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UEFI boot #471

Open
fysnet opened this issue Feb 1, 2025 · 3 comments
Open

UEFI boot #471

fysnet opened this issue Feb 1, 2025 · 3 comments

Comments

@fysnet
Copy link
Collaborator

fysnet commented Feb 1, 2025

There might be something wrong with the UEFI emulation.

Here is a test situation.

Get the latest UEFI from https://www.kraxel.org/repos/jenkins/edk2/.
I use OVMF-pure-efi.fd from the x64 version. Also extract UefiSheel.iso from that same rpm

Now try to boot the ISO. Here is a demo bochrc.txt file. Note that ata1: is disabled...

display_library: win32, options="gui_debug:globalini" # use Win32 debugger gui
romimage: file="OVMF-pure-efi.fd", address=0x0, options=none
config_interface: win32config
cpu: model=tigerlake
cpu: count=1, ips=750000000, reset_on_triple_fault=1, ignore_bad_msrs=1
cpu: cpuid_limit_winnt=0
memory: guest=1024, host=1024
vgaromimage: file=VGABIOS-lgpl-latest-cirrus.bin
vga: extension=cirrus, update_freq=10
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata1: enabled=0, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata2: enabled=0, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11
ata3: enabled=0, ioaddr1=0x168, ioaddr2=0x360, irq=9
ata0-master: type=cdrom, path=UefiShell.iso, status=inserted, model="UefiShell.iso"
boot: cdrom
clock: sync=both, time0=local
floppy_bootsig_check: disabled=0
log: log.txt
panic: action=ask
error: action=report, cpu0=ignore
info: action=report, cpu0=ignore
debug: action=ignore
parport1: enabled=1, file="parport.out"
mouse: enabled=0, type=imps2
private_colormap: enabled=0
pci: enabled=1, chipset=i440fx, slot1=cirrus
magic_break: enabled=1 cx
print_timestamps: enabled=0
com1: enabled=1, mode=file, dev=serial1.txt

It hangs. However, if you make the following change:

-    ata1: enabled=0, ioaddr1=0x170, ioaddr2=0x370, irq=15
+    ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15

It boots to the Shell as expected.

Go back to the hang and look at the serial out:

HBdsDxe: failed to load Boot0001 "UEFI image.iso BXCD00001 " from PciRoot(0x0)/Pci(0x1,0x1)/Ata(Primary,Slave,0x0): Not Found

It can't open the file.

I can confirm that it finds, loads, and boots fine from an HDD image.

Since this is the case, and QEMU (using the same efi image) finds and loads the ISO image, there must be something different with Bochs' ATA emulation when UEFI is loaded.

.
.
.

On a side note, the emulation also has the following complaint.

PAE: asked to set dirty on paging leaf entry with R/W bit clear

Using the OVMF_CODE-need-smm.fd file does not have the same complaint.

@fysnet
Copy link
Collaborator Author

fysnet commented Feb 1, 2025

P.S. If you have a valid UEFI bootable HDD on ata0-master and an ISO on ata0-slave: and tell it to boot: cdrom, it still boots the HDD.

@Vort
Copy link
Contributor

Vort commented Feb 1, 2025

I noticed problems with disk emulation in Bochs in the past as well.
However, in this particular case, it is not clear if problem is on Bochs side or on OVMF side.
They may just not support this particular configuration (ata1 disabled).

@fysnet
Copy link
Collaborator Author

fysnet commented Feb 2, 2025

Note that ata1: is disabled...It hangs. However, if you make the following change:
... enable ata1 ...
It boots to the Shell as expected.

I think this is an error in OVMF, not Bochs. OVMF sends the Execute Device Diagnostic (0x90) command to ata1, then reads back the Status Register (0x177). If this register is not 0x00, it hangs for some reason.

I made a little test to return 0xFF on all reads from ata1 (0x170 -> 0x177) except for 0x177 which returns 0x00 and the OVMF booted as expected when ATA1 is disabled.

I did not look at the second issue I noted.

PAE: asked to set dirty on paging leaf entry with R/W bit clear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants