FreeBSD on Synology NAS hardware

Hello,

I installed FreeBSD 13-CURRENT on Apollo Lake 6-wide NAS Box. No SATA drives visible and even all drives are powered off. In this case, the controllers and all 6 AHCI-channels are visible. How power management should work, maybe some driver is missing?

One more issue - serial console does not work. As I understand it, Intel PCI-UART is not supported?

dmesg log:

Code:
# dmesg
---<<BOOT>>---
Copyright (c) 1992-2020 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 13.0-CURRENT #0 main-c255460-g282381aa53a: Thu Dec 31 06:08:47 UTC 2020
    root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
FreeBSD clang version 11.0.0 (git@github.com:llvm/llvm-project.git llvmorg-11.0.0-0-g176249bd673)
WARNING: WITNESS option enabled, expect reduced performance.
VT(vga): resolution 640x480
CPU: Intel(R) Celeron(R) CPU J3355 @ 2.00GHz (1996.87-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x506c9  Family=0x6  Model=0x5c  Stepping=9
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x4ff8ebb7<SSE3,PCLMULQDQ,DTES64,DS_CPL,VMX,EST,TM2,SSSE3,SDBG,CX16,xTPR,PDCM,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,RDRAND>
  AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
  AMD Features2=0x101<LAHF,Prefetch>
  Structured Extended Features=0x2294e283<FSGSBASE,TSCADJ,SMEP,ERMS,NFPUSG,MPX,PQE,RDSEED,SMAP,CLFLUSHOPT,PROCTRACE,SHA>
  Structured Extended Features3=0x2c000400<MD_CLEAR,IBPB,STIBP,ARCH_CAP>
  XSAVE Features=0xf<XSAVEOPT,XSAVEC,XINUSE,XSAVES>
  IA32_ARCH_CAPS=0x79<RDCL_NO,SKIP_L1DFL_VME,SSB_NO,MDS_NO>
  VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID,VID,PostIntr
  TSC: P-state invariant, performance statistics
real memory  = 2147483648 (2048 MB)
avail memory = 1853759488 (1767 MB)
Event timer "LAPIC" quality 600
ACPI APIC Table: <INSYDE INSYDE>
WARNING: L1 data cache covers fewer APIC IDs than a core (0 < 1)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 1 package(s) x 2 core(s)
random: registering fast source Intel Secure Key RNG
random: fast provider: "Intel Secure Key RNG"
random: unblocking device.
ioapic0 <Version 2.0> irqs 0-119
Launching APs: 1
Timecounter "TSC" frequency 1996869824 Hz quality 1000
random: entropy device external interface
WARNING: Device "kbd" is Giant locked and may be deleted before FreeBSD 13.0.
kbd0 at kbdmux0
000.000043 [4346] netmap_init               netmap: loaded module
[ath_hal] loaded
nexus0
efirtc0: <EFI Realtime Clock>
efirtc0: registered as a time-of-day clock, resolution 1.000000s
cryptosoft0: <software crypto>
acpi0: <INSYDE INSYDE>
unknown: I/O range not supported
cpu0: <ACPI CPU> on acpi0
attimer0: <AT timer> port 0x40-0x43,0x50-0x53 irq 0 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
atrtc0: <AT realtime clock> port 0x70-0x77 irq 8 on acpi0
atrtc0: Warning: Couldn't map I/O.
atrtc0: registered as a time-of-day clock, resolution 1.000000s
Event timer "RTC" frequency 32768 Hz quality 0
hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
Timecounter "HPET" frequency 19200000 Hz quality 950
Event timer "HPET" frequency 19200000 Hz quality 550
Event timer "HPET1" frequency 19200000 Hz quality 440
Event timer "HPET2" frequency 19200000 Hz quality 440
Event timer "HPET3" frequency 19200000 Hz quality 440
Event timer "HPET4" frequency 19200000 Hz quality 440
Event timer "HPET5" frequency 19200000 Hz quality 440
Event timer "HPET6" frequency 19200000 Hz quality 440
Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
vgapci0: <VGA-compatible display> port 0x4000-0x403f mem 0x90000000-0x90ffffff,0x80000000-0x8fffffff at device 2.0 on pci0
vgapci0: Boot video device
hdac0: <Intel Broxton-P HDA Controller> mem 0x91410000-0x91413fff,0x91000000-0x910fffff irq 25 at device 14.0 on pci0
pci0: <simple comms> at device 15.0 (no driver attached)
pci0: <old> at device 17.0 (no driver attached)
ahci0: <Intel Apollo Lake AHCI SATA controller> port 0x4080-0x4087,0x4088-0x408b,0x4060-0x407f mem 0x91416000-0x91417fff,0x9142e000-0x9142e0ff,0x9142c000-0x9142c7ff at device 18.0 on pci0
ahci0: AHCI v1.31 with 2 6Gbps ports, Port Multiplier supported
ahcich0: <AHCI channel> at channel 0 on ahci0
ahcich1: <AHCI channel> at channel 1 on ahci0
pcib1: <ACPI PCI-PCI bridge> at device 19.0 on pci0
pci1: <ACPI PCI bus> on pcib1
ahci1: <Marvell 88SE9235 AHCI SATA controller> port 0x3028-0x302f,0x3034-0x3037,0x3020-0x3027,0x3030-0x3033,0x3000-0x301f mem 0x91300000-0x913007ff at device 0.0 on pci1
ahci1: AHCI v1.00 with 4 6Gbps ports, Port Multiplier supported with FBS
ahcich2: <AHCI channel> at channel 0 on ahci1
ahcich3: <AHCI channel> at channel 1 on ahci1
ahcich4: <AHCI channel> at channel 2 on ahci1
ahcich5: <AHCI channel> at channel 3 on ahci1
pcib2: <ACPI PCI-PCI bridge> at device 19.3 on pci0
pci2: <ACPI PCI bus> on pcib2
re0: <RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet> port 0x2000-0x20ff mem 0x91204000-0x91204fff,0x91200000-0x91203fff at device 0.0 on pci2
re0: Using 1 MSI-X message
re0: ASPM disabled
re0: Chip rev. 0x54000000
re0: MAC rev. 0x00100000
miibus0: <MII bus> on re0
rgephy0: <RTL8251/8153 1000BASE-T media interface> PHY 1 on miibus0
rgephy0:  none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT-FDX, 1000baseT-FDX-master, 1000baseT-FDX-flow, 1000baseT-FDX-flow-master, auto, auto-flow
re0: Using defaults for TSO: 65518/35/2048
re0: Ethernet address: 00:e0:4c:68:00:02
re0: netmap queues/slots: TX 1/256, RX 1/256
pcib3: <ACPI PCI-PCI bridge> at device 20.0 on pci0
pci3: <ACPI PCI bus> on pcib3
re1: <RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet> port 0x1000-0x10ff mem 0x91104000-0x91104fff,0x91100000-0x91103fff at device 0.0 on pci3
re1: Using 1 MSI-X message
re1: ASPM disabled
re1: Chip rev. 0x54000000
re1: MAC rev. 0x00100000
miibus1: <MII bus> on re1
rgephy1: <RTL8251/8153 1000BASE-T media interface> PHY 1 on miibus1
rgephy1:  none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT-FDX, 1000baseT-FDX-master, 1000baseT-FDX-flow, 1000baseT-FDX-flow-master, auto, auto-flow
re1: Using defaults for TSO: 65518/35/2048
re1: Ethernet address: 00:e0:4c:68:00:03
re1: netmap queues/slots: TX 1/256, RX 1/256
xhci0: <Intel Apollo Lake USB 3.0 controller> mem 0x91400000-0x9140ffff irq 17 at device 21.0 on pci0
xhci0: 32 bytes context size, 64-bit DMA
usbus0: waiting for BIOS to give up control
xhci_interrupt: host controller halted
usbus0 on xhci0
usbus0: 5.0Gbps Super Speed USB v3.0
pci0: <serial bus> at device 26.0 (no driver attached)
isab0: <PCI-ISA bridge> at device 31.0 on pci0
isa0: <ISA bus> on isab0
acpi_button0: <Power Button> on acpi0
acpi_tz0: <Thermal Zone> on acpi0
est0: <Enhanced SpeedStep Frequency Control> on cpu0
Timecounters tick every 1.000 msec
ZFS filesystem version: 5
ZFS storage pool version: features support (5000)
ugen0.1: <0x8086 XHCI root HUB> at usbus0
hdacc0: <Intel Broxton HDA CODEC> at cad 2 on hdac0
hdaa0: <Intel Broxton Audio Function Group> at nid 1 on hdacc0
pcm0: <Intel Broxton (HDMI/DP 8ch)> at nid 3 on hdaa0
Trying to mount root from zfs:wd_zroot []...
Root mount waiting for: CAM usbus0
WARNING: WITNESS option enabled, expect reduced performance.
uhub0 on usbus0
uhub0: <0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
uhub0: 15 ports with 15 removable, self powered
Root mount waiting for: usbus0
ugen0.2: <Seagate Backup+ Hub> at usbus0
uhub1 on uhub0
uhub1: <Seagate Backup+ Hub, class 9/0, rev 2.10/48.85, addr 1> on usbus0
uhub1: MTT enabled
uhub1: 3 ports with 3 removable, self powered
Root mount waiting for: usbus0
Root mount waiting for: usbus0
ugen0.3: <Synology DiskStation> at usbus0
umass0 on uhub0
umass0: <Synology DiskStation, class 0/0, rev 3.20/1.00, addr 2> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0x8100
umass0:6:0: Attached to scbus6
da0 at umass-sim0 bus 0 scbus6 target 0 lun 0
da0: <Synology DiskStation 0100> Removable Direct Access SPC-4 SCSI device
da0: Serial Number AA00000000000489
da0: 400.000MB/s transfers
da0: 30000MB (61440000 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>
Root mount waiting for: usbus0
ugen0.4: <Seagate Backup+ Hub> at usbus0
uhub2 on uhub0
uhub2: <Seagate> on usbus0
uhub2: 3 ports with 3 removable, self powered
Root mount waiting for: usbus0
Root mount waiting for: usbus0
ugen0.5: <Seagate Backup+ Hub BK> at usbus0
umass1 on uhub2
umass1: <Seagate Backup+ Hub BK, class 0/0, rev 3.10/1.00, addr 4> on usbus0
umass1:  SCSI over Bulk-Only; quirks = 0x0100
umass1:7:1: Attached to scbus7
da1 at umass-sim1 bus 1 scbus7 target 0 lun 0
da1: <Seagate Backup+ Hub BK D781> Fixed Direct Access SPC-4 SCSI device
da1: Serial Number 01CB8304B0D2
da1: 400.000MB/s transfers
da1: 476940MB (976773167 512 byte sectors)
da1: quirks=0x2<NO_6_BYTE>
lo0: link state changed to UP
re0: link state changed to DOWN
re1: link state changed to DOWN
ig4iic0: <Intel Apollo Lake I2C Controller-0> mem 0x9141a000-0x9141afff,0x9141b000-0x9141bfff irq 27 at device 22.0 on pci0
ig4iic0: Using MSI
iicbus0: <Philips I2C bus (ACPI-hinted)> on ig4iic0
re0: link state changed to UP
ichsmb0: <Intel Broxton SMBus controller> port 0x4040-0x405f mem 0x9142d000-0x9142d0ff at device 31.1 on pci0
smbus0: <System Management Bus> on ichsmb0

And pciconf -lv

Code:
 # pciconf -lv
hostb0@pci0:0:0:0:      class=0x060000 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5af0 subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series Host Bridge'
    class      = bridge
    subclass   = HOST-PCI
vgapci0@pci0:0:2:0:     class=0x030000 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5a85 subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'HD Graphics 500'
    class      = display
    subclass   = VGA
hdac0@pci0:0:14:0:      class=0x040380 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5a98 subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series Audio Cluster'
    class      = multimedia
    subclass   = HDA
none0@pci0:0:15:0:      class=0x078000 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5a9a subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series Trusted Execution Engine'
    class      = simple comms
none1@pci0:0:17:0:      class=0x005007 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5aa2 subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series Integrated Sensor Hub'
    class      = old
ahci0@pci0:0:18:0:      class=0x010601 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5ae3 subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series SATA AHCI Controller'
    class      = mass storage
    subclass   = SATA
pcib1@pci0:0:19:0:      class=0x060400 rev=0xfb hdr=0x01 vendor=0x8086 device=0x5ad8 subvendor=0x0000 subdevice=0x0000
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series PCI Express Port A'
    class      = bridge
    subclass   = PCI-PCI
pcib2@pci0:0:19:3:      class=0x060400 rev=0xfb hdr=0x01 vendor=0x8086 device=0x5adb subvendor=0x0000 subdevice=0x0000
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series PCI Express Port A'
    class      = bridge
    subclass   = PCI-PCI
pcib3@pci0:0:20:0:      class=0x060400 rev=0xfb hdr=0x01 vendor=0x8086 device=0x5ad6 subvendor=0x0000 subdevice=0x0000
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series PCI Express Port B'
    class      = bridge
    subclass   = PCI-PCI
xhci0@pci0:0:21:0:      class=0x0c0330 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5aa8 subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series USB xHCI'
    class      = serial bus
    subclass   = USB
ig4iic0@pci0:0:22:0:    class=0x118000 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5aac subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series I2C Controller'
    class      = dasp
none2@pci0:0:24:0:      class=0x118000 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5abc subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series HSUART Controller'
    class      = dasp
none3@pci0:0:24:1:      class=0x118000 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5abe subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series HSUART Controller'
    class      = dasp
none4@pci0:0:24:2:      class=0x118000 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5ac0 subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series HSUART Controller'
    class      = dasp
none5@pci0:0:24:3:      class=0x118000 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5aee subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series HSUART Controller'
    class      = dasp
none6@pci0:0:25:0:      class=0x118000 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5ac2 subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series SPI Controller'
    class      = dasp
none7@pci0:0:25:1:      class=0x118000 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5ac4 subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series SPI Controller'
    class      = dasp
none8@pci0:0:25:2:      class=0x118000 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5ac6 subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series SPI Controller'
    class      = dasp
none9@pci0:0:26:0:      class=0x0c8000 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5ac8 subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series PWM Pin Controller'
    class      = serial bus
isab0@pci0:0:31:0:      class=0x060100 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5ae8 subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series Low Pin Count Interface'
    class      = bridge
    subclass   = PCI-ISA
ichsmb0@pci0:0:31:1:    class=0x0c0500 rev=0x0b hdr=0x00 vendor=0x8086 device=0x5ad4 subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series SMBus Controller'
    class      = serial bus
    subclass   = SMBus
ahci1@pci0:1:0:0:       class=0x010601 rev=0x11 hdr=0x00 vendor=0x1b4b device=0x9235 subvendor=0x1b4b subdevice=0x9235
    vendor     = 'Marvell Technology Group Ltd.'
    device     = '88SE9235 PCIe 2.0 x2 4-port SATA 6 Gb/s Controller'
    class      = mass storage
    subclass   = SATA
re0@pci0:2:0:0: class=0x020000 rev=0x15 hdr=0x00 vendor=0x10ec device=0x8168 subvendor=0x10ec subdevice=0x0123
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller'
    class      = network
    subclass   = ethernet
re1@pci0:3:0:0: class=0x020000 rev=0x15 hdr=0x00 vendor=0x10ec device=0x8168 subvendor=0x10ec subdevice=0x0123
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller'
    class      = network
    subclass   = ethernet

Thanks for your feedback
 
We have no idea what the enclosure hardware is. You say "Apollo Lake" ... that's an Intel CPU. Then you say "NAS box", which is generic. You seem to indicate that the SATA disks are powered down. Sometimes disk enclosures have mechanisms for turning power to disk drives on and off. How that is controlled depends heavily on the hardware. For SCSI hardware there is a standard (called "SES") for enclosure services (including power control for disks), and even that standard is very vague and usually only followed as a guideline. For SATA enclosures, power control is all over the map.

With cheap NAS boxes, power control is sometimes done in an ad-hoc fashion, with non-standard hardware. So for example it could be that the power controller is reached via a serial port or via i2c/spi. Or it could be using the GPIO pins that are present on embedded (Celeron- and Atom-) style processors, like your Apollo Lake. If we know the exact model of NAS you are using, a web search might be able to find it.

In most cases, NAS boxes are sold and shipped with embedded operating systems, usually a custom Linux distribution (and famously in some cases a FreeBSD installation). It might be a good idea to install the correct OS on the NAS box, to get it work.
 
In most cases, NAS boxes are sold and shipped with embedded operating systems, usually a custom Linux distribution (and famously in some cases a FreeBSD installation). It might be a good idea to install the correct OS on the NAS box, to get it work.
It's a Synology DS620slim NAS, it comes with native DSM based on linux, but I want to use FreeBSD with ZFS on it. In general, most of hardware works, except SATA and UART.
In original DSM firmware SATA disks spin up when linux kernel finished loading, at the same time, the status LED change color and stops blinking. In FreeBSD LED is always blinking.
 
A quick look on the web finds no single success story of someone installing FreeBSD on Synology hardware. They clearly have a small USB disk (the one that's visible as da0 in your dmesg output) from which they boot, and on which you have installed FreeBSD with ZFS now.

I have no idea how they control disk power to the SATA disks. The fact that they "spin up when kernel finished loading" seems to indicate that there is some software that controls it. You'll have to find success stories on the web, or find some documentation, or contact the manufacturer.
 
Or it could be using the GPIO pins that are present on embedded (Celeron- and Atom-) style processors, like your Apollo Lake. If we know the exact model of NAS you are using, a web search might be able to find it.
You are right. It's actually controls through a GPIO pins.
There are such parameters in linux kernel loader options:
Code:
linux /zImage ...... syno_hdd_detect=18,179,176,175,177,171 syno_hdd_enable=21,20,19,9,173,172
HDDs will not spin up without this parameters.

And when linux kernel is loading, there are following strings in log:
Code:
[    0.000000] Internal HD num: 6
[    0.000000] Internal netif num: 2
[    0.000000] Support HDD Hotplug.
[    0.000000] Synology Hardware Version: DS620slim
[    0.000000] Vender format version: 2
[    0.000000] SYNO GPIO hdd detect pin: 18 179 176 175 177 171
[    0.000000] SYNO GPIO hdd enable pin: 21 20 19 9 173 172
[    0.000000] USB Vbus GPIO Control:
[    0.000000]  Gpp#11 - Host: 0000:00:15.0         - Port:1 - Polarity: ACTIVE_HIGH
[    0.000000]  Gpp#10 - Host: 0000:00:15.0         - Port:2 - Polarity: ACTIVE_HIGH
[    0.000000]  Gpp#10 - Host: 0000:00:15.0         - Port:3 - Polarity: ACTIVE_HIGH

It looks like the Synology has made its own custom kernel module, that controls GPIO pins.

Is there a way to control GPIO pins in FreeBSD? gpiobus.ko is loaded, but nothing in /dev/gpio* :(( .
Driver missing?
 
The good news is that you have confirmed that the Synology hardware uses GPIO pins for detecting and controlling disk drive power. The bad news ...

Is there a way to control GPIO pins in FreeBSD? gpiobus.ko is loaded, but nothing in /dev/gpio* :(( .
Driver missing?
Is there a general way to control *ANY* GPIO pins in all free operating systems? No. It all depends on someone writing a driver (or more accurately, modifying the existing driver).
Is there a way to control *SOME* GPIO pins in FreeBSD? Yes. The command-line utility is called gpioctl, the linkable library libgpio, and it for example works fine on a Raspberry Pi. If you read the man=4 page for gpio (the underlying kernel subsystem), it shows that some types of gpio are supported on all platforms (most types only supported on ARM).

Given that Linux is theoretically a free operating system, you should be able to download the source code that runs on the Synology, and read their kernel code, and compare it to FreeBSD's kernel code. The only problem is how to find the source code. Theoretically, under the GPL it has to be published somewhere. In practice ...
 
The good news is that you have confirmed that the Synology hardware uses GPIO pins for detecting and controlling disk drive power. The bad news ...

Thank you for participating...
The worst news is that we will not be able to boot FreeBSD from ZFS pool directly. Because the SATA-drives in the bootloader are not available and will spin up after kernel loader. To make disks available in bootloader you must have GPIO power management in GRUB, which seems impossible to me.

With this in mind, I did hardware modding - I just soldered +5V on the backplain board and now the disks spin up immediately when the power button is pressed. And all SATA drives are available in the bootloader - FreeBSD can boot directly from ZFS pool. My GRUB config example:
Code:
menuentry "FreeBSD" {
        insmod chain
        insmod zfs
        search -s -l fujitsu_zroot
        chainloader /@/boot/loader.efi
}

Later I will post detailed manual how to install FreeBSD on Synology hardware.
 
Back
Top