diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-03-19 17:23:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-03-19 17:23:30 -0400 |
commit | efac2483e8f289cd879e750075e63a9d16897e65 (patch) | |
tree | dec8a58b2bb5f7f17edef65dffb59f83bb297dac | |
parent | c698ca5278934c0ae32297a8725ced2e27585d7f (diff) | |
parent | d418ff56b8f2d2b296daafa8da151fe27689b757 (diff) |
Merge branch 'for-4.16-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata
Pull libata fixes from Tejun Heo:
"I sat on them too long and it's quite a few this late, but nothing has
a wide blast area. The changes are...
- Fix corner cases in SG command handling.
- Recent introduction of default powersaving mode config option
exposed several devices with broken powersaving behaviors. A number
of patches to update the blacklist accordingly.
- Fix a kernel panic on SAS hotplug.
- Other misc and device specific updates"
* 'for-4.16-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata:
libata: Modify quirks for MX100 to limit NCQ_TRIM quirk to MU01 version
libata: Make Crucial BX100 500GB LPM quirk apply to all firmware versions
libata: Apply NOLPM quirk to Crucial M500 480 and 960GB SSDs
libata: Enable queued TRIM for Samsung SSD 860
PCI: Add function 1 DMA alias quirk for Highpoint RocketRAID 644L
ahci: Add PCI-id for the Highpoint Rocketraid 644L card
ata: do not schedule hot plug if it is a sas host
libata: disable LPM for Crucial BX100 SSD 500GB drive
libata: Apply NOLPM quirk to Crucial MX100 512GB SSDs
libata: update documentation for sysfs interfaces
ata: sata_rcar: Remove unused variable in sata_rcar_init_controller()
libata: transport: cleanup documentation of sysfs interface
sata_rcar: Reset SATA PHY when Salvator-X board resumes
libata: don't try to pass through NCQ commands to non-NCQ devices
libata: remove WARN() for DMA or PIO command without data
libata: fix length validation of ATAPI-relayed SCSI commands
ata: libahci: fix comment indentation
ahci: Add check for device presence (PCIe hot unplug) in ahci_stop_engine()
libata: Fix compile warning with ATA_DEBUG enabled
-rw-r--r-- | Documentation/ABI/testing/sysfs-ata | 171 | ||||
-rw-r--r-- | Documentation/ABI/testing/sysfs-block-device | 58 | ||||
-rw-r--r-- | Documentation/ABI/testing/sysfs-class-scsi_host | 89 | ||||
-rw-r--r-- | drivers/ata/ahci.c | 4 | ||||
-rw-r--r-- | drivers/ata/libahci.c | 10 | ||||
-rw-r--r-- | drivers/ata/libahci_platform.c | 2 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 26 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 3 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c | 12 | ||||
-rw-r--r-- | drivers/ata/sata_rcar.c | 62 | ||||
-rw-r--r-- | drivers/pci/quirks.c | 2 |
11 files changed, 337 insertions, 102 deletions
diff --git a/Documentation/ABI/testing/sysfs-ata b/Documentation/ABI/testing/sysfs-ata index aa4296498859..9ab0ef1dd1c7 100644 --- a/Documentation/ABI/testing/sysfs-ata +++ b/Documentation/ABI/testing/sysfs-ata | |||
@@ -1,110 +1,139 @@ | |||
1 | What: /sys/class/ata_... | 1 | What: /sys/class/ata_... |
2 | Date: August 2008 | ||
3 | Contact: Gwendal Grignou<gwendal@google.com> | ||
4 | Description: | 2 | Description: |
5 | 3 | Provide a place in sysfs for storing the ATA topology of the | |
6 | Provide a place in sysfs for storing the ATA topology of the system. This allows | 4 | system. This allows retrieving various information about ATA |
7 | retrieving various information about ATA objects. | 5 | objects. |
8 | 6 | ||
9 | Files under /sys/class/ata_port | 7 | Files under /sys/class/ata_port |
10 | ------------------------------- | 8 | ------------------------------- |
11 | 9 | ||
12 | For each port, a directory ataX is created where X is the ata_port_id of | 10 | For each port, a directory ataX is created where X is the ata_port_id of the |
13 | the port. The device parent is the ata host device. | 11 | port. The device parent is the ata host device. |
14 | 12 | ||
15 | idle_irq (read) | ||
16 | 13 | ||
17 | Number of IRQ received by the port while idle [some ata HBA only]. | 14 | What: /sys/class/ata_port/ataX/nr_pmp_links |
15 | What: /sys/class/ata_port/ataX/idle_irq | ||
16 | Date: May, 2010 | ||
17 | KernelVersion: v2.6.37 | ||
18 | Contact: Gwendal Grignou <gwendal@chromium.org> | ||
19 | Description: | ||
20 | nr_pmp_links: (RO) If a SATA Port Multiplier (PM) is | ||
21 | connected, the number of links behind it. | ||
18 | 22 | ||
19 | nr_pmp_links (read) | 23 | idle_irq: (RO) Number of IRQ received by the port while |
24 | idle [some ata HBA only]. | ||
20 | 25 | ||
21 | If a SATA Port Multiplier (PM) is connected, number of link behind it. | 26 | |
27 | What: /sys/class/ata_port/ataX/port_no | ||
28 | Date: May, 2013 | ||
29 | KernelVersion: v3.11 | ||
30 | Contact: Gwendal Grignou <gwendal@chromium.org> | ||
31 | Description: | ||
32 | (RO) Host local port number. While registering host controller, | ||
33 | port numbers are tracked based upon number of ports available on | ||
34 | the controller. This attribute is needed by udev for composing | ||
35 | persistent links in /dev/disk/by-path. | ||
22 | 36 | ||
23 | Files under /sys/class/ata_link | 37 | Files under /sys/class/ata_link |
24 | ------------------------------- | 38 | ------------------------------- |
25 | 39 | ||
26 | Behind each port, there is a ata_link. If there is a SATA PM in the | 40 | Behind each port, there is a ata_link. If there is a SATA PM in the topology, 15 |
27 | topology, 15 ata_link objects are created. | 41 | ata_link objects are created. |
28 | |||
29 | If a link is behind a port, the directory name is linkX, where X is | ||
30 | ata_port_id of the port. | ||
31 | If a link is behind a PM, its name is linkX.Y where X is ata_port_id | ||
32 | of the parent port and Y the PM port. | ||
33 | 42 | ||
34 | hw_sata_spd_limit | 43 | If a link is behind a port, the directory name is linkX, where X is ata_port_id |
44 | of the port. If a link is behind a PM, its name is linkX.Y where X is | ||
45 | ata_port_id of the parent port and Y the PM port. | ||
35 | 46 | ||
36 | Maximum speed supported by the connected SATA device. | ||
37 | 47 | ||
38 | sata_spd_limit | 48 | What: /sys/class/ata_link/linkX[.Y]/hw_sata_spd_limit |
49 | What: /sys/class/ata_link/linkX[.Y]/sata_spd_limit | ||
50 | What: /sys/class/ata_link/linkX[.Y]/sata_spd | ||
51 | Date: May, 2010 | ||
52 | KernelVersion: v2.6.37 | ||
53 | Contact: Gwendal Grignou <gwendal@chromium.org> | ||
54 | Description: | ||
55 | hw_sata_spd_limit: (RO) Maximum speed supported by the | ||
56 | connected SATA device. | ||
39 | 57 | ||
40 | Maximum speed imposed by libata. | 58 | sata_spd_limit: (RO) Maximum speed imposed by libata. |
41 | 59 | ||
42 | sata_spd | 60 | sata_spd: (RO) Current speed of the link |
61 | eg. 1.5, 3 Gbps etc. | ||
43 | 62 | ||
44 | Current speed of the link [1.5, 3Gps,...]. | ||
45 | 63 | ||
46 | Files under /sys/class/ata_device | 64 | Files under /sys/class/ata_device |
47 | --------------------------------- | 65 | --------------------------------- |
48 | 66 | ||
49 | Behind each link, up to two ata device are created. | 67 | Behind each link, up to two ata devices are created. |
50 | The name of the directory is devX[.Y].Z where: | 68 | The name of the directory is devX[.Y].Z where: |
51 | - X is ata_port_id of the port where the device is connected, | 69 | - X is ata_port_id of the port where the device is connected, |
52 | - Y the port of the PM if any, and | 70 | - Y the port of the PM if any, and |
53 | - Z the device id: for PATA, there is usually 2 devices [0,1], | 71 | - Z the device id: for PATA, there is usually 2 devices [0,1], only 1 for SATA. |
54 | only 1 for SATA. | 72 | |
55 | 73 | ||
56 | class | 74 | What: /sys/class/ata_device/devX[.Y].Z/spdn_cnt |
57 | Device class. Can be "ata" for disk, "atapi" for packet device, | 75 | What: /sys/class/ata_device/devX[.Y].Z/gscr |
58 | "pmp" for PM, or "none" if no device was found behind the link. | 76 | What: /sys/class/ata_device/devX[.Y].Z/ering |
59 | 77 | What: /sys/class/ata_device/devX[.Y].Z/id | |
60 | dma_mode | 78 | What: /sys/class/ata_device/devX[.Y].Z/pio_mode |
79 | What: /sys/class/ata_device/devX[.Y].Z/xfer_mode | ||
80 | What: /sys/class/ata_device/devX[.Y].Z/dma_mode | ||
81 | What: /sys/class/ata_device/devX[.Y].Z/class | ||
82 | Date: May, 2010 | ||
83 | KernelVersion: v2.6.37 | ||
84 | Contact: Gwendal Grignou <gwendal@chromium.org> | ||
85 | Description: | ||
86 | spdn_cnt: (RO) Number of times libata decided to lower the | ||
87 | speed of link due to errors. | ||
61 | 88 | ||
62 | Transfer modes supported by the device when in DMA mode. | 89 | gscr: (RO) Cached result of the dump of PM GSCR |
63 | Mostly used by PATA device. | 90 | register. Valid registers are: |
64 | 91 | ||
65 | pio_mode | 92 | 0: SATA_PMP_GSCR_PROD_ID, |
93 | 1: SATA_PMP_GSCR_REV, | ||
94 | 2: SATA_PMP_GSCR_PORT_INFO, | ||
95 | 32: SATA_PMP_GSCR_ERROR, | ||
96 | 33: SATA_PMP_GSCR_ERROR_EN, | ||
97 | 64: SATA_PMP_GSCR_FEAT, | ||
98 | 96: SATA_PMP_GSCR_FEAT_EN, | ||
99 | 130: SATA_PMP_GSCR_SII_GPIO | ||
66 | 100 | ||
67 | Transfer modes supported by the device when in PIO mode. | 101 | Only valid if the device is a PM. |
68 | Mostly used by PATA device. | ||
69 | 102 | ||
70 | xfer_mode | 103 | ering: (RO) Formatted output of the error ring of the |
104 | device. | ||
71 | 105 | ||
72 | Current transfer mode. | 106 | id: (RO) Cached result of IDENTIFY command, as |
107 | described in ATA8 7.16 and 7.17. Only valid if | ||
108 | the device is not a PM. | ||
73 | 109 | ||
74 | id | 110 | pio_mode: (RO) Transfer modes supported by the device when |
111 | in PIO mode. Mostly used by PATA device. | ||
75 | 112 | ||
76 | Cached result of IDENTIFY command, as described in ATA8 7.16 and 7.17. | 113 | xfer_mode: (RO) Current transfer mode |
77 | Only valid if the device is not a PM. | ||
78 | 114 | ||
79 | gscr | 115 | dma_mode: (RO) Transfer modes supported by the device when |
116 | in DMA mode. Mostly used by PATA device. | ||
80 | 117 | ||
81 | Cached result of the dump of PM GSCR register. | 118 | class: (RO) Device class. Can be "ata" for disk, |
82 | Valid registers are: | 119 | "atapi" for packet device, "pmp" for PM, or |
83 | 0: SATA_PMP_GSCR_PROD_ID, | 120 | "none" if no device was found behind the link. |
84 | 1: SATA_PMP_GSCR_REV, | ||
85 | 2: SATA_PMP_GSCR_PORT_INFO, | ||
86 | 32: SATA_PMP_GSCR_ERROR, | ||
87 | 33: SATA_PMP_GSCR_ERROR_EN, | ||
88 | 64: SATA_PMP_GSCR_FEAT, | ||
89 | 96: SATA_PMP_GSCR_FEAT_EN, | ||
90 | 130: SATA_PMP_GSCR_SII_GPIO | ||
91 | Only valid if the device is a PM. | ||
92 | 121 | ||
93 | trim | ||
94 | 122 | ||
95 | Shows the DSM TRIM mode currently used by the device. Valid | 123 | What: /sys/class/ata_device/devX[.Y].Z/trim |
96 | values are: | 124 | Date: May, 2015 |
97 | unsupported: Drive does not support DSM TRIM | 125 | KernelVersion: v4.10 |
98 | unqueued: Drive supports unqueued DSM TRIM only | 126 | Contact: Gwendal Grignou <gwendal@chromium.org> |
99 | queued: Drive supports queued DSM TRIM | 127 | Description: |
100 | forced_unqueued: Drive's queued DSM support is known to be | 128 | (RO) Shows the DSM TRIM mode currently used by the device. Valid |
101 | buggy and only unqueued TRIM commands | 129 | values are: |
102 | are sent | ||
103 | 130 | ||
104 | spdn_cnt | 131 | unsupported: Drive does not support DSM TRIM |
105 | 132 | ||
106 | Number of time libata decided to lower the speed of link due to errors. | 133 | unqueued: Drive supports unqueued DSM TRIM only |
107 | 134 | ||
108 | ering | 135 | queued: Drive supports queued DSM TRIM |
109 | 136 | ||
110 | Formatted output of the error ring of the device. | 137 | forced_unqueued: Drive's queued DSM support is known to |
138 | be buggy and only unqueued TRIM commands | ||
139 | are sent | ||
diff --git a/Documentation/ABI/testing/sysfs-block-device b/Documentation/ABI/testing/sysfs-block-device new file mode 100644 index 000000000000..82ef6eab042d --- /dev/null +++ b/Documentation/ABI/testing/sysfs-block-device | |||
@@ -0,0 +1,58 @@ | |||
1 | What: /sys/block/*/device/sw_activity | ||
2 | Date: Jun, 2008 | ||
3 | KernelVersion: v2.6.27 | ||
4 | Contact: linux-ide@vger.kernel.org | ||
5 | Description: | ||
6 | (RW) Used by drivers which support software controlled activity | ||
7 | LEDs. | ||
8 | |||
9 | It has the following valid values: | ||
10 | |||
11 | 0 OFF - the LED is not activated on activity | ||
12 | 1 BLINK_ON - the LED blinks on every 10ms when activity is | ||
13 | detected. | ||
14 | 2 BLINK_OFF - the LED is on when idle, and blinks off | ||
15 | every 10ms when activity is detected. | ||
16 | |||
17 | Note that the user must turn sw_activity OFF it they wish to | ||
18 | control the activity LED via the em_message file. | ||
19 | |||
20 | |||
21 | What: /sys/block/*/device/unload_heads | ||
22 | Date: Sep, 2008 | ||
23 | KernelVersion: v2.6.28 | ||
24 | Contact: linux-ide@vger.kernel.org | ||
25 | Description: | ||
26 | (RW) Hard disk shock protection | ||
27 | |||
28 | Writing an integer value to this file will take the heads of the | ||
29 | respective drive off the platter and block all I/O operations | ||
30 | for the specified number of milliseconds. | ||
31 | |||
32 | - If the device does not support the unload heads feature, | ||
33 | access is denied with -EOPNOTSUPP. | ||
34 | - The maximal value accepted for a timeout is 30000 | ||
35 | milliseconds. | ||
36 | - A previously set timeout can be cancelled and disk can resume | ||
37 | normal operation immediately by specifying a timeout of 0. | ||
38 | - Some hard drives only comply with an earlier version of the | ||
39 | ATA standard, but support the unload feature nonetheless. | ||
40 | There is no safe way Linux can detect these devices, so this | ||
41 | is not enabled by default. If it is known that your device | ||
42 | does support the unload feature, then you can tell the kernel | ||
43 | to enable it by writing -1. It can be disabled again by | ||
44 | writing -2. | ||
45 | - Values below -2 are rejected with -EINVAL | ||
46 | |||
47 | For more information, see | ||
48 | Documentation/laptops/disk-shock-protection.txt | ||
49 | |||
50 | |||
51 | What: /sys/block/*/device/ncq_prio_enable | ||
52 | Date: Oct, 2016 | ||
53 | KernelVersion: v4.10 | ||
54 | Contact: linux-ide@vger.kernel.org | ||
55 | Description: | ||
56 | (RW) Write to the file to turn on or off the SATA ncq (native | ||
57 | command queueing) support. By default this feature is turned | ||
58 | off. | ||
diff --git a/Documentation/ABI/testing/sysfs-class-scsi_host b/Documentation/ABI/testing/sysfs-class-scsi_host index 0eb255e7db12..bafc59fd7b69 100644 --- a/Documentation/ABI/testing/sysfs-class-scsi_host +++ b/Documentation/ABI/testing/sysfs-class-scsi_host | |||
@@ -27,3 +27,92 @@ Description: This file contains the current status of the "SSD Smart Path" | |||
27 | the direct i/o path to physical devices. This setting is | 27 | the direct i/o path to physical devices. This setting is |
28 | controller wide, affecting all configured logical drives on the | 28 | controller wide, affecting all configured logical drives on the |
29 | controller. This file is readable and writable. | 29 | controller. This file is readable and writable. |
30 | |||
31 | What: /sys/class/scsi_host/hostX/link_power_management_policy | ||
32 | Date: Oct, 2007 | ||
33 | KernelVersion: v2.6.24 | ||
34 | Contact: linux-ide@vger.kernel.org | ||
35 | Description: | ||
36 | (RW) This parameter allows the user to read and set the link | ||
37 | (interface) power management. | ||
38 | |||
39 | There are four possible options: | ||
40 | |||
41 | min_power: Tell the controller to try to make the link use the | ||
42 | least possible power when possible. This may sacrifice some | ||
43 | performance due to increased latency when coming out of lower | ||
44 | power states. | ||
45 | |||
46 | max_performance: Generally, this means no power management. | ||
47 | Tell the controller to have performance be a priority over power | ||
48 | management. | ||
49 | |||
50 | medium_power: Tell the controller to enter a lower power state | ||
51 | when possible, but do not enter the lowest power state, thus | ||
52 | improving latency over min_power setting. | ||
53 | |||
54 | med_power_with_dipm: Identical to the existing medium_power | ||
55 | setting except that it enables dipm (device initiated power | ||
56 | management) on top, which makes it match the Windows IRST (Intel | ||
57 | Rapid Storage Technology) driver settings. This setting is also | ||
58 | close to min_power, except that: | ||
59 | a) It does not use host-initiated slumber mode, but it does | ||
60 | allow device-initiated slumber | ||
61 | b) It does not enable low power device sleep mode (DevSlp). | ||
62 | |||
63 | What: /sys/class/scsi_host/hostX/em_message | ||
64 | What: /sys/class/scsi_host/hostX/em_message_type | ||
65 | Date: Jun, 2008 | ||
66 | KernelVersion: v2.6.27 | ||
67 | Contact: linux-ide@vger.kernel.org | ||
68 | Description: | ||
69 | em_message: (RW) Enclosure management support. For the LED | ||
70 | protocol, writes and reads correspond to the LED message format | ||
71 | as defined in the AHCI spec. | ||
72 | |||
73 | The user must turn sw_activity (under /sys/block/*/device/) OFF | ||
74 | it they wish to control the activity LED via the em_message | ||
75 | file. | ||
76 | |||
77 | em_message_type: (RO) Displays the current enclosure management | ||
78 | protocol that is being used by the driver (for eg. LED, SAF-TE, | ||
79 | SES-2, SGPIO etc). | ||
80 | |||
81 | What: /sys/class/scsi_host/hostX/ahci_port_cmd | ||
82 | What: /sys/class/scsi_host/hostX/ahci_host_caps | ||
83 | What: /sys/class/scsi_host/hostX/ahci_host_cap2 | ||
84 | Date: Mar, 2010 | ||
85 | KernelVersion: v2.6.35 | ||
86 | Contact: linux-ide@vger.kernel.org | ||
87 | Description: | ||
88 | [to be documented] | ||
89 | |||
90 | What: /sys/class/scsi_host/hostX/ahci_host_version | ||
91 | Date: Mar, 2010 | ||
92 | KernelVersion: v2.6.35 | ||
93 | Contact: linux-ide@vger.kernel.org | ||
94 | Description: | ||
95 | (RO) Display the version of the AHCI spec implemented by the | ||
96 | host. | ||
97 | |||
98 | What: /sys/class/scsi_host/hostX/em_buffer | ||
99 | Date: Apr, 2010 | ||
100 | KernelVersion: v2.6.35 | ||
101 | Contact: linux-ide@vger.kernel.org | ||
102 | Description: | ||
103 | (RW) Allows access to AHCI EM (enclosure management) buffer | ||
104 | directly if the host supports EM. | ||
105 | |||
106 | For eg. the AHCI driver supports SGPIO EM messages but the | ||
107 | SATA/AHCI specs do not define the SGPIO message format of the EM | ||
108 | buffer. Different hardware(HW) vendors may have different | ||
109 | definitions. With the em_buffer attribute, this issue can be | ||
110 | solved by allowing HW vendors to provide userland drivers and | ||
111 | tools for their SGPIO initiators. | ||
112 | |||
113 | What: /sys/class/scsi_host/hostX/em_message_supported | ||
114 | Date: Oct, 2009 | ||
115 | KernelVersion: v2.6.39 | ||
116 | Contact: linux-ide@vger.kernel.org | ||
117 | Description: | ||
118 | (RO) Displays supported enclosure management message types. | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 355a95a83a34..1ff17799769d 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -550,7 +550,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
550 | .driver_data = board_ahci_yes_fbs }, | 550 | .driver_data = board_ahci_yes_fbs }, |
551 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230), | 551 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230), |
552 | .driver_data = board_ahci_yes_fbs }, | 552 | .driver_data = board_ahci_yes_fbs }, |
553 | { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0642), | 553 | { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0642), /* highpoint rocketraid 642L */ |
554 | .driver_data = board_ahci_yes_fbs }, | ||
555 | { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0645), /* highpoint rocketraid 644L */ | ||
554 | .driver_data = board_ahci_yes_fbs }, | 556 | .driver_data = board_ahci_yes_fbs }, |
555 | 557 | ||
556 | /* Promise */ | 558 | /* Promise */ |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index a0de7a38430c..7adcf3caabd0 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -665,6 +665,16 @@ int ahci_stop_engine(struct ata_port *ap) | |||
665 | if ((tmp & (PORT_CMD_START | PORT_CMD_LIST_ON)) == 0) | 665 | if ((tmp & (PORT_CMD_START | PORT_CMD_LIST_ON)) == 0) |
666 | return 0; | 666 | return 0; |
667 | 667 | ||
668 | /* | ||
669 | * Don't try to issue commands but return with ENODEV if the | ||
670 | * AHCI controller not available anymore (e.g. due to PCIe hot | ||
671 | * unplugging). Otherwise a 500ms delay for each port is added. | ||
672 | */ | ||
673 | if (tmp == 0xffffffff) { | ||
674 | dev_err(ap->host->dev, "AHCI controller unavailable!\n"); | ||
675 | return -ENODEV; | ||
676 | } | ||
677 | |||
668 | /* setting HBA to idle */ | 678 | /* setting HBA to idle */ |
669 | tmp &= ~PORT_CMD_START; | 679 | tmp &= ~PORT_CMD_START; |
670 | writel(tmp, port_mmio + PORT_CMD); | 680 | writel(tmp, port_mmio + PORT_CMD); |
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index 341d0ef82cbd..30cc8f1a31e1 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c | |||
@@ -340,7 +340,7 @@ static int ahci_platform_get_regulator(struct ahci_host_priv *hpriv, u32 port, | |||
340 | * 2) regulator for controlling the targets power (optional) | 340 | * 2) regulator for controlling the targets power (optional) |
341 | * 3) 0 - AHCI_MAX_CLKS clocks, as specified in the devs devicetree node, | 341 | * 3) 0 - AHCI_MAX_CLKS clocks, as specified in the devs devicetree node, |
342 | * or for non devicetree enabled platforms a single clock | 342 | * or for non devicetree enabled platforms a single clock |
343 | * 4) phys (optional) | 343 | * 4) phys (optional) |
344 | * | 344 | * |
345 | * RETURNS: | 345 | * RETURNS: |
346 | * The allocated ahci_host_priv on success, otherwise an ERR_PTR value | 346 | * The allocated ahci_host_priv on success, otherwise an ERR_PTR value |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 3c09122bf038..7431ccd03316 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4530,6 +4530,25 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4530 | { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER }, | 4530 | { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER }, |
4531 | { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, | 4531 | { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, |
4532 | 4532 | ||
4533 | /* Crucial BX100 SSD 500GB has broken LPM support */ | ||
4534 | { "CT500BX100SSD1", NULL, ATA_HORKAGE_NOLPM }, | ||
4535 | |||
4536 | /* 512GB MX100 with MU01 firmware has both queued TRIM and LPM issues */ | ||
4537 | { "Crucial_CT512MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | | ||
4538 | ATA_HORKAGE_ZERO_AFTER_TRIM | | ||
4539 | ATA_HORKAGE_NOLPM, }, | ||
4540 | /* 512GB MX100 with newer firmware has only LPM issues */ | ||
4541 | { "Crucial_CT512MX100*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM | | ||
4542 | ATA_HORKAGE_NOLPM, }, | ||
4543 | |||
4544 | /* 480GB+ M500 SSDs have both queued TRIM and LPM issues */ | ||
4545 | { "Crucial_CT480M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | | ||
4546 | ATA_HORKAGE_ZERO_AFTER_TRIM | | ||
4547 | ATA_HORKAGE_NOLPM, }, | ||
4548 | { "Crucial_CT960M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | | ||
4549 | ATA_HORKAGE_ZERO_AFTER_TRIM | | ||
4550 | ATA_HORKAGE_NOLPM, }, | ||
4551 | |||
4533 | /* devices that don't properly handle queued TRIM commands */ | 4552 | /* devices that don't properly handle queued TRIM commands */ |
4534 | { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | | 4553 | { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
4535 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, | 4554 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
@@ -4541,7 +4560,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4541 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, | 4560 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
4542 | { "Crucial_CT*MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | | 4561 | { "Crucial_CT*MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
4543 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, | 4562 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
4544 | { "Samsung SSD 8*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | | 4563 | { "Samsung SSD 840*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
4564 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, | ||
4565 | { "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | | ||
4545 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, | 4566 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
4546 | { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | | 4567 | { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
4547 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, | 4568 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
@@ -5401,8 +5422,7 @@ void ata_qc_issue(struct ata_queued_cmd *qc) | |||
5401 | * We guarantee to LLDs that they will have at least one | 5422 | * We guarantee to LLDs that they will have at least one |
5402 | * non-zero sg if the command is a data command. | 5423 | * non-zero sg if the command is a data command. |
5403 | */ | 5424 | */ |
5404 | if (WARN_ON_ONCE(ata_is_data(prot) && | 5425 | if (ata_is_data(prot) && (!qc->sg || !qc->n_elem || !qc->nbytes)) |
5405 | (!qc->sg || !qc->n_elem || !qc->nbytes))) | ||
5406 | goto sys_err; | 5426 | goto sys_err; |
5407 | 5427 | ||
5408 | if (ata_is_dma(prot) || (ata_is_pio(prot) && | 5428 | if (ata_is_dma(prot) || (ata_is_pio(prot) && |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 11c3137d7b0a..c016829a38fd 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -815,7 +815,8 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap) | |||
815 | 815 | ||
816 | if (ap->pflags & ATA_PFLAG_LOADING) | 816 | if (ap->pflags & ATA_PFLAG_LOADING) |
817 | ap->pflags &= ~ATA_PFLAG_LOADING; | 817 | ap->pflags &= ~ATA_PFLAG_LOADING; |
818 | else if (ap->pflags & ATA_PFLAG_SCSI_HOTPLUG) | 818 | else if ((ap->pflags & ATA_PFLAG_SCSI_HOTPLUG) && |
819 | !(ap->flags & ATA_FLAG_SAS_HOST)) | ||
819 | schedule_delayed_work(&ap->hotplug_task, 0); | 820 | schedule_delayed_work(&ap->hotplug_task, 0); |
820 | 821 | ||
821 | if (ap->pflags & ATA_PFLAG_RECOVERED) | 822 | if (ap->pflags & ATA_PFLAG_RECOVERED) |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 66be961c93a4..89a9d4a2efc8 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -3316,6 +3316,12 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc) | |||
3316 | goto invalid_fld; | 3316 | goto invalid_fld; |
3317 | } | 3317 | } |
3318 | 3318 | ||
3319 | /* We may not issue NCQ commands to devices not supporting NCQ */ | ||
3320 | if (ata_is_ncq(tf->protocol) && !ata_ncq_enabled(dev)) { | ||
3321 | fp = 1; | ||
3322 | goto invalid_fld; | ||
3323 | } | ||
3324 | |||
3319 | /* sanity check for pio multi commands */ | 3325 | /* sanity check for pio multi commands */ |
3320 | if ((cdb[1] & 0xe0) && !is_multi_taskfile(tf)) { | 3326 | if ((cdb[1] & 0xe0) && !is_multi_taskfile(tf)) { |
3321 | fp = 1; | 3327 | fp = 1; |
@@ -4282,7 +4288,7 @@ static inline void ata_scsi_dump_cdb(struct ata_port *ap, | |||
4282 | #ifdef ATA_DEBUG | 4288 | #ifdef ATA_DEBUG |
4283 | struct scsi_device *scsidev = cmd->device; | 4289 | struct scsi_device *scsidev = cmd->device; |
4284 | 4290 | ||
4285 | DPRINTK("CDB (%u:%d,%d,%d) %9ph\n", | 4291 | DPRINTK("CDB (%u:%d,%d,%lld) %9ph\n", |
4286 | ap->print_id, | 4292 | ap->print_id, |
4287 | scsidev->channel, scsidev->id, scsidev->lun, | 4293 | scsidev->channel, scsidev->id, scsidev->lun, |
4288 | cmd->cmnd); | 4294 | cmd->cmnd); |
@@ -4309,7 +4315,9 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, | |||
4309 | if (likely((scsi_op != ATA_16) || !atapi_passthru16)) { | 4315 | if (likely((scsi_op != ATA_16) || !atapi_passthru16)) { |
4310 | /* relay SCSI command to ATAPI device */ | 4316 | /* relay SCSI command to ATAPI device */ |
4311 | int len = COMMAND_SIZE(scsi_op); | 4317 | int len = COMMAND_SIZE(scsi_op); |
4312 | if (unlikely(len > scmd->cmd_len || len > dev->cdb_len)) | 4318 | if (unlikely(len > scmd->cmd_len || |
4319 | len > dev->cdb_len || | ||
4320 | scmd->cmd_len > ATAPI_CDB_LEN)) | ||
4313 | goto bad_cdb_len; | 4321 | goto bad_cdb_len; |
4314 | 4322 | ||
4315 | xlat_func = atapi_xlat; | 4323 | xlat_func = atapi_xlat; |
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c index 80ee2f2a50d0..6456e07db72a 100644 --- a/drivers/ata/sata_rcar.c +++ b/drivers/ata/sata_rcar.c | |||
@@ -146,6 +146,7 @@ | |||
146 | enum sata_rcar_type { | 146 | enum sata_rcar_type { |
147 | RCAR_GEN1_SATA, | 147 | RCAR_GEN1_SATA, |
148 | RCAR_GEN2_SATA, | 148 | RCAR_GEN2_SATA, |
149 | RCAR_GEN3_SATA, | ||
149 | RCAR_R8A7790_ES1_SATA, | 150 | RCAR_R8A7790_ES1_SATA, |
150 | }; | 151 | }; |
151 | 152 | ||
@@ -784,26 +785,11 @@ static void sata_rcar_setup_port(struct ata_host *host) | |||
784 | ioaddr->command_addr = ioaddr->cmd_addr + (ATA_REG_CMD << 2); | 785 | ioaddr->command_addr = ioaddr->cmd_addr + (ATA_REG_CMD << 2); |
785 | } | 786 | } |
786 | 787 | ||
787 | static void sata_rcar_init_controller(struct ata_host *host) | 788 | static void sata_rcar_init_module(struct sata_rcar_priv *priv) |
788 | { | 789 | { |
789 | struct sata_rcar_priv *priv = host->private_data; | ||
790 | void __iomem *base = priv->base; | 790 | void __iomem *base = priv->base; |
791 | u32 val; | 791 | u32 val; |
792 | 792 | ||
793 | /* reset and setup phy */ | ||
794 | switch (priv->type) { | ||
795 | case RCAR_GEN1_SATA: | ||
796 | sata_rcar_gen1_phy_init(priv); | ||
797 | break; | ||
798 | case RCAR_GEN2_SATA: | ||
799 | case RCAR_R8A7790_ES1_SATA: | ||
800 | sata_rcar_gen2_phy_init(priv); | ||
801 | break; | ||
802 | default: | ||
803 | dev_warn(host->dev, "SATA phy is not initialized\n"); | ||
804 | break; | ||
805 | } | ||
806 | |||
807 | /* SATA-IP reset state */ | 793 | /* SATA-IP reset state */ |
808 | val = ioread32(base + ATAPI_CONTROL1_REG); | 794 | val = ioread32(base + ATAPI_CONTROL1_REG); |
809 | val |= ATAPI_CONTROL1_RESET; | 795 | val |= ATAPI_CONTROL1_RESET; |
@@ -824,10 +810,33 @@ static void sata_rcar_init_controller(struct ata_host *host) | |||
824 | /* ack and mask */ | 810 | /* ack and mask */ |
825 | iowrite32(0, base + SATAINTSTAT_REG); | 811 | iowrite32(0, base + SATAINTSTAT_REG); |
826 | iowrite32(0x7ff, base + SATAINTMASK_REG); | 812 | iowrite32(0x7ff, base + SATAINTMASK_REG); |
813 | |||
827 | /* enable interrupts */ | 814 | /* enable interrupts */ |
828 | iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG); | 815 | iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG); |
829 | } | 816 | } |
830 | 817 | ||
818 | static void sata_rcar_init_controller(struct ata_host *host) | ||
819 | { | ||
820 | struct sata_rcar_priv *priv = host->private_data; | ||
821 | |||
822 | /* reset and setup phy */ | ||
823 | switch (priv->type) { | ||
824 | case RCAR_GEN1_SATA: | ||
825 | sata_rcar_gen1_phy_init(priv); | ||
826 | break; | ||
827 | case RCAR_GEN2_SATA: | ||
828 | case RCAR_GEN3_SATA: | ||
829 | case RCAR_R8A7790_ES1_SATA: | ||
830 | sata_rcar_gen2_phy_init(priv); | ||
831 | break; | ||
832 | default: | ||
833 | dev_warn(host->dev, "SATA phy is not initialized\n"); | ||
834 | break; | ||
835 | } | ||
836 | |||
837 | sata_rcar_init_module(priv); | ||
838 | } | ||
839 | |||
831 | static const struct of_device_id sata_rcar_match[] = { | 840 | static const struct of_device_id sata_rcar_match[] = { |
832 | { | 841 | { |
833 | /* Deprecated by "renesas,sata-r8a7779" */ | 842 | /* Deprecated by "renesas,sata-r8a7779" */ |
@@ -856,7 +865,7 @@ static const struct of_device_id sata_rcar_match[] = { | |||
856 | }, | 865 | }, |
857 | { | 866 | { |
858 | .compatible = "renesas,sata-r8a7795", | 867 | .compatible = "renesas,sata-r8a7795", |
859 | .data = (void *)RCAR_GEN2_SATA | 868 | .data = (void *)RCAR_GEN3_SATA |
860 | }, | 869 | }, |
861 | { | 870 | { |
862 | .compatible = "renesas,rcar-gen2-sata", | 871 | .compatible = "renesas,rcar-gen2-sata", |
@@ -864,7 +873,7 @@ static const struct of_device_id sata_rcar_match[] = { | |||
864 | }, | 873 | }, |
865 | { | 874 | { |
866 | .compatible = "renesas,rcar-gen3-sata", | 875 | .compatible = "renesas,rcar-gen3-sata", |
867 | .data = (void *)RCAR_GEN2_SATA | 876 | .data = (void *)RCAR_GEN3_SATA |
868 | }, | 877 | }, |
869 | { }, | 878 | { }, |
870 | }; | 879 | }; |
@@ -982,11 +991,18 @@ static int sata_rcar_resume(struct device *dev) | |||
982 | if (ret) | 991 | if (ret) |
983 | return ret; | 992 | return ret; |
984 | 993 | ||
985 | /* ack and mask */ | 994 | if (priv->type == RCAR_GEN3_SATA) { |
986 | iowrite32(0, base + SATAINTSTAT_REG); | 995 | sata_rcar_gen2_phy_init(priv); |
987 | iowrite32(0x7ff, base + SATAINTMASK_REG); | 996 | sata_rcar_init_module(priv); |
988 | /* enable interrupts */ | 997 | } else { |
989 | iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG); | 998 | /* ack and mask */ |
999 | iowrite32(0, base + SATAINTSTAT_REG); | ||
1000 | iowrite32(0x7ff, base + SATAINTMASK_REG); | ||
1001 | |||
1002 | /* enable interrupts */ | ||
1003 | iowrite32(ATAPI_INT_ENABLE_SATAINT, | ||
1004 | base + ATAPI_INT_ENABLE_REG); | ||
1005 | } | ||
990 | 1006 | ||
991 | ata_host_resume(host); | 1007 | ata_host_resume(host); |
992 | 1008 | ||
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 8b14bd326d4a..46d47bd6ca1f 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -3908,6 +3908,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9230, | |||
3908 | quirk_dma_func1_alias); | 3908 | quirk_dma_func1_alias); |
3909 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0642, | 3909 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0642, |
3910 | quirk_dma_func1_alias); | 3910 | quirk_dma_func1_alias); |
3911 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0645, | ||
3912 | quirk_dma_func1_alias); | ||
3911 | /* https://bugs.gentoo.org/show_bug.cgi?id=497630 */ | 3913 | /* https://bugs.gentoo.org/show_bug.cgi?id=497630 */ |
3912 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_JMICRON, | 3914 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_JMICRON, |
3913 | PCI_DEVICE_ID_JMICRON_JMB388_ESD, | 3915 | PCI_DEVICE_ID_JMICRON_JMB388_ESD, |