Some Synology network devices show vendor 0x1148 (Schneider & Koch) instead of 0x11ab (Marvell). Detect both. Improve spinning up of both disk drives on Synology DS20x by adding some more delays (directly at the start and after powering up the second drive).diff -r1.38 -r1.39 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
(phx)
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c 2017/08/03 09:42:34 1.38
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c 2017/08/03 19:22:15 1.39
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: brdsetup.c,v 1.38 2017/08/03 09:42:34 phx Exp $ */ | 1 | /* $NetBSD: brdsetup.c,v 1.39 2017/08/03 19:22:15 phx Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Tohru Nishimura. | 8 | * by Tohru Nishimura. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -259,27 +259,28 @@ brdsetup(void) | @@ -259,27 +259,28 @@ brdsetup(void) | |||
259 | brdtype = BRD_ENCOREPP1; | 259 | brdtype = BRD_ENCOREPP1; | |
260 | } | 260 | } | |
261 | else if (PCI_CLASS(pcicfgread(dev11, PCI_CLASS_REG)) == PCI_CLASS_ETH) { | 261 | else if (PCI_CLASS(pcicfgread(dev11, PCI_CLASS_REG)) == PCI_CLASS_ETH) { | |
262 | /* ADMtek AN985 (tlp) or RealTek 8169S (re) at dev 11 */ | 262 | /* ADMtek AN985 (tlp) or RealTek 8169S (re) at dev 11 */ | |
263 | if (PCI_VENDOR(pcicfgread(dev11, PCI_ID_REG)) == 0x1317) | 263 | if (PCI_VENDOR(pcicfgread(dev11, PCI_ID_REG)) == 0x1317) | |
264 | brdtype = BRD_KUROBOX; | 264 | brdtype = BRD_KUROBOX; | |
265 | else if (PCI_VENDOR(pcicfgread(dev11, PCI_ID_REG)) == 0x10ec) { | 265 | else if (PCI_VENDOR(pcicfgread(dev11, PCI_ID_REG)) == 0x10ec) { | |
266 | if (PCI_PRODUCT(pcicfgread(dev12,PCI_ID_REG)) != 0x3512) | 266 | if (PCI_PRODUCT(pcicfgread(dev12,PCI_ID_REG)) != 0x3512) | |
267 | brdtype = BRD_KUROBOX; | 267 | brdtype = BRD_KUROBOX; | |
268 | else | 268 | else | |
269 | brdtype = BRD_KUROBOXT4; | 269 | brdtype = BRD_KUROBOXT4; | |
270 | } | 270 | } | |
271 | } | 271 | } | |
272 | else if (PCI_VENDOR(pcicfgread(dev15, PCI_ID_REG)) == 0x11ab) { | 272 | else if (PCI_VENDOR(pcicfgread(dev15, PCI_ID_REG)) == 0x1148 | |
273 | || PCI_VENDOR(pcicfgread(dev15, PCI_ID_REG)) == 0x11ab) { | |||
273 | /* SKnet/Marvell (sk) at dev 15 */ | 274 | /* SKnet/Marvell (sk) at dev 15 */ | |
274 | brdtype = BRD_SYNOLOGY; | 275 | brdtype = BRD_SYNOLOGY; | |
275 | } | 276 | } | |
276 | else if (PCI_VENDOR(pcicfgread(dev13, PCI_ID_REG)) == 0x1106) { | 277 | else if (PCI_VENDOR(pcicfgread(dev13, PCI_ID_REG)) == 0x1106) { | |
277 | /* VIA 6410 (viaide) at dev 13 */ | 278 | /* VIA 6410 (viaide) at dev 13 */ | |
278 | brdtype = BRD_STORCENTER; | 279 | brdtype = BRD_STORCENTER; | |
279 | } | 280 | } | |
280 | else if (PCI_VENDOR(pcicfgread(dev16, PCI_ID_REG)) == 0x1191) { | 281 | else if (PCI_VENDOR(pcicfgread(dev16, PCI_ID_REG)) == 0x1191) { | |
281 | /* ACARD ATP865 (acardide) at dev 16 */ | 282 | /* ACARD ATP865 (acardide) at dev 16 */ | |
282 | brdtype = BRD_DLINKDSM; | 283 | brdtype = BRD_DLINKDSM; | |
283 | } | 284 | } | |
284 | else if (PCI_VENDOR(pcicfgread(dev16, PCI_ID_REG)) == 0x1283 | 285 | else if (PCI_VENDOR(pcicfgread(dev16, PCI_ID_REG)) == 0x1283 | |
285 | || PCI_VENDOR(pcicfgread(dev16, PCI_ID_REG)) == 0x1095) { | 286 | || PCI_VENDOR(pcicfgread(dev16, PCI_ID_REG)) == 0x1095) { | |
@@ -863,28 +864,31 @@ synopcifix(struct brdprop *brd) | @@ -863,28 +864,31 @@ synopcifix(struct brdprop *brd) | |||
863 | */ | 864 | */ | |
864 | do { | 865 | do { | |
865 | delay(1000 * 1000); | 866 | delay(1000 * 1000); | |
866 | v = SYNOCPLD_READ(1); | 867 | v = SYNOCPLD_READ(1); | |
867 | printf("Power state: %02x\r", v); | 868 | printf("Power state: %02x\r", v); | |
868 | } while (v != 0xff); | 869 | } while (v != 0xff); | |
869 | putchar('\n'); | 870 | putchar('\n'); | |
870 | } else if (model_name != NULL && model_name[2] == '2') { | 871 | } else if (model_name != NULL && model_name[2] == '2') { | |
871 | /* | 872 | /* | |
872 | * DS207 and DS209 have a second SATA disk, which is started | 873 | * DS207 and DS209 have a second SATA disk, which is started | |
873 | * with several seconds delay, but no CPLD register to | 874 | * with several seconds delay, but no CPLD register to | |
874 | * monitor the power state. So all we can do is to | 875 | * monitor the power state. So all we can do is to | |
875 | * wait some more seconds during SATA-init. | 876 | * wait some more seconds during SATA-init. | |
877 | * Also wait some seconds now, to make sure the first | |||
878 | * disk is ready after a cold start. | |||
876 | */ | 879 | */ | |
877 | sata_delay[1] = SYNO_DISK_DELAY; | 880 | sata_delay[1] = SYNO_DISK_DELAY; | |
881 | delay(10 * 1024 * 1024); | |||
878 | } | 882 | } | |
879 | 883 | |||
880 | cpld_done: | 884 | cpld_done: | |
881 | if (model_name != NULL) { | 885 | if (model_name != NULL) { | |
882 | snprintf(bi_model.name, sizeof(bi_model.name), "%s", model_name); | 886 | snprintf(bi_model.name, sizeof(bi_model.name), "%s", model_name); | |
883 | bi_model.flags = cpld | version | flags; | 887 | bi_model.flags = cpld | version | flags; | |
884 | } else | 888 | } else | |
885 | printf("No CPLD found. DS101/DS106.\n"); | 889 | printf("No CPLD found. DS101/DS106.\n"); | |
886 | } | 890 | } | |
887 | 891 | |||
888 | void | 892 | void | |
889 | synolaunch(struct brdprop *brd) | 893 | synolaunch(struct brdprop *brd) | |
890 | { | 894 | { |
--- src/sys/arch/sandpoint/stand/altboot/siisata.c 2015/09/30 14:14:32 1.6
+++ src/sys/arch/sandpoint/stand/altboot/siisata.c 2017/08/03 19:22:15 1.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: siisata.c,v 1.6 2015/09/30 14:14:32 phx Exp $ */ | 1 | /* $NetBSD: siisata.c,v 1.7 2017/08/03 19:22:15 phx Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Tohru Nishimura. | 8 | * by Tohru Nishimura. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -115,26 +115,35 @@ siisata_init(unsigned tag, void *data) | @@ -115,26 +115,35 @@ siisata_init(unsigned tag, void *data) | |||
115 | /* wait some seconds to power-up the drive */ | 115 | /* wait some seconds to power-up the drive */ | |
116 | for (retries = 0; retries < sata_delay[n]; retries++) { | 116 | for (retries = 0; retries < sata_delay[n]; retries++) { | |
117 | wakeup_drive(l, n); | 117 | wakeup_drive(l, n); | |
118 | printf("Waiting %2d seconds for powering up " | 118 | printf("Waiting %2d seconds for powering up " | |
119 | "port %d.\r", sata_delay[n] - retries, n); | 119 | "port %d.\r", sata_delay[n] - retries, n); | |
120 | delay(1000 * 1000); | 120 | delay(1000 * 1000); | |
121 | if ((l->presense[n] = satapresense(l, n)) != 0) | 121 | if ((l->presense[n] = satapresense(l, n)) != 0) | |
122 | break; | 122 | break; | |
123 | } | 123 | } | |
124 | putchar('\n'); | 124 | putchar('\n'); | |
125 | if (l->presense[n] == 0) { | 125 | if (l->presense[n] == 0) { | |
126 | DPRINTF(("port %d not present\n", n)); | 126 | DPRINTF(("port %d not present\n", n)); | |
127 | continue; | 127 | continue; | |
128 | } else { | |||
129 | /* | |||
130 | * XXX perform_atareset() does not work | |||
131 | * when the drive is not completely spun up? | |||
132 | * So insert another delay here. | |||
133 | */ | |||
134 | printf("Waiting 15 seconds for port %d " | |||
135 | "to spin up.\n", n); | |||
136 | delay(15 * 1000 * 1000); | |||
128 | } | 137 | } | |
129 | } | 138 | } | |
130 | if (atachkpwr(l, n) != ATA_PWR_ACTIVE) { | 139 | if (atachkpwr(l, n) != ATA_PWR_ACTIVE) { | |
131 | /* drive is probably sleeping, wake it up */ | 140 | /* drive is probably sleeping, wake it up */ | |
132 | for (retries = 0; retries < 20; retries++) { | 141 | for (retries = 0; retries < 20; retries++) { | |
133 | wakeup_drive(l, n); | 142 | wakeup_drive(l, n); | |
134 | DPRINTF(("port %d spinning up...\n", n)); | 143 | DPRINTF(("port %d spinning up...\n", n)); | |
135 | delay(1000 * 1000); | 144 | delay(1000 * 1000); | |
136 | l->presense[n] = perform_atareset(l, n); | 145 | l->presense[n] = perform_atareset(l, n); | |
137 | if (atachkpwr(l, n) == ATA_PWR_ACTIVE) | 146 | if (atachkpwr(l, n) == ATA_PWR_ACTIVE) | |
138 | break; | 147 | break; | |
139 | } | 148 | } | |
140 | } else { | 149 | } else { |
--- src/sys/arch/sandpoint/stand/altboot/version 2015/09/30 14:14:32 1.8
+++ src/sys/arch/sandpoint/stand/altboot/version 2017/08/03 19:22:15 1.9
@@ -8,13 +8,15 @@ | @@ -8,13 +8,15 @@ | |||
8 | 1.6: build altboot.img to fake a Linux kernel module, supports bootargs | 8 | 1.6: build altboot.img to fake a Linux kernel module, supports bootargs | |
9 | 1.7: ST1023/IP1000A driver, load kernels from memory (mem:), possibility | 9 | 1.7: ST1023/IP1000A driver, load kernels from memory (mem:), possibility | |
10 | to replace altboot with a new version while running, interactive | 10 | to replace altboot with a new version while running, interactive | |
11 | mode, default boot path is now wd0:netbsd in multiuser mode | 11 | mode, default boot path is now wd0:netbsd in multiuser mode | |
12 | 1.8: Iomega support, IT821x & VT6410 IDE support, fixed interrupt | 12 | 1.8: Iomega support, IT821x & VT6410 IDE support, fixed interrupt | |
13 | issue, exception handler and sat-controller test mode (DEBUG) | 13 | issue, exception handler and sat-controller test mode (DEBUG) | |
14 | 1.9: Support PATA drive configuration option. Wait until drives are | 14 | 1.9: Support PATA drive configuration option. Wait until drives are | |
15 | ready after cold-start. Wake up drives from standby mode. | 15 | ready after cold-start. Wake up drives from standby mode. | |
16 | A default command line can be saved to flash as initrd image. | 16 | A default command line can be saved to flash as initrd image. | |
17 | 1.10: Read correct MAC address from flash on QNAP-TS systems with re(4) | 17 | 1.10: Read correct MAC address from flash on QNAP-TS systems with re(4) | |
18 | NIC. | 18 | NIC. | |
19 | 1.11: Pass precise model information and flags with bootinfo. | 19 | 1.11: Pass precise model information and flags with bootinfo. | |
20 | Synology DS207/209 LED and 2nd disk power-up support. | 20 | Synology DS207/209 LED and 2nd disk power-up support. | |
21 | 1.12: Some more Synology DS20x fixes, to make sure both drives have been | |||
22 | spun up. Also detect PCI-vendor 0x1148 (S&K) as Synology. |