Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6250d3af authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz
Browse files

Merge branch 'for-linus' into for-next

parents 4c9773ed 075affcb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -216,6 +216,8 @@ Other kernel parameters for ide_core are:

* "noflush=[interface_number.device_number]" to disable flush requests

* "nohpa=[interface_number.device_number]" to disable Host Protected Area

* "noprobe=[interface_number.device_number]" to skip probing

* "nowerr=[interface_number.device_number]" to ignore the WRERR_STAT bit
+2 −5
Original line number Diff line number Diff line
@@ -835,11 +835,8 @@ and is between 256 and 4096 characters. It is defined in the file

	ide-core.nodma=	[HW] (E)IDE subsystem
			Format: =0.0 to prevent dma on hda, =0.1 hdb =1.0 hdc
			.vlb_clock .pci_clock .noflush .noprobe .nowerr .cdrom
			.chs .ignore_cable are additional options
			See Documentation/ide/ide.txt.

	idebus=		[HW] (E)IDE subsystem - VLB/PCI bus speed
			.vlb_clock .pci_clock .noflush .nohpa .noprobe .nowerr
			.cdrom .chs .ignore_cable are additional options
			See Documentation/ide/ide.txt.

	ide-pci-generic.all-generic-ide [HW] (E)IDE subsystem
+61 −10
Original line number Diff line number Diff line
@@ -302,13 +302,11 @@ static const struct drive_list_entry hpa_list[] = {
	{ NULL,		NULL }
};

static void idedisk_check_hpa(ide_drive_t *drive)
static u64 ide_disk_hpa_get_native_capacity(ide_drive_t *drive, int lba48)
{
	unsigned long long capacity, set_max;
	int lba48 = ata_id_lba48_enabled(drive->id);
	u64 capacity, set_max;

	capacity = drive->capacity64;

	set_max  = idedisk_read_native_max_address(drive, lba48);

	if (ide_in_drive_list(drive->id, hpa_list)) {
@@ -320,9 +318,31 @@ static void idedisk_check_hpa(ide_drive_t *drive)
			set_max--;
	}

	return set_max;
}

static u64 ide_disk_hpa_set_capacity(ide_drive_t *drive, u64 set_max, int lba48)
{
	set_max = idedisk_set_max_address(drive, set_max, lba48);
	if (set_max)
		drive->capacity64 = set_max;

	return set_max;
}

static void idedisk_check_hpa(ide_drive_t *drive)
{
	u64 capacity, set_max;
	int lba48 = ata_id_lba48_enabled(drive->id);

	capacity = drive->capacity64;
	set_max  = ide_disk_hpa_get_native_capacity(drive, lba48);

	if (set_max <= capacity)
		return;

	drive->probed_capacity = set_max;

	printk(KERN_INFO "%s: Host Protected Area detected.\n"
			 "\tcurrent capacity is %llu sectors (%llu MB)\n"
			 "\tnative  capacity is %llu sectors (%llu MB)\n",
@@ -330,14 +350,14 @@ static void idedisk_check_hpa(ide_drive_t *drive)
			 capacity, sectors_to_MB(capacity),
			 set_max, sectors_to_MB(set_max));

	set_max = idedisk_set_max_address(drive, set_max, lba48);
	if ((drive->dev_flags & IDE_DFLAG_NOHPA) == 0)
		return;

	if (set_max) {
		drive->capacity64 = set_max;
	set_max = ide_disk_hpa_set_capacity(drive, set_max, lba48);
	if (set_max)
		printk(KERN_INFO "%s: Host Protected Area disabled.\n",
				 drive->name);
}
}

