diff options
Diffstat (limited to 'drivers/ata')
52 files changed, 423 insertions, 178 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index aeadd00411a1..a67b8e7c712d 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -49,6 +49,17 @@ | |||
49 | #define DRV_NAME "ahci" | 49 | #define DRV_NAME "ahci" |
50 | #define DRV_VERSION "3.0" | 50 | #define DRV_VERSION "3.0" |
51 | 51 | ||
52 | /* Enclosure Management Control */ | ||
53 | #define EM_CTRL_MSG_TYPE 0x000f0000 | ||
54 | |||
55 | /* Enclosure Management LED Message Type */ | ||
56 | #define EM_MSG_LED_HBA_PORT 0x0000000f | ||
57 | #define EM_MSG_LED_PMP_SLOT 0x0000ff00 | ||
58 | #define EM_MSG_LED_VALUE 0xffff0000 | ||
59 | #define EM_MSG_LED_VALUE_ACTIVITY 0x00070000 | ||
60 | #define EM_MSG_LED_VALUE_OFF 0xfff80000 | ||
61 | #define EM_MSG_LED_VALUE_ON 0x00010000 | ||
62 | |||
52 | static int ahci_skip_host_reset; | 63 | static int ahci_skip_host_reset; |
53 | module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); | 64 | module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); |
54 | MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); | 65 | MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); |
@@ -588,6 +599,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
588 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ | 599 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ |
589 | { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ | 600 | { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ |
590 | 601 | ||
602 | /* Promise */ | ||
603 | { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ | ||
604 | |||
591 | /* Generic, PCI class code for AHCI */ | 605 | /* Generic, PCI class code for AHCI */ |
592 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 606 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
593 | PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci }, | 607 | PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci }, |
@@ -1220,18 +1234,20 @@ static void ahci_sw_activity_blink(unsigned long arg) | |||
1220 | struct ahci_em_priv *emp = &pp->em_priv[link->pmp]; | 1234 | struct ahci_em_priv *emp = &pp->em_priv[link->pmp]; |
1221 | unsigned long led_message = emp->led_state; | 1235 | unsigned long led_message = emp->led_state; |
1222 | u32 activity_led_state; | 1236 | u32 activity_led_state; |
1237 | unsigned long flags; | ||
1223 | 1238 | ||
1224 | led_message &= 0xffff0000; | 1239 | led_message &= EM_MSG_LED_VALUE; |
1225 | led_message |= ap->port_no | (link->pmp << 8); | 1240 | led_message |= ap->port_no | (link->pmp << 8); |
1226 | 1241 | ||
1227 | /* check to see if we've had activity. If so, | 1242 | /* check to see if we've had activity. If so, |
1228 | * toggle state of LED and reset timer. If not, | 1243 | * toggle state of LED and reset timer. If not, |
1229 | * turn LED to desired idle state. | 1244 | * turn LED to desired idle state. |
1230 | */ | 1245 | */ |
1246 | spin_lock_irqsave(ap->lock, flags); | ||
1231 | if (emp->saved_activity != emp->activity) { | 1247 | if (emp->saved_activity != emp->activity) { |
1232 | emp->saved_activity = emp->activity; | 1248 | emp->saved_activity = emp->activity; |
1233 | /* get the current LED state */ | 1249 | /* get the current LED state */ |
1234 | activity_led_state = led_message & 0x00010000; | 1250 | activity_led_state = led_message & EM_MSG_LED_VALUE_ON; |
1235 | 1251 | ||
1236 | if (activity_led_state) | 1252 | if (activity_led_state) |
1237 | activity_led_state = 0; | 1253 | activity_led_state = 0; |
@@ -1239,17 +1255,18 @@ static void ahci_sw_activity_blink(unsigned long arg) | |||
1239 | activity_led_state = 1; | 1255 | activity_led_state = 1; |
1240 | 1256 | ||
1241 | /* clear old state */ | 1257 | /* clear old state */ |
1242 | led_message &= 0xfff8ffff; | 1258 | led_message &= ~EM_MSG_LED_VALUE_ACTIVITY; |
1243 | 1259 | ||
1244 | /* toggle state */ | 1260 | /* toggle state */ |
1245 | led_message |= (activity_led_state << 16); | 1261 | led_message |= (activity_led_state << 16); |
1246 | mod_timer(&emp->timer, jiffies + msecs_to_jiffies(100)); | 1262 | mod_timer(&emp->timer, jiffies + msecs_to_jiffies(100)); |
1247 | } else { | 1263 | } else { |
1248 | /* switch to idle */ | 1264 | /* switch to idle */ |
1249 | led_message &= 0xfff8ffff; | 1265 | led_message &= ~EM_MSG_LED_VALUE_ACTIVITY; |
1250 | if (emp->blink_policy == BLINK_OFF) | 1266 | if (emp->blink_policy == BLINK_OFF) |
1251 | led_message |= (1 << 16); | 1267 | led_message |= (1 << 16); |
1252 | } | 1268 | } |
1269 | spin_unlock_irqrestore(ap->lock, flags); | ||
1253 | ahci_transmit_led_message(ap, led_message, 4); | 1270 | ahci_transmit_led_message(ap, led_message, 4); |
1254 | } | 1271 | } |
1255 | 1272 | ||
@@ -1294,7 +1311,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, | |||
1294 | struct ahci_em_priv *emp; | 1311 | struct ahci_em_priv *emp; |
1295 | 1312 | ||
1296 | /* get the slot number from the message */ | 1313 | /* get the slot number from the message */ |
1297 | pmp = (state & 0x0000ff00) >> 8; | 1314 | pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8; |
1298 | if (pmp < MAX_SLOTS) | 1315 | if (pmp < MAX_SLOTS) |
1299 | emp = &pp->em_priv[pmp]; | 1316 | emp = &pp->em_priv[pmp]; |
1300 | else | 1317 | else |
@@ -1319,7 +1336,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, | |||
1319 | message[0] |= (4 << 8); | 1336 | message[0] |= (4 << 8); |
1320 | 1337 | ||
1321 | /* ignore 0:4 of byte zero, fill in port info yourself */ | 1338 | /* ignore 0:4 of byte zero, fill in port info yourself */ |
1322 | message[1] = ((state & 0xfffffff0) | ap->port_no); | 1339 | message[1] = ((state & ~EM_MSG_LED_HBA_PORT) | ap->port_no); |
1323 | 1340 | ||
1324 | /* write message to EM_LOC */ | 1341 | /* write message to EM_LOC */ |
1325 | writel(message[0], mmio + hpriv->em_loc); | 1342 | writel(message[0], mmio + hpriv->em_loc); |
@@ -1362,7 +1379,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf, | |||
1362 | state = simple_strtoul(buf, NULL, 0); | 1379 | state = simple_strtoul(buf, NULL, 0); |
1363 | 1380 | ||
1364 | /* get the slot number from the message */ | 1381 | /* get the slot number from the message */ |
1365 | pmp = (state & 0x0000ff00) >> 8; | 1382 | pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8; |
1366 | if (pmp < MAX_SLOTS) | 1383 | if (pmp < MAX_SLOTS) |
1367 | emp = &pp->em_priv[pmp]; | 1384 | emp = &pp->em_priv[pmp]; |
1368 | else | 1385 | else |
@@ -1373,7 +1390,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf, | |||
1373 | * activity led through em_message | 1390 | * activity led through em_message |
1374 | */ | 1391 | */ |
1375 | if (emp->blink_policy) | 1392 | if (emp->blink_policy) |
1376 | state &= 0xfff8ffff; | 1393 | state &= ~EM_MSG_LED_VALUE_ACTIVITY; |
1377 | 1394 | ||
1378 | return ahci_transmit_led_message(ap, state, size); | 1395 | return ahci_transmit_led_message(ap, state, size); |
1379 | } | 1396 | } |
@@ -1392,16 +1409,16 @@ static ssize_t ahci_activity_store(struct ata_device *dev, enum sw_activity val) | |||
1392 | link->flags &= ~(ATA_LFLAG_SW_ACTIVITY); | 1409 | link->flags &= ~(ATA_LFLAG_SW_ACTIVITY); |
1393 | 1410 | ||
1394 | /* set the LED to OFF */ | 1411 | /* set the LED to OFF */ |
1395 | port_led_state &= 0xfff80000; | 1412 | port_led_state &= EM_MSG_LED_VALUE_OFF; |
1396 | port_led_state |= (ap->port_no | (link->pmp << 8)); | 1413 | port_led_state |= (ap->port_no | (link->pmp << 8)); |
1397 | ahci_transmit_led_message(ap, port_led_state, 4); | 1414 | ahci_transmit_led_message(ap, port_led_state, 4); |
1398 | } else { | 1415 | } else { |
1399 | link->flags |= ATA_LFLAG_SW_ACTIVITY; | 1416 | link->flags |= ATA_LFLAG_SW_ACTIVITY; |
1400 | if (val == BLINK_OFF) { | 1417 | if (val == BLINK_OFF) { |
1401 | /* set LED to ON for idle */ | 1418 | /* set LED to ON for idle */ |
1402 | port_led_state &= 0xfff80000; | 1419 | port_led_state &= EM_MSG_LED_VALUE_OFF; |
1403 | port_led_state |= (ap->port_no | (link->pmp << 8)); | 1420 | port_led_state |= (ap->port_no | (link->pmp << 8)); |
1404 | port_led_state |= 0x00010000; /* check this */ | 1421 | port_led_state |= EM_MSG_LED_VALUE_ON; /* check this */ |
1405 | ahci_transmit_led_message(ap, port_led_state, 4); | 1422 | ahci_transmit_led_message(ap, port_led_state, 4); |
1406 | } | 1423 | } |
1407 | } | 1424 | } |
@@ -2612,7 +2629,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2612 | u32 em_loc = readl(mmio + HOST_EM_LOC); | 2629 | u32 em_loc = readl(mmio + HOST_EM_LOC); |
2613 | u32 em_ctl = readl(mmio + HOST_EM_CTL); | 2630 | u32 em_ctl = readl(mmio + HOST_EM_CTL); |
2614 | 2631 | ||
2615 | messages = (em_ctl & 0x000f0000) >> 16; | 2632 | messages = (em_ctl & EM_CTRL_MSG_TYPE) >> 16; |
2616 | 2633 | ||
2617 | /* we only support LED message type right now */ | 2634 | /* we only support LED message type right now */ |
2618 | if ((messages & 0x01) && (ahci_em_messages == 1)) { | 2635 | if ((messages & 0x01) && (ahci_em_messages == 1)) { |
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index 75a406f5e694..5c33767e66de 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * ata_generic.c - Generic PATA/SATA controller driver. | 2 | * ata_generic.c - Generic PATA/SATA controller driver. |
3 | * Copyright 2005 Red Hat Inc <alan@redhat.com>, all rights reserved. | 3 | * Copyright 2005 Red Hat Inc, all rights reserved. |
4 | * | 4 | * |
5 | * Elements from ide/pci/generic.c | 5 | * Elements from ide/pci/generic.c |
6 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> | 6 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index e9e32ed6b1a3..8e37be19bbf5 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -14,7 +14,7 @@ | |||
14 | * | 14 | * |
15 | * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer | 15 | * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer |
16 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> | 16 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> |
17 | * Copyright (C) 2003 Red Hat Inc <alan@redhat.com> | 17 | * Copyright (C) 2003 Red Hat Inc |
18 | * | 18 | * |
19 | * | 19 | * |
20 | * This program is free software; you can redistribute it and/or modify | 20 | * This program is free software; you can redistribute it and/or modify |
@@ -738,7 +738,6 @@ static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
738 | * do_pata_set_dmamode - Initialize host controller PATA PIO timings | 738 | * do_pata_set_dmamode - Initialize host controller PATA PIO timings |
739 | * @ap: Port whose timings we are configuring | 739 | * @ap: Port whose timings we are configuring |
740 | * @adev: Drive in question | 740 | * @adev: Drive in question |
741 | * @udma: udma mode, 0 - 6 | ||
742 | * @isich: set if the chip is an ICH device | 741 | * @isich: set if the chip is an ICH device |
743 | * | 742 | * |
744 | * Set UDMA mode for device, in host controller PCI config space. | 743 | * Set UDMA mode for device, in host controller PCI config space. |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 8cb0b360bfd8..4214bfb13bbd 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -612,7 +612,7 @@ u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev) | |||
612 | if (tf->flags & ATA_TFLAG_LBA48) { | 612 | if (tf->flags & ATA_TFLAG_LBA48) { |
613 | block |= (u64)tf->hob_lbah << 40; | 613 | block |= (u64)tf->hob_lbah << 40; |
614 | block |= (u64)tf->hob_lbam << 32; | 614 | block |= (u64)tf->hob_lbam << 32; |
615 | block |= tf->hob_lbal << 24; | 615 | block |= (u64)tf->hob_lbal << 24; |
616 | } else | 616 | } else |
617 | block |= (tf->device & 0xf) << 24; | 617 | block |= (tf->device & 0xf) << 24; |
618 | 618 | ||
@@ -1268,7 +1268,7 @@ u64 ata_tf_to_lba48(const struct ata_taskfile *tf) | |||
1268 | 1268 | ||
1269 | sectors |= ((u64)(tf->hob_lbah & 0xff)) << 40; | 1269 | sectors |= ((u64)(tf->hob_lbah & 0xff)) << 40; |
1270 | sectors |= ((u64)(tf->hob_lbam & 0xff)) << 32; | 1270 | sectors |= ((u64)(tf->hob_lbam & 0xff)) << 32; |
1271 | sectors |= (tf->hob_lbal & 0xff) << 24; | 1271 | sectors |= ((u64)(tf->hob_lbal & 0xff)) << 24; |
1272 | sectors |= (tf->lbah & 0xff) << 16; | 1272 | sectors |= (tf->lbah & 0xff) << 16; |
1273 | sectors |= (tf->lbam & 0xff) << 8; | 1273 | sectors |= (tf->lbam & 0xff) << 8; |
1274 | sectors |= (tf->lbal & 0xff); | 1274 | sectors |= (tf->lbal & 0xff); |
@@ -1602,7 +1602,6 @@ unsigned long ata_id_xfermask(const u16 *id) | |||
1602 | /** | 1602 | /** |
1603 | * ata_pio_queue_task - Queue port_task | 1603 | * ata_pio_queue_task - Queue port_task |
1604 | * @ap: The ata_port to queue port_task for | 1604 | * @ap: The ata_port to queue port_task for |
1605 | * @fn: workqueue function to be scheduled | ||
1606 | * @data: data for @fn to use | 1605 | * @data: data for @fn to use |
1607 | * @delay: delay time in msecs for workqueue function | 1606 | * @delay: delay time in msecs for workqueue function |
1608 | * | 1607 | * |
@@ -1713,6 +1712,8 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, | |||
1713 | else | 1712 | else |
1714 | tag = 0; | 1713 | tag = 0; |
1715 | 1714 | ||
1715 | if (test_and_set_bit(tag, &ap->qc_allocated)) | ||
1716 | BUG(); | ||
1716 | qc = __ata_qc_from_tag(ap, tag); | 1717 | qc = __ata_qc_from_tag(ap, tag); |
1717 | 1718 | ||
1718 | qc->tag = tag; | 1719 | qc->tag = tag; |
@@ -2159,6 +2160,10 @@ retry: | |||
2159 | static inline u8 ata_dev_knobble(struct ata_device *dev) | 2160 | static inline u8 ata_dev_knobble(struct ata_device *dev) |
2160 | { | 2161 | { |
2161 | struct ata_port *ap = dev->link->ap; | 2162 | struct ata_port *ap = dev->link->ap; |
2163 | |||
2164 | if (ata_dev_blacklisted(dev) & ATA_HORKAGE_BRIDGE_OK) | ||
2165 | return 0; | ||
2166 | |||
2162 | return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id))); | 2167 | return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id))); |
2163 | } | 2168 | } |
2164 | 2169 | ||
@@ -4021,6 +4026,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4021 | 4026 | ||
4022 | /* Weird ATAPI devices */ | 4027 | /* Weird ATAPI devices */ |
4023 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, | 4028 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, |
4029 | { "QUANTUM DAT DAT72-000", NULL, ATA_HORKAGE_ATAPI_MOD16_DMA }, | ||
4024 | 4030 | ||
4025 | /* Devices we expect to fail diagnostics */ | 4031 | /* Devices we expect to fail diagnostics */ |
4026 | 4032 | ||
@@ -4063,6 +4069,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4063 | { "TSSTcorp CDDVDW SH-S202N", "SB00", ATA_HORKAGE_IVB, }, | 4069 | { "TSSTcorp CDDVDW SH-S202N", "SB00", ATA_HORKAGE_IVB, }, |
4064 | { "TSSTcorp CDDVDW SH-S202N", "SB01", ATA_HORKAGE_IVB, }, | 4070 | { "TSSTcorp CDDVDW SH-S202N", "SB01", ATA_HORKAGE_IVB, }, |
4065 | 4071 | ||
4072 | /* Devices that do not need bridging limits applied */ | ||
4073 | { "MTRON MSP-SATA*", NULL, ATA_HORKAGE_BRIDGE_OK, }, | ||
4074 | |||
4066 | /* End Marker */ | 4075 | /* End Marker */ |
4067 | { } | 4076 | { } |
4068 | }; | 4077 | }; |
@@ -4156,29 +4165,33 @@ static int cable_is_40wire(struct ata_port *ap) | |||
4156 | struct ata_link *link; | 4165 | struct ata_link *link; |
4157 | struct ata_device *dev; | 4166 | struct ata_device *dev; |
4158 | 4167 | ||
4159 | /* If the controller thinks we are 40 wire, we are */ | 4168 | /* If the controller thinks we are 40 wire, we are. */ |
4160 | if (ap->cbl == ATA_CBL_PATA40) | 4169 | if (ap->cbl == ATA_CBL_PATA40) |
4161 | return 1; | 4170 | return 1; |
4162 | /* If the controller thinks we are 80 wire, we are */ | 4171 | |
4172 | /* If the controller thinks we are 80 wire, we are. */ | ||
4163 | if (ap->cbl == ATA_CBL_PATA80 || ap->cbl == ATA_CBL_SATA) | 4173 | if (ap->cbl == ATA_CBL_PATA80 || ap->cbl == ATA_CBL_SATA) |
4164 | return 0; | 4174 | return 0; |
4165 | /* If the system is known to be 40 wire short cable (eg laptop), | 4175 | |
4166 | then we allow 80 wire modes even if the drive isn't sure */ | 4176 | /* If the system is known to be 40 wire short cable (eg |
4177 | * laptop), then we allow 80 wire modes even if the drive | ||
4178 | * isn't sure. | ||
4179 | */ | ||
4167 | if (ap->cbl == ATA_CBL_PATA40_SHORT) | 4180 | if (ap->cbl == ATA_CBL_PATA40_SHORT) |
4168 | return 0; | 4181 | return 0; |
4169 | /* If the controller doesn't know we scan | 4182 | |
4170 | 4183 | /* If the controller doesn't know, we scan. | |
4171 | - Note: We look for all 40 wire detects at this point. | 4184 | * |
4172 | Any 80 wire detect is taken to be 80 wire cable | 4185 | * Note: We look for all 40 wire detects at this point. Any |
4173 | because | 4186 | * 80 wire detect is taken to be 80 wire cable because |
4174 | - In many setups only the one drive (slave if present) | 4187 | * - in many setups only the one drive (slave if present) will |
4175 | will give a valid detect | 4188 | * give a valid detect |
4176 | - If you have a non detect capable drive you don't | 4189 | * - if you have a non detect capable drive you don't want it |
4177 | want it to colour the choice | 4190 | * to colour the choice |
4178 | */ | 4191 | */ |
4179 | ata_port_for_each_link(link, ap) { | 4192 | ata_port_for_each_link(link, ap) { |
4180 | ata_link_for_each_dev(dev, link) { | 4193 | ata_link_for_each_dev(dev, link) { |
4181 | if (!ata_is_40wire(dev)) | 4194 | if (ata_dev_enabled(dev) && !ata_is_40wire(dev)) |
4182 | return 0; | 4195 | return 0; |
4183 | } | 4196 | } |
4184 | } | 4197 | } |
@@ -4434,7 +4447,8 @@ int atapi_check_dma(struct ata_queued_cmd *qc) | |||
4434 | /* Don't allow DMA if it isn't multiple of 16 bytes. Quite a | 4447 | /* Don't allow DMA if it isn't multiple of 16 bytes. Quite a |
4435 | * few ATAPI devices choke on such DMA requests. | 4448 | * few ATAPI devices choke on such DMA requests. |
4436 | */ | 4449 | */ |
4437 | if (unlikely(qc->nbytes & 15)) | 4450 | if (!(qc->dev->horkage & ATA_HORKAGE_ATAPI_MOD16_DMA) && |
4451 | unlikely(qc->nbytes & 15)) | ||
4438 | return 1; | 4452 | return 1; |
4439 | 4453 | ||
4440 | if (ap->ops->check_atapi_dma) | 4454 | if (ap->ops->check_atapi_dma) |
@@ -4551,27 +4565,55 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
4551 | } | 4565 | } |
4552 | 4566 | ||
4553 | /** | 4567 | /** |
4554 | * ata_qc_new_init - Request an available ATA command, and initialize it | 4568 | * ata_qc_new - Request an available ATA command, for queueing |
4569 | * @ap: Port associated with device @dev | ||
4555 | * @dev: Device from whom we request an available command structure | 4570 | * @dev: Device from whom we request an available command structure |
4556 | * | 4571 | * |
4557 | * LOCKING: | 4572 | * LOCKING: |
4558 | * None. | 4573 | * None. |
4559 | */ | 4574 | */ |
4560 | 4575 | ||
4561 | struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag) | 4576 | static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) |
4562 | { | 4577 | { |
4563 | struct ata_port *ap = dev->link->ap; | 4578 | struct ata_queued_cmd *qc = NULL; |
4564 | struct ata_queued_cmd *qc; | 4579 | unsigned int i; |
4565 | 4580 | ||
4581 | /* no command while frozen */ | ||
4566 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) | 4582 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) |
4567 | return NULL; | 4583 | return NULL; |
4568 | 4584 | ||
4569 | qc = __ata_qc_from_tag(ap, tag); | 4585 | /* the last tag is reserved for internal command. */ |
4586 | for (i = 0; i < ATA_MAX_QUEUE - 1; i++) | ||
4587 | if (!test_and_set_bit(i, &ap->qc_allocated)) { | ||
4588 | qc = __ata_qc_from_tag(ap, i); | ||
4589 | break; | ||
4590 | } | ||
4591 | |||
4592 | if (qc) | ||
4593 | qc->tag = i; | ||
4594 | |||
4595 | return qc; | ||
4596 | } | ||
4597 | |||
4598 | /** | ||
4599 | * ata_qc_new_init - Request an available ATA command, and initialize it | ||
4600 | * @dev: Device from whom we request an available command structure | ||
4601 | * @tag: command tag | ||
4602 | * | ||
4603 | * LOCKING: | ||
4604 | * None. | ||
4605 | */ | ||
4606 | |||
4607 | struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev) | ||
4608 | { | ||
4609 | struct ata_port *ap = dev->link->ap; | ||
4610 | struct ata_queued_cmd *qc; | ||
4611 | |||
4612 | qc = ata_qc_new(ap); | ||
4570 | if (qc) { | 4613 | if (qc) { |
4571 | qc->scsicmd = NULL; | 4614 | qc->scsicmd = NULL; |
4572 | qc->ap = ap; | 4615 | qc->ap = ap; |
4573 | qc->dev = dev; | 4616 | qc->dev = dev; |
4574 | qc->tag = tag; | ||
4575 | 4617 | ||
4576 | ata_qc_reinit(qc); | 4618 | ata_qc_reinit(qc); |
4577 | } | 4619 | } |
@@ -4579,6 +4621,31 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag) | |||
4579 | return qc; | 4621 | return qc; |
4580 | } | 4622 | } |
4581 | 4623 | ||
4624 | /** | ||
4625 | * ata_qc_free - free unused ata_queued_cmd | ||
4626 | * @qc: Command to complete | ||
4627 | * | ||
4628 | * Designed to free unused ata_queued_cmd object | ||
4629 | * in case something prevents using it. | ||
4630 | * | ||
4631 | * LOCKING: | ||
4632 | * spin_lock_irqsave(host lock) | ||
4633 | */ | ||
4634 | void ata_qc_free(struct ata_queued_cmd *qc) | ||
4635 | { | ||
4636 | struct ata_port *ap = qc->ap; | ||
4637 | unsigned int tag; | ||
4638 | |||
4639 | WARN_ON(qc == NULL); /* ata_qc_from_tag _might_ return NULL */ | ||
4640 | |||
4641 | qc->flags = 0; | ||
4642 | tag = qc->tag; | ||
4643 | if (likely(ata_tag_valid(tag))) { | ||
4644 | qc->tag = ATA_TAG_POISON; | ||
4645 | clear_bit(tag, &ap->qc_allocated); | ||
4646 | } | ||
4647 | } | ||
4648 | |||
4582 | void __ata_qc_complete(struct ata_queued_cmd *qc) | 4649 | void __ata_qc_complete(struct ata_queued_cmd *qc) |
4583 | { | 4650 | { |
4584 | struct ata_port *ap = qc->ap; | 4651 | struct ata_port *ap = qc->ap; |
@@ -4643,7 +4710,6 @@ static void ata_verify_xfer(struct ata_queued_cmd *qc) | |||
4643 | /** | 4710 | /** |
4644 | * ata_qc_complete - Complete an active ATA command | 4711 | * ata_qc_complete - Complete an active ATA command |
4645 | * @qc: Command to complete | 4712 | * @qc: Command to complete |
4646 | * @err_mask: ATA Status register contents | ||
4647 | * | 4713 | * |
4648 | * Indicate to the mid and upper layers that an ATA | 4714 | * Indicate to the mid and upper layers that an ATA |
4649 | * command has completed, with either an ok or not-ok status. | 4715 | * command has completed, with either an ok or not-ok status. |
@@ -5924,7 +5990,7 @@ static void ata_port_detach(struct ata_port *ap) | |||
5924 | * to us. Restore SControl and disable all existing devices. | 5990 | * to us. Restore SControl and disable all existing devices. |
5925 | */ | 5991 | */ |
5926 | __ata_port_for_each_link(link, ap) { | 5992 | __ata_port_for_each_link(link, ap) { |
5927 | sata_scr_write(link, SCR_CONTROL, link->saved_scontrol); | 5993 | sata_scr_write(link, SCR_CONTROL, link->saved_scontrol & 0xff0); |
5928 | ata_link_for_each_dev(dev, link) | 5994 | ata_link_for_each_dev(dev, link) |
5929 | ata_dev_disable(dev); | 5995 | ata_dev_disable(dev); |
5930 | } | 5996 | } |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 5d687d7cffae..32da9a93ce44 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -603,13 +603,13 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
603 | ata_link_for_each_dev(dev, link) { | 603 | ata_link_for_each_dev(dev, link) { |
604 | int devno = dev->devno; | 604 | int devno = dev->devno; |
605 | 605 | ||
606 | if (!ata_dev_enabled(dev)) | ||
607 | continue; | ||
608 | |||
606 | ehc->saved_xfer_mode[devno] = dev->xfer_mode; | 609 | ehc->saved_xfer_mode[devno] = dev->xfer_mode; |
607 | if (ata_ncq_enabled(dev)) | 610 | if (ata_ncq_enabled(dev)) |
608 | ehc->saved_ncq_enabled |= 1 << devno; | 611 | ehc->saved_ncq_enabled |= 1 << devno; |
609 | } | 612 | } |
610 | |||
611 | /* set last reset timestamp to some time in the past */ | ||
612 | ehc->last_reset = jiffies - 60 * HZ; | ||
613 | } | 613 | } |
614 | 614 | ||
615 | ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; | 615 | ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; |
@@ -1161,6 +1161,7 @@ void ata_eh_detach_dev(struct ata_device *dev) | |||
1161 | { | 1161 | { |
1162 | struct ata_link *link = dev->link; | 1162 | struct ata_link *link = dev->link; |
1163 | struct ata_port *ap = link->ap; | 1163 | struct ata_port *ap = link->ap; |
1164 | struct ata_eh_context *ehc = &link->eh_context; | ||
1164 | unsigned long flags; | 1165 | unsigned long flags; |
1165 | 1166 | ||
1166 | ata_dev_disable(dev); | 1167 | ata_dev_disable(dev); |
@@ -1174,9 +1175,11 @@ void ata_eh_detach_dev(struct ata_device *dev) | |||
1174 | ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; | 1175 | ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; |
1175 | } | 1176 | } |
1176 | 1177 | ||
1177 | /* clear per-dev EH actions */ | 1178 | /* clear per-dev EH info */ |
1178 | ata_eh_clear_action(link, dev, &link->eh_info, ATA_EH_PERDEV_MASK); | 1179 | ata_eh_clear_action(link, dev, &link->eh_info, ATA_EH_PERDEV_MASK); |
1179 | ata_eh_clear_action(link, dev, &link->eh_context.i, ATA_EH_PERDEV_MASK); | 1180 | ata_eh_clear_action(link, dev, &link->eh_context.i, ATA_EH_PERDEV_MASK); |
1181 | ehc->saved_xfer_mode[dev->devno] = 0; | ||
1182 | ehc->saved_ncq_enabled &= ~(1 << dev->devno); | ||
1180 | 1183 | ||
1181 | spin_unlock_irqrestore(ap->lock, flags); | 1184 | spin_unlock_irqrestore(ap->lock, flags); |
1182 | } | 1185 | } |
@@ -2275,17 +2278,21 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2275 | if (link->flags & ATA_LFLAG_NO_SRST) | 2278 | if (link->flags & ATA_LFLAG_NO_SRST) |
2276 | softreset = NULL; | 2279 | softreset = NULL; |
2277 | 2280 | ||
2278 | now = jiffies; | 2281 | /* make sure each reset attemp is at least COOL_DOWN apart */ |
2279 | deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN); | 2282 | if (ehc->i.flags & ATA_EHI_DID_RESET) { |
2280 | if (time_before(now, deadline)) | 2283 | now = jiffies; |
2281 | schedule_timeout_uninterruptible(deadline - now); | 2284 | WARN_ON(time_after(ehc->last_reset, now)); |
2285 | deadline = ata_deadline(ehc->last_reset, | ||
2286 | ATA_EH_RESET_COOL_DOWN); | ||
2287 | if (time_before(now, deadline)) | ||
2288 | schedule_timeout_uninterruptible(deadline - now); | ||
2289 | } | ||
2282 | 2290 | ||
2283 | spin_lock_irqsave(ap->lock, flags); | 2291 | spin_lock_irqsave(ap->lock, flags); |
2284 | ap->pflags |= ATA_PFLAG_RESETTING; | 2292 | ap->pflags |= ATA_PFLAG_RESETTING; |
2285 | spin_unlock_irqrestore(ap->lock, flags); | 2293 | spin_unlock_irqrestore(ap->lock, flags); |
2286 | 2294 | ||
2287 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); | 2295 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); |
2288 | ehc->last_reset = jiffies; | ||
2289 | 2296 | ||
2290 | ata_link_for_each_dev(dev, link) { | 2297 | ata_link_for_each_dev(dev, link) { |
2291 | /* If we issue an SRST then an ATA drive (not ATAPI) | 2298 | /* If we issue an SRST then an ATA drive (not ATAPI) |
@@ -2373,7 +2380,6 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2373 | /* | 2380 | /* |
2374 | * Perform reset | 2381 | * Perform reset |
2375 | */ | 2382 | */ |
2376 | ehc->last_reset = jiffies; | ||
2377 | if (ata_is_host_link(link)) | 2383 | if (ata_is_host_link(link)) |
2378 | ata_eh_freeze_port(ap); | 2384 | ata_eh_freeze_port(ap); |
2379 | 2385 | ||
@@ -2385,6 +2391,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2385 | reset == softreset ? "soft" : "hard"); | 2391 | reset == softreset ? "soft" : "hard"); |
2386 | 2392 | ||
2387 | /* mark that this EH session started with reset */ | 2393 | /* mark that this EH session started with reset */ |
2394 | ehc->last_reset = jiffies; | ||
2388 | if (reset == hardreset) | 2395 | if (reset == hardreset) |
2389 | ehc->i.flags |= ATA_EHI_DID_HARDRESET; | 2396 | ehc->i.flags |= ATA_EHI_DID_HARDRESET; |
2390 | else | 2397 | else |
@@ -2529,7 +2536,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2529 | ata_eh_done(link, NULL, ATA_EH_RESET); | 2536 | ata_eh_done(link, NULL, ATA_EH_RESET); |
2530 | if (slave) | 2537 | if (slave) |
2531 | ata_eh_done(slave, NULL, ATA_EH_RESET); | 2538 | ata_eh_done(slave, NULL, ATA_EH_RESET); |
2532 | ehc->last_reset = jiffies; | 2539 | ehc->last_reset = jiffies; /* update to completion time */ |
2533 | ehc->i.action |= ATA_EH_REVALIDATE; | 2540 | ehc->i.action |= ATA_EH_REVALIDATE; |
2534 | 2541 | ||
2535 | rc = 0; | 2542 | rc = 0; |
@@ -2787,6 +2794,9 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
2787 | 2794 | ||
2788 | /* if data transfer is verified, clear DUBIOUS_XFER on ering top */ | 2795 | /* if data transfer is verified, clear DUBIOUS_XFER on ering top */ |
2789 | ata_link_for_each_dev(dev, link) { | 2796 | ata_link_for_each_dev(dev, link) { |
2797 | if (!ata_dev_enabled(dev)) | ||
2798 | continue; | ||
2799 | |||
2790 | if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) { | 2800 | if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) { |
2791 | struct ata_ering_entry *ent; | 2801 | struct ata_ering_entry *ent; |
2792 | 2802 | ||
@@ -2808,6 +2818,9 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
2808 | u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno]; | 2818 | u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno]; |
2809 | u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno)); | 2819 | u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno)); |
2810 | 2820 | ||
2821 | if (!ata_dev_enabled(dev)) | ||
2822 | continue; | ||
2823 | |||
2811 | if (dev->xfer_mode != saved_xfer_mode || | 2824 | if (dev->xfer_mode != saved_xfer_mode || |
2812 | ata_ncq_enabled(dev) != saved_ncq) | 2825 | ata_ncq_enabled(dev) != saved_ncq) |
2813 | dev->flags |= ATA_DFLAG_DUBIOUS_XFER; | 2826 | dev->flags |= ATA_DFLAG_DUBIOUS_XFER; |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 4b95c4387e9e..47c7afcb36f2 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -190,7 +190,7 @@ static ssize_t ata_scsi_park_show(struct device *device, | |||
190 | struct ata_port *ap; | 190 | struct ata_port *ap; |
191 | struct ata_link *link; | 191 | struct ata_link *link; |
192 | struct ata_device *dev; | 192 | struct ata_device *dev; |
193 | unsigned long flags; | 193 | unsigned long flags, now; |
194 | unsigned int uninitialized_var(msecs); | 194 | unsigned int uninitialized_var(msecs); |
195 | int rc = 0; | 195 | int rc = 0; |
196 | 196 | ||
@@ -208,10 +208,11 @@ static ssize_t ata_scsi_park_show(struct device *device, | |||
208 | } | 208 | } |
209 | 209 | ||
210 | link = dev->link; | 210 | link = dev->link; |
211 | now = jiffies; | ||
211 | if (ap->pflags & ATA_PFLAG_EH_IN_PROGRESS && | 212 | if (ap->pflags & ATA_PFLAG_EH_IN_PROGRESS && |
212 | link->eh_context.unloaded_mask & (1 << dev->devno) && | 213 | link->eh_context.unloaded_mask & (1 << dev->devno) && |
213 | time_after(dev->unpark_deadline, jiffies)) | 214 | time_after(dev->unpark_deadline, now)) |
214 | msecs = jiffies_to_msecs(dev->unpark_deadline - jiffies); | 215 | msecs = jiffies_to_msecs(dev->unpark_deadline - now); |
215 | else | 216 | else |
216 | msecs = 0; | 217 | msecs = 0; |
217 | 218 | ||
@@ -708,11 +709,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev, | |||
708 | { | 709 | { |
709 | struct ata_queued_cmd *qc; | 710 | struct ata_queued_cmd *qc; |
710 | 711 | ||
711 | if (cmd->request->tag != -1) | 712 | qc = ata_qc_new_init(dev); |
712 | qc = ata_qc_new_init(dev, cmd->request->tag); | ||
713 | else | ||
714 | qc = ata_qc_new_init(dev, 0); | ||
715 | |||
716 | if (qc) { | 713 | if (qc) { |
717 | qc->scsicmd = cmd; | 714 | qc->scsicmd = cmd; |
718 | qc->scsidone = done; | 715 | qc->scsidone = done; |
@@ -1107,8 +1104,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, | |||
1107 | 1104 | ||
1108 | depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); | 1105 | depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); |
1109 | depth = min(ATA_MAX_QUEUE - 1, depth); | 1106 | depth = min(ATA_MAX_QUEUE - 1, depth); |
1110 | scsi_set_tag_type(sdev, MSG_SIMPLE_TAG); | 1107 | scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth); |
1111 | scsi_activate_tcq(sdev, depth); | ||
1112 | } | 1108 | } |
1113 | 1109 | ||
1114 | return 0; | 1110 | return 0; |
@@ -1948,11 +1944,6 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) | |||
1948 | hdr[1] |= (1 << 7); | 1944 | hdr[1] |= (1 << 7); |
1949 | 1945 | ||
1950 | memcpy(rbuf, hdr, sizeof(hdr)); | 1946 | memcpy(rbuf, hdr, sizeof(hdr)); |
1951 | |||
1952 | /* if ncq, set tags supported */ | ||
1953 | if (ata_id_has_ncq(args->id)) | ||
1954 | rbuf[7] |= (1 << 1); | ||
1955 | |||
1956 | memcpy(&rbuf[8], "ATA ", 8); | 1947 | memcpy(&rbuf[8], "ATA ", 8); |
1957 | ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16); | 1948 | ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16); |
1958 | ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4); | 1949 | ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4); |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 4b4739486327..9033d164c4ec 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -1227,10 +1227,19 @@ fsm_start: | |||
1227 | /* ATA PIO protocol */ | 1227 | /* ATA PIO protocol */ |
1228 | if (unlikely((status & ATA_DRQ) == 0)) { | 1228 | if (unlikely((status & ATA_DRQ) == 0)) { |
1229 | /* handle BSY=0, DRQ=0 as error */ | 1229 | /* handle BSY=0, DRQ=0 as error */ |
1230 | if (likely(status & (ATA_ERR | ATA_DF))) | 1230 | if (likely(status & (ATA_ERR | ATA_DF))) { |
1231 | /* device stops HSM for abort/error */ | 1231 | /* device stops HSM for abort/error */ |
1232 | qc->err_mask |= AC_ERR_DEV; | 1232 | qc->err_mask |= AC_ERR_DEV; |
1233 | else { | 1233 | |
1234 | /* If diagnostic failed and this is | ||
1235 | * IDENTIFY, it's likely a phantom | ||
1236 | * device. Mark hint. | ||
1237 | */ | ||
1238 | if (qc->dev->horkage & | ||
1239 | ATA_HORKAGE_DIAGNOSTIC) | ||
1240 | qc->err_mask |= | ||
1241 | AC_ERR_NODEV_HINT; | ||
1242 | } else { | ||
1234 | /* HSM violation. Let EH handle this. | 1243 | /* HSM violation. Let EH handle this. |
1235 | * Phantom devices also trigger this | 1244 | * Phantom devices also trigger this |
1236 | * condition. Mark hint. | 1245 | * condition. Mark hint. |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index d3831d39bdaa..fe2839e58774 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -74,7 +74,7 @@ extern struct ata_link *ata_dev_phys_link(struct ata_device *dev); | |||
74 | extern void ata_force_cbl(struct ata_port *ap); | 74 | extern void ata_force_cbl(struct ata_port *ap); |
75 | extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); | 75 | extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); |
76 | extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); | 76 | extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); |
77 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag); | 77 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); |
78 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, | 78 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, |
79 | u64 block, u32 n_block, unsigned int tf_flags, | 79 | u64 block, u32 n_block, unsigned int tf_flags, |
80 | unsigned int tag); | 80 | unsigned int tag); |
@@ -103,6 +103,7 @@ extern int ata_dev_configure(struct ata_device *dev); | |||
103 | extern int sata_down_spd_limit(struct ata_link *link); | 103 | extern int sata_down_spd_limit(struct ata_link *link); |
104 | extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); | 104 | extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); |
105 | extern void ata_sg_clean(struct ata_queued_cmd *qc); | 105 | extern void ata_sg_clean(struct ata_queued_cmd *qc); |
106 | extern void ata_qc_free(struct ata_queued_cmd *qc); | ||
106 | extern void ata_qc_issue(struct ata_queued_cmd *qc); | 107 | extern void ata_qc_issue(struct ata_queued_cmd *qc); |
107 | extern void __ata_qc_complete(struct ata_queued_cmd *qc); | 108 | extern void __ata_qc_complete(struct ata_queued_cmd *qc); |
108 | extern int atapi_check_dma(struct ata_queued_cmd *qc); | 109 | extern int atapi_check_dma(struct ata_queued_cmd *qc); |
@@ -118,22 +119,6 @@ extern struct ata_port *ata_port_alloc(struct ata_host *host); | |||
118 | extern void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy); | 119 | extern void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy); |
119 | extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm); | 120 | extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm); |
120 | 121 | ||
121 | /** | ||
122 | * ata_qc_free - free unused ata_queued_cmd | ||
123 | * @qc: Command to complete | ||
124 | * | ||
125 | * Designed to free unused ata_queued_cmd object | ||
126 | * in case something prevents using it. | ||
127 | * | ||
128 | * LOCKING: | ||
129 | * spin_lock_irqsave(host lock) | ||
130 | */ | ||
131 | static inline void ata_qc_free(struct ata_queued_cmd *qc) | ||
132 | { | ||
133 | qc->flags = 0; | ||
134 | qc->tag = ATA_TAG_POISON; | ||
135 | } | ||
136 | |||
137 | /* libata-acpi.c */ | 122 | /* libata-acpi.c */ |
138 | #ifdef CONFIG_ATA_ACPI | 123 | #ifdef CONFIG_ATA_ACPI |
139 | extern void ata_acpi_associate_sata_port(struct ata_port *ap); | 124 | extern void ata_acpi_associate_sata_port(struct ata_port *ap); |
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c index eb919c16a03e..e2e332d8ff95 100644 --- a/drivers/ata/pata_acpi.c +++ b/drivers/ata/pata_acpi.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * ACPI PATA driver | 2 | * ACPI PATA driver |
3 | * | 3 | * |
4 | * (c) 2007 Red Hat <alan@redhat.com> | 4 | * (c) 2007 Red Hat |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index 5ca70fa1f587..73c466e452ca 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_ali.c - ALI 15x3 PATA for new ATA layer | 2 | * pata_ali.c - ALI 15x3 PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | ||
5 | * | 4 | * |
6 | * based in part upon | 5 | * based in part upon |
7 | * linux/drivers/ide/pci/alim15x3.c Version 0.17 2003/01/02 | 6 | * linux/drivers/ide/pci/alim15x3.c Version 0.17 2003/01/02 |
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c index 57dd00f463d3..0ec9c7d9fe9d 100644 --- a/drivers/ata/pata_amd.c +++ b/drivers/ata/pata_amd.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_amd.c - AMD PATA for new ATA layer | 2 | * pata_amd.c - AMD PATA for new ATA layer |
3 | * (C) 2005-2006 Red Hat Inc | 3 | * (C) 2005-2006 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | ||
5 | * | 4 | * |
6 | * Based on pata-sil680. Errata information is taken from data sheets | 5 | * Based on pata-sil680. Errata information is taken from data sheets |
7 | * and the amd74xx.c driver by Vojtech Pavlik. Nvidia SATA devices are | 6 | * and the amd74xx.c driver by Vojtech Pavlik. Nvidia SATA devices are |
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c index 0f513bc11193..6b3092c75ffe 100644 --- a/drivers/ata/pata_artop.c +++ b/drivers/ata/pata_artop.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_artop.c - ARTOP ATA controller driver | 2 | * pata_artop.c - ARTOP ATA controller driver |
3 | * | 3 | * |
4 | * (C) 2006 Red Hat <alan@redhat.com> | 4 | * (C) 2006 Red Hat |
5 | * (C) 2007 Bartlomiej Zolnierkiewicz | 5 | * (C) 2007 Bartlomiej Zolnierkiewicz |
6 | * | 6 | * |
7 | * Based in part on drivers/ide/pci/aec62xx.c | 7 | * Based in part on drivers/ide/pci/aec62xx.c |
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index e8a0d99d7356..0e2cde8f9973 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_atiixp.c - ATI PATA for new ATA layer | 2 | * pata_atiixp.c - ATI PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | ||
5 | * | 4 | * |
6 | * Based on | 5 | * Based on |
7 | * | 6 | * |
diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c index 2de30b990278..34a394264c3d 100644 --- a/drivers/ata/pata_cmd640.c +++ b/drivers/ata/pata_cmd640.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_cmd640.c - CMD640 PCI PATA for new ATA layer | 2 | * pata_cmd640.c - CMD640 PCI PATA for new ATA layer |
3 | * (C) 2007 Red Hat Inc | 3 | * (C) 2007 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | ||
5 | * | 4 | * |
6 | * Based upon | 5 | * Based upon |
7 | * linux/drivers/ide/pci/cmd640.c Version 1.02 Sep 01, 1996 | 6 | * linux/drivers/ide/pci/cmd640.c Version 1.02 Sep 01, 1996 |
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c index ddd09b7d98c9..3167d8fed2f2 100644 --- a/drivers/ata/pata_cmd64x.c +++ b/drivers/ata/pata_cmd64x.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_cmd64x.c - CMD64x PATA for new ATA layer | 2 | * pata_cmd64x.c - CMD64x PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | 4 | * Alan Cox <alan@lxorguk.ukuu.org.uk> |
5 | * | 5 | * |
6 | * Based upon | 6 | * Based upon |
7 | * linux/drivers/ide/pci/cmd64x.c Version 1.30 Sept 10, 2002 | 7 | * linux/drivers/ide/pci/cmd64x.c Version 1.30 Sept 10, 2002 |
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c index 0c4b271a9d5a..bba453381f44 100644 --- a/drivers/ata/pata_cs5530.c +++ b/drivers/ata/pata_cs5530.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata-cs5530.c - CS5530 PATA for new ATA layer | 2 | * pata-cs5530.c - CS5530 PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | ||
5 | * | 4 | * |
6 | * based upon cs5530.c by Mark Lord. | 5 | * based upon cs5530.c by Mark Lord. |
7 | * | 6 | * |
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c index f1b6556f0483..8b236af84c2e 100644 --- a/drivers/ata/pata_cs5535.c +++ b/drivers/ata/pata_cs5535.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata-cs5535.c - CS5535 PATA for new ATA layer | 2 | * pata-cs5535.c - CS5535 PATA for new ATA layer |
3 | * (C) 2005-2006 Red Hat Inc | 3 | * (C) 2005-2006 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | 4 | * Alan Cox <alan@lxorguk.ukuu.org.uk> |
5 | * | 5 | * |
6 | * based upon cs5535.c from AMD <Jens.Altmann@amd.com> as cleaned up and | 6 | * based upon cs5535.c from AMD <Jens.Altmann@amd.com> as cleaned up and |
7 | * made readable and Linux style by Wolfgang Zuleger <wolfgang.zuleger@gmx.de | 7 | * made readable and Linux style by Wolfgang Zuleger <wolfgang.zuleger@gmx.de |
@@ -72,7 +72,6 @@ | |||
72 | /** | 72 | /** |
73 | * cs5535_cable_detect - detect cable type | 73 | * cs5535_cable_detect - detect cable type |
74 | * @ap: Port to detect on | 74 | * @ap: Port to detect on |
75 | * @deadline: deadline jiffies for the operation | ||
76 | * | 75 | * |
77 | * Perform cable detection for ATA66 capable cable. Return a libata | 76 | * Perform cable detection for ATA66 capable cable. Return a libata |
78 | * cable type. | 77 | * cable type. |
diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c index 73f8332cb679..afed92976198 100644 --- a/drivers/ata/pata_cs5536.c +++ b/drivers/ata/pata_cs5536.c | |||
@@ -110,7 +110,6 @@ static inline int cs5536_write(struct pci_dev *pdev, int reg, int val) | |||
110 | /** | 110 | /** |
111 | * cs5536_cable_detect - detect cable type | 111 | * cs5536_cable_detect - detect cable type |
112 | * @ap: Port to detect on | 112 | * @ap: Port to detect on |
113 | * @deadline: deadline jiffies for the operation | ||
114 | * | 113 | * |
115 | * Perform cable detection for ATA66 capable cable. Return a libata | 114 | * Perform cable detection for ATA66 capable cable. Return a libata |
116 | * cable type. | 115 | * cable type. |
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c index 2ff62608ae37..d546425cd380 100644 --- a/drivers/ata/pata_cypress.c +++ b/drivers/ata/pata_cypress.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_cypress.c - Cypress PATA for new ATA layer | 2 | * pata_cypress.c - Cypress PATA for new ATA layer |
3 | * (C) 2006 Red Hat Inc | 3 | * (C) 2006 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | 4 | * Alan Cox |
5 | * | 5 | * |
6 | * Based heavily on | 6 | * Based heavily on |
7 | * linux/drivers/ide/pci/cy82c693.c Version 0.40 Sep. 10, 2002 | 7 | * linux/drivers/ide/pci/cy82c693.c Version 0.40 Sep. 10, 2002 |
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c index 9fba82976ba6..ac6392ea35b0 100644 --- a/drivers/ata/pata_efar.c +++ b/drivers/ata/pata_efar.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_efar.c - EFAR PIIX clone controller driver | 2 | * pata_efar.c - EFAR PIIX clone controller driver |
3 | * | 3 | * |
4 | * (C) 2005 Red Hat <alan@redhat.com> | 4 | * (C) 2005 Red Hat |
5 | * | 5 | * |
6 | * Some parts based on ata_piix.c by Jeff Garzik and others. | 6 | * Some parts based on ata_piix.c by Jeff Garzik and others. |
7 | * | 7 | * |
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c index 6a111baab523..15cdb9148aab 100644 --- a/drivers/ata/pata_isapnp.c +++ b/drivers/ata/pata_isapnp.c | |||
@@ -1,7 +1,7 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | * pata-isapnp.c - ISA PnP PATA controller driver. | 3 | * pata-isapnp.c - ISA PnP PATA controller driver. |
4 | * Copyright 2005/2006 Red Hat Inc <alan@redhat.com>, all rights reserved. | 4 | * Copyright 2005/2006 Red Hat Inc, all rights reserved. |
5 | * | 5 | * |
6 | * Based in part on ide-pnp.c by Andrey Panin <pazke@donpac.ru> | 6 | * Based in part on ide-pnp.c by Andrey Panin <pazke@donpac.ru> |
7 | */ | 7 | */ |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index 0221c9a46769..860ede526282 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_it821x.c - IT821x PATA for new ATA layer | 2 | * pata_it821x.c - IT821x PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | 4 | * Alan Cox <alan@lxorguk.ukuu.org.uk> |
5 | * (C) 2007 Bartlomiej Zolnierkiewicz | 5 | * (C) 2007 Bartlomiej Zolnierkiewicz |
6 | * | 6 | * |
7 | * based upon | 7 | * based upon |
@@ -10,7 +10,7 @@ | |||
10 | * | 10 | * |
11 | * linux/drivers/ide/pci/it821x.c Version 0.09 December 2004 | 11 | * linux/drivers/ide/pci/it821x.c Version 0.09 December 2004 |
12 | * | 12 | * |
13 | * Copyright (C) 2004 Red Hat <alan@redhat.com> | 13 | * Copyright (C) 2004 Red Hat |
14 | * | 14 | * |
15 | * May be copied or modified under the terms of the GNU General Public License | 15 | * May be copied or modified under the terms of the GNU General Public License |
16 | * Based in part on the ITE vendor provided SCSI driver. | 16 | * Based in part on the ITE vendor provided SCSI driver. |
@@ -557,9 +557,8 @@ static unsigned int it821x_read_id(struct ata_device *adev, | |||
557 | if (strstr(model_num, "Integrated Technology Express")) { | 557 | if (strstr(model_num, "Integrated Technology Express")) { |
558 | /* Set feature bits the firmware neglects */ | 558 | /* Set feature bits the firmware neglects */ |
559 | id[49] |= 0x0300; /* LBA, DMA */ | 559 | id[49] |= 0x0300; /* LBA, DMA */ |
560 | id[82] |= 0x0400; /* LBA48 */ | ||
561 | id[83] &= 0x7FFF; | 560 | id[83] &= 0x7FFF; |
562 | id[83] |= 0x4000; /* Word 83 is valid */ | 561 | id[83] |= 0x4400; /* Word 83 is valid and LBA48 */ |
563 | id[86] |= 0x0400; /* LBA48 on */ | 562 | id[86] |= 0x0400; /* LBA48 on */ |
564 | id[ATA_ID_MAJOR_VER] |= 0x1F; | 563 | id[ATA_ID_MAJOR_VER] |= 0x1F; |
565 | } | 564 | } |
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c index 73b7596816b4..38cf1ab2d289 100644 --- a/drivers/ata/pata_jmicron.c +++ b/drivers/ata/pata_jmicron.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * driven by AHCI in the usual configuration although | 4 | * driven by AHCI in the usual configuration although |
5 | * this driver can handle other setups if we need it. | 5 | * this driver can handle other setups if we need it. |
6 | * | 6 | * |
7 | * (c) 2006 Red Hat <alan@redhat.com> | 7 | * (c) 2006 Red Hat |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c index bc037ffce200..930c2208640b 100644 --- a/drivers/ata/pata_legacy.c +++ b/drivers/ata/pata_legacy.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata-legacy.c - Legacy port PATA/SATA controller driver. | 2 | * pata-legacy.c - Legacy port PATA/SATA controller driver. |
3 | * Copyright 2005/2006 Red Hat <alan@redhat.com>, all rights reserved. | 3 | * Copyright 2005/2006 Red Hat, all rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c index 0d87eec84966..76e399bf8c1b 100644 --- a/drivers/ata/pata_marvell.c +++ b/drivers/ata/pata_marvell.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * isn't making full use of the device functionality but it is | 5 | * isn't making full use of the device functionality but it is |
6 | * easy to get working. | 6 | * easy to get working. |
7 | * | 7 | * |
8 | * (c) 2006 Red Hat <alan@redhat.com> | 8 | * (c) 2006 Red Hat |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c index 7d7e3fdab71f..7c8faa48b5f3 100644 --- a/drivers/ata/pata_mpiix.c +++ b/drivers/ata/pata_mpiix.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_mpiix.c - Intel MPIIX PATA for new ATA layer | 2 | * pata_mpiix.c - Intel MPIIX PATA for new ATA layer |
3 | * (C) 2005-2006 Red Hat Inc | 3 | * (C) 2005-2006 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | 4 | * Alan Cox <alan@lxorguk.ukuu.org.uk> |
5 | * | 5 | * |
6 | * The MPIIX is different enough to the PIIX4 and friends that we give it | 6 | * The MPIIX is different enough to the PIIX4 and friends that we give it |
7 | * a separate driver. The old ide/pci code handles this by just not tuning | 7 | * a separate driver. The old ide/pci code handles this by just not tuning |
diff --git a/drivers/ata/pata_netcell.c b/drivers/ata/pata_netcell.c index d9719c8b9dbe..9dc05e1656a8 100644 --- a/drivers/ata/pata_netcell.c +++ b/drivers/ata/pata_netcell.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_netcell.c - Netcell PATA driver | 2 | * pata_netcell.c - Netcell PATA driver |
3 | * | 3 | * |
4 | * (c) 2006 Red Hat <alan@redhat.com> | 4 | * (c) 2006 Red Hat |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
diff --git a/drivers/ata/pata_ninja32.c b/drivers/ata/pata_ninja32.c index 565e67cd13fa..4e466eae8b46 100644 --- a/drivers/ata/pata_ninja32.c +++ b/drivers/ata/pata_ninja32.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_ninja32.c - Ninja32 PATA for new ATA layer | 2 | * pata_ninja32.c - Ninja32 PATA for new ATA layer |
3 | * (C) 2007 Red Hat Inc | 3 | * (C) 2007 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | ||
5 | * | 4 | * |
6 | * Note: The controller like many controllers has shared timings for | 5 | * Note: The controller like many controllers has shared timings for |
7 | * PIO and DMA. We thus flip to the DMA timings in dma_start and flip back | 6 | * PIO and DMA. We thus flip to the DMA timings in dma_start and flip back |
@@ -45,7 +44,7 @@ | |||
45 | #include <linux/libata.h> | 44 | #include <linux/libata.h> |
46 | 45 | ||
47 | #define DRV_NAME "pata_ninja32" | 46 | #define DRV_NAME "pata_ninja32" |
48 | #define DRV_VERSION "0.0.1" | 47 | #define DRV_VERSION "0.1.1" |
49 | 48 | ||
50 | 49 | ||
51 | /** | 50 | /** |
@@ -89,6 +88,17 @@ static struct ata_port_operations ninja32_port_ops = { | |||
89 | .set_piomode = ninja32_set_piomode, | 88 | .set_piomode = ninja32_set_piomode, |
90 | }; | 89 | }; |
91 | 90 | ||
91 | static void ninja32_program(void __iomem *base) | ||
92 | { | ||
93 | iowrite8(0x05, base + 0x01); /* Enable interrupt lines */ | ||
94 | iowrite8(0xBE, base + 0x02); /* Burst, ?? setup */ | ||
95 | iowrite8(0x01, base + 0x03); /* Unknown */ | ||
96 | iowrite8(0x20, base + 0x04); /* WAIT0 */ | ||
97 | iowrite8(0x8f, base + 0x05); /* Unknown */ | ||
98 | iowrite8(0xa4, base + 0x1c); /* Unknown */ | ||
99 | iowrite8(0x83, base + 0x1d); /* BMDMA control: WAIT0 */ | ||
100 | } | ||
101 | |||
92 | static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 102 | static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
93 | { | 103 | { |
94 | struct ata_host *host; | 104 | struct ata_host *host; |
@@ -134,18 +144,28 @@ static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
134 | ap->ioaddr.bmdma_addr = base; | 144 | ap->ioaddr.bmdma_addr = base; |
135 | ata_sff_std_ports(&ap->ioaddr); | 145 | ata_sff_std_ports(&ap->ioaddr); |
136 | 146 | ||
137 | iowrite8(0x05, base + 0x01); /* Enable interrupt lines */ | 147 | ninja32_program(base); |
138 | iowrite8(0xBE, base + 0x02); /* Burst, ?? setup */ | ||
139 | iowrite8(0x01, base + 0x03); /* Unknown */ | ||
140 | iowrite8(0x20, base + 0x04); /* WAIT0 */ | ||
141 | iowrite8(0x8f, base + 0x05); /* Unknown */ | ||
142 | iowrite8(0xa4, base + 0x1c); /* Unknown */ | ||
143 | iowrite8(0x83, base + 0x1d); /* BMDMA control: WAIT0 */ | ||
144 | /* FIXME: Should we disable them at remove ? */ | 148 | /* FIXME: Should we disable them at remove ? */ |
145 | return ata_host_activate(host, dev->irq, ata_sff_interrupt, | 149 | return ata_host_activate(host, dev->irq, ata_sff_interrupt, |
146 | IRQF_SHARED, &ninja32_sht); | 150 | IRQF_SHARED, &ninja32_sht); |
147 | } | 151 | } |
148 | 152 | ||
153 | #ifdef CONFIG_PM | ||
154 | |||
155 | static int ninja32_reinit_one(struct pci_dev *pdev) | ||
156 | { | ||
157 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
158 | int rc; | ||
159 | |||
160 | rc = ata_pci_device_do_resume(pdev); | ||
161 | if (rc) | ||
162 | return rc; | ||
163 | ninja32_program(host->iomap[0]); | ||
164 | ata_host_resume(host); | ||
165 | return 0; | ||
166 | } | ||
167 | #endif | ||
168 | |||
149 | static const struct pci_device_id ninja32[] = { | 169 | static const struct pci_device_id ninja32[] = { |
150 | { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 170 | { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
151 | { 0x1145, 0xf024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 171 | { 0x1145, 0xf024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
@@ -156,7 +176,11 @@ static struct pci_driver ninja32_pci_driver = { | |||
156 | .name = DRV_NAME, | 176 | .name = DRV_NAME, |
157 | .id_table = ninja32, | 177 | .id_table = ninja32, |
158 | .probe = ninja32_init_one, | 178 | .probe = ninja32_init_one, |
159 | .remove = ata_pci_remove_one | 179 | .remove = ata_pci_remove_one, |
180 | #ifdef CONFIG_PM | ||
181 | .suspend = ata_pci_device_suspend, | ||
182 | .resume = ninja32_reinit_one, | ||
183 | #endif | ||
160 | }; | 184 | }; |
161 | 185 | ||
162 | static int __init ninja32_init(void) | 186 | static int __init ninja32_init(void) |
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c index be756b7ef07e..40d411c460de 100644 --- a/drivers/ata/pata_ns87410.c +++ b/drivers/ata/pata_ns87410.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_ns87410.c - National Semiconductor 87410 PATA for new ATA layer | 2 | * pata_ns87410.c - National Semiconductor 87410 PATA for new ATA layer |
3 | * (C) 2006 Red Hat Inc | 3 | * (C) 2006 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | ||
5 | * | 4 | * |
6 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/ata/pata_ns87415.c b/drivers/ata/pata_ns87415.c index e0aa7eaaee0a..89bf5f865d6a 100644 --- a/drivers/ata/pata_ns87415.c +++ b/drivers/ata/pata_ns87415.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_ns87415.c - NS87415 (non PARISC) PATA | 2 | * pata_ns87415.c - NS87415 (non PARISC) PATA |
3 | * | 3 | * |
4 | * (C) 2005 Red Hat <alan@redhat.com> | 4 | * (C) 2005 Red Hat <alan@lxorguk.ukuu.org.uk> |
5 | * | 5 | * |
6 | * This is a fairly generic MWDMA controller. It has some limitations | 6 | * This is a fairly generic MWDMA controller. It has some limitations |
7 | * as it requires timing reloads on PIO/DMA transitions but it is otherwise | 7 | * as it requires timing reloads on PIO/DMA transitions but it is otherwise |
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c index df64f2443001..c0dbc46a348e 100644 --- a/drivers/ata/pata_oldpiix.c +++ b/drivers/ata/pata_oldpiix.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_oldpiix.c - Intel PATA/SATA controllers | 2 | * pata_oldpiix.c - Intel PATA/SATA controllers |
3 | * | 3 | * |
4 | * (C) 2005 Red Hat <alan@redhat.com> | 4 | * (C) 2005 Red Hat |
5 | * | 5 | * |
6 | * Some parts based on ata_piix.c by Jeff Garzik and others. | 6 | * Some parts based on ata_piix.c by Jeff Garzik and others. |
7 | * | 7 | * |
diff --git a/drivers/ata/pata_opti.c b/drivers/ata/pata_opti.c index fb2cf661b0e8..e4fa4d565e96 100644 --- a/drivers/ata/pata_opti.c +++ b/drivers/ata/pata_opti.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_opti.c - ATI PATA for new ATA layer | 2 | * pata_opti.c - ATI PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | ||
5 | * | 4 | * |
6 | * Based on | 5 | * Based on |
7 | * linux/drivers/ide/pci/opti621.c Version 0.7 Sept 10, 2002 | 6 | * linux/drivers/ide/pci/opti621.c Version 0.7 Sept 10, 2002 |
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c index 4cd744456313..93bb6e91973f 100644 --- a/drivers/ata/pata_optidma.c +++ b/drivers/ata/pata_optidma.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_optidma.c - Opti DMA PATA for new ATA layer | 2 | * pata_optidma.c - Opti DMA PATA for new ATA layer |
3 | * (C) 2006 Red Hat Inc | 3 | * (C) 2006 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | ||
5 | * | 4 | * |
6 | * The Opti DMA controllers are related to the older PIO PCI controllers | 5 | * The Opti DMA controllers are related to the older PIO PCI controllers |
7 | * and indeed the VLB ones. The main differences are that the timing | 6 | * and indeed the VLB ones. The main differences are that the timing |
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 02b596b9cf6a..64b2e2281ee7 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_pcmcia.c - PCMCIA PATA controller driver. | 2 | * pata_pcmcia.c - PCMCIA PATA controller driver. |
3 | * Copyright 2005-2006 Red Hat Inc <alan@redhat.com>, all rights reserved. | 3 | * Copyright 2005-2006 Red Hat Inc, all rights reserved. |
4 | * PCMCIA ident update Copyright 2006 Marcin Juszkiewicz | 4 | * PCMCIA ident update Copyright 2006 Marcin Juszkiewicz |
5 | * <openembedded@hrw.one.pl> | 5 | * <openembedded@hrw.one.pl> |
6 | * | 6 | * |
@@ -416,6 +416,7 @@ static struct pcmcia_device_id pcmcia_devices[] = { | |||
416 | PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), | 416 | PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), |
417 | PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e), | 417 | PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e), |
418 | PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6), | 418 | PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6), |
419 | PCMCIA_DEVICE_PROD_ID2("Flash Card", 0x5a362506), | ||
419 | PCMCIA_DEVICE_NULL, | 420 | PCMCIA_DEVICE_NULL, |
420 | }; | 421 | }; |
421 | 422 | ||
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c index d2673060bc8d..799a6a098712 100644 --- a/drivers/ata/pata_pdc202xx_old.c +++ b/drivers/ata/pata_pdc202xx_old.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_pdc202xx_old.c - Promise PDC202xx PATA for new ATA layer | 2 | * pata_pdc202xx_old.c - Promise PDC202xx PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | 4 | * Alan Cox <alan@lxorguk.ukuu.org.uk> |
5 | * (C) 2007 Bartlomiej Zolnierkiewicz | 5 | * (C) 2007 Bartlomiej Zolnierkiewicz |
6 | * | 6 | * |
7 | * Based in part on linux/drivers/ide/pci/pdc202xx_old.c | 7 | * Based in part on linux/drivers/ide/pci/pdc202xx_old.c |
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c index 8f65ad61b8af..77e4e3b17f54 100644 --- a/drivers/ata/pata_platform.c +++ b/drivers/ata/pata_platform.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * Based on pata_pcmcia: | 6 | * Based on pata_pcmcia: |
7 | * | 7 | * |
8 | * Copyright 2005-2006 Red Hat Inc <alan@redhat.com>, all rights reserved. | 8 | * Copyright 2005-2006 Red Hat Inc, all rights reserved. |
9 | * | 9 | * |
10 | * This file is subject to the terms and conditions of the GNU General Public | 10 | * This file is subject to the terms and conditions of the GNU General Public |
11 | * License. See the file "COPYING" in the main directory of this archive | 11 | * License. See the file "COPYING" in the main directory of this archive |
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c index 63b7a1c165a5..3080f371222c 100644 --- a/drivers/ata/pata_qdi.c +++ b/drivers/ata/pata_qdi.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_qdi.c - QDI VLB ATA controllers | 2 | * pata_qdi.c - QDI VLB ATA controllers |
3 | * (C) 2006 Red Hat <alan@redhat.com> | 3 | * (C) 2006 Red Hat |
4 | * | 4 | * |
5 | * This driver mostly exists as a proof of concept for non PCI devices under | 5 | * This driver mostly exists as a proof of concept for non PCI devices under |
6 | * libata. While the QDI6580 was 'neat' in 1993 it is no longer terribly | 6 | * libata. While the QDI6580 was 'neat' in 1993 it is no longer terribly |
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c index 1c0d9fa7ee54..0b0aa452de14 100644 --- a/drivers/ata/pata_radisys.c +++ b/drivers/ata/pata_radisys.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_radisys.c - Intel PATA/SATA controllers | 2 | * pata_radisys.c - Intel PATA/SATA controllers |
3 | * | 3 | * |
4 | * (C) 2006 Red Hat <alan@redhat.com> | 4 | * (C) 2006 Red Hat <alan@lxorguk.ukuu.org.uk> |
5 | * | 5 | * |
6 | * Some parts based on ata_piix.c by Jeff Garzik and others. | 6 | * Some parts based on ata_piix.c by Jeff Garzik and others. |
7 | * | 7 | * |
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c index 0278fd2b8fb1..9a4bdca54616 100644 --- a/drivers/ata/pata_sc1200.c +++ b/drivers/ata/pata_sc1200.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * New ATA layer SC1200 driver Alan Cox <alan@redhat.com> | 2 | * New ATA layer SC1200 driver Alan Cox <alan@lxorguk.ukuu.org.uk> |
3 | * | 3 | * |
4 | * TODO: Mode selection filtering | 4 | * TODO: Mode selection filtering |
5 | * TODO: Can't enable second channel until ATA core has serialize | 5 | * TODO: Can't enable second channel until ATA core has serialize |
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c index 16673d168573..cf3707e516a2 100644 --- a/drivers/ata/pata_scc.c +++ b/drivers/ata/pata_scc.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * Copyright 2003-2005 Jeff Garzik | 8 | * Copyright 2003-2005 Jeff Garzik |
9 | * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer | 9 | * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer |
10 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> | 10 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> |
11 | * Copyright (C) 2003 Red Hat Inc <alan@redhat.com> | 11 | * Copyright (C) 2003 Red Hat Inc |
12 | * | 12 | * |
13 | * and drivers/ata/ahci.c: | 13 | * and drivers/ata/ahci.c: |
14 | * Copyright 2004-2005 Red Hat, Inc. | 14 | * Copyright 2004-2005 Red Hat, Inc. |
diff --git a/drivers/ata/pata_sch.c b/drivers/ata/pata_sch.c index c8cc027789fe..6aeeeeb34124 100644 --- a/drivers/ata/pata_sch.c +++ b/drivers/ata/pata_sch.c | |||
@@ -83,7 +83,7 @@ static struct ata_port_operations sch_pata_ops = { | |||
83 | }; | 83 | }; |
84 | 84 | ||
85 | static struct ata_port_info sch_port_info = { | 85 | static struct ata_port_info sch_port_info = { |
86 | .flags = 0, | 86 | .flags = ATA_FLAG_SLAVE_POSS, |
87 | .pio_mask = ATA_PIO4, /* pio0-4 */ | 87 | .pio_mask = ATA_PIO4, /* pio0-4 */ |
88 | .mwdma_mask = ATA_MWDMA2, /* mwdma0-2 */ | 88 | .mwdma_mask = ATA_MWDMA2, /* mwdma0-2 */ |
89 | .udma_mask = ATA_UDMA5, /* udma0-5 */ | 89 | .udma_mask = ATA_UDMA5, /* udma0-5 */ |
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c index ffd26d0dc50d..72e41c9f969b 100644 --- a/drivers/ata/pata_serverworks.c +++ b/drivers/ata/pata_serverworks.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_serverworks.c - Serverworks PATA for new ATA layer | 2 | * pata_serverworks.c - Serverworks PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | ||
5 | * | 4 | * |
6 | * based upon | 5 | * based upon |
7 | * | 6 | * |
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c index a598bb36aafc..83580a59db58 100644 --- a/drivers/ata/pata_sil680.c +++ b/drivers/ata/pata_sil680.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_sil680.c - SIL680 PATA for new ATA layer | 2 | * pata_sil680.c - SIL680 PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | ||
5 | * | 4 | * |
6 | * based upon | 5 | * based upon |
7 | * | 6 | * |
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index 26345d7b531c..d34236611752 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_sis.c - SiS ATA driver | 2 | * pata_sis.c - SiS ATA driver |
3 | * | 3 | * |
4 | * (C) 2005 Red Hat <alan@redhat.com> | 4 | * (C) 2005 Red Hat |
5 | * (C) 2007 Bartlomiej Zolnierkiewicz | 5 | * (C) 2007 Bartlomiej Zolnierkiewicz |
6 | * | 6 | * |
7 | * Based upon linux/drivers/ide/pci/sis5513.c | 7 | * Based upon linux/drivers/ide/pci/sis5513.c |
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c index 69877bd81815..1b0e7b6d8ef5 100644 --- a/drivers/ata/pata_sl82c105.c +++ b/drivers/ata/pata_sl82c105.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_sl82c105.c - SL82C105 PATA for new ATA layer | 2 | * pata_sl82c105.c - SL82C105 PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | ||
5 | * | 4 | * |
6 | * Based in part on linux/drivers/ide/pci/sl82c105.c | 5 | * Based in part on linux/drivers/ide/pci/sl82c105.c |
7 | * SL82C105/Winbond 553 IDE driver | 6 | * SL82C105/Winbond 553 IDE driver |
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c index b181261f2743..ef9597517cdd 100644 --- a/drivers/ata/pata_triflex.c +++ b/drivers/ata/pata_triflex.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_triflex.c - Compaq PATA for new ATA layer | 2 | * pata_triflex.c - Compaq PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | 4 | * Alan Cox <alan@lxorguk.ukuu.org.uk> |
5 | * | 5 | * |
6 | * based upon | 6 | * based upon |
7 | * | 7 | * |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 8fdb2ce73210..681169c9c640 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_via.c - VIA PATA for new ATA layer | 2 | * pata_via.c - VIA PATA for new ATA layer |
3 | * (C) 2005-2006 Red Hat Inc | 3 | * (C) 2005-2006 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | ||
5 | * | 4 | * |
6 | * Documentation | 5 | * Documentation |
7 | * Most chipset documentation available under NDA only | 6 | * Most chipset documentation available under NDA only |
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c index a7606b044a61..319e164a3d74 100644 --- a/drivers/ata/pata_winbond.c +++ b/drivers/ata/pata_winbond.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_winbond.c - Winbond VLB ATA controllers | 2 | * pata_winbond.c - Winbond VLB ATA controllers |
3 | * (C) 2006 Red Hat <alan@redhat.com> | 3 | * (C) 2006 Red Hat |
4 | * | 4 | * |
5 | * Support for the Winbond 83759A when operating in advanced mode. | 5 | * Support for the Winbond 83759A when operating in advanced mode. |
6 | * Multichip mode is not currently supported. | 6 | * Multichip mode is not currently supported. |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index fae3841de0d8..6f1460614325 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -307,10 +307,10 @@ static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); | |||
307 | 307 | ||
308 | static void nv_nf2_freeze(struct ata_port *ap); | 308 | static void nv_nf2_freeze(struct ata_port *ap); |
309 | static void nv_nf2_thaw(struct ata_port *ap); | 309 | static void nv_nf2_thaw(struct ata_port *ap); |
310 | static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class, | ||
311 | unsigned long deadline); | ||
310 | static void nv_ck804_freeze(struct ata_port *ap); | 312 | static void nv_ck804_freeze(struct ata_port *ap); |
311 | static void nv_ck804_thaw(struct ata_port *ap); | 313 | static void nv_ck804_thaw(struct ata_port *ap); |
312 | static int nv_hardreset(struct ata_link *link, unsigned int *class, | ||
313 | unsigned long deadline); | ||
314 | static int nv_adma_slave_config(struct scsi_device *sdev); | 314 | static int nv_adma_slave_config(struct scsi_device *sdev); |
315 | static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc); | 315 | static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc); |
316 | static void nv_adma_qc_prep(struct ata_queued_cmd *qc); | 316 | static void nv_adma_qc_prep(struct ata_queued_cmd *qc); |
@@ -405,17 +405,8 @@ static struct scsi_host_template nv_swncq_sht = { | |||
405 | .slave_configure = nv_swncq_slave_config, | 405 | .slave_configure = nv_swncq_slave_config, |
406 | }; | 406 | }; |
407 | 407 | ||
408 | /* OSDL bz3352 reports that some nv controllers can't determine device | ||
409 | * signature reliably and nv_hardreset is implemented to work around | ||
410 | * the problem. This was reported on nf3 and it's unclear whether any | ||
411 | * other controllers are affected. However, the workaround has been | ||
412 | * applied to all variants and there isn't much to gain by trying to | ||
413 | * find out exactly which ones are affected at this point especially | ||
414 | * because NV has moved over to ahci for newer controllers. | ||
415 | */ | ||
416 | static struct ata_port_operations nv_common_ops = { | 408 | static struct ata_port_operations nv_common_ops = { |
417 | .inherits = &ata_bmdma_port_ops, | 409 | .inherits = &ata_bmdma_port_ops, |
418 | .hardreset = nv_hardreset, | ||
419 | .scr_read = nv_scr_read, | 410 | .scr_read = nv_scr_read, |
420 | .scr_write = nv_scr_write, | 411 | .scr_write = nv_scr_write, |
421 | }; | 412 | }; |
@@ -429,12 +420,22 @@ static struct ata_port_operations nv_generic_ops = { | |||
429 | .hardreset = ATA_OP_NULL, | 420 | .hardreset = ATA_OP_NULL, |
430 | }; | 421 | }; |
431 | 422 | ||
423 | /* OSDL bz3352 reports that nf2/3 controllers can't determine device | ||
424 | * signature reliably. Also, the following thread reports detection | ||
425 | * failure on cold boot with the standard debouncing timing. | ||
426 | * | ||
427 | * http://thread.gmane.org/gmane.linux.ide/34098 | ||
428 | * | ||
429 | * Debounce with hotplug timing and request follow-up SRST. | ||
430 | */ | ||
432 | static struct ata_port_operations nv_nf2_ops = { | 431 | static struct ata_port_operations nv_nf2_ops = { |
433 | .inherits = &nv_common_ops, | 432 | .inherits = &nv_common_ops, |
434 | .freeze = nv_nf2_freeze, | 433 | .freeze = nv_nf2_freeze, |
435 | .thaw = nv_nf2_thaw, | 434 | .thaw = nv_nf2_thaw, |
435 | .hardreset = nv_nf2_hardreset, | ||
436 | }; | 436 | }; |
437 | 437 | ||
438 | /* CK804 finally gets hardreset right */ | ||
438 | static struct ata_port_operations nv_ck804_ops = { | 439 | static struct ata_port_operations nv_ck804_ops = { |
439 | .inherits = &nv_common_ops, | 440 | .inherits = &nv_common_ops, |
440 | .freeze = nv_ck804_freeze, | 441 | .freeze = nv_ck804_freeze, |
@@ -443,7 +444,7 @@ static struct ata_port_operations nv_ck804_ops = { | |||
443 | }; | 444 | }; |
444 | 445 | ||
445 | static struct ata_port_operations nv_adma_ops = { | 446 | static struct ata_port_operations nv_adma_ops = { |
446 | .inherits = &nv_common_ops, | 447 | .inherits = &nv_ck804_ops, |
447 | 448 | ||
448 | .check_atapi_dma = nv_adma_check_atapi_dma, | 449 | .check_atapi_dma = nv_adma_check_atapi_dma, |
449 | .sff_tf_read = nv_adma_tf_read, | 450 | .sff_tf_read = nv_adma_tf_read, |
@@ -467,7 +468,7 @@ static struct ata_port_operations nv_adma_ops = { | |||
467 | }; | 468 | }; |
468 | 469 | ||
469 | static struct ata_port_operations nv_swncq_ops = { | 470 | static struct ata_port_operations nv_swncq_ops = { |
470 | .inherits = &nv_common_ops, | 471 | .inherits = &nv_generic_ops, |
471 | 472 | ||
472 | .qc_defer = ata_std_qc_defer, | 473 | .qc_defer = ata_std_qc_defer, |
473 | .qc_prep = nv_swncq_qc_prep, | 474 | .qc_prep = nv_swncq_qc_prep, |
@@ -1553,6 +1554,17 @@ static void nv_nf2_thaw(struct ata_port *ap) | |||
1553 | iowrite8(mask, scr_addr + NV_INT_ENABLE); | 1554 | iowrite8(mask, scr_addr + NV_INT_ENABLE); |
1554 | } | 1555 | } |
1555 | 1556 | ||
1557 | static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class, | ||
1558 | unsigned long deadline) | ||
1559 | { | ||
1560 | bool online; | ||
1561 | int rc; | ||
1562 | |||
1563 | rc = sata_link_hardreset(link, sata_deb_timing_hotplug, deadline, | ||
1564 | &online, NULL); | ||
1565 | return online ? -EAGAIN : rc; | ||
1566 | } | ||
1567 | |||
1556 | static void nv_ck804_freeze(struct ata_port *ap) | 1568 | static void nv_ck804_freeze(struct ata_port *ap) |
1557 | { | 1569 | { |
1558 | void __iomem *mmio_base = ap->host->iomap[NV_MMIO_BAR]; | 1570 | void __iomem *mmio_base = ap->host->iomap[NV_MMIO_BAR]; |
@@ -1605,21 +1617,6 @@ static void nv_mcp55_thaw(struct ata_port *ap) | |||
1605 | ata_sff_thaw(ap); | 1617 | ata_sff_thaw(ap); |
1606 | } | 1618 | } |
1607 | 1619 | ||
1608 | static int nv_hardreset(struct ata_link *link, unsigned int *class, | ||
1609 | unsigned long deadline) | ||
1610 | { | ||
1611 | int rc; | ||
1612 | |||
1613 | /* SATA hardreset fails to retrieve proper device signature on | ||
1614 | * some controllers. Request follow up SRST. For more info, | ||
1615 | * see http://bugzilla.kernel.org/show_bug.cgi?id=3352 | ||
1616 | */ | ||
1617 | rc = sata_sff_hardreset(link, class, deadline); | ||
1618 | if (rc) | ||
1619 | return rc; | ||
1620 | return -EAGAIN; | ||
1621 | } | ||
1622 | |||
1623 | static void nv_adma_error_handler(struct ata_port *ap) | 1620 | static void nv_adma_error_handler(struct ata_port *ap) |
1624 | { | 1621 | { |
1625 | struct nv_adma_port_priv *pp = ap->private_data; | 1622 | struct nv_adma_port_priv *pp = ap->private_data; |
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index 750d8cdc00cd..ba9a2570a742 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -153,6 +153,10 @@ static void pdc_freeze(struct ata_port *ap); | |||
153 | static void pdc_sata_freeze(struct ata_port *ap); | 153 | static void pdc_sata_freeze(struct ata_port *ap); |
154 | static void pdc_thaw(struct ata_port *ap); | 154 | static void pdc_thaw(struct ata_port *ap); |
155 | static void pdc_sata_thaw(struct ata_port *ap); | 155 | static void pdc_sata_thaw(struct ata_port *ap); |
156 | static int pdc_pata_softreset(struct ata_link *link, unsigned int *class, | ||
157 | unsigned long deadline); | ||
158 | static int pdc_sata_hardreset(struct ata_link *link, unsigned int *class, | ||
159 | unsigned long deadline); | ||
156 | static void pdc_error_handler(struct ata_port *ap); | 160 | static void pdc_error_handler(struct ata_port *ap); |
157 | static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); | 161 | static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); |
158 | static int pdc_pata_cable_detect(struct ata_port *ap); | 162 | static int pdc_pata_cable_detect(struct ata_port *ap); |
@@ -186,6 +190,7 @@ static struct ata_port_operations pdc_sata_ops = { | |||
186 | .scr_read = pdc_sata_scr_read, | 190 | .scr_read = pdc_sata_scr_read, |
187 | .scr_write = pdc_sata_scr_write, | 191 | .scr_write = pdc_sata_scr_write, |
188 | .port_start = pdc_sata_port_start, | 192 | .port_start = pdc_sata_port_start, |
193 | .hardreset = pdc_sata_hardreset, | ||
189 | }; | 194 | }; |
190 | 195 | ||
191 | /* First-generation chips need a more restrictive ->check_atapi_dma op */ | 196 | /* First-generation chips need a more restrictive ->check_atapi_dma op */ |
@@ -200,6 +205,7 @@ static struct ata_port_operations pdc_pata_ops = { | |||
200 | .freeze = pdc_freeze, | 205 | .freeze = pdc_freeze, |
201 | .thaw = pdc_thaw, | 206 | .thaw = pdc_thaw, |
202 | .port_start = pdc_common_port_start, | 207 | .port_start = pdc_common_port_start, |
208 | .softreset = pdc_pata_softreset, | ||
203 | }; | 209 | }; |
204 | 210 | ||
205 | static const struct ata_port_info pdc_port_info[] = { | 211 | static const struct ata_port_info pdc_port_info[] = { |
@@ -693,6 +699,20 @@ static void pdc_sata_thaw(struct ata_port *ap) | |||
693 | readl(host_mmio + hotplug_offset); /* flush */ | 699 | readl(host_mmio + hotplug_offset); /* flush */ |
694 | } | 700 | } |
695 | 701 | ||
702 | static int pdc_pata_softreset(struct ata_link *link, unsigned int *class, | ||
703 | unsigned long deadline) | ||
704 | { | ||
705 | pdc_reset_port(link->ap); | ||
706 | return ata_sff_softreset(link, class, deadline); | ||
707 | } | ||
708 | |||
709 | static int pdc_sata_hardreset(struct ata_link *link, unsigned int *class, | ||
710 | unsigned long deadline) | ||
711 | { | ||
712 | pdc_reset_port(link->ap); | ||
713 | return sata_sff_hardreset(link, class, deadline); | ||
714 | } | ||
715 | |||
696 | static void pdc_error_handler(struct ata_port *ap) | 716 | static void pdc_error_handler(struct ata_port *ap) |
697 | { | 717 | { |
698 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) | 718 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 4621807a1a6a..ccee930f1e12 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -1329,6 +1329,11 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1329 | } | 1329 | } |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | /* Set max read request size to 4096. This slightly increases | ||
1333 | * write throughput for pci-e variants. | ||
1334 | */ | ||
1335 | pcie_set_readrq(pdev, 4096); | ||
1336 | |||
1332 | sil24_init_controller(host); | 1337 | sil24_init_controller(host); |
1333 | 1338 | ||
1334 | pci_set_master(pdev); | 1339 | pci_set_master(pdev); |
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index 5b72e734300a..c18935f0bda2 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -44,11 +44,16 @@ | |||
44 | #include <linux/libata.h> | 44 | #include <linux/libata.h> |
45 | 45 | ||
46 | #define DRV_NAME "sata_via" | 46 | #define DRV_NAME "sata_via" |
47 | #define DRV_VERSION "2.3" | 47 | #define DRV_VERSION "2.4" |
48 | 48 | ||
49 | /* | ||
50 | * vt8251 is different from other sata controllers of VIA. It has two | ||
51 | * channels, each channel has both Master and Slave slot. | ||
52 | */ | ||
49 | enum board_ids_enum { | 53 | enum board_ids_enum { |
50 | vt6420, | 54 | vt6420, |
51 | vt6421, | 55 | vt6421, |
56 | vt8251, | ||
52 | }; | 57 | }; |
53 | 58 | ||
54 | enum { | 59 | enum { |
@@ -70,6 +75,8 @@ enum { | |||
70 | static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); | 75 | static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
71 | static int svia_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); | 76 | static int svia_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); |
72 | static int svia_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); | 77 | static int svia_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); |
78 | static int vt8251_scr_read(struct ata_link *link, unsigned int scr, u32 *val); | ||
79 | static int vt8251_scr_write(struct ata_link *link, unsigned int scr, u32 val); | ||
73 | static void svia_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); | 80 | static void svia_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); |
74 | static void svia_noop_freeze(struct ata_port *ap); | 81 | static void svia_noop_freeze(struct ata_port *ap); |
75 | static int vt6420_prereset(struct ata_link *link, unsigned long deadline); | 82 | static int vt6420_prereset(struct ata_link *link, unsigned long deadline); |
@@ -79,12 +86,12 @@ static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev); | |||
79 | 86 | ||
80 | static const struct pci_device_id svia_pci_tbl[] = { | 87 | static const struct pci_device_id svia_pci_tbl[] = { |
81 | { PCI_VDEVICE(VIA, 0x5337), vt6420 }, | 88 | { PCI_VDEVICE(VIA, 0x5337), vt6420 }, |
82 | { PCI_VDEVICE(VIA, 0x0591), vt6420 }, | 89 | { PCI_VDEVICE(VIA, 0x0591), vt6420 }, /* 2 sata chnls (Master) */ |
83 | { PCI_VDEVICE(VIA, 0x3149), vt6420 }, | 90 | { PCI_VDEVICE(VIA, 0x3149), vt6420 }, /* 2 sata chnls (Master) */ |
84 | { PCI_VDEVICE(VIA, 0x3249), vt6421 }, | 91 | { PCI_VDEVICE(VIA, 0x3249), vt6421 }, /* 2 sata chnls, 1 pata chnl */ |
85 | { PCI_VDEVICE(VIA, 0x5287), vt6420 }, | ||
86 | { PCI_VDEVICE(VIA, 0x5372), vt6420 }, | 92 | { PCI_VDEVICE(VIA, 0x5372), vt6420 }, |
87 | { PCI_VDEVICE(VIA, 0x7372), vt6420 }, | 93 | { PCI_VDEVICE(VIA, 0x7372), vt6420 }, |
94 | { PCI_VDEVICE(VIA, 0x5287), vt8251 }, /* 2 sata chnls (Master/Slave) */ | ||
88 | 95 | ||
89 | { } /* terminate list */ | 96 | { } /* terminate list */ |
90 | }; | 97 | }; |
@@ -128,6 +135,13 @@ static struct ata_port_operations vt6421_sata_ops = { | |||
128 | .scr_write = svia_scr_write, | 135 | .scr_write = svia_scr_write, |
129 | }; | 136 | }; |
130 | 137 | ||
138 | static struct ata_port_operations vt8251_ops = { | ||
139 | .inherits = &svia_base_ops, | ||
140 | .hardreset = sata_std_hardreset, | ||
141 | .scr_read = vt8251_scr_read, | ||
142 | .scr_write = vt8251_scr_write, | ||
143 | }; | ||
144 | |||
131 | static const struct ata_port_info vt6420_port_info = { | 145 | static const struct ata_port_info vt6420_port_info = { |
132 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | 146 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, |
133 | .pio_mask = 0x1f, | 147 | .pio_mask = 0x1f, |
@@ -152,6 +166,15 @@ static struct ata_port_info vt6421_pport_info = { | |||
152 | .port_ops = &vt6421_pata_ops, | 166 | .port_ops = &vt6421_pata_ops, |
153 | }; | 167 | }; |
154 | 168 | ||
169 | static struct ata_port_info vt8251_port_info = { | ||
170 | .flags = ATA_FLAG_SATA | ATA_FLAG_SLAVE_POSS | | ||
171 | ATA_FLAG_NO_LEGACY, | ||
172 | .pio_mask = 0x1f, | ||
173 | .mwdma_mask = 0x07, | ||
174 | .udma_mask = ATA_UDMA6, | ||
175 | .port_ops = &vt8251_ops, | ||
176 | }; | ||
177 | |||
155 | MODULE_AUTHOR("Jeff Garzik"); | 178 | MODULE_AUTHOR("Jeff Garzik"); |
156 | MODULE_DESCRIPTION("SCSI low-level driver for VIA SATA controllers"); | 179 | MODULE_DESCRIPTION("SCSI low-level driver for VIA SATA controllers"); |
157 | MODULE_LICENSE("GPL"); | 180 | MODULE_LICENSE("GPL"); |
@@ -174,6 +197,83 @@ static int svia_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) | |||
174 | return 0; | 197 | return 0; |
175 | } | 198 | } |
176 | 199 | ||
200 | static int vt8251_scr_read(struct ata_link *link, unsigned int scr, u32 *val) | ||
201 | { | ||
202 | static const u8 ipm_tbl[] = { 1, 2, 6, 0 }; | ||
203 | struct pci_dev *pdev = to_pci_dev(link->ap->host->dev); | ||
204 | int slot = 2 * link->ap->port_no + link->pmp; | ||
205 | u32 v = 0; | ||
206 | u8 raw; | ||
207 | |||
208 | switch (scr) { | ||
209 | case SCR_STATUS: | ||
210 | pci_read_config_byte(pdev, 0xA0 + slot, &raw); | ||
211 | |||
212 | /* read the DET field, bit0 and 1 of the config byte */ | ||
213 | v |= raw & 0x03; | ||
214 | |||
215 | /* read the SPD field, bit4 of the configure byte */ | ||
216 | if (raw & (1 << 4)) | ||
217 | v |= 0x02 << 4; | ||
218 | else | ||
219 | v |= 0x01 << 4; | ||
220 | |||
221 | /* read the IPM field, bit2 and 3 of the config byte */ | ||
222 | v |= ipm_tbl[(raw >> 2) & 0x3]; | ||
223 | break; | ||
224 | |||
225 | case SCR_ERROR: | ||
226 | /* devices other than 5287 uses 0xA8 as base */ | ||
227 | WARN_ON(pdev->device != 0x5287); | ||
228 | pci_read_config_dword(pdev, 0xB0 + slot * 4, &v); | ||
229 | break; | ||
230 | |||
231 | case SCR_CONTROL: | ||
232 | pci_read_config_byte(pdev, 0xA4 + slot, &raw); | ||
233 | |||
234 | /* read the DET field, bit0 and bit1 */ | ||
235 | v |= ((raw & 0x02) << 1) | (raw & 0x01); | ||
236 | |||
237 | /* read the IPM field, bit2 and bit3 */ | ||
238 | v |= ((raw >> 2) & 0x03) << 8; | ||
239 | break; | ||
240 | |||
241 | default: | ||
242 | return -EINVAL; | ||
243 | } | ||
244 | |||
245 | *val = v; | ||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | static int vt8251_scr_write(struct ata_link *link, unsigned int scr, u32 val) | ||
250 | { | ||
251 | struct pci_dev *pdev = to_pci_dev(link->ap->host->dev); | ||
252 | int slot = 2 * link->ap->port_no + link->pmp; | ||
253 | u32 v = 0; | ||
254 | |||
255 | switch (scr) { | ||
256 | case SCR_ERROR: | ||
257 | /* devices other than 5287 uses 0xA8 as base */ | ||
258 | WARN_ON(pdev->device != 0x5287); | ||
259 | pci_write_config_dword(pdev, 0xB0 + slot * 4, val); | ||
260 | return 0; | ||
261 | |||
262 | case SCR_CONTROL: | ||
263 | /* set the DET field */ | ||
264 | v |= ((val & 0x4) >> 1) | (val & 0x1); | ||
265 | |||
266 | /* set the IPM field */ | ||
267 | v |= ((val >> 8) & 0x3) << 2; | ||
268 | |||
269 | pci_write_config_byte(pdev, 0xA4 + slot, v); | ||
270 | return 0; | ||
271 | |||
272 | default: | ||
273 | return -EINVAL; | ||
274 | } | ||
275 | } | ||
276 | |||
177 | /** | 277 | /** |
178 | * svia_tf_load - send taskfile registers to host controller | 278 | * svia_tf_load - send taskfile registers to host controller |
179 | * @ap: Port to which output is sent | 279 | * @ap: Port to which output is sent |
@@ -396,6 +496,30 @@ static int vt6421_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) | |||
396 | return 0; | 496 | return 0; |
397 | } | 497 | } |
398 | 498 | ||
499 | static int vt8251_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) | ||
500 | { | ||
501 | const struct ata_port_info *ppi[] = { &vt8251_port_info, NULL }; | ||
502 | struct ata_host *host; | ||
503 | int i, rc; | ||
504 | |||
505 | rc = ata_pci_sff_prepare_host(pdev, ppi, &host); | ||
506 | if (rc) | ||
507 | return rc; | ||
508 | *r_host = host; | ||
509 | |||
510 | rc = pcim_iomap_regions(pdev, 1 << 5, DRV_NAME); | ||
511 | if (rc) { | ||
512 | dev_printk(KERN_ERR, &pdev->dev, "failed to iomap PCI BAR 5\n"); | ||
513 | return rc; | ||
514 | } | ||
515 | |||
516 | /* 8251 hosts four sata ports as M/S of the two channels */ | ||
517 | for (i = 0; i < host->n_ports; i++) | ||
518 | ata_slave_link_init(host->ports[i]); | ||
519 | |||
520 | return 0; | ||
521 | } | ||
522 | |||
399 | static void svia_configure(struct pci_dev *pdev) | 523 | static void svia_configure(struct pci_dev *pdev) |
400 | { | 524 | { |
401 | u8 tmp8; | 525 | u8 tmp8; |
@@ -451,10 +575,10 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
451 | if (rc) | 575 | if (rc) |
452 | return rc; | 576 | return rc; |
453 | 577 | ||
454 | if (board_id == vt6420) | 578 | if (board_id == vt6421) |
455 | bar_sizes = &svia_bar_sizes[0]; | ||
456 | else | ||
457 | bar_sizes = &vt6421_bar_sizes[0]; | 579 | bar_sizes = &vt6421_bar_sizes[0]; |
580 | else | ||
581 | bar_sizes = &svia_bar_sizes[0]; | ||
458 | 582 | ||
459 | for (i = 0; i < ARRAY_SIZE(svia_bar_sizes); i++) | 583 | for (i = 0; i < ARRAY_SIZE(svia_bar_sizes); i++) |
460 | if ((pci_resource_start(pdev, i) == 0) || | 584 | if ((pci_resource_start(pdev, i) == 0) || |
@@ -467,10 +591,19 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
467 | return -ENODEV; | 591 | return -ENODEV; |
468 | } | 592 | } |
469 | 593 | ||
470 | if (board_id == vt6420) | 594 | switch (board_id) { |
595 | case vt6420: | ||
471 | rc = vt6420_prepare_host(pdev, &host); | 596 | rc = vt6420_prepare_host(pdev, &host); |
472 | else | 597 | break; |
598 | case vt6421: | ||
473 | rc = vt6421_prepare_host(pdev, &host); | 599 | rc = vt6421_prepare_host(pdev, &host); |
600 | break; | ||
601 | case vt8251: | ||
602 | rc = vt8251_prepare_host(pdev, &host); | ||
603 | break; | ||
604 | default: | ||
605 | rc = -EINVAL; | ||
606 | } | ||
474 | if (rc) | 607 | if (rc) |
475 | return rc; | 608 | return rc; |
476 | 609 | ||