aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide-acpi.c71
1 files changed, 24 insertions, 47 deletions
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index ce5b213e2bc2..5b704f1ea90c 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -20,9 +20,6 @@
20#include <acpi/acpi_bus.h> 20#include <acpi/acpi_bus.h>
21 21
22#define REGS_PER_GTF 7 22#define REGS_PER_GTF 7
23struct taskfile_array {
24 u8 tfa[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */
25};
26 23
27struct GTM_buffer { 24struct GTM_buffer {
28 u32 PIO_speed0; 25 u32 PIO_speed0;
@@ -285,43 +282,6 @@ out:
285} 282}
286 283
287/** 284/**
288 * taskfile_load_raw - send taskfile registers to drive
289 * @drive: drive to which output is sent
290 * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7)
291 *
292 * Outputs IDE taskfile to the drive.
293 */
294static int taskfile_load_raw(ide_drive_t *drive,
295 const struct taskfile_array *gtf)
296{
297 ide_task_t args;
298 int err = 0;
299
300 DEBPRINT("(0x1f1-1f7): hex: "
301 "%02x %02x %02x %02x %02x %02x %02x\n",
302 gtf->tfa[0], gtf->tfa[1], gtf->tfa[2],
303 gtf->tfa[3], gtf->tfa[4], gtf->tfa[5], gtf->tfa[6]);
304
305 memset(&args, 0, sizeof(ide_task_t));
306
307 /* convert gtf to IDE Taskfile */
308 memcpy(&args.tf_array[7], &gtf->tfa, 7);
309 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
310
311 if (!ide_acpigtf) {
312 DEBPRINT("_GTF execution disabled\n");
313 return err;
314 }
315
316 err = ide_no_data_taskfile(drive, &args);
317 if (err)
318 printk(KERN_ERR "%s: ide_no_data_taskfile failed: %u\n",
319 __func__, err);
320
321 return err;
322}
323
324/**
325 * do_drive_set_taskfiles - write the drive taskfile settings from _GTF 285 * do_drive_set_taskfiles - write the drive taskfile settings from _GTF
326 * @drive: the drive to which the taskfile command should be sent 286 * @drive: the drive to which the taskfile command should be sent
327 * @gtf_length: total number of bytes of _GTF taskfiles 287 * @gtf_length: total number of bytes of _GTF taskfiles
@@ -337,19 +297,36 @@ static int do_drive_set_taskfiles(ide_drive_t *drive,
337 int rc = 0, err; 297 int rc = 0, err;
338 int gtf_count = gtf_length / REGS_PER_GTF; 298 int gtf_count = gtf_length / REGS_PER_GTF;
339 int ix; 299 int ix;
340 struct taskfile_array *gtf;
341 300
342 DEBPRINT("total GTF bytes=%u (0x%x), gtf_count=%d, addr=0x%lx\n", 301 DEBPRINT("total GTF bytes=%u (0x%x), gtf_count=%d, addr=0x%lx\n",
343 gtf_length, gtf_length, gtf_count, gtf_address); 302 gtf_length, gtf_length, gtf_count, gtf_address);
344 303
304 /* send all taskfile registers (0x1f1-0x1f7) *in*that*order* */
345 for (ix = 0; ix < gtf_count; ix++) { 305 for (ix = 0; ix < gtf_count; ix++) {
346 gtf = (struct taskfile_array *) 306 u8 *gtf = (u8 *)(gtf_address + ix * REGS_PER_GTF);
347 (gtf_address + ix * REGS_PER_GTF); 307 ide_task_t task;
348 308
349 /* send all TaskFile registers (0x1f1-0x1f7) *in*that*order* */ 309 DEBPRINT("(0x1f1-1f7): "
350 err = taskfile_load_raw(drive, gtf); 310 "hex: %02x %02x %02x %02x %02x %02x %02x\n",
351 if (err) 311 gtf[0], gtf[1], gtf[2],
312 gtf[3], gtf[4], gtf[5], gtf[6]);
313
314 if (!ide_acpigtf) {
315 DEBPRINT("_GTF execution disabled\n");
316 continue;
317 }
318
319 /* convert GTF to taskfile */
320 memset(&task, 0, sizeof(ide_task_t));
321 memcpy(&task.tf_array[7], gtf, REGS_PER_GTF);
322 task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
323
324 err = ide_no_data_taskfile(drive, &task);
325 if (err) {
326 printk(KERN_ERR "%s: ide_no_data_taskfile failed: %u\n",
327 __func__, err);
352 rc = err; 328 rc = err;
329 }
353 } 330 }
354 331
355 return rc; 332 return rc;