static int ide_disk_get_capacity(ide_drive_t *drive)
{
@@ -358,6 +378,8 @@ static int ide_disk_get_capacity(ide_drive_t *drive)
		drive->capacity64 = drive->cyl * drive->head * drive->sect;
	}

	drive->probed_capacity = drive->capacity64;

	if (lba) {
		drive->dev_flags |= IDE_DFLAG_LBA;

@@ -376,7 +398,7 @@ static int ide_disk_get_capacity(ide_drive_t *drive)
		       "%llu sectors (%llu MB)\n",
		       drive->name, (unsigned long long)drive->capacity64,
		       sectors_to_MB(drive->capacity64));
		drive->capacity64 = 1ULL << 28;
		drive->probed_capacity = drive->capacity64 = 1ULL << 28;
	}

	if ((drive->hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) &&
@@ -392,6 +414,34 @@ static int ide_disk_get_capacity(ide_drive_t *drive)
	return 0;
}

static u64 ide_disk_set_capacity(ide_drive_t *drive, u64 capacity)
{
	u64 set = min(capacity, drive->probed_capacity);
	u16 *id = drive->id;
	int lba48 = ata_id_lba48_enabled(id);

	if ((drive->dev_flags & IDE_DFLAG_LBA) == 0 ||
	    ata_id_hpa_enabled(id) == 0)
		goto out;

	/*
	 * according to the spec the SET MAX ADDRESS command shall be
	 * immediately preceded by a READ NATIVE MAX ADDRESS command
	 */
	capacity = ide_disk_hpa_get_native_capacity(drive, lba48);
	if (capacity == 0)
		goto out;

	set = ide_disk_hpa_set_capacity(drive, set, lba48);
	if (set) {
		/* needed for ->resume to disable HPA */
		drive->dev_flags |= IDE_DFLAG_NOHPA;
		return set;
	}
out:
	return drive->capacity64;
}

static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
{
	ide_drive_t *drive = q->queuedata;
@@ -740,6 +790,7 @@ static int ide_disk_set_doorlock(ide_drive_t *drive, struct gendisk *disk,

const struct ide_disk_ops ide_ata_disk_ops = {
	.check		= ide_disk_check,
	.set_capacity	= ide_disk_set_capacity,
	.get_capacity	= ide_disk_get_capacity,
	.setup		= ide_disk_setup,
	.flush		= ide_disk_flush,
+14 −0
Original line number Diff line number Diff line
@@ -287,6 +287,19 @@ static int ide_gd_media_changed(struct gendisk *disk)
	return ret;
}

static unsigned long long ide_gd_set_capacity(struct gendisk *disk,
					      unsigned long long capacity)
{
	struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj);
	ide_drive_t *drive = idkp->drive;
	const struct ide_disk_ops *disk_ops = drive->disk_ops;

	if (disk_ops->set_capacity)
		return disk_ops->set_capacity(drive, capacity);

	return drive->capacity64;
}

static int ide_gd_revalidate_disk(struct gendisk *disk)
{
	struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj);
@@ -315,6 +328,7 @@ static struct block_device_operations ide_gd_ops = {
	.locked_ioctl		= ide_gd_ioctl,
	.getgeo			= ide_gd_getgeo,
	.media_changed		= ide_gd_media_changed,
	.set_capacity		= ide_gd_set_capacity,
	.revalidate_disk	= ide_gd_revalidate_disk
};

+11 −0
Original line number Diff line number Diff line
@@ -33,6 +33,16 @@ static int ide_generic_all; /* Set to claim all devices */
module_param_named(all_generic_ide, ide_generic_all, bool, 0444);
MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers.");

static void netcell_quirkproc(ide_drive_t *drive)
{
	/* mark words 85-87 as valid */
	drive->id[ATA_ID_CSF_DEFAULT] |= 0x4000;
}

static const struct ide_port_ops netcell_port_ops = {
	.quirkproc		= netcell_quirkproc,
};

#define DECLARE_GENERIC_PCI_DEV(extra_flags) \
	{ \
		.name		= DRV_NAME, \
@@ -74,6 +84,7 @@ static const struct ide_port_info generic_chipsets[] __devinitdata = {

	{	/* 6: Revolution */
		.name		= DRV_NAME,
		.port_ops	= &netcell_port_ops,
		.host_flags	= IDE_HFLAG_CLEAR_SIMPLEX |
				  IDE_HFLAG_TRUST_BIOS_FOR_DMA |
				  IDE_HFLAG_OFF_BOARD,
Loading