OpenBSD 6.x unable to boot from Mac mini 2014

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

OpenBSD 6.x unable to boot from Mac mini 2014

Kristian Peters
Hi,

I want to install the latest OpenBSD on a Mac mini, but the kernel fails
with a panic. Everything was fine with OpenBSD 5.9 before.

Since version 6.0, OpenBSD is unable to boot on a Mac mini (2014 model =
MacMini7,1). On amd64, I'm getting the following kernel panic with using
6.0, 6.1 and 6.2:

avail mem = 4017737728 (3831MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0x88d10000 (49 entries)
bios0: vendor Apple Inc.
bios0: Apple Inc Macmini7,1
acpi0 at bios0: rev2
[..]
cpu0: Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz, 2000.26 MHz
[..]
cpu at mainbus0: not configured
ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 40 pins
acpiec0 at acpi0
Unsupported RegionSpace 0x5
panic: aml_die aml_rwfield:2493

The operating system has halted.
Press press any key to reboot.

rebooting...

This has also been reported by Bryan Vyhmeister over a year ago!

https://marc.info/?l=openbsd-misc&m=146714369624842&w=4

So I'm wondering why nobody noticed that before...

The kernel panic is caused in line 2493 in sys/dev/acpi/dsdt.c.
(https://github.com/openbsd/src/blob/master/sys/dev/acpi/dsdt.c)

The only difference in the code between OpenBSD 5.0 and 6.0 was a change
in the default CASE, where aml_rwgas(ref1, fld->v_field.bitpos + bpos,
blen, val, mode, fld->v_field.flags); was done before.

Doing machine memory at the boot> prompt of the install62.fs, I can see
the memory regions:
[..]
Region 4: type 1 at 0x90000 for 64KB
Region 5: type 1 at 0x100000 for 2240576KB
Region 6: type 1 at 0x88d10000 for 268KB
[...]
Low ram: 640KB  High ram: 2352128KB
Total free memory: 4067512KB

I'm planning to boot the Mac mini with an external hd and custom-built
kernel to see whether a change in the code will fix the problem for me.
Please not that I do not have access to a running OpenBSD on the Mac
mini right now... In the meantime it would be great if you could
acknowledge the problem and propse a fix or at least some instructions
how I could get the Mac mini booting again!

PS: I also CC'ed Bryan as he might provide further help.

Best wishes, *Kristian

Reply | Threaded
Open this post in threaded view
|

Re: OpenBSD 6.x unable to boot from Mac mini 2014

Kristian Peters
Hi,

As I thought, a simple addition to acpi/dsdt.c and the Mac mini is able
to boot. I used the external hard drive from a fresh 6.2-install on
another computer to that purpose. This patch is tested (tried to compile
the release under the newly built kernel) and was made against 6.2-release.

I attach the patch and the dmesg-output of the Mac mini running with the
patched kernel.

Can you merge it in -current?

--- 6.2/src/sys/dev/acpi/dsdt.c Sun May 28 17:36:45 2017
+++ src/sys/dev/acpi/dsdt.c     Mon Oct 30 16:08:39 2017
@@ -2488,6 +2488,11 @@
                        aml_rwgas(ref1, fld->v_field.bitpos + bpos, blen,
                            val, mode, fld->v_field.flags);
                        break;
+               case ACPI_OPREG_CMOS:
+                       printf("RegionSpace: %u\n",
ref1->v_opregion.iospace);
+                       aml_rwgas(ref1, fld->v_field.bitpos + bpos, blen,
+                           val, mode, fld->v_field.flags);
+                       break;
                default:
                        aml_die("Unsupported RegionSpace 0x%x",
                            ref1->v_opregion.iospace);

PS: I still fail to build the full release and, thus, also the
install62.fs image I want to use for installation. So it would be great
if you consider fixing the issue soon.

Best wishes, *Kristian


On 30.10.17 11:02 , Kristian Peters wrote:

> Hi,
>
> I want to install the latest OpenBSD on a Mac mini, but the kernel fails
> with a panic. Everything was fine with OpenBSD 5.9 before.
>
> Since version 6.0, OpenBSD is unable to boot on a Mac mini (2014 model =
> MacMini7,1). On amd64, I'm getting the following kernel panic with using
> 6.0, 6.1 and 6.2:
>
> avail mem = 4017737728 (3831MB)
> mainbus0 at root
> bios0 at mainbus0: SMBIOS rev. 2.4 @ 0x88d10000 (49 entries)
> bios0: vendor Apple Inc.
> bios0: Apple Inc Macmini7,1
> acpi0 at bios0: rev2
> [..]
> cpu0: Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz, 2000.26 MHz
> [..]
> cpu at mainbus0: not configured
> ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 40 pins
> acpiec0 at acpi0
> Unsupported RegionSpace 0x5
> panic: aml_die aml_rwfield:2493
>
> The operating system has halted.
> Press press any key to reboot.
>
> rebooting...
>
> This has also been reported by Bryan Vyhmeister over a year ago!
>
> https://marc.info/?l=openbsd-misc&m=146714369624842&w=4
>
> So I'm wondering why nobody noticed that before...
>
> The kernel panic is caused in line 2493 in sys/dev/acpi/dsdt.c.
> (https://github.com/openbsd/src/blob/master/sys/dev/acpi/dsdt.c)
>
> The only difference in the code between OpenBSD 5.0 and 6.0 was a change
> in the default CASE, where aml_rwgas(ref1, fld->v_field.bitpos + bpos,
> blen, val, mode, fld->v_field.flags); was done before.
>
> Doing machine memory at the boot> prompt of the install62.fs, I can see
> the memory regions:
> [..]
> Region 4: type 1 at 0x90000 for 64KB
> Region 5: type 1 at 0x100000 for 2240576KB
> Region 6: type 1 at 0x88d10000 for 268KB
> [...]
> Low ram: 640KB  High ram: 2352128KB
> Total free memory: 4067512KB
>
> I'm planning to boot the Mac mini with an external hd and custom-built
> kernel to see whether a change in the code will fix the problem for me.
> Please not that I do not have access to a running OpenBSD on the Mac
> mini right now... In the meantime it would be great if you could
> acknowledge the problem and propse a fix or at least some instructions
> how I could get the Mac mini booting again!
>
> PS: I also CC'ed Bryan as he might provide further help.
>
> Best wishes, *Kristian
>


mac_mini_7.1.patch (710 bytes) Download Attachment
mac_mini_7.1.txt (12K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: OpenBSD 6.x unable to boot from Mac mini 2014

Mike Larkin
On Mon, Oct 30, 2017 at 06:31:19PM +0100, Kristian Peters wrote:

> Hi,
>
> As I thought, a simple addition to acpi/dsdt.c and the Mac mini is able
> to boot. I used the external hard drive from a fresh 6.2-install on
> another computer to that purpose. This patch is tested (tried to compile
> the release under the newly built kernel) and was made against 6.2-release.
>
> I attach the patch and the dmesg-output of the Mac mini running with the
> patched kernel.
>
> Can you merge it in -current?
>
> --- 6.2/src/sys/dev/acpi/dsdt.c Sun May 28 17:36:45 2017
> +++ src/sys/dev/acpi/dsdt.c     Mon Oct 30 16:08:39 2017
> @@ -2488,6 +2488,11 @@
>                         aml_rwgas(ref1, fld->v_field.bitpos + bpos, blen,
>                             val, mode, fld->v_field.flags);
>                         break;
> +               case ACPI_OPREG_CMOS:
> +                       printf("RegionSpace: %u\n",
> ref1->v_opregion.iospace);
> +                       aml_rwgas(ref1, fld->v_field.bitpos + bpos, blen,
> +                           val, mode, fld->v_field.flags);
> +                       break;
>                 default:
>                         aml_die("Unsupported RegionSpace 0x%x",
>                             ref1->v_opregion.iospace);
>
> PS: I still fail to build the full release and, thus, also the
> install62.fs image I want to use for installation. So it would be great
> if you consider fixing the issue soon.
>
> Best wishes, *Kristian
>

I don't think this is right. It may be "solving" your problem but our rwgas
implementation doesn't handle this type of OpRegion. So, at best, we're ignoring
the request (with the changes above), or worse, perhaps trashing some memory.

Someone needs to add the I/O for this type of region (CMOS NVRAM) to
the gasio code in acpi.c. There is a sequence of IN/OUT instructions that need to
occur (in a proper order, with correct locking because the OS is using the
device also) to get at those NVRAM registers. It probably isn't a huge amount
of work, but nobody has stepped up to do it yet.

If you want a workaround, you might try just ignoring ACPI_OPREG_CMOS locally
in your tree. That too isn't right but at least it won't be possibly causing
side effects/damage elsewhere.

-ml