Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 118284
Collapse All | Expand All

(-)linux-2.6.15-rc6-orig/drivers/scsi/ata_piix.c (+4 lines)
Lines 125-130 static struct pci_driver piix_pci_driver Link Here
125
	.id_table		= piix_pci_tbl,
125
	.id_table		= piix_pci_tbl,
126
	.probe			= piix_init_one,
126
	.probe			= piix_init_one,
127
	.remove			= ata_pci_remove_one,
127
	.remove			= ata_pci_remove_one,
128
	.suspend		= ata_pci_device_suspend,
129
	.resume			= ata_pci_device_resume,
128
};
130
};
129
131
130
static struct scsi_host_template piix_sht = {
132
static struct scsi_host_template piix_sht = {
Lines 145-150 static struct scsi_host_template piix_sh Link Here
145
	.slave_configure	= ata_scsi_slave_config,
147
	.slave_configure	= ata_scsi_slave_config,
146
	.bios_param		= ata_std_bios_param,
148
	.bios_param		= ata_std_bios_param,
147
	.ordered_flush		= 1,
149
	.ordered_flush		= 1,
150
	.suspend		= ata_scsi_device_suspend,
151
	.resume			= ata_scsi_device_resume,
148
};
152
};
149
153
150
static const struct ata_port_operations piix_pata_ops = {
154
static const struct ata_port_operations piix_pata_ops = {
(-)linux-2.6.15-rc6-orig/drivers/scsi/libata-core.c (+122 lines)
Lines 4099-4104 err_out: Link Here
4099
}
4099
}
4100
4100
4101
4101
4102
/*
4103
 * Execute a 'simple' command, that only consists of the opcode 'cmd' itself,
4104
 * without filling any other registers
4105
 */
4106
static int ata_do_simple_cmd(struct ata_port *ap, struct ata_device *dev,
4107
			     u8 cmd)
4108
{
4109
	DECLARE_COMPLETION(wait);
4110
	struct ata_queued_cmd *qc;
4111
	unsigned long flags;
4112
	int rc;
4113
4114
	while ((qc = ata_qc_new_init(ap, dev)) == NULL)
4115
		msleep(10);
4116
4117
	qc->tf.command = cmd;
4118
	qc->tf.flags |= ATA_TFLAG_DEVICE;
4119
	qc->tf.protocol = ATA_PROT_NODATA;
4120
4121
	qc->waiting = &wait;
4122
	qc->complete_fn = ata_qc_complete_noop;
4123
4124
	spin_lock_irqsave(&ap->host_set->lock, flags);
4125
	rc = ata_qc_issue(qc);
4126
	spin_unlock_irqrestore(&ap->host_set->lock, flags);
4127
4128
	if (!rc)
4129
		wait_for_completion(&wait);
4130
4131
	return rc;
4132
}
4133
4134
static int ata_flush_cache(struct ata_port *ap, struct ata_device *dev)
4135
{
4136
	u8 cmd;
4137
4138
	if (!ata_try_flush_cache(dev))
4139
		return 0;
4140
4141
	if (ata_id_has_flush_ext(dev->id))
4142
		cmd = ATA_CMD_FLUSH_EXT;
4143
	else
4144
		cmd = ATA_CMD_FLUSH;
4145
4146
	return ata_do_simple_cmd(ap, dev, cmd);
4147
}
4148
4149
static int ata_standby_drive(struct ata_port *ap, struct ata_device *dev)
4150
{
4151
	return ata_do_simple_cmd(ap, dev, ATA_CMD_STANDBYNOW1);
4152
}
4153
4154
static int ata_start_drive(struct ata_port *ap, struct ata_device *dev)
4155
{
4156
	return ata_do_simple_cmd(ap, dev, ATA_CMD_IDLEIMMEDIATE);
4157
}
4158
4159
/**
4160
 *	ata_device_resume - wakeup a previously suspended devices
4161
 *
4162
 *	Kick the drive back into action, by sending it an idle immediate
4163
 *	command and making sure its transfer mode matches between drive
4164
 *	and host.
4165
 *
4166
 */
4167
int ata_device_resume(struct ata_port *ap, struct ata_device *dev)
4168
{
4169
	if (ap->flags & ATA_FLAG_SUSPENDED) {
4170
		ap->flags &= ~ATA_FLAG_SUSPENDED;
4171
		ata_set_mode(ap);
4172
	}
4173
	if (!ata_dev_present(dev))
4174
		return 0;
4175
	if (dev->class == ATA_DEV_ATA)
4176
		ata_start_drive(ap, dev);
4177
4178
	return 0;
4179
}
4180
4181
/**
4182
 *	ata_device_suspend - prepare a device for suspend
4183
 *
4184
 *	Flush the cache on the drive, if appropriate, then issue a
4185
 *	standbynow command.
4186
 *
4187
 */
