# FreeBSD on EFI motherboard



## Glebushka (Mar 11, 2010)

For four days i've been experiencing random complete deadlocks of amd64 8.0-RELASE or 8.0-STABLE on a brand new system.

Now it seems i've found the problem.

On a motherboard with EFI (all latest Intel boards), enabling USB legacy support causes random lockups of FreeBSD.

I found sort-of-a-solution here:
http://lists.freebsd.org/pipermail/freebsd-current/2009-August/010778.html
and i'got no idea how to modify this fix (what to put in sysenv?) for my problem.

A couple of strange things:
 hangs were completely random, not in any way related to load or connected devices.
 I can make it hang by just opening ddb with c-a-esc and typing continue.
 ddb won't open after it hangs
 it locks with debug kernel (developers-handbook/kerneldebug-deadlocks.html), i.e. no coredump, no panic, frozen and dead.

get this panic with boot -d:
AP #2 (PHY# 2) failed!

Dmidecode: http://pastebin.com/XwUWRDpn
dmesg:     http://pastebin.com/vCyePKXg
uname -a:

```
FreeBSD 8.0-STABLE FreeBSD 8.0-STABLE #2: Thu Mar 11 23:50:33 MSK 2010     root@c:/usr/obj/usr/src/sys/ml  amd64
```
M/B: *INTEL DG43GT*, latest bios
8.0-Stable as of today (11.03.2010)

I'm currently going to wait couple days to be sure I found the cause of a deadlock correctly.
*The question:*
What do i put into machdep.c so I can enable usb legacy in bios to get my keyboard at boot time?
Will there be a more general solution for this problem in the future? It seems now it simply looks for mac hardware with efi.


----------



## Glebushka (Mar 11, 2010)

Update: 
I figured out i should put 'Product Name' field from dmidecode in there. 

```
# dmidecode | grep Name
        Product Name:
        Product Name: DG43GT
```
so i get

```
--- machdep.c   2010-03-11 22:56:47.565846901 +0300
+++ machdep.c.orig      2009-12-19 14:31:28.000000000 +0300
@@ -218,7 +218,6 @@
                    strncmp(sysenv, "MacBookPro1,1", 13) == 0 ||
                    strncmp(sysenv, "MacBookPro1,2", 13) == 0 ||
                    strncmp(sysenv, "MacBookPro3,1", 13) == 0 ||
-                   strncmp(sysenv, "DG43GT", 6) == 0 ||
                    strncmp(sysenv, "Macmini1,1", 10) == 0) {
                        if (bootverbose)
                                printf("Disabling LEGACY_USB_EN bit on "
```
Don't think it's a good idea though, as this issue should also affect other EFI boards.

So, i'm currently going to rebuild kernel with this fix and wait for two or three days to see if it's really fixed.
The bad part is once it worked okay for 30 hours straight without triggering this hang problem, so I have no idea how to check if it's really fixed.


----------



## Glebushka (Mar 11, 2010)

Oops, it hang again. (
So seems i didn't fix anything.

May I be missing something obvious? I'm completely out of ideas of what can be wrong here. I'd think it's a hardware problem but winxp works perfectly on this hw..


----------



## Glebushka (Mar 19, 2010)

Turned out to be hardware problem, as win7 also hanged on this motherboard (winxp didn't).
Fixed by replacing m\b with another model.


----------

