mafredri/asustor-platform-driver

Asustor AS6604T

DOcGui opened this issue · 8 comments

Hello,
If you have some time to look for my Asustor AS6604T
But I think we will have the same problem with IT8625E
Ask me if you need more information

# sudo dmidecode -s system-manufacturer
Insyde

# sudo dmidecode -s system-product-name
GeminiLake

# sudo dmidecode -s bios-vendor
INSYDE Corp.

# sudo dmidecode -s bios-version
V1.1C

# sudo dmidecode -s bios-release-date
03/20/2020

# sudo dmidecode -s bios-revision
1.25

gpioinfo.txt
dmesg.txt

Could the work of this ones help?
https://github.com/a1wong/it87

I’ll take a look once I have some time. In the meantime, if you want to give the it87 branch in this repo a spin, feel free: https://github.com/mafredri/asustor-platform-driver/tree/it87

Hi, I've got the Asustor AS6602T (Lockerstore 2), and get the exact same output from dmidecode.

I'm running latest Debian stable (Bookworm 12.1) on it, with kernel 6.1.0-12-amd64 (standard Debian kernel).

The astor_it87 module from the branch linked above works, sensors outputs values that seem plausible, and I can control the fanspeed and LED brightness through /sys/devices/platform/asustor_it87.656/hwmon/hwmon3/pwm1 and pwm3 in the same directory.
(Ok, is it really plausible that the fanspeed is 1222 by default and goes up to 5000RPM at pwm 255? It does sound like a jet engine at max speed, though..)

Anyway, the asustor module itself doesn't work: modprobe: ERROR: could not insert 'asustor': No such device

gpioinfo.txt
dmesg.txt

If you can give me some hints on how to test those GPIO pins, I might try to create a patch myself - would love to get rid of the blinking green LED after boot (with the original software it turns to steadily lit once it's done booting)

Also possibly relevant, the gpio-it87 driver doesn't load, dmesg says:
gpio_it87: Unknown Chip found, Chip 8625 Revision 8

(it's also not included in Debian's kernel package, so I built the latest code for it myself, with the Makefile from here)

gpio_ich (built similarly) does load, but that doesn't give me any new GPIO chips in gpiodetect or gpioinfo

I had a quick look at asustors kernel source (from https://sourceforge.net/projects/asgpl/files/ADM4.1.0/4.1.0.RLQ1_and_above/x64g3_adm41_kernel_5_13_x/) and they have patched gpio-it87.c (and lots of other files).
I hope to find some time to port their changes to this repo (incl. adding asustor_gpio_it87.c) soonish, to get asustor.ko to work on my AS6602T (and probably other machines as well)

Update: urgs, looks like they have changes behind #ifdef ASUSTOR_PATCH for which the source is missing. For example, the changes to gpio-it87.c are:

Click to show diff
diff -w -u -r linux-5.13.19/drivers/gpio/gpio-it87.c linux-5.13.x_20221102/drivers/gpio/gpio-it87.c
--- linux-5.13.19/drivers/gpio/gpio-it87.c	2021-09-18 13:42:24.000000000 +0200
+++ linux-5.13.x_20221102/drivers/gpio/gpio-it87.c	2022-07-13 08:08:14.000000000 +0200
@@ -25,6 +25,9 @@
 #define NO_DEV_ID	0xffff
 #define IT8613_ID	0x8613
 #define IT8620_ID	0x8620
+#ifdef ASUSTOR_PATCH
+#define IT8625_ID 	0x8625
+#endif ///ASUSTOR_PATCH
 #define IT8628_ID	0x8628
 #define IT8718_ID       0x8718
 #define IT8728_ID	0x8728
@@ -45,6 +48,10 @@
 #define CHIPID		0x20
 #define CHIPREV		0x22
 
+#ifdef ASUSTOR_PATCH
+bool to_load_it87(void);
+#endif ///ASUSTOR_PATCH
+
 /**
  * struct it87_gpio - it87-specific GPIO chip
  * @chip: the underlying gpio_chip structure
@@ -168,7 +175,6 @@
 	 * newly-exported GPIO interfaces are set to input.
 	 */
 	superio_clear_mask(mask, group + it87_gpio->output_base);
-
 	superio_exit();
 
 exit:
@@ -258,6 +264,37 @@
 	return rc;
 }
 
+#ifdef ASUSTOR_PATCH
+#define GPLED_TO_LOCATION(GP_LED) ({ ((GP_LED / 10) << 3) + (GP_LED % 10); })
+#define LOCATION_TO_GPLED(LOCATION) ({ ((LOCATION >> 3) * 10) + (LOCATION & 0x07); })
+
+static const u8 IT87_REG_GP_LED_CTRL_PIN_MAPPING[] = {0xf8, 0xfa};
+
+int it87_gpio_led_blink_get(u8 index)
+{
+	return 0;
+}
+EXPORT_SYMBOL(it87_gpio_led_blink_get);
+
+int it87_gpio_led_blink_set(u8 index, u32 gpio)
+{
+	return 0;
+}
+EXPORT_SYMBOL(it87_gpio_led_blink_set);
+
+int it87_gpio_led_blink_freq_get(u8 index)
+{
+	return 0;
+}
+EXPORT_SYMBOL(it87_gpio_led_blink_freq_get);
+
+int it87_gpio_led_blink_freq_set(u8 index, u8 val)
+{
+	return 0;
+}
+EXPORT_SYMBOL(it87_gpio_led_blink_freq_set);
+#endif ///ASUSTOR_PATCH
+

yes, that's all.

  • IT8625_ID is never used
  • to_load_it87() is never actually implemented, unless it's somehow dynamically generated while compiling (I grepped the complete source for it, but didn't try to actually build the kernel source). It's also declared (but not used) in it87.c (which also has a bool asustor_model_check(const char *model_name); declaration that's also never called or implemented)
  • The GPLED_TO_LOCATION(GP_LED) and LOCATION_TO_GPLED(LOCATION) macros are never used
  • The it87_gpio_led_blink_*() functions are obviously dummies that don't do anything (but they're called from asustor's patched it87.c)

