Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#13528 closed bug (duplicate)

Early bios call in bootloader cause reboot on skylake x86_64

Reported by: kallisti5 Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/Boot Loader Version: R1/Development
Keywords: Cc:
Blocked By: #11019 Blocking:
Platform: All

Description (last modified by kallisti5)

Intel Sky lake Celeron 3855U

AHCI Internal SSD:

options = 0
No APM available.
smp: using ACPI to detect MP configuration
smp: local apic address is 0xfee00000
smp: found local APIC with id 0
smp: found local APIC with id 2
smp: found io APIC with id 2 and address 0xfec00000
VESA version = 3.0, capabilities 1
OEM string: Intel(R) SKL Mobile/Desktop Graphics Chipset Accelerated VGA BIOS
.
.
 0x118: 1024 x 768 x 32 (a = 155, mem = 6, phy = c0000000, p = 1, b = 1)
        mask: r: 8 16 g: 8 8 b: 8 0 dcmi: 0
.
.
Using mode 0x118
VESA compatible graphics!
EDID1: 4f
EDID2: ebx 102
EDID3: 4f
Vendor: ACR
Product ID: 422
Serial #: 571535284
Produced in week/year: 21/2012
EDID version: 1.3
Type: Digital
Size: 51 cm x 29 cm
Gamma=2.2
White (X,Y)=(0.313,0.329)
Supported Future Video Modes:
1280x720@60Hz (id=49281)
1280x960@60Hz (id=16513)
1152x864@75Hz (id=20337)
1280x1024@60Hz (id=32897)
1280x1280@60Hz (id=129)
1920x1080@60Hz (id=49361)
Supported VESA Video Modes:
720x400@70Hz
640x480@60Hz
640x480@67Hz
640x480@72Hz
640x480@75Hz
800x600@56Hz
800x600@60Hz
800x600@72Hz
800x600@75Hz
832x624@75Hz
1024x768@60Hz
1024x768@70Hz
1024x768@75Hz
1280x1024@75Hz
1152x870@75Hz
Additional Video Mode (1920x1080@60Hz):
clock=148.5 MHz
h: (1920, 2008, 2052, 2200)
v: (1080, 1084, 1089, 1125)
size: 51 cm x 28.699 cm
border: 0 cm x 0 cm
Horizontal frequency range = 30..80 kHz
Vertical frequency range = 50..75 Hz
Maximum pixel clock = 160 MHz
Serial Number: LNZ080024237
Monitor Name: Acer S231HL
crtc: h 2008/2052/2200, v 1084/1089/1125, pixel clock 148500000, refresh 6026
Welcome to the Haiku boot loader!
number of drives: 1
add_partitions_for(0x00105360, mountFS = no)
add_partitions_for(fd = 0, mountFS = no)
0x001054c8 Partition::Partition
0x001054c8 Partition::Scan()
check for partitioning_system: GUID Partition Map
<reboot>

Change History (8)

comment:1 by kallisti5, 8 years ago

Description: modified (diff)
Summary: Instant reboot of BIOS bootloaderEarly bios call in bootloader cause reboot on skylake x86_64

BIOS reads 512 bytes from 0 (offset = 0), drive 129

After much tracing, the bootloader seems to be hanging up here: http://cgit.haiku-os.org/haiku/tree/src/system/boot/platform/bios_ia32/devices.cpp#n546

  • is_drive_readable
  • drive->ReadAt
  • BIOSDrive::ReadAt
  • while blocksLeft > 0
    • if fLBA
      • call_bios(0x13, &regs);
        • reboot

So... something is up with: src/system/boot/platform/bios_ia32/bios.cpp

comment:2 by kallisti5, 8 years ago

a little deeper. The lockup doesn't happen until after we jump into the bios call assembly:

http://cgit.haiku-os.org/haiku/tree/src/system/boot/platform/bios_ia32/bios_asm.S#n161

I get the feeling maybe it is something not 64-bit safe in that assembly? EDIT: Nope. Happens on x86 and x86_64 builds of Haiku.

Last edited 8 years ago by kallisti5 (previous) (diff)

comment:3 by axeld, 8 years ago

You could try some no-op BIOS call first, and see how that fares. Otherwise, since it works on pretty much everything else out there, it's likely to be a memory layout related issue.