4188
int ata_device_suspend(struct ata_port *ap, struct ata_device *dev)
4189
{
4190
	if (!ata_dev_present(dev))
4191
		return 0;
4192
	if (dev->class == ATA_DEV_ATA)
4193
		ata_flush_cache(ap, dev);
4194
4195
	ata_standby_drive(ap, dev);
4196
	ap->flags |= ATA_FLAG_SUSPENDED;
4197
	return 0;
4198
}
4199
4102
/**
4200
/**
4103
 *	ata_port_start - Set port up for dma.
4201
 *	ata_port_start - Set port up for dma.
4104
 *	@ap: Port to initialize
4202
 *	@ap: Port to initialize
Lines 4860-4865 int pci_test_config_bits(struct pci_dev Link Here
4860
4958
4861
	return (tmp == bits->val) ? 1 : 0;
4959
	return (tmp == bits->val) ? 1 : 0;
4862
}
4960
}
4961
4962
int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state)
4963
{
4964
	pci_save_state(pdev);
4965
	pci_disable_device(pdev);
4966
	pci_set_power_state(pdev, PCI_D3hot);
4967
	return 0;
4968
}
4969
4970
int ata_pci_device_resume(struct pci_dev *pdev)
4971
{
4972
	pci_set_power_state(pdev, PCI_D0);
4973
	pci_restore_state(pdev);
4974
	pci_enable_device(pdev);
4975
	pci_set_master(pdev);
4976
	return 0;
4977
}
4863
#endif /* CONFIG_PCI */
4978
#endif /* CONFIG_PCI */
4864
4979
4865
4980
Lines 4963-4966 EXPORT_SYMBOL_GPL(ata_pci_host_stop); Link Here
4963
EXPORT_SYMBOL_GPL(ata_pci_init_native_mode);
5078
EXPORT_SYMBOL_GPL(ata_pci_init_native_mode);
4964
EXPORT_SYMBOL_GPL(ata_pci_init_one);
5079
EXPORT_SYMBOL_GPL(ata_pci_init_one);
4965
EXPORT_SYMBOL_GPL(ata_pci_remove_one);
5080
EXPORT_SYMBOL_GPL(ata_pci_remove_one);
5081
EXPORT_SYMBOL_GPL(ata_pci_device_suspend);
5082
EXPORT_SYMBOL_GPL(ata_pci_device_resume);
4966
#endif /* CONFIG_PCI */
5083
#endif /* CONFIG_PCI */
5084
5085
EXPORT_SYMBOL_GPL(ata_device_suspend);
5086
EXPORT_SYMBOL_GPL(ata_device_resume);
5087
EXPORT_SYMBOL_GPL(ata_scsi_device_suspend);
5088
EXPORT_SYMBOL_GPL(ata_scsi_device_resume);
(-)linux-2.6.15-rc6-orig/drivers/scsi/libata-scsi.c (+16 lines)
Lines 396-401 void ata_dump_status(unsigned id, struct Link Here
396
	}
396
	}
397
}
397
}
398
398
399
int ata_scsi_device_resume(struct scsi_device *sdev)
400
{
401
	struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0];
402
	struct ata_device *dev = &ap->device[sdev->id];
403
404
	return ata_device_resume(ap, dev);
405
}
406
407
int ata_scsi_device_suspend(struct scsi_device *sdev)
408
{
409
	struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0];
410
	struct ata_device *dev = &ap->device[sdev->id];
411
412
	return ata_device_suspend(ap, dev);
