Introduce Synology x86 NAS LEDs driver
PATCH v3 1/1 Introduce Synology x86 NAS LEDs driver
Add platform driver for Synology x86-based NAS devices to support HDD LEDs controlled by ICH9 GPIO pins.
Only DS411+II is supported for now (DS411+ should be the same except CPU).
Unfortunately, the DMI data in BIOS is not very helpful to identify the device as almost all strings are "To be filled by O.E.M.". Match also the BIOS date and then check presence of PCI devices (host bridge, LPC bridge, onboard SiI3531 SATA controller and i82574L ethernet controller) to avoid activation on other systems.
Buttons and other LEDs are not supported by this driver because they're controlled by a PIC MCU (connected through serial port).
---
Changes in v3:
- descriptions changed to mention LEDs
- GPIO swnodes are used instead of gpiod
- improved PCI device presence checking
Changes in v2:
- fixed includes (order, added missing, removed kernel.h)
- added missing DMI and PCI dependencies to Kconfig
- added PCI device presence check details to changelog
- used %pe for error message
--- drivers/platform/x86/Kconfig | 16 ++ drivers/platform/x86/Makefile | 3 + drivers/platform/x86/synology-x86.c | 253 ++++++++++++++++++++++++++++ 3 files changed, 272 insertions(+) create mode 100644 drivers/platform/x86/synology-x86.c
drivers/platform/x86/Kconfig +16 -0
@@ -1059,6 +1059,22 @@ config OXP_EC source "drivers/platform/x86/tuxedo/Kconfig" +config SYNOLOGY_X86 + tristate "Synology x86 NAS LEDs driver" + depends on DMI + depends on GPIOLIB + depends on LPC_ICH + depends on GPIO_ICH + depends on LEDS_CLASS + depends on PCI + select LEDS_GPIO + help + This driver provides support for the HDD LEDs on Synology x86 NAS + devices. + + To compile this driver as a module, choose M here: the module + will be called synology-x86. + endif # X86_PLATFORM_DEVICES config P2SB
drivers/platform/x86/Makefile +3 -0
@@ -166,3 +166,6 @@ obj-$(CONFIG_SEL3350_PLATFORM) += sel3350-platform.o # OneXPlayer obj-$(CONFIG_OXP_EC) += oxpec.o + +# Synology +obj-$(CONFIG_SYNOLOGY_X86) += synology-x86.o
drivers/platform/x86/synology-x86.c new file +253 -0
253 lines not on this page · raw message
Signature · 1 line
Ondrej Zary
Quoted 13 lines · Ondrej Zary
Add platform driver for Synology x86-based NAS devices to support HDD LEDs controlled by ICH9 GPIO pins.
Only DS411+II is supported for now (DS411+ should be the same except CPU).
Unfortunately, the DMI data in BIOS is not very helpful to identify the device as almost all strings are "To be filled by O.E.M.". Match also the BIOS date and then check presence of PCI devices (host bridge, LPC bridge, onboard SiI3531 SATA controller and i82574L ethernet controller) to avoid activation on other systems.
Buttons and other LEDs are not supported by this driver because they're controlled by a PIC MCU (connected through serial port).
...
Quoted 30 lines
drivers/platform/x86/synology-x86.c new file +27
-0+struct synology_pci_dev { +unsigned int bus; +unsigned int devfn; +struct pci_device_id id; +}; + +/* onboard PCI devices found in DS411+ to confirm the machine type (after DMI match) */ +static const struct synology_pci_dev ds411plus_pci_devices[]__initconst = { +/* 00:00.0 Host bridge: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge */ + {0 ,PCI_DEVFN (0 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0xa000 , +PCI_VENDOR_ID_INTEL ,0xa000 ) } }, +/* 00:1f.0 ISA bridge: Intel Corporation 82801IR (ICH9R) LPC Interface Controller */ + {0 ,PCI_DEVFN (0x1f ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x2916 , +PCI_VENDOR_ID_INTEL ,0x2916 ) } }, +/* 02:00.0 Mass storage controller: Silicon Image, Inc. SiI 3531 Serial ATA Controller */ + {2 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_CMD ,0x3531 , +PCI_VENDOR_ID_CMD ,0x3531 ) } }, +/* 03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection */ + {3 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x10d3 , +PCI_VENDOR_ID_INTEL ,0x0000 ) } }, + {} +}; +/* check if all PCI devices in the list are present at specified locations */ +static bool __init synology_pci_devices_present (const struct synology_pci_dev *list) +{ +const struct synology_pci_dev *d; +
drivers/platform/x86/synology-x86.c line 190
Quoted 10 lines
drivers/platform/x86/synology-x86.c new file +9
-0+for (d = list; d->id.vendor; d++) { +struct pci_dev *pdev =pci_get_domain_bus_and_slot (0 , d->bus, d->devfn); + +if (!pdev) +return false; +bool matched = d->id.vendor == pdev->vendor && + d->id.device == pdev->device && + d->id.subvendor == pdev->subsystem_vendor && + d->id.subdevice == pdev->subsystem_device;
Don't mix variable definitions with the code (it's exceptionally possible for a couple of cases, none of which is this one). Can't it use pci_match_id() approach with driver_data? (If we ever need this check.)
drivers/platform/x86/synology-x86.c line 198
Quoted 7 lines
drivers/platform/x86/synology-x86.c new file +7
-0+pci_dev_put (pdev); +if (!matched) +return false; + } + +return true; +}
Yeah, this becomes an ugly part of the patch...
...
drivers/platform/x86/synology-x86.c line 209
Quoted 9 lines
drivers/platform/x86/synology-x86.c new file +8
-0+static int __init synology_init (void ) +{ +struct platform_device_info leds_info = { + .name ="leds-gpio" , + .id =PLATFORM_DEVID_NONE , + }; +int err; +
No blank line in the definition block.
drivers/platform/x86/synology-x86.c line 210
Quoted 1 line
drivers/platform/x86/synology-x86.c new file +1
-0+const struct dmi_system_id *dmi =dmi_first_match (synology_systems);
Split assignment and keep the variables in reversed xmas tree order.
Quoted 29 lines
drivers/platform/x86/synology-x86.c new file +29
-0+if (!dmi) +return -ENODEV ; + +/* DS411+ DMI match is too generic, confirm by onboard PCI devices */ +if (!strcmp (dmi->ident,"DS411+" ) && !synology_pci_devices_present (ds411plus_pci_devices)) +return -ENODEV ; + +pr_info ("Detected Synology NAS %s\n" , dmi->ident); + + err =software_node_register_node_group (synology_swnodes); +if (err) { +pr_err ("failed to register software nodes: %d\n" , err); +return err; + } + + leds_info.fwnode =software_node_fwnode (&synology_gpio_leds_node); + synology_leds_pdev =platform_device_register_full (&leds_info); + err =PTR_ERR_OR_ZERO (synology_leds_pdev); +if (err) { +pr_err ("error registering platform device: %pe\n" , synology_leds_pdev); + goto err_unregister; + } + +return 0 ; + +err_unregister: +software_node_unregister_node_group (synology_swnodes); +return err; +}
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 53 lines · On Tuesday 24 November 2026 18:03:00 Andy Shevchenko wrote:
Quoted 13 lines · Ondrej Zary
Add platform driver for Synology x86-based NAS devices to support HDD LEDs controlled by ICH9 GPIO pins.
Only DS411+II is supported for now (DS411+ should be the same except CPU).
Unfortunately, the DMI data in BIOS is not very helpful to identify the device as almost all strings are "To be filled by O.E.M.". Match also the BIOS date and then check presence of PCI devices (host bridge, LPC bridge, onboard SiI3531 SATA controller and i82574L ethernet controller) to avoid activation on other systems.
Buttons and other LEDs are not supported by this driver because they're controlled by a PIC MCU (connected through serial port).
...
Quoted 35 lines
drivers/platform/x86/synology-x86.c new file +32
-0+struct synology_pci_dev { +unsigned int bus; +unsigned int devfn; +struct pci_device_id id; +}; + +/* onboard PCI devices found in DS411+ to confirm the machine type (after DMI match) */ +static const struct synology_pci_dev ds411plus_pci_devices[]__initconst = { +/* 00:00.0 Host bridge: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge */ + {0 ,PCI_DEVFN (0 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0xa000 , +PCI_VENDOR_ID_INTEL ,0xa000 ) } }, +/* 00:1f.0 ISA bridge: Intel Corporation 82801IR (ICH9R) LPC Interface Controller */ + {0 ,PCI_DEVFN (0x1f ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x2916 , +PCI_VENDOR_ID_INTEL ,0x2916 ) } }, +/* 02:00.0 Mass storage controller: Silicon Image, Inc. SiI 3531 Serial ATA Controller */ + {2 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_CMD ,0x3531 , +PCI_VENDOR_ID_CMD ,0x3531 ) } }, +/* 03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection */ + {3 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x10d3 , +PCI_VENDOR_ID_INTEL ,0x0000 ) } }, + {} +}; +/* check if all PCI devices in the list are present at specified locations */ +static bool __init synology_pci_devices_present (const struct synology_pci_dev *list) +{ +const struct synology_pci_dev *d; + +for (d = list; d->id.vendor; d++) { +struct pci_dev *pdev =pci_get_domain_bus_and_slot (0 , d->bus, d->devfn); + +if (!pdev) +return false;
Quoted 8 lines
drivers/platform/x86/synology-x86.c line 190
Quoted 4 lines
drivers/platform/x86/synology-x86.c new file +4
-0+bool matched = d->id.vendor == pdev->vendor && + d->id.device == pdev->device && + d->id.subvendor == pdev->subsystem_vendor && + d->id.subdevice == pdev->subsystem_device;Don't mix variable definitions with the code (it's exceptionally possible for a couple of cases, none of which is this one). Can't it use
pci_match_id()approach withdriver_data? (If we ever need this check.)
I don't see how can pci_match_id() be used here. I can merge pci bus and devfun into driver_data to fit into pci_device_id table but there's no pci_dev which could be matched against that table (and walking all PCI devices does not seem to be an improvement).
Signature · 1 line
Ondrej Zary
Quoted 2 lines · Ondrej Zary
Quoted 1 line · On Tuesday 24 November 2026 18:03:00 Andy Shevchenko wrote:
On Tue, Nov 24, 2026 at 01:45:46PM +0100, Ondrej Zary wrote:
...
Quoted 45 lines
Quoted 36 lines
Quoted 35 lines
drivers/platform/x86/synology-x86.c new file +32
-0+struct synology_pci_dev { +unsigned int bus; +unsigned int devfn; +struct pci_device_id id; +}; + +/* onboard PCI devices found in DS411+ to confirm the machine type (after DMI match) */ +static const struct synology_pci_dev ds411plus_pci_devices[]__initconst = { +/* 00:00.0 Host bridge: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge */ + {0 ,PCI_DEVFN (0 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0xa000 , +PCI_VENDOR_ID_INTEL ,0xa000 ) } }, +/* 00:1f.0 ISA bridge: Intel Corporation 82801IR (ICH9R) LPC Interface Controller */ + {0 ,PCI_DEVFN (0x1f ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x2916 , +PCI_VENDOR_ID_INTEL ,0x2916 ) } }, +/* 02:00.0 Mass storage controller: Silicon Image, Inc. SiI 3531 Serial ATA Controller */ + {2 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_CMD ,0x3531 , +PCI_VENDOR_ID_CMD ,0x3531 ) } }, +/* 03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection */ + {3 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x10d3 , +PCI_VENDOR_ID_INTEL ,0x0000 ) } }, + {} +}; +/* check if all PCI devices in the list are present at specified locations */ +static bool __init synology_pci_devices_present (const struct synology_pci_dev *list) +{ +const struct synology_pci_dev *d; + +for (d = list; d->id.vendor; d++) { +struct pci_dev *pdev =pci_get_domain_bus_and_slot (0 , d->bus, d->devfn); + +if (!pdev) +return false;Quoted 8 lines
drivers/platform/x86/synology-x86.c line 190
Quoted 4 lines
drivers/platform/x86/synology-x86.c new file +4
-0+bool matched = d->id.vendor == pdev->vendor && + d->id.device == pdev->device && + d->id.subvendor == pdev->subsystem_vendor && + d->id.subdevice == pdev->subsystem_device;Don't mix variable definitions with the code (it's exceptionally possible for a couple of cases, none of which is this one). Can't it use
pci_match_id()approach withdriver_data? (If we ever need this check.)
Quoted 4 lines
I don't see how can
pci_match_id()be used here. I can merge pci bus and devfun intodriver_datato fit intopci_device_idtable but there's nopci_devwhich could be matched against that table (and walking all PCI devices does not seem to be an improvement).
_After_ DMI match the walk over all PCI devices is not a big deal. The code will be nicer. But maybe there is a better choice? Like checking CPUID? Or maybe something interesting is present in the ACPI tables?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 51 lines · On Tuesday 24 November 2026 21:13:21 Andy Shevchenko wrote:
Quoted 2 lines · Ondrej Zary
Quoted 1 line · On Tuesday 24 November 2026 18:03:00 Andy Shevchenko wrote:
On Tue, Nov 24, 2026 at 01:45:46PM +0100, Ondrej Zary wrote:
...
Quoted 45 lines
Quoted 44 lines
Quoted 30 lines
drivers/platform/x86/synology-x86.c new file +27
-0+struct synology_pci_dev { +unsigned int bus; +unsigned int devfn; +struct pci_device_id id; +}; + +/* onboard PCI devices found in DS411+ to confirm the machine type (after DMI match) */ +static const struct synology_pci_dev ds411plus_pci_devices[]__initconst = { +/* 00:00.0 Host bridge: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge */ + {0 ,PCI_DEVFN (0 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0xa000 , +PCI_VENDOR_ID_INTEL ,0xa000 ) } }, +/* 00:1f.0 ISA bridge: Intel Corporation 82801IR (ICH9R) LPC Interface Controller */ + {0 ,PCI_DEVFN (0x1f ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x2916 , +PCI_VENDOR_ID_INTEL ,0x2916 ) } }, +/* 02:00.0 Mass storage controller: Silicon Image, Inc. SiI 3531 Serial ATA Controller */ + {2 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_CMD ,0x3531 , +PCI_VENDOR_ID_CMD ,0x3531 ) } }, +/* 03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection */ + {3 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x10d3 , +PCI_VENDOR_ID_INTEL ,0x0000 ) } }, + {} +}; +/* check if all PCI devices in the list are present at specified locations */ +static bool __init synology_pci_devices_present (const struct synology_pci_dev *list) +{ +const struct synology_pci_dev *d; +drivers/platform/x86/synology-x86.c line 190
Quoted 10 lines
drivers/platform/x86/synology-x86.c new file +9
-0+for (d = list; d->id.vendor; d++) { +struct pci_dev *pdev =pci_get_domain_bus_and_slot (0 , d->bus, d->devfn); + +if (!pdev) +return false; +bool matched = d->id.vendor == pdev->vendor && + d->id.device == pdev->device && + d->id.subvendor == pdev->subsystem_vendor && + d->id.subdevice == pdev->subsystem_device;Don't mix variable definitions with the code (it's exceptionally possible for a couple of cases, none of which is this one). Can't it use
pci_match_id()approach withdriver_data? (If we ever need this check.)
Quoted 8 lines
Quoted 4 lines
I don't see how can
pci_match_id()be used here. I can merge pci bus and devfun intodriver_datato fit intopci_device_idtable but there's nopci_devwhich could be matched against that table (and walking all PCI devices does not seem to be an improvement)._After_ DMI match the walk over all PCI devices is not a big deal. The code will be nicer. But maybe there is a better choice? Like checking CPUID? Or maybe something interesting is present in the ACPI tables?
pci_find_next_bus() and pci_walk_bus() with a callback or list_for_each_entry()?
Then pci_match_id() and finally test if the matched device has proper bus and devfn numbers. Doesn't look like a recipe for nice code.
I'll check ACPI tables tomorrow but I doubt there's anything done properly in the BIOS (even int13 support is buggy and requires GRUB patch).
Signature · 1 line
Ondrej Zary
Quoted 4 lines · Ondrej Zary
Quoted 3 lines · On Tuesday 24 November 2026 21:13:21 Andy Shevchenko wrote:
Quoted 2 lines · Ondrej Zary
Quoted 1 line · On Tuesday 24 November 2026 18:03:00 Andy Shevchenko wrote:
On Tue, Nov 24, 2026 at 01:45:46PM +0100, Ondrej Zary wrote:
...
Quoted 50 lines
Quoted 50 lines
Quoted 49 lines
Quoted 36 lines
Quoted 35 lines
drivers/platform/x86/synology-x86.c new file +32
-0+struct synology_pci_dev { +unsigned int bus; +unsigned int devfn; +struct pci_device_id id; +}; + +/* onboard PCI devices found in DS411+ to confirm the machine type (after DMI match) */ +static const struct synology_pci_dev ds411plus_pci_devices[]__initconst = { +/* 00:00.0 Host bridge: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge */ + {0 ,PCI_DEVFN (0 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0xa000 , +PCI_VENDOR_ID_INTEL ,0xa000 ) } }, +/* 00:1f.0 ISA bridge: Intel Corporation 82801IR (ICH9R) LPC Interface Controller */ + {0 ,PCI_DEVFN (0x1f ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x2916 , +PCI_VENDOR_ID_INTEL ,0x2916 ) } }, +/* 02:00.0 Mass storage controller: Silicon Image, Inc. SiI 3531 Serial ATA Controller */ + {2 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_CMD ,0x3531 , +PCI_VENDOR_ID_CMD ,0x3531 ) } }, +/* 03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection */ + {3 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x10d3 , +PCI_VENDOR_ID_INTEL ,0x0000 ) } }, + {} +}; +/* check if all PCI devices in the list are present at specified locations */ +static bool __init synology_pci_devices_present (const struct synology_pci_dev *list) +{ +const struct synology_pci_dev *d; + +for (d = list; d->id.vendor; d++) { +struct pci_dev *pdev =pci_get_domain_bus_and_slot (0 , d->bus, d->devfn); + +if (!pdev) +return false;Quoted 8 lines
drivers/platform/x86/synology-x86.c line 190
Quoted 4 lines
drivers/platform/x86/synology-x86.c new file +4
-0+bool matched = d->id.vendor == pdev->vendor && + d->id.device == pdev->device && + d->id.subvendor == pdev->subsystem_vendor && + d->id.subdevice == pdev->subsystem_device;Don't mix variable definitions with the code (it's exceptionally possible for a couple of cases, none of which is this one). Can't it use
pci_match_id()approach withdriver_data? (If we ever need this check.)I don't see how can
pci_match_id()be used here. I can merge pci bus and devfun intodriver_datato fit intopci_device_idtable but there's nopci_devwhich could be matched against that table (and walking all PCI devices does not seem to be an improvement).
Quoted 8 lines
Quoted 3 lines
_After_ DMI match the walk over all PCI devices is not a big deal. The code will be nicer. But maybe there is a better choice? Like checking CPUID? Or maybe something interesting is present in the ACPI tables?
pci_find_next_bus()andpci_walk_bus()with a callback orlist_for_each_entry()?
Thenpci_match_id()and finally test if the matched device has proper bus and devfn numbers. Doesn't look like a recipe for nice code.
Check how pmc_atom_init() is implemented.
Quoted 2 lines
I'll check ACPI tables tomorrow but I doubt there's anything done properly in the BIOS (even int13 support is buggy and requires GRUB patch).
Yeah...
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 51 lines · Andy Shevchenko
Quoted 2 lines · Ondrej Zary
Quoted 1 line · On Tuesday 24 November 2026 18:03:00 Andy Shevchenko wrote:
On Tue, Nov 24, 2026 at 01:45:46PM +0100, Ondrej Zary wrote:
...
Quoted 45 lines
Quoted 44 lines
Quoted 30 lines
drivers/platform/x86/synology-x86.c new file +27
-0+struct synology_pci_dev { +unsigned int bus; +unsigned int devfn; +struct pci_device_id id; +}; + +/* onboard PCI devices found in DS411+ to confirm the machine type (after DMI match) */ +static const struct synology_pci_dev ds411plus_pci_devices[]__initconst = { +/* 00:00.0 Host bridge: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge */ + {0 ,PCI_DEVFN (0 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0xa000 , +PCI_VENDOR_ID_INTEL ,0xa000 ) } }, +/* 00:1f.0 ISA bridge: Intel Corporation 82801IR (ICH9R) LPC Interface Controller */ + {0 ,PCI_DEVFN (0x1f ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x2916 , +PCI_VENDOR_ID_INTEL ,0x2916 ) } }, +/* 02:00.0 Mass storage controller: Silicon Image, Inc. SiI 3531 Serial ATA Controller */ + {2 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_CMD ,0x3531 , +PCI_VENDOR_ID_CMD ,0x3531 ) } }, +/* 03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection */ + {3 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x10d3 , +PCI_VENDOR_ID_INTEL ,0x0000 ) } }, + {} +}; +/* check if all PCI devices in the list are present at specified locations */ +static bool __init synology_pci_devices_present (const struct synology_pci_dev *list) +{ +const struct synology_pci_dev *d; +drivers/platform/x86/synology-x86.c line 190
Quoted 10 lines
drivers/platform/x86/synology-x86.c new file +9
-0+for (d = list; d->id.vendor; d++) { +struct pci_dev *pdev =pci_get_domain_bus_and_slot (0 , d->bus, d->devfn); + +if (!pdev) +return false; +bool matched = d->id.vendor == pdev->vendor && + d->id.device == pdev->device && + d->id.subvendor == pdev->subsystem_vendor && + d->id.subdevice == pdev->subsystem_device;Don't mix variable definitions with the code (it's exceptionally possible for a couple of cases, none of which is this one). Can't it use
pci_match_id()approach withdriver_data? (If we ever need this check.)
Quoted 9 lines
Quoted 4 lines
I don't see how can
pci_match_id()be used here. I can merge pci bus and devfun intodriver_datato fit intopci_device_idtable but there's nopci_devwhich could be matched against that table (and walking all PCI devices does not seem to be an improvement)._After_ DMI match the walk over all PCI devices is not a big deal. The code will be nicer. But maybe there is a better choice? Like checking CPUID? Or maybe something interesting is present in the ACPI tables?
I don't know much about ACPI but can't find any Synology traces.
# acpidump -s Firmware Warning (ACPI): Incorrect checksum in table [GSCI] - 0x83, should be 0x34 (20250404/utcksum-100) ACPI: GSCI 0x0000000000000000 002024 (v01 052112 GMCHSCI 20120521 MSFT 00000097) ACPI: MCFG 0x0000000000000000 00003C (v01 052112 OEMMCFG 20120521 MSFT 00000097) ACPI: APIC 0x0000000000000000 00006C (v01 052112 APIC1409 20120521 MSFT 00000097) Firmware Warning (ACPI): Incorrect checksum in table [OEMB] - 0x6F, should be 0x03 (20250404/utcksum-100) ACPI: OEMB 0x0000000000000000 000082 (v01 052112 OEMB1409 20120521 MSFT 00000097) ACPI: DSDT 0x0000000000000000 006B21 (v01 1AAAA 1AAAA005 00000005 INTL 20051117) ACPI: FACP 0x0000000000000000 000084 (v01 052112 FACP1409 20120521 MSFT 00000097) ACPI: HPET 0x0000000000000000 000038 (v01 052112 OEMHPET 20120521 MSFT 00000097) ACPI: FACS 0x0000000000000000 000040
ACPI devices look very generic:
AWY0001:00
INT0800:00
INTC0102:00
ITE8704:00
LNXCPU:00
LNXCPU:01
LNXCPU:02
LNXCPU:03
LNXPWRBN:00
LNXSYBUS:00
LNXSYBUS:01
LNXSYSTM:00
PNP0000:00
PNP0100:00
PNP0103:00
PNP0200:00
PNP0303:00
PNP0401:00
PNP0501:00
PNP0501:01
PNP0700:00
PNP0800:00
PNP0A08:00
PNP0B00:00
PNP0C01:00
PNP0C01:01
PNP0C02:00
PNP0C02:01
PNP0C02:02
PNP0C02:03
PNP0C02:04
PNP0C04:00
PNP0C0C:00
PNP0C0E:00
PNP0C0F:00
PNP0C0F:01
PNP0C0F:02
PNP0C0F:03
PNP0C0F:04
PNP0C0F:05
PNP0C0F:06
PNP0C0F:07
PNP0C31:00
PNP0F03:00
Signature · 1 line
Ondrej Zary
Quoted 4 lines · Ondrej Zary
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Ondrej Zary
Quoted 1 line · On Tuesday 24 November 2026 18:03:00 Andy Shevchenko wrote:
On Tue, Nov 24, 2026 at 01:45:46PM +0100, Ondrej Zary wrote:
...
Quoted 107 lines
Quoted 45 lines
Quoted 45 lines
Quoted 44 lines
Quoted 30 lines
drivers/platform/x86/synology-x86.c new file +27
-0+struct synology_pci_dev { +unsigned int bus; +unsigned int devfn; +struct pci_device_id id; +}; + +/* onboard PCI devices found in DS411+ to confirm the machine type (after DMI match) */ +static const struct synology_pci_dev ds411plus_pci_devices[]__initconst = { +/* 00:00.0 Host bridge: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge */ + {0 ,PCI_DEVFN (0 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0xa000 , +PCI_VENDOR_ID_INTEL ,0xa000 ) } }, +/* 00:1f.0 ISA bridge: Intel Corporation 82801IR (ICH9R) LPC Interface Controller */ + {0 ,PCI_DEVFN (0x1f ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x2916 , +PCI_VENDOR_ID_INTEL ,0x2916 ) } }, +/* 02:00.0 Mass storage controller: Silicon Image, Inc. SiI 3531 Serial ATA Controller */ + {2 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_CMD ,0x3531 , +PCI_VENDOR_ID_CMD ,0x3531 ) } }, +/* 03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection */ + {3 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x10d3 , +PCI_VENDOR_ID_INTEL ,0x0000 ) } }, + {} +}; +/* check if all PCI devices in the list are present at specified locations */ +static bool __init synology_pci_devices_present (const struct synology_pci_dev *list) +{ +const struct synology_pci_dev *d; +drivers/platform/x86/synology-x86.c line 190
Quoted 10 lines
drivers/platform/x86/synology-x86.c new file +9
-0+for (d = list; d->id.vendor; d++) { +struct pci_dev *pdev =pci_get_domain_bus_and_slot (0 , d->bus, d->devfn); + +if (!pdev) +return false; +bool matched = d->id.vendor == pdev->vendor && + d->id.device == pdev->device && + d->id.subvendor == pdev->subsystem_vendor && + d->id.subdevice == pdev->subsystem_device;Don't mix variable definitions with the code (it's exceptionally possible for a couple of cases, none of which is this one). Can't it use
pci_match_id()approach withdriver_data? (If we ever need this check.)Quoted 9 lines
Quoted 4 lines
I don't see how can
pci_match_id()be used here. I can merge pci bus and devfun intodriver_datato fit intopci_device_idtable but there's nopci_devwhich could be matched against that table (and walking all PCI devices does not seem to be an improvement)._After_ DMI match the walk over all PCI devices is not a big deal. The code will be nicer. But maybe there is a better choice? Like checking CPUID? Or maybe something interesting is present in the ACPI tables?
I don't know much about ACPI but can't find any Synology traces.
# acpidump -s Firmware Warning (ACPI): Incorrect checksum in table [GSCI] - 0x83, should be 0x34 (20250404/utcksum-100) ACPI: GSCI 0x0000000000000000 002024 (v01 052112 GMCHSCI 20120521 MSFT 00000097) ACPI: MCFG 0x0000000000000000 00003C (v01 052112 OEMMCFG 20120521 MSFT 00000097) ACPI: APIC 0x0000000000000000 00006C (v01 052112 APIC1409 20120521 MSFT 00000097) Firmware Warning (ACPI): Incorrect checksum in table [OEMB] - 0x6F, should be 0x03 (20250404/utcksum-100) ACPI: OEMB 0x0000000000000000 000082 (v01 052112 OEMB1409 20120521 MSFT 00000097) ACPI: DSDT 0x0000000000000000 006B21 (v01 1AAAA 1AAAA005 00000005 INTL 20051117) ACPI: FACP 0x0000000000000000 000084 (v01 052112 FACP1409 20120521 MSFT 00000097) ACPI: HPET 0x0000000000000000 000038 (v01 052112 OEMHPET 20120521 MSFT 00000097) ACPI: FACS 0x0000000000000000 000040ACPI devices look very generic:
AWY0001:00
INT0800:00
INTC0102:00
ITE8704:00
LNXCPU:00
LNXCPU:01
LNXCPU:02
LNXCPU:03
LNXPWRBN:00
LNXSYBUS:00
LNXSYBUS:01
LNXSYSTM:00
PNP0000:00
PNP0100:00
PNP0103:00
PNP0200:00
PNP0303:00
PNP0401:00
PNP0501:00
PNP0501:01
PNP0700:00
PNP0800:00
PNP0A08:00
PNP0B00:00
PNP0C01:00
PNP0C01:01
PNP0C02:00
PNP0C02:01
PNP0C02:02
PNP0C02:03
PNP0C02:04
PNP0C04:00
PNP0C0C:00
PNP0C0E:00
PNP0C0F:00
PNP0C0F:01
Quoted 8 lines
PNP0C0F:02
PNP0C0F:03
PNP0C0F:04
PNP0C0F:05
PNP0C0F:06
PNP0C0F:07
PNP0C31:00
PNP0F03:00
Can you add the platform to https://linux-hardware.org/?view=howto ?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 124 lines · Andy Shevchenko
Quoted 4 lines · Ondrej Zary
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Ondrej Zary
Quoted 1 line · On Tuesday 24 November 2026 18:03:00 Andy Shevchenko wrote:
On Tue, Nov 24, 2026 at 01:45:46PM +0100, Ondrej Zary wrote:
...
Quoted 107 lines
Quoted 45 lines
Quoted 45 lines
Quoted 44 lines
Quoted 30 lines
drivers/platform/x86/synology-x86.c new file +27
-0+struct synology_pci_dev { +unsigned int bus; +unsigned int devfn; +struct pci_device_id id; +}; + +/* onboard PCI devices found in DS411+ to confirm the machine type (after DMI match) */ +static const struct synology_pci_dev ds411plus_pci_devices[]__initconst = { +/* 00:00.0 Host bridge: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge */ + {0 ,PCI_DEVFN (0 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0xa000 , +PCI_VENDOR_ID_INTEL ,0xa000 ) } }, +/* 00:1f.0 ISA bridge: Intel Corporation 82801IR (ICH9R) LPC Interface Controller */ + {0 ,PCI_DEVFN (0x1f ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x2916 , +PCI_VENDOR_ID_INTEL ,0x2916 ) } }, +/* 02:00.0 Mass storage controller: Silicon Image, Inc. SiI 3531 Serial ATA Controller */ + {2 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_CMD ,0x3531 , +PCI_VENDOR_ID_CMD ,0x3531 ) } }, +/* 03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection */ + {3 ,PCI_DEVFN (0x00 ,0 ), {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x10d3 , +PCI_VENDOR_ID_INTEL ,0x0000 ) } }, + {} +}; +/* check if all PCI devices in the list are present at specified locations */ +static bool __init synology_pci_devices_present (const struct synology_pci_dev *list) +{ +const struct synology_pci_dev *d; +drivers/platform/x86/synology-x86.c line 190
Quoted 10 lines
drivers/platform/x86/synology-x86.c new file +9
-0+for (d = list; d->id.vendor; d++) { +struct pci_dev *pdev =pci_get_domain_bus_and_slot (0 , d->bus, d->devfn); + +if (!pdev) +return false; +bool matched = d->id.vendor == pdev->vendor && + d->id.device == pdev->device && + d->id.subvendor == pdev->subsystem_vendor && + d->id.subdevice == pdev->subsystem_device;Don't mix variable definitions with the code (it's exceptionally possible for a couple of cases, none of which is this one). Can't it use
pci_match_id()approach withdriver_data? (If we ever need this check.)Quoted 9 lines
Quoted 4 lines
I don't see how can
pci_match_id()be used here. I can merge pci bus and devfun intodriver_datato fit intopci_device_idtable but there's nopci_devwhich could be matched against that table (and walking all PCI devices does not seem to be an improvement)._After_ DMI match the walk over all PCI devices is not a big deal. The code will be nicer. But maybe there is a better choice? Like checking CPUID? Or maybe something interesting is present in the ACPI tables?
I don't know much about ACPI but can't find any Synology traces.
# acpidump -s Firmware Warning (ACPI): Incorrect checksum in table [GSCI] - 0x83, should be 0x34 (20250404/utcksum-100) ACPI: GSCI 0x0000000000000000 002024 (v01 052112 GMCHSCI 20120521 MSFT 00000097) ACPI: MCFG 0x0000000000000000 00003C (v01 052112 OEMMCFG 20120521 MSFT 00000097) ACPI: APIC 0x0000000000000000 00006C (v01 052112 APIC1409 20120521 MSFT 00000097) Firmware Warning (ACPI): Incorrect checksum in table [OEMB] - 0x6F, should be 0x03 (20250404/utcksum-100) ACPI: OEMB 0x0000000000000000 000082 (v01 052112 OEMB1409 20120521 MSFT 00000097) ACPI: DSDT 0x0000000000000000 006B21 (v01 1AAAA 1AAAA005 00000005 INTL 20051117) ACPI: FACP 0x0000000000000000 000084 (v01 052112 FACP1409 20120521 MSFT 00000097) ACPI: HPET 0x0000000000000000 000038 (v01 052112 OEMHPET 20120521 MSFT 00000097) ACPI: FACS 0x0000000000000000 000040ACPI devices look very generic:
AWY0001:00
INT0800:00
INTC0102:00
ITE8704:00
LNXCPU:00
LNXCPU:01
LNXCPU:02
LNXCPU:03
LNXPWRBN:00
LNXSYBUS:00
LNXSYBUS:01
LNXSYSTM:00
PNP0000:00
PNP0100:00
PNP0103:00
PNP0200:00
PNP0303:00
PNP0401:00
PNP0501:00
PNP0501:01
PNP0700:00
PNP0800:00
PNP0A08:00
PNP0B00:00
PNP0C01:00
PNP0C01:01
PNP0C02:00
PNP0C02:01
PNP0C02:02
PNP0C02:03
PNP0C02:04
PNP0C04:00
PNP0C0C:00
PNP0C0E:00
PNP0C0F:00
PNP0C0F:01Quoted 8 lines
PNP0C0F:02
PNP0C0F:03
PNP0C0F:04
PNP0C0F:05
PNP0C0F:06
PNP0C0F:07
PNP0C31:00
PNP0F03:00
Quoted 1 line
Can you add the platform to https://linux-hardware.org/?view=howto ?
https://linux-hardware.org/?probe=1d48e86441
Signature · 1 line
Ondrej Zary
Quoted 6 lines · Ondrej Zary
Quoted 5 lines · Andy Shevchenko
Quoted 4 lines · Ondrej Zary
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Ondrej Zary
Quoted 1 line · On Tuesday 24 November 2026 18:03:00 Andy Shevchenko wrote:
On Tue, Nov 24, 2026 at 01:45:46PM +0100, Ondrej Zary wrote:
...
Quoted 116 lines
Quoted 116 lines
Quoted 115 lines
Quoted 45 lines
Quoted 45 lines
Quoted 44 lines
Quoted 30 lines
(quoted diff) +27
-0+struct synology_pci_dev { + unsigned int bus; + unsigned int devfn; + struct pci_device_id id; +}; + +/* onboard PCI devices found in DS411+ to confirm the machine type (after DMI match) */ +static const struct synology_pci_dev ds411plus_pci_devices[] __initconst = { + /* 00:00.0 Host bridge: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge */ + { 0, PCI_DEVFN(0, 0), { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0xa000, + PCI_VENDOR_ID_INTEL, 0xa000) } }, + /* 00:1f.0 ISA bridge: Intel Corporation 82801IR (ICH9R) LPC Interface Controller */ + { 0, PCI_DEVFN(0x1f, 0), { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x2916, + PCI_VENDOR_ID_INTEL, 0x2916) } }, + /* 02:00.0 Mass storage controller: Silicon Image, Inc. SiI 3531 Serial ATA Controller */ + { 2, PCI_DEVFN(0x00, 0), { PCI_DEVICE_SUB(PCI_VENDOR_ID_CMD, 0x3531, + PCI_VENDOR_ID_CMD, 0x3531) } }, + /* 03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection */ + { 3, PCI_DEVFN(0x00, 0), { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x10d3, + PCI_VENDOR_ID_INTEL, 0x0000) } }, + {} +}; +/* check if all PCI devices in the list are present at specified locations */ +static bool __init synology_pci_devices_present(const struct synology_pci_dev *list) +{ + const struct synology_pci_dev *d; +Review
Quoted 10 lines
(quoted diff) +9
-0+ for (d = list; d->id.vendor; d++) { + struct pci_dev *pdev = pci_get_domain_bus_and_slot(0, d->bus, d->devfn); + + if (!pdev) + return false; + bool matched = d->id.vendor == pdev->vendor && + d->id.device == pdev->device && + d->id.subvendor == pdev->subsystem_vendor && + d->id.subdevice == pdev->subsystem_device;Don't mix variable definitions with the code (it's exceptionally possible for a couple of cases, none of which is this one). Can't it use
pci_match_id()approach withdriver_data? (If we ever need this check.)Quoted 9 lines
Quoted 4 lines
I don't see how can
pci_match_id()be used here. I can merge pci bus and devfun intodriver_datato fit intopci_device_idtable but there's nopci_devwhich could be matched against that table (and walking all PCI devices does not seem to be an improvement)._After_ DMI match the walk over all PCI devices is not a big deal. The code will be nicer. But maybe there is a better choice? Like checking CPUID? Or maybe something interesting is present in the ACPI tables?
I don't know much about ACPI but can't find any Synology traces.
# acpidump -s Firmware Warning (ACPI): Incorrect checksum in table [GSCI] - 0x83, should be 0x34 (20250404/utcksum-100) ACPI: GSCI 0x0000000000000000 002024 (v01 052112 GMCHSCI 20120521 MSFT 00000097) ACPI: MCFG 0x0000000000000000 00003C (v01 052112 OEMMCFG 20120521 MSFT 00000097) ACPI: APIC 0x0000000000000000 00006C (v01 052112 APIC1409 20120521 MSFT 00000097) Firmware Warning (ACPI): Incorrect checksum in table [OEMB] - 0x6F, should be 0x03 (20250404/utcksum-100) ACPI: OEMB 0x0000000000000000 000082 (v01 052112 OEMB1409 20120521 MSFT 00000097) ACPI: DSDT 0x0000000000000000 006B21 (v01 1AAAA 1AAAA005 00000005 INTL 20051117) ACPI: FACP 0x0000000000000000 000084 (v01 052112 FACP1409 20120521 MSFT 00000097) ACPI: HPET 0x0000000000000000 000038 (v01 052112 OEMHPET 20120521 MSFT 00000097) ACPI: FACS 0x0000000000000000 000040ACPI devices look very generic:
AWY0001:00
INT0800:00
INTC0102:00
ITE8704:00
LNXCPU:00
LNXCPU:01
LNXCPU:02
LNXCPU:03
LNXPWRBN:00
LNXSYBUS:00
LNXSYBUS:01
LNXSYSTM:00
PNP0000:00
PNP0100:00
PNP0103:00
PNP0200:00
PNP0303:00
PNP0401:00
PNP0501:00
PNP0501:01
PNP0700:00
PNP0800:00
PNP0A08:00
PNP0B00:00
PNP0C01:00
PNP0C01:01
PNP0C02:00
PNP0C02:01
PNP0C02:02
PNP0C02:03
PNP0C02:04
PNP0C04:00
PNP0C0C:00
PNP0C0E:00
PNP0C0F:00
PNP0C0F:01
PNP0C0F:02
PNP0C0F:03
PNP0C0F:04
PNP0C0F:05
PNP0C0F:06
PNP0C0F:07
PNP0C31:00
PNP0F03:00
Quoted 3 lines
Quoted 1 line
Can you add the platform to https://linux-hardware.org/?view=howto ?
Thanks!
Based on that I would drop the PCI hack and use these DMI matches together:
Vendor: American Megatrends Inc. Version: 080016 Release Date: 05/21/2012
If ever we need to make this narrower, we would use CPUID.
Signature · 2 lines
With Best Regards, Andy Shevchenko