comment:4 by pulkomandy, 8 years ago

IIRC we investigated a possibly similar issue with Ithamar on his MacBook during some BeGeistert coding sprint. This was quite a long time ago, but I remember we had traced it down to an usual way to handle segment:offset addressing while calling the BIOS (yay, segmented memory!)

Basically, the BIOS expects to be called at 0800:0000, but we were calling it at 0000:8000, which results in the same physical address (because segments overlap) but may confuse some BIOS implementations.

There is nothing 64-bit related at this early stage of boot. This code runs with the CPU in real mode, compatible with Intel's 286.

comment:5 by kallisti5, 8 years ago

Added some bios call debugging:

Additional Video Mode (1920x1080@60Hz):
clock=148.5 MHz
h: (1920, 2008, 2052, 2200)
v: (1080, 1084, 1089, 1125)
size: 51 cm x 28.699 cm
border: 0 cm x 0 cm
Horizontal frequency range = 30..80 kHz
Vertical frequency range = 50..75 Hz
Maximum pixel clock = 160 MHz
Serial Number: LNZ080024237
Monitor Name: Acer S231HL
crtc: h 2008/2052/2200, v 1084/1089/1125, pixel clock 148500000, refresh 6026
Welcome to the Haiku boot loader!
boot drive ID: 80
drive ID 128
BIOS(13h): Restore BIOS IDT
BIOS(13h): eax: 0x4100, ebx: 0x55aa, ecx: 0x13fca0, edx: 0x80, esi: 0x0, edi: 0x0, es: 0x0, flags: 0x0
BIOS(13h): Set debug BIOS IDT
checking extensions: carry: 0; ebx: 0x0000aa55; ecx: 0x00130005
BIOS(13h): Restore BIOS IDT
BIOS(13h): eax: 0x4800, ebx: 0xaa55, ecx: 0x130005, edx: 0x80, esi: 0x20, edi: 0x0, es: 0x0, flags: 0x286
BIOS(13h): Set debug BIOS IDT
size: 1e
drive_path_signature: 0
host bus: "", interface: ""
cylinders: 942, heads: 255, sectors: 63, bytes_per_sector: 512
total sectors: 15133248
BIOS(13h): Restore BIOS IDT
BIOS(13h): eax: 0x800, ebx: 0x0, ecx: 0x2960000, edx: 0x80, esi: 0x5daec, edi: 0x0, es: 0x0, flags: 0x10
BIOS(13h): Set debug BIOS IDT
number of drives: 2
drive ID 129
BIOS(13h): Restore BIOS IDT
BIOS(13h): eax: 0x4100, ebx: 0x55aa, ecx: 0x13fbe0, edx: 0x81, esi: 0xfc79, edi: 0x0, es: 0x0, flags: 0x0
BIOS(13h): Set debug BIOS IDT
checking extensions: carry: 0; ebx: 0x0000aa55; ecx: 0x00130001
BIOS(13h): Restore BIOS IDT
BIOS(13h): eax: 0x4800, ebx: 0xaa55, ecx: 0x130001, edx: 0x81, esi: 0x20, edi: 0x0, es: 0x0, flags: 0x246
BIOS(13h): Set debug BIOS IDT
size: 1e
drive_path_signature: 0
host bus: "", interface: ""
cylinders: 16383, heads: 16, sectors: 63, bytes_per_sector: 512
total sectors: 117231408
BIOS reads 512 bytes from 0 (offset = 0), drive 129
ReadAt fLBA A
ReadAt fLBA B
ReadAt fLBA C
BIOS(13h): Restore BIOS IDT
BIOS(13h): eax: 0x4200, ebx: 0x105441, ecx: 0xfe34, edx: 0x81, esi: 0x20, edi: 0xaa55, es: 0x1, flags: 0x13
<rebootsky>

comment:6 by kallisti5, 8 years ago

after a lot of digging in bug reports, #11019 seems *extremely* similar. It even details a potential regression source.

comment:7 by kallisti5, 8 years ago

Blocked By: 11019 added
Resolution: duplicate
Status: newclosed

Actually.... #11019 is identical. Closing this one as a duplicate.

Note: See TracTickets for help on using tickets.