OPNsense Forum

Archive => 22.7 Legacy Series => Topic started by: lebowski on January 10, 2023, 10:31:48 pm

Title: emmc timeout / unuseable on cyberoam / aewin appliance
Post by: lebowski on January 10, 2023, 10:31:48 pm
I'm trying to run opnsense 22.7 on an cyberoam appliance. Every hardware part seems to be supported, except that i'm experiencing problems with it's onboard emmc module.

To be specific, this part from the bootlog is where things seem to go wrong:

sdhci_pci0-slot0: Controller timeout
sdhci_pci0-slot0: ============== REGISTER DUMP ==============
sdhci_pci0-slot0: Sys addr: 0x00000000 | Version:  0x00001001
sdhci_pci0-slot0: Blk size: 0x00000004 | Blk cnt:  0x00000001
sdhci_pci0-slot0: Argument: 0x00000000 | Trn mode: 0x00000002
sdhci_pci0-slot0: Present:  0x01ff0106 | Host ctl: 0x00000003
sdhci_pci0-slot0: Power:    0x0000000f | Blk gap:  0x00000000
sdhci_pci0-slot0: Wake-up:  0x00000000 | Clock:    0x00004007
sdhci_pci0-slot0: Timeout:  0x0000000d | Int stat: 0x00000000
sdhci_pci0-slot0: Int enab: 0x01ff00fb | Sig enab: 0x01ff00fa
sdhci_pci0-slot0: AC12 err: 0x00000000 | Host ctl2:0x00000000
sdhci_pci0-slot0: Caps:     0x21a632b2 | Caps2:    0x00000570
sdhci_pci0-slot0: Max curr: 0x00c80064 | ADMA err: 0x00000000
sdhci_pci0-slot0: ADMA addr:0x00000000 | Slot int: 0x000000ff
sdhci_pci0-slot0: ===========================================
sdhci_pci0-slot0: Controller timeout
sdhci_pci0-slot0: ============== REGISTER DUMP ==============
sdhci_pci0-slot0: Sys addr: 0x00000000 | Version:  0x00001001
sdhci_pci0-slot0: Blk size: 0x00000004 | Blk cnt:  0x00000001
sdhci_pci0-slot0: Argument: 0x00000000 | Trn mode: 0x00000012
sdhci_pci0-slot0: Present:  0x01ff0206 | Host ctl: 0x00000003
sdhci_pci0-slot0: Power:    0x0000000f | Blk gap:  0x00000000
sdhci_pci0-slot0: Wake-up:  0x00000000 | Clock:    0x00004007
sdhci_pci0-slot0: Timeout:  0x0000000d | Int stat: 0x00000001
sdhci_pci0-slot0: Int enab: 0x01ff00fb | Sig enab: 0x01ff00fa
sdhci_pci0-slot0: AC12 err: 0x00000000 | Host ctl2:0x00000000
sdhci_pci0-slot0: Caps:     0x21a632b2 | Caps2:    0x00000570
sdhci_pci0-slot0: Max curr: 0x00c80064 | ADMA err: 0x00000000
sdhci_pci0-slot0: ADMA addr:0x00000000 | Slot int: 0x000000ff
sdhci_pci0-slot0: ===========================================

The scb-6901 appliance supports both uefi and legacy booting. Strangely enough, while booting in pure uefi mode (with csm disabled) the emmc device disappears.

So what i've tried so far:
Booting opnsense 22.7 vga image from usb in uefi mode with csm (legacy) module disabled
Booting opnsense 22.7 serial image from usb in csm (legacy) mode

Read this topic (https://forum.opnsense.org/index.php?topic=14148.0) that suggests emmc support should be there.

Read this topic (https://forums.freebsd.org/threads/sdhci_pci0_slot0-controller-timeout.59077/) and tried putting "hw.sdhci.enable_msi=0" in the loader.conf file . Even that didnt make much of a difference (one would expect the emmc device to be disabled?)

Putting the "sd host controller version" (thats what the uefi/bios calls the emmc device/controller) in "2.0"mode. And after that, putting it in "3.0" mode.
Changed the sd device in the uefi from adma to pio mode. Made no difference.

So now i've tried as much as anything i could think of. Does anyone have a clue how to get the emmc device not timing out?
Title: Re: emmc timeout / unuseable on cyberoam / aewin appliance
Post by: lebowski on January 14, 2023, 04:23:56 pm
So i made a little progress here. I first started to find out if other distributions would or would not work with the onboard emmc chip. After booting the other *sense, it inmediately gave exactly the same error in the bootlog as opnsense. Then i started to run some dos tools, trying to wipe the emmc, but to no avail. dban wouldnt start as a result of console redirection.

At this point, i was wondering if the emmc chip is actually still working, or it maybe being defective? I tried a couple of emmc / sdcard settings in the uefi, and with result.

I figured it would make sense to first start some sort of linux distribution, with linux generally supporting a broader ranger of hardware. I found ipfire and first started it before the emmc / bios settings alterations, with no luck. ipfire wouldnt even detect the emmc chip. Then i changed some emmc settings (see screenshot), for example to 32bit and a lower standard (sd 2.0). And that did the trick, ipfire found the emmc device and i was even able to install and boot ipfire from the cyberoams internal 8gb emmc storage.

I expected this to be the same with opnsense, so with big hopes i booted opnsense, only to find out that it still wouldnt work with the emmc chip and still gives the same controller timeout error.

So with all of this, i now know that the emmc chip and controller is in a good working order, ipfire runs with no issues whatsoever. Only opnsense is refusing to support the emmc chip.
Title: Re: emmc timeout / unuseable on cyberoam / aewin appliance
Post by: newsense on January 14, 2023, 05:49:36 pm
OPNsense has nothing to do with supporting hardware chipsets, this is either a FreeBSD issue in the kernel or a faulty HW implementation - check if a newer BIOS is available.

If you could find a working or partially working combo by tinkering with the existing options that may be helpful should this lead to a FreeBSD bug report.
Title: Re: emmc timeout / unuseable on cyberoam / aewin appliance
Post by: FraLem on January 15, 2023, 09:03:40 am
Could you try to install FreeBsd?
Title: Re: emmc timeout / unuseable on cyberoam / aewin appliance
Post by: lebowski on January 15, 2023, 04:04:27 pm
I seem to have stumbled upon this problem a couple of years ago (https://forum.opnsense.org/index.php?topic=12405.0), back then i put aside the appliance, only to encounter the same problem again. Wireless issues have been solved in the meantime (atheros bsd drivers where developed), but the emmc problems persists.

@newsense I am aware that opnsense isnt directly involved in hardware support. Even better: i almost gave up on the emmc chip, only to discover that it actually does work with certain settings in the uefi and with booting linux (that original OS on this appliance probably also was linux based). I continued tinkering with the emmc settings, but this lead to no improvement in opnsense.  I did send an inquery for newer firmware. I hope that there will come a response to this, you never know with these companys.

@FraLem I havent thought of this actually, seems like a good test. This will be my next "endevour" with this device.

Another thing that came to mind. All of this made me think about "the olden days", back when lots of us where busy installing *sense on the well known watchguard firebox appliances. On these devices, there was a problem using cf cards with basic *sense settings, it would boot. You needed to disable dma for the CF reader in the loader.conf file. After that, running in PIO mode, all was fine. I wonder if these emmc troubles are of the same kind. I did actually disabled adma and after that dma, only to run in pio mode. But this gave me no improvement. Are there loader.conf settings that can be made for the emmc device in bsd, such as disabling dma accesss?