So unfortunately this doesn't tell us how the IT8625 chip works or how to configure the blinking..

Similarly, they "add" a gpioctl syscall:

diff -w -u -r linux-5.13.19/arch/x86/entry/syscalls/syscall_64.tbl linux-5.13.x_20221102/arch/x86/entry/syscalls/syscall_64.tbl
--- linux-5.13.19/arch/x86/entry/syscalls/syscall_64.tbl	2021-09-18 13:42:24.000000000 +0200
+++ linux-5.13.x_20221102/arch/x86/entry/syscalls/syscall_64.tbl	2022-07-13 04:35:50.000000000 +0200
@@ -368,6 +368,8 @@
 444	common	landlock_create_ruleset	sys_landlock_create_ruleset
 445	common	landlock_add_rule	sys_landlock_add_rule
 446	common	landlock_restrict_self	sys_landlock_restrict_self
+# ASUSTOR_PATCH
+480 common  gpioctl         sys_gpioctl

diff -w -u -r linux-5.13.19/include/linux/syscalls.h linux-5.13.x_20221102/include/linux/syscalls.h
--- linux-5.13.19/include/linux/syscalls.h	2021-09-18 13:42:24.000000000 +0200
+++ linux-5.13.x_20221102/include/linux/syscalls.h	2022-07-13 04:36:58.000000000 +0200
@@ -1377,4 +1377,10 @@
 		int __user *optlen);
 int __sys_setsockopt(int fd, int level, int optname, char __user *optval,
 		int optlen);
+		
+#ifdef ASUSTOR_PATCH
+/* for corp.Asustor */
+long sys_gpioctl(unsigned int cmd, unsigned long args);
+#endif ///ASUSTOR_PATCH
+
 #endif

gpioctl() is never implemented either.

So it seems like their released kernel source is incomplete and thus probably not conforming to the GPL?

I extracted the bzImage from the ADM, and extracted that to vmlinux, and checked if the to_load_it87() and/or asustor_model_check() functions exist in it (ok, I just ran strings on it and grepped for those identifiers).

Anyway, they do.

I also built the kernel source from https://sourceforge.net/projects/asgpl/files/ADM4.1.0/4.1.0.RLQ1_and_above/x64g3_adm41_kernel_5_13_x/ myself (with the kernel config provided there), and the resulting vmlinux does not contain to_load_it87 or asustor_model_check, so I'm quite certain that the kernel source they're providing is incomplete.

I filed a support request with asustor, requesting the full source and describing my findings, we'll see how that goes..

Update: I haven't heard from asustor (yet?), but I also returned the AS6602T because I wasn't happy with the performance (m.2 SSDs were slower than SATA SSDs due to being connected with PCIe 2.0 x1). I now have a AS5402T (Nimbustor 2 Gen2) instead which is based on the newer Intel Jasper Lake platform, so the CPU is faster and it uses PCIe 3.0 instead of 2.0 which makes the m.2 SSDs twice as fast (~890MB/s instead of ~440MB/s), and (probably due to the faster CPU?) accessing samba shares over 2.5Gbit LAN is also faster (309MB/s instead of 262MB/s).
Still have the same problem with the blinking status LED (though it's smaller and less annoying in the Nimbustor).

Hi @DOcGui I patched the it87 branch to (hopefully) support the AS660xT as well (even found a way to disable the blinking green status LED), but I don't have such a device (anymore).
Can you test my branch? https://github.com/DanielGibson/asustor-platform-driver/tree/it87-jasperlake

All of @DanielGibson's changes have been merged in, so feel free to try the main branch @DOcGui and let us know if it works.