Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 114181
b: refs/heads/master
c: be3c096
h: refs/heads/master
i:
  114179: d79ae75
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Oct 13, 2008
1 parent bf80d42 commit 3d50579
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 35c137531245118962eb40a550661afe317bec03
refs/heads/master: be3c096ebdbe3c828aacb5473751a22840753eff
34 changes: 19 additions & 15 deletions trunk/drivers/ide/ide-disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,19 @@ static int set_nowerr(ide_drive_t *drive, int arg)
return 0;
}

static int ide_do_setfeature(ide_drive_t *drive, u8 feature, u8 nsect)
{
ide_task_t task;

memset(&task, 0, sizeof(task));
task.tf.feature = feature;
task.tf.nsect = nsect;
task.tf.command = ATA_CMD_SET_FEATURES;
task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;

return ide_no_data_taskfile(drive, &task);
}

static void update_ordered(ide_drive_t *drive)
{
u16 *id = drive->id;
Expand Down Expand Up @@ -619,19 +632,14 @@ ide_devset_get(wcache, wcache);

static int set_wcache(ide_drive_t *drive, int arg)
{
ide_task_t args;
int err = 1;

if (arg < 0 || arg > 1)
return -EINVAL;

if (ata_id_flush_enabled(drive->id)) {
memset(&args, 0, sizeof(ide_task_t));
args.tf.feature = arg ?
SETFEATURES_WC_ON : SETFEATURES_WC_OFF;
args.tf.command = ATA_CMD_SET_FEATURES;
args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
err = ide_no_data_taskfile(drive, &args);
err = ide_do_setfeature(drive,
arg ? SETFEATURES_WC_ON : SETFEATURES_WC_OFF, 0);
if (err == 0)
drive->wcache = arg;
}
Expand All @@ -658,18 +666,14 @@ ide_devset_get(acoustic, acoustic);

static int set_acoustic(ide_drive_t *drive, int arg)
{
ide_task_t args;

if (arg < 0 || arg > 254)
return -EINVAL;

memset(&args, 0, sizeof(ide_task_t));
args.tf.feature = arg ? SETFEATURES_AAM_ON : SETFEATURES_AAM_OFF;
args.tf.nsect = arg;
args.tf.command = ATA_CMD_SET_FEATURES;
args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
ide_no_data_taskfile(drive, &args);
ide_do_setfeature(drive,
arg ? SETFEATURES_AAM_ON : SETFEATURES_AAM_OFF, arg);

drive->acoustic = arg;

return 0;
}

Expand Down

0 comments on commit 3d50579

Please sign in to comment.