Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 133367
b: refs/heads/master
c: b0b3914
h: refs/heads/master
i:
  133365: d2c89b6
  133363: bc41764
  133359: fa93c01
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Mar 24, 2009
1 parent c787af8 commit e1cf312
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 48 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: 1f5892a5d21c905b1614cbd6bd8c5ad2cfbc106f
refs/heads/master: b0b391430bea405ced6038e4cf4d8cf831511935
71 changes: 24 additions & 47 deletions trunk/drivers/ide/ide-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
#include <acpi/acpi_bus.h>

#define REGS_PER_GTF 7
struct taskfile_array {
u8 tfa[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */
};

struct GTM_buffer {
u32 PIO_speed0;
Expand Down Expand Up @@ -284,43 +281,6 @@ static int do_drive_get_GTF(ide_drive_t *drive,
return err;
}

/**
* taskfile_load_raw - send taskfile registers to drive
* @drive: drive to which output is sent
* @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7)
*
* Outputs IDE taskfile to the drive.
*/
static int taskfile_load_raw(ide_drive_t *drive,
const struct taskfile_array *gtf)
{
ide_task_t args;
int err = 0;

DEBPRINT("(0x1f1-1f7): hex: "
"%02x %02x %02x %02x %02x %02x %02x\n",
gtf->tfa[0], gtf->tfa[1], gtf->tfa[2],
gtf->tfa[3], gtf->tfa[4], gtf->tfa[5], gtf->tfa[6]);

memset(&args, 0, sizeof(ide_task_t));

/* convert gtf to IDE Taskfile */
memcpy(&args.tf_array[7], &gtf->tfa, 7);
args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;

if (!ide_acpigtf) {
DEBPRINT("_GTF execution disabled\n");
return err;
}

err = ide_no_data_taskfile(drive, &args);
if (err)
printk(KERN_ERR "%s: ide_no_data_taskfile failed: %u\n",
__func__, err);

return err;
}

/**
* do_drive_set_taskfiles - write the drive taskfile settings from _GTF
* @drive: the drive to which the taskfile command should be sent
Expand All @@ -337,19 +297,36 @@ static int do_drive_set_taskfiles(ide_drive_t *drive,
int rc = 0, err;
int gtf_count = gtf_length / REGS_PER_GTF;
int ix;
struct taskfile_array *gtf;

DEBPRINT("total GTF bytes=%u (0x%x), gtf_count=%d, addr=0x%lx\n",
gtf_length, gtf_length, gtf_count, gtf_address);

/* send all taskfile registers (0x1f1-0x1f7) *in*that*order* */
for (ix = 0; ix < gtf_count; ix++) {
gtf = (struct taskfile_array *)
(gtf_address + ix * REGS_PER_GTF);

/* send all TaskFile registers (0x1f1-0x1f7) *in*that*order* */
err = taskfile_load_raw(drive, gtf);
if (err)
u8 *gtf = (u8 *)(gtf_address + ix * REGS_PER_GTF);
ide_task_t task;

DEBPRINT("(0x1f1-1f7): "
"hex: %02x %02x %02x %02x %02x %02x %02x\n",
gtf[0], gtf[1], gtf[2],
gtf[3], gtf[4], gtf[5], gtf[6]);

if (!ide_acpigtf) {
DEBPRINT("_GTF execution disabled\n");
continue;
}

/* convert GTF to taskfile */
memset(&task, 0, sizeof(ide_task_t));
memcpy(&task.tf_array[7], gtf, REGS_PER_GTF);
task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;

err = ide_no_data_taskfile(drive, &task);
if (err) {
printk(KERN_ERR "%s: ide_no_data_taskfile failed: %u\n",
__func__, err);
rc = err;
}
}

return rc;
Expand Down

0 comments on commit e1cf312

Please sign in to comment.