413
}
414
399
/**
415
/**
400
 *	ata_to_sense_error - convert ATA error to SCSI error
416
 *	ata_to_sense_error - convert ATA error to SCSI error
401
 *	@id: ATA device number
417
 *	@id: ATA device number
(-)linux-2.6.15-rc6-orig/drivers/scsi/scsi_sysfs.c (-2 / +33 lines)
Lines 263-271 static int scsi_bus_match(struct device Link Here
263
	return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0;
263
	return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0;
264
}
264
}
265
265
266
static int scsi_bus_suspend(struct device * dev, pm_message_t state)
267
{
268
	struct scsi_device *sdev = to_scsi_device(dev);
269
	struct scsi_host_template *sht = sdev->host->hostt;
270
	int err;
271
272
	err = scsi_device_quiesce(sdev);
273
	if (err)
274
		return err;
275
276
	if (sht->suspend)
277
		err = sht->suspend(sdev);
278
279
	return err;
280
}
281
282
static int scsi_bus_resume(struct device * dev)
283
{
284
	struct scsi_device *sdev = to_scsi_device(dev);
285
	struct scsi_host_template *sht = sdev->host->hostt;
286
	int err = 0;
287
288
	if (sht->resume)
289
		err = sht->resume(sdev);
290
291
	scsi_device_resume(sdev);
292
	return err;
293
}
294
266
struct bus_type scsi_bus_type = {
295
struct bus_type scsi_bus_type = {
267
        .name		= "scsi",
296
	.name		= "scsi",
268
        .match		= scsi_bus_match,
297
	.match		= scsi_bus_match,
298
	.suspend	= scsi_bus_suspend,
299
	.resume		= scsi_bus_resume,
269
};
300
};
270
301
271
int scsi_sysfs_register(void)
302
int scsi_sysfs_register(void)
(-)linux-2.6.15-rc6-orig/include/linux/ata.h (+2 lines)
Lines 141-146 enum { Link Here
141
	ATA_CMD_PACKET		= 0xA0,
141
	ATA_CMD_PACKET		= 0xA0,
142
	ATA_CMD_VERIFY		= 0x40,
142
	ATA_CMD_VERIFY		= 0x40,
143
	ATA_CMD_VERIFY_EXT	= 0x42,
143
	ATA_CMD_VERIFY_EXT	= 0x42,
144
 	ATA_CMD_STANDBYNOW1	= 0xE0,
145
 	ATA_CMD_IDLEIMMEDIATE	= 0xE1,
144
	ATA_CMD_INIT_DEV_PARAMS	= 0x91,
146
	ATA_CMD_INIT_DEV_PARAMS	= 0x91,
145
147
146
	/* SETFEATURES stuff */
148
	/* SETFEATURES stuff */
(-)linux-2.6.15-rc6-orig/include/linux/libata.h (+7 lines)
Lines 123-128 enum { Link Here
123
					     * proper HSM is in place. */
123
					     * proper HSM is in place. */
124
	ATA_FLAG_DEBUGMSG	= (1 << 10),
124
	ATA_FLAG_DEBUGMSG	= (1 << 10),
125
	ATA_FLAG_NO_ATAPI	= (1 << 11), /* No ATAPI support */
125
	ATA_FLAG_NO_ATAPI	= (1 << 11), /* No ATAPI support */
126
	ATA_FLAG_SUSPENDED	= (1 << 12), /* port is suspended */
126
127
127
	ATA_QCFLAG_ACTIVE	= (1 << 1), /* cmd not yet ack'd to scsi lyer */
128
	ATA_QCFLAG_ACTIVE	= (1 << 1), /* cmd not yet ack'd to scsi lyer */
128
	ATA_QCFLAG_SG		= (1 << 3), /* have s/g table? */
129
	ATA_QCFLAG_SG		= (1 << 3), /* have s/g table? */
Lines 436-441 extern void ata_std_ports(struct ata_iop Link Here
436
extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
437
extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
437
			     unsigned int n_ports);
438
			     unsigned int n_ports);
438
extern void ata_pci_remove_one (struct pci_dev *pdev);
439
extern void ata_pci_remove_one (struct pci_dev *pdev);
440
extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state);
441
extern int ata_pci_device_resume(struct pci_dev *pdev);
439
#endif /* CONFIG_PCI */
442
#endif /* CONFIG_PCI */
440
extern int ata_device_add(const struct ata_probe_ent *ent);
443
extern int ata_device_add(const struct ata_probe_ent *ent);
441
extern void ata_host_set_remove(struct ata_host_set *host_set);
444
extern void ata_host_set_remove(struct ata_host_set *host_set);
Lines 445-450 extern int ata_scsi_queuecmd(struct scsi Link Here
445
extern int ata_scsi_error(struct Scsi_Host *host);
448
extern int ata_scsi_error(struct Scsi_Host *host);
446
extern int ata_scsi_release(struct Scsi_Host *host);
449
extern int ata_scsi_release(struct Scsi_Host *host);
447
extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
450
extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
451
extern int ata_scsi_device_resume(struct scsi_device *);
452
extern int ata_scsi_device_suspend(struct scsi_device *);
453
extern int ata_device_resume(struct ata_port *, struct ata_device *);
454
extern int ata_device_suspend(struct ata_port *, struct ata_device *);
448
extern int ata_ratelimit(void);
455
extern int ata_ratelimit(void);
449
456
450
/*
457
/*
(-)linux-2.6.15-rc6-orig/include/scsi/scsi_host.h (+6 lines)
Lines 296-301 struct scsi_host_template { Link Here
296
	int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int);
296
	int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int);
297
297
298
	/*
298
	/*
299
	 * suspend support
300
	 */
301
	int (*suspend)(struct scsi_device *);
302
	int (*resume)(struct scsi_device *);
303
304
	/*
299
	 * Name of proc directory
305
	 * Name of proc directory
300
	 */
306
	 */
301
	char *proc_name;
307
	char *proc_name;

Return to bug 118284